资源简介

采用C++ ,Windows API GDI开发的简单飞机游戏,有助于初学者

资源截图

代码片段和文件信息

// AircraftGame.cpp : Defines the entry point for the application.
//

#include “stdafx.h“
#include “AircraftGame.h“

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst; // current instance
TCHAR sztitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name

// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE int);
LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM);
INT_PTR CALLBACK About(HWND UINT WPARAM LPARAM);


#include “GameControler.h“
CGameControler *pGameControl = NULL;
HDC g_hdc;

int APIENTRY _tWinMain(HINSTANCE hInstance
                     HINSTANCE hPrevInstance
                     LPTSTR    lpCmdLine
                     int       nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);

  // TODO: Place code here.
MSG msg;
ZeroMemory(&msg sizeof(MSG));
HACCEL hAccelTable;

// Initialize global strings
LoadString(hInstance IDS_APP_title sztitle MAX_LOADSTRING);
LoadString(hInstance IDC_AIRCRAFTGAME szWindowClass MAX_LOADSTRING);
MyRegisterClass(hInstance);

// Perform application initialization:
if (!InitInstance (hInstance nCmdShow))
{
return FALSE;
}

hAccelTable = LoadAccelerators(hInstance MAKEINTRESOURCE(IDC_AIRCRAFTGAME));

//游戏循环
while (msg.message != WM_QUIT)
{


if (PeekMessage(&msg NULL 0 0 PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
pGameControl->UpdateScence();
}

pGameControl->Exit();

return (int) msg.wParam;
}



//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
//  COMMENTS:
//
//    This function and its usage are only necessary if you want this code
//    to be compatible with Win32 systems prior to the ‘RegisterClassEx‘
//    function that was added to Windows 95. It is important to call this function
//    so that the application will get ‘well formed‘ small icons associated
//    with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;

wcex.cbSize = sizeof(WNDCLASSEX);

wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance MAKEINTRESOURCE(IDI_AIRCRAFTGAME));
wcex.hCursor = LoadCursor(NULL IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_AIRCRAFTGAME);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance MAKEINTRESOURCE(IDI_SMALL));

return RegisterClassEx(&wcex);
}

//
//   FUNCTION: InitInstance(HINSTANCE int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function we save the instance handle in a global variable 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      72192  2012-05-13 18:32  飞机游戏全程实录\AircraftGame.exe

     文件       5196  2012-05-13 17:58  飞机游戏全程实录\Code\AircraftGame\AircraftGame\AircraftGame.cpp

     文件         39  2012-05-08 23:17  飞机游戏全程实录\Code\AircraftGame\AircraftGame\AircraftGame.h

     文件      23558  2009-08-31 02:31  飞机游戏全程实录\Code\AircraftGame\AircraftGame\AircraftGame.ico

     文件       6926  2012-05-08 23:17  飞机游戏全程实录\Code\AircraftGame\AircraftGame\AircraftGame.rc

     文件       5393  2012-05-13 15:23  飞机游戏全程实录\Code\AircraftGame\AircraftGame\AircraftGame.vcxproj

     文件       3574  2012-05-13 15:23  飞机游戏全程实录\Code\AircraftGame\AircraftGame\AircraftGame.vcxproj.filters

     文件        143  2012-05-08 23:17  飞机游戏全程实录\Code\AircraftGame\AircraftGame\AircraftGame.vcxproj.user

     文件       1022  2012-05-13 18:28  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Bullet.cpp

     文件        759  2012-05-13 11:38  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Bullet.h

     文件       1903  2012-05-13 18:26  飞机游戏全程实录\Code\AircraftGame\AircraftGame\EnemyBullet.cpp

     文件        386  2012-05-12 12:51  飞机游戏全程实录\Code\AircraftGame\AircraftGame\EnemyBullet.h

     文件       4296  2012-05-13 18:31  飞机游戏全程实录\Code\AircraftGame\AircraftGame\EnemyPlane.cpp

     文件        818  2012-05-13 17:30  飞机游戏全程实录\Code\AircraftGame\AircraftGame\EnemyPlane.h

     文件       1240  2012-05-13 18:28  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Explosion.cpp

     文件        450  2012-05-13 14:57  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Explosion.h

     文件       5632  2012-05-13 18:32  飞机游戏全程实录\Code\AircraftGame\AircraftGame\GameControler.cpp

     文件       1118  2012-05-13 18:02  飞机游戏全程实录\Code\AircraftGame\AircraftGame\GameControler.h

     文件       2291  2012-05-13 15:46  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Picture.cpp

     文件       1280  2012-05-13 15:46  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Picture.h

     文件       2476  2012-05-13 18:22  飞机游戏全程实录\Code\AircraftGame\AircraftGame\PrincipalBullet.cpp

     文件        434  2012-05-13 11:25  飞机游戏全程实录\Code\AircraftGame\AircraftGame\PrincipalBullet.h

     文件       6590  2012-05-13 18:29  飞机游戏全程实录\Code\AircraftGame\AircraftGame\PrincipalPlane.cpp

     文件       1553  2012-05-13 18:05  飞机游戏全程实录\Code\AircraftGame\AircraftGame\PrincipalPlane.h

     文件       2633  2012-05-08 23:17  飞机游戏全程实录\Code\AircraftGame\AircraftGame\ReadMe.txt

     文件        755  2012-05-08 23:17  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Resource.h

     文件      23558  2009-08-31 02:31  飞机游戏全程实录\Code\AircraftGame\AircraftGame\small.ico

     文件       1314  2012-05-12 02:39  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Sprite.cpp

     文件       1694  2012-05-13 18:30  飞机游戏全程实录\Code\AircraftGame\AircraftGame\Sprite.h

     文件        299  2012-05-08 23:17  飞机游戏全程实录\Code\AircraftGame\AircraftGame\stdafx.cpp

............此处省略37个文件信息

评论

共有 条评论