1 #ifndef LXGUI_GUI_FRAME_RENDERER_HPP
2 #define LXGUI_GUI_FRAME_RENDERER_HPP
4 #include "lxgui/gui_strata.hpp"
5 #include "lxgui/lxgui.hpp"
6 #include "lxgui/utils.hpp"
7 #include "lxgui/utils_observer.hpp"
8 #include "lxgui/utils_sorted_vector.hpp"
11 #include <magic_enum.hpp>
51 const utils::observer_ptr<frame>& obj,
strata old_strata_id,
strata new_strata_id);
73 utils::observer_ptr<const frame>
81 utils::observer_ptr<frame>
83 return utils::const_pointer_cast<frame>(
110 static constexpr std::size_t
num_strata = magic_enum::enum_count<strata>();
Abstract class for layering and rendering frames.
frame_renderer & operator=(const frame_renderer &)=delete
virtual void notify_strata_changed(const utils::observer_ptr< frame > &obj, strata old_strata_id, strata new_strata_id)
Tells this renderer that a frame has changed strata.
virtual void notify_strata_needs_redraw(strata strata_id)
Tells this renderer that one of its region requires redraw.
frame_renderer(frame_renderer &&)=delete
int get_highest_level(strata strata_id) const
Returns the highest level on the provided strata.
virtual void notify_level_changed(const utils::observer_ptr< frame > &obj, int old_level, int new_level)
Tells this renderer that a frame has changed level.
frame_renderer(const frame_renderer &)=delete
void reset_strata_list_changed_flag_()
void render_strata_(const strata_data &strata_obj) const
virtual ~frame_renderer()=default
Destructor.
frame_list_type sorted_frame_list_
frame_list_type::iterator frame_list_iterator
std::array< strata_data, num_strata > strata_list_
bool has_strata_list_changed_() const
virtual void notify_rendered_frame(const utils::observer_ptr< frame > &obj, bool rendered)
Tells this renderer that it should (or not) render another frame.
utils::observer_ptr< const frame > find_topmost_frame(const std::function< bool(const frame &)> &predicate) const
Find the top-most frame matching the provided predicate.
utils::observer_ptr< frame > find_topmost_frame(const std::function< bool(const frame &)> &predicate)
Find the top-most frame matching the provided predicate.
static constexpr std::size_t num_strata
void clear_strata_list_()
virtual vector2f get_target_dimensions() const =0
Returns the width and height of of this renderer's main render target (e.g., screen).
std::pair< std::size_t, std::size_t > get_strata_range_(strata strata_id) const
frame_renderer()
Default constructor.
frame_renderer & operator=(frame_renderer &&)=delete
A region that can contain other regions and react to events.
typename base::iterator iterator
bool operator()(const frame *f1, const frame *f2) const
Contains frames sorted by level.