/* Starshatter: The Open Source Project Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors Copyright (c) 1997-2006, Destroyer Studios LLC. AUTHOR: John DiCamillo */ #ifndef Game_h #define Game_h #include "Types.h" // +--------------------------------------------------------------------+ class Universe; // +--------------------------------------------------------------------+ class Game { public: static const char* TYPENAME() { return "Game"; } enum STATUS { OK, RUN, EXIT, INIT_FAILED, TOO_MANY }; enum MODE { MENU_MODE, CLOD_MODE, CMPN_MODE, PREP_MODE, PLAN_MODE, LOAD_MODE, PLAY_MODE, EXIT_MODE, }; Game(); virtual ~Game(); // // MAIN GAME FUNCTIONALITY: // virtual bool Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow); virtual int Run(); virtual void Exit(); virtual bool OnPaint() { return false; } virtual int GetGameMode() const { return game_mode; } virtual void SetGameMode(int mode) { game_mode = mode; } virtual void Activate(bool f); virtual void Pause(bool f); int Status() const { return status; } // // GENERAL GAME CLASS UTILITY METHODS: // static Game* GetInstance(); DWORD Frame(); void SetMaxFrameLength(double seconds) { max_frame_length = seconds; } double GetMaxFrameLength() { return max_frame_length; } bool Active() { return active; } bool Paused() { return paused; } bool Server() { return server; } bool ShowMouse() { return show_mouse; } virtual void PumpEvents(); virtual void GameLoop(); virtual void UpdateWorld(); virtual void GameState(); virtual void UpdateScreen(); virtual bool InitGame(); protected: Universe* world; int status; int exit_code; int game_mode; bool active; bool paused; bool server; bool show_mouse; DWORD frame_number; double max_frame_length; }; // +--------------------------------------------------------------------+ #endif // Game_h