2
0
mirror of https://github.com/Thracky/GlosSI.git synced 2024-11-03 09:40:18 +00:00

SteamTarget: Show a little GloSC logo when the overlay is shown

This commit is contained in:
Peter Repukat 2017-01-26 00:01:26 +01:00
parent 4841fc2caa
commit 4dd65156a6
6 changed files with 32 additions and 11 deletions

Binary file not shown.

View File

@ -201,6 +201,9 @@
<Image Include="..\GloSC_Icon.ico" />
<Image Include="Resources\GloSC_Icon.png" />
</ItemGroup>
<ItemGroup>
<None Include="..\rcdata1.bin" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -82,4 +82,7 @@
<Image Include="Resources\GloSC_Icon.png" />
<Image Include="..\GloSC_Icon.ico" />
</ItemGroup>
<ItemGroup>
<None Include="..\rcdata1.bin" />
</ItemGroup>
</Project>

View File

@ -19,6 +19,7 @@ limitations under the License.
SteamTargetRenderer::SteamTargetRenderer(int& argc, char** argv) : QApplication(argc, argv)
{
getSteamOverlay();
loadLogo();
QSettings settings(".\\TargetConfig.ini", QSettings::IniFormat);
settings.beginGroup("BaseConf");
@ -60,7 +61,6 @@ SteamTargetRenderer::SteamTargetRenderer(int& argc, char** argv) : QApplication(
controllerThread.run();
QTimer::singleShot(2000, this, &SteamTargetRenderer::launchApp); // lets steam do its thing
}
SteamTargetRenderer::~SteamTargetRenderer()
@ -113,8 +113,6 @@ void SteamTargetRenderer::RunSfWindowLoop()
if (bDrawDebugEdges)
drawDebugEdges();
sfWindow.display();
//This ensures that we stay in game binding, even if focused application changes! (Why does this work? Well, i dunno... ask Valve...)
//Only works with a console window
//Causes trouble as soon as there is more than the consoleWindow and the overlayWindow
@ -168,8 +166,8 @@ void SteamTargetRenderer::RunSfWindowLoop()
//Move the mouse cursor inside the overlaywindow
//this is neccessary because steam doesn't want to switch to big picture bindings if mouse isn't inside
SetCursorPos(16, 16);
}
sfWindow.draw(backgroundSprite);
} else {
if (bNeedFocusSwitch)
{
@ -191,6 +189,7 @@ void SteamTargetRenderer::RunSfWindowLoop()
}
}
}
sfWindow.display();
}
stop();
}
@ -308,6 +307,20 @@ void SteamTargetRenderer::hookBindings()
}
}
void SteamTargetRenderer::loadLogo()
{
HRSRC rsrcData = FindResource(NULL, L"ICOPNG", RT_RCDATA);
DWORD rsrcDataSize = SizeofResource(NULL, rsrcData);
HGLOBAL grsrcData = LoadResource(NULL, rsrcData);
LPVOID firstByte = LockResource(grsrcData);
spriteTexture = std::make_unique<sf::Texture>();
spriteTexture->loadFromMemory(firstByte, rsrcDataSize);
backgroundSprite.setTexture(*spriteTexture);
backgroundSprite.setOrigin(sf::Vector2f(spriteTexture->getSize().x / 2.f, spriteTexture->getSize().y / 2));
sf::VideoMode winSize = sf::VideoMode::getDesktopMode();
backgroundSprite.setPosition(sf::Vector2f(winSize.width / 2.f, winSize.height / 2.f));
}
void SteamTargetRenderer::launchApp()
{
bool launchGame = false;

View File

@ -53,6 +53,13 @@ public:
private:
void stop();
void getSteamOverlay();
void RunSfWindowLoop();
void makeSfWindowTransparent(sf::RenderWindow& window);
void drawDebugEdges();
void hookBindings();
void loadLogo();
bool bRunLoop = true;
@ -75,7 +82,6 @@ private:
#endif
HWND hwForeGroundWindow = NULL;
bool bNeedFocusSwitch = false;
void getSteamOverlay();
VirtualControllerThread controllerThread;
@ -83,14 +89,10 @@ private:
bool bHookSteam = false;
void RunSfWindowLoop();
void makeSfWindowTransparent(sf::RenderWindow& window);
void drawDebugEdges();
QTimer updateTimer;
void hookBindings();
std::unique_ptr<sf::Texture> spriteTexture;
sf::Sprite backgroundSprite;
const QString LaunchGame = "LaunchGame";
const QString LaunchedProcessFinished = "LaunchedProcessFinished";

Binary file not shown.