-------------------------------------------------- IN SCREEN ---------------------------------------------
| 13 | { |
| 14 | //-------------------------------------------------- IN SCREEN --------------------------------------------- |
| 15 | bool GameImpl::inScreen(CoordinateType::Enum ctype, int x, int y) const |
| 16 | { |
| 17 | if ( !data->hasGUI ) |
| 18 | return false; |
| 19 | |
| 20 | Position p(x,y); |
| 21 | switch ( ctype ) |
| 22 | { |
| 23 | case BWAPI::CoordinateType::Map: // if we're using map coordinates, subtract the position of the screen to convert the coordinates into screen coordinates |
| 24 | p.x -= BW::BWDATA::ScreenX; |
| 25 | p.y -= BW::BWDATA::ScreenY; |
| 26 | break; |
| 27 | case BWAPI::CoordinateType::Mouse: // if we're using mouse coordinates, add the position of the mouse to convert the coordinates into screen coordinates |
| 28 | p.x += BW::BWDATA::Mouse.x; |
| 29 | p.y += BW::BWDATA::Mouse.y; |
| 30 | break; |
| 31 | } |
| 32 | if (p.x < 0 || |
| 33 | p.y < 0 || |
| 34 | p.x > BW::BWDATA::GameScreenBuffer.width() || |
| 35 | p.y > BW::BWDATA::GameScreenBuffer.height()) |
| 36 | return false; |
| 37 | return true; |
| 38 | } |
| 39 | |
| 40 | bool GameImpl::inScreen(CoordinateType::Enum ctype, int x1, int y1, int x2, int y2) const |
| 41 | { |