diff options
| author | Schark <jordan@schark.online> | 2026-09-23 23:09:55 -0400 |
|---|---|---|
| committer | Schark <jordan@schark.online> | 2026-09-23 23:09:55 -0400 |
| commit | dab65412376d1b73381446f969c1461c24169811 (patch) | |
| tree | 27adfec438a9bd9f3c96a740ab54016df5f68b80 /platformer/src/window.h | |
| parent | af03f388cbcff795158ea8345b5c876470229e8b (diff) | |
| download | gamedev-dab65412376d1b73381446f969c1461c24169811.tar.gz gamedev-dab65412376d1b73381446f969c1461c24169811.zip | |
Base prompts
Diffstat (limited to 'platformer/src/window.h')
| -rw-r--r-- | platformer/src/window.h | 43 |
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 */ |
