Opened 14 years ago

Closed 14 years ago

#2263 closed defect (fixed)

BS1: savegame name text input ignores keypresses

Reported by: wjp Owned by:
Priority: normal Component: Engine: Sword1
Keywords: Cc:
Game: Broken Sword 1

Description

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 eriktorbjorn, 14 years ago

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?

comment:2 by wjp, 14 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 lavosspawn, 14 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.