Peoplemon  0.1.0
Peoplemon 3 game source documentation
LightSlider.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_COMPONENTS_LIGHTSLIDER_HPP
2 #define EDITOR_COMPONENTS_LIGHTSLIDER_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
6 
7 namespace editor
8 {
9 namespace component
10 {
17 class LightSlider : public bl::gui::Box {
18 public:
19  using Ptr = std::shared_ptr<LightSlider>;
20  using ChangeCb = std::function<void()>;
21 
29  static Ptr create(const std::string& prompt, const ChangeCb& onChange);
30 
35  std::uint8_t getLightLevel() const;
36 
41  void setLightLevel(std::uint8_t level);
42 
47  void setPrompt(const std::string& prompt);
48 
49 private:
50  bl::gui::Label::Ptr prompt;
51  bl::gui::Slider::Ptr slider;
52  LightPreview::Ptr preview;
53 
54  LightSlider(const std::string& prompt, const ChangeCb& onChange);
55 };
56 } // namespace component
57 } // namespace editor
58 
59 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
std::shared_ptr< LightPreview > Ptr
void setLightLevel(std::uint8_t level)
Sets the selected light level.
Definition: LightSlider.cpp:40
std::shared_ptr< LightSlider > Ptr
Definition: LightSlider.hpp:19
static Ptr create(const std::string &prompt, const ChangeCb &onChange)
Create a new light level slider.
Definition: LightSlider.cpp:9
std::function< void()> ChangeCb
Definition: LightSlider.hpp:20
void setPrompt(const std::string &prompt)
Sets the text prompt that is displayed.
Definition: LightSlider.cpp:45
std::uint8_t getLightLevel() const
Returns the currently selected light level.
Definition: LightSlider.cpp:36