![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Class handling camera movement, either by mouse or by events on the battlescape. More...
#include <Camera.h>
Public Member Functions | |
| Camera (int spriteWidth, int spriteHeight, int mapsize_x, int mapsize_y, int mapsize_z, Map *map, int visibleMapHeight) | |
| Creates a new camera. More... | |
| ~Camera () | |
| Cleans up the camera. More... | |
| void | setScrollTimer (Timer *mouse, Timer *key) |
| Sets the camera's scroll timers. More... | |
| void | mousePress (Action *action, State *state) |
| Special handling for mouse press. More... | |
| void | mouseRelease (Action *action, State *state) |
| Special handling for mouse release. More... | |
| void | mouseOver (Action *action, State *state) |
| Special handling for mouse over. More... | |
| void | keyboardPress (Action *action, State *state) |
| Special handling for key presses. More... | |
| void | keyboardRelease (Action *action, State *state) |
| Special handling for key releases. More... | |
| void | scrollMouse () |
| Scrolls the view for mouse-scrolling. More... | |
| void | scrollKey () |
| Scrolls the view for keyboard-scrolling. More... | |
| void | scrollXY (int x, int y, bool redraw) |
| Scrolls the view a certain amount. More... | |
| void | jumpXY (int x, int y) |
| Jumps the view (when projectile in motion). More... | |
| void | up () |
| Moves map layer up. More... | |
| void | down () |
| Move map layer down. More... | |
| void | setViewLevel (int viewlevel) |
| Sets the view level. More... | |
| void | convertMapToScreen (Position mapPos, Position *screenPos) const |
| Converts map coordinates to screen coordinates. More... | |
| void | convertVoxelToScreen (Position voxelPos, Position *screenPos) const |
| Converts voxel coordinates to screen coordinates. More... | |
| void | convertScreenToMap (int screenX, int screenY, int *mapX, int *mapY) const |
| Converts screen coordinates to map coordinates. More... | |
| void | centerOnPosition (Position pos, bool redraw=true) |
| Center map on a position. More... | |
| Position | getCenterPosition () |
| Gets map's center position. More... | |
| int | getViewLevel () const |
| Gets the map displayed level. More... | |
| int | getMapSizeX () const |
| Gets the map size x. More... | |
| int | getMapSizeY () const |
| Gets the map size y. More... | |
| Position | getMapOffset () const |
| Get the map x/y screen offset. More... | |
| void | setMapOffset (const Position &pos) |
| Sets the map x/y screen offset. More... | |
| int | toggleShowAllLayers () |
| Toggles showing all map layers. More... | |
| bool | getShowAllLayers () const |
| Checks if the camera is showing all map layers. More... | |
| bool | isOnScreen (Position mapPos, const bool unitWalking, const int unitSize, const bool boundary) const |
| Checks if map coordinates X,Y,Z are on screen. More... | |
| void | resize () |
| Resize the viewable area. More... | |
| void | stopMouseScrolling () |
| stop mouse scrolling. | |
Class handling camera movement, either by mouse or by events on the battlescape.
| OpenXcom::Camera::Camera | ( | int | spriteWidth, |
| int | spriteHeight, | ||
| int | mapsize_x, | ||
| int | mapsize_y, | ||
| int | mapsize_z, | ||
| Map * | map, | ||
| int | visibleMapHeight | ||
| ) |
Creates a new camera.
Sets up a camera.
| spriteWidth | Width of map sprite. |
| spriteHeight | Height of map sprite. |
| mapsize_x | Current map size in X axis. |
| mapsize_y | Current map size in Y axis. |
| mapsize_z | Current map size in Z axis. |
| map | Pointer to map surface. |
| visibleMapHeight | Current height the view is at. |
| OpenXcom::Camera::~Camera | ( | ) |
Cleans up the camera.
Deletes the Camera.
| void OpenXcom::Camera::centerOnPosition | ( | Position | mapPos, |
| bool | redraw = true |
||
| ) |
Center map on a position.
Centers map on a certain position.
| mapPos | Position to center on. |
| redraw | Redraw map or not. |
Converts map coordinates to screen coordinates.
Converts map coordinates X,Y,Z to screen positions X, Y.
| mapPos | X,Y,Z coordinates on the map. |
| screenPos | Screen position. |
| void OpenXcom::Camera::convertScreenToMap | ( | int | screenX, |
| int | screenY, | ||
| int * | mapX, | ||
| int * | mapY | ||
| ) | const |
Converts voxel coordinates to screen coordinates.
Converts voxel coordinates X,Y,Z to screen positions X, Y.
| voxelPos | X,Y,Z coordinates of the voxel. |
| screenPos | Screen position. |
| void OpenXcom::Camera::down | ( | ) |
Move map layer down.
Goes one level down.
| Position OpenXcom::Camera::getCenterPosition | ( | ) |
Gets map's center position.
| Position OpenXcom::Camera::getMapOffset | ( | ) | const |
Get the map x/y screen offset.
Gets the map offset.
| int OpenXcom::Camera::getMapSizeX | ( | ) | const |
Gets the map size x.
| int OpenXcom::Camera::getMapSizeY | ( | ) | const |
Gets the map size y.
| bool OpenXcom::Camera::getShowAllLayers | ( | ) | const |
Checks if the camera is showing all map layers.
| int OpenXcom::Camera::getViewLevel | ( | ) | const |
Gets the map displayed level.
Gets the displayed level.
| bool OpenXcom::Camera::isOnScreen | ( | Position | mapPos, |
| const bool | unitWalking, | ||
| const int | unitSize, | ||
| const bool | boundary | ||
| ) | const |
Checks if map coordinates X,Y,Z are on screen.
| mapPos | Coordinates to check. |
| unitWalking | True to offset coordinates for a unit walking. |
| unitSize | size of unit (0 - single, 1 - 2x2, etc, used for walking only |
| boundary | True if it's for caching calculation |
| void OpenXcom::Camera::jumpXY | ( | int | x, |
| int | y | ||
| ) |
Jumps the view (when projectile in motion).
Handles jumping with given deviation.
| x | X deviation. |
| y | Y deviation. |
Special handling for key presses.
Handles camera keyboard shortcuts.
| action | Pointer to an action. |
| state | State that the action handlers belong to. |
Special handling for key releases.
Handles camera keyboard shortcuts.
| action | Pointer to an action. |
| state | State that the action handlers belong to. |
Special handling for mouse over.
Handles mouse over events.
| action | Pointer to an action. |
| state | State that the action handlers belong to. |
Special handling for mouse press.
Handles camera mouse shortcuts.
| action | Pointer to an action. |
| state | State that the action handlers belong to. |
Special handling for mouse release.
Handles camera mouse shortcuts.
| action | Pointer to an action. |
| state | State that the action handlers belong to. |
| void OpenXcom::Camera::resize | ( | ) |
Resize the viewable area.
Resizes the viewable window of the camera.
| void OpenXcom::Camera::scrollKey | ( | ) |
Scrolls the view for keyboard-scrolling.
Handles keyboard-scrolling.
| void OpenXcom::Camera::scrollMouse | ( | ) |
Scrolls the view for mouse-scrolling.
Handles mouse-scrolling.
| void OpenXcom::Camera::scrollXY | ( | int | x, |
| int | y, | ||
| bool | redraw | ||
| ) |
Scrolls the view a certain amount.
Handles scrolling with given deviation.
| x | X deviation. |
| y | Y deviation. |
| redraw | Redraw map or not. |
| void OpenXcom::Camera::setMapOffset | ( | const Position & | pos | ) |
Sets the map x/y screen offset.
Sets the map offset.
| pos | The map offset. |
Sets the camera's scroll timers.
Sets the camera's scrolling timer.
| mouse | Pointer to mouse timer. |
| key | Pointer to key timer. |
| void OpenXcom::Camera::setViewLevel | ( | int | viewlevel | ) |
Sets the view level.
| viewlevel | New view level. |
| int OpenXcom::Camera::toggleShowAllLayers | ( | ) |
Toggles showing all map layers.
| void OpenXcom::Camera::up | ( | ) |
Moves map layer up.
Goes one level up.
1.8.14