Introduce the game variables struct (#338)

Co-authored-by: emiyl <me@emiyl.com>

* Introduce the game variables struct

* Fix clang format

* Move game variables into their own file
This commit is contained in:
Rickey
2026-03-29 14:32:21 -07:00
committed by GitHub
co-authored by emiyl
parent 34fb0b22db
commit 835e44e4db
5 changed files with 73 additions and 45 deletions
+7 -3
View File
@@ -1,6 +1,8 @@
#ifndef GAME_H
#define GAME_H
#include "game_variables.h"
#include <tonc.h>
#define MAX_HAND_SIZE 16
@@ -129,12 +131,14 @@ typedef struct ContainedHandTypes
} ContainedHandTypes;
// clang-format on
typedef void (*GameStateCallback)(GameVariables* gs);
typedef struct
{
int substate;
void (*on_init)();
void (*on_update)();
void (*on_exit)();
GameStateCallback on_init;
GameStateCallback on_update;
GameStateCallback on_exit;
} StateInfo;
// Game functions
+20
View File
@@ -0,0 +1,20 @@
/**
* @file game_variables.h
*
* @brief Game global game variables struct definition
*/
#ifndef GAME_VARIABLES_H
#define GAME_VARIABLES_H
/**
* @brief A central location for all game variables.
*
* **NOTE**: This is currently WIP and will be populated with a refactor effort.
* NOT ALL VARIABLES ARE LOCATED HERE YET
*/
typedef struct
{
} GameVariables;
#endif // GAME_VARIABLES_H
+5 -3
View File
@@ -7,6 +7,8 @@
#ifndef SPLASH_SCREEN_H
#define SPLASH_SCREEN_H
#include "game.h"
#include <tonc.h>
/** @name Splash screen timing variables
@@ -23,16 +25,16 @@
/**
* @brief Initialize the splash screen by printing the splash screen text.
*/
void splash_screen_on_init(void);
void splash_screen_on_init(GameVariables* vars);
/**
* @brief Update splash screen timers and print the remaining time accordingly.
*/
void splash_screen_on_update(void);
void splash_screen_on_update(GameVariables* vars);
/**
* @brief Exit the splash screen
*/
void splash_screen_on_exit(void);
void splash_screen_on_exit(GameVariables* vars);
#endif // SPLASH_SCREEN_H