tank2003.cpp

来自「一个坦克大战的源码」· C++ 代码 · 共 62 行

CPP
62
字号
// Tank2003.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "Tank2003.h"
#include "MainGame.h"

/////////////////////////////////////////////////////////////////////////////
// CTank2003App

BEGIN_MESSAGE_MAP(CTank2003App, CWinApp)
	//{{AFX_MSG_MAP(CTank2003App)
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTank2003App construction

CTank2003App::CTank2003App()
{
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CTank2003App object

CTank2003App theApp;

/////////////////////////////////////////////////////////////////////////////
// CTank2003App initialization

BOOL CTank2003App::InitInstance()
{
	srand(time(NULL));
	CMainGame *pWnd=new CMainGame();
    pWnd->Create("Tank2003");
    m_pMainWnd = pWnd;	
	if(pWnd->InitializeWnd(640,480,16)==FALSE)
    {
        pWnd->DestroyWindow();
        return FALSE;
    }
	

    MSG msg;
    while(TRUE)
    {
        if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))//如果有消息就处理消息
        {
            if(!GetMessage(&msg,NULL,0,0))
                return msg.wParam;
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
		else 
		{
			pWnd->GameFight();
		}
	}
	return FALSE;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?