mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
api: check for window focus when accepting input (#317)
## Link to GitHub Issue, if one exists Fixes #139 ## Description of change Add an option for detecting window focus when accepting input. The new default will be to have the following: * naive bindings will check for window focus * rawinput binds are not affected, will continue to be accepted regardless of focus Other options (always / never choices) can be picked by the user to tweak the behavior if needed. Clean up usage of `0xff` constant to represent invalid naive vkey. ## Testing Still in progress, especially in regards to performance. On a i7-9700 system, 10000 calls to `superexit::has_focus()` takes 250-350 microseconds, so this should not be a big deal at all.
This commit is contained in:
@@ -2170,6 +2170,23 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
|
||||
.setting_name = "20",
|
||||
.category = "I/O Options",
|
||||
},
|
||||
{
|
||||
// InputRequiresFocus
|
||||
.title = "Input Requires Focus",
|
||||
.name = "inputfocus",
|
||||
.desc =
|
||||
"Determine input behavior when game window is not in focus.\n\n"
|
||||
"never: allow input regardless of focus\n"
|
||||
"naive (default): only naive bindings check for window focus, rawinput binds are always allowed\n"
|
||||
"always: only process input when window is in focus",
|
||||
.type = OptionType::Enum,
|
||||
.category = "I/O Options",
|
||||
.elements = {
|
||||
{"never", ""},
|
||||
{"naive", ""},
|
||||
{"always", ""},
|
||||
},
|
||||
},
|
||||
{
|
||||
// NostalgiaPoke
|
||||
.title = "Nost Screen Poke",
|
||||
|
||||
Reference in New Issue
Block a user