MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / inputMapping

Function inputMapping

TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp:2425–2475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2423 static KeyModifier s_keyMod = KEYMOD_NONE;
2424
2425 void inputMapping(const char* name, InputAction action)
2426 {
2427 u32 indices[2];
2428 u32 count = inputMapping_getBindingsForAction(action, indices, 2);
2429
2430 char inputName1[256] = "##Input1";
2431 char inputName2[256] = "##Input2";
2432
2433 ImGui::LabelText("##ConfigLabel", "%s", name); ImGui::SameLine(132*s_uiScale);
2434 if (count >= 1)
2435 {
2436 InputBinding* binding = inputMapping_getBindingByIndex(indices[0]);
2437 getBindingString(binding, inputName1);
2438 strcat(inputName1, "##Input1");
2439 strcat(inputName1, name);
2440 }
2441 else
2442 {
2443 strcat(inputName1, name);
2444 }
2445
2446 if (count >= 2)
2447 {
2448 InputBinding* binding = inputMapping_getBindingByIndex(indices[1]);
2449 getBindingString(binding, inputName2);
2450 strcat(inputName2, "##Input2");
2451 strcat(inputName2, name);
2452 }
2453 else
2454 {
2455 strcat(inputName2, name);
2456 }
2457
2458 if (ImGui::Button(inputName1, ImVec2(120.0f*s_uiScale, 0.0f)))
2459 {
2460 // Press Key Popup.
2461 s_keyIndex = s32(action);
2462 s_keySlot = 0;
2463 s_keyMod = TFE_Input::getKeyModifierDown();
2464 ImGui::OpenPopup("##ChangeBinding");
2465 }
2466 ImGui::SameLine();
2467 if (ImGui::Button(inputName2, ImVec2(120.0f*s_uiScale, 0.0f)))
2468 {
2469 // Press Key Popup.
2470 s_keyIndex = s32(action);
2471 s_keySlot = 1;
2472 s_keyMod = TFE_Input::getKeyModifierDown();
2473 ImGui::OpenPopup("##ChangeBinding");
2474 }
2475 }
2476
2477 bool uiControlsEnabled()
2478 {

Callers 1

configInputFunction · 0.85

Calls 6

getBindingStringFunction · 0.85
ButtonEnum · 0.85
ImVec2Function · 0.85
getKeyModifierDownFunction · 0.85

Tested by

no test coverage detected