Skip to content

Commit

Permalink
Fix log and imgui.ini paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Alia5 committed Oct 23, 2021
1 parent d80a535 commit c050163
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 10 deletions.
27 changes: 21 additions & 6 deletions GlosSITarget/Overlay.cpp
Expand Up @@ -15,22 +15,38 @@ limitations under the License.
*/
#include "Overlay.h"

#include <filesystem>
#include <utility>

Overlay::Overlay(sf::RenderWindow& window, std::function<void()> 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;
Expand All @@ -40,7 +56,7 @@ Overlay::Overlay(sf::RenderWindow& window, std::function<void()> 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);
Expand Down Expand Up @@ -106,7 +122,6 @@ bool Overlay::isEnabled() const
return enabled_;
}


bool Overlay::toggle()
{
enabled_ = !enabled_;
Expand Down
4 changes: 4 additions & 0 deletions GlosSITarget/Overlay.h
Expand Up @@ -56,4 +56,8 @@ class Overlay {

static inline std::vector<std::function<void()>> OVERLAY_ELEMS_;

#ifdef _WIN32
std::string config_file_name_;
#endif

};
40 changes: 36 additions & 4 deletions GlosSITarget/Resource.rc
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -124,6 +124,38 @@ END






































Expand Down
1 change: 1 addition & 0 deletions GlosSITarget/main.cpp
Expand Up @@ -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();

Expand Down

0 comments on commit c050163

Please sign in to comment.