Now have a mostly working inventory UI and can pickup items and see them. Next up, being able to use things by clicking on them.
This commit is contained in:
parent
fa6311f10c
commit
b7f49aa719
9 changed files with 84 additions and 28 deletions
13
guecs.hpp
13
guecs.hpp
|
@ -9,6 +9,7 @@
|
|||
#include <functional>
|
||||
#include "events.hpp"
|
||||
#include "constants.hpp"
|
||||
#include "components.hpp"
|
||||
|
||||
namespace guecs {
|
||||
using std::shared_ptr, std::make_shared;
|
||||
|
@ -154,6 +155,13 @@ namespace guecs {
|
|||
$world.set<Comp>(ent, val);
|
||||
}
|
||||
|
||||
template <typename Comp>
|
||||
void set_init(DinkyECS::Entity ent, Comp val) {
|
||||
auto& cell = get<lel::Cell>(ent);
|
||||
val.init(cell);
|
||||
$world.set<Comp>(ent, val);
|
||||
}
|
||||
|
||||
lel::Cell& cell_for(DinkyECS::Entity entity) {
|
||||
return $world.get<lel::Cell>(entity);
|
||||
}
|
||||
|
@ -168,6 +176,11 @@ namespace guecs {
|
|||
return $world.get_if<Comp>(entity);
|
||||
}
|
||||
|
||||
template <typename Comp>
|
||||
bool has(DinkyECS::Entity entity) {
|
||||
return $world.has<Comp>(entity);
|
||||
}
|
||||
|
||||
template <typename Comp>
|
||||
void remove(DinkyECS::Entity ent) {
|
||||
$world.remove<Comp>(ent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue