?? main.cpp
字號:
//main.cpp
#include <windows.h>
#include <crtdbg.h>
#include "DirectWnd.h"
#include "Sound.h"
#include "Midi.h"
#include "Game.h"
LRESULT CALLBACK WinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
//*******************************************************************
//應用程序入口
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
CDirectWnd *win;
CGame *game;
CSound *sound;
CMidi *midi;
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); // 檢測內存泄漏
//初始化主窗口
win = new CDirectWnd(hInstance,nCmdShow);
if (!win->Create()) return 0;
if (!win->InitializeWnd(SrcWidth,SrcHeight,16)) return 0;
sound = new CSound(win->GetHwnd());
win->SetSound(sound);
midi = new CMidi();
win->SetMusic(midi);
midi->Play(0);
game = new CGame(win);
while(1) //程序主循環
{
if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!GetMessage(&msg, NULL, 0, 0))
return msg.wParam;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else if(win->bActive)
{
/*
static int NewCount, OldCount=0;
NewCount = timeGetTime();
if (NewCount > OldCount+12)
{
OldCount=NewCount;
*/ game->Run();
// }
}
else WaitMessage(); //等待消息
}
SAFE_DELETE(midi)
SAFE_DELETE(sound)
SAFE_DELETE(win)
SAFE_DELETE(game)
return 1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -