Major refactoring but now centering text and sprites works. See Issue #16 for why only those and not anything else yet.
This commit is contained in:
parent
2c22da022f
commit
9e9b9620c9
6 changed files with 47 additions and 92 deletions
|
@ -141,12 +141,12 @@ struct CalculatorUI {
|
|||
$gui.layout(
|
||||
"[*%(400)stack |_|_|_]"
|
||||
"[*%(400)readout|_|_|_]"
|
||||
"[push|pop|clear|eq]"
|
||||
"[add |sub|mul |div]"
|
||||
"[btn7|btn8|btn9]"
|
||||
"[btn4|btn5|btn6]"
|
||||
"[btn1|btn2|btn3]"
|
||||
"[neg |btn0|del]");
|
||||
"[=push|=pop|=clear|=eq]"
|
||||
"[=add |=sub|=mul |=div]"
|
||||
"[=btn7|=btn8|=btn9]"
|
||||
"[=btn4|=btn5|=btn6]"
|
||||
"[=btn1|=btn2|=btn3]"
|
||||
"[=neg |=btn0|=del]");
|
||||
}
|
||||
|
||||
void init() {
|
||||
|
@ -161,12 +161,12 @@ struct CalculatorUI {
|
|||
$gui.set<guecs::Rectangle>(id, {});
|
||||
|
||||
if(name == "readout") {
|
||||
$gui.set<guecs::Textual>(id, {L"", 40});
|
||||
$gui.set<guecs::Text>(id, {L"", 40});
|
||||
} else if(name == "stack") {
|
||||
$gui.set<guecs::Textual>(id, {L"", 20});
|
||||
$gui.set<guecs::Text>(id, {L"", 20});
|
||||
} else {
|
||||
$gui.set<guecs::Effect>(id, {});
|
||||
$gui.set<guecs::Label>(id, { label });
|
||||
$gui.set<guecs::Text>(id, { label });
|
||||
wchar_t op = label[0];
|
||||
$gui.set<guecs::Clickable>(id, {
|
||||
[&, op](auto, auto) { handle_button(op); }
|
||||
|
|
|
@ -77,7 +77,7 @@ struct ClickerUI {
|
|||
"[_|_ |_|_|_]"
|
||||
"[_|_ |_|_|_]"
|
||||
"[_|_ |_|_|_]"
|
||||
"[a1|a2|a3|a4|a5]");
|
||||
"[(30,30)a1|=(30,30)a2|a3|=a4|a5]");
|
||||
}
|
||||
|
||||
void init() {
|
||||
|
@ -91,9 +91,9 @@ struct ClickerUI {
|
|||
for(auto& [name, cell] : $gui.cells()) {
|
||||
auto id = $gui.entity(name);
|
||||
if(name != "clicker") {
|
||||
$gui.set<guecs::Rectangle>(id, {});
|
||||
$gui.set<guecs::Rectangle>(id, {0, {255, 0, 0, 255}});
|
||||
$gui.set<guecs::Effect>(id, {});
|
||||
$gui.set<guecs::Sprite>(id, { "clicker_treat_bone" });
|
||||
// $gui.set<guecs::Sprite>(id, { "clicker_treat_bone" });
|
||||
$gui.set<guecs::Clickable>(id, {
|
||||
[&](auto, auto) { handle_button(Event::A_BUTTON); }
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue