資源簡介
使用MFC編寫的2D地圖編輯器,實現了基本的2D地圖編輯器的功能。并有項目文檔

代碼片段和文件信息
//?DownView.cpp?:?實現文件
//
#include?“stdafx.h“
#include?“MapEditor.h“
#include?“DownView.h“
MESH1?m_mesh[50][50];
extern?POINT?bp;
extern?CString?m_Pathname;
extern?CString?m_pname;
bool?flag?=??false;
int?xy;
extern?int?l;
extern?int?num[50][4];
//?CDownView
IMPLEMENT_DYNCREATE(CDownView?CView)
CDownView::CDownView()
{
}
CDownView::~CDownView()
{
}
BEGIN_MESSAGE_MAP(CDownView?CView)
????ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
//?CDownView?繪圖
void?CDownView::OnDraw(CDC*?pDC)
{
CDocument*?pDoc?=?GetDocument();
//?TODO:?在此添加繪制代碼
????int?i;
int?jmn;
????int?k?=?0;
????CBrush???m_brush;
CPen?????m_pen;
????CRect????m_rect;
????HBITMAP?????m_hbmp;
????HDC?????????hdc;
????hdc????=?CreateCompatibleDC(pDC->m_hDC);
????m_brush.CreateSolidBrush(RGB(000));
m_pen.CreatePen(PS_SOLID1RGB(00255));
????this->GetClientRect(&m_rect);
pDC->FillRect(&CRect(00m_rect.rightm_rect.bottom)&m_brush);m?=?0;
????m?=?0;
????for(i?=?0;??i? {
????????n?=?0;
for(j?=?0;?j? {?
m_mesh[m][n].i?=?0;
m_mesh[m][n].rect?=?CRect(ji?j+32i+32);
//k?=?k?+?1;
n?=?n?+?1;
}
m?=?m?+?1;
}
????x?=?m?-?1;
????y?=?n?-?1;
????pDC->Selectobject(&m_pen);
m_hbmp?=(?HBITMAP)LoadImage(::AfxGetInstanceHandle()//
????????m_pname//文件名
?????????????????????????????IMAGE_BITMAP //位圖方式
?????????????????????????????????????0//圖形寬
?????????????????????????????????????0//圖形高
???LR_LOADFROMFILE|LR_CREATEDIBSECTION//方式
);
????Selectobject(hdcm_hbmp);
????BitBlt(pDC->m_hDC003232?hdc00SRCCOPY);
???/*?for(i=0;i ????????????BitBlt(pDC->m_hDCnum[i][1]*32num[i][0]*323232?hdcnum[i][2]num[i][3]SRCCOPY);*/
????
????pDC->Selectobject(&m_pen);
????for(i?=?0;?i? {
pDC->MoveTo(0?i);
pDC->LineTo((int)m_rect.righti);
}
for(j?=?0;?j?(int)m_rect.right;?j?=?j?+?32)
{
pDC->MoveTo(j?0);
pDC->LineTo(j(int)m_rect.bottom);
}
}
//?CDownView?診斷
#ifdef?_DEBUG
void?CDownView::AssertValid()?const
{
CView::AssertValid();
}
#ifndef?_WIN32_WCE
void?CDownView::Dump(CDumpContext&?dc)?const
{
CView::Dump(dc);
}
#endif
#endif?//_DEBUG
//?CDownView?消息處理程序
void?CDownView::OnLButtonDown(UINT?nFlags?CPoint?point)
{
????//?TODO:?在此添加消息處理程序代碼和/或調用默認值
?????CClientDC???dc(this);
????HDC?????????hdc;
????HBITMAP?????m_hbmp;
int?i?j;
bool?flag?=??false;
????hdc????=?CreateCompatibleDC(dc.m_hDC);
m_hbmp?=(?HBITMAP)LoadImage(::AfxGetInstanceHandle()//
??????????????????????????????m_Pathname//文件名
?????????????????????????????IMAGE_BITMAP //位圖方式
?????????????????????????????????????0//圖形寬
?????????????????????????????????????0//圖形高
???LR_LOADFROMFILE|LR_CREATEDIBSECTION//方式
);
????Selectobject(hdcm_hbmp);
????for(i?=?0;?i? ??{
??for(j?=?0;?j? ??{
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????200704??2008-04-21?16:25??2D編輯器\MapEditor\debug\MapEditor.exe
?????文件????1637552??2008-04-21?16:25??2D編輯器\MapEditor\debug\MapEditor.ilk
?????文件????3681280??2008-04-21?16:25??2D編輯器\MapEditor\debug\MapEditor.pdb
?????文件?????925094??2008-04-19?22:58??2D編輯器\MapEditor\MapEditor\1.bmp
?????文件????????120??2008-04-19?23:25??2D編輯器\MapEditor\MapEditor\1.txt
?????文件???????7028??2008-04-21?16:25??2D編輯器\MapEditor\MapEditor\Debug\BuildLog.htm
?????文件??????34875??2008-04-21?16:25??2D編輯器\MapEditor\MapEditor\Debug\DownView.obj
?????文件??????64486??2008-04-21?16:24??2D編輯器\MapEditor\MapEditor\Debug\MainFrm.obj
?????文件????????660??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\MapEditor.exe.em
?????文件????????724??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\MapEditor.exe.em
?????文件????????625??2008-04-21?16:25??2D編輯器\MapEditor\MapEditor\Debug\MapEditor.exe.intermediate.manifest
?????文件??????36759??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\MapEditor.obj
?????文件???13697024??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\MapEditor.pch
?????文件??????30752??2008-04-19?23:08??2D編輯器\MapEditor\MapEditor\Debug\MapEditor.res
?????文件??????21918??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\MapEditorDoc.obj
?????文件??????30430??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\MapEditorView.obj
?????文件?????????67??2008-04-21?16:25??2D編輯器\MapEditor\MapEditor\Debug\mt.dep
?????文件?????336222??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\stdafx.obj
?????文件??????29133??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\ToolBarEx.obj
?????文件??????34477??2008-04-17?16:34??2D編輯器\MapEditor\MapEditor\Debug\UpView.obj
?????文件?????789504??2008-04-21?16:25??2D編輯器\MapEditor\MapEditor\Debug\vc80.idb
?????文件?????700416??2008-04-21?16:25??2D編輯器\MapEditor\MapEditor\Debug\vc80.pdb
?????文件???????3699??2008-04-21?16:25??2D編輯器\MapEditor\MapEditor\DownView.cpp
?????文件????????592??2008-04-17?14:07??2D編輯器\MapEditor\MapEditor\DownView.h
?????文件???????7853??2008-04-21?16:27??2D編輯器\MapEditor\MapEditor\MainFrm.cpp
?????文件???????1101??2008-04-19?23:07??2D編輯器\MapEditor\MapEditor\MainFrm.h
?????文件??????70556??2008-04-19?23:08??2D編輯器\MapEditor\MapEditor\MapEditor.aps
?????文件???????3300??2008-04-04?20:47??2D編輯器\MapEditor\MapEditor\MapEditor.cpp
?????文件?????200704??2008-04-21?15:48??2D編輯器\MapEditor\MapEditor\MapEditor.exe
?????文件????????514??2008-04-04?23:33??2D編輯器\MapEditor\MapEditor\MapEditor.h
............此處省略39個文件信息
評論
共有 條評論