map.h

来自「俄罗斯方块,适于sdk初学者参考学习」· C头文件 代码 · 共 54 行

H
54
字号
//map.h
//map 类 记录并管理游戏的地图操作

#if !defined(AFX_MAP_H__E65119B7_08AD_4636_A1ED_C63C846BAC98__INCLUDED_)
#define AFX_MAP_H__E65119B7_08AD_4636_A1ED_C63C846BAC98__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "diamond.h"

#define MAP_HOLLOW       2
#define MAP_SOLID        4

#define CHECK_RESULT_BUTT       0
#define CHECK_RESULT_FREEZE     1
#define CHECK_RESULT_FREE       2
#define CHECK_RESULT_DEAD       3
#define CHECK_RESULT_OK         4

#define DIAMOND_ACTION_DOWN    0
#define DIAMOND_ACTION_LEFT    1
#define DIAMOND_ACTION_RIGHT   2
#define DIAMOND_ACTION_ROTATE  3
#define DIAMOND_ACTION_CREATE  4

#define MAP_CHECK_NOPROGRAM    5
#define MAP_CHECK_NEEDREFRESH  6

class map  
{
public:
	map(int width,int height);
	virtual ~map();
	void init();
	int length()const {return m_length;};
	int width()const {return m_width;};
	int height()const {return m_height;};
    int checkanddel(const diamond &,int &y1,int &y2);
	int refreshmap(int y1,int y2);
    int checkaction(int diamondaction,const diamond &);
	char mapinfo(int x,int y) const;
private:
    int 	m_width;
	int     m_height;
	int     m_length;
    int     m_fill_point;
	char    *m_pmap;
    int     checkmap();
	void    mapoperate(int x,int y,char val);
};

#endif // !defined(AFX_MAP_H__E65119B7_08AD_4636_A1ED_C63C846BAC98__INCLUDED_)

⌨️ 快捷键说明

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