diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 11:42:23 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 11:42:23 -0500 |
| commit | d159969a1b5e1018900bb40cf5e9f2a79fb2a7f7 (patch) | |
| tree | b341daf0274a883ba6cf4c2c52999a3107ea1373 /runtime/test/gameinput_test.cpp | |
| parent | d8c5a10f3518a58d74ef199c4bbd655a7d64b549 (diff) | |
| parent | 3ff74e8d58cb9420e4dae884378b98eb55ce62b2 (diff) | |
Merge pull request #2162 from Cozma
Diffstat (limited to 'runtime/test/gameinput_test.cpp')
| -rw-r--r-- | runtime/test/gameinput_test.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/test/gameinput_test.cpp b/runtime/test/gameinput_test.cpp index a0a950d9d..d7da81b60 100644 --- a/runtime/test/gameinput_test.cpp +++ b/runtime/test/gameinput_test.cpp | |||
| @@ -393,6 +393,33 @@ void test_keyboard_pad_sticks(IGameInput* input, IGameInputDevice* kb) { | |||
| 393 | } | 393 | } |
| 394 | check(monotonic && polls < 100 && sticks_at_rest(st), "keyboard pad: right stick decays to 0 when the mouse stops"); | 394 | check(monotonic && polls < 100 && sticks_at_rest(st), "keyboard pad: right stick decays to 0 when the mouse stops"); |
| 395 | 395 | ||
| 396 | // LEONIDA_MOUSE_SENSITIVITY scales the axis units per count: 2 doubles, 0.5 halves; out of range clamps. | ||
| 397 | auto settle = [&] { | ||
| 398 | for (int i = 0; i < 200 && !sticks_at_rest(pad_state(input, kb)); ++i) rt::gameinput::poll(); | ||
| 399 | }; | ||
| 400 | set_env("LEONIDA_MOUSE_SENSITIVITY", "2"); | ||
| 401 | rt::gameinput::reload_config(); | ||
| 402 | g_cursor_x += 10; | ||
| 403 | rt::gameinput::poll(); | ||
| 404 | check(approx(pad_state(input, kb).rightThumbstickX, 20480 / 32767.0f), "keyboard pad: mouse sensitivity 2 doubles the stick"); | ||
| 405 | settle(); | ||
| 406 | set_env("LEONIDA_MOUSE_SENSITIVITY", "0.5"); | ||
| 407 | rt::gameinput::reload_config(); | ||
| 408 | g_cursor_x -= 10; | ||
| 409 | rt::gameinput::poll(); | ||
| 410 | check(approx(pad_state(input, kb).rightThumbstickX, -5120 / 32767.0f), "keyboard pad: mouse sensitivity 0.5 halves the stick"); | ||
| 411 | settle(); | ||
| 412 | set_env("LEONIDA_MOUSE_SENSITIVITY", "100"); | ||
| 413 | rt::gameinput::reload_config(); | ||
| 414 | check(rt::gameinput::config().mouse_sensitivity == 10.0f, "keyboard pad: mouse sensitivity clamps to 10"); | ||
| 415 | set_env("LEONIDA_MOUSE_SENSITIVITY", "0"); | ||
| 416 | rt::gameinput::reload_config(); | ||
| 417 | check(approx(rt::gameinput::config().mouse_sensitivity, 0.1f), "keyboard pad: mouse sensitivity clamps to 0.1"); | ||
| 418 | set_env("LEONIDA_MOUSE_SENSITIVITY", nullptr); | ||
| 419 | rt::gameinput::reload_config(); | ||
| 420 | check(rt::gameinput::config().mouse_sensitivity == 1.0f && rt::gameinput::config().ds_trigger_gain == 1.0f, | ||
| 421 | "keyboard pad: mouse sensitivity defaults to 1 and leaves the trigger gain alone"); | ||
| 422 | |||
| 396 | g_keys[VK_RBUTTON] = true; | 423 | g_keys[VK_RBUTTON] = true; |
| 397 | rt::gameinput::poll(); | 424 | rt::gameinput::poll(); |
| 398 | st = pad_state(input, kb); | 425 | st = pad_state(input, kb); |