NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
application.hpp
浏览该文件的文档.
1#ifndef NEFORCE_TUI_APPLICATION_HPP__
2#define NEFORCE_TUI_APPLICATION_HPP__
3
10
14NEFORCE_BEGIN_NAMESPACE__
15NEFORCE_BEGIN_TUI__
16
21
23class reconciler;
24class input_driver;
25class component_base;
27
43class NEFORCE_API application {
44public:
45 application();
46 ~application();
47
48 application(const application&) = delete;
49 application& operator=(const application&) = delete;
50 application(application&&) = delete;
51 application& operator=(application&&) = delete;
52
60 template <typename RootComponent, typename... Args>
61 application& with_component(Args&&... args) {
62 root_ = _NEFORCE make_unique<RootComponent>(_NEFORCE forward<Args>(args)...);
63 return *this;
64 }
65
71 application& with_theme(const theme& theme);
72
78 application& with_fps(int fps);
79
85 application& with_title(string title);
86
91 int run();
92
97 void quit(int exit_code = 0);
98
99private:
100 io_context ctx_;
101 strand render_strand_{ctx_};
103 unique_ptr<reconciler> reconiler_;
106 theme theme_{dark_theme};
107 int fps_{60};
108 int exit_code_ = 0;
109 string title_;
110 bool running_ = false;
111};
112 // TUI
114
115NEFORCE_END_TUI__
116NEFORCE_END_NAMESPACE__
117#endif // NEFORCE_TUI_APPLICATION_HPP__
统一异步操作核心
串行化执行器
系统控制台单例类
static sys_console & instance() noexcept
获取单例实例
application & with_title(string title)
设置程序名
application & with_component(Args &&... args)
设置根组件
application & with_fps(int fps)
设置最大刷新帧率
int run()
阻塞运行事件循环
application & with_theme(const theme &theme)
设置主题
void quit(int exit_code=0)
请求退出应用
独占智能指针
控制台输入输出工具
constexpr T && forward(remove_reference_t< T > &x) noexcept
完美转发左值
constexpr unique_ptr< T > make_unique(Args &&... args)
创建unique_ptr
串行化执行器
TUI样式与主题系统