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.h | |
| parent | d85464781580796bbcc744ae732e56d1920e3b0f (diff) | |
| download | pocketempires-f0b654b9bf3bc2a93c1f89d4cc3edcf77b948555.tar.gz | |
Game has been restructured in favor of OOP
Diffstat (limited to 'Camera.h')
| -rw-r--r-- | Camera.h | 72 |
1 files changed, 30 insertions, 42 deletions
@@ -1,56 +1,44 @@ -#ifndef __CAM_HEADER__ -#define __CAM_HEADER__ +#ifndef CAMERA_H__ +#define CAMERA_H__ /* ************************************* - * Includes + * Includes * *************************************/ -#include "Global_Inc.h" -#include "Gfx.h" - -#ifdef __cplusplus -extern "C" -{ -#endif //__cplusplus - +#include <stdint.h> /* ************************************* - * Defines + * Defines * *************************************/ /* ************************************* - * Structs and enums + * Structs and enums * *************************************/ -typedef struct t_Camera -{ - int16_t X_Offset; - int16_t Y_Offset; - int8_t X_Speed; - int8_t Y_Speed; - uint8_t Speed_Timer; - bool locked; -}TYPE_CAMERA; - -typedef struct t_sprite TYPE_SPRITE; - /* ************************************* - * Global prototypes + * Class definition * *************************************/ -void CameraInit(TYPE_CAMERA* ptrCamera); -void CameraHandler(TYPE_CAMERA* ptrCamera); -void CameraSetLock(TYPE_CAMERA* ptrCamera, bool value); -void CameraApplyCoordinatesToSprite( TYPE_CAMERA* ptrCamera, - TYPE_SPRITE* spr, - uint16_t x, - uint16_t y ); -TYPE_COLLISION_BLOCK CameraApplyCoordinatesToCoordinates( TYPE_CAMERA* ptrCamera, - uint16_t x, - uint16_t y ); - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif //__CAM_HEADER__ +class Camera +{ + public: + Camera(void); + void setLock(const bool bLock) + { + _bLocked = bLock; + } + void getCoordinates(int16_t* const x, int16_t* const y); + + /* Event handlers. */ + void onLeftBtnPressed(void); + + private: + bool _bLocked; + int16_t _xOffset; + int16_t _yOffset; + int16_t _xSpeed; + int16_t _ySpeed; + uint8_t _speedTimer; +}; + +#endif /* CAMERA_H__ */ |
