WORD getWSmallIcon() const {
return m_wSmallIcon;
}
};
#endif /* GAMEENGINE_H_ */
11 个解决方案
#1
/*
* GameEngine.cpp
*
* Created on: 2015年1月21日
*
*/
#include "GameEngine.h"
GameEngine *GameEngine::m_pGameEngine = NULL;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
int iCmdShow) {
MSG msg;
static int iTickTrigger = 0;
int iTickCount;
if (GameInitialize(hInstance)) {
if (!GameEngine::GetEngine()->Initialize(iCmdShow)) {
return FALSE;
}
while (true) {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} else {
if (!GameEngine::GetEngine()->getBSleep()) {
iTickCount = GetTickCount();
if (iTickCount > iTickTrigger) {
iTickTrigger = iTickCount;
GameEngine::GetEngine()->getIFrameDelay();
GameCycle();
}
}
}
}
return (int) msg.wParam;
}
GameEnd();
return TRUE;
}
LRESULT GameEngine::HandleEvent(HWND hWindow,UINT msg,WPARAM wParam, LPARAM lParam){
switch(msg){
case WM_CREATE:
setHWindow(hWindow);
GameStart(hWindow);
return 0;
case WM_SETFOCUS:
GameActivate(hWindow);
setBSleep(FALSE);
return 0;
case WM_KILLFOCUS:
GameDeactivate(hWindow);
setBSleep(TRUE);
return 0;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC = BeginPaint(hWindow,&ps);
GamePaint(hDC);
EndPaint(hWindow,&ps);
return 0;
case WM_DESTROY:
GameEnd();
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWindow,msg,wParam,lParam);
}
#2
15:27:07 **** Incremental Build of configuration Debug for project game ****
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o GameEngine.o "..\\GameEngine.cpp"
g++ -o game.exe GameEngine.o
GameEngine.o: In function `ZN10GameEngine10setHWindowEP6HWND__':
H:/workspace/game/Debug/../GameEngine.h:(.text+0xd): undefined reference to `GameInitialize(HINSTANCE__*)'
H:/workspace/game/Debug/../GameEngine.h:(.text+0xb1): undefined reference to `GameCycle()'
H:/workspace/game/Debug/../GameEngine.h:(.text+0xc0): undefined reference to `GameEnd()'
GameEngine.o: In function `ZN10GameEngine11HandleEventEP6HWND__jjl':
H:/workspace/game/Debug/../GameEngine.cpp:114: undefined reference to `GameStart(HWND__*)'
H:/workspace/game/Debug/../GameEngine.cpp:117: undefined reference to `GameActivate(HWND__*)'
H:/workspace/game/Debug/../GameEngine.cpp:121: undefined reference to `GameDeactivate(HWND__*)'
H:/workspace/game/Debug/../GameEngine.cpp:128: undefined reference to `GamePaint(HDC__*)'
H:/workspace/game/Debug/../GameEngine.cpp:132: undefined reference to `GameEnd()'
collect2: ld returned 1 exit status
/*
* GameEngine.cpp
*
* Created on: 2015年1月21日
*
*/
#include "GameEngine.h"
GameEngine *GameEngine::m_pGameEngine = NULL;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
int iCmdShow) {
MSG msg;
static int iTickTrigger = 0;
int iTickCount;
if (GameInitialize(hInstance)) {
if (!GameEngine::GetEngine()->Initialize(iCmdShow)) {
return FALSE;
}
while (true) {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} else {
if (!GameEngine::GetEngine()->getBSleep()) {
iTickCount = GetTickCount();
if (iTickCount > iTickTrigger) {
iTickTrigger = iTickCount;
GameEngine::GetEngine()->getIFrameDelay();
GameCycle();
}
}
}
}
return (int) msg.wParam;
}
GameEnd();
return TRUE;
}
LRESULT GameEngine::HandleEvent(HWND hWindow,UINT msg,WPARAM wParam, LPARAM lParam){
switch(msg){
case WM_CREATE:
setHWindow(hWindow);
GameStart(hWindow);
return 0;
case WM_SETFOCUS:
GameActivate(hWindow);
setBSleep(FALSE);
return 0;
case WM_KILLFOCUS:
GameDeactivate(hWindow);
setBSleep(TRUE);
return 0;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC = BeginPaint(hWindow,&ps);
GamePaint(hDC);
EndPaint(hWindow,&ps);
return 0;
case WM_DESTROY:
GameEnd();
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWindow,msg,wParam,lParam);
}
#2
15:27:07 **** Incremental Build of configuration Debug for project game ****
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o GameEngine.o "..\\GameEngine.cpp"
g++ -o game.exe GameEngine.o
GameEngine.o: In function `ZN10GameEngine10setHWindowEP6HWND__':
H:/workspace/game/Debug/../GameEngine.h:(.text+0xd): undefined reference to `GameInitialize(HINSTANCE__*)'
H:/workspace/game/Debug/../GameEngine.h:(.text+0xb1): undefined reference to `GameCycle()'
H:/workspace/game/Debug/../GameEngine.h:(.text+0xc0): undefined reference to `GameEnd()'
GameEngine.o: In function `ZN10GameEngine11HandleEventEP6HWND__jjl':
H:/workspace/game/Debug/../GameEngine.cpp:114: undefined reference to `GameStart(HWND__*)'
H:/workspace/game/Debug/../GameEngine.cpp:117: undefined reference to `GameActivate(HWND__*)'
H:/workspace/game/Debug/../GameEngine.cpp:121: undefined reference to `GameDeactivate(HWND__*)'
H:/workspace/game/Debug/../GameEngine.cpp:128: undefined reference to `GamePaint(HDC__*)'
H:/workspace/game/Debug/../GameEngine.cpp:132: undefined reference to `GameEnd()'
collect2: ld returned 1 exit status