Fixed "includes/defines/local variables" headers.
This commit is contained in:
parent
cd78b97bce
commit
8ed9a3a57a
44
Camera.cpp
44
Camera.cpp
|
@ -1,33 +1,35 @@
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Includes
|
* Includes
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Defines
|
* Defines
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
#define SPEED_CALCULATION_TIME ((uint8_t)3)
|
||||||
* Structs and enums
|
|
||||||
* *************************************/
|
|
||||||
|
|
||||||
enum
|
/* *******************************************************************
|
||||||
{
|
* Types definition
|
||||||
SPEED_CALCULATION_TIME = 3
|
* ******************************************************************/
|
||||||
};
|
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Global Variables
|
* Global variables definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Local Variables
|
* Local variables definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Local Prototypes
|
* Local prototypes declaration
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Functions definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
|
@ -59,7 +61,7 @@ void Camera::getCoordinates(int16_t* const x, int16_t* const y)
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
* \brief Event handler executed when human player presses
|
* \brief Event handler executed when human player presses
|
||||||
* left arrow button.
|
* left button.
|
||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
void Camera::onLeftBtnPressed(void)
|
void Camera::onLeftBtnPressed(void)
|
||||||
|
|
42
Game.cpp
42
Game.cpp
|
@ -1,6 +1,6 @@
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Includes *
|
* Includes
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
|
@ -9,13 +9,13 @@
|
||||||
#include <Gamebuino.h>
|
#include <Gamebuino.h>
|
||||||
#include <Display.h>
|
#include <Display.h>
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Defines *
|
* Defines
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Structs and enums *
|
* Types definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
enum tPauseMenuChoice
|
enum tPauseMenuChoice
|
||||||
{
|
{
|
||||||
|
@ -25,23 +25,23 @@ enum tPauseMenuChoice
|
||||||
MAX_PAUSE_MENU_CHOICES,
|
MAX_PAUSE_MENU_CHOICES,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Global variables *
|
* Global variables definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Local variables *
|
* Local variables definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Local prototypes *
|
* Local prototypes declaration
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
static enum tPauseMenuChoice GamePause(void);
|
static enum tPauseMenuChoice GamePause(void);
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Functions definition *
|
* Functions definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Includes *
|
* Includes
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include "HumanPlayer.h"
|
#include "HumanPlayer.h"
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
|
@ -16,11 +16,15 @@
|
||||||
* ******************************************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *******************************************************************
|
/* *******************************************************************
|
||||||
* Global variables
|
* Global variables definition
|
||||||
* ******************************************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *******************************************************************
|
/* *******************************************************************
|
||||||
* Local variables
|
* Local variables definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Local prototypes declaration
|
||||||
* ******************************************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *******************************************************************
|
/* *******************************************************************
|
||||||
|
@ -45,7 +49,7 @@ Player(strPlayerName)
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
void HumanPlayer::buttonHandler(void)
|
void HumanPlayer::buttonHandler(void)
|
||||||
{
|
{
|
||||||
for (uint8_t btn = 0; btn < NUM_BTN; btn++)
|
for (uint8_t u8Btn = 0; u8Btn < NUM_BTN; u8Btn++)
|
||||||
{
|
{
|
||||||
/* This array of member functions lists
|
/* This array of member functions lists
|
||||||
* button pressed event handlers for each button. */
|
* button pressed event handlers for each button. */
|
||||||
|
@ -68,13 +72,13 @@ void HumanPlayer::buttonHandler(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Member function pointer is valid. */
|
/* Member function pointer is valid. */
|
||||||
if (gb.buttons.pressed(btn))
|
if (gb.buttons.pressed(u8Btn))
|
||||||
{
|
{
|
||||||
/* Key has been pressed. Execute both
|
/* Key has been pressed. Execute both
|
||||||
* HumanPlayer and Camera handlers, if available. */
|
* HumanPlayer and Camera handlers, if available. */
|
||||||
|
|
||||||
/* Get pointer to HumanPlayer member function for selected button. */
|
/* Get pointer to HumanPlayer member function for selected button. */
|
||||||
void (HumanPlayer::*const pBtnHandler)(void) = apBtnHandlerTable[btn];
|
void (HumanPlayer::*const pBtnHandler)(void) = apBtnHandlerTable[u8Btn];
|
||||||
|
|
||||||
if (pBtnHandler != NULL)
|
if (pBtnHandler != NULL)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +92,7 @@ void HumanPlayer::buttonHandler(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get pointer to Camera member function for selected button. */
|
/* Get pointer to Camera member function for selected button. */
|
||||||
void (Camera::*const pCameraBtnHandler)(void) = apBtnCameraHandlerTable[btn];
|
void (Camera::*const pCameraBtnHandler)(void) = apBtnCameraHandlerTable[u8Btn];
|
||||||
|
|
||||||
if (pCameraBtnHandler != NULL)
|
if (pCameraBtnHandler != NULL)
|
||||||
{
|
{
|
||||||
|
|
40
Menu.cpp
40
Menu.cpp
|
@ -1,6 +1,6 @@
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Includes *
|
* Includes
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "HumanPlayer.h"
|
#include "HumanPlayer.h"
|
||||||
|
@ -9,23 +9,31 @@
|
||||||
#include <Gamebuino.h>
|
#include <Gamebuino.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Defines *
|
* Defines
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#define GAME_NAME "Pocket Empires"
|
#define GAME_NAME "Pocket Empires"
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Structs and enums *
|
* Types definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Local variables *
|
* Global variables definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Functions definition *
|
* Local variables definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Local prototypes declaration
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Functions definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
|
@ -44,6 +52,8 @@ void MainMenu(void)
|
||||||
MAX_CHOICES
|
MAX_CHOICES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Strings must be individually allocated into
|
||||||
|
* PROGMEM so they can be read correctly by gb.menu(). */
|
||||||
static const char strMainMenuOptions_0[] PROGMEM = "Single player game";
|
static const char strMainMenuOptions_0[] PROGMEM = "Single player game";
|
||||||
static const char strMainMenuOptions_1[] PROGMEM = "Multiplayer game";
|
static const char strMainMenuOptions_1[] PROGMEM = "Multiplayer game";
|
||||||
static const char strMainMenuOptions_2[] PROGMEM = "Options";
|
static const char strMainMenuOptions_2[] PROGMEM = "Options";
|
||||||
|
|
38
Player.cpp
38
Player.cpp
|
@ -1,25 +1,33 @@
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Includes *
|
* Includes
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Defines *
|
* Defines
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Structs and enums *
|
* Types definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Local variables *
|
* Global variables definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Functions definition *
|
* Local variables definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Local prototypes declaration
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Functions definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
|
|
36
Sprite.cpp
36
Sprite.cpp
|
@ -1,28 +1,32 @@
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Includes
|
* Includes
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Defines
|
* Defines
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Structs and enums
|
* Types definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Global Variables
|
* Global variables definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Local Variables
|
* Local variables definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Local Prototypes
|
* Local prototypes declaration
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Functions definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
|
|
36
System.cpp
36
System.cpp
|
@ -1,13 +1,13 @@
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Includes
|
* Includes
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <Gamebuino.h>
|
#include <Gamebuino.h>
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Defines
|
* Defines
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#define mCHECK_COLLISION(x1, y1, w1, h1, x2, y2, w2, h2) \
|
#define mCHECK_COLLISION(x1, y1, w1, h1, x2, y2, w2, h2) \
|
||||||
(!( ((x1) >= (x2) + (w2)) \
|
(!( ((x1) >= (x2) + (w2)) \
|
||||||
|
@ -18,13 +18,13 @@
|
||||||
|| \
|
|| \
|
||||||
((y2) >= (y1) + (h1)) )
|
((y2) >= (y1) + (h1)) )
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Structs and enums
|
* Types definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Global Variables
|
* Global variables definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
|
@ -33,13 +33,17 @@
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
Gamebuino gb;
|
Gamebuino gb;
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Local Variables
|
* Local variables definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Local Prototypes
|
* Local prototypes declaration
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Functions definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
|
|
36
Unit.cpp
36
Unit.cpp
|
@ -1,28 +1,32 @@
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Includes
|
* Includes
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include "Unit.h"
|
#include "Unit.h"
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Defines
|
* Defines
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Structs and enums
|
* Types definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Global Variables
|
* Global variables definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Local Variables
|
* Local variables definition
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* *************************************
|
/* *******************************************************************
|
||||||
* Local Prototypes
|
* Local prototypes declaration
|
||||||
* *************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Functions definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
|
|
43
main.cpp
43
main.cpp
|
@ -1,30 +1,43 @@
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Includes *
|
* Includes
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Defines *
|
* Defines
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Global variables *
|
* Types definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
/* **************************************
|
/* *******************************************************************
|
||||||
* Functions definition *
|
* Global variables definition
|
||||||
* **************************************/
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Local variables definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Local prototypes declaration
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
|
/* *******************************************************************
|
||||||
|
* Functions definition
|
||||||
|
* ******************************************************************/
|
||||||
|
|
||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
*
|
*
|
||||||
* \brief Initializes the device and game parameters.
|
* \brief Initializes the device and game parameters and
|
||||||
|
* executes the game.
|
||||||
*
|
*
|
||||||
* \return Error code (always 0), but is never returned.
|
* \return Error code (always 0), but must never be returned.
|
||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
/* Initialize system and game parameters. */
|
/* Initialize system and game parameters. */
|
||||||
SystemInit();
|
SystemInit();
|
||||||
|
|
Loading…
Reference in New Issue