I tried searching but couldn't find an answer.
How would I use a DarkGDK function in a class, so not within void DarkGDK (void) { ... }?
For example:
class Application {
public:
Application() { }
Application( int sw, int sh, int sd, int sr ) {
this->screen_width = sw;
this->screen_height = sh;
this->screen_depth = sd;
dbSetDisplayMode( sw, sh, 32 );
dbSyncOn();
dbSyncRate( sr );
}
protected:
int screen_width, screen_height, screen_depth, sync_rate, mouse_x, mouse_y, mouse_click;
};
--------------------------
// DarkGDK
#include "DarkGDK.h"
// Application
#include "Application.h"
Application app( 1280, 1024, 32, 60 );
void DarkGDK( void ) {
dbSyncOn();
dbSyncRate( app.getSyncRate() );
while( LoopGDK() ) {
dbSync();
}
return;
}
The program crashes unless I remove db commands in the Application constructor.
DarkGDK is good