Make zero length arrays ptrs, finish Raylib prog

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
Slendi 2024-04-10 13:37:38 +03:00
parent 1caebf3295
commit 3b70d9786c
2 changed files with 25 additions and 6 deletions

View File

@ -9,6 +9,8 @@ fn SetTargetFPS(fps: i32)
fn EndDrawing
fn DrawFPS(x y: i32)
fn WindowShouldClose i32
fn TextSubtext(text: []u8, start end: i32) []u8
fn IsKeyPressed(key: i32) u1
struct Rectangle {
x y w h: f32,
@ -103,12 +105,26 @@ for WindowShouldClose == 0 {
state = 4
}
}
} else {
if IsKeyPressed(82) { \ KEY_R
fc = 0
lc = 0
top_side_rec_width = 16
left_side_rec_height = 16
bottom_side_rec_width = 16
right_side_rec_height = 16
state = 0
alpha = 1.0
}
}
BeginDrawing
ClearBackgroundWrap WHITE
if state == 0 {
DrawFPS 20 20
if state == 0 {
if (fc/15)%2 != 0 {
DrawRectangleWrap logox logoy 16 16 BLACK
}
@ -134,12 +150,11 @@ for WindowShouldClose == 0 {
DrawRectangleWrap GetScreenWidth/2-112 GetScreenHeight/2-112 224 224 colorw
\ DrawText(TextSubtext("raylib", 0, lettersCount), GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha));
\ DrawTextWrap "raylib" GetScreenWidth/2-44 GetScreenHeight/2+48 50 BLACK
DrawTextWrap (TextSubtext "raylib" 0 lc) GetScreenWidth/2-44 GetScreenHeight/2+48 50 colorb
} else {
DrawTextWrap "[R] REPLAY" 340 200 20 BLACK
}
EndDrawing
}
CloseWindow
"asf"

View File

@ -145,7 +145,11 @@ generate_llvm :: proc(ctx: LLVMContextRef, mod: LLVMModuleRef, builder: LLVMBuil
}
case .Array:
array_of := generate_llvm_type_from_node(ctx, mod, builder, type.array_of)
return LLVMArrayType2(array_of, type.array_size)
if type.array_size == 0 {
return LLVMPointerType(array_of, 0)
} else {
return LLVMArrayType2(array_of, type.array_size)
}
case .Pointer:
pointer_of := generate_llvm_type_from_node(ctx, mod, builder, type.pointer_to)
return LLVMPointerType(pointer_of, 0)