Fixed "includes/defines/local variables" headers.

This commit is contained in:
XaviDCR92 2018-07-09 22:33:29 +02:00
parent cd78b97bce
commit 8ed9a3a57a
9 changed files with 193 additions and 144 deletions

View File

@ -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)

View File

@ -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
* **************************************/ * ******************************************************************/
/*****************************************************************//** /*****************************************************************//**
* *

View File

@ -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)
{ {

View File

@ -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";

View File

@ -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
* ******************************************************************/
/*****************************************************************//** /*****************************************************************//**
* *

View File

@ -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
* ******************************************************************/
/*****************************************************************//** /*****************************************************************//**
* *

View File

@ -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
* ******************************************************************/
/*****************************************************************//** /*****************************************************************//**
* *

View File

@ -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
* ******************************************************************/
/*****************************************************************//** /*****************************************************************//**
* *

View File

@ -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();