mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 21:03:42 -07:00
* Add Overlay Text Font Size option and extends max Song Name Display Duration to 20 seconds
* Solved conflict (2)
This commit is contained in:
parent
237dcfec74
commit
9fdf72e82b
4 changed files with 44 additions and 3 deletions
|
@ -546,7 +546,7 @@ void AudioEditor::DrawElement() {
|
|||
UIWidgets::CVarSliderInt("Overlay Duration: %d seconds", CVAR_AUDIO("SeqNameOverlayDuration"),
|
||||
UIWidgets::IntSliderOptions()
|
||||
.Min(1)
|
||||
.Max(10)
|
||||
.Max(20)
|
||||
.DefaultValue(5)
|
||||
.Size(ImVec2(300.0f, 0.0f))
|
||||
.Color(THEME_COLOR));
|
||||
|
|
|
@ -345,9 +345,8 @@ void OTRGlobals::Initialize() {
|
|||
context->InitWindow(sohFast3dWindow);
|
||||
|
||||
auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay();
|
||||
overlay->LoadFont("Press Start 2P", 12.0f, "fonts/PressStart2P-Regular.ttf");
|
||||
overlay->LoadFont("Fipps", 32.0f, "fonts/Fipps-Regular.otf");
|
||||
overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P"));
|
||||
LoadOverlayTextFont();
|
||||
|
||||
context->InitAudio({ .SampleRate = 32000, .SampleLength = 1024, .DesiredBuffered = 1680 });
|
||||
|
||||
|
@ -513,6 +512,30 @@ void OTRGlobals::ScaleImGui() {
|
|||
previousImGuiScale = scale;
|
||||
}
|
||||
|
||||
void OTRGlobals::LoadOverlayTextFont() {
|
||||
// TODO: Currenty, reloading a font causes crash.
|
||||
auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay();
|
||||
float fontSize;
|
||||
switch (CVarGetInteger(CVAR_SETTING("OverlayTextScale"), 0)) {
|
||||
case 0:
|
||||
default:
|
||||
fontSize = 12.0f;
|
||||
break;
|
||||
case 1:
|
||||
fontSize = 24.0f;
|
||||
break;
|
||||
case 2:
|
||||
fontSize = 32.0f;
|
||||
break;
|
||||
case 3:
|
||||
fontSize = 40.0f;
|
||||
break;
|
||||
}
|
||||
SPDLOG_DEBUG("Loading Overlay Text Font with size {}", fontSize);
|
||||
overlay->LoadFont("Press Start 2P", fontSize, "fonts/PressStart2P-Regular.ttf");
|
||||
overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P"));
|
||||
}
|
||||
|
||||
ImFont* OTRGlobals::CreateDefaultFontWithSize(float size) {
|
||||
auto mImGuiIo = &ImGui::GetIO();
|
||||
ImFontConfig fontCfg = ImFontConfig();
|
||||
|
|
|
@ -72,6 +72,8 @@ class OTRGlobals {
|
|||
|
||||
void ScaleImGui();
|
||||
void Initialize();
|
||||
void LoadOverlayTextFont();
|
||||
|
||||
bool HasMasterQuest();
|
||||
bool HasOriginal();
|
||||
uint32_t GetInterpolationFPS();
|
||||
|
|
|
@ -56,6 +56,13 @@ static const std::unordered_map<int32_t, const char*> bootSequenceLabels = {
|
|||
{ BOOTSEQUENCE_FILESELECT, "File Select" },
|
||||
};
|
||||
|
||||
static std::unordered_map<int32_t, const char*> overlayTextScaleOptions = {
|
||||
{ 0, "Small" },
|
||||
{ 1, "Normal" },
|
||||
{ 2, "Large" },
|
||||
{ 3, "X-Large" },
|
||||
};
|
||||
|
||||
const char* GetGameVersionString(uint32_t index) {
|
||||
uint32_t gameVersion = ResourceMgr_GetGameVersion(index);
|
||||
switch (gameVersion) {
|
||||
|
@ -244,6 +251,15 @@ void SohMenu::AddMenuSettings() {
|
|||
.ComponentAlignment(ComponentAlignments::Right)
|
||||
.LabelPosition(LabelPositions::Far))
|
||||
.Callback([](WidgetInfo& info) { OTRGlobals::Instance->ScaleImGui(); });
|
||||
AddWidget(path, "Overlay Text Size", WIDGET_CVAR_COMBOBOX)
|
||||
.CVar(CVAR_SETTING("OverlayTextScale"))
|
||||
.RaceDisable(false)
|
||||
.Options(ComboboxOptions()
|
||||
.ComboMap(overlayTextScaleOptions)
|
||||
.Tooltip("Changes the font size of Overlay Text.\n(REQUIRES RESTART)")
|
||||
.DefaultIndex(0)
|
||||
.ComponentAlignment(ComponentAlignments::Right)
|
||||
.LabelPosition(LabelPositions::Far));
|
||||
|
||||
// General - About
|
||||
path.column = SECTION_COLUMN_2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue