GLBasic forum

Main forum => Bug Reports => Topic started by: Moebius on 2010-Jul-25

Title: Mouse Movement only after Showscreen is called?
Post by: Moebius on 2010-Jul-25
Hello,
I'm not sure if this is the right place to post this, but it seems like a 'bug' to me and none of the other pages seem to really fit this.

It seems that the position of the mouse pointer is only updated when ShowScreen is called.  I'm not sure if this is intentional, but this example demonstrates it.  Hold the left button down to use showscreen.  Run it in debug mode:

Code (glbasic) Select
SYSTEMPOINTER TRUE

mbb = 0
mba = 1

WHILE mbb = 0

DEBUG mx + " " + my + " " + mba + " " + mbb + CHR$(10)

IF mba = 1
SHOWSCREEN
ENDIF

MOUSESTATE mx, my, mba, mbb

WEND

END



In addition, if the pointer is disabled, the cursor wont move while ShowScreen isn't being called.  If you want, you can try the following example.  Again, left click enables ShowScreen.  In this one, note that movement in between turning ShowScreen on and off isn't recognised:

Code (glbasic) Select
SHOWSCREEN

WHILE mbb = 0

MOUSESTATE mx, my, mba, mbb

PRINT mx, 10, 20
PRINT my, 10, 40
PRINT "<=", mx, my-8

IF mba = 1
SHOWSCREEN
ENDIF

WEND

END



Note:  I've run these examples using Keys instead of the left-click and the same thing happens.  Cursor movement is recognised when ShowScreen is called.
Title: Re: Mouse Movement only after Showscreen is called?
Post by: MrTAToad on 2010-Jul-25
Yes, mouse positions wont be updated without a SHOWSCREEN - likewise a mouse pointer wont move either.

SHOWSCREEN is needed to process window messages as well a screen flipping so not using it can causing problems (program not responding etc).

I dont see it as a bug though.
Title: Re: Mouse Movement only after Showscreen is called?
Post by: Moru on 2010-Jul-26
I would say it's more "working as designed" :-) Why do you need to not use SHOWSCREEN? You won't get anything displayed without showscreen. Not to mention lots of other things SHOWSCREEN does under the hood.
Title: Re: Mouse Movement only after Showscreen is called?
Post by: matchy on 2010-Jul-26
For SHOWSCREEN is required in every loop draw.  8)
There is no bug because there is no meaning to the code. What's trying to be achieved?
Title: Re: Mouse Movement only after Showscreen is called?
Post by: Moebius on 2010-Jul-26
okay - I was wondering whether it was a 'bug' or a 'feature' :)
I was getting my program to wait at a menu screen for the user to click on any of the buttons when I noticed this.  ShowScreen processing messages from Windows makes sense.  Thanks for the quick response.
Title: Re: Mouse Movement only after Showscreen is called?
Post by: Kitty Hello on 2010-Jul-26
But.. MOUSEAXIS(3) should be able to poll the left button statw w/o SHOWSCREEN.
Title: Re: Mouse Movement only after Showscreen is called?
Post by: Moebius on 2010-Jul-26
Button statuses seem to work without ShowScreen (whether you check them via MouseAxis or MouseState) but the pointer position isn't updated.
Title: Re: Mouse Movement only after Showscreen is called?
Post by: Kitty Hello on 2010-Jul-26
Yes. The reason is, that the mouse speed (MOUSEAXIS(0) ) is calculated from the relative mouse movement in one SHOWSCREEN step.
Title: Re: Mouse Movement only after Showscreen is called?
Post by: Moebius on 2010-Jul-27
Thought so.