You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.0 KiB

#pragma once
#include <string>
#include <conio.h>
#include <graphics.h>
//<2F>ߵĽڵ<C4BD><DAB5>
#define SNAKE_RADIU 9
//ʳ<><CAB3><EFBFBD>İ뾶
#define FOOD_RADIU 8
//<2F>ߵĽڵ<C4BD><DAB5><EFBFBD><EFBFBD><EFBFBD>
#define SNAKE_WIDTH 20
//COLORREF BG_COLOR = RGB(0,0,0); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫΪ<C9AB><CEAA>ɫ
#define BG_COLOR 0
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>
enum class Dir { DIR_UP = 1, DIR_RIGHT = 2, DIR_DOWN = 3, DIR_LEFT = 4 };
//<2F><><EFBFBD>Ľṹ<C4BD><E1B9B9>
struct Point {
int x;
int y;
Point() :x(-1), y(-1) {}
Point(int dx, int dy) :x(dx), y(dy) {}
Point(const Point& point) :x(point.x), y(point.y) {}
bool operator==(const Point& point)
{
return (this->x == point.x) && (this->y == point.y);
}
};
//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
struct PlayerMsg
{
int id;
int score;
int len;
std::string r_time; //<2F><>¼ʱ<C2BC><CAB1>
PlayerMsg()
{
id = 99;
score = 0;
len = 0;
r_time = "";
}
};
struct SortPlayerMsg
{
bool operator()(const PlayerMsg& msg1, const PlayerMsg& msg2)
{
if (msg1.score == msg2.score)
{
return msg1.r_time > msg2.r_time;
}
else return msg1.score > msg2.score;
}
};