From 197e17910bfea974c2515a6e6e77224f05996cb3 Mon Sep 17 00:00:00 2001 From: Angel Xex Date: Sat, 19 Feb 2022 17:51:08 -0300 Subject: [PATCH 1/2] fix bug 120 --- source/UI/settingsMenu.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/source/UI/settingsMenu.cpp b/source/UI/settingsMenu.cpp index 296be54..5723819 100644 --- a/source/UI/settingsMenu.cpp +++ b/source/UI/settingsMenu.cpp @@ -170,14 +170,35 @@ namespace Windows { } ImGui::SameLine(0.0f, spacing); if (ImGui::ArrowButton("##subsizeright", ImGuiDir_Right)) { - if(configini->getSubFontSize(true)+1 <120){ + if(configini->getSubFontSize(true)+1 <=120){ configini->setSubFontSize(configini->getSubFontSize(true)+1); } } ImGui::PopButtonRepeat(); ImGui::SameLine(); ImGui::Text("%d", configini->getSubFontSize(true)); + ImGui::Dummy(ImVec2(0.0f,10.0f)); + + //SubFontScale + ImGui::Text("Sub Font Scale"); + ImGui::SameLine(220,spacing); + ImGui::PushButtonRepeat(true); + if (ImGui::ArrowButton("##subsizescaleleft", ImGuiDir_Left)) { + if(configini->getSubFontScale(true)-0.01f >0.0f){ + configini->setSubFontScale(configini->getSubFontScale(true)-0.01f); + } + } + ImGui::SameLine(0.0f, spacing); + if (ImGui::ArrowButton("##subsizescaleright", ImGuiDir_Right)) { + if(configini->getSubFontScale(true)+0.01f <=3.0f){ + configini->setSubFontScale(configini->getSubFontScale(true)+0.01f); + } + } + ImGui::PopButtonRepeat(); + ImGui::SameLine(); + ImGui::Text("%.2f", configini->getSubFontScale(true)); ImGui::Dummy(ImVec2(0.0f,30.0f)); + //endSubFontScale ImGui::Text("Video"); ImGui::Separator(); std::vector deintmenu = {"No","Yes","Auto"}; @@ -403,6 +424,7 @@ namespace Windows { configini->setThemeName(configini->getThemeName(false)); configini->setSubFontSize(configini->getSubFontSize(false)); + configini->setSubFontScale(configini->getSubFontScale(false)); configini->setSubFontColor(configini->getSubFontColor(false)); //bordercolor configini->setSubBorderColor(configini->getSubBorderColor(false)); From 07265848a9173d2ebe19d7f9233a9a3a66309d0b Mon Sep 17 00:00:00 2001 From: Angel Xex Date: Sat, 19 Feb 2022 18:04:29 -0300 Subject: [PATCH 2/2] More Bug Fixed --- include/gui.h | 1 + include/libmpv.h | 1 + include/playerwindows.h | 1 + source/UI/playerWindows.cpp | 14 +++++++------- source/libmpv.cpp | 1 + source/main.cpp | 1 + 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/gui.h b/include/gui.h index ac73fda..661fa58 100644 --- a/include/gui.h +++ b/include/gui.h @@ -242,6 +242,7 @@ extern SysIcons nxmpicons; extern int newResW; extern int newResH; extern float multiplyRes; +extern int initSize; extern float initScale; extern bool isHandheld; extern bool clockoc; diff --git a/include/libmpv.h b/include/libmpv.h index e4da22d..effee4d 100644 --- a/include/libmpv.h +++ b/include/libmpv.h @@ -16,6 +16,7 @@ struct decoderlist_struct{ extern Config *configini; extern bool clockoc; extern float initScale; +extern int initSize; class libMpv{ public: diff --git a/include/playerwindows.h b/include/playerwindows.h index a82a710..d4fd88d 100644 --- a/include/playerwindows.h +++ b/include/playerwindows.h @@ -9,6 +9,7 @@ extern int newResH; extern float multiplyRes; extern bool isHandheld; extern float initScale; +extern int initSize; namespace playerWindows{ inline void SetupCacheWindow(void){ diff --git a/source/UI/playerWindows.cpp b/source/UI/playerWindows.cpp index 30e5ccc..250e374 100644 --- a/source/UI/playerWindows.cpp +++ b/source/UI/playerWindows.cpp @@ -36,7 +36,6 @@ namespace playerWindows{ static int drag_subpos = 100; static float drag_subdelay = 0.0f; - static int drag_subfontsize = 55; static int drag_subfontbordersize = 3; static float drag_subborderblur = 0.0f; static int drag_shadowposition = 1; @@ -594,7 +593,7 @@ namespace playerWindows{ if(ImGui::Button("Reset to Default",ImVec2(190, 30))){ drag_subpos = 100; drag_subdelay = 0.0f; - drag_subfontsize = configini->getSubFontSize(false); + initSize = configini->getSubFontSize(false); drag_subfontbordersize = 3; drag_shadowposition = 1; drag_shadowintensity = 0.25f; @@ -610,7 +609,7 @@ namespace playerWindows{ libmpv->setSubBorderBlur(drag_subborderblur,false); libmpv->setSubPos(drag_subpos,false); libmpv->setSubDelay(drag_subdelay,false); - libmpv->setSubFontSize(drag_subfontsize,false); + libmpv->setSubFontSize(initSize,false); configini->setSubFontColor(configini->getSubFontColor(false)); libmpv->setSubFontColor(configini->getSubFontColorHex(true)); //bordercolor @@ -662,15 +661,16 @@ namespace playerWindows{ //ImGui::BeginDisabled(); ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Sub Font Size", NULL, true).x) * 0.5f); ImGui::Text("Sub Font Size"); - if(ImGui::DragInt("Sub Font Size", &drag_subfontsize, 0.5f, 1, 120, "%d", ImGuiSliderFlags_NoInput)){ - libmpv->setSubFontSize(drag_subfontsize,item.playershowcontrols); + if(ImGui::DragInt("Sub Font Size", &initSize, 0.5f, 1, 120, "%d", ImGuiSliderFlags_NoInput)){ + configini->setSubFontSize(initSize); + libmpv->setSubFontSize(initSize,item.playershowcontrols); } //fontscale ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Sub Font Scale", NULL, true).x) * 0.5f); ImGui::Text("Sub Font Scale"); if(ImGui::DragFloat("Sub Font Scale", &initScale, 0.01f, 0.0f, 3.0f, "%.2f", ImGuiSliderFlags_NoInput)){ - configini->setSubFontScale(initScale); - libmpv->setSubScaleSize(initScale,item.playershowcontrols); + configini->setSubFontScale(initScale); + libmpv->setSubScaleSize(initScale,item.playershowcontrols); } //fontscale //bordersize diff --git a/source/libmpv.cpp b/source/libmpv.cpp index 408c384..cd6d5c8 100644 --- a/source/libmpv.cpp +++ b/source/libmpv.cpp @@ -132,6 +132,7 @@ void libMpv::loadFile(std::string _path){ const char *cmd[] = {"loadfile", _path.c_str(), NULL}; mpv_command_async(handle, 0, cmd); setLoop(false); + initSize = configini->getSubFontSize(false); setSubFontSize(configini->getSubFontSize(false),false); initScale = configini->getSubFontScale(false); setSubScaleSize(configini->getSubFontScale(false),false); diff --git a/source/main.cpp b/source/main.cpp index 925a98a..555779a 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -109,6 +109,7 @@ int newResW = 1280; int newResH = 720; float multiplyRes = 1.0f; float initScale = 1.0f; +int initSize = 55; std::string tempKbUrl = ""; shaderMania* shadermania = nullptr;