From dc96fcd771bea09d726a760266739906e95c09a6 Mon Sep 17 00:00:00 2001 From: Vasco Date: Sun, 23 Aug 2026 02:25:33 +0100 Subject: Peak 0.1.1 --- Peak/src/p_emscripten.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Peak/src/p_emscripten.c (limited to 'Peak/src/p_emscripten.c') 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 +#include +#include + +#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; +} -- cgit v1.3.1