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 / Coin Flip help

Years of Service
User Offline
Joined: 31st Mar 2013
Posted: 31st Mar 2013 21:09
So anyone on. I'm not receiving any errors for this but can't seem to even get pass the "press any key to continue" screen

// include the Dark GDK header file (
#include "DarkGDK.h"

//Global Variables
int number = -1;
const int HEADS = 0;
const int TAILS = 1;
const int spriteFlip = 3;
const int coinFlipSprite= 3;
const int headsSprite = 1;
const int tailsSprite = 1;
const int coinX = 320;
const int coinY = 240;

//Function prototypes
void setUp();
void coinToss();

// main entry point for the application
void DarkGDK ( void )
dbSetWindowTitle("Coin Toss");

setUp(); // The setup function.
coinToss(); //The coinToss function

dbPrint("Welcome to the coin toss. Press any key to start the game!");

//Waits for the user to press any key.

coinToss(); //The coinToss function

// our main game loop
while ( LoopGDK ( ) )

// update the contents of the screen
dbSync ( );

// return back to Windows

void setUp()
// Load the images.
dbLoadImage("Heads.bmp", HEADS);
dbLoadImage("Tails.bmp", TAILS);

//Constant for the refresh rate.
const int REFRESH_RATE = 60;

//Seed the random number generator.
dbRandomize(dbTimer() );

//Disable auto refresh and set the refresh rate.

void coinToss()
number = dbRND(1);
Years of Service
User Offline
Joined: 2nd Jan 2013
Posted: 2nd Apr 2013 15:18
It actually does get past the dbWaitKey() function, it's just that because no sprites/3d is drawn during the dbSync(), DGDK doesn't clear the screen every refresh, so it is keeping "Welcome to the coin toss. Press any key to start the game!" on the backbuffer.

Use dbCLS() to clear the screen during the game loop

Login to post a reply

Server time is: 2023-12-03 04:06:29
Your offset time is: 2023-12-03 04:06:29