More GUECS cleanup before releasing. Still need to sort out events and reduce the amount of stuff that GUECS needs.

This commit is contained in:
Zed A. Shaw 2025-05-04 23:28:36 -04:00
parent 1780a758b3
commit abea6da2e0
10 changed files with 71 additions and 54 deletions

View file

@ -1,8 +1,11 @@
#include "guecs.hpp"
#include "shaders.hpp"
#include "sound.hpp"
#include "textures.hpp"
#include <typeinfo>
namespace guecs {
using std::make_shared;
void Textual::init(lel::Cell &cell, shared_ptr<sf::Font> font_ptr) {
dbc::check(font_ptr != nullptr, "you failed to initialize this WideText");
@ -314,7 +317,7 @@ namespace guecs {
tc->text->setString(content);
} else {
auto &cell = cell_for(ent);
Textual to_set{content, 20};
Textual to_set{content, TEXT_SIZE};
to_set.init(cell, $font);
set<Textual>(ent, to_set);
}
@ -348,25 +351,10 @@ namespace guecs {
tc->text->setString(content);
} else {
auto &cell = cell_for(ent);
Label to_set{content, 20};
Label to_set{content, LABEL_SIZE};
to_set.init(cell, $font);
to_set.text->setFillColor(ColorValue::LIGHT_MID);
to_set.text->setFillColor(TEXT_COLOR);
set<Label>(ent, to_set);
}
}
Clickable make_action(DinkyECS::World& target, Events::GUI event) {
return {[&, event](auto ent, auto data){
// remember that ent is passed in from the UI::mouse handler
target.send<Events::GUI>(event, ent, data);
}};
}
Clickable make_action(DinkyECS::World& target, Events::GUI event, std::any data) {
return {[&, event, data](auto ent, auto){
// remember that ent is passed in from the UI::mouse handler
target.send<Events::GUI>(event, ent, data);
}};
}
}