minesweeper

A minewseeper implementation to play around with Hare and Raylib
git clone https://git.tronto.net/minesweeper
Download | Log | Files | Refs | README | LICENSE

raylib.ha (1652B)


      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 };