Raven Engine v0.1
Loading...
Searching...
No Matches

Classes

class  Raven::UI::ScopedStyle
 RAII helper to push and pop a single ImGui style variable. Pushes the style var on construction, pops on destruction. More...
class  Raven::UI::ScopedColor
 RAII helper to push and pop a single ImGui style color. More...
class  Raven::UI::ScopedFont
 RAII helper to push and pop an ImGui font. More...
class  Raven::UI::ScopedID
 RAII helper to push and pop an ImGui ID. Supports any type convertible to ImGuiID. More...
class  Raven::UI::ScopedColorStack
 RAII helper to push and pop multiple ImGui style colors in one go. Expects a list of pairs: (ImGuiCol colorID, ColorValue). More...
class  Raven::UI::ScopedStyleStack
 RAII helper to push and pop multiple ImGui style variables in one go. Expects a list of pairs: (ImGuiStyleVar, Value). More...
class  Raven::UI::ScopedItemFlags
 RAII helper to push and pop ImGui item flags. More...
struct  Raven::UI::Toast
 Simple structure to represent a toast notification. More...

Functions

ImVec4 Raven::Colors::ConvertFromSRGB (ImVec4 colour)
 Converts an sRGB ImVec4 color to linear space.
ImVec4 Raven::Colors::ConvertToSRGB (ImVec4 colour)
 Converts a linear ImVec4 color to sRGB space.
ImU32 Raven::Colors::ColorWithValue (const ImColor &color, float value)
 Modifies the V (value) of a color in HSV space.
ImU32 Raven::Colors::ColorWithSaturation (const ImColor &color, float saturation)
 Modifies the S (saturation) of a color in HSV space.
ImU32 Raven::Colors::ColorWithHue (const ImColor &color, float hue)
 Modifies the H (hue) of a color in HSV space.
ImU32 Raven::Colors::ColorWithMultipliedValue (const ImColor &color, float multiplier)
 Scales the V (value) of a color in HSV space.
ImU32 Raven::Colors::ColorWithMultipliedSaturation (const ImColor &color, float multiplier)
 Scales the S (saturation) of a color in HSV space.
ImU32 Raven::Colors::ColorWithMultipliedHue (const ImColor &color, float multiplier)
 Scales the H (hue) of a color in HSV space.
void Raven::UI::Image (Ref< Image2D > &image, float width, float height)
 Render an Image2D at the specified size.
bool Raven::UI::CreateCombo (const char *label, std::string &currentItem, std::vector< std::string > &items, ImGuiComboFlags_ flags)
 Create a combo box widget with a list of string items.
void Raven::UI::SuspendLayout ()
 Suspend layout updates for batching UI changes.
void Raven::UI::ResumeLayout ()
 Resume layout updates after suspension.
void Raven::UI::ShiftCursorX (float distance)
 Shift the ImGui cursor horizontally.
void Raven::UI::ShiftCursorY (float distance)
 Shift the ImGui cursor vertically.
void Raven::UI::ShiftCursor (float x, float y)
 Shift the ImGui cursor position by a 2D offset.
ImRect Raven::UI::GetItemRect ()
 Retrieve the rectangle of the last rendered ImGui item.
ImRect Raven::UI::RectExpanded (const ImRect &rect, float x, float y)
 Expand an ImRect by a fixed pixel amount on each axis.
ImRect Raven::UI::RectOffset (const ImRect &rect, float x, float y)
 Offset an ImRect by fixed pixel amounts.
ImRect Raven::UI::RectOffset (const ImRect &rect, ImVec2 xy)
 Offset an ImRect by a 2D vector.
void Raven::UI::DrawVec2Control (const std::string &label, Crux::vec2 &values, float resetValue=0.0f, float columnLabelWidth=50.0f)
 Draw a labeled UI control for editing a 2D vector.
void Raven::UI::DrawVec3Control (const std::string &label, Crux::vec3 &values, float resetValue=0.0f, float columnLabelWidth=50.0f)
 Draw a labeled UI control for editing a 3D vector.
void Raven::UI::DrawButtonImage (const Ref< Texture2D > &imageNormal, const Ref< Texture2D > &imageHovered, const Ref< Texture2D > &imagePressed, ImU32 tintNormal, ImU32 tintHovered, ImU32 tintPressed, ImVec2 rectMin, ImVec2 rectMax)
 Draw a textured button with different states and tinting.
void Raven::UI::DrawButtonImage (const Ref< Texture2D > &imageNormal, const Ref< Texture2D > &imageHovered, const Ref< Texture2D > &imagePressed, ImU32 tintNormal, ImU32 tintHovered, ImU32 tintPressed, ImRect rectangle)
 Draw a textured button using an ImRect.
void Raven::UI::DrawButtonImage (const Ref< Texture2D > &image, ImU32 tintNormal, ImU32 tintHovered, ImU32 tintPressed, ImVec2 rectMin, ImVec2 rectMax)
 Draw a textured button with a single image.
void Raven::UI::DrawButtonImage (const Ref< Texture2D > &image, ImU32 tintNormal, ImU32 tintHovered, ImU32 tintPressed, ImRect rectangle)
 Draw a textured button with a single image using a rectangle.
void Raven::UI::DrawButtonImage (const Ref< Texture2D > &imageNormal, const Ref< Texture2D > &imageHovered, const Ref< Texture2D > &imagePressed, ImU32 tintNormal, ImU32 tintHovered, ImU32 tintPressed)
 Draw a textured button with multiple states and implicit rect.
void Raven::UI::DrawButtonImage (const Ref< Texture2D > &image, ImU32 tintNormal, ImU32 tintHovered, ImU32 tintPressed)
 Draw a textured button with single image and implicit rect.
void Raven::UI::RenderWindowOuterBorders (ImGuiWindow *window)
 Render borders around the outer edge of a window.
bool Raven::UI::UpdateWindowManualResize (ImGuiWindow *window, ImVec2 &newSize, ImVec2 &newPosition)
 Handle manual window resize operation.
void Raven::UI::BeginHorizontal (const char *str_id=nullptr, const ImVec2 &size=ImVec2(0, 0))
 Begin a horizontal UI layout group.
void Raven::UI::EndHorizontal ()
 End the current horizontal layout group.
void Raven::UI::BeginVertical (const char *str_id=nullptr, const ImVec2 &size=ImVec2(0, 0))
 Begin a vertical UI layout group.
void Raven::UI::EndVertical ()
 End the current vertical layout group.
bool Raven::UI::SelectableW (const wchar_t *label, bool selected, ImGuiSelectableFlags flags=0)
 Render a selectable item using a wide-character label.
void Raven::UI::Spring (float weightX=1.0f, float weightY=1.0f)
 Insert flexible spacing using weights.
bool Raven::UI::BeginMenubar (const ImRect &barRectangle)
 Begin a custom menubar inside a defined rectangle.
void Raven::UI::EndMenubar ()
 End the current menubar.
void Raven::UI::DrawBorder (ImRect rect, float thickness=1.0f, float rounding=0.0f, float offsetX=0.0f, float offsetY=0.0f)
 Draws a border around a given ImRect area.
void Raven::UI::ShowToast (const std::string &message, float duration, ImVec4 color=ImVec4(1.0f, 1.0f, 1.0f, 1.0f))
 Display a toast notification.
void Raven::UI::RenderToasts (const ImVec2 &viewportPos, const ImVec2 &viewportSize)
 Render all active toasts within the given viewport area.

Detailed Description

User Interface layer: UI components, rendering, and interaction handling.

Function Documentation

◆ BeginHorizontal()

void Raven::UI::BeginHorizontal ( const char * str_id = nullptr,
const ImVec2 & size = ImVec2(0, 0) )

Begin a horizontal UI layout group.

Parameters
str_idOptional ID to distinguish multiple horizontal layouts.
sizeOptional size override.

◆ BeginMenubar()

bool Raven::UI::BeginMenubar ( const ImRect & barRectangle)

Begin a custom menubar inside a defined rectangle.

Parameters
barRectangleBounding rectangle of the menubar.
Returns
true if the menubar was successfully started.

