Commit 174c839e authored by CjhGm's avatar CjhGm
Browse files

start

parent c1dd3741
......@@ -4,3 +4,6 @@
/Aircraft Battle/.vs/Aircraft Battle/v16
/AircraftBattle/.vs/AircraftBattle/v16
/MFCApplication1/.vs/MFCApplication1/v16
/MFCApplication1
/MFCApplication4/.vs/MFCApplication4/v16
......@@ -190,6 +190,7 @@
<ClInclude Include="AircraftBattle.h" />
<ClInclude Include="AircraftBattleDlg.h" />
<ClInclude Include="AircraftMain.h" />
<ClInclude Include="CAircraftBattleView.h" />
<ClInclude Include="CGameObject.h" />
<ClInclude Include="CPlane.h" />
<ClInclude Include="framework.h" />
......@@ -201,6 +202,7 @@
<ClCompile Include="AircraftBattle.cpp" />
<ClCompile Include="AircraftBattleDlg.cpp" />
<ClCompile Include="AircraftMain.cpp" />
<ClCompile Include="CAircraftBattleView.cpp" />
<ClCompile Include="CGameObject.cpp" />
<ClCompile Include="CPlane.cpp" />
<ClCompile Include="pch.cpp">
......
......@@ -42,6 +42,9 @@
<ClInclude Include="CPlane.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="CAircraftBattleView.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AircraftBattle.cpp">
......@@ -62,6 +65,9 @@
<ClCompile Include="CPlane.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="CAircraftBattleView.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AircraftBattle.rc">
......
#include "pch.h"
#include "CAircraftBattleView.h"
#pragma once
#include <afxwin.h>
#include "CPlane.h"
class CAircraftBattleView : public CView
{
private:
CPlane* pPlane;
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28922.388
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MFCApplication4", "MFCApplication4\MFCApplication4.vcxproj", "{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}.Debug|x64.ActiveCfg = Debug|x64
{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}.Debug|x64.Build.0 = Debug|x64
{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}.Debug|x86.ActiveCfg = Debug|Win32
{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}.Debug|x86.Build.0 = Debug|Win32
{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}.Release|x64.ActiveCfg = Release|x64
{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}.Release|x64.Build.0 = Release|x64
{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}.Release|x86.ActiveCfg = Release|Win32
{D39E8654-EA1D-496F-8A8B-917F5BA5AA75}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AD15EE2-8B87-4C15-A935-5971DD0EF382}
EndGlobalSection
EndGlobal
#include "pch.h"
#include "CGameObject.h"
BOOL CGameObject::LoadImage(CImageList& images, UINT bmpID, COLORREF crMask, int cx, int cy, int nInitial)
{
//加载游戏对象的图标对象
CBitmap bmp;
if (!bmp.LoadBitmapW(bmpID))
return FALSE;
//创建CImageList对象
if (!images.Create(cx, cy, ILC_COLOR24 | ILC_MASK, nInitial, 0))//nInitial初始个数
return FALSE;//cx,cy 图片的宽度
//图像链表中加入对象对应的图标对象,之后直接通过该链表访问图标对象
images.Add(&bmp, crMask);
return TRUE;
}
\ No newline at end of file
#pragma once
#include <afx.h>
class CGameObject : public CObject
{
private:
CPoint point;
public:
protected:
//加载该游戏对象对应的图像,图像对象是共有数据,只需要加载一份,使用静态方法
static BOOL LoadImage(CImageList& imageList, UINT bmpID, COLORREF crMask, int cx, int cy, int nInitial);
};
#include "pch.h"
#include "CMyplane.h"
#include "resource.h"
//静态图像链表
CImageList CMyplane::images;
CImageList CMyplane::images1;
CImageList CMyplane::imagespro;
//加载战机图像
BOOL CMyplane::LoadImage()
{
//加载游戏对象的图标对象
CBitmap me;//升级战机图像
if (!me.LoadBitmapW(IDB_BITMAP_ME))
return FALSE;
CBitmap me1;//未升级战机图像
if (!me1.LoadBitmapW(IDB_BITMAP_ME1))
return FALSE;
//创建CImageList对象
if (!images.Create(PLANE_WIDTH, PLANE_HEIGHT, ILC_COLOR24 | ILC_MASK, 14, 0))//nInitial初始个数
return FALSE;//cx,cy 图片的宽度
if (!images1.Create(PLANE1_WIDTH, PLANE1_HEIGHT, ILC_COLOR24 | ILC_MASK, 4, 0))//nInitial初始个数
return FALSE;//cx,cy 图片的宽度
//图像链表中加入对象对应的图标对象,之后直接通过该链表访问图标对象
images.Add(&me, RGB(0, 0, 0));
images1.Add(&me1, RGB(0, 0, 0));
return TRUE;
}
\ No newline at end of file
#pragma once
#include "CGameObject.h"
//升级战机图像宽
#define PLANE_WIDTH 120
//升级战机图像高
#define PLANE_HEIGHT 150
//未升级战机图像宽
#define PLANE1_WIDTH 120
//未升级战机图像高
#define PLANE1_HEIGHT 90
//保护罩战机图像宽
#define PLANE_PRO_WIDTH 165
//保护罩战机图像高
#define PLANE_PRO_HEIGHT 166
//战机初始位置X
#define PLANE_X 400
//战机初始位置Y
#define PLANE_Y 300
class CMyplane : public CGameObject
{
private:
static CImageList images;//存储升级战机图片
static CImageList images1;//存储未升级战机图片
static CImageList imagespro;//存储防护罩图片
int index;//标记要显示的战机图片下标索引,和战机是否升级相关
int progress;
public:
//加载战机图像
static BOOL LoadImage();
};

// ChildFrm.cpp: CChildFrame 类的实现
//
#include "pch.h"
#include "framework.h"
#include "MFCApplication4.h"
#include "ChildFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
END_MESSAGE_MAP()
// CChildFrame 构造/析构
CChildFrame::CChildFrame() noexcept
{
// TODO: 在此添加成员初始化代码
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或样式
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
// CChildFrame 诊断
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CMDIChildWnd::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CMDIChildWnd::Dump(dc);
}
#endif //_DEBUG
// CChildFrame 消息处理程序

// ChildFrm.h: CChildFrame 类的接口
//
#pragma once
class CChildFrame : public CMDIChildWnd
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame() noexcept;
// 特性
protected:
CSplitterWnd m_wndSplitter;
public:
// 操作
public:
// 重写
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
// 实现
public:
virtual ~CChildFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
};
B^C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\PCH.CPP
B^C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\PCH.CPP
B^C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\PCH.CPP
#TargetFrameworkVersion=v4.0:PlatformToolSet=v142:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0
Debug|Win32|C:\Users\tf\source\repos\MFCApplication4\|
B^C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CGAMEOBJECT.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CHILDFRM.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CMYPLANE.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MAINFRM.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4.RES|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4DOC.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4VIEW.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\PCH.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\SCENE.OBJ
B^C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CGAMEOBJECT.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CHILDFRM.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CMYPLANE.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MAINFRM.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4.RES|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4DOC.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4VIEW.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\PCH.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\SCENE.OBJ
B^C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CGAMEOBJECT.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CHILDFRM.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\CMYPLANE.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MAINFRM.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4.RES|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4DOC.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\MFCAPPLICATION4VIEW.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\PCH.OBJ|C:\USERS\TF\SOURCE\REPOS\MFCAPPLICATION4\MFCAPPLICATION4\DEBUG\SCENE.OBJ
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment