Add float to int builtin

This commit is contained in:
nub31
2025-09-28 22:48:32 +02:00
parent a2bdf47f5d
commit c489f23c41
6 changed files with 111 additions and 15 deletions

View File

@@ -6,11 +6,30 @@ module "main"
extern "main" func main(args: []cstring): i64
{
raylib::InitWindow(1600, 900, "Hi from nub-lang")
raylib::SetTargetFPS(240)
let x: i32 = 0
let y: i32 = 0
let width: i32 = 100
let height: i32 = 100
let direction: raylib::Vector2 = { x = 1 y = 1 }
let bgColor: raylib::Color = { r = 0 g = 0 b = 0 a = 255 }
let color: raylib::Color = { r = 255 g = 255 b = 255 a = 255 }
while !raylib::WindowShouldClose()
{
raylib::BeginDrawing()
{
raylib::ClearBackground(bgColor);
raylib::DrawRectangle(x, y, width, height, color)
}
raylib::EndDrawing()
x = x + @floatToInt(i32, direction.x)
y = y + @floatToInt(i32, direction.y)
}
return 0