Leistungsstarkes Game Framework
The game framework based on game framework by Woei Kae Chen
Loading...
Searching...
No Matches
mygame.h
Go to the documentation of this file.
1/*
2 * mygame.h: 本檔案儲遊戲本身的class的interface
3 * Copyright (C) 2002-2008 Woei-Kae Chen <wkc@csie.ntut.edu.tw>
4 *
5 * This file is part of game, a free game development framework for windows.
6 *
7 * game is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * game is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * 2004-03-02 V4.0
22 * 1. Add CGameStateInit, CGameStateRun, and CGameStateOver to
23 * demonstrate the use of states.
24 * 2005-09-13
25 * Rewrite the codes for CBall and CEraser.
26 * 2005-09-20 V4.2Beta1.
27 * 2005-09-29 V4.2Beta2.
28 * 2006-02-08 V4.2
29 * 1. Rename OnInitialUpdate() -> OnInit().
30 * 2. Replace AUDIO_CANYON as AUDIO_NTUT.
31 * 3. Add help bitmap to CGameStateRun.
32 * 2006-09-09 V4.3
33 * 1. Rename Move() and Show() as OnMove and OnShow() to emphasize that they are
34 * event driven.
35 * 2008-02-15 V4.4
36 * 1. Add namespace game_framework.
37 * 2. Replace the demonstration of animation as a new bouncing ball.
38 * 3. Use ShowInitProgress(percent) to display loading progress.
39*/
40
41
42namespace game_framework {
44 // Constants
46
47 enum AUDIO_ID { // 定義各種音效的編號
50 AUDIO_NTUT // 2
51 };
52
54 // 這個class為遊戲的遊戲開頭畫面物件
55 // 每個Member function的Implementation都要弄懂
57
58 class CGameStateInit : public CGameState {
59 public:
61 void OnInit(); // 遊戲的初值及圖形設定
62 void OnBeginState(); // 設定每次重玩所需的變數
63 void OnKeyUp(UINT, UINT, UINT); // 處理鍵盤Up的動作
64 void OnLButtonDown(UINT nFlags, CPoint point); // 處理滑鼠的動作
65 protected:
66 void OnShow(); // 顯示這個狀態的遊戲畫面
67 private:
68 CMovingBitmap logo; // csie的logo
69 };
70
72 // 這個class為遊戲的遊戲執行物件,主要的遊戲程式都在這裡
73 // 每個Member function的Implementation都要弄懂
75
76 class CGameStateRun : public CGameState {
77 public:
80 void OnBeginState(); // 設定每次重玩所需的變數
81 void OnInit(); // 遊戲的初值及圖形設定
82 void OnKeyDown(UINT, UINT, UINT);
83 void OnKeyUp(UINT, UINT, UINT);
84 void OnLButtonDown(UINT nFlags, CPoint point); // 處理滑鼠的動作
85 void OnLButtonUp(UINT nFlags, CPoint point); // 處理滑鼠的動作
86 void OnMouseMove(UINT nFlags, CPoint point); // 處理滑鼠的動作
87 void OnRButtonDown(UINT nFlags, CPoint point); // 處理滑鼠的動作
88 void OnRButtonUp(UINT nFlags, CPoint point); // 處理滑鼠的動作
89 protected:
90 void OnMove(); // 移動遊戲元素
91 void OnShow(); // 顯示這個狀態的遊戲畫面
92 };
93
95 // 這個class為遊戲的結束狀態(Game Over)
96 // 每個Member function的Implementation都要弄懂
98
99 class CGameStateOver : public CGameState {
100 public:
102 void OnBeginState(); // 設定每次重玩所需的變數
103 void OnInit();
104 protected:
105 void OnMove(); // 移動遊戲元素
106 void OnShow(); // 顯示這個狀態的遊戲畫面
107 private:
108 int counter; // 倒數之計數器
109 };
110
111}
Definition: gamecore.h:163
Definition: gamecore.h:128
Definition: mygame.h:58
void OnKeyUp(UINT, UINT, UINT)
Definition: mygame_initialize.cpp:39
void OnInit()
Definition: mygame_initialize.cpp:19
void OnShow()
Definition: mygame_initialize.cpp:49
void OnLButtonDown(UINT nFlags, CPoint point)
Definition: mygame_initialize.cpp:44
void OnBeginState()
Definition: mygame_initialize.cpp:35
Definition: mygame.h:99
void OnMove()
Definition: mygame_over.cpp:20
void OnInit()
Definition: mygame_over.cpp:29
void OnBeginState()
Definition: mygame_over.cpp:25
void OnShow()
Definition: mygame_over.cpp:48
Definition: mygame.h:76
void OnBeginState()
Definition: mygame_run.cpp:24
~CGameStateRun()
Definition: mygame_run.cpp:20
void OnKeyDown(UINT, UINT, UINT)
Definition: mygame_run.cpp:38
void OnLButtonDown(UINT nFlags, CPoint point)
Definition: mygame_run.cpp:48
void OnKeyUp(UINT, UINT, UINT)
Definition: mygame_run.cpp:43
void OnRButtonDown(UINT nFlags, CPoint point)
Definition: mygame_run.cpp:60
void OnInit()
Definition: mygame_run.cpp:33
void OnMove()
Definition: mygame_run.cpp:28
void OnRButtonUp(UINT nFlags, CPoint point)
Definition: mygame_run.cpp:64
void OnLButtonUp(UINT nFlags, CPoint point)
Definition: mygame_run.cpp:52
void OnShow()
Definition: mygame_run.cpp:68
void OnMouseMove(UINT nFlags, CPoint point)
Definition: mygame_run.cpp:56
Definition: gameutil.h:81
Definition: mygame.h:42
AUDIO_ID
Definition: mygame.h:47
@ AUDIO_NTUT
Definition: mygame.h:50
@ AUDIO_DING
Definition: mygame.h:48
@ AUDIO_LAKE
Definition: mygame.h:49