mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-08 19:47:28 +00:00
Make use of Zigs doc comments (#116)
* copy over inline comments * remove trailing comma * add more doc comments * implement requested changes * Newly generated file * Manually add docstrings to raygui functions in prelude * Fix generator script --------- Co-authored-by: Not-Nik <nik.wipper@gmx.de>
This commit is contained in:
parent
e98afb5252
commit
2d8e856009
@ -55,7 +55,7 @@ def ziggify_type(name: str, t: str, func_name) -> str:
|
||||
"position", "mesh", "materialCount", "material", "model", "animCount",
|
||||
"wave", "v1", "v2", "outAxis", "outAngle", "fileSize",
|
||||
"AutomationEventList", "list", "batch", "glInternalFormat", "glFormat",
|
||||
"glType", "mipmaps", "active", "scroll", "view", "checked", "mouseCell",
|
||||
"glType", "mipmaps", "active", "scroll", "view", "checked", "mouseCell",
|
||||
"scrollIndex", "focus", "secretViewActive", "color", "alpha", "colorHsv"
|
||||
]
|
||||
multi = [
|
||||
@ -225,7 +225,15 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
|
||||
if not line.startswith(prefix):
|
||||
continue
|
||||
|
||||
line = line.split(";", 1)[0]
|
||||
split_line = line.split(";", 1)
|
||||
|
||||
line = split_line[0]
|
||||
if len(split_line) > 1:
|
||||
desc = split_line[1].lstrip()
|
||||
inline_comment = ("/" + desc) if len(desc) > 0 else ""
|
||||
else:
|
||||
inline_comment = ""
|
||||
|
||||
|
||||
if leftover:
|
||||
line = leftover + line
|
||||
@ -267,7 +275,7 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
|
||||
zig_c_arguments = []
|
||||
zig_arguments = []
|
||||
zig_call_args = []
|
||||
|
||||
|
||||
if not arguments:
|
||||
arguments = "void"
|
||||
|
||||
@ -360,6 +368,7 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
|
||||
|
||||
if return_cast:
|
||||
zig_funcs.append(
|
||||
inline_comment +
|
||||
f"pub fn {zig_name}({zig_arguments}) {zig_return}" +
|
||||
" {\n " +
|
||||
("return " if zig_return != "void" else "") +
|
||||
|
@ -412,6 +412,7 @@ pub const GuiIconName = enum(c_int) {
|
||||
icon_255 = 255,
|
||||
};
|
||||
|
||||
/// Get raygui icons data pointer
|
||||
pub fn guiGetIcons() rl.RaylibError![]u32 {
|
||||
var res: []u32 = undefined;
|
||||
|
||||
@ -424,18 +425,22 @@ pub fn guiGetIcons() rl.RaylibError![]u32 {
|
||||
}
|
||||
|
||||
// If you REALLY need the return value of the function, you'll know what to do with it and its size yourself
|
||||
/// Load raygui icons file (.rgi) into internal icons data
|
||||
pub fn guiLoadIcons(fileName: [*c]const u8, loadIconsName: bool) [*c][*c]u8 {
|
||||
return cdef.GuiLoadIcons(fileName, loadIconsName);
|
||||
}
|
||||
|
||||
/// Tab Bar control, returns TAB to be closed or -1
|
||||
pub fn guiTabBar(bounds: Rectangle, text: [][:0]const u8, active: *i32) i32 {
|
||||
return @as(i32, cdef.GuiTabBar(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(active))));
|
||||
}
|
||||
|
||||
/// List View with extended parameters
|
||||
pub fn guiListViewEx(bounds: Rectangle, text: [][:0]const u8, scrollIndex: *i32, active: *i32, focus: *i32) i32 {
|
||||
return @as(i32, cdef.GuiListViewEx(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active)), @as([*c]c_int, @ptrCast(focus))));
|
||||
}
|
||||
|
||||
/// Panel control, useful to group controls
|
||||
pub fn guiPanel(bounds: Rectangle, text: ?[:0]const u8) i32 {
|
||||
var textFinal = @as([*c]const u8, 0);
|
||||
if (text) |textSure| {
|
||||
@ -444,6 +449,7 @@ pub fn guiPanel(bounds: Rectangle, text: ?[:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiPanel(bounds, textFinal));
|
||||
}
|
||||
|
||||
/// Scroll Panel control
|
||||
pub fn guiScrollPanel(bounds: Rectangle, text: ?[:0]const u8, content: Rectangle, scroll: *Vector2, view: *Rectangle) i32 {
|
||||
var textFinal = @as([*c]const u8, 0);
|
||||
if (text) |textSure| {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -412,6 +412,7 @@ pub const GuiIconName = enum(c_int) {
|
||||
icon_255 = 255,
|
||||
};
|
||||
|
||||
/// Get raygui icons data pointer
|
||||
pub fn guiGetIcons() rl.RaylibError![]u32 {
|
||||
var res: []u32 = undefined;
|
||||
|
||||
@ -424,18 +425,22 @@ pub fn guiGetIcons() rl.RaylibError![]u32 {
|
||||
}
|
||||
|
||||
// If you REALLY need the return value of the function, you'll know what to do with it and its size yourself
|
||||
/// Load raygui icons file (.rgi) into internal icons data
|
||||
pub fn guiLoadIcons(fileName: [*c]const u8, loadIconsName: bool) [*c][*c]u8 {
|
||||
return cdef.GuiLoadIcons(fileName, loadIconsName);
|
||||
}
|
||||
|
||||
/// Tab Bar control, returns TAB to be closed or -1
|
||||
pub fn guiTabBar(bounds: Rectangle, text: [][:0]const u8, active: *i32) i32 {
|
||||
return @as(i32, cdef.GuiTabBar(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(active))));
|
||||
}
|
||||
|
||||
/// List View with extended parameters
|
||||
pub fn guiListViewEx(bounds: Rectangle, text: [][:0]const u8, scrollIndex: *i32, active: *i32, focus: *i32) i32 {
|
||||
return @as(i32, cdef.GuiListViewEx(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active)), @as([*c]c_int, @ptrCast(focus))));
|
||||
}
|
||||
|
||||
/// Panel control, useful to group controls
|
||||
pub fn guiPanel(bounds: Rectangle, text: ?[:0]const u8) i32 {
|
||||
var textFinal = @as([*c]const u8, 0);
|
||||
if (text) |textSure| {
|
||||
@ -444,6 +449,7 @@ pub fn guiPanel(bounds: Rectangle, text: ?[:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiPanel(bounds, textFinal));
|
||||
}
|
||||
|
||||
/// Scroll Panel control
|
||||
pub fn guiScrollPanel(bounds: Rectangle, text: ?[:0]const u8, content: Rectangle, scroll: *Vector2, view: *Rectangle) i32 {
|
||||
var textFinal = @as([*c]const u8, 0);
|
||||
if (text) |textSure| {
|
||||
@ -452,206 +458,257 @@ pub fn guiScrollPanel(bounds: Rectangle, text: ?[:0]const u8, content: Rectangle
|
||||
return @as(i32, cdef.GuiScrollPanel(bounds, textFinal, content, @as([*c]Vector2, @ptrCast(scroll)), @as([*c]Rectangle, @ptrCast(view))));
|
||||
}
|
||||
|
||||
/// Enable gui controls (global state)
|
||||
pub fn guiEnable() void {
|
||||
cdef.GuiEnable();
|
||||
}
|
||||
|
||||
/// Disable gui controls (global state)
|
||||
pub fn guiDisable() void {
|
||||
cdef.GuiDisable();
|
||||
}
|
||||
|
||||
/// Lock gui controls (global state)
|
||||
pub fn guiLock() void {
|
||||
cdef.GuiLock();
|
||||
}
|
||||
|
||||
/// Unlock gui controls (global state)
|
||||
pub fn guiUnlock() void {
|
||||
cdef.GuiUnlock();
|
||||
}
|
||||
|
||||
/// Check if gui is locked (global state)
|
||||
pub fn guiIsLocked() bool {
|
||||
return cdef.GuiIsLocked();
|
||||
}
|
||||
|
||||
/// Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
||||
pub fn guiSetAlpha(alpha: f32) void {
|
||||
cdef.GuiSetAlpha(alpha);
|
||||
}
|
||||
|
||||
/// Set gui state (global state)
|
||||
pub fn guiSetState(state: i32) void {
|
||||
cdef.GuiSetState(@as(c_int, state));
|
||||
}
|
||||
|
||||
/// Get gui state (global state)
|
||||
pub fn guiGetState() i32 {
|
||||
return @as(i32, cdef.GuiGetState());
|
||||
}
|
||||
|
||||
/// Set gui custom font (global state)
|
||||
pub fn guiSetFont(font: Font) void {
|
||||
cdef.GuiSetFont(font);
|
||||
}
|
||||
|
||||
/// Get gui custom font (global state)
|
||||
pub fn guiGetFont() Font {
|
||||
return cdef.GuiGetFont();
|
||||
}
|
||||
|
||||
/// Set one style property
|
||||
pub fn guiSetStyle(control: i32, property: i32, value: i32) void {
|
||||
cdef.GuiSetStyle(@as(c_int, control), @as(c_int, property), @as(c_int, value));
|
||||
}
|
||||
|
||||
/// Get one style property
|
||||
pub fn guiGetStyle(control: i32, property: i32) i32 {
|
||||
return @as(i32, cdef.GuiGetStyle(@as(c_int, control), @as(c_int, property)));
|
||||
}
|
||||
|
||||
/// Load style file over global style variable (.rgs)
|
||||
pub fn guiLoadStyle(fileName: [:0]const u8) void {
|
||||
cdef.GuiLoadStyle(@as([*c]const u8, @ptrCast(fileName)));
|
||||
}
|
||||
|
||||
/// Load style default over global style
|
||||
pub fn guiLoadStyleDefault() void {
|
||||
cdef.GuiLoadStyleDefault();
|
||||
}
|
||||
|
||||
/// Enable gui tooltips (global state)
|
||||
pub fn guiEnableTooltip() void {
|
||||
cdef.GuiEnableTooltip();
|
||||
}
|
||||
|
||||
/// Disable gui tooltips (global state)
|
||||
pub fn guiDisableTooltip() void {
|
||||
cdef.GuiDisableTooltip();
|
||||
}
|
||||
|
||||
/// Set tooltip string
|
||||
pub fn guiSetTooltip(tooltip: [:0]const u8) void {
|
||||
cdef.GuiSetTooltip(@as([*c]const u8, @ptrCast(tooltip)));
|
||||
}
|
||||
|
||||
/// Get text with icon id prepended (if supported)
|
||||
pub fn guiIconText(iconId: i32, text: [:0]const u8) [:0]const u8 {
|
||||
return std.mem.span(cdef.GuiIconText(@as(c_int, iconId), @as([*c]const u8, @ptrCast(text))));
|
||||
}
|
||||
|
||||
/// Set default icon drawing size
|
||||
pub fn guiSetIconScale(scale: i32) void {
|
||||
cdef.GuiSetIconScale(@as(c_int, scale));
|
||||
}
|
||||
|
||||
/// Draw icon using pixel size at specified position
|
||||
pub fn guiDrawIcon(iconId: i32, posX: i32, posY: i32, pixelSize: i32, color: Color) void {
|
||||
cdef.GuiDrawIcon(@as(c_int, iconId), @as(c_int, posX), @as(c_int, posY), @as(c_int, pixelSize), color);
|
||||
}
|
||||
|
||||
/// Window Box control, shows a window that can be closed
|
||||
pub fn guiWindowBox(bounds: Rectangle, title: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiWindowBox(bounds, @as([*c]const u8, @ptrCast(title))));
|
||||
}
|
||||
|
||||
/// Group Box control with text name
|
||||
pub fn guiGroupBox(bounds: Rectangle, text: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiGroupBox(bounds, @as([*c]const u8, @ptrCast(text))));
|
||||
}
|
||||
|
||||
/// Line separator control, could contain text
|
||||
pub fn guiLine(bounds: Rectangle, text: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiLine(bounds, @as([*c]const u8, @ptrCast(text))));
|
||||
}
|
||||
|
||||
/// Label control
|
||||
pub fn guiLabel(bounds: Rectangle, text: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiLabel(bounds, @as([*c]const u8, @ptrCast(text))));
|
||||
}
|
||||
|
||||
/// Button control, returns true when clicked
|
||||
pub fn guiButton(bounds: Rectangle, text: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiButton(bounds, @as([*c]const u8, @ptrCast(text))));
|
||||
}
|
||||
|
||||
/// Label button control, returns true when clicked
|
||||
pub fn guiLabelButton(bounds: Rectangle, text: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiLabelButton(bounds, @as([*c]const u8, @ptrCast(text))));
|
||||
}
|
||||
|
||||
/// Toggle Button control
|
||||
pub fn guiToggle(bounds: Rectangle, text: [:0]const u8, active: *bool) i32 {
|
||||
return @as(i32, cdef.GuiToggle(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]bool, @ptrCast(active))));
|
||||
}
|
||||
|
||||
/// Toggle Group control
|
||||
pub fn guiToggleGroup(bounds: Rectangle, text: [:0]const u8, active: *i32) i32 {
|
||||
return @as(i32, cdef.GuiToggleGroup(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(active))));
|
||||
}
|
||||
|
||||
/// Toggle Slider control
|
||||
pub fn guiToggleSlider(bounds: Rectangle, text: [:0]const u8, active: *i32) i32 {
|
||||
return @as(i32, cdef.GuiToggleSlider(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(active))));
|
||||
}
|
||||
|
||||
/// Check Box control, returns true when active
|
||||
pub fn guiCheckBox(bounds: Rectangle, text: [:0]const u8, checked: *bool) i32 {
|
||||
return @as(i32, cdef.GuiCheckBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]bool, @ptrCast(checked))));
|
||||
}
|
||||
|
||||
/// Combo Box control
|
||||
pub fn guiComboBox(bounds: Rectangle, text: [:0]const u8, active: *i32) i32 {
|
||||
return @as(i32, cdef.GuiComboBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(active))));
|
||||
}
|
||||
|
||||
/// Dropdown Box control
|
||||
pub fn guiDropdownBox(bounds: Rectangle, text: [:0]const u8, active: *i32, editMode: bool) i32 {
|
||||
return @as(i32, cdef.GuiDropdownBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(active)), editMode));
|
||||
}
|
||||
|
||||
/// Spinner control
|
||||
pub fn guiSpinner(bounds: Rectangle, text: [:0]const u8, value: *i32, minValue: i32, maxValue: i32, editMode: bool) i32 {
|
||||
return @as(i32, cdef.GuiSpinner(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(value)), @as(c_int, minValue), @as(c_int, maxValue), editMode));
|
||||
}
|
||||
|
||||
/// Value Box control, updates input text with numbers
|
||||
pub fn guiValueBox(bounds: Rectangle, text: [:0]const u8, value: *i32, minValue: i32, maxValue: i32, editMode: bool) i32 {
|
||||
return @as(i32, cdef.GuiValueBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(value)), @as(c_int, minValue), @as(c_int, maxValue), editMode));
|
||||
}
|
||||
|
||||
/// Value box control for float values
|
||||
pub fn guiValueBoxFloat(bounds: Rectangle, text: [:0]const u8, textValue: [:0]u8, value: *f32, editMode: bool) i32 {
|
||||
return @as(i32, cdef.GuiValueBoxFloat(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]u8, @ptrCast(textValue)), @as([*c]f32, @ptrCast(value)), editMode));
|
||||
}
|
||||
|
||||
/// Text Box control, updates input text
|
||||
pub fn guiTextBox(bounds: Rectangle, text: [:0]u8, textSize: i32, editMode: bool) i32 {
|
||||
return @as(i32, cdef.GuiTextBox(bounds, @as([*c]u8, @ptrCast(text)), @as(c_int, textSize), editMode));
|
||||
}
|
||||
|
||||
/// Slider control
|
||||
pub fn guiSlider(bounds: Rectangle, textLeft: [:0]const u8, textRight: [:0]const u8, value: *f32, minValue: f32, maxValue: f32) i32 {
|
||||
return @as(i32, cdef.GuiSlider(bounds, @as([*c]const u8, @ptrCast(textLeft)), @as([*c]const u8, @ptrCast(textRight)), @as([*c]f32, @ptrCast(value)), minValue, maxValue));
|
||||
}
|
||||
|
||||
/// Slider Bar control
|
||||
pub fn guiSliderBar(bounds: Rectangle, textLeft: [:0]const u8, textRight: [:0]const u8, value: *f32, minValue: f32, maxValue: f32) i32 {
|
||||
return @as(i32, cdef.GuiSliderBar(bounds, @as([*c]const u8, @ptrCast(textLeft)), @as([*c]const u8, @ptrCast(textRight)), @as([*c]f32, @ptrCast(value)), minValue, maxValue));
|
||||
}
|
||||
|
||||
/// Progress Bar control
|
||||
pub fn guiProgressBar(bounds: Rectangle, textLeft: [:0]const u8, textRight: [:0]const u8, value: *f32, minValue: f32, maxValue: f32) i32 {
|
||||
return @as(i32, cdef.GuiProgressBar(bounds, @as([*c]const u8, @ptrCast(textLeft)), @as([*c]const u8, @ptrCast(textRight)), @as([*c]f32, @ptrCast(value)), minValue, maxValue));
|
||||
}
|
||||
|
||||
/// Status Bar control, shows info text
|
||||
pub fn guiStatusBar(bounds: Rectangle, text: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiStatusBar(bounds, @as([*c]const u8, @ptrCast(text))));
|
||||
}
|
||||
|
||||
/// Dummy control for placeholders
|
||||
pub fn guiDummyRec(bounds: Rectangle, text: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiDummyRec(bounds, @as([*c]const u8, @ptrCast(text))));
|
||||
}
|
||||
|
||||
/// Grid control
|
||||
pub fn guiGrid(bounds: Rectangle, text: [:0]const u8, spacing: f32, subdivs: i32, mouseCell: *Vector2) i32 {
|
||||
return @as(i32, cdef.GuiGrid(bounds, @as([*c]const u8, @ptrCast(text)), spacing, @as(c_int, subdivs), @as([*c]Vector2, @ptrCast(mouseCell))));
|
||||
}
|
||||
|
||||
/// List View control
|
||||
pub fn guiListView(bounds: Rectangle, text: [:0]const u8, scrollIndex: *i32, active: *i32) i32 {
|
||||
return @as(i32, cdef.GuiListView(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active))));
|
||||
}
|
||||
|
||||
/// Message Box control, displays a message
|
||||
pub fn guiMessageBox(bounds: Rectangle, title: [:0]const u8, message: [:0]const u8, buttons: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiMessageBox(bounds, @as([*c]const u8, @ptrCast(title)), @as([*c]const u8, @ptrCast(message)), @as([*c]const u8, @ptrCast(buttons))));
|
||||
}
|
||||
|
||||
/// Text Input Box control, ask for text, supports secret
|
||||
pub fn guiTextInputBox(bounds: Rectangle, title: [:0]const u8, message: [:0]const u8, buttons: [:0]const u8, text: [:0]u8, textMaxSize: i32, secretViewActive: *bool) i32 {
|
||||
return @as(i32, cdef.GuiTextInputBox(bounds, @as([*c]const u8, @ptrCast(title)), @as([*c]const u8, @ptrCast(message)), @as([*c]const u8, @ptrCast(buttons)), @as([*c]u8, @ptrCast(text)), @as(c_int, textMaxSize), @as([*c]bool, @ptrCast(secretViewActive))));
|
||||
}
|
||||
|
||||
/// Color Picker control (multiple color controls)
|
||||
pub fn guiColorPicker(bounds: Rectangle, text: [:0]const u8, color: *Color) i32 {
|
||||
return @as(i32, cdef.GuiColorPicker(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]Color, @ptrCast(color))));
|
||||
}
|
||||
|
||||
/// Color Panel control
|
||||
pub fn guiColorPanel(bounds: Rectangle, text: [:0]const u8, color: *Color) i32 {
|
||||
return @as(i32, cdef.GuiColorPanel(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]Color, @ptrCast(color))));
|
||||
}
|
||||
|
||||
/// Color Bar Alpha control
|
||||
pub fn guiColorBarAlpha(bounds: Rectangle, text: [:0]const u8, alpha: *f32) i32 {
|
||||
return @as(i32, cdef.GuiColorBarAlpha(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]f32, @ptrCast(alpha))));
|
||||
}
|
||||
|
||||
/// Color Bar Hue control
|
||||
pub fn guiColorBarHue(bounds: Rectangle, text: [:0]const u8, value: *f32) i32 {
|
||||
return @as(i32, cdef.GuiColorBarHue(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]f32, @ptrCast(value))));
|
||||
}
|
||||
|
||||
/// Color Picker control that avoids conversion to RGB on each call (multiple color controls)
|
||||
pub fn guiColorPickerHSV(bounds: Rectangle, text: [:0]const u8, colorHsv: *Vector3) i32 {
|
||||
return @as(i32, cdef.GuiColorPickerHSV(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]Vector3, @ptrCast(colorHsv))));
|
||||
}
|
||||
|
||||
/// Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV()
|
||||
pub fn guiColorPanelHSV(bounds: Rectangle, text: [:0]const u8, colorHsv: *Vector3) i32 {
|
||||
return @as(i32, cdef.GuiColorPanelHSV(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]Vector3, @ptrCast(colorHsv))));
|
||||
}
|
||||
|
836
lib/raylib.zig
836
lib/raylib.zig
File diff suppressed because it is too large
Load Diff
152
lib/rlgl.zig
152
lib/rlgl.zig
@ -188,34 +188,42 @@ pub const RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR = @as(i32, 3);
|
||||
pub const RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT = @as(i32, 4);
|
||||
pub const RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 = @as(i32, 5);
|
||||
|
||||
/// Choose the current matrix to be transformed
|
||||
pub fn rlMatrixMode(mode: i32) void {
|
||||
cdef.rlMatrixMode(@as(c_int, mode));
|
||||
}
|
||||
|
||||
/// Push the current matrix to stack
|
||||
pub fn rlPushMatrix() void {
|
||||
cdef.rlPushMatrix();
|
||||
}
|
||||
|
||||
/// Pop latest inserted matrix from stack
|
||||
pub fn rlPopMatrix() void {
|
||||
cdef.rlPopMatrix();
|
||||
}
|
||||
|
||||
/// Reset current matrix to identity matrix
|
||||
pub fn rlLoadIdentity() void {
|
||||
cdef.rlLoadIdentity();
|
||||
}
|
||||
|
||||
/// Multiply the current matrix by a translation matrix
|
||||
pub fn rlTranslatef(x: f32, y: f32, z: f32) void {
|
||||
cdef.rlTranslatef(x, y, z);
|
||||
}
|
||||
|
||||
/// Multiply the current matrix by a rotation matrix
|
||||
pub fn rlRotatef(angle: f32, x: f32, y: f32, z: f32) void {
|
||||
cdef.rlRotatef(angle, x, y, z);
|
||||
}
|
||||
|
||||
/// Multiply the current matrix by a scaling matrix
|
||||
pub fn rlScalef(x: f32, y: f32, z: f32) void {
|
||||
cdef.rlScalef(x, y, z);
|
||||
}
|
||||
|
||||
/// Multiply the current matrix by another matrix
|
||||
pub fn rlMultMatrixf(matf: []const f32) void {
|
||||
cdef.rlMultMatrixf(@as([*c]const f32, @ptrCast(matf)));
|
||||
}
|
||||
@ -228,578 +236,722 @@ pub fn rlOrtho(left: f64, right: f64, bottom: f64, top: f64, znear: f64, zfar: f
|
||||
cdef.rlOrtho(left, right, bottom, top, znear, zfar);
|
||||
}
|
||||
|
||||
/// Set the viewport area
|
||||
pub fn rlViewport(x: i32, y: i32, width: i32, height: i32) void {
|
||||
cdef.rlViewport(@as(c_int, x), @as(c_int, y), @as(c_int, width), @as(c_int, height));
|
||||
}
|
||||
|
||||
/// Set clip planes distances
|
||||
pub fn rlSetClipPlanes(near: f64, far: f64) void {
|
||||
cdef.rlSetClipPlanes(near, far);
|
||||
}
|
||||
|
||||
/// Get cull plane distance near
|
||||
pub fn rlGetCullDistanceNear() f64 {
|
||||
return cdef.rlGetCullDistanceNear();
|
||||
}
|
||||
|
||||
/// Get cull plane distance far
|
||||
pub fn rlGetCullDistanceFar() f64 {
|
||||
return cdef.rlGetCullDistanceFar();
|
||||
}
|
||||
|
||||
/// Initialize drawing mode (how to organize vertex)
|
||||
pub fn rlBegin(mode: i32) void {
|
||||
cdef.rlBegin(@as(c_int, mode));
|
||||
}
|
||||
|
||||
/// Finish vertex providing
|
||||
pub fn rlEnd() void {
|
||||
cdef.rlEnd();
|
||||
}
|
||||
|
||||
/// Define one vertex (position) - 2 int
|
||||
pub fn rlVertex2i(x: i32, y: i32) void {
|
||||
cdef.rlVertex2i(@as(c_int, x), @as(c_int, y));
|
||||
}
|
||||
|
||||
/// Define one vertex (position) - 2 float
|
||||
pub fn rlVertex2f(x: f32, y: f32) void {
|
||||
cdef.rlVertex2f(x, y);
|
||||
}
|
||||
|
||||
/// Define one vertex (position) - 3 float
|
||||
pub fn rlVertex3f(x: f32, y: f32, z: f32) void {
|
||||
cdef.rlVertex3f(x, y, z);
|
||||
}
|
||||
|
||||
/// Define one vertex (texture coordinate) - 2 float
|
||||
pub fn rlTexCoord2f(x: f32, y: f32) void {
|
||||
cdef.rlTexCoord2f(x, y);
|
||||
}
|
||||
|
||||
/// Define one vertex (normal) - 3 float
|
||||
pub fn rlNormal3f(x: f32, y: f32, z: f32) void {
|
||||
cdef.rlNormal3f(x, y, z);
|
||||
}
|
||||
|
||||
/// Define one vertex (color) - 4 byte
|
||||
pub fn rlColor4ub(r: u8, g: u8, b: u8, a: u8) void {
|
||||
cdef.rlColor4ub(r, g, b, a);
|
||||
}
|
||||
|
||||
/// Define one vertex (color) - 3 float
|
||||
pub fn rlColor3f(x: f32, y: f32, z: f32) void {
|
||||
cdef.rlColor3f(x, y, z);
|
||||
}
|
||||
|
||||
/// Define one vertex (color) - 4 float
|
||||
pub fn rlColor4f(x: f32, y: f32, z: f32, w: f32) void {
|
||||
cdef.rlColor4f(x, y, z, w);
|
||||
}
|
||||
|
||||
/// Enable vertex array (VAO, if supported)
|
||||
pub fn rlEnableVertexArray(vaoId: u32) bool {
|
||||
return cdef.rlEnableVertexArray(@as(c_uint, vaoId));
|
||||
}
|
||||
|
||||
/// Disable vertex array (VAO, if supported)
|
||||
pub fn rlDisableVertexArray() void {
|
||||
cdef.rlDisableVertexArray();
|
||||
}
|
||||
|
||||
/// Enable vertex buffer (VBO)
|
||||
pub fn rlEnableVertexBuffer(id: u32) void {
|
||||
cdef.rlEnableVertexBuffer(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Disable vertex buffer (VBO)
|
||||
pub fn rlDisableVertexBuffer() void {
|
||||
cdef.rlDisableVertexBuffer();
|
||||
}
|
||||
|
||||
/// Enable vertex buffer element (VBO element)
|
||||
pub fn rlEnableVertexBufferElement(id: u32) void {
|
||||
cdef.rlEnableVertexBufferElement(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Disable vertex buffer element (VBO element)
|
||||
pub fn rlDisableVertexBufferElement() void {
|
||||
cdef.rlDisableVertexBufferElement();
|
||||
}
|
||||
|
||||
/// Enable vertex attribute index
|
||||
pub fn rlEnableVertexAttribute(index: u32) void {
|
||||
cdef.rlEnableVertexAttribute(@as(c_uint, index));
|
||||
}
|
||||
|
||||
/// Disable vertex attribute index
|
||||
pub fn rlDisableVertexAttribute(index: u32) void {
|
||||
cdef.rlDisableVertexAttribute(@as(c_uint, index));
|
||||
}
|
||||
|
||||
/// Enable attribute state pointer
|
||||
pub fn rlEnableStatePointer(vertexAttribType: i32, buffer: *anyopaque) void {
|
||||
cdef.rlEnableStatePointer(@as(c_int, vertexAttribType), buffer);
|
||||
}
|
||||
|
||||
/// Disable attribute state pointer
|
||||
pub fn rlDisableStatePointer(vertexAttribType: i32) void {
|
||||
cdef.rlDisableStatePointer(@as(c_int, vertexAttribType));
|
||||
}
|
||||
|
||||
/// Select and active a texture slot
|
||||
pub fn rlActiveTextureSlot(slot: i32) void {
|
||||
cdef.rlActiveTextureSlot(@as(c_int, slot));
|
||||
}
|
||||
|
||||
/// Enable texture
|
||||
pub fn rlEnableTexture(id: u32) void {
|
||||
cdef.rlEnableTexture(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Disable texture
|
||||
pub fn rlDisableTexture() void {
|
||||
cdef.rlDisableTexture();
|
||||
}
|
||||
|
||||
/// Enable texture cubemap
|
||||
pub fn rlEnableTextureCubemap(id: u32) void {
|
||||
cdef.rlEnableTextureCubemap(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Disable texture cubemap
|
||||
pub fn rlDisableTextureCubemap() void {
|
||||
cdef.rlDisableTextureCubemap();
|
||||
}
|
||||
|
||||
/// Set texture parameters (filter, wrap)
|
||||
pub fn rlTextureParameters(id: u32, param: i32, value: i32) void {
|
||||
cdef.rlTextureParameters(@as(c_uint, id), @as(c_int, param), @as(c_int, value));
|
||||
}
|
||||
|
||||
/// Set cubemap parameters (filter, wrap)
|
||||
pub fn rlCubemapParameters(id: u32, param: i32, value: i32) void {
|
||||
cdef.rlCubemapParameters(@as(c_uint, id), @as(c_int, param), @as(c_int, value));
|
||||
}
|
||||
|
||||
/// Enable shader program
|
||||
pub fn rlEnableShader(id: u32) void {
|
||||
cdef.rlEnableShader(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Disable shader program
|
||||
pub fn rlDisableShader() void {
|
||||
cdef.rlDisableShader();
|
||||
}
|
||||
|
||||
/// Enable render texture (fbo)
|
||||
pub fn rlEnableFramebuffer(id: u32) void {
|
||||
cdef.rlEnableFramebuffer(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Disable render texture (fbo), return to default framebuffer
|
||||
pub fn rlDisableFramebuffer() void {
|
||||
cdef.rlDisableFramebuffer();
|
||||
}
|
||||
|
||||
/// Get the currently active render texture (fbo), 0 for default framebuffer
|
||||
pub fn rlGetActiveFramebuffer() u32 {
|
||||
return @as(u32, cdef.rlGetActiveFramebuffer());
|
||||
}
|
||||
|
||||
/// Activate multiple draw color buffers
|
||||
pub fn rlActiveDrawBuffers(count: i32) void {
|
||||
cdef.rlActiveDrawBuffers(@as(c_int, count));
|
||||
}
|
||||
|
||||
/// Blit active framebuffer to main framebuffer
|
||||
pub fn rlBlitFramebuffer(srcX: i32, srcY: i32, srcWidth: i32, srcHeight: i32, dstX: i32, dstY: i32, dstWidth: i32, dstHeight: i32, bufferMask: i32) void {
|
||||
cdef.rlBlitFramebuffer(@as(c_int, srcX), @as(c_int, srcY), @as(c_int, srcWidth), @as(c_int, srcHeight), @as(c_int, dstX), @as(c_int, dstY), @as(c_int, dstWidth), @as(c_int, dstHeight), @as(c_int, bufferMask));
|
||||
}
|
||||
|
||||
/// Bind framebuffer (FBO)
|
||||
pub fn rlBindFramebuffer(target: u32, framebuffer: u32) void {
|
||||
cdef.rlBindFramebuffer(@as(c_uint, target), @as(c_uint, framebuffer));
|
||||
}
|
||||
|
||||
/// Enable color blending
|
||||
pub fn rlEnableColorBlend() void {
|
||||
cdef.rlEnableColorBlend();
|
||||
}
|
||||
|
||||
/// Disable color blending
|
||||
pub fn rlDisableColorBlend() void {
|
||||
cdef.rlDisableColorBlend();
|
||||
}
|
||||
|
||||
/// Enable depth test
|
||||
pub fn rlEnableDepthTest() void {
|
||||
cdef.rlEnableDepthTest();
|
||||
}
|
||||
|
||||
/// Disable depth test
|
||||
pub fn rlDisableDepthTest() void {
|
||||
cdef.rlDisableDepthTest();
|
||||
}
|
||||
|
||||
/// Enable depth write
|
||||
pub fn rlEnableDepthMask() void {
|
||||
cdef.rlEnableDepthMask();
|
||||
}
|
||||
|
||||
/// Disable depth write
|
||||
pub fn rlDisableDepthMask() void {
|
||||
cdef.rlDisableDepthMask();
|
||||
}
|
||||
|
||||
/// Enable backface culling
|
||||
pub fn rlEnableBackfaceCulling() void {
|
||||
cdef.rlEnableBackfaceCulling();
|
||||
}
|
||||
|
||||
/// Disable backface culling
|
||||
pub fn rlDisableBackfaceCulling() void {
|
||||
cdef.rlDisableBackfaceCulling();
|
||||
}
|
||||
|
||||
/// Color mask control
|
||||
pub fn rlColorMask(r: bool, g: bool, b: bool, a: bool) void {
|
||||
cdef.rlColorMask(r, g, b, a);
|
||||
}
|
||||
|
||||
/// Set face culling mode
|
||||
pub fn rlSetCullFace(mode: i32) void {
|
||||
cdef.rlSetCullFace(@as(c_int, mode));
|
||||
}
|
||||
|
||||
/// Enable scissor test
|
||||
pub fn rlEnableScissorTest() void {
|
||||
cdef.rlEnableScissorTest();
|
||||
}
|
||||
|
||||
/// Disable scissor test
|
||||
pub fn rlDisableScissorTest() void {
|
||||
cdef.rlDisableScissorTest();
|
||||
}
|
||||
|
||||
/// Scissor test
|
||||
pub fn rlScissor(x: i32, y: i32, width: i32, height: i32) void {
|
||||
cdef.rlScissor(@as(c_int, x), @as(c_int, y), @as(c_int, width), @as(c_int, height));
|
||||
}
|
||||
|
||||
/// Enable wire mode
|
||||
pub fn rlEnableWireMode() void {
|
||||
cdef.rlEnableWireMode();
|
||||
}
|
||||
|
||||
/// Enable point mode
|
||||
pub fn rlEnablePointMode() void {
|
||||
cdef.rlEnablePointMode();
|
||||
}
|
||||
|
||||
/// Disable wire mode ( and point ) maybe rename
|
||||
pub fn rlDisableWireMode() void {
|
||||
cdef.rlDisableWireMode();
|
||||
}
|
||||
|
||||
/// Set the line drawing width
|
||||
pub fn rlSetLineWidth(width: f32) void {
|
||||
cdef.rlSetLineWidth(width);
|
||||
}
|
||||
|
||||
/// Get the line drawing width
|
||||
pub fn rlGetLineWidth() f32 {
|
||||
return cdef.rlGetLineWidth();
|
||||
}
|
||||
|
||||
/// Enable line aliasing
|
||||
pub fn rlEnableSmoothLines() void {
|
||||
cdef.rlEnableSmoothLines();
|
||||
}
|
||||
|
||||
/// Disable line aliasing
|
||||
pub fn rlDisableSmoothLines() void {
|
||||
cdef.rlDisableSmoothLines();
|
||||
}
|
||||
|
||||
/// Enable stereo rendering
|
||||
pub fn rlEnableStereoRender() void {
|
||||
cdef.rlEnableStereoRender();
|
||||
}
|
||||
|
||||
/// Disable stereo rendering
|
||||
pub fn rlDisableStereoRender() void {
|
||||
cdef.rlDisableStereoRender();
|
||||
}
|
||||
|
||||
/// Check if stereo render is enabled
|
||||
pub fn rlIsStereoRenderEnabled() bool {
|
||||
return cdef.rlIsStereoRenderEnabled();
|
||||
}
|
||||
|
||||
/// Clear color buffer with color
|
||||
pub fn rlClearColor(r: u8, g: u8, b: u8, a: u8) void {
|
||||
cdef.rlClearColor(r, g, b, a);
|
||||
}
|
||||
|
||||
/// Clear used screen buffers (color and depth)
|
||||
pub fn rlClearScreenBuffers() void {
|
||||
cdef.rlClearScreenBuffers();
|
||||
}
|
||||
|
||||
/// Check and log OpenGL error codes
|
||||
pub fn rlCheckErrors() void {
|
||||
cdef.rlCheckErrors();
|
||||
}
|
||||
|
||||
/// Set blending mode
|
||||
pub fn rlSetBlendMode(mode: i32) void {
|
||||
cdef.rlSetBlendMode(@as(c_int, mode));
|
||||
}
|
||||
|
||||
/// Set blending mode factor and equation (using OpenGL factors)
|
||||
pub fn rlSetBlendFactors(glSrcFactor: i32, glDstFactor: i32, glEquation: i32) void {
|
||||
cdef.rlSetBlendFactors(@as(c_int, glSrcFactor), @as(c_int, glDstFactor), @as(c_int, glEquation));
|
||||
}
|
||||
|
||||
/// Set blending mode factors and equations separately (using OpenGL factors)
|
||||
pub fn rlSetBlendFactorsSeparate(glSrcRGB: i32, glDstRGB: i32, glSrcAlpha: i32, glDstAlpha: i32, glEqRGB: i32, glEqAlpha: i32) void {
|
||||
cdef.rlSetBlendFactorsSeparate(@as(c_int, glSrcRGB), @as(c_int, glDstRGB), @as(c_int, glSrcAlpha), @as(c_int, glDstAlpha), @as(c_int, glEqRGB), @as(c_int, glEqAlpha));
|
||||
}
|
||||
|
||||
/// Initialize rlgl (buffers, shaders, textures, states)
|
||||
pub fn rlglInit(width: i32, height: i32) void {
|
||||
cdef.rlglInit(@as(c_int, width), @as(c_int, height));
|
||||
}
|
||||
|
||||
/// De-initialize rlgl (buffers, shaders, textures)
|
||||
pub fn rlglClose() void {
|
||||
cdef.rlglClose();
|
||||
}
|
||||
|
||||
/// Load OpenGL extensions (loader function required)
|
||||
pub fn rlLoadExtensions(loader: *anyopaque) void {
|
||||
cdef.rlLoadExtensions(loader);
|
||||
}
|
||||
|
||||
/// Get current OpenGL version
|
||||
pub fn rlGetVersion() i32 {
|
||||
return @as(i32, cdef.rlGetVersion());
|
||||
}
|
||||
|
||||
/// Set current framebuffer width
|
||||
pub fn rlSetFramebufferWidth(width: i32) void {
|
||||
cdef.rlSetFramebufferWidth(@as(c_int, width));
|
||||
}
|
||||
|
||||
/// Get default framebuffer width
|
||||
pub fn rlGetFramebufferWidth() i32 {
|
||||
return @as(i32, cdef.rlGetFramebufferWidth());
|
||||
}
|
||||
|
||||
/// Set current framebuffer height
|
||||
pub fn rlSetFramebufferHeight(height: i32) void {
|
||||
cdef.rlSetFramebufferHeight(@as(c_int, height));
|
||||
}
|
||||
|
||||
/// Get default framebuffer height
|
||||
pub fn rlGetFramebufferHeight() i32 {
|
||||
return @as(i32, cdef.rlGetFramebufferHeight());
|
||||
}
|
||||
|
||||
/// Get default texture id
|
||||
pub fn rlGetTextureIdDefault() u32 {
|
||||
return @as(u32, cdef.rlGetTextureIdDefault());
|
||||
}
|
||||
|
||||
/// Get default shader id
|
||||
pub fn rlGetShaderIdDefault() u32 {
|
||||
return @as(u32, cdef.rlGetShaderIdDefault());
|
||||
}
|
||||
|
||||
/// Load a render batch system
|
||||
pub fn rlLoadRenderBatch(numBuffers: i32, bufferElements: i32) rlRenderBatch {
|
||||
return cdef.rlLoadRenderBatch(@as(c_int, numBuffers), @as(c_int, bufferElements));
|
||||
}
|
||||
|
||||
/// Unload render batch system
|
||||
pub fn rlUnloadRenderBatch(batch: rlRenderBatch) void {
|
||||
cdef.rlUnloadRenderBatch(batch);
|
||||
}
|
||||
|
||||
/// Draw render batch data (Update->Draw->Reset)
|
||||
pub fn rlDrawRenderBatch(batch: *rlRenderBatch) void {
|
||||
cdef.rlDrawRenderBatch(@as([*c]rlRenderBatch, @ptrCast(batch)));
|
||||
}
|
||||
|
||||
/// Set the active render batch for rlgl (NULL for default internal)
|
||||
pub fn rlSetRenderBatchActive(batch: *rlRenderBatch) void {
|
||||
cdef.rlSetRenderBatchActive(@as([*c]rlRenderBatch, @ptrCast(batch)));
|
||||
}
|
||||
|
||||
/// Update and draw internal render batch
|
||||
pub fn rlDrawRenderBatchActive() void {
|
||||
cdef.rlDrawRenderBatchActive();
|
||||
}
|
||||
|
||||
/// Check internal buffer overflow for a given number of vertex
|
||||
pub fn rlCheckRenderBatchLimit(vCount: i32) bool {
|
||||
return cdef.rlCheckRenderBatchLimit(@as(c_int, vCount));
|
||||
}
|
||||
|
||||
/// Set current texture for render batch and check buffers limits
|
||||
pub fn rlSetTexture(id: u32) void {
|
||||
cdef.rlSetTexture(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Load vertex array (vao) if supported
|
||||
pub fn rlLoadVertexArray() u32 {
|
||||
return @as(u32, cdef.rlLoadVertexArray());
|
||||
}
|
||||
|
||||
/// Load a vertex buffer object
|
||||
pub fn rlLoadVertexBuffer(buffer: *const anyopaque, size: i32, dynamic: bool) u32 {
|
||||
return @as(u32, cdef.rlLoadVertexBuffer(buffer, @as(c_int, size), dynamic));
|
||||
}
|
||||
|
||||
/// Load vertex buffer elements object
|
||||
pub fn rlLoadVertexBufferElement(buffer: *const anyopaque, size: i32, dynamic: bool) u32 {
|
||||
return @as(u32, cdef.rlLoadVertexBufferElement(buffer, @as(c_int, size), dynamic));
|
||||
}
|
||||
|
||||
/// Update vertex buffer object data on GPU buffer
|
||||
pub fn rlUpdateVertexBuffer(bufferId: u32, data: *const anyopaque, dataSize: i32, offset: i32) void {
|
||||
cdef.rlUpdateVertexBuffer(@as(c_uint, bufferId), data, @as(c_int, dataSize), @as(c_int, offset));
|
||||
}
|
||||
|
||||
/// Update vertex buffer elements data on GPU buffer
|
||||
pub fn rlUpdateVertexBufferElements(id: u32, data: *const anyopaque, dataSize: i32, offset: i32) void {
|
||||
cdef.rlUpdateVertexBufferElements(@as(c_uint, id), data, @as(c_int, dataSize), @as(c_int, offset));
|
||||
}
|
||||
|
||||
/// Unload vertex array (vao)
|
||||
pub fn rlUnloadVertexArray(vaoId: u32) void {
|
||||
cdef.rlUnloadVertexArray(@as(c_uint, vaoId));
|
||||
}
|
||||
|
||||
/// Unload vertex buffer object
|
||||
pub fn rlUnloadVertexBuffer(vboId: u32) void {
|
||||
cdef.rlUnloadVertexBuffer(@as(c_uint, vboId));
|
||||
}
|
||||
|
||||
/// Set vertex attribute data configuration
|
||||
pub fn rlSetVertexAttribute(index: u32, compSize: i32, ty: i32, normalized: bool, stride: i32, offset: i32) void {
|
||||
cdef.rlSetVertexAttribute(@as(c_uint, index), @as(c_int, compSize), @as(c_int, ty), normalized, @as(c_int, stride), @as(c_int, offset));
|
||||
}
|
||||
|
||||
/// Set vertex attribute data divisor
|
||||
pub fn rlSetVertexAttributeDivisor(index: u32, divisor: i32) void {
|
||||
cdef.rlSetVertexAttributeDivisor(@as(c_uint, index), @as(c_int, divisor));
|
||||
}
|
||||
|
||||
/// Set vertex attribute default value, when attribute to provided
|
||||
pub fn rlSetVertexAttributeDefault(locIndex: i32, value: *const anyopaque, attribType: i32, count: i32) void {
|
||||
cdef.rlSetVertexAttributeDefault(@as(c_int, locIndex), value, @as(c_int, attribType), @as(c_int, count));
|
||||
}
|
||||
|
||||
/// Draw vertex array (currently active vao)
|
||||
pub fn rlDrawVertexArray(offset: i32, count: i32) void {
|
||||
cdef.rlDrawVertexArray(@as(c_int, offset), @as(c_int, count));
|
||||
}
|
||||
|
||||
/// Draw vertex array elements
|
||||
pub fn rlDrawVertexArrayElements(offset: i32, count: i32, buffer: ?*const anyopaque) void {
|
||||
cdef.rlDrawVertexArrayElements(@as(c_int, offset), @as(c_int, count), buffer);
|
||||
}
|
||||
|
||||
/// Draw vertex array (currently active vao) with instancing
|
||||
pub fn rlDrawVertexArrayInstanced(offset: i32, count: i32, instances: i32) void {
|
||||
cdef.rlDrawVertexArrayInstanced(@as(c_int, offset), @as(c_int, count), @as(c_int, instances));
|
||||
}
|
||||
|
||||
/// Draw vertex array elements with instancing
|
||||
pub fn rlDrawVertexArrayElementsInstanced(offset: i32, count: i32, buffer: ?*const anyopaque, instances: i32) void {
|
||||
cdef.rlDrawVertexArrayElementsInstanced(@as(c_int, offset), @as(c_int, count), buffer, @as(c_int, instances));
|
||||
}
|
||||
|
||||
/// Load texture data
|
||||
pub fn rlLoadTexture(data: *const anyopaque, width: i32, height: i32, format: i32, mipmapCount: i32) u32 {
|
||||
return @as(u32, cdef.rlLoadTexture(data, @as(c_int, width), @as(c_int, height), @as(c_int, format), @as(c_int, mipmapCount)));
|
||||
}
|
||||
|
||||
/// Load depth texture/renderbuffer (to be attached to fbo)
|
||||
pub fn rlLoadTextureDepth(width: i32, height: i32, useRenderBuffer: bool) u32 {
|
||||
return @as(u32, cdef.rlLoadTextureDepth(@as(c_int, width), @as(c_int, height), useRenderBuffer));
|
||||
}
|
||||
|
||||
/// Load texture cubemap data
|
||||
pub fn rlLoadTextureCubemap(data: *const anyopaque, size: i32, format: i32) u32 {
|
||||
return @as(u32, cdef.rlLoadTextureCubemap(data, @as(c_int, size), @as(c_int, format)));
|
||||
}
|
||||
|
||||
/// Update texture with new data on GPU
|
||||
pub fn rlUpdateTexture(id: u32, offsetX: i32, offsetY: i32, width: i32, height: i32, format: i32, data: *const anyopaque) void {
|
||||
cdef.rlUpdateTexture(@as(c_uint, id), @as(c_int, offsetX), @as(c_int, offsetY), @as(c_int, width), @as(c_int, height), @as(c_int, format), data);
|
||||
}
|
||||
|
||||
/// Get OpenGL internal formats
|
||||
pub fn rlGetGlTextureFormats(format: i32, glInternalFormat: *u32, glFormat: *u32, glType: *u32) void {
|
||||
cdef.rlGetGlTextureFormats(@as(c_int, format), @as([*c]c_uint, @ptrCast(glInternalFormat)), @as([*c]c_uint, @ptrCast(glFormat)), @as([*c]c_uint, @ptrCast(glType)));
|
||||
}
|
||||
|
||||
/// Get name string for pixel format
|
||||
pub fn rlGetPixelFormatName(format: u32) [:0]const u8 {
|
||||
return std.mem.span(cdef.rlGetPixelFormatName(@as(c_uint, format)));
|
||||
}
|
||||
|
||||
/// Unload texture from GPU memory
|
||||
pub fn rlUnloadTexture(id: u32) void {
|
||||
cdef.rlUnloadTexture(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Generate mipmap data for selected texture
|
||||
pub fn rlGenTextureMipmaps(id: u32, width: i32, height: i32, format: i32, mipmaps: *i32) void {
|
||||
cdef.rlGenTextureMipmaps(@as(c_uint, id), @as(c_int, width), @as(c_int, height), @as(c_int, format), @as([*c]c_int, @ptrCast(mipmaps)));
|
||||
}
|
||||
|
||||
/// Read texture pixel data
|
||||
pub fn rlReadTexturePixels(id: u32, width: i32, height: i32, format: i32) *anyopaque {
|
||||
return cdef.rlReadTexturePixels(@as(c_uint, id), @as(c_int, width), @as(c_int, height), @as(c_int, format));
|
||||
}
|
||||
|
||||
/// Read screen pixel data (color buffer)
|
||||
pub fn rlReadScreenPixels(width: i32, height: i32) [:0]u8 {
|
||||
return std.mem.span(cdef.rlReadScreenPixels(@as(c_int, width), @as(c_int, height)));
|
||||
}
|
||||
|
||||
/// Load an empty framebuffer
|
||||
pub fn rlLoadFramebuffer() u32 {
|
||||
return @as(u32, cdef.rlLoadFramebuffer());
|
||||
}
|
||||
|
||||
/// Attach texture/renderbuffer to a framebuffer
|
||||
pub fn rlFramebufferAttach(fboId: u32, texId: u32, attachType: i32, texType: i32, mipLevel: i32) void {
|
||||
cdef.rlFramebufferAttach(@as(c_uint, fboId), @as(c_uint, texId), @as(c_int, attachType), @as(c_int, texType), @as(c_int, mipLevel));
|
||||
}
|
||||
|
||||
/// Verify framebuffer is complete
|
||||
pub fn rlFramebufferComplete(id: u32) bool {
|
||||
return cdef.rlFramebufferComplete(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Delete framebuffer from GPU
|
||||
pub fn rlUnloadFramebuffer(id: u32) void {
|
||||
cdef.rlUnloadFramebuffer(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Load shader from code strings
|
||||
pub fn rlLoadShaderCode(vsCode: [:0]const u8, fsCode: [:0]const u8) u32 {
|
||||
return @as(u32, cdef.rlLoadShaderCode(@as([*c]const u8, @ptrCast(vsCode)), @as([*c]const u8, @ptrCast(fsCode))));
|
||||
}
|
||||
|
||||
/// Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER)
|
||||
pub fn rlCompileShader(shaderCode: [:0]const u8, ty: i32) u32 {
|
||||
return @as(u32, cdef.rlCompileShader(@as([*c]const u8, @ptrCast(shaderCode)), @as(c_int, ty)));
|
||||
}
|
||||
|
||||
/// Load custom shader program
|
||||
pub fn rlLoadShaderProgram(vShaderId: u32, fShaderId: u32) u32 {
|
||||
return @as(u32, cdef.rlLoadShaderProgram(@as(c_uint, vShaderId), @as(c_uint, fShaderId)));
|
||||
}
|
||||
|
||||
/// Unload shader program
|
||||
pub fn rlUnloadShaderProgram(id: u32) void {
|
||||
cdef.rlUnloadShaderProgram(@as(c_uint, id));
|
||||
}
|
||||
|
||||
/// Get shader location uniform
|
||||
pub fn rlGetLocationUniform(shaderId: u32, uniformName: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.rlGetLocationUniform(@as(c_uint, shaderId), @as([*c]const u8, @ptrCast(uniformName))));
|
||||
}
|
||||
|
||||
/// Get shader location attribute
|
||||
pub fn rlGetLocationAttrib(shaderId: u32, attribName: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.rlGetLocationAttrib(@as(c_uint, shaderId), @as([*c]const u8, @ptrCast(attribName))));
|
||||
}
|
||||
|
||||
/// Set shader value uniform
|
||||
pub fn rlSetUniform(locIndex: i32, value: *const anyopaque, uniformType: i32, count: i32) void {
|
||||
cdef.rlSetUniform(@as(c_int, locIndex), value, @as(c_int, uniformType), @as(c_int, count));
|
||||
}
|
||||
|
||||
/// Set shader value matrix
|
||||
pub fn rlSetUniformMatrix(locIndex: i32, mat: Matrix) void {
|
||||
cdef.rlSetUniformMatrix(@as(c_int, locIndex), mat);
|
||||
}
|
||||
|
||||
/// Set shader value sampler
|
||||
pub fn rlSetUniformSampler(locIndex: i32, textureId: u32) void {
|
||||
cdef.rlSetUniformSampler(@as(c_int, locIndex), @as(c_uint, textureId));
|
||||
}
|
||||
|
||||
/// Set shader currently active (id and locations)
|
||||
pub fn rlSetShader(id: u32, locs: []i32) void {
|
||||
cdef.rlSetShader(@as(c_uint, id), @as([*c]c_int, @ptrCast(locs)));
|
||||
}
|
||||
|
||||
/// Load compute shader program
|
||||
pub fn rlLoadComputeShaderProgram(shaderId: u32) u32 {
|
||||
return @as(u32, cdef.rlLoadComputeShaderProgram(@as(c_uint, shaderId)));
|
||||
}
|
||||
|
||||
/// Dispatch compute shader (equivalent to *draw* for graphics pipeline)
|
||||
pub fn rlComputeShaderDispatch(groupX: u32, groupY: u32, groupZ: u32) void {
|
||||
cdef.rlComputeShaderDispatch(@as(c_uint, groupX), @as(c_uint, groupY), @as(c_uint, groupZ));
|
||||
}
|
||||
|
||||
/// Load shader storage buffer object (SSBO)
|
||||
pub fn rlLoadShaderBuffer(size: u32, data: *const anyopaque, usageHint: i32) u32 {
|
||||
return @as(u32, cdef.rlLoadShaderBuffer(@as(c_uint, size), data, @as(c_int, usageHint)));
|
||||
}
|
||||
|
||||
/// Unload shader storage buffer object (SSBO)
|
||||
pub fn rlUnloadShaderBuffer(ssboId: u32) void {
|
||||
cdef.rlUnloadShaderBuffer(@as(c_uint, ssboId));
|
||||
}
|
||||
|
||||
/// Update SSBO buffer data
|
||||
pub fn rlUpdateShaderBuffer(id: u32, data: *const anyopaque, dataSize: u32, offset: u32) void {
|
||||
cdef.rlUpdateShaderBuffer(@as(c_uint, id), data, @as(c_uint, dataSize), @as(c_uint, offset));
|
||||
}
|
||||
|
||||
/// Bind SSBO buffer
|
||||
pub fn rlBindShaderBuffer(id: u32, index: u32) void {
|
||||
cdef.rlBindShaderBuffer(@as(c_uint, id), @as(c_uint, index));
|
||||
}
|
||||
|
||||
/// Read SSBO buffer data (GPU->CPU)
|
||||
pub fn rlReadShaderBuffer(id: u32, dest: *anyopaque, count: u32, offset: u32) void {
|
||||
cdef.rlReadShaderBuffer(@as(c_uint, id), dest, @as(c_uint, count), @as(c_uint, offset));
|
||||
}
|
||||
|
||||
/// Copy SSBO data between buffers
|
||||
pub fn rlCopyShaderBuffer(destId: u32, srcId: u32, destOffset: u32, srcOffset: u32, count: u32) void {
|
||||
cdef.rlCopyShaderBuffer(@as(c_uint, destId), @as(c_uint, srcId), @as(c_uint, destOffset), @as(c_uint, srcOffset), @as(c_uint, count));
|
||||
}
|
||||
|
||||
/// Get SSBO buffer size
|
||||
pub fn rlGetShaderBufferSize(id: u32) u32 {
|
||||
return @as(u32, cdef.rlGetShaderBufferSize(@as(c_uint, id)));
|
||||
}
|
||||
|
||||
/// Bind image texture
|
||||
pub fn rlBindImageTexture(id: u32, index: u32, format: i32, readonly: bool) void {
|
||||
cdef.rlBindImageTexture(@as(c_uint, id), @as(c_uint, index), @as(c_int, format), readonly);
|
||||
}
|
||||
|
||||
/// Get internal modelview matrix
|
||||
pub fn rlGetMatrixModelview() Matrix {
|
||||
return cdef.rlGetMatrixModelview();
|
||||
}
|
||||
|
||||
/// Get internal projection matrix
|
||||
pub fn rlGetMatrixProjection() Matrix {
|
||||
return cdef.rlGetMatrixProjection();
|
||||
}
|
||||
|
||||
/// Get internal accumulated transform matrix
|
||||
pub fn rlGetMatrixTransform() Matrix {
|
||||
return cdef.rlGetMatrixTransform();
|
||||
}
|
||||
|
||||
/// Get internal projection matrix for stereo render (selected eye)
|
||||
pub fn rlGetMatrixProjectionStereo(eye: i32) Matrix {
|
||||
return cdef.rlGetMatrixProjectionStereo(@as(c_int, eye));
|
||||
}
|
||||
|
||||
/// Get internal view offset matrix for stereo render (selected eye)
|
||||
pub fn rlGetMatrixViewOffsetStereo(eye: i32) Matrix {
|
||||
return cdef.rlGetMatrixViewOffsetStereo(@as(c_int, eye));
|
||||
}
|
||||
|
||||
/// Set a custom projection matrix (replaces internal projection matrix)
|
||||
pub fn rlSetMatrixProjection(proj: Matrix) void {
|
||||
cdef.rlSetMatrixProjection(proj);
|
||||
}
|
||||
|
||||
/// Set a custom modelview matrix (replaces internal modelview matrix)
|
||||
pub fn rlSetMatrixModelview(view: Matrix) void {
|
||||
cdef.rlSetMatrixModelview(view);
|
||||
}
|
||||
|
||||
/// Set eyes projection matrices for stereo rendering
|
||||
pub fn rlSetMatrixProjectionStereo(right: Matrix, left: Matrix) void {
|
||||
cdef.rlSetMatrixProjectionStereo(right, left);
|
||||
}
|
||||
|
||||
/// Set eyes view offsets matrices for stereo rendering
|
||||
pub fn rlSetMatrixViewOffsetStereo(right: Matrix, left: Matrix) void {
|
||||
cdef.rlSetMatrixViewOffsetStereo(right, left);
|
||||
}
|
||||
|
||||
/// Load and draw a cube
|
||||
pub fn rlLoadDrawCube() void {
|
||||
cdef.rlLoadDrawCube();
|
||||
}
|
||||
|
||||
/// Load and draw a quad
|
||||
pub fn rlLoadDrawQuad() void {
|
||||
cdef.rlLoadDrawQuad();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user