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

📄 isorenderer.h

📁 一個遊戲教程
💻 H
字号:
//IsoRendere.h
#ifndef __ISORENDERER_H__
#define __ISORENDERER_H__

#include "IsoHexCore.h"
#include <ddraw.h>

//rendering function pointer typedef
typedef void (*RENDERFN)(LPDIRECTDRAWSURFACE7 lpddsDst,RECT* rcClip,int xDst,int yDst,int xMap,int yMap);

//CRenderer Declaration
class CRenderer
{
public:
	///////////////////
	//members
	///////////////////
	//surfaces
	LPDIRECTDRAWSURFACE7 lpddsBackBuffer;//back buffer
	LPDIRECTDRAWSURFACE7 lpddsFrameBuffer;//frame buffer
	//isohexcore components
	CTilePlotter* pTilePlotter;//plotter
	CTileWalker* pTileWalker;//walker
	CMouseMap* pMouseMap;//mousemap
	CScroller* pScroller;//scroller
	//update RECT list
	RECT* rcUpdateList;//must be allocated
	int iUpdateRectCount;//number of RECTs in the update list
	int iUpdateRectIndex;//stores the next update RECT in the list
	//update map
	bool* bMap;//will be allocated with enough space for the entire map
	int iMapWidth;//width of the map
	int iMapHeight;//height of the map
	//extent rect
	RECT rcExtent;//extent rect, used when adding tiles to the update list
	//rendering function
	RENDERFN RenderFunction;//function used to render a tile
	/////////////////////
	//member functions
	/////////////////////
	//constructor
	CRenderer();
	virtual ~CRenderer();
	//destructor
	//surfaces
	void SetBackBuffer(LPDIRECTDRAWSURFACE7 lpdds);
	void SetFrameBuffer(LPDIRECTDRAWSURFACE7 lpdds);
	//isohexcore components
	void SetPlotter(CTilePlotter* pPlotter);
	void SetWalker(CTileWalker* pWalker);
	void SetMouseMap(CMouseMap* pMMap);
	void SetScroller(CScroller* pScroll);
	//update list
	void SetUpdateRectCount(int iMaxRects);//sets up the rectangle list
	//update map
	void SetMapSize(int MapWidth,int MapHeight);//sets up the update map
	//rendering functions
	void SetRenderFunction(RENDERFN RendFunc);
	//extent rect
	void SetExtentRect(RECT* rcExt);
	//add rect to list
	void AddRect(RECT* prcAdd);
	void AddTile(int mapx,int mapy);
	//scroll the frame
	void ScrollFrame(int scrollx,int scrolly);
	//update the frame
	void UpdateFrame();
};


#endif

⌨️ 快捷键说明

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