summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib.h22
-rw-r--r--main.c14
2 files changed, 23 insertions, 13 deletions
diff --git a/lib.h b/lib.h
new file mode 100644
index 0000000..bebc1df
--- /dev/null
+++ b/lib.h
@@ -0,0 +1,22 @@
+#ifndef LIB_H
+#define LIB_H
+
+#include <stdbool.h>
+#include <stdlib.h>
+
+typedef struct State
+{
+ // Sandpiles
+ unsigned char *data;
+ size_t dwidth;
+
+ size_t window_len;
+ int multiplier;
+
+ bool thread_alive;
+} state_t;
+
+bool load_from_file(state_t *state, const char *filepath);
+bool write_to_file(state_t *state, const char *filepath);
+
+#endif
diff --git a/main.c b/main.c
index c20662d..ab11790 100644
--- a/main.c
+++ b/main.c
@@ -13,19 +13,7 @@
#include <raylib.h>
#include <raymath.h>
-struct State
-{
- // Sandpiles
- unsigned char *data;
- size_t dwidth;
-
- size_t window_len;
- int multiplier;
-
- bool thread_alive;
-};
-
-typedef struct State state_t;
+#include "./lib.h"
void step(state_t *state)
{