19 #ifndef OPENXCOM_CAMERA_H
20 #define OPENXCOM_CAMERA_H
38 Timer *_scrollMouseTimer, *_scrollKeyTimer;
39 int _spriteWidth, _spriteHeight;
40 int _mapsize_x, _mapsize_y, _mapsize_z;
41 int _screenWidth, _screenHeight;
43 int _scrollMouseX, _scrollMouseY, _scrollKeyX, _scrollKeyY;
45 int _visibleMapHeight;
47 void minMaxInt(
int *value,
const int minValue,
const int maxValue)
const;
50 static const int SCROLL_BORDER = 5;
51 static const int SCROLL_DIAGONAL_EDGE = 60;
53 Camera(
int spriteWidth,
int spriteHeight,
int mapsize_x,
int mapsize_y,
int mapsize_z,
Map *map,
int visibleMapHeight);
73 void scrollXY(
int x,
int y,
bool redraw);
void resize()
Resize the viewable area.
Definition: Camera.cpp:601
~Camera()
Cleans up the camera.
Definition: Camera.cpp:49
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
Position getCenterPosition()
Gets map's center position.
Definition: Camera.cpp:445
void jumpXY(int x, int y)
Jumps the view (when projectile in motion).
Definition: Camera.cpp:375
void scrollXY(int x, int y, bool redraw)
Scrolls the view a certain amount.
Definition: Camera.cpp:345
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void convertMapToScreen(const Position &mapPos, Position *screenPos) const
Converts map coordinates to screen coordinates.
Definition: Camera.cpp:481
Timer used to run code in fixed intervals.
Definition: Timer.h:37
int getMapSizeY() const
Gets the map size y.
Definition: Camera.cpp:528
Class handling camera movement, either by mouse or by events on the battlescape.
Definition: Camera.h:35
int getViewLevel() const
Gets the map displayed level.
Definition: Camera.cpp:510
int getMapSizeX() const
Gets the map size x.
Definition: Camera.cpp:519
void convertScreenToMap(int screenX, int screenY, int *mapX, int *mapY) const
Converts screen coordinates to map coordinates.
Definition: Camera.cpp:458
bool isOnScreen(const Position &mapPos, const bool unitWalking) const
Checks if map coordinates X,Y,Z are on screen.
Definition: Camera.cpp:576
void mouseOver(Action *action, State *state)
Special handling for mouse over.
Definition: Camera.cpp:138
void mousePress(Action *action, State *state)
Special handling for mouse press.
Definition: Camera.cpp:88
void scrollMouse()
Scrolls the view for mouse-scrolling.
Definition: Camera.cpp:326
void keyboardPress(Action *action, State *state)
Special handling for key presses.
Definition: Camera.cpp:247
void centerOnPosition(const Position &pos, bool redraw=true)
Center map on a position.
Definition: Camera.cpp:426
void scrollKey()
Scrolls the view for keyboard-scrolling.
Definition: Camera.cpp:334
Interactive map of the battlescape.
Definition: Map.h:46
Camera(int spriteWidth, int spriteHeight, int mapsize_x, int mapsize_y, int mapsize_z, Map *map, int visibleMapHeight)
Creates a new camera.
Definition: Camera.cpp:41
bool getShowAllLayers() const
Checks if the camera is showing all map layers.
Definition: Camera.cpp:565
void setScrollTimer(Timer *mouse, Timer *key)
Sets the camera's scroll timers.
Definition: Camera.cpp:59
Position getMapOffset()
Get the map x/y screen offset.
Definition: Camera.cpp:537
void up()
Moves map layer up.
Definition: Camera.cpp:386
void setMapOffset(Position pos)
Sets the map x/y screen offset.
Definition: Camera.cpp:546
void convertVoxelToScreen(const Position &voxelPos, Position *screenPos) const
Converts voxel coordinates to screen coordinates.
Definition: Camera.cpp:493
void mouseRelease(Action *action, State *state)
Special handling for mouse release.
Definition: Camera.cpp:113
Easy handling of X-Y-Z coordinates.
Definition: Position.h:30
void setViewLevel(int viewlevel)
Sets the view level.
Definition: Camera.cpp:413
void down()
Move map layer down.
Definition: Camera.cpp:399
void stopMouseScrolling()
stop mouse scrolling.
Definition: Camera.cpp:608
int toggleShowAllLayers()
Toggles showing all map layers.
Definition: Camera.cpp:555
void keyboardRelease(Action *action, State *state)
Special handling for key releases.
Definition: Camera.cpp:288