⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _debug.cpp

📁 一个利用MAP的类,可以方便地使用多维数组.
💻 CPP
字号:
// _DEBUG.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include "CMapEditor.h"

CMapEditor *meEditor;

void printmap()
{
	for(int y=0;y<10;y++)
	{
		printf("\n");

		for(int x=0;x<10;x++)
			printf(" %d",meEditor->GetMapValue(x,y,0));
	}

	printf("\n");
}

int _tmain(int argc, _TCHAR* argv[])
{
	printf("This application uses all of the CMapEditor functions and demonstrates how they work\n");
	
	meEditor = new CMapEditor(10,10,1);
	
	MAPINFO minfoTemp;
	minfoTemp = meEditor->GetMapInfo();

	printf("Width %d; Height %d\n\n",minfoTemp.iWidth,minfoTemp.iHeight);

	meEditor->NextUndo();
	if(!meEditor->SetMapValue(0,0,0,5)) printf("\nSetMapValue(0,0,0,5) failed!\n");
	else printf("\nSetMapValue(0,0,0,5)\n");
	printmap();
	getchar();

	meEditor->NextUndo();
	if(!meEditor->StartDrag(1,1,0)) printf("\nStartDrag(1,1,0) failed!\n");
	else printf("\nStartDrag(1,1,0)\n");

	if(!meEditor->EndDrag(5,5,1)) printf("EndDrag(5,5,1) failed!\n");
	else printf("EndDrag(5,5,1)\n");
	printmap();
	getchar();

	meEditor->NextUndo();
	if(!meEditor->StartDrag(9,9,0)) printf("\nStartDrag(9,9,0) failed!\n");
	else printf("\nStartDrag(9,9,0)\n");

	if(!meEditor->EndDrag(6,6,2)) printf("EndDrag(6,6,2) failed!\n");
	else printf("EndDrag(6,6,2)\n");
	printmap();
	getchar();

	meEditor->NextUndo();
	if(!meEditor->Fill(7,2,0,0,3)) printf("\nFill(7,2,0,0,3) failed!\n");
	else printf("\nFill(7,2,0,0,3)\n");
	printmap();
	getchar();

	printf("\nUndo() (m_iUndoPos = %d)\n",meEditor->Undo());
	printmap();
	getchar();

	printf("\nUndo() (m_iUndoPos = %d)\n",meEditor->Undo());
	printmap();
	getchar();
	
	printf("\nRedo() (m_iUndoPos = %d)\n",meEditor->Redo());
	printmap();
	getchar();

	meEditor->NextUndo();
	if(!meEditor->Fill(2,7,0,0,7)) printf("\nFill(2,7,0,0,7) failed!\n");
	else printf("\nFill(2,7,0,0,7)\n");
	printmap();
	getchar();

	printf("\nUndo() (m_iUndoPos = %d)\n",meEditor->Undo());
	printmap();
	getchar();

	printf("\nUndo() (m_iUndoPos = %d)\n",meEditor->Undo());
	printmap();

	printf("\nRedo() (m_iUndoPos = %d)\n",meEditor->Redo());
	printmap();
	getchar();

	printf("\nRedo() (m_iUndoPos = %d)\n",meEditor->Redo());
	printmap();
	getchar();

	delete meEditor;

	getchar();
	return 0;
}

⌨️ 快捷键说明

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