Opened 18 years ago
Closed 18 years ago
#2263 closed defect (fixed)
BS1: savegame name text input ignores keypresses
|Reported by:||wjp||Owned by:|
|Cc:||Game:||Broken Sword 1|
The keyboard handling in the sword1 savegame dialog uses a variable to store the 'current keypress', and polls this variable to check for keypresses.
This means it almost always misses keypresses when several keys are pressed rapidly in a row, giving a very laggy feel to the dialog.
The least invasive way of fixing this would probably be the introduction of a small keyboard buffer that can store, say, 16 keypresses, with the event handler putting keys in that list, and the key handlers removing them again.
Ticket imported from: #1328022. Ticket imported from: bugs/2263.
Change History (3)
comment:1 by , 18 years ago
comment:2 by , 18 years ago
It does make the dialog feel a lot smoother, and it's a lot harder to make keypresses disappear now.
I'll think a bit about a more permanent solution. There aren't too many places in control.cpp where key input is handled, luckily.
comment:3 by , 18 years ago
|Status:||new → closed|
Well, I believe there already is such a buffer - at least in the SDL backend. But the dialog "sleeps" periodically to avoid eating all the available CPU time, and during those sleeps the engine itself only keeps the most recent keypress.
I've decreased the sleep time in BS1 for the case where it's waiting for the user to type a savegame name. Keypresses may still be lost, but the chance of it should be much smaller.
Could you try the next snapshot and see if it made any difference for you?