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.

Dark GDK / The Easiest Question you could ever answer... I promise

Author
Message
sonshuma
11
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 25th Feb 2013 05:34
I'm hoping this is the correct place to ask this. If its not I'm really sorry and I ask any moderators to move it to the correct place.

I'm working on a game Project for a class. I could play the worlds smallest violin but, to be honest, I'm dumb and deleted my entire project (Which was complete) and I had to reconstruct it from scratch... which I have done but now I'm not getting something to work like it has in the past.

My professor requires us to check if space key it being pressed and if it is continue (instead of dbWaitKey)... otherwise pause the game. This sounds simple like creating a function with a while loop that if dbSpaceKey == 0, repeats blank.... this is how I THOUGHT I originally had it but thats not working. I'm sure I'm just duressed and missing something completely obvious... so if someone could humor me and look at my code and tell me what I'm doing wrong I would be ever grateful and my brain would thank you forever...


-----------------------------------------------------------

Just call it wherever I need the check with spaceKeyCheck() when I need a pause....
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 25th Feb 2013 11:19
Maybe try putting a dbSync() inside the while loop. I guess that's needed to update the key state. And you didn't put brackets after the dbSpaceKey() function call, but I guess that's just because you were posting some pseudo code and won't compile anyway.



Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 1st Mar 2013 13:40 Edited at: 1st Mar 2013 13:40
Quote: "Maybe try putting a dbSync() inside the while loop. I guess that's needed to update the key state."

It shouldn't be.

Writing while( dbSpaceKey == 0 ) ... might actually compile; it would then translate into comparing the function pointer to null (which it will never be). I would think a sophisticated compiler should at least throw an implicit cast warning if you gave it that though.


"Why do programmers get Halloween and Christmas mixed up?"
Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 1st Mar 2013 15:54 Edited at: 1st Mar 2013 15:54
Quote: "Writing while( dbSpaceKey == 0 ) ... might actually compile; it would then translate into comparing the function pointer to null (which it will never be). I would think a sophisticated compiler should at least throw an implicit cast warning if you gave it that though."


This exactly. But to be more precise:
is always false because you forgot the "()" parenthesis and it is checking to see if the function is NULL aka doesn't exist (which, of course, it does).

So slab some parenthesis on there and its fixed.

P.S. I responded because I don't know if Rudolpho was clear enough

Ventures of the worlds around us are limited only by our imagination.
sonshuma
11
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 31st Mar 2013 22:34
I completely forgot to ever reply to this and say "Thank you" to everyone who responded. It did fix the issue by adding the ().

Login to post a reply

Server time is: 2024-03-29 07:39:08
Your offset time is: 2024-03-29 07:39:08