PocketEmpires/Game.cpp

91 lines
2.4 KiB
C++
Raw Normal View History

/* **************************************
* Includes *
* **************************************/
#include "Game.h"
#include "Sprite.h"
#include "MouseSpr.i"
#include "System.h"
#include <Gamebuino.h>
#include <Display.h>
/* **************************************
* Defines *
* **************************************/
/* **************************************
* Structs and enums *
* **************************************/
enum tPauseMenuChoice
{
PAUSE_MENU_CHOICE_RESUME,
PAUSE_MENU_CHOICE_QUIT,
MAX_PAUSE_MENU_CHOICES,
};
/* **************************************
* Global variables *
* **************************************/
/* **************************************
* Local variables *
* **************************************/
/* **************************************
* Local prototypes *
* **************************************/
static enum tPauseMenuChoice GamePause(void);
/* **************************************
* Functions definition *
* **************************************/
/*****************************************************************//**
*
* \brief Entry point for gameplay logic.
*
*********************************************************************/
void Game(const struct tGameConfig& psGameConfig)
{
#if 0
Sprite MouseSpr( MouseSprData,
INVERT,
NOROT,
NOFLIP,
(X_SCREEN_RESOLUTION >> 1) - 4,
(Y_SCREEN_RESOLUTION >> 1) - 4);
#endif /* 0 */
do
{
/* Do not calculate a new frame
* until refresh flag is set. */
while (gb.update() == false);
} while (GamePause() != PAUSE_MENU_CHOICE_QUIT);
}
static enum tPauseMenuChoice GamePause(void)
{
if (gb.buttons.released(BTN_C) != false)
{
static const char* const astrPauseMenuOptions[MAX_PAUSE_MENU_CHOICES] PROGMEM =
{
[PAUSE_MENU_CHOICE_RESUME] = "Resume",
[PAUSE_MENU_CHOICE_QUIT] = "Quit"
};
return (enum tPauseMenuChoice)gb.menu(astrPauseMenuOptions, MAX_PAUSE_MENU_CHOICES);
}
else
{
/* C button has not been pressed. Exit. */
}
/* Return false since no
* actions need to be done yet. */
return PAUSE_MENU_CHOICE_RESUME;
}