Updated clay
This commit is contained in:
parent
c1cd3e4e49
commit
91ff487edd
6 changed files with 1604 additions and 1033 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "TextLabelHelpers.hpp"
|
||||
#include "../Elements/MutableTextLabel.hpp"
|
||||
#include "Helpers/ConvertVec.hpp"
|
||||
|
||||
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) {
|
||||
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) {}
|
||||
|
||||
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) {
|
||||
oldText = text;
|
||||
gui.invalidate_draw_element(this);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace GUIStuff {
|
|||
class MutableTextLabel : public Element {
|
||||
public:
|
||||
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:
|
||||
std::string oldText;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ void GUIManager::layout_begin() {
|
|||
}
|
||||
|
||||
void GUIManager::layout_end() {
|
||||
renderCommands = Clay_EndLayout();
|
||||
renderCommands = Clay_EndLayout(io.deltaTime);
|
||||
if(!idStack.empty())
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue