14 std::string r = std::to_string(
static_cast<int>(ppl));
15 while (r.size() < 3) { r.insert(0,
"0"); }
27 getSignal(Item::Selected).willAlwaysCall(std::bind(&PeopledexRow::makeActive,
this));
28 getSignal(Item::Deselected).willAlwaysCall(std::bind(&PeopledexRow::makeInactive,
this));
35 const bool caught = dex.
getCaught(ppl) > 0;
38 auto& jp = bl::util::FileUtil::joinPath;
40 bgndTxtr = engine.renderer().texturePool().getOrLoadTexture(jp(ImgPath,
"Peopledex/item.png"));
42 engine.renderer().texturePool().getOrLoadTexture(jp(ImgPath,
"Peopledex/itemActive.png"));
43 background.create(engine, bgndTxtr);
44 const float mid =
static_cast<float>(bgndTxtr->size().y) * 0.5f;
46 ballTxtr = engine.renderer().texturePool().getOrLoadTexture(
48 constexpr
float BallX = 26.f;
49 const float bw =
static_cast<float>(ballTxtr->size().x) * 0.5f;
51 ball.create(engine, ballTxtr);
52 ball.getTransform().setOrigin(ballTxtr->size() * 0.5f);
53 ball.getTransform().setPosition({BallX, mid});
54 ball.setParent(background);
58 id.getTransform().setPosition(bw + BallX, mid);
59 id.getTransform().setOrigin(0.f,
60 id.getLocalBounds().height * 0.5f +
id.getLocalBounds().top * 0.5f);
61 id.setParent(background);
69 name.getTransform().setOrigin(
70 0.f, name.getLocalBounds().height * 0.5f + name.getLocalBounds().top * 0.5f);
71 name.getTransform().setPosition(
id.getTransform().getLocalPosition().x + 65.f, mid);
72 name.setParent(background);
76 background.addToScene(overlay, bl::rc::UpdateSpeed::Static);
77 id.addToScene(overlay, bl::rc::UpdateSpeed::Static);
78 name.addToScene(overlay, bl::rc::UpdateSpeed::Static);
79 if (ball.entity() != bl::ecs::InvalidEntity) {
80 ball.addToScene(overlay, bl::rc::UpdateSpeed::Static);
88 void PeopledexRow::makeActive() { background.setTexture(activeBgndTxtr); }
90 void PeopledexRow::makeInactive() { background.setTexture(bgndTxtr); }
96 if (ball.entity() != bl::ecs::InvalidEntity) { ball.draw(ctx); }
Parent namespace for all functionality unique to the game.
static const std::string & name(Id id)
Returns the name of the given Peoplemon.
Maintains the information required to populate the peopledex.
IntelLevel getIntelLevel(pplmn::Id peoplemon) const
Returns the level of intel on the given peoplemon.
unsigned int getCaught(pplmn::Id peoplemon) const
Returns how many of the given peoplemon have been caught.
static const sf::VulkanFont & MenuFont()
static const std::string & MenuImagePath()
static const std::string & ImagePath()
Item row for peoplemon in the peopledex.
virtual void doSceneRemove() override
Called when the item should be removed from the overlay.
virtual void doCreate(bl::engine::Engine &engine) override
Called at least once when the item is added to a menu. Should create required graphics primitives and...
virtual glm::vec2 getSize() const override
Returns the size that the row takes up.
virtual bl::ecs::Entity getEntity() const override
Returns the entity (or top level entity) of the item.
static Ptr create(core::pplmn::Id ppl, const core::player::Peopledex &dex)
Create a new peopledex row.
virtual void doSceneAdd(bl::rc::Scene *overlay) override
Called when the item should be added to the overlay.
std::shared_ptr< PeopledexRow > Ptr
Pointer to the row item.
virtual void draw(bl::rc::scene::CodeScene::RenderContext &ctx) override
Renders the item.