diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-19 18:47:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-19 18:47:49 +0100 |
| commit | a360c31d0434898888e710f4a5f560200f50cecf (patch) | |
| tree | f68746c77b416654ec059f670e2e66af62581de3 /src/errorOverlay/Overlay.hpp | |
| parent | 889ee4f26d77ff0c36f5c4767ef0629371fd2c18 (diff) | |
errorOverlay: modernize, refactor, use GPU rendering (#14122)
Improves the overlay's rendering:
- GPU accelerated
- supports gradients
- wraps
- cleaner code a bit
Diffstat (limited to 'src/errorOverlay/Overlay.hpp')
| -rw-r--r-- | src/errorOverlay/Overlay.hpp | 57 |
1 files changed, 57 insertions, 0 deletions
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 <vector> + +#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<CHyprColor>{*configStringToInt("0xffff6666"), *configStringToInt("0xff800000")}, ANGLE_30}; + static const Config::CGradientValueData WARNING = + Config::CGradientValueData{std::vector<CHyprColor>{*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<Render::ITexture> 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<float> m_fadeOpacity; + CBox m_damageBox = {0, 0, 0, 0}; + float m_lastHeight = 0.F; + + bool m_monitorChanged = false; + }; + + UP<COverlay>& overlay(); +} |
