Added more menus to phone version
This commit is contained in:
parent
1b99c64c1b
commit
4774f1ee94
22 changed files with 633 additions and 306 deletions
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "TextLabelHelpers.hpp"
|
||||
#include "../Elements/MutableTextLabel.hpp"
|
||||
#include "../Elements/TextParagraph.hpp"
|
||||
#include "../Elements/LayoutElement.hpp"
|
||||
#include "Helpers/ConvertVec.hpp"
|
||||
|
||||
namespace GUIStuff { namespace ElementHelpers {
|
||||
|
|
@ -65,4 +67,28 @@ void mutable_text_label(GUIManager& gui, const char* id, const std::string& val)
|
|||
gui.element<MutableTextLabel>(id, val, textConfig);
|
||||
}
|
||||
|
||||
void mutable_text_label_light(GUIManager& gui, const char* id, const std::string& val) {
|
||||
Clay_TextElementConfig textConfig = CLAY_TEXT_CONFIG({.textColor = convert_vec4<Clay_Color>(gui.io.theme->frontColor2), .fontSize = gui.io.fontSize });
|
||||
gui.element<MutableTextLabel>(id, val, textConfig);
|
||||
}
|
||||
|
||||
void ellipse_wide_paragraph_label(GUIManager& gui, const char* id, const std::string& val) {
|
||||
gui.element<LayoutElement>(id, [&](LayoutElement* l, const Clay_ElementId& lId) {
|
||||
CLAY(lId, {
|
||||
.layout = {.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0)}}
|
||||
}) {
|
||||
if(l->get_bb().has_value()) {
|
||||
RichText::TextData t;
|
||||
t.paragraphs.emplace_back();
|
||||
t.paragraphs.back().text = val;
|
||||
gui.element<TextParagraph>("p", TextParagraph::Data{
|
||||
.text = t,
|
||||
.maxGrowX = l->get_bb().value().width(),
|
||||
.ellipsis = true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -29,5 +29,8 @@ void text_label_light_centered(GUIManager& gui, std::string_view val);
|
|||
void text_label_centered(GUIManager& gui, std::string_view val);
|
||||
|
||||
void mutable_text_label(GUIManager& gui, const char* id, const std::string& val);
|
||||
void mutable_text_label_light(GUIManager& gui, const char* id, const std::string& val);
|
||||
|
||||
void ellipse_wide_paragraph_label(GUIManager& gui, const char* id, const std::string& val);
|
||||
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@ void CheckBox::layout(const Clay_ElementId& id, const std::function<bool()>& isT
|
|||
this->isTicked = isTicked;
|
||||
this->onClick = onClick;
|
||||
|
||||
float size = gui.io.isTouchDevice ? 25 : 15;
|
||||
CLAY(id, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(15), .height = CLAY_SIZING_FIXED(15)}
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(size), .height = CLAY_SIZING_FIXED(size)}
|
||||
},
|
||||
.custom = { .customData = this }
|
||||
}) {}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,10 @@ template <typename T> class NumberSlider : public Element {
|
|||
dd.maxData = maxData;
|
||||
this->config = config;
|
||||
|
||||
float height = gui.io.isTouchDevice ? 25 : 10;
|
||||
CLAY(id, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_GROW(100), .height = CLAY_SIZING_FIXED(10)}
|
||||
.sizing = {.width = CLAY_SIZING_GROW(100), .height = CLAY_SIZING_FIXED(height)}
|
||||
},
|
||||
.custom = { .customData = this }
|
||||
}) {
|
||||
|
|
|
|||
|
|
@ -29,9 +29,10 @@ void RadioButton::layout(const Clay_ElementId& id, const std::function<bool()>&
|
|||
this->onClick = onClick;
|
||||
this->isTicked = isTicked;
|
||||
|
||||
float size = gui.io.isTouchDevice ? 25 : 20;
|
||||
CLAY(id, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(20), .height = CLAY_SIZING_FIXED(20)}
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(size), .height = CLAY_SIZING_FIXED(size)}
|
||||
},
|
||||
.custom = { .customData = this }
|
||||
}) {}
|
||||
|
|
|
|||
|
|
@ -574,7 +574,7 @@ void GUIManager::layout_if_necessary() {
|
|||
}
|
||||
|
||||
void GUIManager::layout() {
|
||||
constexpr int LAYOUT_RUN_COUNT = 6;
|
||||
constexpr int LAYOUT_RUN_COUNT = 8;
|
||||
for(int i = 0; i < LAYOUT_RUN_COUNT; i++)
|
||||
single_layout_run();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue