mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 03:57:29 +00:00
Convert some more enums
This commit is contained in:
parent
3f046d9db7
commit
052ab7b75b
@ -126,9 +126,11 @@ def fix_enums(arg_name, arg_type, func_name):
|
||||
elif arg_name == "mode" and func_name == "SetCameraMode":
|
||||
arg_type = "CameraMode"
|
||||
elif arg_name == "gesture":
|
||||
arg_type = "Gestures"
|
||||
arg_type = "Gesture"
|
||||
elif arg_name == "flags" and func_name in ["SetWindowState", "ClearWindowState", "SetConfigFlags"]:
|
||||
arg_type = "ConfigFlags"
|
||||
elif arg_name == "logLevel":
|
||||
arg_type = "TraceLogLevel"
|
||||
return arg_type
|
||||
|
||||
|
||||
@ -186,6 +188,13 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
|
||||
return_type = c_to_zig_type(return_type)
|
||||
func_name, return_type = fix_pointer(func_name, return_type)
|
||||
|
||||
if func_name == "GetKeyPressed":
|
||||
return_type = "KeyboardKey"
|
||||
elif func_name == "GetGamepadButtonPressed":
|
||||
return_type = "GamepadButton"
|
||||
elif func_name == "GetGestureDetected":
|
||||
return_type = "Gesture"
|
||||
|
||||
zig_c_arguments = []
|
||||
zig_arguments = []
|
||||
zig_call_args = []
|
||||
|
@ -859,7 +859,7 @@ pub const BlendMode = enum(c_int) {
|
||||
blend_custom_separate = 7,
|
||||
};
|
||||
|
||||
pub const Gestures = enum(c_int) {
|
||||
pub const Gesture = enum(c_int) {
|
||||
gesture_none = 0,
|
||||
gesture_tap = 1,
|
||||
gesture_doubletap = 2,
|
||||
|
@ -98,8 +98,8 @@ pub extern "c" fn GetRandomValue(min: c_int, max: c_int) c_int;
|
||||
pub extern "c" fn SetRandomSeed(seed: c_uint) void;
|
||||
pub extern "c" fn TakeScreenshot(fileName: [*c]const u8) void;
|
||||
pub extern "c" fn SetConfigFlags(flags: rl.ConfigFlags) void;
|
||||
pub extern "c" fn TraceLog(logLevel: c_int, text: [*c]const u8, ...) void;
|
||||
pub extern "c" fn SetTraceLogLevel(logLevel: c_int) void;
|
||||
pub extern "c" fn TraceLog(logLevel: rl.TraceLogLevel, text: [*c]const u8, ...) void;
|
||||
pub extern "c" fn SetTraceLogLevel(logLevel: rl.TraceLogLevel) void;
|
||||
pub extern "c" fn MemAlloc(size: c_uint) *anyopaque;
|
||||
pub extern "c" fn MemRealloc(ptr: *anyopaque, size: c_uint) *anyopaque;
|
||||
pub extern "c" fn MemFree(ptr: *anyopaque) void;
|
||||
@ -144,7 +144,7 @@ pub extern "c" fn IsKeyDown(key: rl.KeyboardKey) bool;
|
||||
pub extern "c" fn IsKeyReleased(key: rl.KeyboardKey) bool;
|
||||
pub extern "c" fn IsKeyUp(key: rl.KeyboardKey) bool;
|
||||
pub extern "c" fn SetExitKey(key: rl.KeyboardKey) void;
|
||||
pub extern "c" fn GetKeyPressed() c_int;
|
||||
pub extern "c" fn GetKeyPressed() rl.KeyboardKey;
|
||||
pub extern "c" fn GetCharPressed() c_int;
|
||||
pub extern "c" fn IsGamepadAvailable(gamepad: c_int) bool;
|
||||
pub extern "c" fn GetGamepadName(gamepad: c_int) [*c]const u8;
|
||||
@ -152,7 +152,7 @@ pub extern "c" fn IsGamepadButtonPressed(gamepad: c_int, button: rl.GamepadButto
|
||||
pub extern "c" fn IsGamepadButtonDown(gamepad: c_int, button: rl.GamepadButton) bool;
|
||||
pub extern "c" fn IsGamepadButtonReleased(gamepad: c_int, button: rl.GamepadButton) bool;
|
||||
pub extern "c" fn IsGamepadButtonUp(gamepad: c_int, button: rl.GamepadButton) bool;
|
||||
pub extern "c" fn GetGamepadButtonPressed() c_int;
|
||||
pub extern "c" fn GetGamepadButtonPressed() rl.GamepadButton;
|
||||
pub extern "c" fn GetGamepadAxisCount(gamepad: c_int) c_int;
|
||||
pub extern "c" fn GetGamepadAxisMovement(gamepad: c_int, axis: c_int) f32;
|
||||
pub extern "c" fn SetGamepadMappings(mappings: [*c]const u8) c_int;
|
||||
@ -176,8 +176,8 @@ pub extern "c" fn GetTouchPosition(index: c_int) rl.Vector2;
|
||||
pub extern "c" fn GetTouchPointId(index: c_int) c_int;
|
||||
pub extern "c" fn GetTouchPointCount() c_int;
|
||||
pub extern "c" fn SetGesturesEnabled(flags: c_uint) void;
|
||||
pub extern "c" fn IsGestureDetected(gesture: rl.Gestures) bool;
|
||||
pub extern "c" fn GetGestureDetected() c_int;
|
||||
pub extern "c" fn IsGestureDetected(gesture: rl.Gesture) bool;
|
||||
pub extern "c" fn GetGestureDetected() rl.Gesture;
|
||||
pub extern "c" fn GetGestureHoldDuration() f32;
|
||||
pub extern "c" fn GetGestureDragVector() rl.Vector2;
|
||||
pub extern "c" fn GetGestureDragAngle() f32;
|
||||
|
@ -859,7 +859,7 @@ pub const BlendMode = enum(c_int) {
|
||||
blend_custom_separate = 7,
|
||||
};
|
||||
|
||||
pub const Gestures = enum(c_int) {
|
||||
pub const Gesture = enum(c_int) {
|
||||
gesture_none = 0,
|
||||
gesture_tap = 1,
|
||||
gesture_doubletap = 2,
|
||||
@ -1383,12 +1383,12 @@ pub fn setConfigFlags(flags: ConfigFlags) void {
|
||||
cdef.SetConfigFlags(flags);
|
||||
}
|
||||
|
||||
pub fn traceLog(logLevel: i32, text: []const u8) void {
|
||||
cdef.TraceLog(@as(c_int, logLevel), @ptrCast([*c]const u8, text));
|
||||
pub fn traceLog(logLevel: TraceLogLevel, text: []const u8) void {
|
||||
cdef.TraceLog(logLevel, @ptrCast([*c]const u8, text));
|
||||
}
|
||||
|
||||
pub fn setTraceLogLevel(logLevel: i32) void {
|
||||
cdef.SetTraceLogLevel(@as(c_int, logLevel));
|
||||
pub fn setTraceLogLevel(logLevel: TraceLogLevel) void {
|
||||
cdef.SetTraceLogLevel(logLevel);
|
||||
}
|
||||
|
||||
pub fn memAlloc(size: u32) *anyopaque {
|
||||
@ -1567,8 +1567,8 @@ pub fn setExitKey(key: KeyboardKey) void {
|
||||
cdef.SetExitKey(key);
|
||||
}
|
||||
|
||||
pub fn getKeyPressed() i32 {
|
||||
return @as(i32, cdef.GetKeyPressed());
|
||||
pub fn getKeyPressed() KeyboardKey {
|
||||
return cdef.GetKeyPressed();
|
||||
}
|
||||
|
||||
pub fn getCharPressed() i32 {
|
||||
@ -1599,8 +1599,8 @@ pub fn isGamepadButtonUp(gamepad: i32, button: GamepadButton) bool {
|
||||
return cdef.IsGamepadButtonUp(@as(c_int, gamepad), button);
|
||||
}
|
||||
|
||||
pub fn getGamepadButtonPressed() i32 {
|
||||
return @as(i32, cdef.GetGamepadButtonPressed());
|
||||
pub fn getGamepadButtonPressed() GamepadButton {
|
||||
return cdef.GetGamepadButtonPressed();
|
||||
}
|
||||
|
||||
pub fn getGamepadAxisCount(gamepad: i32) i32 {
|
||||
@ -1695,12 +1695,12 @@ pub fn setGesturesEnabled(flags: u32) void {
|
||||
cdef.SetGesturesEnabled(@as(c_uint, flags));
|
||||
}
|
||||
|
||||
pub fn isGestureDetected(gesture: Gestures) bool {
|
||||
pub fn isGestureDetected(gesture: Gesture) bool {
|
||||
return cdef.IsGestureDetected(gesture);
|
||||
}
|
||||
|
||||
pub fn getGestureDetected() i32 {
|
||||
return @as(i32, cdef.GetGestureDetected());
|
||||
pub fn getGestureDetected() Gesture {
|
||||
return cdef.GetGestureDetected();
|
||||
}
|
||||
|
||||
pub fn getGestureHoldDuration() f32 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user