25#include <initializer_list>
32namespace osc {
class App; }
33namespace osc {
class Camera; }
34namespace osc {
class Event; }
35namespace osc {
struct PolarPerspectiveCamera; }
36namespace osc {
class RenderTexture; }
37namespace osc {
class Texture2D; }
118 template<
typename...
Args>
121 detail::draw_text(
fmt, std::forward<Args>(
args)...);
126 void draw_text_disabled_v(
CStringView fmt, va_list);
127 inline void draw_text_disabled(
CStringView fmt, ...)
131 draw_text_disabled_v(fmt, args);
136 template<
typename...
Args>
139 detail::draw_text_disabled(
fmt, std::forward<Args>(
args)...);
144 void draw_text_wrapped_v(
CStringView fmt, va_list);
145 inline void draw_text_wrapped(
CStringView fmt, ...)
149 draw_text_wrapped_v(fmt, args);
154 template<
typename...
Args>
157 detail::draw_text_wrapped(
fmt, std::forward<Args>(
args)...);
190 std::optional<KeyCombination>
shortcut = {},
197 std::optional<KeyCombination>
shortcut,
237 explicit ID() =
default;
238 explicit ID(
unsigned int value) : value_{value} {}
240 unsigned int value()
const {
return value_; }
242 unsigned int value_ = 0;
578 size_t column_index = 0;
579 size_t sort_order = 0;
625 void add_rect(const
Rect& ui_rect, const
Color& color,
float rounding = 0.0f,
float thickness = 1.0f);
626 void add_rect_filled(const
Rect& ui_rect, const
Color& color,
float rounding = 0.0f);
627 void add_circle(const
Circle& ui_circle, const
Color& color,
int num_segments = 0,
float thickness = 1.0f);
628 void add_circle_filled(const
Circle& ui_circle, const
Color& color,
int num_segments = 0);
630 void add_line(const
Vector2& ui_start, const
Vector2& ui_end, const
Color& color,
float thickness = 1.0f);
632 void push_clip_rect(const
Rect&,
bool intersect_with_currect_clip_rect = false);
633 void pop_clip_rect();
637 virtual ImDrawList& impl_get_drawlist() = 0;
643 inner_list_{inner_list}
648 ImDrawList* inner_list_;
665 std::unique_ptr<ImDrawList> underlying_drawlist_;
679 const Rect& viewport_rect,
680 std::optional<AABB> maybe_scene_world_space_aabb
686 const Rect& viewport_rect,
687 std::optional<AABB> maybe_scene_world_space_aabb
709 std::optional<Vector2> dimensions = std::nullopt,
710 const Rect& region_uv_coordinates = Rect::from_corners({0.0f, 0.0f}, {1.0f, 1.0f})
726 Vector2 dimensions = {0.0f, 0.0f}
734 const Rect& texture_coordinates
759 bool is_hovered =
false;
760 bool is_left_click_released_without_dragging =
false;
761 bool is_right_click_released_without_dragging =
false;
822 HoveredFlags = HoveredFlag::ForTooltip
834 std::string& edited_string,
842 std::string& edited_string,
851 float step_fast = 0.0f,
876 float step_fast = 0.0f,
942 float height = ui::get_frame_height(),
943 PanelFlags = {PanelFlag::NoScrollbar, PanelFlag::NoSavedSettings, PanelFlag::MenuBar}
992 std::span<const CStringView> items
1057 const Rect& ui_rect,
1059 const AABB* local_bounds =
nullptr
1068 const Rect& ui_rect,
1070 const AABB* local_bounds =
nullptr
1084 std::optional<Transform> draw_to(
1088 const Rect& ui_rect,
1089 ImDrawList* draw_list,
1091 const AABB* local_bounds
1097 bool was_using_last_frame_ =
false;
1115 bool can_translate =
true,
1116 bool can_rotate =
true,
1117 bool can_scale =
true,
1125 bool can_translate =
true,
1126 bool can_rotate =
true,
1127 bool can_scale =
true,
1139 enum class PlotFlags {
1151 constexpr PlotFlags operator|(PlotFlags lhs, PlotFlags rhs)
1153 return static_cast<PlotFlags
>(std::to_underlying(lhs) | std::to_underlying(rhs));
1155 constexpr PlotFlags operator^(PlotFlags lhs, PlotFlags rhs)
1157 return static_cast<PlotFlags
>(std::to_underlying(lhs) ^ std::to_underlying(rhs));
1159 constexpr bool operator&(PlotFlags lhs, PlotFlags rhs)
1161 return (std::to_underlying(lhs) & std::to_underlying(rhs)) != 0;
1164 enum class PlotStyleVar {
1180 enum class PlotColorVar {
1197 enum class AxisFlags {
1202 NoTickLabels = 1<<3,
1209 Lock = LockMin | LockMax,
1210 NoDecorations = NoLabel | NoGridLines | NoTickMarks | NoTickLabels,
1213 constexpr AxisFlags operator|(AxisFlags lhs, AxisFlags rhs)
1215 return static_cast<AxisFlags
>(std::to_underlying(lhs) | std::to_underlying(rhs));
1218 enum class Condition {
1224 enum class MarkerType {
1230 enum class DragToolFlag : uint8_t {
1240 enum class Location {
1255 enum class LegendFlags {
1262 constexpr bool operator&(LegendFlags lhs, LegendFlags rhs)
1264 return (std::to_underlying(lhs) & std::to_underlying(rhs)) != 0;
1267 constexpr LegendFlags operator^(LegendFlags lhs, LegendFlags rhs)
1269 return static_cast<LegendFlags
>(std::to_underlying(lhs) ^ std::to_underlying(rhs));
1305 void setup_axis(Axis, std::optional<CStringView> label = std::nullopt, AxisFlags = AxisFlags::Default);
1308 void setup_axes(
CStringView x_label,
CStringView y_label, AxisFlags x_flags = AxisFlags::Default, AxisFlags y_flags = AxisFlags::Default);
1311 void setup_axis_limits(Axis axis,
ClosedInterval<float> data_range,
float padding_percentage, Condition = Condition::Once);
1319 void setup_finish();
1322 void set_next_marker_style(
1323 MarkerType = MarkerType::None,
1324 std::optional<float> size = std::nullopt,
1325 std::optional<Color> fill = std::nullopt,
1326 std::optional<float> weight = std::nullopt,
1327 std::optional<Color> outline = std::nullopt
1331 void plot_line(
CStringView name, std::span<const Vector2> points);
1337 Rect get_plot_ui_rect();
1350 va_start(args, fmt);
1351 detail::draw_annotation_v(position_dataspace, color, pixel_offset, clamp, fmt, args);
1366 DragToolFlags = DragToolFlag::Default
1375 float thickness = 1,
1376 DragToolFlags = DragToolFlag::Default
1385 float thickness = 1,
1386 DragToolFlags = DragToolFlag::Default
1390 void tag_x(
double plot_x,
const Color&,
bool round =
false);
1393 bool is_plot_hovered();
1396 Vector2 get_plot_mouse_position();
1399 Vector2 get_plot_mouse_position(Axis x_axis, Axis y_axis);
1402 void setup_legend(Location, LegendFlags = LegendFlags::Default);
1408 void end_legend_popup();
Definition c_string_view.h:12
Definition copy_on_upd_ptr.h:22
Definition render_texture.h:18
Definition resource_path.h:12
Definition texture2d.h:22
void set_base_imgui_ini_config_resource(ResourcePath)
void set_main_font_as_standard_plus_icon_font(ResourcePath main_font_ttf_path, ResourcePath icon_font_ttf_path, ClosedInterval< char16_t > codepoint_range)
Context(Context &&) noexcept=delete
Context(const Context &)=delete
Context(App &, const ContextConfiguration &={})
void on_start_new_frame()
Definition oscimgui.h:615
DrawListAPI(DrawListAPI &&) noexcept=default
DrawListAPI(const DrawListAPI &)=default
Definition oscimgui.h:640
ImDrawList & impl_get_drawlist() final
Definition oscimgui.h:646
DrawListView(ImDrawList *inner_list)
Definition oscimgui.h:642
Definition oscimgui.h:651
ImDrawList & impl_get_drawlist() final
Definition oscimgui.h:663
DrawList(const DrawList &)=delete
DrawList(DrawList &&) noexcept
Definition oscimgui.h:1040
GizmoOperation operation() const
Definition oscimgui.h:1076
std::optional< Transform > draw(Matrix4x4 &model_matrix, const Matrix4x4 &view_matrix, const Matrix4x4 &projection_matrix, const Rect &ui_rect, const GizmoOperationSnappingSteps *snap=nullptr, const AABB *local_bounds=nullptr)
GizmoMode mode() const
Definition oscimgui.h:1078
void set_mode(GizmoMode mode)
Definition oscimgui.h:1079
bool handle_keyboard_inputs()
bool was_using() const
Definition oscimgui.h:1074
std::optional< Transform > draw_to_foreground(Matrix4x4 &model_matrix, const Matrix4x4 &view_matrix, const Matrix4x4 &projection_matrix, const Rect &ui_rect, const GizmoOperationSnappingSteps *snap=nullptr, const AABB *local_bounds=nullptr)
void set_operation(GizmoOperation operation)
Definition oscimgui.h:1077
void set_tooltip_v(CStringView fmt, va_list)
bool draw_rgb_color_editor(CStringView label, Color &color)
bool draw_size_t_input(CStringView label, size_t *v, size_t step=1, size_t step_fast=100, TextInputFlags={})
bool is_ctrl_or_super_down()
PanelFlag
Definition oscimgui.h:314
@ AlwaysVerticalScrollbar
bool draw_image_button(CStringView, const Texture2D &, Vector2 dimensions, const Rect &texture_coordinates)
bool draw_string_input(CStringView label, std::string &edited_string, TextInputFlags={})
bool draw_float3_input(CStringView label, float v[3], const char *format="%.3f", TextInputFlags={})
bool is_item_clicked(MouseButton=MouseButton::Left)
void push_style_color(ColorVar, const Color &)
bool begin_listbox(CStringView label)
void draw_image(const Texture2D &texture, std::optional< Vector2 > dimensions=std::nullopt, const Rect ®ion_uv_coordinates=Rect::from_corners({0.0f, 0.0f}, {1.0f, 1.0f}))
void draw_tooltip_body_only(CStringView)
void begin_tooltip(std::optional< float > wrap_width=std::nullopt)
bool is_key_released(Key)
bool draw_float_circular_slider(CStringView label, float *v, float min, float max, CStringView format="%.3f", SliderFlags={})
void draw_tooltip_body_only_if_item_hovered(CStringView, HoveredFlags=HoveredFlag::ForTooltip)
void draw_text_column_centered(CStringView)
bool is_mouse_dragging(MouseButton, float lock_threshold=-1.0f)
bool table_column_sort_specs_are_dirty()
TextInputFlag
Definition oscimgui.h:265
bool table_set_column_index(int column_n)
Rect get_last_drawn_item_screen_rect()
bool begin_popup(CStringView str_id, PanelFlags={})
bool draw_tree_node_ex(CStringView, TreeNodeFlags={})
bool is_panel_hovered(HoveredFlags={})
Rect get_content_region_available_ui_rect()
void set_tooltip(CStringView fmt,...)
Definition oscimgui.h:358
ColumnFlag
Definition oscimgui.h:586
bool draw_float_input(CStringView label, float *v, float step=0.0f, float step_fast=0.0f, const char *format="%.3f", TextInputFlags={})
Rect get_last_drawn_item_ui_rect()
void enable_dockspace_over_main_window()
bool draw_angle_input(CStringView label, Radians &v)
ChildPanelFlag
Definition oscimgui.h:341
bool draw_rgba_color_editor(CStringView label, Color &color)
Vector2 get_item_top_left_ui_position()
bool update_polar_camera_from_all_inputs(PolarPerspectiveCamera &, const Rect &viewport_rect, std::optional< AABB > maybe_scene_world_space_aabb)
void draw_text_wrapped(CStringView)
bool begin_tab_bar(CStringView str_id)
void set_next_item_width(float item_width)
void draw_text_centered(CStringView)
bool begin_menu(CStringView sv, bool enabled=true)
Rect get_main_window_workspace_ui_rect()
TreeNodeFlag
Definition oscimgui.h:165
bool draw_menu_item(CStringView label, std::optional< KeyCombination > shortcut={}, bool selected=false, bool enabled=true)
void close_current_popup()
bool draw_invisible_button(CStringView label, Vector2 size={})
ComboFlag
Definition oscimgui.h:299
float get_style_frame_border_size()
void indent(float indent_w=0.0f)
void set_cursor_panel_x(float local_x)
MouseButton
Definition oscimgui.h:228
bool draw_tab_item_button(CStringView label)
void draw_text_disabled_and_panel_centered(CStringView)
bool begin_popup_context_menu(CStringView str_id={}, PopupFlags=PopupFlag::MouseButtonRight)
Vector2 get_cursor_ui_position()
void set_num_columns(int count=1, std::optional< CStringView > id=std::nullopt, bool border=true)
TableFlag
Definition oscimgui.h:547
bool begin_main_window_bottom_bar(CStringView)
bool draw_angle_slider(CStringView label, Radians &v, Radians min, Radians max)
bool draw_string_input_with_hint(CStringView label, CStringView hint, std::string &edited_string, TextInputFlags={})
bool is_item_hovered(HoveredFlags={})
float get_font_base_size()
void draw_text(CStringView)
bool should_save_last_drawn_item_value()
void draw_text_bullet_pointed(CStringView)
Vector2 calc_button_size(CStringView)
void draw_dummy(const Vector2 &size)
void set_keyboard_focus_here()
float get_text_line_height_in_current_panel()
std::vector< TableColumnSortSpec > get_table_column_sort_specs()
float get_font_base_size_with_spacing()
Vector2 get_style_panel_padding()
void draw_tooltip_description_spacer()
bool draw_button_nobg(CStringView, Vector2 dimensions={0.0f, 0.0f})
Flags< PopupFlag > PopupFlags
Definition oscimgui.h:522
void set_next_panel_size(Vector2 size, Conditional=Conditional::Always)
bool is_mouse_released_without_dragging(MouseButton)
void end_tooltip(std::optional< float > wrap_width=std::nullopt)
Vector2 get_content_region_available()
float get_main_window_workspace_aspect_ratio()
void end_tooltip_nowrap()
void draw_same_line_with_vertical_separator()
void pop_style_var(int count=1)
bool draw_angle3_input(CStringView label, Vector< Radians, 3 > &, CStringView format="%.3f")
void table_setup_column(CStringView label, ColumnFlags={}, float init_width_or_weight=0.0f, ID=ID{})
bool update_polar_camera_from_mouse_inputs(PolarPerspectiveCamera &, Vector2 viewport_dimensions)
float get_tree_node_to_label_spacing()
void draw_text_warning(CStringView)
bool begin_table(CStringView str_id, int column, TableFlags={}, const Vector2 &outer_size={}, float inner_width=0.0f)
bool draw_button_centered(CStringView)
void set_cursor_ui_position(Vector2)
void update_camera_from_all_inputs(Camera &, EulerAngles &)
bool is_mouse_down(MouseButton)
void set_next_item_size(Rect)
bool is_mouse_released(MouseButton)
Vector2 get_cursor_start_panel_position()
bool begin_tooltip_nowrap()
bool any_of_keys_down(std::span< const Key >)
void draw_vertical_spacer(float num_lines)
bool draw_checkbox(CStringView label, bool *v)
void draw_tooltip_header_text(CStringView)
SliderFlag
Definition oscimgui.h:251
Vector2 get_mouse_ui_position()
TabItemFlag
Definition oscimgui.h:205
void draw_help_marker(CStringView header, CStringView description)
bool draw_double_input(CStringView label, double *v, double step=0.0, double step_fast=0.0, const char *format="%.6f", TextInputFlags={})
Vector2 get_style_item_spacing()
void table_setup_scroll_freeze(int cols, int rows)
void draw_progress_bar(float fraction)
void set_next_panel_bg_alpha(float alpha)
bool is_item_hoverable(Rect bounds, ID)
void draw_tooltip(CStringView header, CStringView description={})
constexpr float gizmo_annotation_offset()
Definition oscimgui.h:1100
bool draw_float_kilogram_input(CStringView label, float &v, float step=0.0f, float step_fast=0.0f, TextInputFlags={})
bool begin_tab_item(CStringView label, bool *p_open=nullptr, TabItemFlags={})
bool is_item_deactivated_after_edit()
bool is_mouse_clicked(MouseButton, bool repeat=false)
bool draw_button(CStringView label, const Vector2 &size={})
Vector2 get_style_frame_padding()
float calc_button_width(CStringView)
GizmoMode
Definition oscimgui.h:1025
bool is_mouse_dragging_with_any_button_down()
float get_mouse_wheel_amount()
bool main_window_has_workspace()
void set_cursor_panel_position(Vector2)
bool draw_arrow_down_button(CStringView label)
bool draw_combobox(CStringView label, size_t *current, size_t size, const std::function< CStringView(size_t)> &accessor)
void push_item_flag(ItemFlags flags, bool enabled)
void unindent(float indent_w=0.0f)
bool draw_text_link(CStringView)
bool draw_int_input(CStringView label, int *v, int step=1, int step_fast=100, TextInputFlags={})
DrawListView get_panel_draw_list()
void draw_tooltip_description_text(CStringView)
GizmoOperation
Definition oscimgui.h:1015
StyleVar
Definition oscimgui.h:498
Vector2 get_cursor_panel_position()
bool update_polar_camera_from_keyboard_inputs(PolarPerspectiveCamera &, const Rect &viewport_rect, std::optional< AABB > maybe_scene_world_space_aabb)
bool any_of_keys_pressed(std::span< const Key >)
bool draw_float3_meters_input(CStringView label, Vector3 &, TextInputFlags={})
void draw_text_faded(CStringView)
bool draw_float_meters_slider(CStringView label, float &v, float v_min, float v_max, SliderFlags flags={})
void begin_disabled(bool disabled=true)
bool add_item(Rect bounds, ID)
bool draw_gizmo_mode_selector(Gizmo &)
void set_next_panel_size_constraints(Vector2 size_min, Vector2 size_max)
bool draw_selectable(CStringView label, bool *p_selected)
bool draw_small_button(CStringView label)
ID get_id(std::string_view)
Color get_style_color(ColorVar)
void open_popup(CStringView str_id, PopupFlags={})
void pop_style_color(int count=1)
void draw_text_disabled_and_centered(CStringView)
std::optional< Texture2D > get_font_texture()
ColorVar
Definition oscimgui.h:472
ItemFlag
Definition oscimgui.h:448
Vector2 calc_text_size(CStringView text, bool hide_text_after_double_hash=false)
Color get_color(ColorVar)
void draw_vertical_separator()
bool begin_main_window_top_bar(CStringView label, float height=ui::get_frame_height(), PanelFlags={PanelFlag::NoScrollbar, PanelFlag::NoSavedSettings, PanelFlag::MenuBar})
HittestResult hittest_last_drawn_item()
PopupFlag
Definition oscimgui.h:516
PanelFlags get_minimal_panel_flags()
float get_column_width(int column_index=-1)
bool draw_float_meters_input(CStringView label, float &v, float step=0.0f, float step_fast=0.0f, TextInputFlags={})
bool draw_collapsing_header(CStringView label, TreeNodeFlags={})
bool draw_gizmo_operation_selector(Gizmo &, bool can_translate=true, bool can_rotate=true, bool can_scale=true, CStringView translate_button_text="T", CStringView rotate_button_text="R", CStringView scale_button_text="S")
DataType
Definition oscimgui.h:260
Vector2 get_main_window_workspace_dimensions()
void draw_tooltip_if_item_hovered(CStringView header, CStringView description={}, HoveredFlags=HoveredFlag::ForTooltip)
bool begin_popup_modal(CStringView name, bool *p_open=nullptr, PanelFlags={})
Flags< PanelFlag > PanelFlags
Definition oscimgui.h:336
SortDirection
Definition oscimgui.h:569
void draw_text_panel_centered(CStringView)
HoveredFlag
Definition oscimgui.h:416
@ AllowWhenBlockedByPopup
@ AllowWhenBlockedByActiveItem
void set_next_panel_ui_position(Vector2, Conditional=Conditional::Always, Vector2 pivot={})
bool draw_vector3_input(CStringView label, Vector3 &v, const char *format="%.3f", TextInputFlags={})
void draw_text_disabled(CStringView)
bool draw_scalar_input(CStringView label, DataType data_type, void *p_data, const void *p_step=nullptr, const void *p_step_fast=nullptr, const char *format=nullptr, TextInputFlags={})
bool draw_float_slider(CStringView label, float *v, float v_min, float v_max, const char *format="%.3f", SliderFlags={})
float get_text_line_height_with_spacing_in_current_panel()
Vector2 get_item_bottom_right_ui_position()
bool is_mouse_in_main_window_workspace()
bool is_key_pressed(Key, bool repeat=true)
bool begin_combobox(CStringView label, CStringView preview_value, ComboFlags={})
Flags< ChildPanelFlag > ChildPanelFlags
Definition oscimgui.h:346
Conditional
Definition oscimgui.h:401
bool begin_child_panel(CStringView str_id, const Vector2 &size={}, ChildPanelFlags child_flags={}, PanelFlags panel_flags={})
float get_cursor_panel_x()
void add_screenshot_annotation_to_last_drawn_item(std::string_view label)
bool begin_panel(CStringView name, bool *p_open=nullptr, PanelFlags={})
void align_text_to_frame_padding()
void pop_item_flags(int n=1)
bool draw_radio_button(CStringView label, bool active)
Vector2 get_style_item_inner_spacing()
void push_style_var(StyleVar, Vector2)
Rect get_main_window_workspace_screen_space_rect()
DrawListView get_foreground_draw_list()
void same_line(float offset_from_start_x=0.0f, float spacing=-1.0f)
void set_next_item_open(bool is_open)
Definition custom_decoration_generator.h:5
constexpr Angle< Rep, Units > clamp(const Angle< Rep, Units > &v, const AngleMin &min, const AngleMax &max)
Definition angle.h:303
constexpr U to(T &&value)
Definition conversion.h:56
Definition closed_interval.h:20
Definition polar_perspective_camera.h:14
Definition oscimgui.h:1033
std::optional< Vector3 > position
Definition oscimgui.h:1036
std::optional< Vector3 > scale
Definition oscimgui.h:1034
std::optional< Radians > rotation
Definition oscimgui.h:1035
Definition oscimgui.h:757
Definition oscimgui.h:235
unsigned int value() const
Definition oscimgui.h:240
ID(unsigned int value)
Definition oscimgui.h:238
Definition oscimgui.h:576