diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 11:09:56 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 11:09:56 +0200 |
| commit | 123144c93bfc77883c8fb517828b47bbe13b8671 (patch) | |
| tree | 762739afedb5f3f168051367515cb9b9a06ec68d /raylib/raylib.ha | |
| download | minesweeper-123144c93bfc77883c8fb517828b47bbe13b8671.tar.gz minesweeper-123144c93bfc77883c8fb517828b47bbe13b8671.zip | |
Diffstat (limited to 'raylib/raylib.ha')
| -rw-r--r-- | raylib/raylib.ha | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/raylib/raylib.ha b/raylib/raylib.ha new file mode 100644 index 0000000..65c1b51 --- /dev/null +++ b/raylib/raylib.ha | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | use types::c; | ||
| 2 | |||
| 3 | export const MOUSE_BUTTON_LEFT = 0; | ||
| 4 | export const MOUSE_BUTTON_RIGHT = 1; | ||
| 5 | export const FLAG_WINDOW_RESIZABLE: uint = 4; | ||
| 6 | |||
| 7 | export const KEY_N = 78; | ||
| 8 | |||
| 9 | export type color = struct { | ||
| 10 | r: u8, | ||
| 11 | g: u8, | ||
| 12 | b: u8, | ||
| 13 | a: u8 | ||
| 14 | }; | ||
| 15 | |||
| 16 | export type vector2 = struct { | ||
| 17 | x: f32, | ||
| 18 | y: f32 | ||
| 19 | }; | ||
| 20 | |||
| 21 | export @symbol("WindowShouldClose") fn window_should_close() bool; | ||
| 22 | export @symbol("BeginDrawing") fn begin_drawing() void; | ||
| 23 | export @symbol("EndDrawing") fn end_drawing() void; | ||
| 24 | export @symbol("ClearBackground") fn clear_background(color) void; | ||
| 25 | export @symbol("DrawRectangleV") fn draw_rectangle_v(vector2, vector2, color) void; | ||
| 26 | export @symbol("IsMouseButtonPressed") fn is_mouse_button_pressed(int) bool; | ||
| 27 | export @symbol("GetMousePosition") fn get_mouse_position() vector2; | ||
| 28 | export @symbol("GetScreenHeight") fn get_screen_height() int; | ||
| 29 | export @symbol("GetScreenWidth") fn get_screen_width() int; | ||
| 30 | export @symbol("SetConfigFlags") fn set_config_flags(uint) void; | ||
| 31 | export @symbol("IsKeyPressed") fn is_key_pressed(int) bool; | ||
| 32 | |||
| 33 | @symbol("InitWindow") fn InitWindow(int, int, *c::char) void; | ||
| 34 | export fn init_window(width: int, height: int, title: str) void = { | ||
| 35 | let c_title = c::fromstr(title)!; | ||
| 36 | defer free(c_title); | ||
| 37 | InitWindow(width, height, c_title); | ||
| 38 | }; | ||
| 39 | |||
| 40 | @symbol("DrawText") fn DrawText(*c::char, int, int, int, color) void; | ||
| 41 | export fn draw_text(text: str, x: int, y: int, sz: int, c: color) void = { | ||
| 42 | let c_str = c::fromstr(text)!; | ||
| 43 | defer free(c_str); | ||
| 44 | DrawText(c_str, x, y, sz, c); | ||
| 45 | }; | ||
| 46 | |||
| 47 | @symbol("MeasureText") fn MeasureText(*c::char, int) int; | ||
| 48 | export fn measure_text(text: str, sz: int) int = { | ||
| 49 | let c_str = c::fromstr(text)!; | ||
| 50 | defer free(c_str); | ||
| 51 | return MeasureText(c_str, sz); | ||
| 52 | }; | ||
