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

📄 map.cpp

📁 这个例子告诉你2d Arpg游戏中的动态阴影如何生成
💻 CPP
字号:
// Map.cpp: implementation of the Map class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include <Mmsystem.h>
#include "Map.h"
#include "log.h"
#include <stdio.h>
#include "CDInput.h"
extern CDIMouse	theMouse;

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
bool Map::Isnight=true;
Map::Map()
{
	view.x=0;
	view.y=0;
	flag=0;
	Count=0;
}

Map::~Map()
{

}

bool Map::Init(char* Filename,int w,int h)
{
	this->MapHeight=960;
	this->MapWidth=640;
	this->Surmap.CreateImageSurface(Filename,false,false,DDBLTFAST_NOCOLORKEY);
	Surmap.CreateNight();
	time=timeGetTime();
//	if(!(this->Surmapmask.CreateImageSurface(Filename,false,false,DDBLTFAST_NOCOLORKEY)))
//	Surmapmask.SetSurfaceColorKey(0xf81f);
//	srand(timeGetTime());
/*	int ran;
	for(int i=0;i<w;i++)
		for(int j=0;j<h;j++)
		{
			ran=rand()%10;
			RECT rect={ran*160+80,40,(ran+1)*160,80};
			Surmapmask.BltTo(i*80,j*40,&Surmap,&rect);
			RECT rect1={ran*160,0,ran*160+80,40};
			Surmapmask.BltTo(i*80,j*40,&Surmap,&rect1);
		}
		*/
//	this->Surmap.SetSurfaceColorKey(0xf81f);
	return true;
}

void Map::MoveMap()
{

}

void Map::ShowMap()
{
//	if(flag==0)
	{
		RECT rect={view.x,view.y,view.x+800,view.y+600};

			Surmap.DrawSurface(0,0,&rect);
	}
/*	else
	{
		RECT rect={view.x,view.y,view.x+404,view.y+404};
		Surmap.DrawSurface(0,0,&rect);
	}*/
}

⌨️ 快捷键说明

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