Skip to content

Lightnet/zig_raylib_sample01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zig_raylib_sample01

License: MIT

Lib:

  • raylib 5.0 master f62202198e35161a9fe394a14bbd1a7c655107ad
  • raygui 4.0 master 12804826d01bfb636e36f816bda19eaa23b4ace7
  • zig 0.12.0

OS:

  • Windows 10 [Tested]

Information:

Simple raylib and raygui test build. After doing search engine.

The package manager is work in progress from Zig language Dev. Since the release of 0.11.0 This project use zig dependencies download to run application. By using the dependencies to handle build.zig script for easy compile and run application.

The Zig language will be subject to change in API. Which will break the build config. Since it not release to 1.0.0

raylib:

const r = @cImport({
    @cInclude("raylib.h");
    @cInclude("raygui.h");
});
//...
r.InitWindow(960, 540, "My Window Name");

Note it still use access but with name space. Check out on cheatsheet for more information from raylib site.

raygui:

Note that Zig language use name space for easy access for C language. As well same with the raylab as they group together.

const r = @cImport({
    @cInclude("raylib.h");
    @cInclude("raygui.h");
});

//...
r.InitWindow(960, 540, "My Window Name");
//...

It can be found in https://github.com/raysan5/raygui/blob/master/src/raygui.h

if (r.GuiButton(r.Rectangle{ .x = 20, .y = 100, .height = 16, .width = 100 }, "Print!") == 1) {
    std.debug.print("Hello World!\n", .{});
}

Note button return is int and not bool.

Note one file is add to handle raygui.h file for load correctly that is raygui_impl.c.

Zig:

zig build

If nothing happen, it pass build.

zig build run

Window, text and gui checkbox test.

raylib examples refs:

Key Area Points:

Test refs:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors