summaryrefslogtreecommitdiff
path: root/Game.cpp
blob: 175d2477c6b4c54f6c7d6f6669e21920dfd1324c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* *******************************************************************
 *  Includes
 * ******************************************************************/

#include "Game.h"
#include "Sprite.h"
#include "MouseSpr.i"
#include "System.h"
#include <Gamebuino.h>
#include <Display.h>

/* *******************************************************************
 *  Defines
 * ******************************************************************/

/* *******************************************************************
 *  Types definition
 * ******************************************************************/

enum tPauseMenuChoice
{
    PAUSE_MENU_CHOICE_RESUME,
    PAUSE_MENU_CHOICE_QUIT,

    MAX_PAUSE_MENU_CHOICES,
};

/* *******************************************************************
 *  Global variables definition
 * ******************************************************************/

/* *******************************************************************
 *  Local variables definition
 * ******************************************************************/

/* *******************************************************************
 *  Local prototypes declaration
 * ******************************************************************/

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;
}