Hi
Im an intermediate C++ programmer and I've started learning how to use the Dark GDK. As I started writing some code I always had the problem that images weren't drawn as they should be.
Here you can see a very simple code. Everything works nicely until I call dbSetWindowOff() and dbSetDisplayMode(...). If I do, the screen remains black without any change.
It works very well though if i comment out these two function calls.
#include "DarkGDK.h"
void DarkGDK ( void )
{
const int BACKGROUND_IMG = 1;
const int PLAYER_IMG = 2;
int x = 40; // x coordinate of the player
int y = 40; // y coordinate of the player
// images are loaded
dbLoadImage( "earth.png", BACKGROUND_IMG );
dbSetImageColorKey( 0, 255, 0);
dbLoadImage( "player.bmp", PLAYER_IMG );
dbSprite( PLAYER_IMG, x, y, PLAYER_IMG );
//dbSetWindowOff();
//dbSetDisplayMode( 640, 900, 32 );
dbSyncOn ( );
dbSyncRate ( 60 );
while ( LoopGDK() )
{
dbPasteImage( BACKGROUND_IMG, 0, 0);
dbSprite( PLAYER_IMG, x, y, PLAYER_IMG );
if( dbUpKey() )
y -= 5;
if( dbDownKey() )
y += 5;
if( dbLeftKey() )
x -= 5;
if( dbRightKey() )
x += 5;
dbSync();
}
return;
}
Have you any idea what could be wrong? As far as I know I use these two functions correctly.