smap.h

来自「用VC++及DirectX实现的SuperMario小游戏」· C头文件 代码 · 共 43 行

H
43
字号
/*
Author: Bear

This source is free to anybody.
If you have any problem with this or some advice to me, please:
    mailto: heyang22118952.student@sina.com
        or  yang45249.student@sina.com
or you can contact me through my QQ:     261570581

Welcome to discuss game programming techniques with me :)
And I like to play games!
*/
#pragma once

#include "SuperMarioDemo.h"

class SMap
{
public:
	SMap(void);
	~SMap(void);
	bool Load(BDirectDraw* pdd, BBitmap* pbitmap, const char* fileName);
	bool Draw(BDirectDrawSurface* pDest);
	void UnLoad(void);
	bool MoveTo(int posX, int posY);
	int GetX(void);
	int GetY(void);
	bool Save(char* fileName);
	bool DrawSlices(BDirectDrawSurface* pDest, int startX, int startY, float scale = 1);
	BDirectDrawSurface* GetSurface(int index);
	void Set(int row, int col, int surfaceIndex);
private:
	bool loaded;
	int worldX, worldY;
	int speedX, speedY;
	int nSurfaces;
	int m_map[MAP_HEIGHT][MAP_WIDTH];
	int rowStart, rowEnd, numCols;
	BDirectDrawSurface* ppSurfaces[MAX_SLICE_NUM];

	bool CheckWorld(void);
};

⌨️ 快捷键说明

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