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

Function calcWindowSize

TheForceEngine/TFE_A11y/accessibility.cpp:724–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

722 }
723
724 ImVec2 calcWindowSize(f32* fontScale, CaptionEnv env)
725 {
726 TFE_Settings_A11y* settings = TFE_Settings::getA11ySettings();
727 *fontScale = s_screenHeight / 1024.0f; // Scale based on window resolution
728 *fontScale = (f32)fmax(*fontScale, 1);
729
730 f32 maxWidth = MAX_CAPTION_WIDTH;
731 if (env == CC_GAMEPLAY)
732 {
733 *fontScale += (f32)(settings->gameplayFontSize * s_screenHeight / 1280.0f);
734 maxWidth += 100 * settings->gameplayFontSize;
735 }
736 else
737 {
738 *fontScale += (f32)(settings->cutsceneFontSize * s_screenHeight / 1280.0f);
739 maxWidth += 100 * settings->cutsceneFontSize;
740 }
741 *fontScale = (f32)fmax(*fontScale, 1);
742 if (s_currentCaptionFont != nullptr) *fontScale *= .7f;
743
744 f32 windowWidth = s_screenWidth * 0.8f;
745 if (windowWidth > maxWidth) windowWidth = maxWidth;
746 ImVec2 windowSize = ImVec2(windowWidth, 0); // Auto-size vertically
747 return windowSize;
748 }
749
750 s64 secondsToMicroseconds(f32 seconds)
751 {

Callers 2

onSoundPlayFunction · 0.85
drawCaptionsFunction · 0.85

Calls 2

getA11ySettingsFunction · 0.85
ImVec2Function · 0.85

Tested by

no test coverage detected