Files
snakePlus/include/game_state.h
T
phillip 8bf999c33b 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.
2026-09-03 22:27:49 +02:00

38 lines
745 B
C++

#ifndef GAME_STATE_H
#define GAME_STATE_H
#include <array>
#include <deque>
#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;
volatile uint16_t snakeDirection = 1;
volatile uint16_t score = 0;
bool gameOver = false;
bool paused = false;
bool hardMode = false;
Scene scene = Scene::Menu;
int menuSelection = 0;
uint16_t curseTicksRemaining = 0;
std::deque<std::array<int, 3>> snake;
std::vector<std::array<int, 2>> apples;
std::vector<std::array<int, 2>> bad_apples;
std::vector<std::array<int, 2>> cursed_apples;
};
#endif