26 #include "../../engine/Util/Config.h" 39 typedef std::shared_ptr<UiHandler> UiHandlerPtr;
41 namespace HoverScript {
45 typedef std::shared_ptr<SessionPeer> SessionPeerPtr;
53 typedef std::shared_ptr<Rulebook> RulebookPtr;
67 CRITICAL_SECTION mMutex;
72 static unsigned long __stdcall Loop(LPVOID pThread);
74 GameThread(GameApp * pApp);
78 static GameThread *New(GameApp * pApp);
84 class GameApp :
public GameDirector
86 typedef GameDirector SUPER;
90 enum eViewMode { e3DView, eDebugView };
96 HWND mBadVideoModeDlg;
98 VideoServices::VideoBuffer *mVideoBuffer;
100 Observer *observers[MAX_OBSERVERS];
101 bool nonInteractiveShutdown;
102 HighObserver *highObserver;
103 HoverScript::HighConsole *highConsole;
104 IntroMovie *introMovie;
105 FullscreenTest *fullscreenTest;
106 Script::Core *scripting;
107 HoverScript::GamePeer *gamePeer;
108 HoverScript::SysEnv *sysEnv;
109 ClientSession *mCurrentSession;
110 HoverScript::SessionPeerPtr sessionPeer;
111 GameThread *mGameThread;
112 RulebookPtr requestedNewSession;
114 std::shared_ptr<UiInput> uiInput;
116 eViewMode mCurrentMode;
120 BOOL mPaletteChangeAllowed;
122 BOOL mServerHasChanged;
125 time_t mNbFramesStartingTime;
129 bool mustCheckUpdates;
131 static LRESULT CALLBACK DispatchFunc(HWND pWindow, UINT pMsgId, WPARAM pWParam, LPARAM pLParam);
132 static BOOL CALLBACK BadModeDialogFunc(HWND pWindow, UINT pMsgId, WPARAM pWParam, LPARAM pLParam);
134 BOOL CreateMainWindow();
135 bool CreateMainMenu();
138 bool SetVideoMode(
int pX,
int pY,
const std::string *monitor=NULL,
140 void RefreshTitleBar();
142 void PollController();
143 int ReadAsyncInputControllerPlayer(
int playerIdx);
144 void ReadAsyncInputController();
148 void NewLocalSession(RulebookPtr rules=RulebookPtr());
149 void NewSplitSession(
int pSplitPlayers);
150 void NewNetworkSession(BOOL pIsServer);
151 void NewInternetSession();
153 virtual void RequestShutdown();
160 void OnDisplayChange();
163 void PauseGameThread();
164 void RestartGameThread();
166 void DeleteMovieWnd();
168 void DrawBackground();
170 void UpdateMenuItems();
177 BOOL IsGameRunning();
178 int AskUserToAbortGame();
180 static void TrackOpenFailMessageBox(HWND parent,
const std::string &name,
const std::string &details);
182 Control::InputEventController* controller;
185 GameApp(HINSTANCE pInstance,
bool safeMode);
188 BOOL IsFirstInstance()
const;
190 BOOL InitApplication();
195 virtual void SignalServerHasChanged() { mServerHasChanged = TRUE; }
196 virtual void ChangeAutoUpdates(
bool newSetting) { mustCheckUpdates = newSetting; }
197 virtual void AssignPalette();
199 virtual VideoServices::VideoBuffer *GetVideoBuffer()
const {
return mVideoBuffer; }
201 virtual Control::InputEventController *GetController()
const {
return controller; }
202 virtual Control::InputEventController *ReloadController();
204 virtual HWND GetWindowHandle()
const {
return mMainWindow; }
207 static void NewInternetSessionCall();
213 #endif // ifndef WITH_SDL
MR_DllDeclare void Clean() noexcept
Must be called at the end of the program.
Definition: DllObjectFactory.cpp:63
Definition: Announcement.h:24
static const int MAX_PLAYERS
Definition: Config.h:289