Article Index
Introduction
Game Engine
Game Logic
Bitmap Font
Sprites
The CCavern Method
Level Files
Sound And Input
Class Summary
Modding

Game Engine

The application entry point is in file WinApp.cpp. This is actually not a class file. It contains window initialization the window event handler,  and basically initializes game engine class.

The Game engine class CGameEngine is inside GameEngine.cpp and GameEngine.h files.  It is responsible for DirectDraw initialization
and surface initialization.

Surface, in terms of DirectX, is a memory area, in which DirectDraw application can store and manipulate 2D images. TheDr Dobbs game engine uses surfaces to store game graphics (i.e. tile, sprites, fonts).

Inside the CGameEngine::Init() method there is a section, which defines surfaces and links them with bitmap resources:

if (!DDCreateSurface( 240, 240, IDB_HEROS ))
 return false;
if (!DDCreateSurface( 168, 288, IDB_GFXSET1 ))
 return false;
if (!DDCreateSurface( 144, 384, IDB_GFXSET2 ))
 return false;
if (!DDCreateSurface( 360, 168, IDB_GFXSET3 ))
 return false;
 ...


This section of code defines that bitmap and surface identified by IDB_HEROS constant. Located in the application resource, it is 240 pixels wide, and 240 pixels high.




DDJ