returns the map coordinates that the mouse cursor is over
| 2977 | |
| 2978 | // returns the map coordinates that the mouse cursor is over |
| 2979 | df::coord Gui::getMousePos(bool allow_out_of_bounds) |
| 2980 | { |
| 2981 | df::coord pos; |
| 2982 | if (gps && gps->precise_mouse_x > -1) { |
| 2983 | pos = getViewportPos(); |
| 2984 | if (Screen::inGraphicsMode()) { |
| 2985 | int32_t map_tile_pixels = gps->viewport_zoom_factor / 4; |
| 2986 | pos.x += gps->precise_mouse_x / map_tile_pixels; |
| 2987 | pos.y += gps->precise_mouse_y / map_tile_pixels; |
| 2988 | } else { |
| 2989 | pos.x += gps->mouse_x; |
| 2990 | pos.y += gps->mouse_y; |
| 2991 | } |
| 2992 | } |
| 2993 | if (!allow_out_of_bounds && !Maps::isValidTilePos(pos.x, pos.y, pos.z)) |
| 2994 | return df::coord(); |
| 2995 | return pos; |
| 2996 | } |
| 2997 | |
| 2998 | int getDepthAt_default (int32_t x, int32_t y) |
| 2999 | { |
nothing calls this directly
no test coverage detected