Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Game Class Reference

#include <Game.h>

Inheritance diagram for Game:
StarServer Starshatter

List of all members.

Public Types

enum  STATUS {
  OK, RUN, EXIT, PANIC,
  INIT_FAILED, TOO_MANY
}

Public Member Functions

 Game ()
virtual ~Game ()
virtual bool Init (HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
virtual int Run ()
virtual void Exit ()
virtual bool OnPaint ()
virtual bool OnHelp ()
virtual void Activate (bool f)
virtual void Pause (bool f)
int Status () const
virtual void ScreenCapture (const char *name=0)
virtual void AVICapture (const char *fname=0)
const RenderStatsGetPolyStats ()
virtual bool GameLoop ()
virtual void UpdateWorld ()
virtual void GameState ()
virtual void UpdateScreen ()
virtual void CollectStats ()
virtual bool InitApplication (HINSTANCE)
virtual bool InitInstance (HINSTANCE, int)
virtual bool InitContent ()
virtual bool InitGame ()
virtual bool InitVideo ()
virtual bool ResizeVideo ()
virtual bool ResetVideo ()
virtual bool ToggleFullscreen ()
virtual bool AdjustWindowForChange ()
virtual bool SetupPalette ()
virtual bool LoadPalette (PALETTEENTRY *pal, BYTE *inv)
virtual void ShowStats ()

Static Public Member Functions

static const char * TYPENAME ()
static void Panic (const char *msg=0)
static bool DisplayModeSupported (int w, int h, int bpp)
static int MaxTexSize ()
static int MaxTexAspect ()
static int GammaLevel ()
static void SetGammaLevel (int g)
static void SetMaxTexSize (int n)
static DWORD RealTime ()
static DWORD GameTime ()
static DWORD TimeCompression ()
static void SetTimeCompression (DWORD comp)
static DWORD Frame ()
static void ResetGameTime ()
static void SkipGameTime (double seconds)
static double FrameRate ()
static double FrameTime ()
static double GUITime ()
static void SetMaxFrameLength (double seconds)
static void SetMinFrameLength (double seconds)
static double GetMaxFrameLength ()
static double GetMinFrameLength ()
static GameGetInstance ()
static VideoGetVideo ()
static Color GetScreenColor ()
static void SetScreenColor (Color c)
static int GetScreenWidth ()
static int GetScreenHeight ()
static bool Active ()
static bool Paused ()
static bool Server ()
static bool ShowMouse ()
static bool IsWindowed ()
static HINSTANCE GetHINST ()
static HWND GetHWND ()
static void UseLocale (Locale *locale)
static Text GetText (const char *key)
static const char * GetPanicMessage ()

Protected Attributes

ContentBundlecontent
Universeworld
VideoFactoryvideo_factory
Videovideo
VideoSettingsvideo_settings
SoundCardsoundcard
Screenscreen
int gamma
int max_tex_size
RenderStats stats
DWORD totaltime
PALETTEENTRY standard_palette [256]
BYTE inverse_palette [32768]
HINSTANCE hInst
HWND hwnd
HMENU hmenu
DWORD winstyle
char * app_name
char * title_text
char * palette_name
bool is_windowed
bool is_active
bool is_device_lost
bool is_minimized
bool is_maximized
bool ignore_size_change
bool is_device_initialized
bool is_device_restored
DWORD window_style
RECT bounds_rect
RECT client_rect
double gui_seconds
double seconds
double frame_rate
int frame_count
int frame_count0
int frame_time
int frame_time0
int status
int exit_code
Color screen_color
AviFileavi_file

Static Protected Attributes

static bool active = false
static bool paused = false
static bool server = false
static bool show_mouse = false
static DWORD base_game_time = 0
static DWORD real_time = 0
static DWORD game_time = 0
static DWORD time_comp = 1
static DWORD frame_number = 0
static double max_frame_length = MAX_FRAME_TIME_NORMAL
static double min_frame_length = MIN_FRAME_TIME_NORMAL
static char panicbuf [256]

Friends

bool ProfileGameLoop (void)
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM uParam, LPARAM lParam)

