?? path.h
字號:
// Path.h
//
// Class with all path related methods
//
/////////////////////////////////////////////////////////////////////////////
#ifndef _PATH_H_
#define _PATH_H_
// this enumeration allows changing orientation easily with a xor 2
enum Orientation {
RIGHT = 0,
DOWN = 1,
LEFT = 2,
UP = 3
};
// this table has the (x, y) offsets for a move in any orientation
extern int movementOffsets[4][2];
class Path
{
// methods
public:
// calculates the square of the distance between 2 points
static int distance2(int p1X, int p1Y, int p2X, int p2Y);
// calculates the best path between two points, given an orientation
static void calcPath(int sourceX, int sourceY, Orientation ori, int destX, int destY,
int &movOffsX, int &movOffsY, Orientation &finalOri);
// calculates a random path, given a point and an orientation
static void calcRandomPath(int sourceX, int sourceY, Orientation ori,
int &movOffsX, int &movOffsY, Orientation &finalOri);
};
#endif // _PATH_H_
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -