consts in raylib.zr
This commit is contained in:
@@ -9,6 +9,14 @@ extern CloseWindow
|
|||||||
extern DrawRectangle
|
extern DrawRectangle
|
||||||
extern IsKeyDown
|
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
|
func main[] : i64
|
||||||
let x = 200
|
let x = 200
|
||||||
let y = 200
|
let y = 200
|
||||||
@@ -17,18 +25,18 @@ func main[] : i64
|
|||||||
SetTargetFPS(60)
|
SetTargetFPS(60)
|
||||||
|
|
||||||
while !WindowShouldClose()
|
while !WindowShouldClose()
|
||||||
if IsKeyDown(87) & 255 // W
|
if IsKeyDown(KEY_W) & 255
|
||||||
y = y - 10
|
y = y - 10
|
||||||
if IsKeyDown(83) & 255 // S
|
if IsKeyDown(KEY_S) & 255
|
||||||
y = y + 10
|
y = y + 10
|
||||||
if IsKeyDown(65) & 255 // A
|
if IsKeyDown(KEY_A) & 255
|
||||||
x = x - 10
|
x = x - 10
|
||||||
if IsKeyDown(68) & 255 // D
|
if IsKeyDown(KEY_D) & 255
|
||||||
x = x + 10
|
x = x + 10
|
||||||
|
|
||||||
BeginDrawing()
|
BeginDrawing()
|
||||||
ClearBackground(0xffffffff)
|
ClearBackground(WHITE)
|
||||||
DrawRectangle(x, y, 100, 100, 0xff0000ff)
|
DrawRectangle(x, y, 100, 100, RED)
|
||||||
EndDrawing()
|
EndDrawing()
|
||||||
|
|
||||||
CloseWindow()
|
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"];
|
static TYPES: [&str; 7] = ["void", "u8", "i64", "str", "bool", "ptr", "array"];
|
||||||
|
|
||||||
pub struct Parser {
|
pub struct Parser {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// absolutely not production-ready
|
||||||
|
|
||||||
func crypto.rotl32[x: i64, r: i64] : i64
|
func crypto.rotl32[x: i64, r: i64] : i64
|
||||||
return ((x << r) | (x >> (32 - r))) & 0xffffffff
|
return ((x << r) | (x >> (32 - r))) & 0xffffffff
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ extern gethostbyname
|
|||||||
func dbg.panic[msg: str] : void
|
func dbg.panic[msg: str] : void
|
||||||
io.print("PANIC: ")
|
io.print("PANIC: ")
|
||||||
io.println(msg)
|
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)
|
os.exit(1)
|
||||||
|
|
||||||
func mem.alloc[x: i64] : ptr
|
func mem.alloc[x: i64] : ptr
|
||||||
|
|||||||
Reference in New Issue
Block a user