Worked out the status UI more, setup the color scheme, and fixed various small problems with looting causing a crash.
This commit is contained in:
parent
db60f75bd9
commit
36a49ef768
6 changed files with 48 additions and 40 deletions
|
|
@ -78,6 +78,7 @@ namespace gui {
|
|||
dbc::check(world->has<components::Sprite>(item),
|
||||
"item in inventory UI doesn't exist in world. New level?");
|
||||
auto& sprite = world->get<components::Sprite>(item);
|
||||
fmt::println("!!!!!!!!!!! trying to load {}", sprite.name);
|
||||
$gui.set_init<guecs::Icon>(id, {sprite.name});
|
||||
|
||||
guecs::GrabSource grabber{
|
||||
|
|
|
|||
|
|
@ -18,12 +18,13 @@ namespace gui {
|
|||
$gui.init();
|
||||
}
|
||||
|
||||
inline void make_clickable_area(guecs::UI &gui, const std::string &name) {
|
||||
inline void make_clickable_area(guecs::UI &gui, const std::string name) {
|
||||
auto area = gui.entity(name);
|
||||
|
||||
gui.set<Clickable>(area, {
|
||||
[&](auto) {
|
||||
[=](auto) {
|
||||
auto world = GameDB::current_world();
|
||||
fmt::println("CLICK {}", name);
|
||||
world->send<game::Event>(game::Event::AIM_CLICK, area, {});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,8 +16,16 @@ namespace gui {
|
|||
{
|
||||
$gui.position(x, y, width, height);
|
||||
$gui.layout(
|
||||
"[=slot1]"
|
||||
"[=slot2]"
|
||||
"[=body_head]"
|
||||
"[=body_chest]"
|
||||
"[=body_right_arm]"
|
||||
"[=body_left_arm]"
|
||||
"[=body_stomach]"
|
||||
"[=body_left_leg]"
|
||||
"[=body_right_leg]"
|
||||
"[=inv0|=inv1|=inv2]"
|
||||
"[=inv3|=inv4|=inv5]"
|
||||
"[=inv6|=inv7|=inv8]"
|
||||
"[=hand_r]"
|
||||
"[=pocket_l]");
|
||||
}
|
||||
|
|
@ -28,17 +36,22 @@ namespace gui {
|
|||
for(auto& [name, cell] : $gui.cells()) {
|
||||
auto gui_id = $gui.entity(name);
|
||||
|
||||
$gui.set<Rectangle>(gui_id, {});
|
||||
|
||||
$gui.set<Text>(gui_id, {guecs::to_wstring(name)});
|
||||
$gui.set<Clickable>(gui_id, {
|
||||
guecs::make_action(gui_id, game::Event::INV_SELECT, {gui_id})
|
||||
});
|
||||
$gui.set<DropTarget>(gui_id, {
|
||||
.commit=[&, gui_id](DinkyECS::Entity world_target) -> bool {
|
||||
return place_slot(gui_id, world_target);
|
||||
}
|
||||
});
|
||||
|
||||
if(name.starts_with("body_")) {
|
||||
$gui.set<Meter>(gui_id, {});
|
||||
} else {
|
||||
$gui.set<Rectangle>(gui_id, {});
|
||||
$gui.set<Clickable>(gui_id, {
|
||||
guecs::make_action(gui_id, game::Event::INV_SELECT, {gui_id})
|
||||
});
|
||||
$gui.set<DropTarget>(gui_id, {
|
||||
.commit=[&, gui_id](DinkyECS::Entity world_target) -> bool {
|
||||
return place_slot(gui_id, world_target);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$gui.init();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue