Happy the code is helpful. I never even opened the projects included with the Dark GDK download, so I wasn’t sure it would help. Here is the Main.cpp to dodger, don’t know how that got missed.
/*
===========================================
Project: Space Dodger
Created: January 25, 2012
Version: 1.0.0
By: WickedX Software
Description: C++ Dark GDK
source code.
===========================================
*/
#include "DarkGDK.h"
#include "globstruct.h"
#include "dodger.h"
#include <time.h>
HWND g_hWnd;
char g_gameflag;
bool g_fntInstalled;
DWORD g_score;
char g_lives;
CBackdrop* g_Background = new CBackdrop[2];
CBarrier* g_Barrier = new CBarrier[2];
void DarkGDK ( void )
{
Initialize ( );
NewGame ( );
InitObjects ( );
while ( LoopGDK ( ) )
{
dbText (16, 456, "score: " );
for ( int i = 0; i < 2; i++ )
{
g_Background[i].ShowBackdrop ( );
g_Barrier[i].ShowBarrier ( );
if ( g_hWnd == GetActiveWindow ( ) )
{
g_Background[i].MoveBackdrop ( );
g_Barrier[i].MoveBarrier ( );
}
}
dbSync ( );
if ( dbScreenInvalid ( ) )
LoadMedia ( );
}
if ( !g_fntInstalled )
UnloadFont( "earth.ttf" );
delete [] g_Background;
delete [] g_Barrier;
return;
}
void Initialize ( )
{
SetWindow ( );
dbSetImageColorKey ( 255, 0, 255 );
g_fntInstalled = FontLoaded( "earth" );
if ( !g_fntInstalled )
LoadFont( "earth.ttf" );
LoadMedia ( );
dbSyncOn ( );
dbBackdropOn ( );
g_gameflag = 1;
int iScnInvalid = dbScreenInvalid ( );
srand( ( unsigned ) time ( NULL ) );
//dbDisableEscapeKey ( );
}
void NewGame ( )
{
g_score = 0;
g_lives = 3;
}
bool FontLoaded ( char* FontName )
{
FontName = dbUpper( FontName );
void dbPerformCheckListForFonts ( );
for ( int i = 1; i = dbChecklistQuantity ( ); i++ )
{
if ( dbUpper ( dbChecklistString ( i ) ) == FontName )
return true;
}
return false;
}
void LoadFont ( char* FontFile )
{
int result = AddFontResourceA ( FontFile );
}
void UnloadFont ( char* FontFile )
{
RemoveFontResourceA ( FontFile );
}
void SetWindow ( )
{
DWORD dwStyle;
g_hWnd = g_pGlob->hWnd;
// Get the style properties of your window.
dwStyle = GetWindowLong( g_hWnd, GWL_STYLE );
dwStyle &= ~( WS_MAXIMIZEBOX|WS_SIZEBOX );
// set the window style without maximizebox and sizebox
SetWindowLong( g_hWnd, GWL_STYLE, dwStyle );
dbSetWindowTitle ( "Space Dodger" );
dbSetDisplayModeVSync ( 640, 480, dbScreenDepth ( ), 1 );
}
void LoadMedia ( )
{
if ( !dbImageExist ( 1 ) )
{
dbColorBackdrop ( 0 );
dbSetTextFont ( "earth" );
dbSetTextSize ( 24 );
dbLoadImage ( "media\\bdsky.png", 1, 1 );
dbLoadImage ( "media\\bdground.png", 2, 1 );
dbCreateAnimatedSprite ( 1, "media\\flame.bmp", 14, 1, 3 );
dbCloneSprite ( 1, 2 );
}
}
void InitObjects ( )
{
g_Background[0].InitBackdrop ( 1, 0, 1 );
g_Background[1].InitBackdrop ( 2, 320, 4 );
g_Barrier[0].InitBarrier ( 1, 3, 0, 16 );
g_Barrier[1].InitBarrier ( 2, 3, 416, 16 );
}