AtlatestRepositorysigil-app

sigil-app / tree / src / capp-internal.h

1/*
2 * app-internal.h - Internal header for Sigil App package
3 *
4 * Provides application state for windowing, input, and app lifecycle.
5 */
6
7#ifndef SIGIL_APP_INTERNAL_H
8#define SIGIL_APP_INTERNAL_H
9
10#include <sigil/sigil.h>
11#include <stdbool.h>
13/*
14 * Application state
15 */
16typedef struct {
17 SigilVM *vm;
19 /* Callbacks from Scheme */
20 Value init_callback;
21 Value frame_callback;
22 Value cleanup_callback;
24 /* Frame timing */
25 double frame_time; /* Seconds since last frame */
26 double time_elapsed; /* Seconds since app start */
28 /* Input state - current frame */
29 bool keys_down[512];
30 bool keys_pressed[512];
31 bool keys_released[512];
33 bool mouse_buttons[3];
34 bool mouse_pressed[3];
35 bool mouse_released[3];
36 float mouse_x;
37 float mouse_y;
39 /* Quit handling */
40 bool quit_requested;
41} AppState;
43/* Global state - initialized by app module */
44extern AppState *g_app;
46/* Initialize/shutdown app state */
47void sigil_app_state_init(SigilVM *vm);
48void sigil_app_state_shutdown(void);
50/* Input handling helpers */
51void sigil_app_clear_frame_input(void);
52int sigil_app_key_code_from_symbol(SigilVM *vm, Value sym);
54#endif /* SIGIL_APP_INTERNAL_H */