Detailed Description

Definition at line 46 of file Game.h.


Member Enumeration Documentation

Enumerator:
OK 
RUN 
EXIT 
PANIC 
INIT_FAILED 
TOO_MANY 

Definition at line 50 of file Game.h.


Constructor & Destructor Documentation

Game::Game ( )

Definition at line 65 of file Game.cpp.

Game::~Game ( )
virtual

Definition at line 92 of file Game.cpp.


Member Function Documentation

void Game::Activate ( bool  f)
virtual

Definition at line 882 of file Game.cpp.

static bool Game::Active ( )
inlinestatic

Definition at line 109 of file Game.h.

bool Game::AdjustWindowForChange ( )
virtual

Definition at line 652 of file Game.cpp.

void Game::AVICapture ( const char *  fname = 0)
virtual

Definition at line 1148 of file Game.cpp.

void Game::CollectStats ( )
virtual

Definition at line 1206 of file Game.cpp.

bool Game::DisplayModeSupported ( int  w,
int  h,
int  bpp 
)
static

Definition at line 205 of file Game.cpp.

void Game::Exit ( )
virtual

Reimplemented in Starshatter.

Definition at line 859 of file Game.cpp.

DWORD Game::Frame ( )
static

Definition at line 1561 of file Game.cpp.

double Game::FrameRate ( )
static

Definition at line 211 of file Game.cpp.

double Game::FrameTime ( )
static

Definition at line 220 of file Game.cpp.

bool Game::GameLoop ( )
virtual

Reimplemented in Starshatter, and StarServer.

Definition at line 915 of file Game.cpp.

void Game::GameState ( )
virtual

Reimplemented in Starshatter, and StarServer.

Definition at line 993 of file Game.cpp.

DWORD Game::GameTime ( )
static

Definition at line 1545 of file Game.cpp.

int Game::GammaLevel ( )
static

Definition at line 150 of file Game.cpp.

HINSTANCE Game::GetHINST ( )
static

Definition at line 112 of file Game.cpp.

HWND Game::GetHWND ( )
static

Definition at line 120 of file Game.cpp.

Game * Game::GetInstance ( )
static

Reimplemented in Starshatter, and StarServer.

Definition at line 1042 of file Game.cpp.

static double Game::GetMaxFrameLength ( )
inlinestatic

Definition at line 99 of file Game.h.

static double Game::GetMinFrameLength ( )
inlinestatic

Definition at line 100 of file Game.h.

static const char* Game::GetPanicMessage ( )
inlinestatic

Definition at line 121 of file Game.h.

const RenderStats& Game::GetPolyStats ( )
inline

Definition at line 72 of file Game.h.

Color Game::GetScreenColor ( )
static

Definition at line 1057 of file Game.cpp.

int Game::GetScreenHeight ( )
static

Reimplemented in Starshatter.

Definition at line 1086 of file Game.cpp.

int Game::GetScreenWidth ( )
static

Reimplemented in Starshatter.

Definition at line 1077 of file Game.cpp.

Text Game::GetText ( const char *  key)
static

Definition at line 139 of file Game.cpp.

Video * Game::GetVideo ( )
static

Definition at line 1048 of file Game.cpp.

double Game::GUITime ( )
static

Definition at line 229 of file Game.cpp.

bool Game::Init ( HINSTANCE  hi,
HINSTANCE  hpi,
LPSTR  cmdline,
int  nCmdShow 
)
virtual

Reimplemented in Starshatter, and StarServer.

Definition at line 240 of file Game.cpp.

bool Game::InitApplication ( HINSTANCE  hInstance)
virtual

Definition at line 303 of file Game.cpp.

bool Game::InitContent ( )
virtual

Definition at line 727 of file Game.cpp.

bool Game::InitGame ( )
virtual

Reimplemented in Starshatter, and StarServer.

Definition at line 678 of file Game.cpp.

bool Game::InitInstance ( HINSTANCE  hInstance,
int  nCmdShow 
)
virtual

Definition at line 342 of file Game.cpp.

bool Game::InitVideo ( )
virtual

