Updated clay
This commit is contained in:
parent
c1cd3e4e49
commit
91ff487edd
6 changed files with 1604 additions and 1033 deletions
2012
include/clay.h
2012
include/clay.h
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,6 @@
|
||||||
#include "TextLabelHelpers.hpp"
|
#include "TextLabelHelpers.hpp"
|
||||||
#include "../Elements/MutableTextLabel.hpp"
|
#include "../Elements/MutableTextLabel.hpp"
|
||||||
|
#include "Helpers/ConvertVec.hpp"
|
||||||
|
|
||||||
namespace GUIStuff { namespace ElementHelpers {
|
namespace GUIStuff { namespace ElementHelpers {
|
||||||
|
|
||||||
|
|
@ -42,7 +43,8 @@ void text_label_light_centered(GUIManager& gui, std::string_view val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mutable_text_label(GUIManager& gui, const char* id, const std::string& val) {
|
void mutable_text_label(GUIManager& gui, const char* id, const std::string& val) {
|
||||||
gui.element<MutableTextLabel>(id, val, CLAY_TEXT_CONFIG({.textColor = convert_vec4<Clay_Color>(gui.io.theme->frontColor1), .fontSize = gui.io.fontSize }));
|
Clay_TextElementConfig textConfig = CLAY_TEXT_CONFIG({.textColor = convert_vec4<Clay_Color>(gui.io.theme->frontColor1), .fontSize = gui.io.fontSize });
|
||||||
|
gui.element<MutableTextLabel>(id, val, textConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace GUIStuff {
|
||||||
|
|
||||||
MutableTextLabel::MutableTextLabel(GUIManager& gui): Element(gui) {}
|
MutableTextLabel::MutableTextLabel(GUIManager& gui): Element(gui) {}
|
||||||
|
|
||||||
void MutableTextLabel::layout(const Clay_ElementId& id, const std::string& text, Clay_TextElementConfig* textConfig) {
|
void MutableTextLabel::layout(const Clay_ElementId& id, const std::string& text, const Clay_TextElementConfig& textConfig) {
|
||||||
if(text != oldText) {
|
if(text != oldText) {
|
||||||
oldText = text;
|
oldText = text;
|
||||||
gui.invalidate_draw_element(this);
|
gui.invalidate_draw_element(this);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ namespace GUIStuff {
|
||||||
class MutableTextLabel : public Element {
|
class MutableTextLabel : public Element {
|
||||||
public:
|
public:
|
||||||
MutableTextLabel(GUIManager& gui);
|
MutableTextLabel(GUIManager& gui);
|
||||||
void layout(const Clay_ElementId& id, const std::string& text, Clay_TextElementConfig* textConfig);
|
void layout(const Clay_ElementId& id, const std::string& text, const Clay_TextElementConfig& textConfig);
|
||||||
private:
|
private:
|
||||||
std::string oldText;
|
std::string oldText;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -565,7 +565,7 @@ void GUIManager::layout_begin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIManager::layout_end() {
|
void GUIManager::layout_end() {
|
||||||
renderCommands = Clay_EndLayout();
|
renderCommands = Clay_EndLayout(io.deltaTime);
|
||||||
if(!idStack.empty())
|
if(!idStack.empty())
|
||||||
throw std::runtime_error("[GUIManager::end] ID Stack is not empty on end (push_id and pop_id calls not equal)");
|
throw std::runtime_error("[GUIManager::end] ID Stack is not empty on end (push_id and pop_id calls not equal)");
|
||||||
std::erase_if(elements, [](auto& p) {
|
std::erase_if(elements, [](auto& p) {
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ void PhoneDrawingProgramScreen::tool_settings_popup() {
|
||||||
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
|
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
|
||||||
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
|
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
|
||||||
}) {
|
}) {
|
||||||
gui.element<ScrollArea>("toolbox scroll area", ScrollArea::Options{
|
gui.clipping_element<ScrollArea>("toolbox scroll area", ScrollArea::Options{
|
||||||
.scrollVertical = true,
|
.scrollVertical = true,
|
||||||
.clipVertical = true,
|
.clipVertical = true,
|
||||||
.scrollbarY = ScrollArea::ScrollbarType::NORMAL,
|
.scrollbarY = ScrollArea::ScrollbarType::NORMAL,
|
||||||
|
|
@ -250,6 +250,7 @@ void PhoneDrawingProgramScreen::color_settings_popup(Vector4f* color) {
|
||||||
.childAlignmentX = CLAY_ALIGN_X_CENTER,
|
.childAlignmentX = CLAY_ALIGN_X_CENTER,
|
||||||
.entryHeight = BIG_BUTTON_SIZE,
|
.entryHeight = BIG_BUTTON_SIZE,
|
||||||
.entryCount = palette.colors.size(),
|
.entryCount = palette.colors.size(),
|
||||||
|
.scrollbar = ScrollArea::ScrollbarType::NORMAL,
|
||||||
.elementContent = [&](size_t i) {
|
.elementContent = [&](size_t i) {
|
||||||
auto newC = std::make_shared<Vector3f>(palette.colors[i].x(), palette.colors[i].y(), palette.colors[i].z());
|
auto newC = std::make_shared<Vector3f>(palette.colors[i].x(), palette.colors[i].y(), palette.colors[i].z());
|
||||||
color_button(gui, "c", newC.get(), {
|
color_button(gui, "c", newC.get(), {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue