Like this?
Your code had a few errors and, I hope, you understand that in this case button.handle_x/y will be returning 0.
The 'handle' is the drawpoint for the image (like a hotspot).For completeness sake :
If you're new to Bmax I strongly recommend you follow Beginner's Guide to Bmax , Learning 2D Game Programming With BlitzMax
and Learning Object-Oriented Programming in Blitzmax . There are a few other use tutorials as well.
Strict Graphics 640,480 Local button:TImage = LoadImage("max.png") While Not KeyHit(KEY_ESCAPE) Cls DrawImage button,200,34 DrawText button.handle_x + " " + button.handle_y,0,0 Flip Wend
Your code had a few errors and, I hope, you understand that in this case button.handle_x/y will be returning 0.
The 'handle' is the drawpoint for the image (like a hotspot).For completeness sake :
strict ' you need a graphics command before loading images graphics 640,80 ' You need to incbin and image before loading it from incbin incbin "images/button.jpg" Local button:TImage = LoadImage("incbin::images/button.jpg") local x:float,y:float ' This is getting the x/y offset applied to EVERY image loaded not just 'button'. Currently it is '0,0' gethandle(x,y) While Not KeyHit(KEY_ESCAPE) Cls ' Only needed for collisions but never mind. ResetCollisions DrawImage button,200,34 print button.handle_x + " " + button.handle_y ' There's not no 'Button.x() function 'drawtext button.X() and button.Y(),0,0 drawtext button.handle_x + " " + button.handle_y Flip Wend
If you're new to Bmax I strongly recommend you follow Beginner's Guide to Bmax , Learning 2D Game Programming With BlitzMax
and Learning Object-Oriented Programming in Blitzmax . There are a few other use tutorials as well.