mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 12:07:27 +00:00
Use ShaderUniformDataType instead of int
This commit is contained in:
parent
a0126d15be
commit
674e5ada11
@ -38,19 +38,19 @@ pub fn main() anyerror!void {
|
||||
shdrOutline,
|
||||
outlineSizeLoc,
|
||||
&outlineSize,
|
||||
@intFromEnum(rl.ShaderUniformDataType.shader_uniform_float),
|
||||
rl.ShaderUniformDataType.shader_uniform_float,
|
||||
);
|
||||
rl.setShaderValue(
|
||||
shdrOutline,
|
||||
outlineColorLoc,
|
||||
&outlineColor,
|
||||
@intFromEnum(rl.ShaderUniformDataType.shader_uniform_vec4),
|
||||
rl.ShaderUniformDataType.shader_uniform_vec4,
|
||||
);
|
||||
rl.setShaderValue(
|
||||
shdrOutline,
|
||||
textureSizeLoc,
|
||||
&textureSize,
|
||||
@intFromEnum(rl.ShaderUniformDataType.shader_uniform_vec2),
|
||||
rl.ShaderUniformDataType.shader_uniform_vec2,
|
||||
);
|
||||
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
@ -67,7 +67,7 @@ pub fn main() anyerror!void {
|
||||
shdrOutline,
|
||||
outlineSizeLoc,
|
||||
&outlineSize,
|
||||
@intFromEnum(rl.ShaderUniformDataType.shader_uniform_float),
|
||||
rl.ShaderUniformDataType.shader_uniform_float,
|
||||
);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
@ -148,6 +148,9 @@ def fix_pointer(name: str, t: str):
|
||||
|
||||
|
||||
def fix_enums(arg_name, arg_type, func_name):
|
||||
if func_name.startswith("rl"):
|
||||
return arg_type
|
||||
|
||||
# Hacking specific enums in here.
|
||||
# Raylib doesn't use the enums but rather the resulting ints.
|
||||
if arg_type == "int" or arg_type == "unsigned int":
|
||||
@ -174,9 +177,9 @@ def fix_enums(arg_name, arg_type, func_name):
|
||||
arg_type = "Gesture"
|
||||
elif arg_name == "logLevel":
|
||||
arg_type = "TraceLogLevel"
|
||||
elif arg_name == "ty" and not func_name.startswith("rl"):
|
||||
elif arg_name == "ty":
|
||||
arg_type = "FontType"
|
||||
elif arg_name == "UniformType":
|
||||
elif arg_name == "uniformType":
|
||||
arg_type = "ShaderUniformDataType"
|
||||
elif arg_name == "Cursor":
|
||||
arg_type = "MouseCursor"
|
||||
@ -188,7 +191,7 @@ def fix_enums(arg_name, arg_type, func_name):
|
||||
arg_type = "TextureFilter"
|
||||
elif arg_name == "TextureWrap":
|
||||
arg_type = "TextureWrap"
|
||||
elif arg_name == "format" and not func_name.startswith("rl"):
|
||||
elif arg_name == "format":
|
||||
arg_type = "PixelFormat"
|
||||
elif arg_name == "mapType":
|
||||
arg_type = "MaterialMapIndex"
|
||||
|
@ -80,8 +80,8 @@ pub extern "c" fn LoadShaderFromMemory(vsCode: [*c]const u8, fsCode: [*c]const u
|
||||
pub extern "c" fn IsShaderReady(shader: rl.Shader) bool;
|
||||
pub extern "c" fn GetShaderLocation(shader: rl.Shader, uniformName: [*c]const u8) c_int;
|
||||
pub extern "c" fn GetShaderLocationAttrib(shader: rl.Shader, attribName: [*c]const u8) c_int;
|
||||
pub extern "c" fn SetShaderValue(shader: rl.Shader, locIndex: c_int, value: *const anyopaque, uniformType: c_int) void;
|
||||
pub extern "c" fn SetShaderValueV(shader: rl.Shader, locIndex: c_int, value: *const anyopaque, uniformType: c_int, count: c_int) void;
|
||||
pub extern "c" fn SetShaderValue(shader: rl.Shader, locIndex: c_int, value: *const anyopaque, uniformType: rl.ShaderUniformDataType) void;
|
||||
pub extern "c" fn SetShaderValueV(shader: rl.Shader, locIndex: c_int, value: *const anyopaque, uniformType: rl.ShaderUniformDataType, count: c_int) void;
|
||||
pub extern "c" fn SetShaderValueMatrix(shader: rl.Shader, locIndex: c_int, mat: rl.Matrix) void;
|
||||
pub extern "c" fn SetShaderValueTexture(shader: rl.Shader, locIndex: c_int, texture: rl.Texture2D) void;
|
||||
pub extern "c" fn UnloadShader(shader: rl.Shader) void;
|
||||
|
@ -1775,12 +1775,12 @@ pub fn getShaderLocationAttrib(shader: Shader, attribName: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GetShaderLocationAttrib(shader, @as([*c]const u8, @ptrCast(attribName))));
|
||||
}
|
||||
|
||||
pub fn setShaderValue(shader: Shader, locIndex: i32, value: *const anyopaque, uniformType: i32) void {
|
||||
cdef.SetShaderValue(shader, @as(c_int, locIndex), value, @as(c_int, uniformType));
|
||||
pub fn setShaderValue(shader: Shader, locIndex: i32, value: *const anyopaque, uniformType: ShaderUniformDataType) void {
|
||||
cdef.SetShaderValue(shader, @as(c_int, locIndex), value, uniformType);
|
||||
}
|
||||
|
||||
pub fn setShaderValueV(shader: Shader, locIndex: i32, value: *const anyopaque, uniformType: i32, count: i32) void {
|
||||
cdef.SetShaderValueV(shader, @as(c_int, locIndex), value, @as(c_int, uniformType), @as(c_int, count));
|
||||
pub fn setShaderValueV(shader: Shader, locIndex: i32, value: *const anyopaque, uniformType: ShaderUniformDataType, count: i32) void {
|
||||
cdef.SetShaderValueV(shader, @as(c_int, locIndex), value, uniformType, @as(c_int, count));
|
||||
}
|
||||
|
||||
pub fn setShaderValueMatrix(shader: Shader, locIndex: i32, mat: Matrix) void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user