GuiColorBridge

Converts between the engine's linear-light Color and GuiColor (Guinevere's packed sRGB color), and lets the editor pass engine colors straight to the Guinevere draw calls it actually uses. Neither assembly can reference the other's color type directly — the engine can't depend on Guinevere, and Guinevere can't depend on the engine — so this bridge lives in Turian.Engine.UI, which already references both. A user-defined implicit conversion isn't an option either way: C# rejects conversion operators declared inside extension blocks (CS9282).

Public Methods

ToGui

public static GuiColor ToGui(Core.Color color)

Encodes a linear engine color to Guinevere's packed sRGB color, clamping to 0..255.

Parameters:

  • color (Core.Color)

Returns: GuiColor

ToEngine

public static Core.Color ToEngine(GuiColor color)

Decodes a Guinevere sRGB color to the engine's linear-light color.

Parameters:

  • color (GuiColor)

Returns: Core.Color

DrawText

public static LayoutNode DrawText(Gui gui, string text, float size = 0, Core.Color? color = null, Font? font = null, float wrapWidth = 0, bool centerInRect = true, bool clip = false, TextEffects? effects = null)

Parameters:

  • gui (Gui)
  • text (string)
  • size (float) (Default: 0)
  • color (Core.Color?) (Default: null)
  • font (Font?) (Default: null)
  • wrapWidth (float) (Default: 0)
  • centerInRect (bool) (Default: true)
  • clip (bool) (Default: false)
  • effects (TextEffects?) (Default: null)

Returns: LayoutNode

DrawRect

public static Shape DrawRect(Gui gui, Rect rect, Core.Color color, float radius = 0.0f, Corner corners = Corner.All)

Parameters:

  • gui (Gui)
  • rect (Rect)
  • color (Core.Color)
  • radius (float) (Default: 0.0f)
  • corners (Corner) (Default: Corner.All)

Returns: Shape

DrawRectBorder

public static Shape DrawRectBorder(Gui gui, Rect screenRect, Core.Color color, float thickness = 1f, float radius = 0.0f, Corner corners = Corner.All)

Parameters:

  • gui (Gui)
  • screenRect (Rect)
  • color (Core.Color)
  • thickness (float) (Default: 1f)
  • radius (float) (Default: 0.0f)
  • corners (Corner) (Default: Corner.All)

Returns: Shape

DrawBackgroundRect

public static Shape DrawBackgroundRect(Gui gui, Core.Color? color = null, float radius = 0.0f, Corner corners = Corner.All)

Parameters:

  • gui (Gui)
  • color (Core.Color?) (Default: null)
  • radius (float) (Default: 0.0f)
  • corners (Corner) (Default: Corner.All)

Returns: Shape