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

Function configHud

TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp:3288–3328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3286 }
3287
3288 void configHud()
3289 {
3290 TFE_Settings_Hud* hud = TFE_Settings::getHudSettings();
3291 TFE_Settings_Window* window = TFE_Settings::getWindowSettings();
3292
3293 ImGui::LabelText("##ConfigLabel", "Hud Scale Type:"); ImGui::SameLine(150*s_uiScale);
3294 ImGui::SetNextItemWidth(196*s_uiScale);
3295 ImGui::Combo("##HudScaleType", (s32*)&hud->hudScale, c_tfeHudScaleStrings, IM_ARRAYSIZE(c_tfeHudScaleStrings));
3296
3297 ImGui::LabelText("##ConfigLabel", "Hud Position Type:"); ImGui::SameLine(150*s_uiScale);
3298 ImGui::SetNextItemWidth(196*s_uiScale);
3299 ImGui::Combo("##HudPosType", (s32*)&hud->hudPos, c_tfeHudPosStrings, IM_ARRAYSIZE(c_tfeHudPosStrings));
3300
3301 ImGui::Separator();
3302
3303 ImGui::SetNextItemWidth(196*s_uiScale);
3304 ImGui::SliderFloat("Scale", &hud->scale, 0.0f, 15.0f, "%.2f"); ImGui::SameLine(0.0f, 29.5f*s_uiScale);
3305 ImGui::SetNextItemWidth(128 * s_uiScale);
3306 ImGui::InputFloat("##HudScaleText", &hud->scale, 0.01f, 0.1f, "%.3f", ImGuiInputTextFlags_CharsHexadecimal);
3307
3308 ImGui::SetNextItemWidth(196*s_uiScale);
3309 ImGui::SliderInt("Offset Lt", &hud->pixelOffset[0], -512, 512); ImGui::SameLine(0.0f, 3.0f*s_uiScale);
3310 ImGui::SetNextItemWidth(128 * s_uiScale);
3311 ImGui::InputInt("##HudOffsetX0Text", &hud->pixelOffset[0], 1, 10);
3312
3313 ImGui::SetNextItemWidth(196 * s_uiScale);
3314 ImGui::SliderInt("Offset Rt", &hud->pixelOffset[1], -512, 512); ImGui::SameLine(0.0f, 3.0f*s_uiScale);
3315 ImGui::SetNextItemWidth(128 * s_uiScale);
3316 ImGui::InputInt("##HudOffsetX1Text", &hud->pixelOffset[1], 1, 10);
3317
3318 ImGui::SetNextItemWidth(196*s_uiScale);
3319 ImGui::SliderInt("Offset Y", &hud->pixelOffset[2], -512, 512); ImGui::SameLine(0.0f, 10.0f*s_uiScale);
3320 ImGui::SetNextItemWidth(128 * s_uiScale);
3321 ImGui::InputInt("##HudOffsetYText", &hud->pixelOffset[2], 1, 10);
3322
3323 // Clamp pixel offsets to avoid fixed-point overflow.
3324 const s32 maxOffset = 16383;
3325 hud->pixelOffset[0] = clamp(hud->pixelOffset[0], -maxOffset, maxOffset);
3326 hud->pixelOffset[1] = clamp(hud->pixelOffset[1], -maxOffset, maxOffset);
3327 hud->pixelOffset[2] = clamp(hud->pixelOffset[2], -maxOffset, maxOffset);
3328 }
3329
3330 // Uses a percentage slider (0 - 100%) to adjust a floating point value (0.0 - 1.0).
3331 // TODO: Refactor UI code to use this and similar functionality.

Callers 1

drawFunction · 0.85

Calls 3

getHudSettingsFunction · 0.85
getWindowSettingsFunction · 0.85
clampFunction · 0.85

Tested by

no test coverage detected