1 Star 1 Fork 0

刘力铭/Quoridor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
GameDisplay.h 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
刘力铭 提交于 5年前 . 优化结构
#pragma once
#include <vector>
#include "GameGlobal.h"
#define SIZE_SQUARE 40
#define SIZE_WALL 8
#define STARTAXIS_X 280
#define STARTAXIS_Y 105
struct Region {
int x = 0;
int y = 0;
int numx = 0;
int numy = 0;
bool isBoardOn(Point point) {
bool flag = false;
if (point.row < x + 15 && point.row > x - 15 && point.col < y + 15 && point.col > y - 15)
flag = true;
return flag;
}
bool isWallOn(int type, Point point) {
bool flag = false;
if (type == 0 && point.row < x + 15 && point.row > x - 15 && point.col < y + 4 && point.col > y - 4)
flag = true;
if (type == 1 && point.row < x + 4 && point.row > x - 4 && point.col < y + 15 && point.col > y - 15)
flag = true;
return flag;
}
};
class GameDisplay
{
public:
GameDisplay(void);
~GameDisplay(void) = default;
CRect getPlayerRegion(Point point) const;
CRect getWallRegion(std::pair<Point, int> wall) const;
std::vector<CRect> getWallRegion(std::vector<std::pair<Point, int>> wall) const;
bool isBoardOn(Point point, Region region) const;
bool isWallOn(int type, Point point, Region region) const;
Order getPositionToOrder(Point point) const;
private:
std::vector<Region> mRegionBoard;
std::vector<Region> mRegionWall[2];
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/LiuLimingCode/Quoridor.git
git@gitee.com:LiuLimingCode/Quoridor.git
LiuLimingCode
Quoridor
Quoridor
MFC_version

搜索帮助