Definition at line 432 of file Game.cpp.

bool Game::IsWindowed ( )
static

Definition at line 128 of file Game.cpp.

bool Game::LoadPalette ( PALETTEENTRY *  pal,
BYTE *  inv 
)
virtual

Definition at line 783 of file Game.cpp.

int Game::MaxTexAspect ( )
static

Definition at line 185 of file Game.cpp.

int Game::MaxTexSize ( )
static

Definition at line 170 of file Game.cpp.

virtual bool Game::OnHelp ( )
inlinevirtual

Reimplemented in Starshatter.

Definition at line 63 of file Game.h.

virtual bool Game::OnPaint ( )
inlinevirtual

Reimplemented in StarServer.

Definition at line 62 of file Game.h.

void Game::Panic ( const char *  msg = 0)
static

Definition at line 866 of file Game.cpp.

void Game::Pause ( bool  f)
virtual

Definition at line 893 of file Game.cpp.

static bool Game::Paused ( )
inlinestatic

Definition at line 110 of file Game.h.

DWORD Game::RealTime ( )
static

Definition at line 1540 of file Game.cpp.

void Game::ResetGameTime ( )
static

Definition at line 1566 of file Game.cpp.

bool Game::ResetVideo ( )
virtual

Definition at line 469 of file Game.cpp.

bool Game::ResizeVideo ( )
virtual

Reimplemented in Starshatter.

Definition at line 523 of file Game.cpp.

int Game::Run ( )
virtual

Definition at line 828 of file Game.cpp.

void Game::ScreenCapture ( const char *  name = 0)
virtual

Definition at line 1097 of file Game.cpp.

static bool Game::Server ( )
inlinestatic

Definition at line 111 of file Game.h.

void Game::SetGammaLevel ( int  g)
static

Definition at line 159 of file Game.cpp.

static void Game::SetMaxFrameLength ( double  seconds)
inlinestatic

Definition at line 97 of file Game.h.

void Game::SetMaxTexSize ( int  n)
static

Definition at line 198 of file Game.cpp.

static void Game::SetMinFrameLength ( double  seconds)
inlinestatic

Definition at line 98 of file Game.h.

void Game::SetScreenColor ( Color  c)
static

Definition at line 1066 of file Game.cpp.

void Game::SetTimeCompression ( DWORD  comp)
static

Definition at line 1555 of file Game.cpp.

bool Game::SetupPalette ( )
virtual

Definition at line 770 of file Game.cpp.

static bool Game::ShowMouse ( )
inlinestatic

Definition at line 112 of file Game.h.

void Game::ShowStats ( )
virtual

Definition at line 1234 of file Game.cpp.

void Game::SkipGameTime ( double  seconds)
static

Definition at line 1571 of file Game.cpp.

int Game::Status ( ) const
inline

Definition at line 67 of file Game.h.

DWORD Game::TimeCompression ( )
static

Definition at line 1550 of file Game.cpp.

bool Game::ToggleFullscreen ( )
virtual

Definition at line 572 of file Game.cpp.

static const char* Game::TYPENAME ( )
inlinestatic

Definition at line 49 of file Game.h.

void Game::UpdateScreen ( )
virtual

Definition at line 1000 of file Game.cpp.

void Game::UpdateWorld ( )
virtual

Reimplemented in Starshatter, and StarServer.

Definition at line 966 of file Game.cpp.

void Game::UseLocale ( Locale locale)
static

Definition at line 754 of file Game.cpp.


Friends And Related Function Documentation

bool ProfileGameLoop ( void  )
friend

Definition at line 909 of file Game.cpp.

LRESULT CALLBACK WndProc ( HWND  hwnd,
UINT  message,
WPARAM  uParam,
LPARAM  lParam 
)
friend

Definition at line 1273 of file Game.cpp.


Member Data Documentation

bool Game::active = false
staticprotected

Definition at line 200 of file Game.h.

char* Game::app_name
protected

Definition at line 168 of file Game.h.

AviFile* Game::avi_file
protected

Definition at line 198 of file Game.h.

DWORD Game::base_game_time = 0
staticprotected

