34 lines
781 B
Plaintext
34 lines
781 B
Plaintext
// needs to be compiled with -m -C="/usr/local/lib/libraylib.a -lm"
|
|
extern InitWindow
|
|
extern SetTargetFPS
|
|
extern WindowShouldClose
|
|
extern BeginDrawing
|
|
extern EndDrawing
|
|
extern ClearBackground
|
|
extern CloseWindow
|
|
extern DrawRectangle
|
|
extern IsKeyDown
|
|
|
|
func main[] : i64
|
|
let x = 200
|
|
let y = 200
|
|
|
|
InitWindow(800, 600, "Hello, World!")
|
|
SetTargetFPS(60)
|
|
|
|
while !WindowShouldClose()
|
|
if IsKeyDown(87) & 255 // W
|
|
y = y - 10
|
|
if IsKeyDown(83) & 255 // S
|
|
y = y + 10
|
|
if IsKeyDown(65) & 255 // A
|
|
x = x - 10
|
|
if IsKeyDown(68) & 255 // D
|
|
x = x + 10
|
|
|
|
BeginDrawing()
|
|
ClearBackground(0xffffffff)
|
|
DrawRectangle(x, y, 100, 100, 0xff0000ff)
|
|
EndDrawing()
|
|
|
|
CloseWindow() |