26#include <initializer_list>
33namespace osc {
class App; }
34namespace osc {
class Camera; }
35namespace osc {
class Event; }
36namespace osc {
struct PolarPerspectiveCamera; }
37namespace osc {
class RenderTexture; }
38namespace osc {
class Texture2D; }
115 template<
class...
Args>
122 template<
class...
Args>
158 std::optional<KeyCombination>
shortcut = {},
165 std::optional<KeyCombination>
shortcut,
205 explicit ID() =
default;
206 explicit ID(
unsigned int value) : value_{value} {}
208 unsigned int value()
const {
return value_; }
210 unsigned int value_ = 0;
323 template<
class...
Args>
541 size_t column_index = 0;
542 size_t sort_order = 0;
588 void add_rect(const
Rect& ui_rect, const
Color& color,
float rounding = 0.0f,
float thickness = 1.0f);
589 void add_rect_filled(const
Rect& ui_rect, const
Color& color,
float rounding = 0.0f);
590 void add_circle(const
Circle& ui_circle, const
Color& color,
int num_segments = 0,
float thickness = 1.0f);
591 void add_circle_filled(const
Circle& ui_circle, const
Color& color,
int num_segments = 0);
593 void add_line(const
Vector2& ui_start, const
Vector2& ui_end, const
Color& color,
float thickness = 1.0f);
595 void push_clip_rect(const
Rect&,
bool intersect_with_currect_clip_rect = false);
596 void pop_clip_rect();
600 virtual ImDrawList& impl_get_drawlist() = 0;
606 inner_list_{inner_list}
611 ImDrawList* inner_list_;
628 std::unique_ptr<ImDrawList> underlying_drawlist_;
642 const Rect& viewport_rect,
643 std::optional<AABB> maybe_scene_world_space_aabb
649 const Rect& viewport_rect,
650 std::optional<AABB> maybe_scene_world_space_aabb
672 std::optional<Vector2> dimensions = std::nullopt,
673 const Rect& region_uv_coordinates = Rect::from_corners({0.0f, 0.0f}, {1.0f, 1.0f})
689 Vector2 dimensions = {0.0f, 0.0f}
697 const Rect& texture_coordinates
722 bool is_hovered =
false;
723 bool is_left_click_released_without_dragging =
false;
724 bool is_right_click_released_without_dragging =
false;
785 HoveredFlags = HoveredFlag::ForTooltip
797 std::string& edited_string,
805 std::string& edited_string,
814 float step_fast = 0.0f,
839 float step_fast = 0.0f,
905 float height = ui::get_frame_height(),
906 PanelFlags = {PanelFlag::NoScrollbar, PanelFlag::NoSavedSettings, PanelFlag::MenuBar}
955 std::span<const CStringView> items
1020 const Rect& ui_rect,
1022 const AABB* local_bounds =
nullptr
1031 const Rect& ui_rect,
1033 const AABB* local_bounds =
nullptr
1047 std::optional<Transform> draw_to(
1051 const Rect& ui_rect,
1052 ImDrawList* draw_list,
1054 const AABB* local_bounds
1060 bool was_using_last_frame_ =
false;
1078 bool can_translate =
true,
1079 bool can_rotate =
true,
1080 bool can_scale =
true,
1088 bool can_translate =
true,
1089 bool can_rotate =
true,
1090 bool can_scale =
true,
1102 enum class PlotFlags {
1114 constexpr PlotFlags operator|(PlotFlags lhs, PlotFlags rhs)
1116 return static_cast<PlotFlags
>(std::to_underlying(lhs) | std::to_underlying(rhs));
1118 constexpr PlotFlags operator^(PlotFlags lhs, PlotFlags rhs)
1120 return static_cast<PlotFlags
>(std::to_underlying(lhs) ^ std::to_underlying(rhs));
1122 constexpr bool operator&(PlotFlags lhs, PlotFlags rhs)
1124 return (std::to_underlying(lhs) & std::to_underlying(rhs)) != 0;
1127 enum class PlotStyleVar {
1143 enum class PlotColorVar {
1160 enum class AxisFlags {
1165 NoTickLabels = 1<<3,
1172 Lock = LockMin | LockMax,
1173 NoDecorations = NoLabel | NoGridLines | NoTickMarks | NoTickLabels,
1176 constexpr AxisFlags operator|(AxisFlags lhs, AxisFlags rhs)
1178 return static_cast<AxisFlags
>(std::to_underlying(lhs) | std::to_underlying(rhs));
1181 enum class Condition {
1187 enum class MarkerType {
1193 enum class DragToolFlag : uint8_t {
1203 enum class Location {
1218 enum class LegendFlags {
1225 constexpr bool operator&(LegendFlags lhs, LegendFlags rhs)
1227 return (std::to_underlying(lhs) & std::to_underlying(rhs)) != 0;
1230 constexpr LegendFlags operator^(LegendFlags lhs, LegendFlags rhs)
1232 return static_cast<LegendFlags
>(std::to_underlying(lhs) ^ std::to_underlying(rhs));
1268 void setup_axis(Axis, std::optional<CStringView> label = std::nullopt, AxisFlags = AxisFlags::Default);
1271 void setup_axes(
CStringView x_label,
CStringView y_label, AxisFlags x_flags = AxisFlags::Default, AxisFlags y_flags = AxisFlags::Default);
1274 void setup_axis_limits(Axis axis,
ClosedInterval<float> data_range,
float padding_percentage, Condition = Condition::Once);
1282 void setup_finish();
1285 void set_next_marker_style(
1286 MarkerType = MarkerType::None,
1287 std::optional<float> size = std::nullopt,
1288 std::optional<Color> fill = std::nullopt,
1289 std::optional<float> weight = std::nullopt,
1290 std::optional<Color> outline = std::nullopt
1294 void plot_line(
CStringView name, std::span<const Vector2> points);
1300 Rect get_plot_ui_rect();
1313 va_start(args, fmt);
1314 detail::draw_annotation_v(position_dataspace, color, pixel_offset, clamp, fmt, args);
1329 DragToolFlags = DragToolFlag::Default
1338 float thickness = 1,
1339 DragToolFlags = DragToolFlag::Default
1348 float thickness = 1,
1349 DragToolFlags = DragToolFlag::Default
1353 void tag_x(
double plot_x,
const Color&,
bool round =
false);
1356 bool is_plot_hovered();
1359 Vector2 get_plot_mouse_position();
1362 Vector2 get_plot_mouse_position(Axis x_axis, Axis y_axis);
1365 void setup_legend(Location, LegendFlags = LegendFlags::Default);
1371 void end_legend_popup();
Definition c_string_view.h:13
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:578
DrawListAPI(DrawListAPI &&) noexcept=default
DrawListAPI(const DrawListAPI &)=default
Definition oscimgui.h:603
ImDrawList & impl_get_drawlist() final
Definition oscimgui.h:609
DrawListView(ImDrawList *inner_list)
Definition oscimgui.h:605
Definition oscimgui.h:614
ImDrawList & impl_get_drawlist() final
Definition oscimgui.h:626
DrawList(const DrawList &)=delete
DrawList(DrawList &&) noexcept
Definition oscimgui.h:1003
GizmoOperation operation() const
Definition oscimgui.h:1039
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:1041
void set_mode(GizmoMode mode)
Definition oscimgui.h:1042
bool handle_keyboard_inputs()
bool was_using() const
Definition oscimgui.h:1037
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:1040
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:282
@ 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:233
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()
ColumnFlag
Definition oscimgui.h:549
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:309
void draw_text_disabled(std::string_view)
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)
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:133
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:267
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:196
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 draw_text(std::string_view)
void set_num_columns(int count=1, std::optional< CStringView > id=std::nullopt, bool border=true)
TableFlag
Definition oscimgui.h:510
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()
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:485
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 set_tooltip(CStringView text)
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()
void set_tooltip_fmt(std::format_string< Args... > fmt, Args &&... args)
Definition oscimgui.h:324
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:219
Vector2 get_mouse_ui_position()
TabItemFlag
Definition oscimgui.h:173
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:1063
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:988
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:978
StyleVar
Definition oscimgui.h:461
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:435
ItemFlag
Definition oscimgui.h:411
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:479
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:228
void draw_text_wrapped(std::string_view)
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:304
SortDirection
Definition oscimgui.h:532
void draw_text_panel_centered(CStringView)
HoveredFlag
Definition oscimgui.h:379
@ 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={})
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:314
Conditional
Definition oscimgui.h:364
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:320
constexpr U to(T &&value)
Definition conversion.h:56
Definition closed_interval.h:20
Definition polar_perspective_camera.h:14
Definition oscimgui.h:996
std::optional< Vector3 > position
Definition oscimgui.h:999
std::optional< Vector3 > scale
Definition oscimgui.h:997
std::optional< Radians > rotation
Definition oscimgui.h:998
Definition oscimgui.h:720
Definition oscimgui.h:203
unsigned int value() const
Definition oscimgui.h:208
ID(unsigned int value)
Definition oscimgui.h:206
Definition oscimgui.h:539