Skip to content

Latest commit

 

History

History
127 lines (102 loc) · 2.68 KB

API.md

File metadata and controls

127 lines (102 loc) · 2.68 KB

Application

constructor

proc new*(_: type Application): Application {.raises: [OSError].}

macros

macro loadPlugin*(app: Application, plugin: untyped): untyped

Loads plugin.

macro loadPluginGroup*(app: Application, group: untyped): untyped

Loads group.

templates

template start*(app: Application, body: untyped): untyped

Starts the application. In body block, you can use a special variable world and run the process that you have to do before the application starts.

example

app.start:
  world.registerStartupSystems(myStartupSystem)
  world.registerSystems(mySystem1, mySystem2)
  world.registerTerminateSystems(myTerminateSystem)

  echo "Start the app!"

procedures

proc terminate*(app: Application)

Quits the application. Used in System.

SaohimeColor

constructors

proc new*(_: type SaohimeColor, r, g, b: range[0..255], a: range[0..255] = 255): SaohimeColor

proc new*(_: type SaohimeColor, color: Color = colWhite, a: range[0..255] = 255): SaohimeColor

Initializes SaohimeColor by specifying its color, where color is of type colors.Color.

fields

proc r*(color: SaohimeColor): range[0..255]

Returns r value of RGBA.

proc `r=`*(color: SaohimeColor, value: int)

Assigns value to color.r. r is set to 0 or 255 when value is out of 0..255.

proc g*(color: SaohimeColor): range[0..255]

Returns g value of RGBA.

proc `g=`*(color: SaohimeColor, value: int)

Assigns value to color.g. g is set to 0 or 255 when value is out of 0..255.

proc b*(color: SaohimeColor): range[0..255]

Returns b value of RGBA.

proc `b=`*(color: SaohimeColor, value: int)

Assigns value to color.b. b is set to 0 or 255 when value is out of 0..255.

proc a*(color: SaohimeColor): range[0..255]

Returns a value of RGBA.

proc `a=`*(color: SaohimeColor, value: int)

Assigns value to color.a. a is set to 0 or 255 when value is out of 0..255.

procedures

proc toSaohimeColor*(color: Color): SaohimeColor

Converts colors.color into SaohimeColor.

proc extractRGBA*(color: SaohimeColor): tuple[r, g, b, a: range[0..255]]

Vector

constructors

proc new*(_: type Vector; x: float = 0, y: float = 0): Vector

proc newWithPolarCoord*(_: type Vector; rad: float = 0f, len: float = 1f): Vector

Initializes Vector by specifying its rad and len.

procedures

proc toVector*(vector: (int, int)): Vector

Converts vector into Vector.

proc toVector*(x, y: int): Vector

Converts x, y into Vector.