diff --git a/pong.cat b/pong.cat index 0c74cd8..ee3f187 100644 --- a/pong.cat +++ b/pong.cat @@ -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" - diff --git a/src/llvm_emitter.odin b/src/llvm_emitter.odin index 21c166d..19088be 100644 --- a/src/llvm_emitter.odin +++ b/src/llvm_emitter.odin @@ -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)