Skip to content

Commit

Permalink
Make arrow keys not scroll so slow you want to self-harm
Browse files Browse the repository at this point in the history
All keyboard and mouse button work via standard text editor semantics:
keeping a button pressed will wait for a while, after which it will
repeat at fixed rate.

That's fine for a text editor or whatnot, but it's painful when you want
to scroll with the arrow keys. I hated this back when I first played the
game, and I'm hating it now. I don't think anyone will miss the old
"functionality".

We can't outright remove the delay for all keys, as e.g. pressing "i"
will repeat so fast that you can never open the inventory. Come to think
of it, I think we can remove all of this functionality, at least for the
keyboard as I don't *think* it's ever used (it is used for mouse
buttons, although that too can be simplified greatly) – but all of that
is a much larger refactor.
  • Loading branch information
arp242 committed Jun 20, 2023
1 parent 55fb75b commit 28b2aea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plib/gnw/input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,10 @@ void GNW95_process_message()
if (ptr->time != -1) {
unsigned int elapsedTime = ptr->time > tick ? INT_MAX : tick - ptr->time;
unsigned int delay = ptr->count == 0 ? GNW95_repeat_delay : GNW95_repeat_rate;
switch (key) {
case SDL_SCANCODE_LEFT: case SDL_SCANCODE_RIGHT: case SDL_SCANCODE_UP: case SDL_SCANCODE_DOWN:
delay = 0;
}
if (elapsedTime > delay) {
keyboardData.key = key;
keyboardData.down = 1;
Expand Down

0 comments on commit 28b2aea

Please sign in to comment.