Re: [Dev-C++] Help with Game Problem
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Robson B. <rob...@su...> - 2003-03-12 00:43:29
|
Have you tried allegro game library (compatible with Dev-C++)? With allegro you have some great stuff to make games. Try www.talula.demon.co.uk and click the link to allegro library. Below a brief example of how to set interrupt handlers to manage game timing with allegro and c++. It makes a very stable timing: Hope it helps! // this boolean variable prevents from jumping for the next game step before the time expected; volatile bool doInterrupt; void refresh() { doInterrupt = false; } END_OF_FUNCTION(refresh) void doGame() { do { doInterrupt = true; //sets another step //game stuff while(doInterrupt); //while doInterrup is true, the game does not advance for the next step. //this interval is set by the argument in the Install_Int funtion (in miliseconds). } while(!key[KEY_ESC]); } // this function sets an interrupt handler calling function 'refresh()' every 50ms. Install_int(refresh, 50); |