Simply drawing a float value

BlitzMax Forums/BlitzMax Beginners Area/Simply drawing a float value

I don't think that function has anything to do with DrawText, but there is a logic error in your function.
ATan only returns correct info when both x_length and y_length are either positive or negative. You need to use the ATan2 function to correct for this. The way to use it is ATan2(y,x). Notice that the y parameter is first, not the x like you would expect. This is to keep consistency with the ATan(y/x) function. It will also return a value between -180 and 180. 0 points right, -values turn counterclockwise, and +values turn clockwise. If you want 0-360, you can either add 180 to the return value, which makes 0 point left instead of right, or you can do something like If Angle < 0 then Angle :+ 360.
To see it in action, try this program out
Graphics 800,600,32

Local MX:Int, MY:Int, Angle:Float

While Not KeyHit(KEY_ESCAPE)
	MX = MouseX()
	MY = MouseY()
	
	Cls
	DrawLine(400,300,MX,MY)
	
	Angle = ATan2(MY-300,MX-400)

	DrawText "Angle = "+Angle,10,10
	
	Flip
Wend