Starting work on moving GUI to event system (doesnt compile)
This commit is contained in:
parent
f1a855edc3
commit
ef7dfcef05
69 changed files with 4296 additions and 3709 deletions
31
src/GUIStuff/Elements/ColorRectangleDisplay.hpp
Normal file
31
src/GUIStuff/Elements/ColorRectangleDisplay.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
#include "Element.hpp"
|
||||
#include <include/effects/SkRuntimeEffect.h>
|
||||
|
||||
namespace GUIStuff {
|
||||
|
||||
class ColorRectangleDisplay : public Element {
|
||||
public:
|
||||
ColorRectangleDisplay(GUIManager& gui);
|
||||
void layout(const std::function<SkColor4f()>& colorFunc);
|
||||
virtual void clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA) override;
|
||||
private:
|
||||
static constexpr const char* alphaBackgroundSksl =
|
||||
R"V(
|
||||
vec4 main(vec2 fragcoord) {
|
||||
vec4 alphaBoard1 = vec4(0.2, 0.2, 0.2, 1.0);
|
||||
vec4 alphaBoard2 = vec4(0.8, 0.8, 0.8, 1.0);
|
||||
|
||||
vec2 flooredCoords = floor(fragcoord / 10);
|
||||
bool isDark = mod(flooredCoords.x + flooredCoords.y, 2.0) > 0.5;
|
||||
|
||||
return isDark ? alphaBoard2 : alphaBoard1;
|
||||
}
|
||||
)V";
|
||||
std::function<SkColor4f()> colorFunc;
|
||||
|
||||
static sk_sp<SkRuntimeEffect> alphaBackgroundEffect;
|
||||
static sk_sp<SkShader> get_alpha_background_shader();
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue