Draw.odin

ClearScreen

ClearScreen (ctx: ^RenderContext, color: Types.Color)

Clears the screen of the renderer win a color

Parameters:
  • cxt: the renderer context to clear
  • color: the rgba value to clear the screen with

PresentScreen

PresentScreen (ctx: ^RenderContext)

Renders the current data in the renderer to the window

Parameters:
  • ctx: the renderer context to render to the window

DrawRect

DrawRect (ctx: ^RenderContext, pos: Types.Vector2f, size: Types.Vector2f, color: Types.Color, filled: bool = true, rot: f32 = 0.0)

Draws a rectangle to the renderer with optional rotation

Parameters:
  • ctx: the renderer to draw to
  • pos: the top-left point of the rect
  • size: the size of the rect
  • color: the RGBA color of the rect
  • filled: flag whether to fill the rect
  • rot: rotation in degrees (clockwise), default is 0

DrawLine

DrawLine (ctx: ^RenderContext, point1: Types.Vector2f, point2: Types.Vector2f, color: Types.Color)

Draws a line to the renderer

Parameters:
  • ctx: the renderer to draw to
  • point1: the start point of the line
  • point2: the end point of the line
  • color: the RGBA color of the line

DrawTexture

DrawTexture (ctx: ^RenderContext, texture: ^sdl2.Texture, pos: Types.Vector2f, rot: f64)

Draws an SDL2 texture to the renderer with optional rotation Can be used with an image loader or any SDL2 code that creates a texture (e.g., ImGUI or other SDL2 libraries) sutch as ImGUI and other SDL2 libs

Parameters:
  • ctx: the renderer to draw to
  • texture: the SDL2 texture to render
  • pos: the top-left position to draw the texture
  • rot: the rotation angle (in degrees)