summaryrefslogtreecommitdiff
path: root/platformer/src/window.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--platformer/src/window.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/platformer/src/window.h b/platformer/src/window.h
new file mode 100644
index 0000000..c40dc9e
--- /dev/null
+++ b/platformer/src/window.h
@@ -0,0 +1,43 @@
+/*
+ * ============================================================
+ * FILE: window.h
+ *
+ * PURPOSE: Public interface for the OS window, the OpenGL context and the
+ * clock. Hides GLFW/GLEW setup from the rest of the game.
+ *
+ * FITS IN: Called by main.c (lifecycle, loop), render.c (aspect ratio /
+ * framebuffer size), and controls.c (window handle, only for
+ * the keyboard fallback).
+ *
+ * INTERFACE: Use these exact signatures:
+ *
+ * bool window_init(void);
+ * Creates the window + GL 3.3 core context, loads GL via GLEW.
+ * Returns false (after printing why to stderr) on failure.
+ * void window_shutdown(void);
+ * bool window_should_close(void);
+ * void window_request_close(void); e.g. when Start/Esc is pressed
+ * void window_poll_events(void); once per display frame
+ * void window_swap(void); present the finished frame
+ * double window_time(void); seconds since start (double for
+ * precision over long sessions)
+ * void window_framebuffer_size(int *w, int *h); in PIXELS (for glViewport)
+ * float window_aspect(void); framebuffer width / height
+ * void window_set_title(const char *title); used for a debug readout
+ * struct GLFWwindow *window_handle(void); ONLY controls.c may use this
+ *
+ * Include <stdbool.h>. Forward-declare `struct GLFWwindow;` rather than
+ * including GLFW here, so files that include window.h don't pull in GLFW.
+ *
+ * CONVENTIONS: Include guard: WINDOW_H.
+ *
+ * NOT IN SCOPE: Fullscreen toggle, multiple windows, mouse capture.
+ *
+ * DONE WHEN: The header compiles on its own and main.c can drive the whole
+ * window lifecycle through it.
+ * ============================================================
+ */
+#ifndef WINDOW_H
+#define WINDOW_H
+
+#endif /* WINDOW_H */