FlushMouse/Touch?

Monkey Forums/Monkey Programming/FlushMouse/Touch?

Dabz(Posted 2014) [#1]
I'm using Diddy, have two screens, one a title screen, and one the main game, when I use MouseHit() in the title screen, it carries over into the main game screen, which, I dont want the game running straight away, want a little "Get Ready" (So you can have a little look at the game map), which waits for another mouse hit before the game commences, but because the title screen hit is carried over, it fires the game off yickety split?

I dont want to use keys, which will obviously not interfere with mouse presses...

e.g (p-code)



Dabz


Gerry Quinn(Posted 2014) [#2]
Best to set a flag, I think. My basic framework app has this in OnUpdate()


There's a splashTapped:Bool field in the app which is false at the start. While it's false, the splash screen is rendered. The user's first tap sets it true and then sets justHit to false so the hit gets ignored, and on the next update the game window (because isOptions also starts false) begins to get updated and drawn.


Dabz(Posted 2014) [#3]
Got over it, just knocked up a little mousebuttonstate class and a global. not neat, but works:-



Using the p-code above:-



Should be easy to knock in the right mouse button, but, I'm only interested in one! :)

Dabz


Paul - Taiphoz(Posted 2014) [#4]
At the moment with Hex and just for speed I have a smaller timer which I trigger when moving from one diddy screen to another, I use this to ignore any interaction code, its just long enough to stop the false detection from one screen to another and gives the result time to expire.


Paul - Taiphoz(Posted 2014) [#5]
Dabz you could expand that to hold all interactions in a queue, and track the x,y position and possible the diddy screen the interaction was innitiated on as well, then in your update go through the queue and check each node.

A mouse click on the intro screen would then store its x,y,intro_scr and your main game loop when it looks through the queue could clear out anything thats not game_scr and act on anything that is.

I might have a bash at that later actually and replace my timer code.


therevills(Posted 2014) [#6]
In Diddy, there is a FlushKeys command which also flushes the Mouse Buttons ;)


Paul - Taiphoz(Posted 2014) [#7]
does that flush touch as well ?


Volker(Posted 2014) [#8]
Yes.


therevills(Posted 2014) [#9]
Actually Monkey has a FlushKeys command built into Monkey these days called "ResetInput", which Diddy now wraps with FlushKeys.

Only just remembered about that one... must be getting old!


Paul - Taiphoz(Posted 2014) [#10]
Had no idea that was there either, damn I wish monkey had better docs. :( but thanks for that little tidbit of info therevills.


Pierrou(Posted May) [#11]
I've been trying to work around a similar problem for a while today, and then I found this thread. Thanks therevills!! Indeed updating the docs would be a good idea..