Add tray icon; Option to disable overlay

pull/169/head
Peter Repukat 2 years ago
parent 23aebd4975
commit 895694fda2

3
.gitmodules vendored

@ -25,3 +25,6 @@
[submodule "deps/json"]
path = deps/json
url = https://github.com/nlohmann/json
[submodule "deps/traypp"]
path = deps/traypp
url = git@github.com:Soundux/traypp.git

@ -80,7 +80,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<ExternalIncludePath>..\deps\SFML\include;..\deps\WinReg;..\deps\spdlog\include;..\deps\ValveFileVDF;..\deps\subhook;..\deps\ViGEmClient\include;..\deps\imgui;..\deps\imgui-sfml;..\deps\json\include;$(ExternalIncludePath)</ExternalIncludePath>
<ExternalIncludePath>..\deps\SFML\include;..\deps\WinReg;..\deps\spdlog\include;..\deps\ValveFileVDF;..\deps\subhook;..\deps\ViGEmClient\include;..\deps\imgui;..\deps\imgui-sfml;..\deps\json\include;..\deps\traypp\tray\include;$(ExternalIncludePath)</ExternalIncludePath>
<LibraryPath>..\deps\SFML\out\Debug\lib\Debug;..\deps\ViGEmClient\lib\debug\x64;$(LibraryPath)</LibraryPath>
<CopyLocalProjectReference>false</CopyLocalProjectReference>
<CopyLocalDeploymentContent>true</CopyLocalDeploymentContent>
@ -88,7 +88,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<ExternalIncludePath>..\deps\SFML\include;..\deps\WinReg;..\deps\spdlog\include;..\deps\ValveFileVDF;..\deps\subhook;..\deps\ViGEmClient\include;..\deps\imgui;..\deps\imgui-sfml;..\deps\json\include;$(ExternalIncludePath)</ExternalIncludePath>
<ExternalIncludePath>..\deps\SFML\include;..\deps\WinReg;..\deps\spdlog\include;..\deps\ValveFileVDF;..\deps\subhook;..\deps\ViGEmClient\include;..\deps\imgui;..\deps\imgui-sfml;..\deps\json\include;..\deps\traypp\tray\include;$(ExternalIncludePath)</ExternalIncludePath>
<LibraryPath>..\deps\SFML\out\Release\lib\RelWithDebInfo;..\deps\ViGEmClient\lib\release\x64;$(LibraryPath)</LibraryPath>
<CustomBuildBeforeTargets>ResourceCompile</CustomBuildBeforeTargets>
<CopyLocalDeploymentContent>true</CopyLocalDeploymentContent>
@ -174,6 +174,18 @@
<ClCompile Include="..\deps\imgui\imgui_tables.cpp" />
<ClCompile Include="..\deps\imgui\imgui_widgets.cpp" />
<ClCompile Include="..\deps\subhook\subhook.c" />
<ClCompile Include="..\deps\traypp\tray\src\components\button.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\components\imagebutton.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\components\label.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\components\separator.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\components\submenu.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\components\syncedtoggle.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\components\toggle.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\core\entry.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\core\traybase.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\core\windows\icon.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\core\windows\image.cpp" />
<ClCompile Include="..\deps\traypp\tray\src\core\windows\tray.cpp" />
<ClCompile Include="AppLauncher.cpp" />
<ClCompile Include="HidHide.cpp" />
<ClCompile Include="InputRedirector.cpp" />

@ -31,6 +31,9 @@
<Filter Include="Header Files\imgui-sfml">
<UniqueIdentifier>{5e050d12-af62-455e-afb1-d8a253f06ab8}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\tray">
<UniqueIdentifier>{fae52f0e-0152-49bd-8d74-a327f54bb789}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
@ -75,6 +78,42 @@
<ClCompile Include="AppLauncher.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\core\windows\icon.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\core\windows\image.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\core\windows\tray.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\core\entry.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\core\traybase.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\components\button.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\components\imagebutton.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\components\label.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\components\separator.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\components\submenu.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\components\syncedtoggle.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
<ClCompile Include="..\deps\traypp\tray\src\components\toggle.cpp">
<Filter>Source Files\tray</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="SteamTarget.h">

@ -51,8 +51,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,4,101004450861
PRODUCTVERSION 0,0,4,101004450861
FILEVERSION 0,0,4,1023002300004
PRODUCTVERSION 0,0,4,1023002300004
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.4.1-1-g445f861"
VALUE "FileVersion", "0.0.4.1-23-g23aebd4"
VALUE "InternalName", "GlosSITarget"
VALUE "LegalCopyright", "Copyright (C) 2021 Peter Repukat - FlatspotSoftware"
VALUE "OriginalFilename", "GlosSITarget.exe"
VALUE "ProductName", "GlosSI"
VALUE "ProductVersion", "0.0.4.1-1-g445f861"
VALUE "ProductVersion", "0.0.4.1-23-g23aebd4"
END
END
BLOCK "VarFileInfo"
@ -83,6 +83,16 @@ BEGIN
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "D:\\Alia5\\Documents\\Visual_Studio_Projects\\GloSC\\GloSC_Icon.ico"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
@ -130,584 +140,6 @@ END

@ -27,6 +27,7 @@ limitations under the License.
#ifdef _WIN32
#include "UWPOverlayEnabler.h"
#include <tray.hpp>
#endif
SteamTarget::SteamTarget(int argc, char* argv[])
@ -88,6 +89,32 @@ Application will not function!");
}
keepControllerConfig(true);
#ifdef _WIN32
HICON icon = 0;
TCHAR path[MAX_PATH];
GetModuleFileName(nullptr, path, MAX_PATH);
icon = (HICON)LoadImage(
0,
path,
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_LOADFROMFILE | LR_LOADMAP3DCOLORS);
if (!icon) {
ExtractIconEx(path, 0, &icon, nullptr, 1);
}
Tray::Tray tray{"GlosSITarget", icon};
#else
Tray::Tray tray{"GlosSITarget", "ico.png"};
#endif
tray.addEntry(Tray::Button{
"Quit", [this, &tray]() {
tray.exit();
run_ = false;
}});
while (run_) {
detector_.update();
overlayHotkeyWorkaround();

@ -22,7 +22,6 @@ limitations under the License.
#include <SFML/Window/Event.hpp>
#include <spdlog/spdlog.h>
#ifdef _WIN32
#include <SFML/Graphics.hpp>
#include <VersionHelpers.h>
@ -296,7 +295,8 @@ void TargetWindow::createWindow(bool window_mode)
spdlog::debug("Limiting overlay to FPS to {}", dev_mode.dmDisplayFrequency);
}
overlay_ = std::make_shared<Overlay>(window_, [this]() { close(); }, toggle_overlay_state_, windowed_);
overlay_ = std::make_shared<Overlay>(
window_, [this]() { close(); }, toggle_overlay_state_, windowed_);
ImGuiIO& io = ImGui::GetIO();
io.FontGlobalScale = dpi / 96.f;
@ -316,4 +316,11 @@ void TargetWindow::createWindow(bool window_mode)
ImGui::SFML::UpdateFontTexture();
}
on_window_changed_();
#ifdef _WIN32
if (Settings::window.disableOverlay) {
setFpsLimit(1);
ShowWindow(hwnd, SW_HIDE);
}
#endif
}

@ -1,12 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Resource.rc
//
#define IDI_ICON1 105
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101

1
deps/traypp vendored

@ -0,0 +1 @@
Subproject commit 8ea68626a484de06d48ebcba8db99f8fd393ddd4
Loading…
Cancel
Save