Plutonium framework API  0.1
Simple UI framework for libnx and SDL2
Application.hpp
Go to the documentation of this file.
1 
2 /*
3 
4  Plutonium library
5 
6  @file Application.hpp
7  @brief An Application is the base to use the UI system of this library.
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 <vector>
16 #include <functional>
17 #include <pu/Dialog.hpp>
18 #include <pu/Layout.hpp>
19 
20 namespace pu
21 {
23  {
24  public:
25  Application();
26  ~Application();
27  void LoadLayout(Layout *Layout);
29  void SetBackgroundColor(draw::Color BackColor);
30  std::string GetBackgroundImage();
31  bool HasBackgroundImage();
32  void SetBackgroundImage(std::string Path);
33  void DeleteBackgroundImage();
34  void AddThread(std::function<void()> Callback);
35  void SetOnInput(std::function<void(u64 Down, u64 Up, u64 Held, bool Touch)> Callback);
36  u32 ShowDialog(Dialog *ToShow);
37  int CreateShowDialog(std::string Title, std::string Content, std::vector<std::string> Options, bool UseLastOptionAsCancel, std::string Icon = "");
38  void Show();
39  bool CallForRender();
40  bool CallForRenderWithRenderOver(std::function<bool(render::Renderer *Drawer)> RenderFunc);
41  void OnRender();
42  void Close();
43  protected:
44  bool rover;
45  std::function<bool(render::Renderer *Drawer)> rof;
47  std::string bgimage;
49  bool hasimage;
50  bool show;
51  s32 fact;
53  std::vector<std::function<void()>> thds;
54  std::function<void(u64, u64, u64, bool)> cbipt;
56  };
57 }
s32 fact
Definition: Application.hpp:51
std::vector< std::function< void()> > thds
Definition: Application.hpp:53
bool hasimage
Definition: Application.hpp:49
void SetBackgroundImage(std::string Path)
Definition: Renderer.hpp:22
render::Renderer * rend
Definition: Application.hpp:55
void SetOnInput(std::function< void(u64 Down, u64 Up, u64 Held, bool Touch)> Callback)
Definition: Layout.hpp:19
Definition: Dialog.hpp:20
Definition: Application.hpp:20
std::function< bool(render::Renderer *Drawer)> rof
Definition: Application.hpp:45
bool show
Definition: Application.hpp:50
void DeleteBackgroundImage()
void AddThread(std::function< void()> Callback)
Layout * lyt
Definition: Application.hpp:52
render::NativeTexture ntex
Definition: Application.hpp:48
void SetBackgroundColor(draw::Color BackColor)
draw::Color bgcolor
Definition: Application.hpp:46
bool CallForRenderWithRenderOver(std::function< bool(render::Renderer *Drawer)> RenderFunc)
void LoadLayout(Layout *Layout)
draw::Color GetBackgroundColor()
bool HasBackgroundImage()
std::string bgimage
Definition: Application.hpp:47
std::string GetBackgroundImage()
int CreateShowDialog(std::string Title, std::string Content, std::vector< std::string > Options, bool UseLastOptionAsCancel, std::string Icon="")
SDL_Texture * NativeTexture
Definition: SDL2.hpp:16
u32 ShowDialog(Dialog *ToShow)
bool CallForRender()
Definition: Color.hpp:19
Definition: Application.hpp:22
std::function< void(u64, u64, u64, bool)> cbipt
Definition: Application.hpp:54
bool rover
Definition: Application.hpp:44