diff --git a/README.md b/README.md index d73f03a..781adba 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,32 @@ invocation in command-line order: `-l`. `--c-include-path ` and `--c-define ` configure C preprocessing. +Instead of passing these on the command line, a project can describe its build +in Brolang itself. `brolang build [root]` (root defaults to the current +directory) reads a `config` constant from `root/build.bro` and compiles the +program package it names: + +```bro +b :: import "@std/build" + +config :: b.BuildConfig{ + name = "manual", + source = "src", + libraries = &[], + lib_paths = &[], + includes = &[], + defines = &[], + links = &["examples/build/manual/native.c"], +} +``` + +`source` is the program package, relative to `build.bro`. The list fields map to +the matching C options (`libraries` → `-l`, `lib_paths` → `-L`, `includes` → +`-I`, `defines` → C defines, `links` → linker inputs) and, like those flags, +their paths are relative to the invocation directory. Lists take the address of +an array literal; empty lists are written `&[]`. See `examples/build/` for +runnable projects. + Relative `.h` imports create synthetic package namespaces backed by libclang: ```bro diff --git a/TODO.md b/TODO.md index f7187ca..a3220ad 100644 --- a/TODO.md +++ b/TODO.md @@ -710,7 +710,16 @@ - native function pointers are non-variadic v1; C variadic function pointers stay under `*c_func(...) R` -28. brolang build system (requires comptime execution) +28. brolang build system — v0 shipped + - `brolang build [root]` reads a declarative `config` constant from + `root/build.bro` (importing `@std/build`'s `BuildConfig`) and compiles the + program package it names. The config is read from the checked HIR — build.bro + is never lowered — so it is literal-only. + - enabled `&` (Zig's `&.{...}`): the literal is promoted to an + anonymous global whose address decays to a slice, so list fields like + `libraries = &["raylib"]` work; empty lists are `&[]` + - deferred: build graph / steps / caching, multiple artifacts, computed paths + (needs string building), struct field defaults to drop `&[]` on empty lists ## A word on multi-unwrap diff --git a/compiler/build.odin b/compiler/build.odin new file mode 100644 index 0000000..86a2079 --- /dev/null +++ b/compiler/build.odin @@ -0,0 +1,252 @@ +package compiler + +import "./checker" +import "./cimport" +import "./hir" +import "./linker" +import "./loader" +import "./source" +import "./symbol" +import "./target" +import "./types" +import "core:fmt" +import vmem "core:mem/virtual" +import "core:path/filepath" +import "core:strings" + +// BuildConfig is the native, extracted form of std/build's BuildConfig: all +// strings are cloned into context.allocator so they outlive the build module's +// arena (freed at the end of run_build). Free with destroy_build_config. +BuildConfig :: struct { + output_name: string, + source_dir: string, + link_arguments: []linker.Argument, + c_options: cimport.Options, +} + +destroy_build_config :: proc(cfg: ^BuildConfig) { + delete(cfg.output_name) + delete(cfg.source_dir) + for arg in cfg.link_arguments { + delete(arg.value) + } + delete(cfg.link_arguments) + for path in cfg.c_options.include_paths { + delete(path) + } + delete(cfg.c_options.include_paths) + for define in cfg.c_options.defines { + delete(define) + } + delete(cfg.c_options.defines) +} + +// run_build implements `brolang build [root]`: it loads and type-checks +// `root/build.bro`, reads its `config` constant, and compiles the program +// package the config names. build.bro is only checked (never lowered/emitted), +// so the config is read straight from the HIR. +run_build :: proc(root: string) -> int { + sources := source.init_store() + defer source.destroy_store(&sources) + diagnostics := source.init_store_diagnostics(&sources) + defer source.destroy_diagnostics(&diagnostics) + symbols := symbol.init_table() + defer symbol.destroy_table(&symbols) + + arena: vmem.Arena + if err := vmem.arena_init_growing(&arena); err != nil { + fmt.eprintln("failed to initialize build arena:", err) + return 2 + } + defer vmem.arena_destroy(&arena) + a := vmem.arena_allocator(&arena) + + ast_module, loaded := loader.load(root, &sources, &diagnostics, &symbols, a, a, cimport.Options{}, target.DEFAULT) + if !loaded { + source.print_all(&diagnostics) + fmt.eprintln("failed to load build root:", root) + return 2 + } + // check needs no `main`: it synthesizes a trap main and emits one benign + // "missing main" diagnostic, which is expected for build.bro. Suppress that + // one but surface any real errors in build.bro (and fail on them). + hir_module := checker.check(&ast_module, &diagnostics, &symbols, target.DEFAULT, a) + if build_bro_has_errors(&diagnostics) { + source.print_all(&diagnostics) + return 2 + } + + cfg, ok := extract_build_config(&hir_module, &symbols) + if !ok { + return 2 + } + defer destroy_build_config(&cfg) + + program := filepath.join({root, cfg.source_dir}) + defer delete(program) + return compile_package(program, cfg.output_name, cfg.link_arguments, target.DEFAULT, cfg.c_options) +} + +// build_bro_has_errors reports whether checking build.bro produced any diagnostic +// other than the benign "missing or unusable main function" (build.bro has no +// main by design; that one is emitted with an empty span). +build_bro_has_errors :: proc(diagnostics: ^source.Diagnostics) -> bool { + for item in diagnostics.items { + if item.span == (source.Span{}) && item.message == "missing or unusable main function" { + continue + } + return true + } + return false +} + +// extract_build_config finds the top-level `config` constant and reads its +// BuildConfig{...} fields out of the HIR. All returned strings are cloned into +// context.allocator. +extract_build_config :: proc(m: ^hir.Module, symbols: ^symbol.Table) -> (BuildConfig, bool) { + config_id := symbol.intern(symbols, "config") + config_expr := hir.INVALID_EXPR + found := false + for g in m.globals { + if g.name == config_id { + config_expr = g.expr + found = true + break + } + } + if !found { + fmt.eprintln("build.bro: missing top-level 'config' constant") + return {}, false + } + root := unwrap_coercions(m, config_expr) + if root == hir.INVALID_EXPR || m.exprs[root].kind != .Struct { + fmt.eprintln("build.bro: 'config' must be a BuildConfig{...} literal") + return {}, false + } + args := m.exprs[root].args + fields := types.fields_for(&m.types, m.exprs[root].type) + + cfg: BuildConfig + links: [dynamic]linker.Argument + includes: [dynamic]string + defines: [dynamic]string + + for field, i in fields { + if i >= len(args) { + break + } + switch symbol.resolve(symbols, symbol.Id(field.name)) { + case "name": + if s, sok := read_string(m, args[i]); sok { + cfg.output_name = strings.clone(s) + } + case "source": + if s, sok := read_string(m, args[i]); sok { + cfg.source_dir = strings.clone(s) + } + case "libraries": + list := read_string_list(m, args[i]) + for v in list { + append(&links, linker.Argument{kind = .Library, value = strings.clone(v)}) + } + delete(list) + case "lib_paths": + list := read_string_list(m, args[i]) + for v in list { + append(&links, linker.Argument{kind = .Library_Path, value = strings.clone(v)}) + } + delete(list) + case "links": + list := read_string_list(m, args[i]) + for v in list { + append(&links, linker.Argument{kind = .Input, value = strings.clone(v)}) + } + delete(list) + case "includes": + list := read_string_list(m, args[i]) + for v in list { + append(&includes, strings.clone(v)) + } + delete(list) + case "defines": + list := read_string_list(m, args[i]) + for v in list { + append(&defines, strings.clone(v)) + } + delete(list) + } + } + + cfg.link_arguments = links[:] + cfg.c_options.include_paths = includes[:] + cfg.c_options.defines = defines[:] + + if len(cfg.output_name) == 0 || len(cfg.source_dir) == 0 { + fmt.eprintln("build.bro: config requires non-empty 'name' and 'source'") + destroy_build_config(&cfg) + return {}, false + } + return cfg, true +} + +// unwrap_coercions strips implicit coercion wrappers (each stores its inner +// expr in `.left`) to reach the underlying value expression. +unwrap_coercions :: proc(m: ^hir.Module, id: hir.Expr_Id) -> hir.Expr_Id { + cur := id + for cur != hir.INVALID_EXPR && int(cur) < len(m.exprs) { + #partial switch m.exprs[cur].kind { + case .Retype, .Weaken_Slice, .Weaken_Pointer, .Decay_Array_Pointer, .Slice_Ptr, + .Widen, .Sum_Widen, .Optional_Some, .C_Coerce, .Scalar_Cast: + cur = m.exprs[cur].left + case: + return cur + } + } + return cur +} + +read_string :: proc(m: ^hir.Module, id: hir.Expr_Id) -> (string, bool) { + e := unwrap_coercions(m, id) + if e == hir.INVALID_EXPR || m.exprs[e].kind != .String { + return "", false + } + sid := m.exprs[e].integer + if sid < 0 || int(sid) >= len(m.strings) { + return "", false + } + return m.strings[int(sid)], true +} + +// read_string_list reads a `&[...]` list field: the value is an address of an +// anonymous global array (see checker `&` promotion), whose +// elements are strings. Returned strings alias m.strings; callers clone them. +// The returned slice is owned by the caller (delete it). +read_string_list :: proc(m: ^hir.Module, id: hir.Expr_Id) -> []string { + addr := unwrap_coercions(m, id) + if addr == hir.INVALID_EXPR || m.exprs[addr].kind != .Address { + return nil + } + g := unwrap_coercions(m, m.exprs[addr].left) + if g == hir.INVALID_EXPR || m.exprs[g].kind != .Global { + return nil + } + gid := hir.as_global(m.exprs[g].target) + if gid == hir.INVALID_GLOBAL || int(gid) >= len(m.globals) { + return nil + } + arr := m.globals[gid].expr + if arr == hir.INVALID_EXPR || m.exprs[arr].kind != .Array { + return nil + } + elems := m.exprs[arr].args + out := make([]string, len(elems)) + for a, i in elems { + s, ok := read_string(m, a) + if !ok { + delete(out) + return nil + } + out[i] = s + } + return out +} diff --git a/compiler/checker/checker.odin b/compiler/checker/checker.odin index 9ff98e5..2735ee4 100644 --- a/compiler/checker/checker.odin +++ b/compiler/checker/checker.odin @@ -152,6 +152,10 @@ Checker :: struct { infer_stack: [dynamic]Infer_Frame, build_stack: [dynamic]Build_Expr_Frame, cycle_stack: [dynamic]Cycle_Frame, + // Anonymous globals synthesized for `&` (Zig's `&.{...}`). Staged + // here during global/function building and flushed into module.globals AFTER + // build_globals, so the 1:1 module.globals <-> ast.globals index identity holds. + anon_globals: [dynamic]hir.Global, main_symbol: symbol.Id, sink_symbol: symbol.Id, type_symbol: symbol.Id, @@ -3792,6 +3796,46 @@ build_compound_expr :: proc( diagnostic=source.INVALID_DIAGNOSTIC, }) case .Address: + // `&` (Zig's `&.{...}`): the operand is an rvalue with no + // address, so promote it to an anonymous global constant and take *its* + // address. Reuses the existing non-scalar-global storage path; only the + // stable global address enters the expression, so it never dangles. The + // resulting `*[N]T` then decays to a slice via the usual coercion. + if expr.left != ast.INVALID_EXPR && checker.ast_module.exprs[expr.left].kind == .Array { + operand := checker.ast_module.exprs[expr.left] + // Propagate an element-expected type through `&` so literal elements + // coerce to the target slice's element type (e.g. string -> []u8). + // Without this, `&["x"]` infers `*[1]*[N:0]u8`, which won't decay to + // `[][]u8` because can_decay_array_pointer requires child equality. + element := types.INVALID + if node, ok := types.node(store, expected); ok && (node.kind == .Slice || node.kind == .Array) { + element = node.child + } + synth_expected := types.INVALID + if types.is_valid(element) { + synth_expected = types.array(store, element, u64(len(operand.args)), false) + } + value := build_nested_expr(checker, expr.left, locals, global_reads, calls, synth_expected, pkg, file) + array_type := checker.module.exprs[value].type + hidden_id := hir.Global_Id(len(checker.ast_module.globals) + len(checker.anon_globals)) + append(&checker.anon_globals, hir.Global{ + name = symbol.intern(checker.symbols, "__anon.array"), + type = array_type, + expr = value, + writable = false, + external = false, + diagnostic = source.INVALID_DIAGNOSTIC, + }) + add_unique_global(global_reads, hidden_id) + global_ref := add_hir_expr(checker, hir.Expr{ + kind=.Global, span=expr.span, type=array_type, target=hir.global_ref(hidden_id), + left=hir.INVALID_EXPR, right=hir.INVALID_EXPR, diagnostic=source.INVALID_DIAGNOSTIC, + }) + return add_hir_expr(checker, hir.Expr{ + kind=.Address, span=expr.span, type=types.pointer(store, array_type, false, false), + left=global_ref, target=hir.INVALID_REF, right=hir.INVALID_EXPR, diagnostic=source.INVALID_DIAGNOSTIC, + }) + } value := build_nested_expr(checker, expr.left, locals, global_reads, calls, types.INVALID, pkg, file) if !hir_is_location(checker, value) { id := source.add(checker.diagnostics, expr.span, "'&' requires an addressable location") @@ -8087,6 +8131,7 @@ check :: proc( checker.infer_stack.allocator = allocator checker.build_stack.allocator = allocator checker.cycle_stack.allocator = allocator + checker.anon_globals.allocator = allocator build_symbol_indexes(&checker) checker.global_types = make([]types.Type, len(ast_module.globals), allocator) checker.global_demands = make([]types.Type, len(ast_module.globals), allocator) @@ -8167,6 +8212,12 @@ check :: proc( for index := 0; index < len(checker.specs); index += 1 { build_function(&checker, spec_id(index)) } + // Flush anonymous globals synthesized for `&`. Appended only now + // (after every ast global was built at its identity-mapped index) so their ids, + // pre-assigned as len(ast.globals)+stage_index, land exactly. + for anon in checker.anon_globals { + append(&checker.module.globals, anon) + } propagate_global_reads(&checker) main_template := find_template(&checker, checker.main_symbol, 0) diff --git a/compiler_tests.odin b/compiler_tests.odin index 5eb4978..8a6ca5f 100644 --- a/compiler_tests.odin +++ b/compiler_tests.odin @@ -2551,6 +2551,31 @@ valid_program_compiles_and_runs :: proc(t: ^testing.T) { testing.expect_value(t, state.exit_code, 0) } +@(test) +build_command_is_recognized :: proc(t: ^testing.T) { + testing.expect(t, is_build_command("build")) + testing.expect(t, !is_build_command("translate-c")) + testing.expect(t, !is_build_command("--build")) +} + +@(test) +build_subcommand_compiles_and_runs :: proc(t: ^testing.T) { + defer _ = os.remove("hello") + status := compiler_core.run_build("examples/build/hello") + testing.expect_value(t, status, 0) + state := run_executable("./hello") + testing.expect_value(t, state.exit_code, 0) +} + +@(test) +build_subcommand_links_c_source_via_list_field :: proc(t: ^testing.T) { + defer _ = os.remove("manual_build") + status := compiler_core.run_build("examples/build/manual") + testing.expect_value(t, status, 0) + state := run_executable("./manual_build") + testing.expect_value(t, state.exit_code, 42) +} + @(test) c_printf_accepts_a_string_literal :: proc(t: ^testing.T) { output := "/tmp/brolang-test-printf" diff --git a/examples/build/hello/build.bro b/examples/build/hello/build.bro new file mode 100644 index 0000000..31737a8 --- /dev/null +++ b/examples/build/hello/build.bro @@ -0,0 +1,11 @@ +b :: import "@std/build" + +config :: b.BuildConfig{ + name = "hello", + source = "src", + libraries = &[], + lib_paths = &[], + includes = &[], + defines = &[], + links = &[], +} diff --git a/examples/build/hello/src/main.bro b/examples/build/hello/src/main.bro new file mode 100644 index 0000000..7a88bff --- /dev/null +++ b/examples/build/hello/src/main.bro @@ -0,0 +1,3 @@ +main func() i32 { + return 0 +} diff --git a/examples/build/manual/build.bro b/examples/build/manual/build.bro new file mode 100644 index 0000000..f62c141 --- /dev/null +++ b/examples/build/manual/build.bro @@ -0,0 +1,11 @@ +b :: import "@std/build" + +config :: b.BuildConfig{ + name = "manual_build", + source = "src", + libraries = &[], + lib_paths = &[], + includes = &[], + defines = &[], + links = &["examples/build/manual/native.c"], +} diff --git a/examples/build/manual/native.c b/examples/build/manual/native.c new file mode 100644 index 0000000..9b41363 --- /dev/null +++ b/examples/build/manual/native.c @@ -0,0 +1,3 @@ +int foreign_add(int a, int b) { + return a + b; +} diff --git a/examples/build/manual/src/main.bro b/examples/build/manual/src/main.bro new file mode 100644 index 0000000..8b0f530 --- /dev/null +++ b/examples/build/manual/src/main.bro @@ -0,0 +1,5 @@ +foreign_add c_func(a, b i32) i32 + +main func() i32 { + return foreign_add(20, 22) +} diff --git a/examples/build/raylib/build.bro b/examples/build/raylib/build.bro new file mode 100644 index 0000000..e575ee7 --- /dev/null +++ b/examples/build/raylib/build.bro @@ -0,0 +1,18 @@ +# Illustrative build.bro for a raylib program (not run in CI: needs raylib +# installed and the game sources under ./game). +# +# Generate the raylib bindings once with: +# brolang translate-c /opt/homebrew/Cellar/raylib/*/include/raylib.h > game/raylib.bro +# then: +# brolang build examples/build/raylib +b :: import "@std/build" + +config :: b.BuildConfig{ + name = "game", + source = "source", + libraries = &["raylib"], + lib_paths = &["/opt/homebrew/lib"], + includes = &["/opt/homebrew/include"], + defines = &[], + links = &["-framework", "Cocoa", "-framework", "IOKit", "-framework", "CoreVideo", "-framework", "OpenGL"], +} diff --git a/examples/build/raylib/source/main.bro b/examples/build/raylib/source/main.bro new file mode 100644 index 0000000..cec6833 --- /dev/null +++ b/examples/build/raylib/source/main.bro @@ -0,0 +1,250 @@ +# Bouncing-shapes sandbox — a tour of brolang on top of raylib. +# +# Click to spawn a shape under the cursor, WASD/arrows to blow them around, +# SPACE to clear. The shape nearest the cursor is highlighted with its stats. +# +# Feature tour: native structs, enums, tagged unions + match (value, statement, +# payload capture, void variants, contextual construction), optionals + unwrap, +# value-loops (`yield :blk`), fallible functions with try/catch, defer, ranged +# and pointer-capturing for-loops, while, break/continue, compound assignment, +# scalar C interop, and multi-line strings. + +rl :: import "@vendor/raylib" + +# --- screen and physics constants ------------------------------------------- +W :: 900 +H :: 540 + +CAP usize :: 64 + +GRAV :: 0.18 # downward pull per frame +DAMP :: 0.82 # energy kept on a wall bounce +FORCE :: 0.9 # wind impulse from a key press +SPINMAX :: 3.0 # spin magnitude cap +RING_PAD :: 6.0 # highlight ring spacing + +# --- shapes ----------------------------------------------------------------- +Kind :: enum { + circle + square + triangle +} + +Ball :: struct { + x f32 + y f32 + dx f32 + dy f32 + radius f32 + kind Kind +} + +# A frame's worth of player intent, as a tagged union. Each arm carries exactly +# the data that action needs (or `void` when it needs none). +Command :: union(enum) { + spawn Vector2 # spawn a shape at this point + push struct { dx f32, dy f32 } # blow every shape this way + clear void + idle void +} + +# Spawning can fail when the backing array is full; the error carries the cap so +# the caller can report it. +SpawnError :: union(enum) { + full struct { cap usize } +} + +# value-match used as an expression source: each arm yields a Color. +color_for func(k Kind) Color { + col :: match k { + .circle: Color{ r = 235, g = 90, b = 90, a = 255 } + .square: Color{ r = 90, g = 205, b = 130, a = 255 } + .triangle: Color{ r = 105, g = 160, b = 245, a = 255 } + } + return col +} + +# value-match dispatching to a contextual return, used to cycle spawn kind. +next_kind func(k Kind) Kind { + return match k { + .circle: .square + .square: .triangle + .triangle: .circle + } +} + +# Read this frame's input into a single Command (contextual union construction: +# `.clear`, `.spawn{...}`, `.push{...}` are built against the return type). +read_command func() Command { + if rl.IsMouseButtonPressed(MOUSE_BUTTON_LEFT) return .spawn{ GetMousePosition() } + if rl.IsKeyPressed(KEY_SPACE) return .clear + + fx f32 = 0.0 + fy f32 = 0.0 + if rl.IsKeyDown(KEY_A) fx -= FORCE + if rl.IsKeyDown(KEY_D) fx += FORCE + if rl.IsKeyDown(KEY_W) fy -= FORCE + if rl.IsKeyDown(KEY_S) fy += FORCE + if rl.IsKeyDown(KEY_LEFT) fx -= FORCE + if rl.IsKeyDown(KEY_RIGHT) fx += FORCE + if rl.IsKeyDown(KEY_UP) fy -= FORCE + if rl.IsKeyDown(KEY_DOWN) fy += FORCE + + moved :: fx != 0.0 or fy != 0.0 + if (moved) return .push{ dx = fx, dy = fy } + return .idle +} + +# Fallible capacity check: returns the slot index to fill, or fails `.full`. +reserve func(used usize) usize ! SpawnError { + if (used >= CAP) return .full{ cap = CAP } + return used +} + +# Advance one ball: gravity, integrate, bounce off the four walls with damping. +# `b` is a pointer into the array, so the writes land in place. +step func(b @mut Ball) void { + b.dy += GRAV + b.x += b.dx + b.y += b.dy + + if (b.x < b.radius) { + b.x = b.radius + b.dx = -b.dx * DAMP + } + right :: f32(W) - b.radius + if (b.x > right) { + b.x = right + b.dx = -b.dx * DAMP + } + if (b.y < b.radius) { + b.y = b.radius + b.dy = -b.dy * DAMP + } + floor :: f32(H) - b.radius + if (b.y > floor) { + b.y = floor + b.dy = -b.dy * DAMP + } +} + +draw_ball func(b @Ball, highlight bool) void { + col :: color_for(b.kind) + center Vector2 = Vector2{ x = b.x, y = b.y } + match b.kind { + .circle: rl.DrawCircleV(center, b.radius, col) + .square: rl.DrawPoly(center, 4, b.radius, 45.0, col) + .triangle: rl.DrawPoly(center, 3, b.radius, 0.0, col) + } + if highlight { + ring rl.Color = rl.Color{ r = 250, g = 245, b = 200, a = 255 } + rl.DrawPoly(center, 24, b.radius + RING_PAD, 0.0, ring) + } +} + +main func() i32 { + rl.SetConfigFlags(FLAG_MSAA_4X_HINT) + rl.InitWindow(W, H, "brolang — bouncing shapes") + defer rl.CloseWindow() # runs on every exit path out of main + rl.SetTargetFPS(60) + + help :: + `[click] spawn a shape [WASD/arrows] blow wind + `[space] clear + + balls [CAP]mut Ball = undefined + count usize = 0 # number of live balls, in slots 0..count + kc Kind = .circle # next kind to spawn + spin f32 = 1.0 # rotates spawn velocity for variety + at_cap bool = false # show the "at capacity" banner + + bg :: rl.Color{ r = 24, g = 26, b = 34, a = 255 } + text :: rl.Color{ r = 225, g = 225, b = 230, a = 255 } + warn :: rl.Color{ r = 245, g = 180, b = 90, a = 255 } + + while !rl.WindowShouldClose() { + # --- input -> command ----------------------------------------------- + cmd :: read_command() + match cmd { + .spawn |at|: { + slot :: reserve(count) catch |e| { + match e { + .full |info|: at_cap = true + } + yield CAP # sentinel: >= CAP means "didn't fit" + } + if (slot < CAP) { + balls[slot] = Ball{ + x = f32(at.x), y = f32(at.y), + dx = FORCE * 6.0 * spin, + dy = -FORCE * 5.0, + radius = 18.0, + kind = kc, + } + count += 1 + kc = next_kind(kc) + spin = -spin * 1.2 + if (spin > SPINMAX or spin < -SPINMAX) spin = 1.0 + at_cap = false + } + } + .push |f|: { + for (&balls) |@b, i| { + if (i >= count) break + b.dx += f.dx + b.dy += f.dy + } + } + .clear: { + count = 0 + at_cap = false + } + .idle: {} + } + + # --- physics -------------------------------------------------------- + for (&balls) |@b, i| { + if (i >= count) break + step(b) + } + + # --- which shape is under the cursor? (optional via a value-loop) --- + mouse :: rl.GetMousePosition() + sel :: for 0..(count) |i| blk: { + c Vector2 = Vector2{ x = balls[i].x, y = balls[i].y } + if rl.CheckCollisionPointCircle(mouse, c, balls[i].radius) yield :blk i + yield none + } + + # --- draw ----------------------------------------------------------- + rl.BeginDrawing() + rl.ClearBackground(bg) + + for (&balls) |@b, i| { + if (i >= count) break + hot bool = false + if sel |s| { + if (s == i) hot = true # true only for the hovered ball + } + draw_ball(b, hot) + } + + rl.DrawText(help, 16, 16, 20, text) + + if sel |s| { + label :: match balls[s].kind { + .circle: "circle" + .square: "square" + .triangle: "triangle" + } + rl.DrawText(label, 16, H - 36, 20, text) + } + + if (at_cap) rl.DrawText("at capacity", W - 170, 16, 20, warn) + + rl.DrawFPS(W - 90, H - 28) + rl.EndDrawing() + } + + return 0 +} diff --git a/examples/build/raylib/vendor/raylib.bro b/examples/build/raylib/vendor/raylib.bro new file mode 100644 index 0000000..a3d6c53 --- /dev/null +++ b/examples/build/raylib/vendor/raylib.bro @@ -0,0 +1,1221 @@ +# generated by brolang translate-c from /opt/homebrew/Cellar/raylib/5.5/include/raylib.h + +Vector2 :: c_struct { + x c_float + y c_float +} +Vector3 :: c_struct { + x c_float + y c_float + z c_float +} +Vector4 :: c_struct { + x c_float + y c_float + z c_float + w c_float +} +Matrix :: c_struct { + m0 c_float + m4 c_float + m8 c_float + m12 c_float + m1 c_float + m5 c_float + m9 c_float + m13 c_float + m2 c_float + m6 c_float + m10 c_float + m14 c_float + m3 c_float + m7 c_float + m11 c_float + m15 c_float +} +Color :: c_struct { + r c_uchar + g c_uchar + b c_uchar + a c_uchar +} +Rectangle :: c_struct { + x c_float + y c_float + width c_float + height c_float +} +Image :: c_struct { + data ?*mut void + width c_int + height c_int + mipmaps c_int + format c_int +} +Texture :: c_struct { + id c_uint + width c_int + height c_int + mipmaps c_int + format c_int +} +RenderTexture :: c_struct { + id c_uint + texture Texture + depth Texture +} +NPatchInfo :: c_struct { + source Rectangle + left c_int + top c_int + right c_int + bottom c_int + layout c_int +} +GlyphInfo :: c_struct { + value c_int + offsetX c_int + offsetY c_int + advanceX c_int + image Image +} +Font :: c_struct { + baseSize c_int + glyphCount c_int + glyphPadding c_int + texture Texture + recs ?*mut Rectangle + glyphs ?*mut GlyphInfo +} +Camera3D :: c_struct { + position Vector3 + target Vector3 + up Vector3 + fovy c_float + projection c_int +} +Camera2D :: c_struct { + offset Vector2 + target Vector2 + rotation c_float + zoom c_float +} +Mesh :: c_struct { + vertexCount c_int + triangleCount c_int + vertices ?*mut c_float + texcoords ?*mut c_float + texcoords2 ?*mut c_float + normals ?*mut c_float + tangents ?*mut c_float + colors ?*mut c_uchar + indices ?*mut c_ushort + animVertices ?*mut c_float + animNormals ?*mut c_float + boneIds ?*mut c_uchar + boneWeights ?*mut c_float + boneMatrices ?*mut Matrix + boneCount c_int + vaoId c_uint + vboId ?*mut c_uint +} +Shader :: c_struct { + id c_uint + locs ?*mut c_int +} +MaterialMap :: c_struct { + texture Texture + color Color + value c_float +} +Material :: c_struct { + shader Shader + maps ?*mut MaterialMap + params [4]c_float +} +Transform :: c_struct { + translation Vector3 + rotation Vector4 + scale Vector3 +} +BoneInfo :: c_struct { + name [32]c_char + parent c_int +} +Model :: c_struct { + transform Matrix + meshCount c_int + materialCount c_int + meshes ?*mut Mesh + materials ?*mut Material + meshMaterial ?*mut c_int + boneCount c_int + bones ?*mut BoneInfo + bindPose ?*mut Transform +} +ModelAnimation :: c_struct { + boneCount c_int + frameCount c_int + bones ?*mut BoneInfo + framePoses ?*mut ?*mut Transform + name [32]c_char +} +Ray :: c_struct { + position Vector3 + direction Vector3 +} +RayCollision :: c_struct { + hit bool + distance c_float + point Vector3 + normal Vector3 +} +BoundingBox :: c_struct { + min Vector3 + max Vector3 +} +Wave :: c_struct { + frameCount c_uint + sampleRate c_uint + sampleSize c_uint + channels c_uint + data ?*mut void +} +rAudioBuffer :: c_struct +rAudioProcessor :: c_struct +AudioStream :: c_struct { + buffer ?*mut rAudioBuffer + processor ?*mut rAudioProcessor + sampleRate c_uint + sampleSize c_uint + channels c_uint +} +Sound :: c_struct { + stream AudioStream + frameCount c_uint +} +Music :: c_struct { + stream AudioStream + frameCount c_uint + looping bool + ctxType c_int + ctxData ?*mut void +} +VrDeviceInfo :: c_struct { + hResolution c_int + vResolution c_int + hScreenSize c_float + vScreenSize c_float + eyeToScreenDistance c_float + lensSeparationDistance c_float + interpupillaryDistance c_float + lensDistortionValues [4]c_float + chromaAbCorrection [4]c_float +} +VrStereoConfig :: c_struct { + projection [2]Matrix + viewOffset [2]Matrix + leftLensCenter [2]c_float + rightLensCenter [2]c_float + leftScreenCenter [2]c_float + rightScreenCenter [2]c_float + scale [2]c_float + scaleIn [2]c_float +} +FilePathList :: c_struct { + capacity c_uint + count c_uint + paths ?*mut ?*mut c_char +} +AutomationEvent :: c_struct { + frame c_uint + type c_uint + params [4]c_int +} +AutomationEventList :: c_struct { + capacity c_uint + count c_uint + events ?*mut AutomationEvent +} + +__gnuc_va_list :: alias ?*mut c_char +va_list :: alias ?*mut c_char +Quaternion :: alias Vector4 +Texture2D :: alias Texture +TextureCubemap :: alias Texture +RenderTexture2D :: alias RenderTexture +Camera :: alias Camera3D +ConfigFlags :: alias c_uint +TraceLogLevel :: alias c_uint +KeyboardKey :: alias c_uint +MouseButton :: alias c_uint +MouseCursor :: alias c_uint +GamepadButton :: alias c_uint +GamepadAxis :: alias c_uint +MaterialMapIndex :: alias c_uint +ShaderLocationIndex :: alias c_uint +ShaderUniformDataType :: alias c_uint +ShaderAttributeDataType :: alias c_uint +PixelFormat :: alias c_uint +TextureFilter :: alias c_uint +TextureWrap :: alias c_uint +CubemapLayout :: alias c_uint +FontType :: alias c_uint +BlendMode :: alias c_uint +Gesture :: alias c_uint +CameraMode :: alias c_uint +CameraProjection :: alias c_uint +NPatchLayout :: alias c_uint +TraceLogCallback :: alias ?*c_func(_ c_int, _ ?*c_char, _ ?*mut c_char) void +LoadFileDataCallback :: alias ?*c_func(_ ?*c_char, _ ?*mut c_int) ?*mut c_uchar +SaveFileDataCallback :: alias ?*c_func(_ ?*c_char, _ ?*mut void, _ c_int) bool +LoadFileTextCallback :: alias ?*c_func(_ ?*c_char) ?*mut c_char +SaveFileTextCallback :: alias ?*c_func(_ ?*c_char, _ ?*mut c_char) bool +AudioCallback :: alias ?*c_func(_ ?*mut void, _ c_uint) void + +RAYLIB_VERSION_MAJOR c_int :: 5 +RAYLIB_VERSION_MINOR c_int :: 5 +RAYLIB_VERSION_PATCH c_int :: 0 +PI c_float :: 3.1415927410125732 +# unsupported in bindings: aggregate macro 'LIGHTGRAY' has no native spelling +# unsupported in bindings: aggregate macro 'GRAY' has no native spelling +# unsupported in bindings: aggregate macro 'DARKGRAY' has no native spelling +# unsupported in bindings: aggregate macro 'YELLOW' has no native spelling +# unsupported in bindings: aggregate macro 'GOLD' has no native spelling +# unsupported in bindings: aggregate macro 'ORANGE' has no native spelling +# unsupported in bindings: aggregate macro 'PINK' has no native spelling +# unsupported in bindings: aggregate macro 'RED' has no native spelling +# unsupported in bindings: aggregate macro 'MAROON' has no native spelling +# unsupported in bindings: aggregate macro 'GREEN' has no native spelling +# unsupported in bindings: aggregate macro 'LIME' has no native spelling +# unsupported in bindings: aggregate macro 'DARKGREEN' has no native spelling +# unsupported in bindings: aggregate macro 'SKYBLUE' has no native spelling +# unsupported in bindings: aggregate macro 'BLUE' has no native spelling +# unsupported in bindings: aggregate macro 'DARKBLUE' has no native spelling +# unsupported in bindings: aggregate macro 'PURPLE' has no native spelling +# unsupported in bindings: aggregate macro 'VIOLET' has no native spelling +# unsupported in bindings: aggregate macro 'DARKPURPLE' has no native spelling +# unsupported in bindings: aggregate macro 'BEIGE' has no native spelling +# unsupported in bindings: aggregate macro 'BROWN' has no native spelling +# unsupported in bindings: aggregate macro 'DARKBROWN' has no native spelling +# unsupported in bindings: aggregate macro 'WHITE' has no native spelling +# unsupported in bindings: aggregate macro 'BLACK' has no native spelling +# unsupported in bindings: aggregate macro 'BLANK' has no native spelling +# unsupported in bindings: aggregate macro 'MAGENTA' has no native spelling +# unsupported in bindings: aggregate macro 'RAYWHITE' has no native spelling +# unsupported in bindings: macro 'true' — name is a brolang keyword +# unsupported in bindings: macro 'false' — name is a brolang keyword +FLAG_VSYNC_HINT c_uint :: 64 +FLAG_FULLSCREEN_MODE c_uint :: 2 +FLAG_WINDOW_RESIZABLE c_uint :: 4 +FLAG_WINDOW_UNDECORATED c_uint :: 8 +FLAG_WINDOW_HIDDEN c_uint :: 128 +FLAG_WINDOW_MINIMIZED c_uint :: 512 +FLAG_WINDOW_MAXIMIZED c_uint :: 1024 +FLAG_WINDOW_UNFOCUSED c_uint :: 2048 +FLAG_WINDOW_TOPMOST c_uint :: 4096 +FLAG_WINDOW_ALWAYS_RUN c_uint :: 256 +FLAG_WINDOW_TRANSPARENT c_uint :: 16 +FLAG_WINDOW_HIGHDPI c_uint :: 8192 +FLAG_WINDOW_MOUSE_PASSTHROUGH c_uint :: 16384 +FLAG_BORDERLESS_WINDOWED_MODE c_uint :: 32768 +FLAG_MSAA_4X_HINT c_uint :: 32 +FLAG_INTERLACED_HINT c_uint :: 65536 +LOG_ALL c_uint :: 0 +LOG_TRACE c_uint :: 1 +LOG_DEBUG c_uint :: 2 +LOG_INFO c_uint :: 3 +LOG_WARNING c_uint :: 4 +LOG_ERROR c_uint :: 5 +LOG_FATAL c_uint :: 6 +LOG_NONE c_uint :: 7 +KEY_NULL c_uint :: 0 +KEY_APOSTROPHE c_uint :: 39 +KEY_COMMA c_uint :: 44 +KEY_MINUS c_uint :: 45 +KEY_PERIOD c_uint :: 46 +KEY_SLASH c_uint :: 47 +KEY_ZERO c_uint :: 48 +KEY_ONE c_uint :: 49 +KEY_TWO c_uint :: 50 +KEY_THREE c_uint :: 51 +KEY_FOUR c_uint :: 52 +KEY_FIVE c_uint :: 53 +KEY_SIX c_uint :: 54 +KEY_SEVEN c_uint :: 55 +KEY_EIGHT c_uint :: 56 +KEY_NINE c_uint :: 57 +KEY_SEMICOLON c_uint :: 59 +KEY_EQUAL c_uint :: 61 +KEY_A c_uint :: 65 +KEY_B c_uint :: 66 +KEY_C c_uint :: 67 +KEY_D c_uint :: 68 +KEY_E c_uint :: 69 +KEY_F c_uint :: 70 +KEY_G c_uint :: 71 +KEY_H c_uint :: 72 +KEY_I c_uint :: 73 +KEY_J c_uint :: 74 +KEY_K c_uint :: 75 +KEY_L c_uint :: 76 +KEY_M c_uint :: 77 +KEY_N c_uint :: 78 +KEY_O c_uint :: 79 +KEY_P c_uint :: 80 +KEY_Q c_uint :: 81 +KEY_R c_uint :: 82 +KEY_S c_uint :: 83 +KEY_T c_uint :: 84 +KEY_U c_uint :: 85 +KEY_V c_uint :: 86 +KEY_W c_uint :: 87 +KEY_X c_uint :: 88 +KEY_Y c_uint :: 89 +KEY_Z c_uint :: 90 +KEY_LEFT_BRACKET c_uint :: 91 +KEY_BACKSLASH c_uint :: 92 +KEY_RIGHT_BRACKET c_uint :: 93 +KEY_GRAVE c_uint :: 96 +KEY_SPACE c_uint :: 32 +KEY_ESCAPE c_uint :: 256 +KEY_ENTER c_uint :: 257 +KEY_TAB c_uint :: 258 +KEY_BACKSPACE c_uint :: 259 +KEY_INSERT c_uint :: 260 +KEY_DELETE c_uint :: 261 +KEY_RIGHT c_uint :: 262 +KEY_LEFT c_uint :: 263 +KEY_DOWN c_uint :: 264 +KEY_UP c_uint :: 265 +KEY_PAGE_UP c_uint :: 266 +KEY_PAGE_DOWN c_uint :: 267 +KEY_HOME c_uint :: 268 +KEY_END c_uint :: 269 +KEY_CAPS_LOCK c_uint :: 280 +KEY_SCROLL_LOCK c_uint :: 281 +KEY_NUM_LOCK c_uint :: 282 +KEY_PRINT_SCREEN c_uint :: 283 +KEY_PAUSE c_uint :: 284 +KEY_F1 c_uint :: 290 +KEY_F2 c_uint :: 291 +KEY_F3 c_uint :: 292 +KEY_F4 c_uint :: 293 +KEY_F5 c_uint :: 294 +KEY_F6 c_uint :: 295 +KEY_F7 c_uint :: 296 +KEY_F8 c_uint :: 297 +KEY_F9 c_uint :: 298 +KEY_F10 c_uint :: 299 +KEY_F11 c_uint :: 300 +KEY_F12 c_uint :: 301 +KEY_LEFT_SHIFT c_uint :: 340 +KEY_LEFT_CONTROL c_uint :: 341 +KEY_LEFT_ALT c_uint :: 342 +KEY_LEFT_SUPER c_uint :: 343 +KEY_RIGHT_SHIFT c_uint :: 344 +KEY_RIGHT_CONTROL c_uint :: 345 +KEY_RIGHT_ALT c_uint :: 346 +KEY_RIGHT_SUPER c_uint :: 347 +KEY_KB_MENU c_uint :: 348 +KEY_KP_0 c_uint :: 320 +KEY_KP_1 c_uint :: 321 +KEY_KP_2 c_uint :: 322 +KEY_KP_3 c_uint :: 323 +KEY_KP_4 c_uint :: 324 +KEY_KP_5 c_uint :: 325 +KEY_KP_6 c_uint :: 326 +KEY_KP_7 c_uint :: 327 +KEY_KP_8 c_uint :: 328 +KEY_KP_9 c_uint :: 329 +KEY_KP_DECIMAL c_uint :: 330 +KEY_KP_DIVIDE c_uint :: 331 +KEY_KP_MULTIPLY c_uint :: 332 +KEY_KP_SUBTRACT c_uint :: 333 +KEY_KP_ADD c_uint :: 334 +KEY_KP_ENTER c_uint :: 335 +KEY_KP_EQUAL c_uint :: 336 +KEY_BACK c_uint :: 4 +KEY_MENU c_uint :: 5 +KEY_VOLUME_UP c_uint :: 24 +KEY_VOLUME_DOWN c_uint :: 25 +MOUSE_BUTTON_LEFT c_uint :: 0 +MOUSE_BUTTON_RIGHT c_uint :: 1 +MOUSE_BUTTON_MIDDLE c_uint :: 2 +MOUSE_BUTTON_SIDE c_uint :: 3 +MOUSE_BUTTON_EXTRA c_uint :: 4 +MOUSE_BUTTON_FORWARD c_uint :: 5 +MOUSE_BUTTON_BACK c_uint :: 6 +MOUSE_CURSOR_DEFAULT c_uint :: 0 +MOUSE_CURSOR_ARROW c_uint :: 1 +MOUSE_CURSOR_IBEAM c_uint :: 2 +MOUSE_CURSOR_CROSSHAIR c_uint :: 3 +MOUSE_CURSOR_POINTING_HAND c_uint :: 4 +MOUSE_CURSOR_RESIZE_EW c_uint :: 5 +MOUSE_CURSOR_RESIZE_NS c_uint :: 6 +MOUSE_CURSOR_RESIZE_NWSE c_uint :: 7 +MOUSE_CURSOR_RESIZE_NESW c_uint :: 8 +MOUSE_CURSOR_RESIZE_ALL c_uint :: 9 +MOUSE_CURSOR_NOT_ALLOWED c_uint :: 10 +GAMEPAD_BUTTON_UNKNOWN c_uint :: 0 +GAMEPAD_BUTTON_LEFT_FACE_UP c_uint :: 1 +GAMEPAD_BUTTON_LEFT_FACE_RIGHT c_uint :: 2 +GAMEPAD_BUTTON_LEFT_FACE_DOWN c_uint :: 3 +GAMEPAD_BUTTON_LEFT_FACE_LEFT c_uint :: 4 +GAMEPAD_BUTTON_RIGHT_FACE_UP c_uint :: 5 +GAMEPAD_BUTTON_RIGHT_FACE_RIGHT c_uint :: 6 +GAMEPAD_BUTTON_RIGHT_FACE_DOWN c_uint :: 7 +GAMEPAD_BUTTON_RIGHT_FACE_LEFT c_uint :: 8 +GAMEPAD_BUTTON_LEFT_TRIGGER_1 c_uint :: 9 +GAMEPAD_BUTTON_LEFT_TRIGGER_2 c_uint :: 10 +GAMEPAD_BUTTON_RIGHT_TRIGGER_1 c_uint :: 11 +GAMEPAD_BUTTON_RIGHT_TRIGGER_2 c_uint :: 12 +GAMEPAD_BUTTON_MIDDLE_LEFT c_uint :: 13 +GAMEPAD_BUTTON_MIDDLE c_uint :: 14 +GAMEPAD_BUTTON_MIDDLE_RIGHT c_uint :: 15 +GAMEPAD_BUTTON_LEFT_THUMB c_uint :: 16 +GAMEPAD_BUTTON_RIGHT_THUMB c_uint :: 17 +GAMEPAD_AXIS_LEFT_X c_uint :: 0 +GAMEPAD_AXIS_LEFT_Y c_uint :: 1 +GAMEPAD_AXIS_RIGHT_X c_uint :: 2 +GAMEPAD_AXIS_RIGHT_Y c_uint :: 3 +GAMEPAD_AXIS_LEFT_TRIGGER c_uint :: 4 +GAMEPAD_AXIS_RIGHT_TRIGGER c_uint :: 5 +MATERIAL_MAP_ALBEDO c_uint :: 0 +MATERIAL_MAP_METALNESS c_uint :: 1 +MATERIAL_MAP_NORMAL c_uint :: 2 +MATERIAL_MAP_ROUGHNESS c_uint :: 3 +MATERIAL_MAP_OCCLUSION c_uint :: 4 +MATERIAL_MAP_EMISSION c_uint :: 5 +MATERIAL_MAP_HEIGHT c_uint :: 6 +MATERIAL_MAP_CUBEMAP c_uint :: 7 +MATERIAL_MAP_IRRADIANCE c_uint :: 8 +MATERIAL_MAP_PREFILTER c_uint :: 9 +MATERIAL_MAP_BRDF c_uint :: 10 +SHADER_LOC_VERTEX_POSITION c_uint :: 0 +SHADER_LOC_VERTEX_TEXCOORD01 c_uint :: 1 +SHADER_LOC_VERTEX_TEXCOORD02 c_uint :: 2 +SHADER_LOC_VERTEX_NORMAL c_uint :: 3 +SHADER_LOC_VERTEX_TANGENT c_uint :: 4 +SHADER_LOC_VERTEX_COLOR c_uint :: 5 +SHADER_LOC_MATRIX_MVP c_uint :: 6 +SHADER_LOC_MATRIX_VIEW c_uint :: 7 +SHADER_LOC_MATRIX_PROJECTION c_uint :: 8 +SHADER_LOC_MATRIX_MODEL c_uint :: 9 +SHADER_LOC_MATRIX_NORMAL c_uint :: 10 +SHADER_LOC_VECTOR_VIEW c_uint :: 11 +SHADER_LOC_COLOR_DIFFUSE c_uint :: 12 +SHADER_LOC_COLOR_SPECULAR c_uint :: 13 +SHADER_LOC_COLOR_AMBIENT c_uint :: 14 +SHADER_LOC_MAP_ALBEDO c_uint :: 15 +SHADER_LOC_MAP_METALNESS c_uint :: 16 +SHADER_LOC_MAP_NORMAL c_uint :: 17 +SHADER_LOC_MAP_ROUGHNESS c_uint :: 18 +SHADER_LOC_MAP_OCCLUSION c_uint :: 19 +SHADER_LOC_MAP_EMISSION c_uint :: 20 +SHADER_LOC_MAP_HEIGHT c_uint :: 21 +SHADER_LOC_MAP_CUBEMAP c_uint :: 22 +SHADER_LOC_MAP_IRRADIANCE c_uint :: 23 +SHADER_LOC_MAP_PREFILTER c_uint :: 24 +SHADER_LOC_MAP_BRDF c_uint :: 25 +SHADER_LOC_VERTEX_BONEIDS c_uint :: 26 +SHADER_LOC_VERTEX_BONEWEIGHTS c_uint :: 27 +SHADER_LOC_BONE_MATRICES c_uint :: 28 +SHADER_UNIFORM_FLOAT c_uint :: 0 +SHADER_UNIFORM_VEC2 c_uint :: 1 +SHADER_UNIFORM_VEC3 c_uint :: 2 +SHADER_UNIFORM_VEC4 c_uint :: 3 +SHADER_UNIFORM_INT c_uint :: 4 +SHADER_UNIFORM_IVEC2 c_uint :: 5 +SHADER_UNIFORM_IVEC3 c_uint :: 6 +SHADER_UNIFORM_IVEC4 c_uint :: 7 +SHADER_UNIFORM_SAMPLER2D c_uint :: 8 +SHADER_ATTRIB_FLOAT c_uint :: 0 +SHADER_ATTRIB_VEC2 c_uint :: 1 +SHADER_ATTRIB_VEC3 c_uint :: 2 +SHADER_ATTRIB_VEC4 c_uint :: 3 +PIXELFORMAT_UNCOMPRESSED_GRAYSCALE c_uint :: 1 +PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA c_uint :: 2 +PIXELFORMAT_UNCOMPRESSED_R5G6B5 c_uint :: 3 +PIXELFORMAT_UNCOMPRESSED_R8G8B8 c_uint :: 4 +PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 c_uint :: 5 +PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 c_uint :: 6 +PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 c_uint :: 7 +PIXELFORMAT_UNCOMPRESSED_R32 c_uint :: 8 +PIXELFORMAT_UNCOMPRESSED_R32G32B32 c_uint :: 9 +PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 c_uint :: 10 +PIXELFORMAT_UNCOMPRESSED_R16 c_uint :: 11 +PIXELFORMAT_UNCOMPRESSED_R16G16B16 c_uint :: 12 +PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 c_uint :: 13 +PIXELFORMAT_COMPRESSED_DXT1_RGB c_uint :: 14 +PIXELFORMAT_COMPRESSED_DXT1_RGBA c_uint :: 15 +PIXELFORMAT_COMPRESSED_DXT3_RGBA c_uint :: 16 +PIXELFORMAT_COMPRESSED_DXT5_RGBA c_uint :: 17 +PIXELFORMAT_COMPRESSED_ETC1_RGB c_uint :: 18 +PIXELFORMAT_COMPRESSED_ETC2_RGB c_uint :: 19 +PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA c_uint :: 20 +PIXELFORMAT_COMPRESSED_PVRT_RGB c_uint :: 21 +PIXELFORMAT_COMPRESSED_PVRT_RGBA c_uint :: 22 +PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA c_uint :: 23 +PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA c_uint :: 24 +TEXTURE_FILTER_POINT c_uint :: 0 +TEXTURE_FILTER_BILINEAR c_uint :: 1 +TEXTURE_FILTER_TRILINEAR c_uint :: 2 +TEXTURE_FILTER_ANISOTROPIC_4X c_uint :: 3 +TEXTURE_FILTER_ANISOTROPIC_8X c_uint :: 4 +TEXTURE_FILTER_ANISOTROPIC_16X c_uint :: 5 +TEXTURE_WRAP_REPEAT c_uint :: 0 +TEXTURE_WRAP_CLAMP c_uint :: 1 +TEXTURE_WRAP_MIRROR_REPEAT c_uint :: 2 +TEXTURE_WRAP_MIRROR_CLAMP c_uint :: 3 +CUBEMAP_LAYOUT_AUTO_DETECT c_uint :: 0 +CUBEMAP_LAYOUT_LINE_VERTICAL c_uint :: 1 +CUBEMAP_LAYOUT_LINE_HORIZONTAL c_uint :: 2 +CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR c_uint :: 3 +CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE c_uint :: 4 +FONT_DEFAULT c_uint :: 0 +FONT_BITMAP c_uint :: 1 +FONT_SDF c_uint :: 2 +BLEND_ALPHA c_uint :: 0 +BLEND_ADDITIVE c_uint :: 1 +BLEND_MULTIPLIED c_uint :: 2 +BLEND_ADD_COLORS c_uint :: 3 +BLEND_SUBTRACT_COLORS c_uint :: 4 +BLEND_ALPHA_PREMULTIPLY c_uint :: 5 +BLEND_CUSTOM c_uint :: 6 +BLEND_CUSTOM_SEPARATE c_uint :: 7 +GESTURE_NONE c_uint :: 0 +GESTURE_TAP c_uint :: 1 +GESTURE_DOUBLETAP c_uint :: 2 +GESTURE_HOLD c_uint :: 4 +GESTURE_DRAG c_uint :: 8 +GESTURE_SWIPE_RIGHT c_uint :: 16 +GESTURE_SWIPE_LEFT c_uint :: 32 +GESTURE_SWIPE_UP c_uint :: 64 +GESTURE_SWIPE_DOWN c_uint :: 128 +GESTURE_PINCH_IN c_uint :: 256 +GESTURE_PINCH_OUT c_uint :: 512 +CAMERA_CUSTOM c_uint :: 0 +CAMERA_FREE c_uint :: 1 +CAMERA_ORBITAL c_uint :: 2 +CAMERA_FIRST_PERSON c_uint :: 3 +CAMERA_THIRD_PERSON c_uint :: 4 +CAMERA_PERSPECTIVE c_uint :: 0 +CAMERA_ORTHOGRAPHIC c_uint :: 1 +NPATCH_NINE_PATCH c_uint :: 0 +NPATCH_THREE_PATCH_VERTICAL c_uint :: 1 +NPATCH_THREE_PATCH_HORIZONTAL c_uint :: 2 + +InitWindow c_func(width c_int, height c_int, title ?*c_char) void +CloseWindow c_func() void +WindowShouldClose c_func() bool +IsWindowReady c_func() bool +IsWindowFullscreen c_func() bool +IsWindowHidden c_func() bool +IsWindowMinimized c_func() bool +IsWindowMaximized c_func() bool +IsWindowFocused c_func() bool +IsWindowResized c_func() bool +IsWindowState c_func(flag c_uint) bool +SetWindowState c_func(flags c_uint) void +ClearWindowState c_func(flags c_uint) void +ToggleFullscreen c_func() void +ToggleBorderlessWindowed c_func() void +MaximizeWindow c_func() void +MinimizeWindow c_func() void +RestoreWindow c_func() void +SetWindowIcon c_func(image Image) void +SetWindowIcons c_func(images ?*mut Image, count c_int) void +SetWindowTitle c_func(title ?*c_char) void +SetWindowPosition c_func(x c_int, y c_int) void +SetWindowMonitor c_func(monitor c_int) void +SetWindowMinSize c_func(width c_int, height c_int) void +SetWindowMaxSize c_func(width c_int, height c_int) void +SetWindowSize c_func(width c_int, height c_int) void +SetWindowOpacity c_func(opacity c_float) void +SetWindowFocused c_func() void +GetWindowHandle c_func() ?*mut void +GetScreenWidth c_func() c_int +GetScreenHeight c_func() c_int +GetRenderWidth c_func() c_int +GetRenderHeight c_func() c_int +GetMonitorCount c_func() c_int +GetCurrentMonitor c_func() c_int +GetMonitorPosition c_func(monitor c_int) Vector2 +GetMonitorWidth c_func(monitor c_int) c_int +GetMonitorHeight c_func(monitor c_int) c_int +GetMonitorPhysicalWidth c_func(monitor c_int) c_int +GetMonitorPhysicalHeight c_func(monitor c_int) c_int +GetMonitorRefreshRate c_func(monitor c_int) c_int +GetWindowPosition c_func() Vector2 +GetWindowScaleDPI c_func() Vector2 +GetMonitorName c_func(monitor c_int) ?*c_char +SetClipboardText c_func(text ?*c_char) void +GetClipboardText c_func() ?*c_char +GetClipboardImage c_func() Image +EnableEventWaiting c_func() void +DisableEventWaiting c_func() void +ShowCursor c_func() void +HideCursor c_func() void +IsCursorHidden c_func() bool +EnableCursor c_func() void +DisableCursor c_func() void +IsCursorOnScreen c_func() bool +ClearBackground c_func(color Color) void +BeginDrawing c_func() void +EndDrawing c_func() void +BeginMode2D c_func(camera Camera2D) void +EndMode2D c_func() void +BeginMode3D c_func(camera Camera3D) void +EndMode3D c_func() void +BeginTextureMode c_func(target RenderTexture) void +EndTextureMode c_func() void +BeginShaderMode c_func(shader Shader) void +EndShaderMode c_func() void +BeginBlendMode c_func(mode c_int) void +EndBlendMode c_func() void +BeginScissorMode c_func(x c_int, y c_int, width c_int, height c_int) void +EndScissorMode c_func() void +BeginVrStereoMode c_func(config VrStereoConfig) void +EndVrStereoMode c_func() void +LoadVrStereoConfig c_func(device VrDeviceInfo) VrStereoConfig +UnloadVrStereoConfig c_func(config VrStereoConfig) void +LoadShader c_func(vsFileName ?*c_char, fsFileName ?*c_char) Shader +LoadShaderFromMemory c_func(vsCode ?*c_char, fsCode ?*c_char) Shader +IsShaderValid c_func(shader Shader) bool +GetShaderLocation c_func(shader Shader, uniformName ?*c_char) c_int +GetShaderLocationAttrib c_func(shader Shader, attribName ?*c_char) c_int +SetShaderValue c_func(shader Shader, locIndex c_int, value ?*void, uniformType c_int) void +SetShaderValueV c_func(shader Shader, locIndex c_int, value ?*void, uniformType c_int, count c_int) void +SetShaderValueMatrix c_func(shader Shader, locIndex c_int, mat Matrix) void +SetShaderValueTexture c_func(shader Shader, locIndex c_int, texture Texture) void +UnloadShader c_func(shader Shader) void +GetScreenToWorldRay c_func(position Vector2, camera Camera3D) Ray +GetScreenToWorldRayEx c_func(position Vector2, camera Camera3D, width c_int, height c_int) Ray +GetWorldToScreen c_func(position Vector3, camera Camera3D) Vector2 +GetWorldToScreenEx c_func(position Vector3, camera Camera3D, width c_int, height c_int) Vector2 +GetWorldToScreen2D c_func(position Vector2, camera Camera2D) Vector2 +GetScreenToWorld2D c_func(position Vector2, camera Camera2D) Vector2 +GetCameraMatrix c_func(camera Camera3D) Matrix +GetCameraMatrix2D c_func(camera Camera2D) Matrix +SetTargetFPS c_func(fps c_int) void +GetFrameTime c_func() c_float +GetTime c_func() c_double +GetFPS c_func() c_int +SwapScreenBuffer c_func() void +PollInputEvents c_func() void +WaitTime c_func(seconds c_double) void +SetRandomSeed c_func(seed c_uint) void +GetRandomValue c_func(min c_int, max c_int) c_int +LoadRandomSequence c_func(count c_uint, min c_int, max c_int) ?*mut c_int +UnloadRandomSequence c_func(sequence ?*mut c_int) void +TakeScreenshot c_func(fileName ?*c_char) void +SetConfigFlags c_func(flags c_uint) void +OpenURL c_func(url ?*c_char) void +TraceLog c_func(logLevel c_int, text ?*c_char, ...) void +SetTraceLogLevel c_func(logLevel c_int) void +MemAlloc c_func(size c_uint) ?*mut void +MemRealloc c_func(ptr ?*mut void, size c_uint) ?*mut void +MemFree c_func(ptr ?*mut void) void +SetTraceLogCallback c_func(callback ?*c_func(_ c_int, _ ?*c_char, _ ?*mut c_char) void) void +SetLoadFileDataCallback c_func(callback ?*c_func(_ ?*c_char, _ ?*mut c_int) ?*mut c_uchar) void +SetSaveFileDataCallback c_func(callback ?*c_func(_ ?*c_char, _ ?*mut void, _ c_int) bool) void +SetLoadFileTextCallback c_func(callback ?*c_func(_ ?*c_char) ?*mut c_char) void +SetSaveFileTextCallback c_func(callback ?*c_func(_ ?*c_char, _ ?*mut c_char) bool) void +LoadFileData c_func(fileName ?*c_char, dataSize ?*mut c_int) ?*mut c_uchar +UnloadFileData c_func(data ?*mut c_uchar) void +SaveFileData c_func(fileName ?*c_char, data ?*mut void, dataSize c_int) bool +ExportDataAsCode c_func(data ?*c_uchar, dataSize c_int, fileName ?*c_char) bool +LoadFileText c_func(fileName ?*c_char) ?*mut c_char +UnloadFileText c_func(text ?*mut c_char) void +SaveFileText c_func(fileName ?*c_char, text ?*mut c_char) bool +FileExists c_func(fileName ?*c_char) bool +DirectoryExists c_func(dirPath ?*c_char) bool +IsFileExtension c_func(fileName ?*c_char, ext ?*c_char) bool +GetFileLength c_func(fileName ?*c_char) c_int +GetFileExtension c_func(fileName ?*c_char) ?*c_char +GetFileName c_func(filePath ?*c_char) ?*c_char +GetFileNameWithoutExt c_func(filePath ?*c_char) ?*c_char +GetDirectoryPath c_func(filePath ?*c_char) ?*c_char +GetPrevDirectoryPath c_func(dirPath ?*c_char) ?*c_char +GetWorkingDirectory c_func() ?*c_char +GetApplicationDirectory c_func() ?*c_char +MakeDirectory c_func(dirPath ?*c_char) c_int +ChangeDirectory c_func(dir ?*c_char) bool +IsPathFile c_func(path ?*c_char) bool +IsFileNameValid c_func(fileName ?*c_char) bool +LoadDirectoryFiles c_func(dirPath ?*c_char) FilePathList +LoadDirectoryFilesEx c_func(basePath ?*c_char, filter ?*c_char, scanSubdirs bool) FilePathList +UnloadDirectoryFiles c_func(files FilePathList) void +IsFileDropped c_func() bool +LoadDroppedFiles c_func() FilePathList +UnloadDroppedFiles c_func(files FilePathList) void +GetFileModTime c_func(fileName ?*c_char) c_long +CompressData c_func(data ?*c_uchar, dataSize c_int, compDataSize ?*mut c_int) ?*mut c_uchar +DecompressData c_func(compData ?*c_uchar, compDataSize c_int, dataSize ?*mut c_int) ?*mut c_uchar +EncodeDataBase64 c_func(data ?*c_uchar, dataSize c_int, outputSize ?*mut c_int) ?*mut c_char +DecodeDataBase64 c_func(data ?*c_uchar, outputSize ?*mut c_int) ?*mut c_uchar +ComputeCRC32 c_func(data ?*mut c_uchar, dataSize c_int) c_uint +ComputeMD5 c_func(data ?*mut c_uchar, dataSize c_int) ?*mut c_uint +ComputeSHA1 c_func(data ?*mut c_uchar, dataSize c_int) ?*mut c_uint +LoadAutomationEventList c_func(fileName ?*c_char) AutomationEventList +UnloadAutomationEventList c_func(list AutomationEventList) void +ExportAutomationEventList c_func(list AutomationEventList, fileName ?*c_char) bool +SetAutomationEventList c_func(list ?*mut AutomationEventList) void +SetAutomationEventBaseFrame c_func(frame c_int) void +StartAutomationEventRecording c_func() void +StopAutomationEventRecording c_func() void +PlayAutomationEvent c_func(event AutomationEvent) void +IsKeyPressed c_func(key c_int) bool +IsKeyPressedRepeat c_func(key c_int) bool +IsKeyDown c_func(key c_int) bool +IsKeyReleased c_func(key c_int) bool +IsKeyUp c_func(key c_int) bool +GetKeyPressed c_func() c_int +GetCharPressed c_func() c_int +SetExitKey c_func(key c_int) void +IsGamepadAvailable c_func(gamepad c_int) bool +GetGamepadName c_func(gamepad c_int) ?*c_char +IsGamepadButtonPressed c_func(gamepad c_int, button c_int) bool +IsGamepadButtonDown c_func(gamepad c_int, button c_int) bool +IsGamepadButtonReleased c_func(gamepad c_int, button c_int) bool +IsGamepadButtonUp c_func(gamepad c_int, button c_int) bool +GetGamepadButtonPressed c_func() c_int +GetGamepadAxisCount c_func(gamepad c_int) c_int +GetGamepadAxisMovement c_func(gamepad c_int, axis c_int) c_float +SetGamepadMappings c_func(mappings ?*c_char) c_int +SetGamepadVibration c_func(gamepad c_int, leftMotor c_float, rightMotor c_float, duration c_float) void +IsMouseButtonPressed c_func(button c_int) bool +IsMouseButtonDown c_func(button c_int) bool +IsMouseButtonReleased c_func(button c_int) bool +IsMouseButtonUp c_func(button c_int) bool +GetMouseX c_func() c_int +GetMouseY c_func() c_int +GetMousePosition c_func() Vector2 +GetMouseDelta c_func() Vector2 +SetMousePosition c_func(x c_int, y c_int) void +SetMouseOffset c_func(offsetX c_int, offsetY c_int) void +SetMouseScale c_func(scaleX c_float, scaleY c_float) void +GetMouseWheelMove c_func() c_float +GetMouseWheelMoveV c_func() Vector2 +SetMouseCursor c_func(cursor c_int) void +GetTouchX c_func() c_int +GetTouchY c_func() c_int +GetTouchPosition c_func(index c_int) Vector2 +GetTouchPointId c_func(index c_int) c_int +GetTouchPointCount c_func() c_int +SetGesturesEnabled c_func(flags c_uint) void +IsGestureDetected c_func(gesture c_uint) bool +GetGestureDetected c_func() c_int +GetGestureHoldDuration c_func() c_float +GetGestureDragVector c_func() Vector2 +GetGestureDragAngle c_func() c_float +GetGesturePinchVector c_func() Vector2 +GetGesturePinchAngle c_func() c_float +UpdateCamera c_func(camera ?*mut Camera3D, mode c_int) void +UpdateCameraPro c_func(camera ?*mut Camera3D, movement Vector3, rotation Vector3, zoom c_float) void +SetShapesTexture c_func(texture Texture, source Rectangle) void +GetShapesTexture c_func() Texture +GetShapesTextureRectangle c_func() Rectangle +DrawPixel c_func(posX c_int, posY c_int, color Color) void +DrawPixelV c_func(position Vector2, color Color) void +DrawLine c_func(startPosX c_int, startPosY c_int, endPosX c_int, endPosY c_int, color Color) void +DrawLineV c_func(startPos Vector2, endPos Vector2, color Color) void +DrawLineEx c_func(startPos Vector2, endPos Vector2, thick c_float, color Color) void +DrawLineStrip c_func(points ?*Vector2, pointCount c_int, color Color) void +DrawLineBezier c_func(startPos Vector2, endPos Vector2, thick c_float, color Color) void +DrawCircle c_func(centerX c_int, centerY c_int, radius c_float, color Color) void +DrawCircleSector c_func(center Vector2, radius c_float, startAngle c_float, endAngle c_float, segments c_int, color Color) void +DrawCircleSectorLines c_func(center Vector2, radius c_float, startAngle c_float, endAngle c_float, segments c_int, color Color) void +DrawCircleGradient c_func(centerX c_int, centerY c_int, radius c_float, inner Color, outer Color) void +DrawCircleV c_func(center Vector2, radius c_float, color Color) void +DrawCircleLines c_func(centerX c_int, centerY c_int, radius c_float, color Color) void +DrawCircleLinesV c_func(center Vector2, radius c_float, color Color) void +DrawEllipse c_func(centerX c_int, centerY c_int, radiusH c_float, radiusV c_float, color Color) void +DrawEllipseLines c_func(centerX c_int, centerY c_int, radiusH c_float, radiusV c_float, color Color) void +DrawRing c_func(center Vector2, innerRadius c_float, outerRadius c_float, startAngle c_float, endAngle c_float, segments c_int, color Color) void +DrawRingLines c_func(center Vector2, innerRadius c_float, outerRadius c_float, startAngle c_float, endAngle c_float, segments c_int, color Color) void +DrawRectangle c_func(posX c_int, posY c_int, width c_int, height c_int, color Color) void +DrawRectangleV c_func(position Vector2, size Vector2, color Color) void +DrawRectangleRec c_func(rec Rectangle, color Color) void +DrawRectanglePro c_func(rec Rectangle, origin Vector2, rotation c_float, color Color) void +DrawRectangleGradientV c_func(posX c_int, posY c_int, width c_int, height c_int, top Color, bottom Color) void +DrawRectangleGradientH c_func(posX c_int, posY c_int, width c_int, height c_int, left Color, right Color) void +DrawRectangleGradientEx c_func(rec Rectangle, topLeft Color, bottomLeft Color, topRight Color, bottomRight Color) void +DrawRectangleLines c_func(posX c_int, posY c_int, width c_int, height c_int, color Color) void +DrawRectangleLinesEx c_func(rec Rectangle, lineThick c_float, color Color) void +DrawRectangleRounded c_func(rec Rectangle, roundness c_float, segments c_int, color Color) void +DrawRectangleRoundedLines c_func(rec Rectangle, roundness c_float, segments c_int, color Color) void +DrawRectangleRoundedLinesEx c_func(rec Rectangle, roundness c_float, segments c_int, lineThick c_float, color Color) void +DrawTriangle c_func(v1 Vector2, v2 Vector2, v3 Vector2, color Color) void +DrawTriangleLines c_func(v1 Vector2, v2 Vector2, v3 Vector2, color Color) void +DrawTriangleFan c_func(points ?*Vector2, pointCount c_int, color Color) void +DrawTriangleStrip c_func(points ?*Vector2, pointCount c_int, color Color) void +DrawPoly c_func(center Vector2, sides c_int, radius c_float, rotation c_float, color Color) void +DrawPolyLines c_func(center Vector2, sides c_int, radius c_float, rotation c_float, color Color) void +DrawPolyLinesEx c_func(center Vector2, sides c_int, radius c_float, rotation c_float, lineThick c_float, color Color) void +DrawSplineLinear c_func(points ?*Vector2, pointCount c_int, thick c_float, color Color) void +DrawSplineBasis c_func(points ?*Vector2, pointCount c_int, thick c_float, color Color) void +DrawSplineCatmullRom c_func(points ?*Vector2, pointCount c_int, thick c_float, color Color) void +DrawSplineBezierQuadratic c_func(points ?*Vector2, pointCount c_int, thick c_float, color Color) void +DrawSplineBezierCubic c_func(points ?*Vector2, pointCount c_int, thick c_float, color Color) void +DrawSplineSegmentLinear c_func(p1 Vector2, p2 Vector2, thick c_float, color Color) void +DrawSplineSegmentBasis c_func(p1 Vector2, p2 Vector2, p3 Vector2, p4 Vector2, thick c_float, color Color) void +DrawSplineSegmentCatmullRom c_func(p1 Vector2, p2 Vector2, p3 Vector2, p4 Vector2, thick c_float, color Color) void +DrawSplineSegmentBezierQuadratic c_func(p1 Vector2, c2 Vector2, p3 Vector2, thick c_float, color Color) void +DrawSplineSegmentBezierCubic c_func(p1 Vector2, c2 Vector2, c3 Vector2, p4 Vector2, thick c_float, color Color) void +GetSplinePointLinear c_func(startPos Vector2, endPos Vector2, t c_float) Vector2 +GetSplinePointBasis c_func(p1 Vector2, p2 Vector2, p3 Vector2, p4 Vector2, t c_float) Vector2 +GetSplinePointCatmullRom c_func(p1 Vector2, p2 Vector2, p3 Vector2, p4 Vector2, t c_float) Vector2 +GetSplinePointBezierQuad c_func(p1 Vector2, c2 Vector2, p3 Vector2, t c_float) Vector2 +GetSplinePointBezierCubic c_func(p1 Vector2, c2 Vector2, c3 Vector2, p4 Vector2, t c_float) Vector2 +CheckCollisionRecs c_func(rec1 Rectangle, rec2 Rectangle) bool +CheckCollisionCircles c_func(center1 Vector2, radius1 c_float, center2 Vector2, radius2 c_float) bool +CheckCollisionCircleRec c_func(center Vector2, radius c_float, rec Rectangle) bool +CheckCollisionCircleLine c_func(center Vector2, radius c_float, p1 Vector2, p2 Vector2) bool +CheckCollisionPointRec c_func(point Vector2, rec Rectangle) bool +CheckCollisionPointCircle c_func(point Vector2, center Vector2, radius c_float) bool +CheckCollisionPointTriangle c_func(point Vector2, p1 Vector2, p2 Vector2, p3 Vector2) bool +CheckCollisionPointLine c_func(point Vector2, p1 Vector2, p2 Vector2, threshold c_int) bool +CheckCollisionPointPoly c_func(point Vector2, points ?*Vector2, pointCount c_int) bool +CheckCollisionLines c_func(startPos1 Vector2, endPos1 Vector2, startPos2 Vector2, endPos2 Vector2, collisionPoint ?*mut Vector2) bool +GetCollisionRec c_func(rec1 Rectangle, rec2 Rectangle) Rectangle +LoadImage c_func(fileName ?*c_char) Image +LoadImageRaw c_func(fileName ?*c_char, width c_int, height c_int, format c_int, headerSize c_int) Image +LoadImageAnim c_func(fileName ?*c_char, frames ?*mut c_int) Image +LoadImageAnimFromMemory c_func(fileType ?*c_char, fileData ?*c_uchar, dataSize c_int, frames ?*mut c_int) Image +LoadImageFromMemory c_func(fileType ?*c_char, fileData ?*c_uchar, dataSize c_int) Image +LoadImageFromTexture c_func(texture Texture) Image +LoadImageFromScreen c_func() Image +IsImageValid c_func(image Image) bool +UnloadImage c_func(image Image) void +ExportImage c_func(image Image, fileName ?*c_char) bool +ExportImageToMemory c_func(image Image, fileType ?*c_char, fileSize ?*mut c_int) ?*mut c_uchar +ExportImageAsCode c_func(image Image, fileName ?*c_char) bool +GenImageColor c_func(width c_int, height c_int, color Color) Image +GenImageGradientLinear c_func(width c_int, height c_int, direction c_int, start Color, end Color) Image +GenImageGradientRadial c_func(width c_int, height c_int, density c_float, inner Color, outer Color) Image +GenImageGradientSquare c_func(width c_int, height c_int, density c_float, inner Color, outer Color) Image +GenImageChecked c_func(width c_int, height c_int, checksX c_int, checksY c_int, col1 Color, col2 Color) Image +GenImageWhiteNoise c_func(width c_int, height c_int, factor c_float) Image +GenImagePerlinNoise c_func(width c_int, height c_int, offsetX c_int, offsetY c_int, scale c_float) Image +GenImageCellular c_func(width c_int, height c_int, tileSize c_int) Image +GenImageText c_func(width c_int, height c_int, text ?*c_char) Image +ImageCopy c_func(image Image) Image +ImageFromImage c_func(image Image, rec Rectangle) Image +ImageFromChannel c_func(image Image, selectedChannel c_int) Image +ImageText c_func(text ?*c_char, fontSize c_int, color Color) Image +ImageTextEx c_func(font Font, text ?*c_char, fontSize c_float, spacing c_float, tint Color) Image +ImageFormat c_func(image ?*mut Image, newFormat c_int) void +ImageToPOT c_func(image ?*mut Image, fill Color) void +ImageCrop c_func(image ?*mut Image, crop Rectangle) void +ImageAlphaCrop c_func(image ?*mut Image, threshold c_float) void +ImageAlphaClear c_func(image ?*mut Image, color Color, threshold c_float) void +ImageAlphaMask c_func(image ?*mut Image, alphaMask Image) void +ImageAlphaPremultiply c_func(image ?*mut Image) void +ImageBlurGaussian c_func(image ?*mut Image, blurSize c_int) void +ImageKernelConvolution c_func(image ?*mut Image, kernel ?*c_float, kernelSize c_int) void +ImageResize c_func(image ?*mut Image, newWidth c_int, newHeight c_int) void +ImageResizeNN c_func(image ?*mut Image, newWidth c_int, newHeight c_int) void +ImageResizeCanvas c_func(image ?*mut Image, newWidth c_int, newHeight c_int, offsetX c_int, offsetY c_int, fill Color) void +ImageMipmaps c_func(image ?*mut Image) void +ImageDither c_func(image ?*mut Image, rBpp c_int, gBpp c_int, bBpp c_int, aBpp c_int) void +ImageFlipVertical c_func(image ?*mut Image) void +ImageFlipHorizontal c_func(image ?*mut Image) void +ImageRotate c_func(image ?*mut Image, degrees c_int) void +ImageRotateCW c_func(image ?*mut Image) void +ImageRotateCCW c_func(image ?*mut Image) void +ImageColorTint c_func(image ?*mut Image, color Color) void +ImageColorInvert c_func(image ?*mut Image) void +ImageColorGrayscale c_func(image ?*mut Image) void +ImageColorContrast c_func(image ?*mut Image, contrast c_float) void +ImageColorBrightness c_func(image ?*mut Image, brightness c_int) void +ImageColorReplace c_func(image ?*mut Image, color Color, replace Color) void +LoadImageColors c_func(image Image) ?*mut Color +LoadImagePalette c_func(image Image, maxPaletteSize c_int, colorCount ?*mut c_int) ?*mut Color +UnloadImageColors c_func(colors ?*mut Color) void +UnloadImagePalette c_func(colors ?*mut Color) void +GetImageAlphaBorder c_func(image Image, threshold c_float) Rectangle +GetImageColor c_func(image Image, x c_int, y c_int) Color +ImageClearBackground c_func(dst ?*mut Image, color Color) void +ImageDrawPixel c_func(dst ?*mut Image, posX c_int, posY c_int, color Color) void +ImageDrawPixelV c_func(dst ?*mut Image, position Vector2, color Color) void +ImageDrawLine c_func(dst ?*mut Image, startPosX c_int, startPosY c_int, endPosX c_int, endPosY c_int, color Color) void +ImageDrawLineV c_func(dst ?*mut Image, start Vector2, end Vector2, color Color) void +ImageDrawLineEx c_func(dst ?*mut Image, start Vector2, end Vector2, thick c_int, color Color) void +ImageDrawCircle c_func(dst ?*mut Image, centerX c_int, centerY c_int, radius c_int, color Color) void +ImageDrawCircleV c_func(dst ?*mut Image, center Vector2, radius c_int, color Color) void +ImageDrawCircleLines c_func(dst ?*mut Image, centerX c_int, centerY c_int, radius c_int, color Color) void +ImageDrawCircleLinesV c_func(dst ?*mut Image, center Vector2, radius c_int, color Color) void +ImageDrawRectangle c_func(dst ?*mut Image, posX c_int, posY c_int, width c_int, height c_int, color Color) void +ImageDrawRectangleV c_func(dst ?*mut Image, position Vector2, size Vector2, color Color) void +ImageDrawRectangleRec c_func(dst ?*mut Image, rec Rectangle, color Color) void +ImageDrawRectangleLines c_func(dst ?*mut Image, rec Rectangle, thick c_int, color Color) void +ImageDrawTriangle c_func(dst ?*mut Image, v1 Vector2, v2 Vector2, v3 Vector2, color Color) void +ImageDrawTriangleEx c_func(dst ?*mut Image, v1 Vector2, v2 Vector2, v3 Vector2, c1 Color, c2 Color, c3 Color) void +ImageDrawTriangleLines c_func(dst ?*mut Image, v1 Vector2, v2 Vector2, v3 Vector2, color Color) void +ImageDrawTriangleFan c_func(dst ?*mut Image, points ?*mut Vector2, pointCount c_int, color Color) void +ImageDrawTriangleStrip c_func(dst ?*mut Image, points ?*mut Vector2, pointCount c_int, color Color) void +ImageDraw c_func(dst ?*mut Image, src Image, srcRec Rectangle, dstRec Rectangle, tint Color) void +ImageDrawText c_func(dst ?*mut Image, text ?*c_char, posX c_int, posY c_int, fontSize c_int, color Color) void +ImageDrawTextEx c_func(dst ?*mut Image, font Font, text ?*c_char, position Vector2, fontSize c_float, spacing c_float, tint Color) void +LoadTexture c_func(fileName ?*c_char) Texture +LoadTextureFromImage c_func(image Image) Texture +LoadTextureCubemap c_func(image Image, layout c_int) Texture +LoadRenderTexture c_func(width c_int, height c_int) RenderTexture +IsTextureValid c_func(texture Texture) bool +UnloadTexture c_func(texture Texture) void +IsRenderTextureValid c_func(target RenderTexture) bool +UnloadRenderTexture c_func(target RenderTexture) void +UpdateTexture c_func(texture Texture, pixels ?*void) void +UpdateTextureRec c_func(texture Texture, rec Rectangle, pixels ?*void) void +GenTextureMipmaps c_func(texture ?*mut Texture) void +SetTextureFilter c_func(texture Texture, filter c_int) void +SetTextureWrap c_func(texture Texture, wrap c_int) void +DrawTexture c_func(texture Texture, posX c_int, posY c_int, tint Color) void +DrawTextureV c_func(texture Texture, position Vector2, tint Color) void +DrawTextureEx c_func(texture Texture, position Vector2, rotation c_float, scale c_float, tint Color) void +DrawTextureRec c_func(texture Texture, source Rectangle, position Vector2, tint Color) void +DrawTexturePro c_func(texture Texture, source Rectangle, dest Rectangle, origin Vector2, rotation c_float, tint Color) void +DrawTextureNPatch c_func(texture Texture, nPatchInfo NPatchInfo, dest Rectangle, origin Vector2, rotation c_float, tint Color) void +ColorIsEqual c_func(col1 Color, col2 Color) bool +Fade c_func(color Color, alpha c_float) Color +ColorToInt c_func(color Color) c_int +ColorNormalize c_func(color Color) Vector4 +ColorFromNormalized c_func(normalized Vector4) Color +ColorToHSV c_func(color Color) Vector3 +ColorFromHSV c_func(hue c_float, saturation c_float, value c_float) Color +ColorTint c_func(color Color, tint Color) Color +ColorBrightness c_func(color Color, factor c_float) Color +ColorContrast c_func(color Color, contrast c_float) Color +ColorAlpha c_func(color Color, alpha c_float) Color +ColorAlphaBlend c_func(dst Color, src Color, tint Color) Color +ColorLerp c_func(color1 Color, color2 Color, factor c_float) Color +GetColor c_func(hexValue c_uint) Color +GetPixelColor c_func(srcPtr ?*mut void, format c_int) Color +SetPixelColor c_func(dstPtr ?*mut void, color Color, format c_int) void +GetPixelDataSize c_func(width c_int, height c_int, format c_int) c_int +GetFontDefault c_func() Font +LoadFont c_func(fileName ?*c_char) Font +LoadFontEx c_func(fileName ?*c_char, fontSize c_int, codepoints ?*mut c_int, codepointCount c_int) Font +LoadFontFromImage c_func(image Image, key Color, firstChar c_int) Font +LoadFontFromMemory c_func(fileType ?*c_char, fileData ?*c_uchar, dataSize c_int, fontSize c_int, codepoints ?*mut c_int, codepointCount c_int) Font +IsFontValid c_func(font Font) bool +LoadFontData c_func(fileData ?*c_uchar, dataSize c_int, fontSize c_int, codepoints ?*mut c_int, codepointCount c_int, type c_int) ?*mut GlyphInfo +GenImageFontAtlas c_func(glyphs ?*GlyphInfo, glyphRecs ?*mut ?*mut Rectangle, glyphCount c_int, fontSize c_int, padding c_int, packMethod c_int) Image +UnloadFontData c_func(glyphs ?*mut GlyphInfo, glyphCount c_int) void +UnloadFont c_func(font Font) void +ExportFontAsCode c_func(font Font, fileName ?*c_char) bool +DrawFPS c_func(posX c_int, posY c_int) void +DrawText c_func(text ?*c_char, posX c_int, posY c_int, fontSize c_int, color Color) void +DrawTextEx c_func(font Font, text ?*c_char, position Vector2, fontSize c_float, spacing c_float, tint Color) void +DrawTextPro c_func(font Font, text ?*c_char, position Vector2, origin Vector2, rotation c_float, fontSize c_float, spacing c_float, tint Color) void +DrawTextCodepoint c_func(font Font, codepoint c_int, position Vector2, fontSize c_float, tint Color) void +DrawTextCodepoints c_func(font Font, codepoints ?*c_int, codepointCount c_int, position Vector2, fontSize c_float, spacing c_float, tint Color) void +SetTextLineSpacing c_func(spacing c_int) void +MeasureText c_func(text ?*c_char, fontSize c_int) c_int +MeasureTextEx c_func(font Font, text ?*c_char, fontSize c_float, spacing c_float) Vector2 +GetGlyphIndex c_func(font Font, codepoint c_int) c_int +GetGlyphInfo c_func(font Font, codepoint c_int) GlyphInfo +GetGlyphAtlasRec c_func(font Font, codepoint c_int) Rectangle +LoadUTF8 c_func(codepoints ?*c_int, length c_int) ?*mut c_char +UnloadUTF8 c_func(text ?*mut c_char) void +LoadCodepoints c_func(text ?*c_char, count ?*mut c_int) ?*mut c_int +UnloadCodepoints c_func(codepoints ?*mut c_int) void +GetCodepointCount c_func(text ?*c_char) c_int +GetCodepoint c_func(text ?*c_char, codepointSize ?*mut c_int) c_int +GetCodepointNext c_func(text ?*c_char, codepointSize ?*mut c_int) c_int +GetCodepointPrevious c_func(text ?*c_char, codepointSize ?*mut c_int) c_int +CodepointToUTF8 c_func(codepoint c_int, utf8Size ?*mut c_int) ?*c_char +TextCopy c_func(dst ?*mut c_char, src ?*c_char) c_int +TextIsEqual c_func(text1 ?*c_char, text2 ?*c_char) bool +TextLength c_func(text ?*c_char) c_uint +TextFormat c_func(text ?*c_char, ...) ?*c_char +TextSubtext c_func(text ?*c_char, position c_int, length c_int) ?*c_char +TextReplace c_func(text ?*c_char, replace ?*c_char, by ?*c_char) ?*mut c_char +TextInsert c_func(text ?*c_char, insert ?*c_char, position c_int) ?*mut c_char +TextJoin c_func(textList ?*mut ?*c_char, count c_int, delimiter ?*c_char) ?*c_char +TextSplit c_func(text ?*c_char, delimiter c_char, count ?*mut c_int) ?*mut ?*c_char +TextAppend c_func(text ?*mut c_char, append ?*c_char, position ?*mut c_int) void +TextFindIndex c_func(text ?*c_char, find ?*c_char) c_int +TextToUpper c_func(text ?*c_char) ?*c_char +TextToLower c_func(text ?*c_char) ?*c_char +TextToPascal c_func(text ?*c_char) ?*c_char +TextToSnake c_func(text ?*c_char) ?*c_char +TextToCamel c_func(text ?*c_char) ?*c_char +TextToInteger c_func(text ?*c_char) c_int +TextToFloat c_func(text ?*c_char) c_float +DrawLine3D c_func(startPos Vector3, endPos Vector3, color Color) void +DrawPoint3D c_func(position Vector3, color Color) void +DrawCircle3D c_func(center Vector3, radius c_float, rotationAxis Vector3, rotationAngle c_float, color Color) void +DrawTriangle3D c_func(v1 Vector3, v2 Vector3, v3 Vector3, color Color) void +DrawTriangleStrip3D c_func(points ?*Vector3, pointCount c_int, color Color) void +DrawCube c_func(position Vector3, width c_float, height c_float, length c_float, color Color) void +DrawCubeV c_func(position Vector3, size Vector3, color Color) void +DrawCubeWires c_func(position Vector3, width c_float, height c_float, length c_float, color Color) void +DrawCubeWiresV c_func(position Vector3, size Vector3, color Color) void +DrawSphere c_func(centerPos Vector3, radius c_float, color Color) void +DrawSphereEx c_func(centerPos Vector3, radius c_float, rings c_int, slices c_int, color Color) void +DrawSphereWires c_func(centerPos Vector3, radius c_float, rings c_int, slices c_int, color Color) void +DrawCylinder c_func(position Vector3, radiusTop c_float, radiusBottom c_float, height c_float, slices c_int, color Color) void +DrawCylinderEx c_func(startPos Vector3, endPos Vector3, startRadius c_float, endRadius c_float, sides c_int, color Color) void +DrawCylinderWires c_func(position Vector3, radiusTop c_float, radiusBottom c_float, height c_float, slices c_int, color Color) void +DrawCylinderWiresEx c_func(startPos Vector3, endPos Vector3, startRadius c_float, endRadius c_float, sides c_int, color Color) void +DrawCapsule c_func(startPos Vector3, endPos Vector3, radius c_float, slices c_int, rings c_int, color Color) void +DrawCapsuleWires c_func(startPos Vector3, endPos Vector3, radius c_float, slices c_int, rings c_int, color Color) void +DrawPlane c_func(centerPos Vector3, size Vector2, color Color) void +DrawRay c_func(ray Ray, color Color) void +DrawGrid c_func(slices c_int, spacing c_float) void +LoadModel c_func(fileName ?*c_char) Model +LoadModelFromMesh c_func(mesh Mesh) Model +IsModelValid c_func(model Model) bool +UnloadModel c_func(model Model) void +GetModelBoundingBox c_func(model Model) BoundingBox +DrawModel c_func(model Model, position Vector3, scale c_float, tint Color) void +DrawModelEx c_func(model Model, position Vector3, rotationAxis Vector3, rotationAngle c_float, scale Vector3, tint Color) void +DrawModelWires c_func(model Model, position Vector3, scale c_float, tint Color) void +DrawModelWiresEx c_func(model Model, position Vector3, rotationAxis Vector3, rotationAngle c_float, scale Vector3, tint Color) void +DrawModelPoints c_func(model Model, position Vector3, scale c_float, tint Color) void +DrawModelPointsEx c_func(model Model, position Vector3, rotationAxis Vector3, rotationAngle c_float, scale Vector3, tint Color) void +DrawBoundingBox c_func(box BoundingBox, color Color) void +DrawBillboard c_func(camera Camera3D, texture Texture, position Vector3, scale c_float, tint Color) void +DrawBillboardRec c_func(camera Camera3D, texture Texture, source Rectangle, position Vector3, size Vector2, tint Color) void +DrawBillboardPro c_func(camera Camera3D, texture Texture, source Rectangle, position Vector3, up Vector3, size Vector2, origin Vector2, rotation c_float, tint Color) void +UploadMesh c_func(mesh ?*mut Mesh, dynamic bool) void +UpdateMeshBuffer c_func(mesh Mesh, index c_int, data ?*void, dataSize c_int, offset c_int) void +UnloadMesh c_func(mesh Mesh) void +DrawMesh c_func(mesh Mesh, material Material, transform Matrix) void +DrawMeshInstanced c_func(mesh Mesh, material Material, transforms ?*Matrix, instances c_int) void +GetMeshBoundingBox c_func(mesh Mesh) BoundingBox +GenMeshTangents c_func(mesh ?*mut Mesh) void +ExportMesh c_func(mesh Mesh, fileName ?*c_char) bool +ExportMeshAsCode c_func(mesh Mesh, fileName ?*c_char) bool +GenMeshPoly c_func(sides c_int, radius c_float) Mesh +GenMeshPlane c_func(width c_float, length c_float, resX c_int, resZ c_int) Mesh +GenMeshCube c_func(width c_float, height c_float, length c_float) Mesh +GenMeshSphere c_func(radius c_float, rings c_int, slices c_int) Mesh +GenMeshHemiSphere c_func(radius c_float, rings c_int, slices c_int) Mesh +GenMeshCylinder c_func(radius c_float, height c_float, slices c_int) Mesh +GenMeshCone c_func(radius c_float, height c_float, slices c_int) Mesh +GenMeshTorus c_func(radius c_float, size c_float, radSeg c_int, sides c_int) Mesh +GenMeshKnot c_func(radius c_float, size c_float, radSeg c_int, sides c_int) Mesh +GenMeshHeightmap c_func(heightmap Image, size Vector3) Mesh +GenMeshCubicmap c_func(cubicmap Image, cubeSize Vector3) Mesh +LoadMaterials c_func(fileName ?*c_char, materialCount ?*mut c_int) ?*mut Material +LoadMaterialDefault c_func() Material +IsMaterialValid c_func(material Material) bool +UnloadMaterial c_func(material Material) void +SetMaterialTexture c_func(material ?*mut Material, mapType c_int, texture Texture) void +SetModelMeshMaterial c_func(model ?*mut Model, meshId c_int, materialId c_int) void +LoadModelAnimations c_func(fileName ?*c_char, animCount ?*mut c_int) ?*mut ModelAnimation +UpdateModelAnimation c_func(model Model, anim ModelAnimation, frame c_int) void +UpdateModelAnimationBones c_func(model Model, anim ModelAnimation, frame c_int) void +UnloadModelAnimation c_func(anim ModelAnimation) void +UnloadModelAnimations c_func(animations ?*mut ModelAnimation, animCount c_int) void +IsModelAnimationValid c_func(model Model, anim ModelAnimation) bool +CheckCollisionSpheres c_func(center1 Vector3, radius1 c_float, center2 Vector3, radius2 c_float) bool +CheckCollisionBoxes c_func(box1 BoundingBox, box2 BoundingBox) bool +CheckCollisionBoxSphere c_func(box BoundingBox, center Vector3, radius c_float) bool +GetRayCollisionSphere c_func(ray Ray, center Vector3, radius c_float) RayCollision +GetRayCollisionBox c_func(ray Ray, box BoundingBox) RayCollision +GetRayCollisionMesh c_func(ray Ray, mesh Mesh, transform Matrix) RayCollision +GetRayCollisionTriangle c_func(ray Ray, p1 Vector3, p2 Vector3, p3 Vector3) RayCollision +GetRayCollisionQuad c_func(ray Ray, p1 Vector3, p2 Vector3, p3 Vector3, p4 Vector3) RayCollision +InitAudioDevice c_func() void +CloseAudioDevice c_func() void +IsAudioDeviceReady c_func() bool +SetMasterVolume c_func(volume c_float) void +GetMasterVolume c_func() c_float +LoadWave c_func(fileName ?*c_char) Wave +LoadWaveFromMemory c_func(fileType ?*c_char, fileData ?*c_uchar, dataSize c_int) Wave +IsWaveValid c_func(wave Wave) bool +LoadSound c_func(fileName ?*c_char) Sound +LoadSoundFromWave c_func(wave Wave) Sound +LoadSoundAlias c_func(source Sound) Sound +IsSoundValid c_func(sound Sound) bool +UpdateSound c_func(sound Sound, data ?*void, sampleCount c_int) void +UnloadWave c_func(wave Wave) void +UnloadSound c_func(sound Sound) void +UnloadSoundAlias c_func(_ Sound) void +ExportWave c_func(wave Wave, fileName ?*c_char) bool +ExportWaveAsCode c_func(wave Wave, fileName ?*c_char) bool +PlaySound c_func(sound Sound) void +StopSound c_func(sound Sound) void +PauseSound c_func(sound Sound) void +ResumeSound c_func(sound Sound) void +IsSoundPlaying c_func(sound Sound) bool +SetSoundVolume c_func(sound Sound, volume c_float) void +SetSoundPitch c_func(sound Sound, pitch c_float) void +SetSoundPan c_func(sound Sound, pan c_float) void +WaveCopy c_func(wave Wave) Wave +WaveCrop c_func(wave ?*mut Wave, initFrame c_int, finalFrame c_int) void +WaveFormat c_func(wave ?*mut Wave, sampleRate c_int, sampleSize c_int, channels c_int) void +LoadWaveSamples c_func(wave Wave) ?*mut c_float +UnloadWaveSamples c_func(samples ?*mut c_float) void +LoadMusicStream c_func(fileName ?*c_char) Music +LoadMusicStreamFromMemory c_func(fileType ?*c_char, data ?*c_uchar, dataSize c_int) Music +IsMusicValid c_func(music Music) bool +UnloadMusicStream c_func(music Music) void +PlayMusicStream c_func(music Music) void +IsMusicStreamPlaying c_func(music Music) bool +UpdateMusicStream c_func(music Music) void +StopMusicStream c_func(music Music) void +PauseMusicStream c_func(music Music) void +ResumeMusicStream c_func(music Music) void +SeekMusicStream c_func(music Music, position c_float) void +SetMusicVolume c_func(music Music, volume c_float) void +SetMusicPitch c_func(music Music, pitch c_float) void +SetMusicPan c_func(music Music, pan c_float) void +GetMusicTimeLength c_func(music Music) c_float +GetMusicTimePlayed c_func(music Music) c_float +LoadAudioStream c_func(sampleRate c_uint, sampleSize c_uint, channels c_uint) AudioStream +IsAudioStreamValid c_func(stream AudioStream) bool +UnloadAudioStream c_func(stream AudioStream) void +UpdateAudioStream c_func(stream AudioStream, data ?*void, frameCount c_int) void +IsAudioStreamProcessed c_func(stream AudioStream) bool +PlayAudioStream c_func(stream AudioStream) void +PauseAudioStream c_func(stream AudioStream) void +ResumeAudioStream c_func(stream AudioStream) void +IsAudioStreamPlaying c_func(stream AudioStream) bool +StopAudioStream c_func(stream AudioStream) void +SetAudioStreamVolume c_func(stream AudioStream, volume c_float) void +SetAudioStreamPitch c_func(stream AudioStream, pitch c_float) void +SetAudioStreamPan c_func(stream AudioStream, pan c_float) void +SetAudioStreamBufferSizeDefault c_func(size c_int) void +SetAudioStreamCallback c_func(stream AudioStream, callback ?*c_func(_ ?*mut void, _ c_uint) void) void +AttachAudioStreamProcessor c_func(stream AudioStream, processor ?*c_func(_ ?*mut void, _ c_uint) void) void +DetachAudioStreamProcessor c_func(stream AudioStream, processor ?*c_func(_ ?*mut void, _ c_uint) void) void +AttachAudioMixedProcessor c_func(processor ?*c_func(_ ?*mut void, _ c_uint) void) void +DetachAudioMixedProcessor c_func(processor ?*c_func(_ ?*mut void, _ c_uint) void) void + +# unsupported in bindings: RAYLIB_H — C macro has no replacement value +# unsupported in bindings: _VA_LIST — C macro has no replacement value +# unsupported in bindings: va_start — C function-like macros are not supported +# unsupported in bindings: va_end — C function-like macros are not supported +# unsupported in bindings: va_arg — C function-like macros are not supported +# unsupported in bindings: va_copy — C function-like macros are not supported +# unsupported in bindings: RAYLIB_VERSION — C macro is not a supported constant +# unsupported in bindings: RLAPI — C macro has no replacement value +# unsupported in bindings: DEG2RAD — C macro is not a supported constant +# unsupported in bindings: RAD2DEG — C macro is not a supported constant +# unsupported in bindings: RL_MALLOC — C function-like macros are not supported +# unsupported in bindings: RL_CALLOC — C function-like macros are not supported +# unsupported in bindings: RL_REALLOC — C function-like macros are not supported +# unsupported in bindings: RL_FREE — C function-like macros are not supported +# unsupported in bindings: CLITERAL — C function-like macros are not supported +# unsupported in bindings: RL_COLOR_TYPE — C macro has no replacement value +# unsupported in bindings: RL_RECTANGLE_TYPE — C macro has no replacement value +# unsupported in bindings: RL_VECTOR2_TYPE — C macro has no replacement value +# unsupported in bindings: RL_VECTOR3_TYPE — C macro has no replacement value +# unsupported in bindings: RL_VECTOR4_TYPE — C macro has no replacement value +# unsupported in bindings: RL_QUATERNION_TYPE — C macro has no replacement value +# unsupported in bindings: RL_MATRIX_TYPE — C macro has no replacement value +# unsupported in bindings: bool — C macro is not a supported constant +# unsupported in bindings: MOUSE_LEFT_BUTTON — C macro is not a supported constant +# unsupported in bindings: MOUSE_RIGHT_BUTTON — C macro is not a supported constant +# unsupported in bindings: MOUSE_MIDDLE_BUTTON — C macro is not a supported constant +# unsupported in bindings: MATERIAL_MAP_DIFFUSE — C macro is not a supported constant +# unsupported in bindings: MATERIAL_MAP_SPECULAR — C macro is not a supported constant +# unsupported in bindings: SHADER_LOC_MAP_DIFFUSE — C macro is not a supported constant +# unsupported in bindings: SHADER_LOC_MAP_SPECULAR — C macro is not a supported constant +# unsupported in bindings: GetMouseRay — C macro is not a supported constant diff --git a/main.odin b/main.odin index c17c554..ba05e67 100644 --- a/main.odin +++ b/main.odin @@ -92,12 +92,19 @@ print_usage :: proc() { fmt.eprintln( " brolang translate-c|--translate-c [--target aarch64-macos] [--c-include-path | --c-define ]...", ) + fmt.eprintln( + " brolang build [root] (reads root/build.bro; root defaults to the current directory)", + ) } is_translate_c_command :: proc(arg: string) -> bool { return arg == "translate-c" || arg == "--translate-c" } +is_build_command :: proc(arg: string) -> bool { + return arg == "build" +} + zig_lib_dir_from_env_output :: proc(text: string, allocator := context.allocator) -> (string, bool) { rest := text prefix := ".lib_dir = \"" @@ -233,6 +240,10 @@ run_translate_c :: proc(args: []string) -> int { } main :: proc() { + if len(os2.args) >= 2 && is_build_command(os2.args[1]) { + root := os2.args[2] if len(os2.args) >= 3 else "." + os2.exit(compiler.run_build(root)) + } if len(os2.args) >= 2 && is_translate_c_command(os2.args[1]) { os2.exit(run_translate_c(os2.args)) } diff --git a/std/build/build.bro b/std/build/build.bro new file mode 100644 index 0000000..5c39b55 --- /dev/null +++ b/std/build/build.bro @@ -0,0 +1,17 @@ +# Build configuration surface for `brolang build` (v0). +# +# A project's `build.bro` imports this module and declares a top-level constant +# named `config` of type `BuildConfig`. `brolang build [root]` type-checks +# build.bro, reads the config, and compiles the program package it names. +# +# Declarative and literal-only: one executable per build. List fields take an +# address-of an array literal (`&["raylib"]`); empty lists are written `&[]`. +BuildConfig :: struct { + name []u8 # output executable name + source []u8 # program package directory, relative to build.bro + libraries [][]u8 # library names to link (-l) + lib_paths [][]u8 # library search directories (-L) + includes [][]u8 # C include directories (-I) + defines [][]u8 # C preprocessor defines (name or name=value) + links [][]u8 # extra linker inputs (object/source files, -framework pairs) +}