◆ BeginVertical()

void Raven::UI::BeginVertical ( const char * str_id = nullptr,
const ImVec2 & size = ImVec2(0, 0) )

Begin a vertical UI layout group.

Parameters
str_idOptional ID to distinguish multiple vertical layouts.
sizeOptional size override.

◆ ColorWithHue()

ImU32 Raven::Colors::ColorWithHue ( const ImColor & color,
float hue )
inline

Modifies the H (hue) of a color in HSV space.

Parameters
colorSource ImColor.
hueNew hue in [0.0, 1.0].
Returns
ImU32 with adjusted hue.

◆ ColorWithMultipliedHue()

ImU32 Raven::Colors::ColorWithMultipliedHue ( const ImColor & color,
float multiplier )
inline

Scales the H (hue) of a color in HSV space.

Parameters
colorSource ImColor.
multiplierHue multiplier.
Returns
ImU32 with scaled hue.

◆ ColorWithMultipliedSaturation()

ImU32 Raven::Colors::ColorWithMultipliedSaturation ( const ImColor & color,
float multiplier )
inline

Scales the S (saturation) of a color in HSV space.

Parameters
colorSource ImColor.
multiplierSaturation multiplier.
Returns
ImU32 with scaled saturation.

◆ ColorWithMultipliedValue()

ImU32 Raven::Colors::ColorWithMultipliedValue ( const ImColor & color,
float multiplier )
inline

Scales the V (value) of a color in HSV space.

Parameters
colorSource ImColor.
multiplierValue multiplier.
Returns
ImU32 with scaled value.

◆ ColorWithSaturation()

ImU32 Raven::Colors::ColorWithSaturation ( const ImColor & color,
float saturation )
inline

Modifies the S (saturation) of a color in HSV space.

Parameters
colorSource ImColor.
saturationNew saturation in [0.0, 1.0].
Returns
ImU32 with adjusted saturation.

◆ ColorWithValue()

ImU32 Raven::Colors::ColorWithValue ( const ImColor & color,
float value )
inline

Modifies the V (value) of a color in HSV space.

Parameters
colorSource ImColor.
valueNew value in [0.0, 1.0].
Returns
ImU32 with adjusted value.

◆ ConvertFromSRGB()

ImVec4 Raven::Colors::ConvertFromSRGB ( ImVec4 colour)
inline

Converts an sRGB ImVec4 color to linear space.

Parameters
coloursRGB color.
Returns
Linear color.

◆ ConvertToSRGB()

ImVec4 Raven::Colors::ConvertToSRGB ( ImVec4 colour)
inline

Converts a linear ImVec4 color to sRGB space.

Parameters
colourLinear color.
Returns
sRGB color.

◆ CreateCombo()

bool Raven::UI::CreateCombo ( const char * label,
std::string & currentItem,
std::vector< std::string > & items,
ImGuiComboFlags_ flags )

Create a combo box widget with a list of string items.

Parameters
labelLabel displayed next to the combo box.
currentItemReference to the string holding the currently selected item. Will be updated if the user selects a different item.
itemsVector of strings to populate the combo box options.
flagsOptional ImGui combo box behavior flags.
Returns
true if the selected item was changed.

◆ DrawBorder()

void Raven::UI::DrawBorder ( ImRect rect,
float thickness = 1.0f,
float rounding = 0.0f,
float offsetX = 0.0f,
float offsetY = 0.0f )

Draws a border around a given ImRect area.

Parameters
rectRectangle specifying the border area.
thicknessThickness of the border line.
roundingCorner rounding radius.
offsetXHorizontal offset for the border.
offsetYVertical offset for the border.

◆ DrawButtonImage() [1/6]

void Raven::UI::DrawButtonImage ( const Ref< Texture2D > & image,
ImU32 tintNormal,
ImU32 tintHovered,
ImU32 tintPressed )

Draw a textured button with single image and implicit rect.

Parameters
imageTexture for all states.
tintNormalTint for normal.
tintHoveredTint for hovered.
tintPressedTint for pressed.

◆ DrawButtonImage() [2/6]

void Raven::UI::DrawButtonImage ( const Ref< Texture2D > & image,
ImU32 tintNormal,
ImU32 tintHovered,
ImU32 tintPressed,
ImRect rectangle )

Draw a textured button with a single image using a rectangle.

Parameters
imageTexture used for all button states.
tintNormalTint for normal state.
tintHoveredTint for hovered state.
tintPressedTint for pressed state.
rectangleBounds of the button.

◆ DrawButtonImage() [3/6]

void Raven::UI::DrawButtonImage ( const Ref< Texture2D > & image,
ImU32 tintNormal,
ImU32 tintHovered,
ImU32 tintPressed,
ImVec2 rectMin,
ImVec2 rectMax )

Draw a textured button with a single image.

Parameters
imageTexture used for all button states.
tintNormalTint for normal state.
tintHoveredTint when hovered.
tintPressedTint when pressed.
rectMinTop-left button corner.
rectMaxBottom-right button corner.

◆ DrawButtonImage() [4/6]

void Raven::UI::DrawButtonImage ( const Ref< Texture2D > & imageNormal,
const Ref< Texture2D > & imageHovered,
const Ref< Texture2D > & imagePressed,
ImU32 tintNormal,
ImU32 tintHovered,
ImU32 tintPressed )

Draw a textured button with multiple states and implicit rect.

Parameters
imageNormalTexture for normal state.
imageHoveredTexture for hovered state.
imagePressedTexture for pressed state.
tintNormalTint for normal.
tintHoveredTint for hovered.
tintPressedTint for pressed.

◆ DrawButtonImage() [5/6]

void Raven::UI::DrawButtonImage ( const Ref< Texture2D > & imageNormal,
const Ref< Texture2D > & imageHovered,
const Ref< Texture2D > & imagePressed,
ImU32 tintNormal,
ImU32 tintHovered,
ImU32 tintPressed,
ImRect rectangle )

Draw a textured button using an ImRect.

Parameters
imageNormalTexture to display in normal state.
imageHoveredTexture for hovered state.
imagePressedTexture for pressed state.
tintNormalNormal state tint.
tintHoveredHovered state tint.
tintPressedPressed state tint.
rectangleRectangle defining button bounds.

◆ DrawButtonImage() [6/6]

void Raven::UI::DrawButtonImage ( const Ref< Texture2D > & imageNormal,
const Ref< Texture2D > & imageHovered,
const Ref< Texture2D > & imagePressed,
ImU32 tintNormal,
ImU32 tintHovered,
ImU32 tintPressed,
ImVec2 rectMin,
ImVec2 rectMax )

Draw a textured button with different states and tinting.

Parameters
imageNormalTexture to display in the normal state.
imageHoveredTexture when hovered.
imagePressedTexture when pressed.
tintNormalTint color in normal state (RGBA).
tintHoveredTint color when hovered.
tintPressedTint color when pressed.
rectMinTop-left coordinate of the button.
rectMaxBottom-right coordinate of the button.

◆ DrawVec2Control()

void Raven::UI::DrawVec2Control ( const std::string & label,
Crux::vec2 & values,
float resetValue = 0.0f,
float columnLabelWidth = 50.0f )

Draw a labeled UI control for editing a 2D vector.

Parameters
labelName of the control displayed to the left.
valuesReference to Crux::vec2 variable to modify.
resetValueDefault value used when reset button is clicked.
columnLabelWidthWidth of the label column in pixels.

◆ DrawVec3Control()

void Raven::UI::DrawVec3Control ( const std::string & label,
Crux::vec3 & values,
float resetValue = 0.0f,
float columnLabelWidth = 50.0f )

Draw a labeled UI control for editing a 3D vector.

Parameters
labelName of the control displayed to the left.
valuesReference to Crux::vec3 variable to modify.
resetValueDefault value used when reset button is clicked.
columnLabelWidthWidth of the label column in pixels.

◆ EndHorizontal()

void Raven::UI::EndHorizontal ( )

End the current horizontal layout group.

◆ EndMenubar()

