This commit is contained in:
nub31
2025-10-20 18:31:43 +02:00
parent 6671fced57
commit 78441549c7
12 changed files with 313 additions and 724 deletions

View File

@@ -5,7 +5,10 @@ module "main"
extern "main" func main(args: []cstring): i64
{
raylib::SetConfigFlags(4 | 64)
raylib::InitWindow(1600, 900, "Hi from nub-lang")
defer raylib::CloseWindow()
raylib::SetTargetFPS(240)
let width: i32 = 150
@@ -20,26 +23,20 @@ extern "main" func main(args: []cstring): i64
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()
{
if x <= 0
{
while !raylib::WindowShouldClose() {
if x <= 0 {
direction.x = 1
}
else if x + width >= raylib::GetScreenWidth()
{
} else if x + width >= raylib::GetScreenWidth() {
direction.x = -1
}
else if y <= 0
{
if y <= 0 {
direction.y = 1
}
else if y + height >= raylib::GetScreenHeight()
{
} else if y + height >= raylib::GetScreenHeight() {
direction.y = -1
}
x = x + @floatToInt(i32, direction.x * speed * raylib::GetFrameTime())
x = x + @floatToInt(i32, direction.x * speed * raylib::GetFrameTime())
y = y + @floatToInt(i32, direction.y * speed * raylib::GetFrameTime())
raylib::BeginDrawing()