summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/Game.h
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-04-01 21:23:39 +0200
committerAki <please@ignore.pl>2022-04-01 21:23:39 +0200
commit3c487c5cd69c53d6fea948643c0a76df03516605 (patch)
tree72730c7b8b26a5ef8fc9a987ec4c16129efd5aac /StarsEx/Game.h
parent8f353abd0bfe18baddd8a8250ab7c4f2d1c83a6e (diff)
downloadstarshatter-3c487c5cd69c53d6fea948643c0a76df03516605.zip
starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.gz
starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.bz2
Moved Stars45 to StarsEx
Diffstat (limited to 'StarsEx/Game.h')
-rw-r--r--StarsEx/Game.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/StarsEx/Game.h b/StarsEx/Game.h
new file mode 100644
index 0000000..0a59197
--- /dev/null
+++ b/StarsEx/Game.h
@@ -0,0 +1,117 @@
+/* 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"
+#include "Screen.h"
+#include "Video.h"
+#include "VideoSettings.h"
+
+// +--------------------------------------------------------------------+
+
+class Universe;
+class Sound;
+class SoundCard;
+class Video;
+class VideoFactory;
+class Text;
+
+// +--------------------------------------------------------------------+
+
+class Game
+{
+public:
+ static const char* TYPENAME() { return "Game"; }
+ enum STATUS { OK, RUN, EXIT, INIT_FAILED, TOO_MANY };
+
+ 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 bool OnHelp() { return false; }
+
+ virtual void Activate(bool f);
+ virtual void Pause(bool f);
+ int Status() const { return status; }
+
+ const RenderStats& GetPolyStats() { return stats; }
+
+ //
+ // 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 bool GameLoop();
+ virtual void UpdateWorld();
+ virtual void GameState();
+ virtual void UpdateScreen();
+ virtual void CollectStats();
+
+ virtual bool InitGame();
+
+ virtual void ShowStats();
+
+protected:
+ Universe* world;
+ VideoFactory* video_factory;
+ Video* video;
+ VideoSettings* video_settings;
+ SoundCard* soundcard;
+ Screen* screen;
+
+ RenderStats stats;
+ DWORD totaltime;
+
+ HMENU hmenu;
+ DWORD winstyle;
+
+ char* app_name;
+ char* title_text;
+ char* palette_name;
+
+ // Internal variables for the state of the app
+ DWORD window_style; // Saved window style for mode switches
+ RECT bounds_rect; // Saved window bounds for mode switches
+ RECT client_rect; // Saved client area size for mode switches
+
+ int status;
+ int exit_code;
+
+ bool active;
+ bool paused;
+ bool server;
+ bool show_mouse;
+ DWORD frame_number;
+
+ double max_frame_length;
+};
+
+// +--------------------------------------------------------------------+
+
+#endif // Game_h