MCPcopy Create free account
hub / github.com/RevoSucks/BM64Recomp / poll_inputs

Method poll_inputs

src/game/input.cpp:466–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464};
465
466void recomp::poll_inputs() {
467 InputState.keys = SDL_GetKeyboardState(&InputState.numkeys);
468 InputState.keymod = SDL_GetModState();
469
470 {
471 std::lock_guard lock{ InputState.cur_controllers_mutex };
472 InputState.cur_controllers.clear();
473
474 for (const auto& [id, state] : InputState.controller_states) {
475 (void)id; // Avoid unused variable warning.
476 SDL_GameController* controller = state.controller;
477 if (controller != nullptr) {
478 InputState.cur_controllers.push_back(controller);
479 }
480 }
481 }
482
483 // Read the deltas while resetting them to zero.
484 {
485 std::lock_guard lock{ InputState.pending_input_mutex };
486
487 InputState.rotation_delta = InputState.pending_rotation_delta;
488 InputState.pending_rotation_delta = { 0.0f, 0.0f };
489
490 InputState.mouse_delta = InputState.pending_mouse_delta;
491 InputState.pending_mouse_delta = { 0.0f, 0.0f };
492 }
493
494 // Quicksaving is disabled for now and will likely have more limited functionality
495 // when restored, rather than allowing saving and loading at any point in time.
496 #if 0
497 if (InputState.keys) {
498 static bool save_was_held = false;
499 static bool load_was_held = false;
500 bool save_is_held = InputState.keys[SDL_SCANCODE_F5] != 0;
501 bool load_is_held = InputState.keys[SDL_SCANCODE_F7] != 0;
502 if (save_is_held && !save_was_held) {
503 zelda64::quicksave_save();
504 }
505 else if (load_is_held && !load_was_held) {
506 zelda64::quicksave_load();
507 }
508 save_was_held = save_is_held;
509 }
510 #endif
511}
512
513void recomp::set_rumble(int controller_num, bool on) {
514 if (controller_num == 0) {

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected