diff options
| author | Vasco <[email protected]> | 2026-08-23 02:25:33 +0100 |
|---|---|---|
| committer | Vasco <[email protected]> | 2026-08-23 02:25:33 +0100 |
| commit | dc96fcd771bea09d726a760266739906e95c09a6 (patch) | |
| tree | 5af4d4d7660a90a04016fae4defec3c2a422477d /Peak/src/p_emscripten.c | |
Peak 0.1.1
Diffstat (limited to 'Peak/src/p_emscripten.c')
| -rw-r--r-- | Peak/src/p_emscripten.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Peak/src/p_emscripten.c b/Peak/src/p_emscripten.c new file mode 100644 index 0000000..dc558f5 --- /dev/null +++ b/Peak/src/p_emscripten.c @@ -0,0 +1,38 @@ +#include <stdlib.h> +#include <string.h> +#include <stdbool.h> + +#define PEAK_CANVAS "#PeakCanvas" + +static PeakKeyCode map_key(const char *code); +static PeakKeyMod map_mod(const EmscriptenKeyboardEvent *keyEvent); +static EM_BOOL key_callback(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData); +static EM_BOOL mouse_callback(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData); +static EM_BOOL resize_callback(int eventType, const EmscriptenUiEvent *uiEvent, void *userData); + +void +peak_platform_window_open() +{ + emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, EM_TRUE, key_callback); + emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, EM_TRUE, key_callback); + emscripten_set_mousedown_callback(PEAK_CANVAS, NULL, EM_TRUE, mouse_callback); + emscripten_set_mouseup_callback(PEAK_CANVAS, NULL, EM_TRUE, mouse_callback); + emscripten_set_mousemove_callback(PEAK_CANVAS, NULL, EM_TRUE, mouse_callback); + emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, NULL, EM_TRUE, resize_callback); +} + +void +peak_platform_window_close() +{ +} + +uint32_t* +peak_platform_window_buffer(size_t *width, size_t *height) +{ +} + +bool +peak_platform_epoll(PeakEvent *ev) +{ + return 0; +} |
