1 #ifndef LXGUI_GUI_MANAGER_HPP
2 #define LXGUI_GUI_MANAGER_HPP
4 #include "lxgui/input_keys.hpp"
5 #include "lxgui/lxgui.hpp"
6 #include "lxgui/utils_observer.hpp"
7 #include "lxgui/utils_signal.hpp"
29 class world_dispatcher;
53 utils::control_block& block,
54 std::unique_ptr<input::source> src,
55 std::unique_ptr<renderer> rdr);
233 const sol::state&
get_lua()
const;
272 return *input_dispatcher_;
280 return *input_dispatcher_;
288 return *world_input_dispatcher_;
296 return *world_input_dispatcher_;
304 return *event_emitter_;
312 return *event_emitter_;
352 return *virtual_root_;
360 return *virtual_root_;
384 return addon_registry_.get();
392 return addon_registry_.get();
415 float scaling_factor_ = 1.0f;
416 float base_scaling_factor_ = 1.0f;
417 bool enable_caching_ =
false;
418 std::vector<std::string> localization_directory_list_;
419 std::vector<std::string> gui_directory_list_;
422 std::unique_ptr<input::source> input_source_;
423 std::unique_ptr<renderer> renderer_;
426 std::unique_ptr<input::window> window_;
427 std::unique_ptr<input::dispatcher> input_dispatcher_;
428 std::unique_ptr<input::world_dispatcher> world_input_dispatcher_;
429 std::unique_ptr<event_emitter> event_emitter_;
432 std::unique_ptr<factory> factory_;
433 std::unique_ptr<localizer> localizer_;
434 std::unique_ptr<sol::state> lua_;
437 std::unique_ptr<addon_registry> addon_registry_;
439 bool is_loaded_ =
false;
440 bool reload_ui_flag_ =
false;
441 bool close_ui_flag_ =
false;
442 bool is_first_iteration_ =
true;
Generates events and keep tracks of registered callbacks.
Handles the creation of new UI objects.
Utility class to translate strings for display in GUI.
Manages the user interface.
manager(utils::control_block &block, std::unique_ptr< input::source > src, std::unique_ptr< renderer > rdr)
Constructor.
void add_localization_directory(const std::string &directory)
Adds a new directory to be parsed for localization.
renderer & get_renderer()
Returns the renderer implementation.
const event_emitter & get_event_emitter() const
Returns the gui event emitter.
manager(manager &&)=delete
manager(const manager &)=delete
void toggle_caching()
Toggles interface caching.
const localizer & get_localizer() const
Returns the object used for localizing strings.
localizer & get_localizer()
Returns the object used for localizing strings.
const root & get_root() const
Returns the UI root object, which contains root frames.
void set_interface_scaling_factor(float scaling_factor)
Sets the global UI scaling factor.
float get_interface_scaling_factor() const
Returns the current UI scaling factor.
bool is_loaded() const
Checks if the UI has been loaded.
void load_ui()
Loads the UI.
void render_ui() const
Renders the UI into the current render target.
factory & get_factory()
Returns the UI object factory, which is used to create new objects.
manager & operator=(manager &&)=delete
utils::signal< void(sol::state &)> on_create_lua
Triggers on each fresh Lua state (e.g., on startup or after a UI re-load).
const input::dispatcher & get_input_dispatcher() const
Returns the input manager associated to this gui.
virtual_root & get_virtual_root()
Returns the UI root object, which contains root frames.
const addon_registry * get_addon_registry() const
Returns the addon registry, which keeps track of loaded addons.
void reload_ui_now()
Closes the UI and load it again (immediately).
addon_registry * get_addon_registry()
Returns the addon registry, which keeps track of loaded addons.
std::string print_ui() const
Prints debug information in the log file.
const input::window & get_window() const
Returns the window in which this gui is being displayed.
void close_ui()
Closes the UI safely (at the end of update_ui()).
const input::world_dispatcher & get_world_input_dispatcher() const
Returns the input manager associated to this gui.
input::dispatcher & get_input_dispatcher()
Returns the input manager associated to this gui.
void clear_localization_directory_list()
Clears the localization directory list.
void clear_addon_directory_list()
Clears the addon directory list.
void enable_caching(bool enable_caching)
Enables or disables interface caching.
const renderer & get_renderer() const
Returns the renderer implementation.
input::window & get_window()
Returns the window in which this gui is being displayed.
void close_ui_now()
Closes the UI (immediately).
input::world_dispatcher & get_world_input_dispatcher()
Returns the input manager associated to this gui.
manager & operator=(const manager &)=delete
const virtual_root & get_virtual_root() const
Returns the UI root object, which contains root frames.
root & get_root()
Returns the UI root object, which contains root frames.
sol::state & get_lua()
Returns the GUI Lua state (sol wrapper).
void reload_ui()
Closes the UI and load it again safely (at the end of update_ui()).
const factory & get_factory() const
Returns the UI object factory, which is used to create new objects.
~manager() override
Destructor.
bool is_caching_enabled() const
Checks if interface caching is enabled.
void add_addon_directory(const std::string &directory)
Adds a new directory to be parsed for UI addons.
void update_ui(float delta)
Updates this manager and its regions.
event_emitter & get_event_emitter()
Returns the gui event emitter.
Abstract type for implementation specific management.
Root of the UI object hierarchy.
Root of the virtual UI object hierarchy.
Generic class for observing and triggering events.
oup::enable_observer_from_this_sealed< T > enable_observer_from_this
oup::observable_sealed_ptr< T > owner_ptr