Skip to content

Commit

Permalink
Fix #183
Browse files Browse the repository at this point in the history
  • Loading branch information
ske2004 committed May 14, 2024
1 parent 6910034 commit a84a7ef
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ th_input_cycle()
memset(thg->press_repeat, 0, 512 * sizeof(uu));
}

void
th_input_reset()
{
th_input_cycle();
memset(thg->pressed, 0, 512 * sizeof(uu));
}

// Deadzone and drift fix
static float
i_fix(float value)
Expand Down
2 changes: 1 addition & 1 deletion src/staembed.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "tophat.h"
#include "tophat.h"
const char *th_em_modulesrc[] = {
"\n"
"import (\n"
Expand Down
2 changes: 2 additions & 0 deletions src/tophat.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ th_input_sync_fake_keys();
void
th_input_cycle();
void
th_input_reset();
void
th_input_update_gamepads();

// misc
Expand Down
1 change: 1 addition & 0 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ static void
event(const sapp_event *ev)
{
switch (ev->type) {
case SAPP_EVENTTYPE_UNFOCUSED: th_input_reset(); break;
case SAPP_EVENTTYPE_MOUSE_MOVE:
thg->mouse_delta = (th_vf2){.x = ev->mouse_dx, .y = ev->mouse_dy};
thg->mouse = (th_vf2){.x = ev->mouse_x, .y = ev->mouse_y};
Expand Down

0 comments on commit a84a7ef

Please sign in to comment.