Plutonium framework API  0.1
Simple UI framework for libnx and SDL2
IconButton.hpp
Go to the documentation of this file.
1 
2 /*
3 
4  Plutonium library
5 
6  @file Button.hpp
7  @brief A Button is an Element for option selecting.
8  @author XorTroll
9 
10  @copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
11 
12 */
13 
14 #pragma once
15 #include <functional>
16 #include <pu/element/Element.hpp>
17 
18 namespace pu::element
19 {
20  class IconButton : public Element
21  {
22  public:
23  IconButton(u32 X, u32 Y, u32 Radius, std::string Icon);
24  ~IconButton();
25  u32 GetX();
26  void SetX(u32 X);
27  u32 GetY();
28  void SetY(u32 Y);
29  u32 GetWidth();
30  u32 GetHeight();
31  u32 GetRadius();
32  void SetRadius(u32 Radius);
33  std::string GetIconPath();
34  void SetIconPath(std::string Icon);
36  void SetColor(draw::Color Color);
37  void SetOnClick(std::function<void()> ClickCallback);
38  void OnRender(render::Renderer *Drawer);
39  void OnInput(u64 Down, u64 Up, u64 Held, bool Touch, bool Focus);
40  private:
41  u32 x;
42  u32 y;
43  u32 rad;
44  draw::Color clr;
45  std::string icon;
46  std::function<void()> clickcb;
47  bool doclick;
48  bool hover;
49  s32 hoverfact;
51  };
52 }
void OnRender(render::Renderer *Drawer)
std::string GetIconPath()
Definition: Renderer.hpp:22
void SetOnClick(std::function< void()> ClickCallback)
Definition: IconButton.hpp:20
void SetIconPath(std::string Icon)
void OnInput(u64 Down, u64 Up, u64 Held, bool Touch, bool Focus)
Definition: Button.hpp:18
Definition: Element.hpp:27
IconButton(u32 X, u32 Y, u32 Radius, std::string Icon)
void SetRadius(u32 Radius)
SDL_Texture * NativeTexture
Definition: SDL2.hpp:16
draw::Color GetColor()
Definition: Color.hpp:19
void SetColor(draw::Color Color)