HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
application.hpp
1// Copyright Take Vos 2019-2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "thread.hpp"
8#include "required.hpp"
9#include "timer.hpp"
10#include "datum.hpp"
11#include "GUI/gui_window_size.hpp"
12#include <span>
13#include <memory>
14#include <string>
15#include <any>
16#include <map>
17#include <thread>
18
19namespace tt {
20class audio_system;
21class font_book;
22class theme_book;
23class RenderDoc;
24class unicode_data;
25class application_delegate;
26class URL;
27
36{
37public:
38 static inline application *global;
39
43
46 int argc;
47
48 char **argv;
49
52 os_handle instance;
53
56 gui_window_size initial_window_size = gui_window_size::normal;
57
61
64 thread_id main_thread_id;
65
66 std::atomic<bool> inLoop;
67
80 int argc,
81 char *argv[],
82 os_handle instance
83 );
84
87 virtual int main();
88
89 virtual ~application();
90 application(const application &) = delete;
91 application &operator=(const application &) = delete;
92 application(application &&) = delete;
93 application &operator=(application &&) = delete;
94
97 virtual void run_from_main_loop(std::function<void()> function) = 0;
98
101 virtual void exit(int exit_code=0) = 0;
102
103protected:
106 virtual void init();
107
110 virtual void deinit();
111
115 virtual int loop() = 0;
116
117 virtual void init_foundation();
118 virtual void deinit_foundation();
119 virtual void init_audio();
120 virtual void deinit_audio();
121 virtual void init_text();
122 virtual void deinit_text();
123 virtual void init_gui();
124 virtual void deinit_gui();
125
126private:
127 typename timer::callback_ptr_type logger_maintenance_callback;
128 typename timer::callback_ptr_type clock_maintenance_callback;
129};
130
131}
132
Definition application.hpp:36
std::weak_ptr< application_delegate > delegate
Definition application.hpp:42
os_handle instance
Handle to the operating system's application-instance.
Definition application.hpp:52
application(std::weak_ptr< application_delegate > const &delegate, int argc, char *argv[], os_handle instance)
This function will take ownership of the delegate and delete it during destruction.
virtual int main()
Start the application.
virtual void run_from_main_loop(std::function< void()> function)=0
int argc
Definition application.hpp:46
gui_window_size initial_window_size
The initial window size for the first application window.
Definition application.hpp:56
virtual void exit(int exit_code=0)=0
Exit the main loop and exit the application.
thread_id main_thread_id
Thread id of the main thread.
Definition application.hpp:64
datum configuration
The global configuration.
Definition application.hpp:60