Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Clearing the input buffer

Author
Message
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 2nd Jul 2016 08:16
Hi all! Quick question... Is it possible to somehow clear the input buffer before moving on? On my main menu I'm using if (GetPointerPressed() = 1) to recognize that the play button has been hit, and that works fine. But then, when it moves on to the main game, it then executes a tap in the same spot my finger was when I tapped on the menu. I tried the obvious:



But that's not working. It just locks the whole game up for some reason... Any ideas?
Thestroyer
8
Years of Service
User Offline
Joined: 14th May 2016
Location:
Posted: 2nd Jul 2016 10:14
I don't know a way to clear the input buffer, but you can do it in another way.
If you are in the menu and you press, you make a variable 1.
Then if you are in the main game every time you check if the pointer is pressed you also check if that variable = 0 and then execute what happens when you press.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Jul 2016 11:02
GetPointerPressed() only triggers once,and then resets until the next press. It takes a sync() to reset it. You may be checking the pointer press a second time without syncing in between.
You can do a really quick test by throwing in an extra sync() after you process the menu option.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 2nd Jul 2016 11:55
Button presses I've found should only be with GetPointerReleased() anyway.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Jul 2016 16:22 Edited at: 2nd Jul 2016 16:23
I use both, for different purposes...

Released - for menus and options. Here you need to give the user the ability to press, change their mind and move the cursor away from the button pressed before letting go to cancel the action.
Pressed - for in-game activity, where reactions are critical and the user expects the pressing action to carry out the action.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 2nd Jul 2016 17:35
Quote: "I use both, for different purposes.."

That's what I meant.
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 3rd Jul 2016 09:59
It was the Sync that did it! Thanks so much BatVink!

Login to post a reply

Server time is: 2024-09-29 15:28:25
Your offset time is: 2024-09-29 15:28:25