void Raven::UI::EndMenubar ( )

End the current menubar.

◆ EndVertical()

void Raven::UI::EndVertical ( )

End the current vertical layout group.

◆ GetItemRect()

ImRect Raven::UI::GetItemRect ( )

Retrieve the rectangle of the last rendered ImGui item.

Returns
Bounding rectangle of the last item.

◆ Image()

void Raven::UI::Image ( Ref< Image2D > & image,
float width,
float height )

Render an Image2D at the specified size.

Parameters
imageReference-counted Image2D resource to render.
widthDesired image width in pixels.
heightDesired image height in pixels.

◆ RectExpanded()

ImRect Raven::UI::RectExpanded ( const ImRect & rect,
float x,
float y )

Expand an ImRect by a fixed pixel amount on each axis.

Parameters
rectRectangle to expand.
xAmount to expand on left/right sides.
yAmount to expand on top/bottom sides.
Returns
Expanded rectangle.

◆ RectOffset() [1/2]

ImRect Raven::UI::RectOffset ( const ImRect & rect,
float x,
float y )

Offset an ImRect by fixed pixel amounts.

Parameters
rectRectangle to offset.
xHorizontal offset.
yVertical offset.
Returns
Offset rectangle.

◆ RectOffset() [2/2]

ImRect Raven::UI::RectOffset ( const ImRect & rect,
ImVec2 xy )

Offset an ImRect by a 2D vector.

Parameters
rectRectangle to offset.
xyImVec2 offset to apply.
Returns
Offset rectangle.

◆ RenderToasts()

void Raven::UI::RenderToasts ( const ImVec2 & viewportPos,
const ImVec2 & viewportSize )

Render all active toasts within the given viewport area.

Parameters
viewportPosPosition of the viewport (top-left corner).
viewportSizeSize of the viewport.

◆ RenderWindowOuterBorders()

void Raven::UI::RenderWindowOuterBorders ( ImGuiWindow * window)

Render borders around the outer edge of a window.

Parameters
windowPointer to the ImGui window to render borders for.

◆ ResumeLayout()

void Raven::UI::ResumeLayout ( )

Resume layout updates after suspension.

◆ SelectableW()

bool Raven::UI::SelectableW ( const wchar_t * label,
bool selected,
ImGuiSelectableFlags flags = 0 )

Render a selectable item using a wide-character label.

Parameters
labelWide character string label.
selectedWhether the item is currently selected.
flagsImGui selectable flags.
Returns
true if the item was clicked.

◆ ShiftCursor()

void Raven::UI::ShiftCursor ( float x,
float y )

Shift the ImGui cursor position by a 2D offset.

Parameters
xHorizontal shift in pixels.
yVertical shift in pixels.

◆ ShiftCursorX()

void Raven::UI::ShiftCursorX ( float distance)

Shift the ImGui cursor horizontally.

Parameters
distanceDistance in pixels to shift along the X axis.

◆ ShiftCursorY()

void Raven::UI::ShiftCursorY ( float distance)

Shift the ImGui cursor vertically.

Parameters
distanceDistance in pixels to shift along the Y axis.

◆ ShowToast()

void Raven::UI::ShowToast ( const std::string & message,
float duration,
ImVec4 color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f) )

Display a toast notification.

Parameters
messageThe message string to display.
durationDuration in seconds the toast remains visible.
colorColor of the toast text (default white).

◆ Spring()

void Raven::UI::Spring ( float weightX = 1.0f,
float weightY = 1.0f )

Insert flexible spacing using weights.

Parameters
weightXHorizontal spring weight.
weightYVertical spring weight.

◆ SuspendLayout()

void Raven::UI::SuspendLayout ( )

Suspend layout updates for batching UI changes.

◆ UpdateWindowManualResize()

bool Raven::UI::UpdateWindowManualResize ( ImGuiWindow * window,
ImVec2 & newSize,
ImVec2 & newPosition )

Handle manual window resize operation.

Parameters
windowTarget ImGui window.
newSizeOutput: new size if resized.
newPositionOutput: new position if resized.
Returns
true if resizing occurred.