diff --git a/include/libmpv.h b/include/libmpv.h index 4d5a712..c2315e1 100644 --- a/include/libmpv.h +++ b/include/libmpv.h @@ -78,6 +78,8 @@ class libMpv{ void setSubPos(int value,bool osd); void setSubFontSize(int value,bool osd); void setSubBorderSize(int value,bool osd); + void setShadowIntensity(double value,bool osd); + void setShadowOffset(int value,bool osd); void setSubFontColor(std::string hexcolor); void setDeinterlace(int value); diff --git a/source/UI/playerWindows.cpp b/source/UI/playerWindows.cpp index c9f50e5..1e62603 100644 --- a/source/UI/playerWindows.cpp +++ b/source/UI/playerWindows.cpp @@ -35,6 +35,8 @@ namespace playerWindows{ static float drag_subdelay = 0.0f; static int drag_subfontsize = 55; static int drag_subfontbordersize = 3; + static int drag_shadowposition = 1; + static float drag_shadowintensity = 0.25f; static int slider_eq[6] = {0,0,0,0,0,0}; static char slider_hz[][8] = {"20-200","200-800","800-2K","2K-4K","4K-8K","20K"}; @@ -637,6 +639,20 @@ namespace playerWindows{ libmpv->setSubBorderSize(drag_subfontbordersize,item.playershowcontrols); } //endbordersize + //shadowintensity + ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Shadow Intensity", NULL, true).x) * 0.5f); + ImGui::Text("Shadow Intensity"); + if(ImGui::DragFloat("Shadow Intensity", &drag_shadowintensity, 0.010f, 0.0f, 1.0f, "%.3f", ImGuiSliderFlags_NoInput)){ + libmpv->setShadowIntensity(drag_shadowintensity,item.playershowcontrols); + } + //shadowintensity + //shadowOffset + ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Shadow Position", NULL, true).x) * 0.5f); + ImGui::Text("Shadow Position"); + if(ImGui::DragInt("Shadow Position", &drag_shadowposition, 0.5f, 0, 5, "%d", ImGuiSliderFlags_NoInput)){ + libmpv->setShadowOffset(drag_shadowposition,item.playershowcontrols); + } + //ShadowOffset ImGui::Text("Sub Font Color"); float * subcolor = configini->getSubFontColor(true); if(ImGui::ColorButton("##subfontcolor", ImVec4(subcolor[0],subcolor[1],subcolor[2],subcolor[3]), ImGuiColorEditFlags_NoAlpha| ImGuiColorEditFlags_NoPicker|ImGuiColorEditFlags_InputRGB , ImVec2(190, 40))){ @@ -650,6 +666,11 @@ namespace playerWindows{ drag_subdelay = 0.0f; drag_subfontsize = configini->getSubFontSize(false); drag_subfontbordersize = 3; + drag_shadowposition = 1; + drag_shadowintensity = 0.25f; + libmpv->setShadowOffset(drag_shadowposition,false); + libmpv->setShadowIntensity(drag_shadowintensity,false); + libmpv->setSubBorderSize(drag_subfontbordersize,false); libmpv->setSubPos(drag_subpos,false); libmpv->setSubDelay(drag_subdelay,false); libmpv->setSubFontSize(drag_subfontsize,false); diff --git a/source/libmpv.cpp b/source/libmpv.cpp index 0618c2d..ed4c122 100644 --- a/source/libmpv.cpp +++ b/source/libmpv.cpp @@ -31,7 +31,10 @@ libMpv::libMpv(const std::string &configDir) { mpv_set_option_string(handle, "gpu-nxmp-deint", std::to_string(configini->getDeinterlace(false)).c_str()); mpv_set_option_string(handle, "volume-max", "200"); mpv_set_option_string(handle, "opengl-pbo", "yes"); - + //default Font Style + mpv_set_option_string(handle, "sub-border-size", "3"); + mpv_set_option_string(handle, "sub-shadow-offset", "1"); + mpv_set_option_string(handle, "sub-shadow-color", "0.0/0.0/0.0/0.25"); if(configini->getUseAlang(false)){ @@ -565,6 +568,25 @@ void libMpv::setSubBorderSize(int value,bool osd){ } } +void libMpv::setShadowIntensity(double value,bool osd){ + if(osd){ + std::string cmd = "set sub-shadow-color 0.0/0.0/0.0/" + std::to_string(value); + mpv_command_string(handle, cmd.c_str()); + }else{ + std::string cmd = "no-osd set sub-shadow-color 0.0/0.0/0.0/" + std::to_string(value); + mpv_command_string(handle, cmd.c_str()); + } +} + +void libMpv::setShadowOffset(int value,bool osd){ + if(osd){ + std::string cmd = "set sub-shadow-offset " + std::to_string(value); + mpv_command_string(handle, cmd.c_str()); + }else{ + std::string cmd = "no-osd set sub-shadow-offset " + std::to_string(value); + mpv_command_string(handle, cmd.c_str()); + } +} void libMpv::setSubFontColor(std::string hexcolor){ std::string cmd = "no-osd set sub-color '" + hexcolor + std::string("'"); mpv_command_string(handle, cmd.c_str());