Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/src/types.c
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2025-04-06 17:17:59 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2025-04-06 17:17:59 +0100
commit75d02c350fa76ffb9f960338b893179f3661692d (patch)
tree1c701e571a8f89a465a581d3496b398672b11651 /src/types.c
parent775d80fe2ea7c541eb3f1180e02a48ae5498743e (diff)
parent672ae1cdc364d15787e0433b3578d0fb30e2231e (diff)
downloadldjam57-75d02c350fa76ffb9f960338b893179f3661692d.tar
Merge branch 'main' into hover
Diffstat (limited to 'src/types.c')
-rw-r--r--src/types.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/types.c b/src/types.c
index b50228c..bee6b05 100644
--- a/src/types.c
+++ b/src/types.c
@@ -8,6 +8,7 @@
#define GRIDHEIGHT 16
#define TICK_LENGTH 200
#define GRID_OFFSET_X 64
+#define MAX_PLACEABLE_CELLS 16
typedef struct {
unsigned char r, g, b, a;
@@ -48,9 +49,20 @@ enum {
};
enum {
- BUTTON_CONTINUE,
- BUTTON_RETRY,
+ IMAGE_NULL,
+ IMAGE_CONTINUE,
+ IMAGE_EXIT,
+ IMAGE_PAUSE,
+ IMAGE_PLAY,
+ IMAGE_RETRY,
+ N_IMAGES,
+};
+
+enum {
BUTTON_BACK,
+ BUTTON_RETRY,
+ BUTTON_PLAY,
+ BUTTON_CONTINUE,
N_BUTTONS,
};
@@ -70,11 +82,19 @@ typedef struct {
} Button;
typedef struct {
+ int grid[GRIDWIDTH * GRIDHEIGHT];
+ int goalx, goaly;
+ int placeableCells[MAX_PLACEABLE_CELLS]; // Color
+} Level;
+
+typedef struct {
uint64_t lastTick;
char playing;
int grid[GRIDWIDTH * GRIDHEIGHT];
int goalx, goaly;
ButtonState buttonStates[N_BUTTONS];
+ int currentLevel;
+ int placedCells[MAX_PLACEABLE_CELLS]; // indices into Level placeableCells
} State;
// Mirror these in src/index.html.in
@@ -84,6 +104,7 @@ enum {
INPUT_RCLICK,
INPUT_PAUSE_PLAY,
INPUT_MOVE,
+ INPUT_RESTART,
};
typedef struct {