consts in raylib.zr
This commit is contained in:
@@ -9,6 +9,14 @@ extern CloseWindow
|
||||
extern DrawRectangle
|
||||
extern IsKeyDown
|
||||
|
||||
const KEY_W = 87
|
||||
const KEY_S = 83
|
||||
const KEY_A = 65
|
||||
const KEY_D = 68
|
||||
|
||||
const WHITE = 0xffffffff
|
||||
const RED = 0xff0000ff
|
||||
|
||||
func main[] : i64
|
||||
let x = 200
|
||||
let y = 200
|
||||
@@ -17,18 +25,18 @@ func main[] : i64
|
||||
SetTargetFPS(60)
|
||||
|
||||
while !WindowShouldClose()
|
||||
if IsKeyDown(87) & 255 // W
|
||||
if IsKeyDown(KEY_W) & 255
|
||||
y = y - 10
|
||||
if IsKeyDown(83) & 255 // S
|
||||
if IsKeyDown(KEY_S) & 255
|
||||
y = y + 10
|
||||
if IsKeyDown(65) & 255 // A
|
||||
if IsKeyDown(KEY_A) & 255
|
||||
x = x - 10
|
||||
if IsKeyDown(68) & 255 // D
|
||||
if IsKeyDown(KEY_D) & 255
|
||||
x = x + 10
|
||||
|
||||
BeginDrawing()
|
||||
ClearBackground(0xffffffff)
|
||||
DrawRectangle(x, y, 100, 100, 0xff0000ff)
|
||||
ClearBackground(WHITE)
|
||||
DrawRectangle(x, y, 100, 100, RED)
|
||||
EndDrawing()
|
||||
|
||||
CloseWindow()
|
||||
@@ -86,7 +86,7 @@ pub enum Expr {
|
||||
},
|
||||
}
|
||||
|
||||
// TODO: currently they are all just 8 byte values
|
||||
// TODO: currently they are all just 64 bit values
|
||||
static TYPES: [&str; 7] = ["void", "u8", "i64", "str", "bool", "ptr", "array"];
|
||||
|
||||
pub struct Parser {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// absolutely not production-ready
|
||||
|
||||
func crypto.rotl32[x: i64, r: i64] : i64
|
||||
return ((x << r) | (x >> (32 - r))) & 0xffffffff
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ extern gethostbyname
|
||||
func dbg.panic[msg: str] : void
|
||||
io.print("PANIC: ")
|
||||
io.println(msg)
|
||||
0/0 // crashes program which is kinda better since you get a gdb backtrace
|
||||
(0 / 0) // crashes program which is kinda better since you get a gdb backtrace
|
||||
os.exit(1)
|
||||
|
||||
func mem.alloc[x: i64] : ptr
|
||||
|
||||
Reference in New Issue
Block a user