summaryrefslogtreecommitdiff
path: root/micro/context.h
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-04-06 17:04:05 -0400
committeriamcheeseman <[email protected]>2026-04-06 17:06:53 -0400
commit957c64c7b8b5e98d8a03dd84c7e27e7991fb9dbc (patch)
treef5fc230703791cee8d8e7851fb87eaef07ae63a2 /micro/context.h
Initial commit
Diffstat (limited to 'micro/context.h')
-rw-r--r--micro/context.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/micro/context.h b/micro/context.h
new file mode 100644
index 0000000..248c475
--- /dev/null
+++ b/micro/context.h
@@ -0,0 +1,36 @@
+#ifndef __MICRO_CONTEXT_H__
+#define __MICRO_CONTEXT_H__
+
+#include <GLFW/glfw3.h>
+
+#include "common.h"
+#include "renderer.h"
+
+struct ctx_hints {
+ int win_width;
+ int win_height;
+ const char *win_title;
+ int ticrate;
+};
+
+struct ctx {
+ struct ctx_hints creation_hints;
+ GLFWwindow *win;
+ double ticrate;
+ double prev_tic_ts;
+
+ struct renderer renderer;
+};
+
+void init_ctx(struct ctx *ctx, struct ctx_hints creation_hints);
+void deinit_ctx(struct ctx *ctx);
+
+// Whether or not the main loop should continue executing.
+bool is_game_running(struct ctx *ctx);
+// Handle events, tick game logic, etc. Returns the amount of times you should
+// tic.
+int game_tick(struct ctx *ctx);
+// Draw stuff at an interpolated state.
+void game_draw(struct ctx *ctx);
+
+#endif // __MICRO_CONTEXT_H__