aboutsummaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-10-10 21:42:08 +0200
committerNicholas Rodrigues Lordello <[email protected]>2026-10-10 21:42:08 +0200
commiteb12c5386f4ea75f4a715b50d73eb8bc74b12815 (patch)
tree96de1ea949fc81021c5f5119dd56a42cce9a3cbc /src/input.c
parentbfcf30e800c68e0289f17b3967081280fca6592c (diff)
Fix Some Bugs
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/input.c b/src/input.c
index 9e41ebe..db491dd 100644
--- a/src/input.c
+++ b/src/input.c
@@ -5,7 +5,7 @@
struct pw_input *pw_input_init(void) {
struct pw_input *input = SDL_malloc(sizeof(*input));
if (!input) {
- return false;
+ return NULL;
}
SDL_zerop(input);
@@ -195,7 +195,7 @@ bool pw_input_event(struct pw_input *input, struct pw_players *players,
return false;
}
if (!players) {
- SDL_InvalidParamError("input");
+ SDL_InvalidParamError("players");
return false;
}
if (!event) {
@@ -225,19 +225,19 @@ static void update_keymod(struct pw_input *input) {
input->keyboard.mod |= PW_KEYMOD_LSHIFT;
}
if (state & SDL_KMOD_RSHIFT) {
- input->keyboard.mod |= PW_KEYMOD_LSHIFT;
+ input->keyboard.mod |= PW_KEYMOD_RSHIFT;
}
if (state & SDL_KMOD_LCTRL) {
- input->keyboard.mod |= PW_KEYMOD_LSHIFT;
+ input->keyboard.mod |= PW_KEYMOD_LCTRL;
}
if (state & SDL_KMOD_RCTRL) {
- input->keyboard.mod |= PW_KEYMOD_LSHIFT;
+ input->keyboard.mod |= PW_KEYMOD_RCTRL;
}
if (state & SDL_KMOD_LALT) {
- input->keyboard.mod |= PW_KEYMOD_LSHIFT;
+ input->keyboard.mod |= PW_KEYMOD_LALT;
}
if (state & SDL_KMOD_RALT) {
- input->keyboard.mod |= PW_KEYMOD_LSHIFT;
+ input->keyboard.mod |= PW_KEYMOD_RALT;
}
}
@@ -299,7 +299,7 @@ enum pw_button pw_input_btn(struct pw_input *input, size_t player) {
// menu needs to be set if it is set for any player.
if (!player) {
for (size_t i = 1; i < PW_PLAYERS_MAX; i++) {
- button |= input->players[player] & PW_BUTTON_MENU;
+ button |= input->players[i] & PW_BUTTON_MENU;
}
}