From a360c31d0434898888e710f4a5f560200f50cecf Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 19 Apr 2026 18:47:49 +0100 Subject: errorOverlay: modernize, refactor, use GPU rendering (#14122) Improves the overlay's rendering: - GPU accelerated - supports gradients - wraps - cleaner code a bit --- src/errorOverlay/Overlay.hpp | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/errorOverlay/Overlay.hpp (limited to 'src/errorOverlay/Overlay.hpp') diff --git a/src/errorOverlay/Overlay.hpp b/src/errorOverlay/Overlay.hpp new file mode 100644 index 00000000..68f0e5dc --- /dev/null +++ b/src/errorOverlay/Overlay.hpp @@ -0,0 +1,57 @@ +#pragma once + +#include + +#include "../defines.hpp" +#include "../render/Texture.hpp" +#include "../helpers/AnimatedVariable.hpp" +#include "../helpers/MiscFunctions.hpp" +#include "../config/shared/complex/ComplexDataTypes.hpp" + +namespace ErrorOverlay { + + namespace Colors { + constexpr const float ANGLE_30 = 0.52359877; + + static const Config::CGradientValueData ERROR = + Config::CGradientValueData{std::vector{*configStringToInt("0xffff6666"), *configStringToInt("0xff800000")}, ANGLE_30}; + static const Config::CGradientValueData WARNING = + Config::CGradientValueData{std::vector{*configStringToInt("0xffffdb4d"), *configStringToInt("0xff665200")}, ANGLE_30}; + }; + + class COverlay { + public: + COverlay(); + ~COverlay() = default; + + void queueCreate(std::string message, const CHyprColor& color); + void queueCreate(std::string message, const Config::CGradientValueData& gradient); + void queueError(std::string err); + void draw(); + void destroy(); + + bool active(); + float height(); // logical + + private: + void createQueued(); + std::string m_queued = ""; + Config::CGradientValueData m_queuedBorderGradient; + Config::CGradientValueData m_borderGradient; + bool m_queuedDestroy = false; + bool m_isCreated = false; + SP m_textTexture; + Vector2D m_textSize = {}; + float m_outerPad = 0.F; + float m_radius = 0.F; + float m_textOffsetX = 0.F; + float m_textOffsetY = 0.F; + PHLANIMVAR m_fadeOpacity; + CBox m_damageBox = {0, 0, 0, 0}; + float m_lastHeight = 0.F; + + bool m_monitorChanged = false; + }; + + UP& overlay(); +} -- cgit v1.2.3