Skip to content

Commit

Permalink
make 3DS controller same with PC controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seng-Jik committed Mar 2, 2022
1 parent 589a4f3 commit 198cf20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions cpymo-backends/3ds/cpymo_backend_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ cpymo_input cpymo_input_snapshot()

if((keys & KEY_ZL)) cpymo_input_fast_kill_pressed = true;

out.ok = (keys & KEY_A) > 0;
out.skip = (keys & KEY_R) > 0;
out.cancel = (keys & KEY_B) > 0;
out.ok = (keys & KEY_A) > 0 || (keys & KEY_Y) > 0;
out.skip = (keys & KEY_R) > 0 || (keys & KEY_ZR) > 0;
out.cancel = (keys & KEY_B) > 0 || (keys & KEY_X) > 0;
out.hide_window = (keys & KEY_L) > 0;
out.auto_mode = (keys & KEY_Y) > 0;
out.down = (keys & KEY_DOWN) > 0;
Expand All @@ -27,8 +27,14 @@ cpymo_input cpymo_input_snapshot()
circlePosition pos;
hidCircleRead(&pos);

if(pos.dy > 170) out.up = true;
else if(pos.dy < -170) out.down = true;
circlePosition cpos;
hidCstickRead(&cpos);

if(pos.dy > 170 || cpos.dy > 32) out.up = true;
else if(pos.dy < -170 || cpos.dy < -32) out.down = true;

if(pos.dx > 170 || cpos.dx > 32) out.right = true;
else if(pos.dx < -170 || cpos.dx < -32) out.left = true;

return out;
}
4 changes: 2 additions & 2 deletions cpymo/cpymo_key_pulse.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ static inline void cpymo_key_pluse_update(cpymo_key_pluse *p, float dt, bool pre
}
}
else {
if (p->timer >= 0.075f) {
if (p->timer >= 0.05f) {
p->output = true;
p->timer -= 0.075f;
p->timer -= 0.05f;
}
}
}
Expand Down

0 comments on commit 198cf20

Please sign in to comment.