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 / [BUG]GetPointerPressed() is persistent (or is it goto that causes the problem?)

Author
Message
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 23rd Oct 2017 07:58
I've used GetPointerPressed() in many scenarios before and never had an issue but when used with goto (yes, i know. Please don't judge me!) it remains persistent.
I have some test code where I need a different resolution each time I run the code. I thought a simply goto would enable me to change the resolution at will whilst the code was running - It's the first time I've used goto in around 30 years but maybe I've finally found a valid use for goto but please let's not turn this into another thread about why goto and/or gosub should never be used!

Here's some simple test code:

That should simply run until the pointer is pressed, then change resolution and continue running again but when you click the pointer the code gets trapped in an endless loop of resolution changes. (Press F5 in the IDE to stop it)
Kevin Cross
20
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 23rd Oct 2017 09:53 Edited at: 23rd Oct 2017 09:56
Is this because you're not calling Sync() again before GetPointerPressed is checked?

Have you tried this?



EDIT: Just tried my version and it works on Windows
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 23rd Oct 2017 11:50
Ah yes, that would do it.
I suppose the pointer pressed flag has to be reset somewhere and during sync() is about the best place for it.

Thanks
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Oct 2017 12:40
Sorry, I have to re-write your code avoiding the use of goto..

Click here for VR Legend of Zelda stuff
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 24th Oct 2017 14:56
or maybe:

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Oct 2017 16:51
or
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.9.3) Radeon R7 265 : Mac mini OS High Sierra (10.13)

Login to post a reply

Server time is: 2024-04-25 22:12:29
Your offset time is: 2024-04-25 22:12:29