diff --git a/GlosSITarget/Overlay.cpp b/GlosSITarget/Overlay.cpp index 1d92536..0b6113f 100644 --- a/GlosSITarget/Overlay.cpp +++ b/GlosSITarget/Overlay.cpp @@ -15,22 +15,38 @@ limitations under the License. */ #include "Overlay.h" +#include #include Overlay::Overlay(sf::RenderWindow& window, std::function on_close) : window_(window), on_close_(std::move(on_close)) { ImGui::SFML::Init(window_); - //Hack: Trick ImGui::SFML into thinking we already have focus (otherwise only notices after focus-lost) - const sf::Event ev(sf::Event::GainedFocus); - ProcessEvent(ev); - ImGuiIO& io = ImGui::GetIO(); io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; +#ifdef _WIN32 + auto config_path = std::filesystem::temp_directory_path() + .parent_path() + .parent_path() + .parent_path(); + + config_path /= "Roaming"; + config_path /= "GlosSI"; + if (!std::filesystem::exists(config_path)) + std::filesystem::create_directories(config_path); + config_path /= "imgui.ini"; + config_file_name_ = config_path.string(); + io.IniFilename = config_file_name_.data(); +#endif + window.resetGLStates(); + //Hack: Trick ImGui::SFML into thinking we already have focus (otherwise only notices after focus-lost) + const sf::Event ev(sf::Event::GainedFocus); + ProcessEvent(ev); + auto& style = ImGui::GetStyle(); style.WindowBorderSize = 0; style.WindowRounding = 12; @@ -40,7 +56,7 @@ Overlay::Overlay(sf::RenderWindow& window, std::function on_close) : win style.ScrollbarRounding = 12; style.GrabRounding = 5; -ImVec4* colors = ImGui::GetStyle().Colors; + ImVec4* colors = ImGui::GetStyle().Colors; colors[ImGuiCol_Text] = ImVec4(0.95f, 0.96f, 0.98f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.36f, 0.42f, 0.47f, 1.00f); colors[ImGuiCol_WindowBg] = ImVec4(0.10f, 0.13f, 0.14f, 0.95f); @@ -106,7 +122,6 @@ bool Overlay::isEnabled() const return enabled_; } - bool Overlay::toggle() { enabled_ = !enabled_; diff --git a/GlosSITarget/Overlay.h b/GlosSITarget/Overlay.h index 88dcc62..e4e0a5c 100644 --- a/GlosSITarget/Overlay.h +++ b/GlosSITarget/Overlay.h @@ -56,4 +56,8 @@ class Overlay { static inline std::vector> OVERLAY_ELEMS_; +#ifdef _WIN32 + std::string config_file_name_; +#endif + }; diff --git a/GlosSITarget/Resource.rc b/GlosSITarget/Resource.rc index ebe2460..cb1054d 100644 --- a/GlosSITarget/Resource.rc +++ b/GlosSITarget/Resource.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,0,103003101062 - PRODUCTVERSION 0,0,0,103003101062 + FILEVERSION 0,0,0,104000800535 + PRODUCTVERSION 0,0,0,104000800535 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,12 +69,12 @@ BEGIN BEGIN VALUE "CompanyName", "Peter Repukat - FlatspotSoftware" VALUE "FileDescription", "GlosSI - SteamTarget" - VALUE "FileVersion", "0.0.0.1-3-g31a1e62" + VALUE "FileVersion", "0.0.0.1-4-gd80a535" VALUE "InternalName", "GlosSITarget" VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware" VALUE "OriginalFilename", "GlosSITarget.exe" VALUE "ProductName", "GlosSI" - VALUE "ProductVersion", "0.0.0.1-3-g31a1e62" + VALUE "ProductVersion", "0.0.0.1-4-gd80a535" END END BLOCK "VarFileInfo" @@ -124,6 +124,38 @@ END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GlosSITarget/main.cpp b/GlosSITarget/main.cpp index b2f659f..73e104c 100644 --- a/GlosSITarget/main.cpp +++ b/GlosSITarget/main.cpp @@ -45,6 +45,7 @@ int main(int argc, char* argv[]) console_sink->set_level(spdlog::level::trace); #ifdef _WIN32 auto path = std::filesystem::temp_directory_path() + .parent_path() .parent_path() .parent_path();