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 / Help me!

Author
Message
Helper
15
Years of Service
User Offline
Joined: 2nd Oct 2009
Location:
Posted: 3rd Oct 2009 03:32
This should display 100 different words (only two distinct word right now), and for each word, wait for the user to press the up or down arrow key. If they press up, say "You Won.", if they press down, say "You Fail.", and either way increase a variable which indicates which word to print. Oh, and, if within 5 seconds, no key is pressed, then go on to the next word. It works nothing like it should. Please help me! Oh, and it is written in DarkGDK on Visual C++ 2008 Express.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 3rd Oct 2009 14:52
1. If you don't use break statements in your switch structures, then several of the "case" branches will be executed, because execution "falls through" to the next branch. Insert the breaks.



Same for the other switch.


2. This is not the proper way to time a program:



When a sleep (or wait) statement is executed, the program will halt for that amount of time, so it cannot react to keypresses, cannot update the screen, it doesn't do anything. Use a proper timer. The dbTimer() function is what you need.

Login to post a reply

Server time is: 2024-11-25 00:33:20
Your offset time is: 2024-11-25 00:33:20