2018-07-09 19:26:13 +02:00
|
|
|
/* *************************************
|
|
|
|
* 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
|
2018-07-09 22:22:26 +02:00
|
|
|
* left arrow button.
|
2018-07-09 19:26:13 +02:00
|
|
|
*
|
|
|
|
*********************************************************************/
|
|
|
|
void Camera::onLeftBtnPressed(void)
|
|
|
|
{
|
|
|
|
}
|
2018-07-09 22:22:26 +02:00
|
|
|
|
|
|
|
/*****************************************************************//**
|
|
|
|
*
|
|
|
|
* \brief Event handler executed when human player presses
|
|
|
|
* right arrow button.
|
|
|
|
*
|
|
|
|
*********************************************************************/
|
|
|
|
void Camera::onRightBtnPressed(void)
|
|
|
|
{
|
|
|
|
}
|