Peoplemon  0.1.0
Peoplemon 3 game source documentation
HighlightRadioButtonComponent.cpp
Go to the documentation of this file.
2 
3 #include <BLIB/Interfaces/GUI/Elements/RadioButton.hpp>
4 
5 namespace editor
6 {
7 namespace component
8 {
9 namespace rdr
10 {
12 : Component(Component::HighlightState::HighlightedByMouse) {}
13 
14 void HighlightRadioButtonComponent::setVisible(bool visible) { base.setVisible(visible); }
15 
16 void HighlightRadioButtonComponent::onElementUpdated() {
17  base.onElementUpdated();
18  highlight.setHidden(!getOwnerAs<bl::gui::RadioButton>().getValue());
19 }
20 
21 void HighlightRadioButtonComponent::onRenderSettingChange() { base.onRenderSettingChange(); }
22 
23 bl::ecs::Entity HighlightRadioButtonComponent::getEntity() const { return base.getEntity(); }
24 
25 void HighlightRadioButtonComponent::doCreate(bl::engine::Engine& engine,
26  bl::gui::rdr::Renderer& renderer) {
27  createChild(base);
28  highlight.create(engine, {100.f, 100.f});
29  highlight.setFillColor(sf::Color(252, 252, 23, 128));
30  highlight.setParent(base.getEntity());
31 }
32 
33 void HighlightRadioButtonComponent::doSceneAdd(bl::rc::Overlay* overlay) {
34  Component::doSceneAdd(base, overlay);
35  highlight.addToScene(overlay, bl::rc::UpdateSpeed::Static);
36 }
37 
38 void HighlightRadioButtonComponent::doSceneRemove() {
39  Component::doSceneRemove(base);
40  highlight.removeFromScene();
41 }
42 
43 void HighlightRadioButtonComponent::handleAcquisition() {
44  base.onAcquisition();
45 
46  const sf::FloatRect& acq = getOwnerAs<bl::gui::RadioButton>().getAcquisition();
47  highlight.scaleToSize({acq.width, acq.height});
48 }
49 
50 void HighlightRadioButtonComponent::handleMove() { base.onMove(); }
51 
52 sf::Vector2f HighlightRadioButtonComponent::getRequisition() const { return base.getRequisition(); }
53 
54 } // namespace rdr
55 } // namespace component
56 } // namespace editor
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11