mirror of
https://github.com/Thracky/GlosSI.git
synced 2024-11-03 09:40:18 +00:00
draw GloSC logo if overlay open
This commit is contained in:
parent
21ae513ca6
commit
303dac0827
@ -91,6 +91,7 @@ void TargetOverlay::overlayLoop()
|
||||
//this is neccessary because steam doesn't want to switch to big picture bindings if mouse isn't inside
|
||||
moveMouseIntoOverlay();
|
||||
overlay_state_ = 0;
|
||||
draw_logo_ = true;
|
||||
|
||||
} else if (overlay_state_ == 2)
|
||||
{
|
||||
@ -102,8 +103,10 @@ void TargetOverlay::overlayLoop()
|
||||
//switch back the the previosly focused window
|
||||
stealFocus(last_foreground_window_);
|
||||
overlay_state_ = 0;
|
||||
draw_logo_ = false;
|
||||
}
|
||||
|
||||
if (draw_logo_)
|
||||
window_.draw(background_sprite_);
|
||||
window_.clear(sf::Color::Transparent);
|
||||
window_.display();
|
||||
}
|
||||
@ -181,3 +184,17 @@ void TargetOverlay::moveMouseIntoOverlay() const
|
||||
}
|
||||
}
|
||||
|
||||
void TargetOverlay::loadLogo()
|
||||
{
|
||||
HRSRC rsrcData = FindResource(NULL, L"ICOPNG", RT_RCDATA);
|
||||
DWORD rsrcDataSize = SizeofResource(NULL, rsrcData);
|
||||
HGLOBAL grsrcData = LoadResource(NULL, rsrcData);
|
||||
LPVOID firstByte = LockResource(grsrcData);
|
||||
sprite_texture_ = std::make_unique<sf::Texture>();
|
||||
sprite_texture_->loadFromMemory(firstByte, rsrcDataSize);
|
||||
background_sprite_.setTexture(*sprite_texture_);
|
||||
background_sprite_.setOrigin(sf::Vector2f(sprite_texture_->getSize().x / 2.f, sprite_texture_->getSize().y / 2));
|
||||
sf::VideoMode winSize = sf::VideoMode::getDesktopMode();
|
||||
background_sprite_.setPosition(sf::Vector2f(winSize.width / 2.f, winSize.height / 2.f));
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,8 @@ limitations under the License.
|
||||
|
||||
#pragma once
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <SFML/Graphics/Sprite.hpp>
|
||||
#include <SFML/Graphics/Texture.hpp>
|
||||
#include <thread>
|
||||
#include <windows.h>
|
||||
#include <atomic>
|
||||
@ -44,11 +46,19 @@ private:
|
||||
void makeSfWindowTransparent();
|
||||
void moveMouseIntoOverlay() const;
|
||||
|
||||
void loadLogo();
|
||||
|
||||
std::unique_ptr<sf::Texture> sprite_texture_;
|
||||
sf::Sprite background_sprite_;
|
||||
|
||||
bool draw_logo_ = false;
|
||||
|
||||
std::thread overlay_thread_;
|
||||
sf::RenderWindow window_;
|
||||
bool run_ = true;
|
||||
bool hidden_ = false;
|
||||
|
||||
|
||||
//Cannot have too much logic inside of overlayOpened / closed callbacks
|
||||
//Otherwise stuff breaks
|
||||
//0 = no change
|
||||
|
Loading…
Reference in New Issue
Block a user