Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2025-04-05 22:16:26 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2025-04-05 22:16:26 +0100
commit8701a3d42c86aada738bfb3b5f817e6e1ce12a47 (patch)
tree79b9b7d239ff7b431fd6a50119061a9394bd2d15 /src
parent7bb8b8c7670728b0dcd510d8a8205bb3776368dd (diff)
parent3fba436a0b83cce81353e3b170621a1632d8b219 (diff)
downloadldjam57-8701a3d42c86aada738bfb3b5f817e6e1ce12a47.tar
Merge branch 'main' of codeberg.org:shtanton/ldjam57
Diffstat (limited to 'src')
-rw-r--r--src/all.c9
-rw-r--r--src/levels.c5
-rw-r--r--src/tick.c5
-rw-r--r--src/types.c8
4 files changed, 24 insertions, 3 deletions
diff --git a/src/all.c b/src/all.c
index b1560a5..e5c86db 100644
--- a/src/all.c
+++ b/src/all.c
@@ -89,9 +89,14 @@ static const Color colors[N_COLORS][4] = {
},
};
+#define BUTTON_SIZE 32
+#define BUTTON_SPACING 16
+#define BUTTON_SPACER(i) (BUTTON_SPACING + (BUTTON_SIZE * (i) + (i) * BUTTON_SPACING))
+
static const Button buttons[N_BUTTONS] = {
- [BUTTON_RETRY] = {.x = 16, .y = 16, .w = 128, .h = 32},
- [BUTTON_BACK] = {.x = 16, .y = 48, .w = 128, .h = 32},
+ [BUTTON_CONTINUE] = {.x = BUTTON_SPACING, .y = BUTTON_SPACER(BUTTON_CONTINUE), .w = BUTTON_SIZE, .h = BUTTON_SIZE},
+ [BUTTON_RETRY] = {.x = BUTTON_SPACING, .y = BUTTON_SPACER(BUTTON_RETRY), .w = BUTTON_SIZE, .h = BUTTON_SIZE},
+ [BUTTON_BACK] = {.x = BUTTON_SPACING, .y = BUTTON_SPACER(BUTTON_BACK), .w = BUTTON_SIZE, .h = BUTTON_SIZE},
};
static DrawList *render(State *state, UI *ui, Arena *a) {
diff --git a/src/levels.c b/src/levels.c
index 22ad76a..004d0d9 100644
--- a/src/levels.c
+++ b/src/levels.c
@@ -1,3 +1,6 @@
+#ifndef INCLUDE_LEVELS_C
+#define INCLUDE_LEVELS_C
+
#include "all.c"
typedef struct {
@@ -35,3 +38,5 @@ static Level levels[] = {
#undef _
#undef B
#undef O
+
+#endif // INCLUDE_LEVELS_C
diff --git a/src/tick.c b/src/tick.c
index 8b8f731..4b255df 100644
--- a/src/tick.c
+++ b/src/tick.c
@@ -1,3 +1,6 @@
+#ifndef INCLUDE_TICK_C
+#define INCLUDE_TICK_C
+
#include "all.c"
static int isRed(int cell) {
@@ -333,3 +336,5 @@ static void tick(Game *game, Arena a) {
// TODO: Win conditions
}
}
+
+#endif // INCLUDE_TICK_C
diff --git a/src/types.c b/src/types.c
index fde4ab4..bfe0d7d 100644
--- a/src/types.c
+++ b/src/types.c
@@ -1,10 +1,13 @@
+#ifndef INCLUDE_TYPES_C
+#define INCLUDE_TYPES_C
+
#include "all.c"
#define MEM_SIZE (1<<24)
#define GRIDWIDTH 20
#define GRIDHEIGHT 16
#define TICK_LENGTH 200
-#define GRID_OFFSET_X 256
+#define GRID_OFFSET_X 64
typedef struct {
unsigned char r, g, b, a;
@@ -45,6 +48,7 @@ enum {
};
enum {
+ BUTTON_CONTINUE,
BUTTON_RETRY,
BUTTON_BACK,
N_BUTTONS,
@@ -107,3 +111,5 @@ static void *alloc(Arena *a, ptrdiff_t count, ptrdiff_t size, ptrdiff_t align) {
return r;
}
+
+#endif // INCLUDE_TYPES_C