Definition at line 204 of file Game.h.

RECT Game::bounds_rect
protected

Definition at line 182 of file Game.h.

RECT Game::client_rect
protected

Definition at line 183 of file Game.h.

ContentBundle* Game::content
protected

Definition at line 147 of file Game.h.

int Game::exit_code
protected

Definition at line 195 of file Game.h.

int Game::frame_count
protected

Definition at line 189 of file Game.h.

int Game::frame_count0
protected

Definition at line 190 of file Game.h.

DWORD Game::frame_number = 0
staticprotected

Definition at line 208 of file Game.h.

double Game::frame_rate
protected

Definition at line 188 of file Game.h.

int Game::frame_time
protected

Definition at line 191 of file Game.h.

int Game::frame_time0
protected

Definition at line 192 of file Game.h.

DWORD Game::game_time = 0
staticprotected

Definition at line 206 of file Game.h.

int Game::gamma
protected

Definition at line 154 of file Game.h.

double Game::gui_seconds
protected

Definition at line 186 of file Game.h.

HINSTANCE Game::hInst
protected

Definition at line 163 of file Game.h.

HMENU Game::hmenu
protected

Definition at line 165 of file Game.h.

HWND Game::hwnd
protected

Definition at line 164 of file Game.h.

bool Game::ignore_size_change
protected

Definition at line 178 of file Game.h.

BYTE Game::inverse_palette[32768]
protected

Definition at line 161 of file Game.h.

bool Game::is_active
protected

Definition at line 174 of file Game.h.

bool Game::is_device_initialized
protected

Definition at line 179 of file Game.h.

bool Game::is_device_lost
protected

Definition at line 175 of file Game.h.

bool Game::is_device_restored
protected

Definition at line 180 of file Game.h.

bool Game::is_maximized
protected

Definition at line 177 of file Game.h.

bool Game::is_minimized
protected

Definition at line 176 of file Game.h.

bool Game::is_windowed
protected

Definition at line 173 of file Game.h.

double Game::max_frame_length = MAX_FRAME_TIME_NORMAL
staticprotected

Definition at line 210 of file Game.h.

int Game::max_tex_size
protected

Definition at line 155 of file Game.h.

double Game::min_frame_length = MIN_FRAME_TIME_NORMAL
staticprotected

Definition at line 211 of file Game.h.

char* Game::palette_name
protected

Definition at line 170 of file Game.h.

char Game::panicbuf
staticprotected

Definition at line 213 of file Game.h.

bool Game::paused = false
staticprotected

Definition at line 201 of file Game.h.

DWORD Game::real_time = 0
staticprotected

Definition at line 205 of file Game.h.

Screen* Game::screen
protected

Definition at line 153 of file Game.h.

Color Game::screen_color
protected

Definition at line 196 of file Game.h.

double Game::seconds
protected

Definition at line 187 of file Game.h.

bool Game::server = false
staticprotected

Definition at line 202 of file Game.h.

bool Game::show_mouse = false
staticprotected

Definition at line 203 of file Game.h.

SoundCard* Game::soundcard
protected

Definition at line 152 of file Game.h.

PALETTEENTRY Game::standard_palette[256]
protected

Definition at line 160 of file Game.h.

RenderStats Game::stats
protected

Definition at line 157 of file Game.h.

int Game::status
protected

Definition at line 194 of file Game.h.

DWORD Game::time_comp = 1
staticprotected

Definition at line 207 of file Game.h.

char* Game::title_text
protected

Definition at line 169 of file Game.h.

DWORD Game::totaltime
protected

Definition at line 158 of file Game.h.

Video* Game::video
protected

Definition at line 150 of file Game.h.

VideoFactory* Game::video_factory
protected

Definition at line 149 of file Game.h.

VideoSettings* Game::video_settings
protected

Definition at line 151 of file Game.h.

DWORD Game::window_style
protected

Definition at line 181 of file Game.h.

DWORD Game::winstyle
protected

Definition at line 166 of file Game.h.

Universe* Game::world
protected

Definition at line 148 of file Game.h.


The documentation for this class was generated from the following files: