Move the management of the 'fake loose items container' into the loot_ui.cpp rather than get rid of it. Closes #34.
This commit is contained in:
parent
efdb0cb119
commit
b6d1ae2700
5 changed files with 24 additions and 24 deletions
|
@ -7,7 +7,9 @@ namespace gui {
|
|||
using namespace guecs;
|
||||
|
||||
LootUI::LootUI(GameLevel level) :
|
||||
$level(level)
|
||||
$level(level),
|
||||
$temp_loot($level.world->entity()),
|
||||
$target($temp_loot)
|
||||
{
|
||||
$gui.position(RAY_VIEW_X+RAY_VIEW_WIDTH/2-200,
|
||||
RAY_VIEW_Y+RAY_VIEW_HEIGHT/2-200, 400, 400);
|
||||
|
@ -17,8 +19,10 @@ namespace gui {
|
|||
"[item_4 | item_5 |item_6 | item_7 ]"
|
||||
"[item_8 | item_9 |item_10| item_11]"
|
||||
"[item_12| item_13|item_14|item_15 ]"
|
||||
"[ =take_all | =close| =destroy]"
|
||||
);
|
||||
"[ =take_all | =close| =destroy]");
|
||||
|
||||
$level.world->set<inventory::Model>($temp_loot, {});
|
||||
$level.world->make_constant($temp_loot);
|
||||
}
|
||||
|
||||
void LootUI::make_button(const std::string &name, const std::wstring& label, Events::GUI event) {
|
||||
|
@ -58,10 +62,8 @@ namespace gui {
|
|||
}
|
||||
|
||||
void LootUI::update() {
|
||||
if(!$level.world->has<inventory::Model>($target)) {
|
||||
dbc::log("NO INV MODEL?!");
|
||||
return;
|
||||
}
|
||||
dbc::check($level.world->has<inventory::Model>($target),
|
||||
"update called but $target isn't in world");
|
||||
|
||||
auto& contents = $level.world->get<inventory::Model>($target);
|
||||
|
||||
|
@ -119,7 +121,15 @@ namespace gui {
|
|||
init();
|
||||
}
|
||||
|
||||
void LootUI::add_loose_item(DinkyECS::Entity entity) {
|
||||
System::place_in_container(*$level.world, $temp_loot, "item_0", entity);
|
||||
set_target($temp_loot);
|
||||
update();
|
||||
}
|
||||
|
||||
bool LootUI::mouse(float x, float y, bool hover) {
|
||||
return $gui.mouse(x, y, hover);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue