mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-07 11:07:27 +00:00
Compare commits
3 Commits
a6e9ce520f
...
731884848a
Author | SHA1 | Date | |
---|---|---|---|
![]() |
731884848a | ||
![]() |
b7d89cb7b9 | ||
![]() |
7bdb0cd320 |
@ -1,4 +1,7 @@
|
||||

|
||||
> Development of raylib-zig has moved to [its own organisation](https://github.com/raylib-zig/raylib-zig).
|
||||
> Please update your `build.zig.zon` files and other links accordingly.
|
||||
|
||||

|
||||
|
||||
# raylib-zig
|
||||
|
||||
@ -6,7 +9,7 @@ Manually tweaked, auto-generated [raylib](https://github.com/raysan5/raylib) bin
|
||||
|
||||
Bindings tested on raylib version 5.6-dev and Zig 0.14.0
|
||||
|
||||
Thanks to all the [contributors](https://github.com/Not-Nik/raylib-zig/graphs/contributors) for their help with this
|
||||
Thanks to all the [contributors](https://github.com/raylib-zig/raylib-zig/graphs/contributors) for their help with this
|
||||
binding.
|
||||
|
||||
## Example
|
||||
@ -64,7 +67,7 @@ want to run an example, say `basic_window` run `zig build basic_window`
|
||||
Download and add raylib-zig as a dependency by running the following command in your project root:
|
||||
|
||||
```
|
||||
zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
|
||||
zig fetch --save git+https://github.com/raylib-zig/raylib-zig#devel
|
||||
```
|
||||
|
||||
Then add raylib-zig as a dependency and import its modules and artifact in your `build.zig`:
|
||||
|
@ -71,6 +71,12 @@ const gui = struct {
|
||||
};
|
||||
|
||||
pub fn build(b: *std.Build) !void {
|
||||
const stdout = std.io.getStdOut().writer();
|
||||
try stdout.print(
|
||||
\\Development of raylib-zig has moved to its own organisation (https://github.com/raylib-zig/raylib-zig).
|
||||
\\Please update your `build.zig.zon` files and other links accordingly.
|
||||
\\
|
||||
, .{});
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
|
@ -1411,6 +1411,11 @@ pub const Mesh = extern struct {
|
||||
pub fn drawInstanced(self: Mesh, material: Material, transforms: []const Matrix) void {
|
||||
rl.drawMeshInstanced(self, material, transforms);
|
||||
}
|
||||
|
||||
/// Unload mesh data from CPU and GPU
|
||||
pub fn unload(self: Mesh) void {
|
||||
rl.unloadMesh(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Shader = extern struct {
|
||||
@ -1426,6 +1431,11 @@ pub const Shader = extern struct {
|
||||
pub fn deactivate(_: Shader) void {
|
||||
rl.endShaderMode();
|
||||
}
|
||||
|
||||
/// Unload shader from GPU memory (VRAM)
|
||||
pub fn unload(self: Shader) void {
|
||||
rl.unloadShader(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const MaterialMap = extern struct {
|
||||
@ -1438,6 +1448,11 @@ pub const Material = extern struct {
|
||||
shader: Shader,
|
||||
maps: [*c]MaterialMap,
|
||||
params: [4]f32,
|
||||
|
||||
/// Unload material from GPU memory (VRAM)
|
||||
pub fn unload(self: Material) void {
|
||||
rl.unloadMaterial(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Transform = extern struct {
|
||||
@ -1504,6 +1519,11 @@ pub const ModelAnimation = extern struct {
|
||||
bones: [*c]BoneInfo,
|
||||
framePoses: [*c][*c]Transform,
|
||||
name: [32]u8,
|
||||
|
||||
/// Unload animation data
|
||||
pub fn unload(self: ModelAnimation) void {
|
||||
rl.unloadModelAnimation(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Ray = extern struct {
|
||||
@ -1529,6 +1549,11 @@ pub const Wave = extern struct {
|
||||
sampleSize: c_uint,
|
||||
channels: c_uint,
|
||||
data: *anyopaque,
|
||||
|
||||
/// Unload wave data
|
||||
pub fn unload(self: Wave) void {
|
||||
rl.unloadWave(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const rAudioBuffer = opaque {};
|
||||
@ -1540,11 +1565,21 @@ pub const AudioStream = extern struct {
|
||||
sampleRate: c_uint,
|
||||
sampleSize: c_uint,
|
||||
channels: c_uint,
|
||||
|
||||
/// Unload audio stream and free memory
|
||||
pub fn unload(self: AudioStream) void {
|
||||
rl.unloadAudioStream(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Sound = extern struct {
|
||||
stream: AudioStream,
|
||||
frameCount: c_uint,
|
||||
|
||||
/// Unload sound
|
||||
pub fn unload(self: Sound) void {
|
||||
rl.unloadSound(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Music = extern struct {
|
||||
@ -1553,6 +1588,11 @@ pub const Music = extern struct {
|
||||
looping: bool,
|
||||
ctxType: c_int,
|
||||
ctxData: *anyopaque,
|
||||
|
||||
/// Unload music stream
|
||||
pub fn unload(self: Music) void {
|
||||
rl.unloadMusicStream(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const VrDeviceInfo = extern struct {
|
||||
@ -1577,6 +1617,11 @@ pub const VrStereoConfig = extern struct {
|
||||
rightScreenCenter: [2]f32,
|
||||
scale: [2]f32,
|
||||
scaleIn: [2]f32,
|
||||
|
||||
/// Unload VR stereo config
|
||||
pub fn unload(self: VrStereoConfig) void {
|
||||
rl.unloadVrStereoConfig(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const FilePathList = extern struct {
|
||||
@ -1591,7 +1636,16 @@ pub const AutomationEvent = extern struct {
|
||||
params: [4]c_int,
|
||||
};
|
||||
|
||||
pub const AutomationEventList = extern struct { capacity: c_uint, count: c_uint, events: [*c]AutomationEvent };
|
||||
pub const AutomationEventList = extern struct {
|
||||
capacity: c_uint,
|
||||
count: c_uint,
|
||||
events: [*c]AutomationEvent,
|
||||
|
||||
/// Unload automation events list from file
|
||||
pub fn unload(self: AutomationEventList) void {
|
||||
rl.unloadAutomationEventList(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const ConfigFlags = packed struct {
|
||||
__reserved: bool = false,
|
||||
|
@ -1411,6 +1411,11 @@ pub const Mesh = extern struct {
|
||||
pub fn drawInstanced(self: Mesh, material: Material, transforms: []const Matrix) void {
|
||||
rl.drawMeshInstanced(self, material, transforms);
|
||||
}
|
||||
|
||||
/// Unload mesh data from CPU and GPU
|
||||
pub fn unload(self: Mesh) void {
|
||||
rl.unloadMesh(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Shader = extern struct {
|
||||
@ -1426,6 +1431,11 @@ pub const Shader = extern struct {
|
||||
pub fn deactivate(_: Shader) void {
|
||||
rl.endShaderMode();
|
||||
}
|
||||
|
||||
/// Unload shader from GPU memory (VRAM)
|
||||
pub fn unload(self: Shader) void {
|
||||
rl.unloadShader(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const MaterialMap = extern struct {
|
||||
@ -1438,6 +1448,11 @@ pub const Material = extern struct {
|
||||
shader: Shader,
|
||||
maps: [*c]MaterialMap,
|
||||
params: [4]f32,
|
||||
|
||||
/// Unload material from GPU memory (VRAM)
|
||||
pub fn unload(self: Material) void {
|
||||
rl.unloadMaterial(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Transform = extern struct {
|
||||
@ -1504,6 +1519,11 @@ pub const ModelAnimation = extern struct {
|
||||
bones: [*c]BoneInfo,
|
||||
framePoses: [*c][*c]Transform,
|
||||
name: [32]u8,
|
||||
|
||||
/// Unload animation data
|
||||
pub fn unload(self: ModelAnimation) void {
|
||||
rl.unloadModelAnimation(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Ray = extern struct {
|
||||
@ -1529,6 +1549,11 @@ pub const Wave = extern struct {
|
||||
sampleSize: c_uint,
|
||||
channels: c_uint,
|
||||
data: *anyopaque,
|
||||
|
||||
/// Unload wave data
|
||||
pub fn unload(self: Wave) void {
|
||||
rl.unloadWave(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const rAudioBuffer = opaque {};
|
||||
@ -1540,11 +1565,21 @@ pub const AudioStream = extern struct {
|
||||
sampleRate: c_uint,
|
||||
sampleSize: c_uint,
|
||||
channels: c_uint,
|
||||
|
||||
/// Unload audio stream and free memory
|
||||
pub fn unload(self: AudioStream) void {
|
||||
rl.unloadAudioStream(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Sound = extern struct {
|
||||
stream: AudioStream,
|
||||
frameCount: c_uint,
|
||||
|
||||
/// Unload sound
|
||||
pub fn unload(self: Sound) void {
|
||||
rl.unloadSound(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const Music = extern struct {
|
||||
@ -1553,6 +1588,11 @@ pub const Music = extern struct {
|
||||
looping: bool,
|
||||
ctxType: c_int,
|
||||
ctxData: *anyopaque,
|
||||
|
||||
/// Unload music stream
|
||||
pub fn unload(self: Music) void {
|
||||
rl.unloadMusicStream(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const VrDeviceInfo = extern struct {
|
||||
@ -1577,6 +1617,11 @@ pub const VrStereoConfig = extern struct {
|
||||
rightScreenCenter: [2]f32,
|
||||
scale: [2]f32,
|
||||
scaleIn: [2]f32,
|
||||
|
||||
/// Unload VR stereo config
|
||||
pub fn unload(self: VrStereoConfig) void {
|
||||
rl.unloadVrStereoConfig(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const FilePathList = extern struct {
|
||||
@ -1591,7 +1636,16 @@ pub const AutomationEvent = extern struct {
|
||||
params: [4]c_int,
|
||||
};
|
||||
|
||||
pub const AutomationEventList = extern struct { capacity: c_uint, count: c_uint, events: [*c]AutomationEvent };
|
||||
pub const AutomationEventList = extern struct {
|
||||
capacity: c_uint,
|
||||
count: c_uint,
|
||||
events: [*c]AutomationEvent,
|
||||
|
||||
/// Unload automation events list from file
|
||||
pub fn unload(self: AutomationEventList) void {
|
||||
rl.unloadAutomationEventList(self);
|
||||
}
|
||||
};
|
||||
|
||||
pub const ConfigFlags = packed struct {
|
||||
__reserved: bool = false,
|
||||
|
@ -65,7 +65,7 @@ pub fn build(b: *std.Build) !void {
|
||||
|
||||
New-Item -Name "build.zig" -ItemType "file" -Value $BUILD_DOT_ZIG -Force
|
||||
|
||||
zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
|
||||
zig fetch --save git+https://github.com/raylib-zig/raylib-zig#devel
|
||||
|
||||
New-Item -Name "resources" -ItemType "directory"
|
||||
New-Item -Name "resources/placeholder.txt" -ItemType "file" -Value "" -Force
|
||||
|
@ -63,7 +63,7 @@ pub fn build(b: *std.Build) !void {
|
||||
b.installArtifact(exe);
|
||||
}' >> build.zig
|
||||
|
||||
zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
|
||||
zig fetch --save git+https://github.com/raylib-zig/raylib-zig#devel
|
||||
|
||||
mkdir resources
|
||||
touch resources/placeholder.txt
|
||||
|
Loading…
x
Reference in New Issue
Block a user