mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-13 21:02:28 +00:00
Make OverlayManager own the overlay color setting
This commit is contained in:
parent
d077c6450f
commit
5788fa7204
3 changed files with 13 additions and 1 deletions
|
@ -921,12 +921,13 @@ void DXVA2Renderer::renderFrameAtVsync(AVFrame *frame)
|
|||
|
||||
if (m_OverlayFont != nullptr) {
|
||||
if (Session::get()->getOverlayManager().isOverlayEnabled(Overlay::OverlayDebug)) {
|
||||
SDL_Color color = Session::get()->getOverlayManager().getOverlayColor(Overlay::OverlayDebug);
|
||||
m_OverlayFont->DrawTextA(nullptr,
|
||||
Session::get()->getOverlayManager().getOverlayText(Overlay::OverlayDebug),
|
||||
-1,
|
||||
&sample.DstRect,
|
||||
DT_LEFT | DT_NOCLIP,
|
||||
D3DCOLOR_ARGB(255, 255, 255, 255));
|
||||
D3DCOLOR_ARGB(color.a, color.r, color.g, color.b));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ OverlayManager::OverlayManager() :
|
|||
m_Renderer(nullptr)
|
||||
{
|
||||
memset(m_Overlays, 0, sizeof(m_Overlays));
|
||||
|
||||
m_Overlays[OverlayType::OverlayDebug].color = {0xFF, 0xFF, 0xFF, 0xFF};
|
||||
}
|
||||
|
||||
bool OverlayManager::isOverlayEnabled(OverlayType type)
|
||||
|
@ -44,6 +46,11 @@ void OverlayManager::setOverlayState(OverlayType type, bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
SDL_Color OverlayManager::getOverlayColor(OverlayType type)
|
||||
{
|
||||
return m_Overlays[type].color;
|
||||
}
|
||||
|
||||
void OverlayManager::setOverlayRenderer(IOverlayRenderer* renderer)
|
||||
{
|
||||
m_Renderer = renderer;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <QString>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
namespace Overlay {
|
||||
|
||||
enum OverlayType {
|
||||
|
@ -28,11 +30,13 @@ public:
|
|||
char* getOverlayText(OverlayType type);
|
||||
void setOverlayTextUpdated(OverlayType type);
|
||||
void setOverlayState(OverlayType type, bool enabled);
|
||||
SDL_Color getOverlayColor(OverlayType type);
|
||||
|
||||
void setOverlayRenderer(IOverlayRenderer* renderer);
|
||||
|
||||
struct {
|
||||
bool enabled;
|
||||
SDL_Color color;
|
||||
char text[512];
|
||||
} m_Overlays[OverlayMax];
|
||||
IOverlayRenderer* m_Renderer;
|
||||
|
|
Loading…
Reference in a new issue