-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgapp.h
87 lines (69 loc) · 2.24 KB
/
gapp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//-----------------------------------------------------------------------------
// File: gApp
// Desc: main entrance of Battle City Lan
// Auth: Lyp
// Date: 2003/11/13
//
// Copyright (c) 1985-2003 CTCRST Entertainment All rights reserved.
//-----------------------------------------------------------------------------
#ifndef _BC_APP_H_
#define _BC_APP_H_
#pragma once
class CDisplay;
class CDirectInput;
class CDirectSound;
class CResMgr;
class CZoneObjSnapshot;
class CSession;
class CGame;
class CTitle;
//-----------------------------------------------------------------------------
// class capp
//-----------------------------------------------------------------------------
class CApp:public Trunk<CApp>
{
public:
CDisplay* GetDisplay() { return m_pDisplay; }
CDirectInput* GetDInput() { return m_pDirectInput; }
CDirectSound* GetDSound() { return m_pDirectSound; }
CResMgr* GetResMgr() { return m_pResMgr; }
CGame* GetGame() { return m_pGame; }
CSession* GetSession() { return m_pSession; }
CZoneObjSnapshot* GetSnapshot() { return m_pSnapshot; }
bool Initialize( HINSTANCE hInst );
int MainLoop();
void SetSpeedup() { m_bSpeedup = true; }
void SetSlowdown() { m_bSlowdown = true; }
DWORD GetGameFreq() { return m_dwGameFreq; }
bool IsServer() { return m_bServer; }
CApp();
~CApp();
private:
HINSTANCE m_hInst;
HWND m_hWnd;
bool m_bActive;
bool m_bFullScreen;
bool m_bServer;
bool m_bGameStarted;
LARGE_INTEGER m_qWinFreq; // 高精度计时器频率
LARGE_INTEGER m_qWinTick; // 高精度计时器Tick
LARGE_INTEGER m_qLastWinTick; // 高精度计时器Tick
LARGE_INTEGER m_qWinTickPerGameTick;
DWORD m_dwGameFreq; // 游戏主循环频率
bool m_bSpeedup; // 是否服务器要求加速主循环
bool m_bSlowdown; // 减速
CDisplay* m_pDisplay;
CDirectInput* m_pDirectInput;
CDirectSound* m_pDirectSound;
CResMgr* m_pResMgr;
CZoneObjSnapshot* m_pSnapshot;
CSession* m_pSession;
CGame* m_pGame;
CTitle* m_pTitle;
bool InitWindow();
bool InitSupport();
void DestroySupport();
void BackToSplash(); // exit current game
LRESULT MsgProc( HWND, UINT, WPARAM, LPARAM );
};
#endif // _BC_APP_H_