1 #include "CreaturePanel.hpp"
3 #include "../app/Assets.hpp"
4 #include "../creature/Creature.hpp"
5 #include "../graphics/Viewport.hpp"
7 #include <glm/gtx/transform.hpp>
13 CreaturePanel::CreaturePanel(const app::Assets &assets)
15 , name(new Label(assets.fonts.large))
19 .Padding(glm::vec2(10.0f))
21 .Direction(Panel::VERTICAL)
22 .Background(glm::vec4(0.7f, 0.7f, 0.7f, 1.0f))
23 .Origin(Gravity::NORTH_EAST);
26 CreaturePanel::~CreaturePanel() {
30 void CreaturePanel::Show(creature::Creature &cr) {
32 name->Text(c->Name());
36 void CreaturePanel::Hide() noexcept {
40 void CreaturePanel::Draw(app::Assets &assets, graphics::Viewport &viewport) noexcept {
43 const glm::vec2 margin(20.0f);
45 panel.Position(glm::vec3(viewport.Width() - margin.x, margin.y, 0.0f));
46 panel.Draw(assets, viewport);