Conversion List

BlitzMax Forums/BlitzMax Programming/Conversion List

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

@Perturbatio,
am I right to assume that the 'Global LastX' declaration in the function is like a VB static variable ? That is, a variable which is set to 0 only the very first time that function is called, and then it preserves the last value ?

Using the Perturbatio code, you can even make your own class (that is, type) with BMax, or a module if you like, and put in all the B3D functions you need:
Type B3D
Function DrawBlock(Image:TImage, x#, y#, frame:Int=0)
	Local oldBlend = GetBlend()
	SetBlend(SOLIDBLEND)
	DrawImage(Image, X, Y, frame)
	SetBlend oldBlend
End Function
 

'MouseXSpeed, MouseYSpeed and MouseZSpeed:
Function MouseXSpeed:Int()
	Global lastX:Int =0
	Local result:Int = MouseX()-lastX
	lastX = MouseX()	
	Return result
End Function


Function MouseYSpeed:Int()
	Global lastY:Int =0
	Local result:Int = MouseY()-lastY
	lastY = MouseY()	
	Return result
End Function


Function MouseZSpeed:Int()
	Global lastZ:Int =0
	Local result:Int = MouseZ()-lastZ
	lastZ = MouseZ()	
	Return result
End Function

end type
Then you can call each function using just one statement (because they are functions, then you do not need to create an instance of the type):
B3D.Drawblock(myimage,x,y)


Sergio.