Skip to content

Commit

Permalink
Merge pull request #97 from lesleyrs/master
Browse files Browse the repository at this point in the history
Add repeating A and B keys
  • Loading branch information
deltabeard authored May 29, 2024
2 parents 28d0390 + 3a065f8 commit 54a5a07
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ maximum FPS to 50.
| Start | Return | START |
| Select | Backspace | BACK |
| D-Pad | Arrow Keys | DPAD |
| Repeat A | a | |
| Repeat B | s | |
| Normal Speed | 1 | |
| Turbo x2 (Hold) | Space | |
| Turbo X2 (Toggle) | 2 | |
Expand Down
16 changes: 16 additions & 0 deletions examples/sdl2/peanut_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,14 @@ int main(int argc, char **argv)
gb.direct.joypad_bits.b = 0;
break;

case SDLK_a:
gb.direct.joypad_bits.a = ~gb.direct.joypad_bits.a;
break;

case SDLK_s:
gb.direct.joypad_bits.b = ~gb.direct.joypad_bits.b;
break;

case SDLK_UP:
gb.direct.joypad_bits.up = 0;
break;
Expand Down Expand Up @@ -1167,6 +1175,14 @@ int main(int argc, char **argv)
gb.direct.joypad_bits.b = 1;
break;

case SDLK_a:
gb.direct.joypad_bits.a = 1;
break;

case SDLK_s:
gb.direct.joypad_bits.b = 1;
break;

case SDLK_UP:
gb.direct.joypad_bits.up = 1;
break;
Expand Down

0 comments on commit 54a5a07

Please sign in to comment.