80 lines
2.5 KiB
C++
80 lines
2.5 KiB
C++
/* *******************************************************************
|
|
* Includes
|
|
* ******************************************************************/
|
|
|
|
#include "Camera.h"
|
|
#include <stdint.h>
|
|
|
|
/* *******************************************************************
|
|
* Defines
|
|
* ******************************************************************/
|
|
|
|
#define SPEED_CALCULATION_TIME ((uint8_t)3)
|
|
|
|
/* *******************************************************************
|
|
* Types definition
|
|
* ******************************************************************/
|
|
|
|
/* *******************************************************************
|
|
* Global variables definition
|
|
* ******************************************************************/
|
|
|
|
/* *******************************************************************
|
|
* Local variables definition
|
|
* ******************************************************************/
|
|
|
|
/* *******************************************************************
|
|
* Local prototypes declaration
|
|
* ******************************************************************/
|
|
|
|
/* *******************************************************************
|
|
* Functions definition
|
|
* ******************************************************************/
|
|
|
|
/*****************************************************************//**
|
|
*
|
|
* \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)
|
|
{
|
|
}
|
|
|
|
/*****************************************************************//**
|
|
*
|
|
* \brief Event handler executed when human player presses
|
|
* right arrow button.
|
|
*
|
|
*********************************************************************/
|
|
void Camera::onRightBtnPressed(void)
|
|
{
|
|
}
|