aboutsummaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-10-12 00:13:15 +0200
committerNicholas Rodrigues Lordello <[email protected]>2026-10-12 00:13:15 +0200
commitc6f5cca39dad3f395e8b479f6106feb10e710695 (patch)
treede7bf2cb65cbc3e745ba38e62c748180ee9095a5 /src/input.c
parent88aedb9414800d2e0002430d2d260ea77a60ea8c (diff)
Implement Partial Emscripten SDL API
Start implementing the surface-specific SDL API so that we can get our stub PICO-8 engine to draw a mouse crosshairs to screen. The Emscripten runtime still needs its own file, and we need to convert everything over to `wasm2c`.
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/input.c b/src/input.c
index db491dd..fb3e55a 100644
--- a/src/input.c
+++ b/src/input.c
@@ -315,11 +315,15 @@ enum pw_keymod pw_input_keymod(struct pw_input *input) {
return input->keyboard.mod;
}
-enum pw_mouse_button pw_input_mouse(struct pw_input *input) {
+enum pw_mouse_button pw_input_mouse(struct pw_input *input,
+ struct pw_coordinates *pos) {
if (!input) {
SDL_InvalidParamError("input");
return PW_MOUSE_BUTTON_NONE;
}
+ if (pos) {
+ SDL_memcpy(pos, &input->mouse.pos, sizeof(*pos));
+ }
return input->mouse.button;
}