diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2018-07-09 19:26:13 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2018-07-09 19:26:13 +0200 |
| commit | f0b654b9bf3bc2a93c1f89d4cc3edcf77b948555 (patch) | |
| tree | 91b7404dca0b6eb136cb7f9b144435419144b777 /Camera.cpp | |
| parent | d85464781580796bbcc744ae732e56d1920e3b0f (diff) | |
Game has been restructured in favor of OOP
Diffstat (limited to 'Camera.cpp')
| -rw-r--r-- | Camera.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/Camera.cpp b/Camera.cpp new file mode 100644 index 0000000..5e096ed --- /dev/null +++ b/Camera.cpp @@ -0,0 +1,67 @@ +/* ************************************* + * Includes + * *************************************/ + +#include "Camera.h" + +/* ************************************* + * Defines + * *************************************/ + +/* ************************************* + * Structs and enums + * *************************************/ + +enum +{ + SPEED_CALCULATION_TIME = 3 +}; + +/* ************************************* + * Global Variables + * *************************************/ + +/* ************************************* + * Local Variables + * *************************************/ + +/* ************************************* + * Local Prototypes + * *************************************/ + +/*****************************************************************//** + * + * \brief Constructor for Camera class. + * + *********************************************************************/ +Camera::Camera(void) : + _bLocked(false), + _xOffset(0), + _yOffset(0), + _xSpeed(0), + _ySpeed(0), + _speedTimer(SPEED_CALCULATION_TIME) +{ +} + +/*****************************************************************//** + * + * \brief This function transforms the coordinates for a given + * object to camera coordinates. + * + *********************************************************************/ +void Camera::getCoordinates(int16_t* const x, int16_t* const y) +{ + *x += _xOffset; + *y += _yOffset; +} + +/*****************************************************************//** + * + * \brief Event handler executed when human player presses + * left button. + * + *********************************************************************/ +void Camera::onLeftBtnPressed(void) +{ +} |
