Fix binop bugs
This commit is contained in:
@@ -8,12 +8,12 @@ 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 x: i32 = raylib::GetScreenWidth() / 2 - (width / 2)
|
||||
let y: i32 = raylib::GetScreenHeight() / 2 - (height / 2)
|
||||
|
||||
let direction: raylib::Vector2 = { x = 1 y = 1 }
|
||||
|
||||
let bgColor: raylib::Color = { r = 0 g = 0 b = 0 a = 255 }
|
||||
@@ -28,12 +28,12 @@ extern "main" func main(args: []cstring): i64
|
||||
}
|
||||
raylib::EndDrawing()
|
||||
|
||||
if x + width > raylib::GetScreenWidth()
|
||||
if x + width >= raylib::GetScreenWidth() || x <= 0
|
||||
{
|
||||
direction.x = -direction.x
|
||||
}
|
||||
|
||||
if y + height > raylib::GetScreenHeight()
|
||||
if y + height >= raylib::GetScreenHeight() || y <= 0
|
||||
{
|
||||
direction.y = -direction.y
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user