Definition at line 9 of file Dir.h.
Public Types | |
enum | eDir { DIR_NO = 0, DIR_UP = 1, DIR_DOWN = 2, DIR_LEFT = 3, DIR_RIGHT = 4 } |
Static Public Member Functions | |
static V2 | dir2xy (eDir dir) |
Convert dir to relative coordinations. |
|
Definition at line 11 of file Dir.h. 00011 { 00012 DIR_NO = 0, 00013 DIR_UP = 1, 00014 DIR_DOWN = 2, 00015 DIR_LEFT = 3, 00016 DIR_RIGHT = 4 00017 };
|
|
Convert dir to relative coordinations.
Definition at line 18 of file Dir.cpp. 00019 { 00020 int x = 0; 00021 int y = 0; 00022 switch (dir) { 00023 case DIR_UP: 00024 y = -1; 00025 break; 00026 case DIR_DOWN: 00027 y = +1; 00028 break; 00029 case DIR_LEFT: 00030 x = -1; 00031 break; 00032 case DIR_RIGHT: 00033 x = +1; 00034 break; 00035 case DIR_NO: 00036 break; 00037 default: 00038 assert(!"unknown dir"); 00039 break; 00040 } 00041 00042 return V2(x, y); 00043 }
|