Engine
The Game Engine for Ian Parberry's "Introduction to Game Physics with Box2D"
 All Classes Files Functions Variables Pages
Functions | Variables
Main.cpp File Reference

Main file for Ian Parberry's game engine. More...

#include <windows.h>
#include <windowsx.h>
#include <process.h>
#include "defines.h"
#include "abort.h"
#include "tinyxml.h"
#include "debug.h"
#include "timer.h"
#include "sprite.h"
#include "sound.h"
#include "SpriteMan.h"
#include "..\My Game\resource.h"

Functions

TiXmlDocument g_xmlDocument (g_xmlFileName)
 TinyXML document for settings.
 
void ProcessFrame ()
 
void InitGame ()
 
void EndGame ()
 
BOOL KeyboardHandler (WPARAM keystroke)
 
LRESULT CALLBACK WindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
void LoadGameSettings ()
 
void InitXMLSettings ()
 
LRESULT CALLBACK DefaultWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
HWND CreateDefaultWindow (char *name, HINSTANCE hInstance, int nCmdShow)
 
int DefaultWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 

Variables

BOOL g_bActiveApp
 TRUE if this is the active application.
 
HWND g_HwndApp
 Application window handle.
 
HINSTANCE g_hInstance
 Application instance handle.
 
char g_szGameName []
 Name of this game.
 
int g_nScreenWidth
 Screen width.
 
int g_nScreenHeight
 Screen height.
 
char g_errMsg []
 Error message if we had to abort.
 
BOOL g_errorExit
 True if we had to abort.
 
const char * g_xmlFileName ="gamesettings.xml"
 Settings file name.
 
TiXmlElement * g_xmlSettings = NULL
 TinyXML element for settings tag.
 
CSoundManagerg_pSoundManager
 
CTimer g_cTimer
 The game timer.
 

Detailed Description

Main file for Ian Parberry's game engine.

Function Documentation

HWND CreateDefaultWindow ( char *  name,
HINSTANCE  hInstance,
int  nCmdShow 
)

Create a default window. Registers and creates a full screen window.

Parameters
namethe name of this application
hInstancehandle to the current instance of this application
nCmdShowspecifies how the window is to be shown
Returns
handle to the application window
LRESULT CALLBACK DefaultWindowProc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Default window procedure. Handler for messages from the Windows API.

Parameters
hwndwindow handle
messagemessage code
wParamparameter for message
lParamsecond parameter for message
Returns
0 if message is handled
int DefaultWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpCmdLine,
int  nCmdShow 
)

Default WinMain. The main entry point for this application should call this function first.

Parameters
hInstancehandle to the current instance of this application
hPrevInstanceunused
lpCmdLineunused
nCmdShowspecifies how the window is to be shown
Returns
TRUE if application terminates correctly
void InitXMLSettings ( )

Initialize XML settings. Opens an XML file and prepares to read settings from it. Settings tag is loaded to XML element g_xmlSettings for later processing. Aborts if it cannot load the file or cannot find settings tag in loaded file.

void LoadGameSettings ( )

Load game settings. Loads essential game settings from an xml file.