Hi,
I?m programming a little app for windows platforms.
I?m using a 512x384 res.
When I?m executing the app, the mouse cannot leave the game window borders.
I?ve checked my code and I?m not drawing the mouse in any weird way.
is this the usual behaviour in windowed applications or am I missing something?
Mine leaves the window okay - the only time it wont is if you keep resetting the mouse position.
Sorry, can you explain it a bit? I dont catch you.
If you are refering to setmouse, Im not using it in the code...
Can you show a slimmed down version of the code that reproduces this?
Of course, mates.
SETSCREEN 512,384,0
GOSUB main
FUNCTION DrawMouse:
MOUSESTATE mx, my, b1, b2
PRINT "<=", mx, my
IF b1 THEN END
ENDFUNCTION
SUB main:
WHILE TRUE // Endless loop
DrawMouse()
SHOWSCREEN
WEND
ENDSUB
QuoteIf you are refering to setmouse, Im not using it in the code...
No, but you are using MOUSESTATE which only works when the mouse pointer is within a window.
Activate the systempointer, and you'll see that MOUSESTATE limits its position to within said window :
SETSCREEN 512,384,0
SYSTEMPOINTER TRUE
GOSUB main
FUNCTION DrawMouse:
MOUSESTATE mx, my, b1, b2
PRINT "<=", mx, my
IF b1 THEN END
ENDFUNCTION
SUB main:
WHILE TRUE // Endless loop
DrawMouse()
SHOWSCREEN
WEND
ENDSUB
You'll notice that the mouse pointer can move freely outside the window, but your PRINT statement will stay within the window.
If you use SYSTEMPOINTER TRUE
You wont need to draw your mouse....youll have the windows mouse on top.
You still need to use mouse position detection though:
MOUSEAXIS or MOUSESTATE
Many thanks mates.
I was not understanding correctly how it works.
Now is solved. =D