Bump raylib to master (#239, #243, #249)

This commit is contained in:
Nikolas 2025-06-27 15:00:11 +02:00
parent 97cb212bf0
commit 5013830647
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784
7 changed files with 62 additions and 50 deletions

View File

@ -30,6 +30,8 @@ fn getRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
.shared = options.shared,
.linux_display_backend = options.linux_display_backend,
.opengl_version = options.opengl_version,
.android_api_version = options.android_api_version,
.android_ndk = options.android_ndk
});
const raylib = raylib_dep.artifact("raylib");
@ -39,7 +41,7 @@ fn getRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
.optimize = optimize,
});
rl.addRaygui(b, raylib, raygui_dep);
rl.addRaygui(b, raylib, raygui_dep, options);
b.installArtifact(raylib);
return raylib;

View File

@ -4,8 +4,8 @@
.fingerprint = 0xc4cfa8c610114f28,
.dependencies = .{
.raylib = .{
.url = "git+https://github.com/raysan5/raylib?ref=master#f5c96302d5623950dccdca31f8dd66d6d633dbd1",
.hash = "raylib-5.5.0-whq8uFV0zQA9NXxhpYFZk_yHW6xzg5eKGmOtMJ2DOTdU",
.url = "git+https://github.com/raysan5/raylib?ref=master#bdda18656b301303b711785db48ac311655bb3d9",
.hash = "raylib-5.5.0-whq8uExcNgQBBys4-PIIEqPuWO-MpfOJkwiM4Q1nLXVN",
},
.raygui = .{
.url = "git+https://github.com/raysan5/raygui#1536ae35c7b42d863135f4181fd2a225e531f68b",

View File

@ -192,8 +192,8 @@ pub const rl_default_batch_drawcalls = @as(i32, 256);
pub const rl_default_batch_max_texture_units = @as(i32, 4);
pub const rl_max_matrix_stack_size = @as(i32, 32);
pub const rl_max_shader_locations = @as(i32, 32);
pub const rl_cull_distance_near = @as(f64, 0.01);
pub const rl_cull_distance_far = @as(f64, 1000.0);
pub const rl_cull_distance_near = @as(f64, 0.05);
pub const rl_cull_distance_far = @as(f64, 4000.0);
pub const rl_texture_wrap_s = @as(i32, 0x2802);
pub const rl_texture_wrap_t = @as(i32, 0x2803);
pub const rl_texture_mag_filter = @as(i32, 0x2800);

View File

@ -123,7 +123,7 @@ pub extern "c" fn SaveFileData(fileName: [*c]const u8, data: *anyopaque, dataSiz
pub extern "c" fn ExportDataAsCode(data: [*c]const u8, dataSize: c_int, fileName: [*c]const u8) bool;
pub extern "c" fn LoadFileText(fileName: [*c]const u8) [*c]u8;
pub extern "c" fn UnloadFileText(text: [*c]u8) void;
pub extern "c" fn SaveFileText(fileName: [*c]const u8, text: [*c]u8) bool;
pub extern "c" fn SaveFileText(fileName: [*c]const u8, text: [*c]const u8) bool;
pub extern "c" fn FileExists(fileName: [*c]const u8) bool;
pub extern "c" fn DirectoryExists(dirPath: [*c]const u8) bool;
pub extern "c" fn IsFileExtension(fileName: [*c]const u8, ext: [*c]const u8) bool;
@ -149,7 +149,7 @@ pub extern "c" fn GetFileModTime(fileName: [*c]const u8) c_long;
pub extern "c" fn CompressData(data: [*c]const u8, dataSize: c_int, compDataSize: [*c]c_int) [*c]u8;
pub extern "c" fn DecompressData(compData: [*c]const u8, compDataSize: c_int, dataSize: [*c]c_int) [*c]u8;
pub extern "c" fn EncodeDataBase64(data: [*c]const u8, dataSize: c_int, outputSize: [*c]c_int) [*c]u8;
pub extern "c" fn DecodeDataBase64(data: [*c]const u8, outputSize: [*c]c_int) [*c]u8;
pub extern "c" fn DecodeDataBase64(text: [*c]const u8, outputSize: [*c]c_int) [*c]u8;
pub extern "c" fn ComputeCRC32(data: [*c]u8, dataSize: c_int) c_uint;
pub extern "c" fn ComputeMD5(data: [*c]u8, dataSize: c_int) [*c]c_uint;
pub extern "c" fn ComputeSHA1(data: [*c]u8, dataSize: c_int) [*c]c_uint;
@ -228,7 +228,9 @@ pub extern "c" fn DrawCircleV(center: rl.Vector2, radius: f32, color: rl.Color)
pub extern "c" fn DrawCircleLines(centerX: c_int, centerY: c_int, radius: f32, color: rl.Color) void;
pub extern "c" fn DrawCircleLinesV(center: rl.Vector2, radius: f32, color: rl.Color) void;
pub extern "c" fn DrawEllipse(centerX: c_int, centerY: c_int, radiusH: f32, radiusV: f32, color: rl.Color) void;
pub extern "c" fn DrawEllipseV(center: rl.Vector2, radiusH: f32, radiusV: f32, color: rl.Color) void;
pub extern "c" fn DrawEllipseLines(centerX: c_int, centerY: c_int, radiusH: f32, radiusV: f32, color: rl.Color) void;
pub extern "c" fn DrawEllipseLinesV(center: rl.Vector2, radiusH: f32, radiusV: f32, color: rl.Color) void;
pub extern "c" fn DrawRing(center: rl.Vector2, innerRadius: f32, outerRadius: f32, startAngle: f32, endAngle: f32, segments: c_int, color: rl.Color) void;
pub extern "c" fn DrawRingLines(center: rl.Vector2, innerRadius: f32, outerRadius: f32, startAngle: f32, endAngle: f32, segments: c_int, color: rl.Color) void;
pub extern "c" fn DrawRectangle(posX: c_int, posY: c_int, width: c_int, height: c_int, color: rl.Color) void;
@ -237,7 +239,7 @@ pub extern "c" fn DrawRectangleRec(rec: rl.Rectangle, color: rl.Color) void;
pub extern "c" fn DrawRectanglePro(rec: rl.Rectangle, origin: rl.Vector2, rotation: f32, color: rl.Color) void;
pub extern "c" fn DrawRectangleGradientV(posX: c_int, posY: c_int, width: c_int, height: c_int, top: rl.Color, bottom: rl.Color) void;
pub extern "c" fn DrawRectangleGradientH(posX: c_int, posY: c_int, width: c_int, height: c_int, left: rl.Color, right: rl.Color) void;
pub extern "c" fn DrawRectangleGradientEx(rec: rl.Rectangle, topLeft: rl.Color, bottomLeft: rl.Color, topRight: rl.Color, bottomRight: rl.Color) void;
pub extern "c" fn DrawRectangleGradientEx(rec: rl.Rectangle, topLeft: rl.Color, bottomLeft: rl.Color, bottomRight: rl.Color, topRight: rl.Color) void;
pub extern "c" fn DrawRectangleLines(posX: c_int, posY: c_int, width: c_int, height: c_int, color: rl.Color) void;
pub extern "c" fn DrawRectangleLinesEx(rec: rl.Rectangle, lineThick: f32, color: rl.Color) void;
pub extern "c" fn DrawRectangleRounded(rec: rl.Rectangle, roundness: f32, segments: c_int, color: rl.Color) void;
@ -350,8 +352,8 @@ pub extern "c" fn ImageDrawRectangleLines(dst: [*c]rl.Image, rec: rl.Rectangle,
pub extern "c" fn ImageDrawTriangle(dst: [*c]rl.Image, v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, color: rl.Color) void;
pub extern "c" fn ImageDrawTriangleEx(dst: [*c]rl.Image, v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, c1: rl.Color, c2: rl.Color, c3: rl.Color) void;
pub extern "c" fn ImageDrawTriangleLines(dst: [*c]rl.Image, v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, color: rl.Color) void;
pub extern "c" fn ImageDrawTriangleFan(dst: [*c]rl.Image, points: [*c]rl.Vector2, pointCount: c_int, color: rl.Color) void;
pub extern "c" fn ImageDrawTriangleStrip(dst: [*c]rl.Image, points: [*c]rl.Vector2, pointCount: c_int, color: rl.Color) void;
pub extern "c" fn ImageDrawTriangleFan(dst: [*c]rl.Image, points: [*c]const rl.Vector2, pointCount: c_int, color: rl.Color) void;
pub extern "c" fn ImageDrawTriangleStrip(dst: [*c]rl.Image, points: [*c]const rl.Vector2, pointCount: c_int, color: rl.Color) void;
pub extern "c" fn ImageDraw(dst: [*c]rl.Image, src: rl.Image, srcRec: rl.Rectangle, dstRec: rl.Rectangle, tint: rl.Color) void;
pub extern "c" fn ImageDrawText(dst: [*c]rl.Image, text: [*c]const u8, posX: c_int, posY: c_int, fontSize: c_int, color: rl.Color) void;
pub extern "c" fn ImageDrawTextEx(dst: [*c]rl.Image, font: rl.Font, text: [*c]const u8, position: rl.Vector2, fontSize: f32, spacing: f32, tint: rl.Color) void;

24
lib/raylib.h vendored
View File

@ -743,7 +743,7 @@ typedef enum {
GAMEPAD_BUTTON_RIGHT_THUMB // Gamepad joystick pressed button right
} GamepadButton;
// Gamepad axis
// Gamepad axes
typedef enum {
GAMEPAD_AXIS_LEFT_X = 0, // Gamepad left stick X axis
GAMEPAD_AXIS_LEFT_Y = 1, // Gamepad left stick Y axis
@ -954,7 +954,7 @@ typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args);
typedef unsigned char *(*LoadFileDataCallback)(const char *fileName, int *dataSize); // FileIO: Load binary data
typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, int dataSize); // FileIO: Save binary data
typedef char *(*LoadFileTextCallback)(const char *fileName); // FileIO: Load text data
typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileIO: Save text data
typedef bool (*SaveFileTextCallback)(const char *fileName, const char *text); // FileIO: Save text data
//------------------------------------------------------------------------------------
// Global Variables Definition
@ -987,7 +987,7 @@ RLAPI void ToggleFullscreen(void); // Toggle wind
RLAPI void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed, resizes window to match monitor resolution
RLAPI void MaximizeWindow(void); // Set window state: maximized, if resizable
RLAPI void MinimizeWindow(void); // Set window state: minimized, if resizable
RLAPI void RestoreWindow(void); // Set window state: not minimized/maximized
RLAPI void RestoreWindow(void); // Restore window from being minimized/maximized
RLAPI void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit)
RLAPI void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit)
RLAPI void SetWindowTitle(const char *title); // Set title for window
@ -1123,7 +1123,7 @@ RLAPI bool SaveFileData(const char *fileName, void *data, int dataSize); // Save
RLAPI bool ExportDataAsCode(const unsigned char *data, int dataSize, const char *fileName); // Export data to code (.h), returns true on success
RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string
RLAPI void UnloadFileText(char *text); // Unload file text data allocated by LoadFileText()
RLAPI bool SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success
RLAPI bool SaveFileText(const char *fileName, const char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success
//------------------------------------------------------------------
// File system functions
@ -1153,8 +1153,8 @@ RLAPI long GetFileModTime(const char *fileName); // Get file mo
// Compression/Encoding functionality
RLAPI unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDataSize); // Compress data (DEFLATE algorithm), memory must be MemFree()
RLAPI unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree()
RLAPI char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string, memory must be MemFree()
RLAPI unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree()
RLAPI char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string (includes NULL terminator), memory must be MemFree()
RLAPI unsigned char *DecodeDataBase64(const char *text, int *outputSize); // Decode Base64 string (expected NULL terminated), memory must be MemFree()
RLAPI unsigned int ComputeCRC32(unsigned char *data, int dataSize); // Compute CRC32 hash code
RLAPI unsigned int *ComputeMD5(unsigned char *data, int dataSize); // Compute MD5 hash code, returns static int[4] (16 bytes)
RLAPI unsigned int *ComputeSHA1(unsigned char *data, int dataSize); // Compute SHA1 hash code, returns static int[5] (20 bytes)
@ -1192,8 +1192,8 @@ RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if a game
RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once
RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed
RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
RLAPI int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis
RLAPI int GetGamepadAxisCount(int gamepad); // Get axis count for a gamepad
RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get movement value for a gamepad axis
RLAPI int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Set gamepad vibration for both motors (duration in seconds)
@ -1264,7 +1264,9 @@ RLAPI void DrawCircleV(Vector2 center, float radius, Color color);
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
RLAPI void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse (Vector version)
RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
RLAPI void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color); // Draw ellipse outline (Vector version)
RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring
RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
@ -1273,7 +1275,7 @@ RLAPI void DrawRectangleRec(Rectangle rec, Color color);
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight); // Draw a gradient-filled rectangle with custom vertex colors
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color bottomRight, Color topRight); // Draw a gradient-filled rectangle with custom vertex colors
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
@ -1406,8 +1408,8 @@ RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color c
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
RLAPI void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
RLAPI void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
RLAPI void ImageDrawTriangleStrip(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
RLAPI void ImageDrawTriangleFan(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)

View File

@ -2540,7 +2540,7 @@ pub fn minimizeWindow() void {
cdef.MinimizeWindow();
}
/// Set window state: not minimized/maximized
/// Restore window from being minimized/maximized
pub fn restoreWindow() void {
cdef.RestoreWindow();
}
@ -3029,8 +3029,8 @@ pub fn unloadFileText(text: [:0]u8) void {
}
/// Save text data to file (write), string must be '\0' terminated, returns true on success
pub fn saveFileText(fileName: [:0]const u8, text: [:0]u8) bool {
return cdef.SaveFileText(@as([*c]const u8, @ptrCast(fileName)), @as([*c]u8, @ptrCast(text)));
pub fn saveFileText(fileName: [:0]const u8, text: [:0]const u8) bool {
return cdef.SaveFileText(@as([*c]const u8, @ptrCast(fileName)), @as([*c]const u8, @ptrCast(text)));
}
/// Check if file exists
@ -3159,7 +3159,7 @@ pub fn decompressData(compData: []const u8, compDataSize: i32) RaylibError![]u8
return _ptr[0..@as(usize, @intCast(_len))];
}
/// Encode data to Base64 string, memory must be MemFree()
/// Encode data to Base64 string (includes NULL terminator), memory must be MemFree()
pub fn encodeDataBase64(data: []const u8, dataSize: i32) RaylibError![]u8 {
var _len: i32 = 0;
const _ptr = cdef.EncodeDataBase64(@as([*c]const u8, @ptrCast(data)), @as(c_int, dataSize), @as([*c]c_int, @ptrCast(&_len)));
@ -3167,10 +3167,10 @@ pub fn encodeDataBase64(data: []const u8, dataSize: i32) RaylibError![]u8 {
return _ptr[0..@as(usize, @intCast(_len))];
}
/// Decode Base64 string data, memory must be MemFree()
pub fn decodeDataBase64(data: []const u8) RaylibError![]u8 {
/// Decode Base64 string (expected NULL terminated), memory must be MemFree()
pub fn decodeDataBase64(text: []const u8) RaylibError![]u8 {
var _len: i32 = 0;
const _ptr = cdef.DecodeDataBase64(@as([*c]const u8, @ptrCast(data)), @as([*c]c_int, @ptrCast(&_len)));
const _ptr = cdef.DecodeDataBase64(@as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(&_len)));
if (_ptr == 0) return RaylibError.DecodeDataBase64;
return _ptr[0..@as(usize, @intCast(_len))];
}
@ -3295,12 +3295,12 @@ pub fn getGamepadButtonPressed() GamepadButton {
return cdef.GetGamepadButtonPressed();
}
/// Get gamepad axis count for a gamepad
/// Get axis count for a gamepad
pub fn getGamepadAxisCount(gamepad: i32) i32 {
return @as(i32, cdef.GetGamepadAxisCount(@as(c_int, gamepad)));
}
/// Get axis movement value for a gamepad axis
/// Get movement value for a gamepad axis
pub fn getGamepadAxisMovement(gamepad: i32, axis: GamepadAxis) f32 {
return cdef.GetGamepadAxisMovement(@as(c_int, gamepad), axis);
}
@ -3545,11 +3545,21 @@ pub fn drawEllipse(centerX: i32, centerY: i32, radiusH: f32, radiusV: f32, color
cdef.DrawEllipse(@as(c_int, centerX), @as(c_int, centerY), radiusH, radiusV, color);
}
/// Draw ellipse (Vector version)
pub fn drawEllipseV(center: Vector2, radiusH: f32, radiusV: f32, color: Color) void {
cdef.DrawEllipseV(center, radiusH, radiusV, color);
}
/// Draw ellipse outline
pub fn drawEllipseLines(centerX: i32, centerY: i32, radiusH: f32, radiusV: f32, color: Color) void {
cdef.DrawEllipseLines(@as(c_int, centerX), @as(c_int, centerY), radiusH, radiusV, color);
}
/// Draw ellipse outline (Vector version)
pub fn drawEllipseLinesV(center: Vector2, radiusH: f32, radiusV: f32, color: Color) void {
cdef.DrawEllipseLinesV(center, radiusH, radiusV, color);
}
/// Draw ring
pub fn drawRing(center: Vector2, innerRadius: f32, outerRadius: f32, startAngle: f32, endAngle: f32, segments: i32, color: Color) void {
cdef.DrawRing(center, innerRadius, outerRadius, startAngle, endAngle, @as(c_int, segments), color);
@ -3591,8 +3601,8 @@ pub fn drawRectangleGradientH(posX: i32, posY: i32, width: i32, height: i32, lef
}
/// Draw a gradient-filled rectangle with custom vertex colors
pub fn drawRectangleGradientEx(rec: Rectangle, topLeft: Color, bottomLeft: Color, topRight: Color, bottomRight: Color) void {
cdef.DrawRectangleGradientEx(rec, topLeft, bottomLeft, topRight, bottomRight);
pub fn drawRectangleGradientEx(rec: Rectangle, topLeft: Color, bottomLeft: Color, bottomRight: Color, topRight: Color) void {
cdef.DrawRectangleGradientEx(rec, topLeft, bottomLeft, bottomRight, topRight);
}
/// Draw rectangle outline
@ -4067,13 +4077,13 @@ pub fn imageDrawTriangleLines(dst: *Image, v1: Vector2, v2: Vector2, v3: Vector2
}
/// Draw a triangle fan defined by points within an image (first vertex is the center)
pub fn imageDrawTriangleFan(dst: *Image, points: []Vector2, pointCount: i32, color: Color) void {
cdef.ImageDrawTriangleFan(@as([*c]Image, @ptrCast(dst)), @as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), color);
pub fn imageDrawTriangleFan(dst: *Image, points: []const Vector2, pointCount: i32, color: Color) void {
cdef.ImageDrawTriangleFan(@as([*c]Image, @ptrCast(dst)), @as([*c]const Vector2, @ptrCast(points)), @as(c_int, pointCount), color);
}
/// Draw a triangle strip defined by points within an image
pub fn imageDrawTriangleStrip(dst: *Image, points: []Vector2, pointCount: i32, color: Color) void {
cdef.ImageDrawTriangleStrip(@as([*c]Image, @ptrCast(dst)), @as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), color);
pub fn imageDrawTriangleStrip(dst: *Image, points: []const Vector2, pointCount: i32, color: Color) void {
cdef.ImageDrawTriangleStrip(@as([*c]Image, @ptrCast(dst)), @as([*c]const Vector2, @ptrCast(points)), @as(c_int, pointCount), color);
}
/// Draw a source image within a destination image (tint applied to source)

24
lib/rlgl.h vendored
View File

@ -56,8 +56,8 @@
*
* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
* #define RL_CULL_DISTANCE_NEAR 0.001 // Default projection matrix near cull distance
* #define RL_CULL_DISTANCE_FAR 10000.0 // Default projection matrix far cull distance
* #define RL_CULL_DISTANCE_NEAR 0.05 // Default projection matrix near cull distance
* #define RL_CULL_DISTANCE_FAR 4000.0 // Default projection matrix far cull distance
*
* When loading a shader, the following vertex attributes and uniform
* location names are tried to be set automatically:
@ -234,10 +234,10 @@
// Projection matrix culling
#ifndef RL_CULL_DISTANCE_NEAR
#define RL_CULL_DISTANCE_NEAR 0.001 // Default near cull distance
#define RL_CULL_DISTANCE_NEAR 0.05 // Default near cull distance
#endif
#ifndef RL_CULL_DISTANCE_FAR
#define RL_CULL_DISTANCE_FAR 10000.0 // Default far cull distance
#define RL_CULL_DISTANCE_FAR 4000.0 // Default far cull distance
#endif
// Texture parameters (equivalent to OpenGL defines)
@ -1748,7 +1748,6 @@ void rlTextureParameters(unsigned int id, int param, int value)
#endif
}
else glTexParameteri(GL_TEXTURE_2D, param, value);
} break;
case RL_TEXTURE_MAG_FILTER:
case RL_TEXTURE_MIN_FILTER: glTexParameteri(GL_TEXTURE_2D, param, value); break;
@ -1793,7 +1792,6 @@ void rlCubemapParameters(unsigned int id, int param, int value)
else TRACELOG(RL_LOG_WARNING, "GL: Clamp mirror wrap mode not supported (GL_MIRROR_CLAMP_EXT)");
}
else glTexParameteri(GL_TEXTURE_CUBE_MAP, param, value);
} break;
case RL_TEXTURE_MAG_FILTER:
case RL_TEXTURE_MIN_FILTER: glTexParameteri(GL_TEXTURE_CUBE_MAP, param, value); break;
@ -2112,14 +2110,12 @@ void rlSetBlendMode(int mode)
{
// NOTE: Using GL blend src/dst factors and GL equation configured with rlSetBlendFactors()
glBlendFunc(RLGL.State.glBlendSrcFactor, RLGL.State.glBlendDstFactor); glBlendEquation(RLGL.State.glBlendEquation);
} break;
case RL_BLEND_CUSTOM_SEPARATE:
{
// NOTE: Using GL blend src/dst factors and GL equation configured with rlSetBlendFactorsSeparate()
glBlendFuncSeparate(RLGL.State.glBlendSrcFactorRGB, RLGL.State.glBlendDestFactorRGB, RLGL.State.glBlendSrcFactorAlpha, RLGL.State.glBlendDestFactorAlpha);
glBlendEquationSeparate(RLGL.State.glBlendEquationRGB, RLGL.State.glBlendEquationAlpha);
} break;
default: break;
}
@ -2429,7 +2425,7 @@ void rlLoadExtensions(void *loader)
// Get supported extensions list
GLint numExt = 0;
const char **extList = RL_MALLOC(512*sizeof(const char *)); // Allocate 512 strings pointers (2 KB)
const char **extList = (const char **)RL_MALLOC(512*sizeof(const char *)); // Allocate 512 strings pointers (2 KB)
const char *extensions = (const char *)glGetString(GL_EXTENSIONS); // One big const string
// NOTE: We have to duplicate string because glGetString() returns a const string
@ -3311,7 +3307,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
// Activate Trilinear filtering if mipmaps are available
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapCount); // user defined mip count would break without this.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapCount); // Required for user-defined mip count
}
#endif
@ -3684,7 +3680,7 @@ unsigned char *rlReadScreenPixels(int width, int height)
// Flip image vertically!
// NOTE: Alpha value has already been applied to RGB in framebuffer, we don't need it!
for (int y = height - 1; y >= height / 2; y--)
for (int y = height - 1; y >= height/2; y--)
{
for (int x = 0; x < (width*4); x += 4)
{
@ -3747,19 +3743,16 @@ void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType,
if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_TEXTURE_2D, texId, mipLevel);
else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_RENDERBUFFER, texId);
else if (texType >= RL_ATTACHMENT_CUBEMAP_POSITIVE_X) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_TEXTURE_CUBE_MAP_POSITIVE_X + texType, texId, mipLevel);
} break;
case RL_ATTACHMENT_DEPTH:
{
if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, texId, mipLevel);
else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, texId);
} break;
case RL_ATTACHMENT_STENCIL:
{
if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, texId, mipLevel);
else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, texId);
} break;
default: break;
}
@ -4185,6 +4178,9 @@ unsigned int rlCompileShader(const char *shaderCode, int type)
RL_FREE(log);
}
// Unload object allocated by glCreateShader(),
// despite failing in the compilation process
glDeleteShader(shader);
shader = 0;
}
else