diff --git a/compiler/NubLang/Generation/QBE/QBEGenerator.cs b/compiler/NubLang/Generation/QBE/QBEGenerator.cs index 5426ceb..f547e73 100644 --- a/compiler/NubLang/Generation/QBE/QBEGenerator.cs +++ b/compiler/NubLang/Generation/QBE/QBEGenerator.cs @@ -156,7 +156,7 @@ public class QBEGenerator NubCStringType => "=l", NubStringType => "=l", NubArrayType => "=l", - NubStructType => throw new InvalidOperationException("Structs are not loaded/stored directly"), + NubStructType => "=l", NubVoidType => throw new InvalidOperationException("Void has no assignment"), _ => throw new ArgumentOutOfRangeException(nameof(type), $"Unknown type {type.GetType()}") }; diff --git a/example/cat.png b/example/cat.png new file mode 100644 index 0000000..bd7a4b0 Binary files /dev/null and b/example/cat.png differ diff --git a/example/src/main.nub b/example/src/main.nub index 9c2657f..226a28f 100644 --- a/example/src/main.nub +++ b/example/src/main.nub @@ -8,13 +8,14 @@ extern "main" func main(args: []cstring): i64 raylib::InitWindow(1600, 900, "Hi from nub-lang") raylib::SetTargetFPS(240) - let width: i32 = 100 - let height: i32 = 100 + let width: i32 = 150 + let height: i32 = 150 let x: i32 = raylib::GetScreenWidth() / 2 - (width / 2) let y: i32 = raylib::GetScreenHeight() / 2 - (height / 2) let direction: raylib::Vector2 = { x = 1 y = 1 } + let speed: f32 = 250 let bgColor: raylib::Color = { r = 0 g = 0 b = 0 a = 255 } let color: raylib::Color = { r = 255 g = 255 b = 255 a = 255 } @@ -45,8 +46,8 @@ extern "main" func main(args: []cstring): i64 direction.y = -1 } - x = x + @floatToInt(i32, direction.x) - y = y + @floatToInt(i32, direction.y) + x = x + @floatToInt(i32, direction.x * speed * raylib::GetFrameTime()) + y = y + @floatToInt(i32, direction.y * speed * raylib::GetFrameTime()) } return 0