add small wrapper for raylib
This commit is contained in:
		
							parent
							
								
									749661ec36
								
							
						
					
					
						commit
						68df481b8a
					
				
					 5 changed files with 19 additions and 18 deletions
				
			
		
							
								
								
									
										24
									
								
								src/main.zig
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								src/main.zig
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,26 +1,20 @@
 | 
			
		|||
const std = @import("std");
 | 
			
		||||
const ray = @cImport({
 | 
			
		||||
    @cInclude("raylib.h");
 | 
			
		||||
});
 | 
			
		||||
const raygui = @cImport({
 | 
			
		||||
    @cDefine("RAYGUI_IMPLEMENTATION", {});
 | 
			
		||||
    @cInclude("raygui.h");
 | 
			
		||||
});
 | 
			
		||||
const r = @import("raylib.zig");
 | 
			
		||||
 | 
			
		||||
pub fn main() anyerror!void {
 | 
			
		||||
    std.log.info("All your codebase are belong to us.", .{});
 | 
			
		||||
 | 
			
		||||
    ray.InitWindow(800, 450, "ray [core] example - basic window");
 | 
			
		||||
    defer ray.CloseWindow();
 | 
			
		||||
    r.InitWindow(800, 450, "ray [core] example - basic window");
 | 
			
		||||
    defer r.CloseWindow();
 | 
			
		||||
 | 
			
		||||
    while (!ray.WindowShouldClose()) {
 | 
			
		||||
        ray.BeginDrawing();
 | 
			
		||||
        defer ray.EndDrawing();
 | 
			
		||||
    while (!r.WindowShouldClose()) {
 | 
			
		||||
        r.BeginDrawing();
 | 
			
		||||
        defer r.EndDrawing();
 | 
			
		||||
 | 
			
		||||
        ray.ClearBackground(ray.RAYWHITE);
 | 
			
		||||
        ray.DrawText("Congrats! You created your first window!", 190, 200, 20, ray.LIGHTGRAY);
 | 
			
		||||
        r.ClearBackground(r.RAYWHITE);
 | 
			
		||||
        r.DrawText("Congrats! You created your first window!", 190, 200, 20, r.LIGHTGRAY);
 | 
			
		||||
 | 
			
		||||
        if (raygui.GuiButton(raygui.Rectangle{ .x = 190, .y = 250, .width = 150, .height = 30 }, "Button")) {
 | 
			
		||||
        if (r.GuiButton(r.Rectangle{ .x = 190, .y = 250, .width = 150, .height = 30 }, "Button")) {
 | 
			
		||||
            std.log.info("Button pressed", .{});
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								src/raylib.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/raylib.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
#define RAYGUI_IMPLEMENTATION
 | 
			
		||||
#include <raygui.h>
 | 
			
		||||
							
								
								
									
										4
									
								
								src/raylib.zig
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/raylib.zig
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
pub usingnamespace @cImport({
 | 
			
		||||
    @cInclude("raylib.h");
 | 
			
		||||
    @cInclude("raygui.h");
 | 
			
		||||
});
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue