Draw
draw! : Color, ({} => {}) => {}
Draw to the framebuffer. Takes a color to clear the screen with.
Draw.draw! White \{} -> Draw.text! { pos: { x: 300, y: 50 }, text: "Hello World", size: 40, color: Navy } Draw.rectangle! { rect: { x: 100, y: 150, width: 250, height: 100 }, color: Aqua }
with_mode_2d! : Camera, ({} => {}) => {}
Draw a 2D scene using a camera perspective.
# RENDER FRAMEBUFFER Draw.draw! White \{} -> # RENDER WORLD Draw.withMode2D! model.camera \{} -> drawWorld! model # RENDER SCREEN UI drawScreenUI!
with_texture! :
RenderTexture,
Color,
({} => {})
=> {}
Draw to a render texture. Takes a color to clear the texture with.
text! :
{
font ? Font,
pos :
{
x : F32,
y : F32
},
text : Str,
size ? F32,
spacing ? F32,
color ? Color
}
=> {}
Draw text on the screen using the default font.
line! :
{
start : Vector2,
end : Vector2,
color : Color
}
=> {}
Draw a line on the screen.
Draw.line! { start: { x: 100, y: 500 }, end: { x: 500, y: 500 }, color: Red }
rectangle! :
{
rect : Rectangle,
color : Color
}
=> {}
Draw a rectangle on the screen.
Draw.rectangle! { rect: { x: 100, y: 150, width: 250, height: 100 }, color: Aqua }
rectangle_gradient_v! :
{
rect : Rectangle,
top : Color,
bottom : Color
}
=> {}
Draw a rectangle with a vertical-gradient fill on the screen.
Draw.rectangleGradientV! { rect: { x: 300, y: 250, width: 250, height: 100 }, top: Maroon, bottom: Green }
rectangle_gradient_h! :
{
rect : Rectangle,
left : Color,
right : Color
}
=> {}
Draw a rectangle with a horizontal-gradient fill on the screen.
Draw.rectangleGradientH! { rect: { x: 400, y: 150, width: 250, height: 100 }, top: Lime, bottom: Navy }
circle! :
{
center : Vector2,
radius : F32,
color : Color
}
=> {}
Draw a circle on the screen.
Draw.circle! { center: { x: 200, y: 400 }, radius: 75, color: Fuchsia }
circle_gradient! :
{
center : Vector2,
radius : F32,
inner : Color,
outer : Color
}
=> {}
Draw a circle with a gradient on the screen.
Draw.circleGradient! { center: { x: 600, y: 400 }, radius: 75, inner: Yellow, outer: Maroon }
texture_rec! :
{
texture : Texture,
source : Rectangle,
pos : Vector2,
tint : Color
}
=> {}
Draw part of a texture.
# Draw the sprite at the player's position. Draw.textureRec! { texture: model.dude, source: dudeSprite model.direction dudeAnimation.frame, pos: model.player, tint: White, }
render_texture_rec! :
{
texture : RenderTexture,
source : Rectangle,
pos : Vector2,
tint : Color
}
=> {}
Draw part of a texture.
# Draw the sprite at the player's position. Draw.renderTextureRec! { texture: model.dude, source: dudeSprite model.direction dudeAnimation.frame, pos: model.player, tint: White, }