Add a main menu scene with Start/Hard Mode/Music options
The game now boots into a menu (Start Game, Hard Mode toggle, Music toggle) navigated with Up/Down and A/Start, instead of dropping straight into a match. B returns to the menu from a paused or game-over state.
This commit is contained in:
1 parent
0e7477031f
commit
8bf999c33b
5 files changed
+85
-7
No files matched your search
@@ -20,6 +20,7 @@ struct RenderAssets {
|
||||
|
||||
void draw_game(const GameState &state, const RenderAssets &assets);
|
||||
void draw_stats(const GameState &state, bool internals, bool musicEnabled, uint8_t frame);
|
||||
void draw_menu(const GameState &state, const RenderAssets &assets, bool musicEnabled);
|
||||
void blink_apples(const GameState &state, u16 *gfx_apple);
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,13 @@
|
||||
#include <vector>
|
||||
#include <nds/ndstypes.h>
|
||||
|
||||
enum class Scene {
|
||||
Menu,
|
||||
Playing,
|
||||
};
|
||||
|
||||
constexpr int MENU_ITEM_COUNT = 3;
|
||||
|
||||
struct GameState {
|
||||
volatile uint16_t ticks = 0;
|
||||
volatile uint16_t snakelength = 0;
|
||||
@@ -16,6 +23,9 @@ struct GameState {
|
||||
bool paused = false;
|
||||
bool hardMode = false;
|
||||
|
||||
Scene scene = Scene::Menu;
|
||||
int menuSelection = 0;
|
||||
|
||||
uint16_t curseTicksRemaining = 0;
|
||||
|
||||
std::deque<std::array<int, 3>> snake;
|
||||
|
||||
Reference in new issue
Block a user