MouseX and Y to Canvas?!

BlitzMax Forums/MaxGUI Module/MouseX and Y to Canvas?!

BLaBZ(Posted 2010) [#1]
I have a Max2D canvas displaying my game, how would I go about feeding the input into the canvas?


GaryV(Posted 2010) [#2]
http://www.blitzbasic.com/bmdocs/command.php?name=CreateCanvas&ref=gui_cat


explosive(Posted 2010) [#3]
Hi BLaBZ,

it's quite simple actually. Check for EVENT_MOUSEMOVE and store the values given by EventX() and EventY() in global variables. Eg:

global canvasx:int, canvasy:int
repeat
event=waitevent()
source=eventsource()
select event
case EVENT_MOUSEMOVE and source=yourcanvas
canvasx=eventx()
canvasy=eventy()
end select
forever


You can then use canvasx and canvasy all over you code as synonyms to Mousex() and MouseY().