mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 03:57:29 +00:00
Update raylib to the latest version (#101)
* Update raylib to the latest * Update API --------- Co-authored-by: Not-Nik <nik.wipper@gmx.de>
This commit is contained in:
parent
4d48d3c090
commit
171c2e100c
@ -3,8 +3,8 @@
|
|||||||
.version = "5.1.0",
|
.version = "5.1.0",
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.raylib = .{
|
.raylib = .{
|
||||||
.url = "https://github.com/raysan5/raylib/archive/d6b22b17aecd2346d4fd1fc8ebaea8212e40008f.tar.gz",
|
.url = "https://github.com/raysan5/raylib/archive/5767c4cd059e07355ae5588966d0aee97038a86b.tar.gz",
|
||||||
.hash = "12205f45151f556dd41348acc8a93099f19d6a2e830978ace86733ce0bfe52978812",
|
.hash = "1220aa75240ee6459499456ef520ab7e8bddffaed8a5055441da457b198fc4e92b26",
|
||||||
},
|
},
|
||||||
.raygui = .{
|
.raygui = .{
|
||||||
.url = "https://github.com/raysan5/raygui/archive/4b3d94f5df6a5a2aa86286350f7e20c0ca35f516.tar.gz",
|
.url = "https://github.com/raysan5/raygui/archive/4b3d94f5df6a5a2aa86286350f7e20c0ca35f516.tar.gz",
|
||||||
|
@ -136,6 +136,7 @@ pub extern "c" fn GetWorkingDirectory() [*c]const u8;
|
|||||||
pub extern "c" fn GetApplicationDirectory() [*c]const u8;
|
pub extern "c" fn GetApplicationDirectory() [*c]const u8;
|
||||||
pub extern "c" fn ChangeDirectory(dir: [*c]const u8) bool;
|
pub extern "c" fn ChangeDirectory(dir: [*c]const u8) bool;
|
||||||
pub extern "c" fn IsPathFile(path: [*c]const u8) bool;
|
pub extern "c" fn IsPathFile(path: [*c]const u8) bool;
|
||||||
|
pub extern "c" fn IsFileNameValid(fileName: [*c]const u8) bool;
|
||||||
pub extern "c" fn LoadDirectoryFiles(dirPath: [*c]const u8) rl.FilePathList;
|
pub extern "c" fn LoadDirectoryFiles(dirPath: [*c]const u8) rl.FilePathList;
|
||||||
pub extern "c" fn LoadDirectoryFilesEx(basePath: [*c]const u8, filter: [*c]const u8, scanSubdirs: bool) rl.FilePathList;
|
pub extern "c" fn LoadDirectoryFilesEx(basePath: [*c]const u8, filter: [*c]const u8, scanSubdirs: bool) rl.FilePathList;
|
||||||
pub extern "c" fn UnloadDirectoryFiles(files: rl.FilePathList) void;
|
pub extern "c" fn UnloadDirectoryFiles(files: rl.FilePathList) void;
|
||||||
@ -267,6 +268,7 @@ pub extern "c" fn CheckCollisionPointTriangle(point: rl.Vector2, p1: rl.Vector2,
|
|||||||
pub extern "c" fn CheckCollisionPointPoly(point: rl.Vector2, points: [*c]rl.Vector2, pointCount: c_int) bool;
|
pub extern "c" fn CheckCollisionPointPoly(point: rl.Vector2, points: [*c]rl.Vector2, pointCount: c_int) bool;
|
||||||
pub extern "c" fn CheckCollisionLines(startPos1: rl.Vector2, endPos1: rl.Vector2, startPos2: rl.Vector2, endPos2: rl.Vector2, collisionPoint: [*c]rl.Vector2) bool;
|
pub extern "c" fn CheckCollisionLines(startPos1: rl.Vector2, endPos1: rl.Vector2, startPos2: rl.Vector2, endPos2: rl.Vector2, collisionPoint: [*c]rl.Vector2) bool;
|
||||||
pub extern "c" fn CheckCollisionPointLine(point: rl.Vector2, p1: rl.Vector2, p2: rl.Vector2, threshold: c_int) bool;
|
pub extern "c" fn CheckCollisionPointLine(point: rl.Vector2, p1: rl.Vector2, p2: rl.Vector2, threshold: c_int) bool;
|
||||||
|
pub extern "c" fn CheckCollisionCircleLine(center: rl.Vector2, radius: f32, p1: rl.Vector2, p2: rl.Vector2) bool;
|
||||||
pub extern "c" fn GetCollisionRec(rec1: rl.Rectangle, rec2: rl.Rectangle) rl.Rectangle;
|
pub extern "c" fn GetCollisionRec(rec1: rl.Rectangle, rec2: rl.Rectangle) rl.Rectangle;
|
||||||
pub extern "c" fn LoadImage(fileName: [*c]const u8) rl.Image;
|
pub extern "c" fn LoadImage(fileName: [*c]const u8) rl.Image;
|
||||||
pub extern "c" fn LoadImageRaw(fileName: [*c]const u8, width: c_int, height: c_int, format: rl.PixelFormat, headerSize: c_int) rl.Image;
|
pub extern "c" fn LoadImageRaw(fileName: [*c]const u8, width: c_int, height: c_int, format: rl.PixelFormat, headerSize: c_int) rl.Image;
|
||||||
@ -422,6 +424,8 @@ pub extern "c" fn TextFindIndex(text: [*c]const u8, find: [*c]const u8) c_int;
|
|||||||
pub extern "c" fn TextToUpper(text: [*c]const u8) [*c]const u8;
|
pub extern "c" fn TextToUpper(text: [*c]const u8) [*c]const u8;
|
||||||
pub extern "c" fn TextToLower(text: [*c]const u8) [*c]const u8;
|
pub extern "c" fn TextToLower(text: [*c]const u8) [*c]const u8;
|
||||||
pub extern "c" fn TextToPascal(text: [*c]const u8) [*c]const u8;
|
pub extern "c" fn TextToPascal(text: [*c]const u8) [*c]const u8;
|
||||||
|
pub extern "c" fn TextToSnake(text: [*c]const u8) [*c]const u8;
|
||||||
|
pub extern "c" fn TextToCamel(text: [*c]const u8) [*c]const u8;
|
||||||
pub extern "c" fn TextToInteger(text: [*c]const u8) c_int;
|
pub extern "c" fn TextToInteger(text: [*c]const u8) c_int;
|
||||||
pub extern "c" fn TextToFloat(text: [*c]const u8) f32;
|
pub extern "c" fn TextToFloat(text: [*c]const u8) f32;
|
||||||
pub extern "c" fn DrawLine3D(startPos: rl.Vector3, endPos: rl.Vector3, color: rl.Color) void;
|
pub extern "c" fn DrawLine3D(startPos: rl.Vector3, endPos: rl.Vector3, color: rl.Color) void;
|
||||||
@ -524,7 +528,7 @@ pub extern "c" fn SetSoundVolume(sound: rl.Sound, volume: f32) void;
|
|||||||
pub extern "c" fn SetSoundPitch(sound: rl.Sound, pitch: f32) void;
|
pub extern "c" fn SetSoundPitch(sound: rl.Sound, pitch: f32) void;
|
||||||
pub extern "c" fn SetSoundPan(sound: rl.Sound, pan: f32) void;
|
pub extern "c" fn SetSoundPan(sound: rl.Sound, pan: f32) void;
|
||||||
pub extern "c" fn WaveCopy(wave: rl.Wave) rl.Wave;
|
pub extern "c" fn WaveCopy(wave: rl.Wave) rl.Wave;
|
||||||
pub extern "c" fn WaveCrop(wave: [*c]rl.Wave, initSample: c_int, finalSample: c_int) void;
|
pub extern "c" fn WaveCrop(wave: [*c]rl.Wave, initFrame: c_int, finalFrame: c_int) void;
|
||||||
pub extern "c" fn WaveFormat(wave: [*c]rl.Wave, sampleRate: c_int, sampleSize: c_int, channels: c_int) void;
|
pub extern "c" fn WaveFormat(wave: [*c]rl.Wave, sampleRate: c_int, sampleSize: c_int, channels: c_int) void;
|
||||||
pub extern "c" fn LoadWaveSamples(wave: rl.Wave) [*c]f32;
|
pub extern "c" fn LoadWaveSamples(wave: rl.Wave) [*c]f32;
|
||||||
pub extern "c" fn UnloadWaveSamples(samples: [*c]f32) void;
|
pub extern "c" fn UnloadWaveSamples(samples: [*c]f32) void;
|
||||||
|
13
lib/raylib.h
13
lib/raylib.h
@ -934,7 +934,7 @@ typedef enum {
|
|||||||
} NPatchLayout;
|
} NPatchLayout;
|
||||||
|
|
||||||
// Callbacks to hook some internal functions
|
// Callbacks to hook some internal functions
|
||||||
// WARNING: These callbacks are intended for advance users
|
// WARNING: These callbacks are intended for advanced users
|
||||||
typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages
|
typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages
|
||||||
typedef unsigned char *(*LoadFileDataCallback)(const char *fileName, int *dataSize); // FileIO: Load binary data
|
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 bool (*SaveFileDataCallback)(const char *fileName, void *data, int dataSize); // FileIO: Save binary data
|
||||||
@ -1066,7 +1066,7 @@ RLAPI double GetTime(void); // Get elapsed
|
|||||||
RLAPI int GetFPS(void); // Get current FPS
|
RLAPI int GetFPS(void); // Get current FPS
|
||||||
|
|
||||||
// Custom frame control functions
|
// Custom frame control functions
|
||||||
// NOTE: Those functions are intended for advance users that want full control over the frame processing
|
// NOTE: Those functions are intended for advanced users that want full control over the frame processing
|
||||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
||||||
// To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
|
// To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
|
||||||
RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
|
RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
|
||||||
@ -1093,7 +1093,7 @@ RLAPI void *MemRealloc(void *ptr, unsigned int size); // Internal me
|
|||||||
RLAPI void MemFree(void *ptr); // Internal memory free
|
RLAPI void MemFree(void *ptr); // Internal memory free
|
||||||
|
|
||||||
// Set custom callbacks
|
// Set custom callbacks
|
||||||
// WARNING: Callbacks setup is intended for advance users
|
// WARNING: Callbacks setup is intended for advanced users
|
||||||
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
|
RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
|
||||||
RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
|
RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
|
||||||
RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
|
RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
|
||||||
@ -1124,6 +1124,7 @@ RLAPI const char *GetWorkingDirectory(void); // Get current
|
|||||||
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
|
||||||
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
|
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
|
||||||
RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
|
RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
|
||||||
|
RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
|
||||||
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths
|
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths
|
||||||
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan
|
RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan
|
||||||
RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
|
RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
|
||||||
@ -1294,6 +1295,7 @@ RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Ve
|
|||||||
RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
|
RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
|
||||||
RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
|
RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
|
||||||
RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
|
RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
|
||||||
|
RLAPI bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); // Check if circle collides with a line created betweeen two points [p1] and [p2]
|
||||||
RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
|
RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
@ -1487,6 +1489,9 @@ RLAPI int TextFindIndex(const char *text, const char *find);
|
|||||||
RLAPI const char *TextToUpper(const char *text); // Get upper case version of provided string
|
RLAPI const char *TextToUpper(const char *text); // Get upper case version of provided string
|
||||||
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
|
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
|
||||||
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
|
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
|
||||||
|
RLAPI const char *TextToSnake(const char *text); // Get Snake case notation version of provided string
|
||||||
|
RLAPI const char *TextToCamel(const char *text); // Get Camel case notation version of provided string
|
||||||
|
|
||||||
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
|
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
|
||||||
RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported)
|
RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported)
|
||||||
|
|
||||||
@ -1624,7 +1629,7 @@ RLAPI void SetSoundVolume(Sound sound, float volume); // Set vol
|
|||||||
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||||
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
|
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
|
||||||
RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
|
RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
|
||||||
RLAPI void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range
|
RLAPI void WaveCrop(Wave *wave, int initFrame, int finalFrame); // Crop a wave to defined frames range
|
||||||
RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
|
RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
|
||||||
RLAPI float *LoadWaveSamples(Wave wave); // Load samples data from wave as a 32bit float data array
|
RLAPI float *LoadWaveSamples(Wave wave); // Load samples data from wave as a 32bit float data array
|
||||||
RLAPI void UnloadWaveSamples(float *samples); // Unload samples data loaded with LoadWaveSamples()
|
RLAPI void UnloadWaveSamples(float *samples); // Unload samples data loaded with LoadWaveSamples()
|
||||||
|
@ -1983,6 +1983,10 @@ pub fn isPathFile(path: [:0]const u8) bool {
|
|||||||
return cdef.IsPathFile(@as([*c]const u8, @ptrCast(path)));
|
return cdef.IsPathFile(@as([*c]const u8, @ptrCast(path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn isFileNameValid(fileName: [:0]const u8) bool {
|
||||||
|
return cdef.IsFileNameValid(@as([*c]const u8, @ptrCast(fileName)));
|
||||||
|
}
|
||||||
|
|
||||||
pub fn loadDirectoryFiles(dirPath: [:0]const u8) FilePathList {
|
pub fn loadDirectoryFiles(dirPath: [:0]const u8) FilePathList {
|
||||||
return cdef.LoadDirectoryFiles(@as([*c]const u8, @ptrCast(dirPath)));
|
return cdef.LoadDirectoryFiles(@as([*c]const u8, @ptrCast(dirPath)));
|
||||||
}
|
}
|
||||||
@ -2475,6 +2479,10 @@ pub fn checkCollisionPointLine(point: Vector2, p1: Vector2, p2: Vector2, thresho
|
|||||||
return cdef.CheckCollisionPointLine(point, p1, p2, @as(c_int, threshold));
|
return cdef.CheckCollisionPointLine(point, p1, p2, @as(c_int, threshold));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn checkCollisionCircleLine(center: Vector2, radius: f32, p1: Vector2, p2: Vector2) bool {
|
||||||
|
return cdef.CheckCollisionCircleLine(center, radius, p1, p2);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn getCollisionRec(rec1: Rectangle, rec2: Rectangle) Rectangle {
|
pub fn getCollisionRec(rec1: Rectangle, rec2: Rectangle) Rectangle {
|
||||||
return cdef.GetCollisionRec(rec1, rec2);
|
return cdef.GetCollisionRec(rec1, rec2);
|
||||||
}
|
}
|
||||||
@ -3035,6 +3043,14 @@ pub fn textToPascal(text: [:0]const u8) [:0]const u8 {
|
|||||||
return std.mem.span(cdef.TextToPascal(@as([*c]const u8, @ptrCast(text))));
|
return std.mem.span(cdef.TextToPascal(@as([*c]const u8, @ptrCast(text))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn textToSnake(text: [:0]const u8) [:0]const u8 {
|
||||||
|
return std.mem.span(cdef.TextToSnake(@as([*c]const u8, @ptrCast(text))));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn textToCamel(text: [:0]const u8) [:0]const u8 {
|
||||||
|
return std.mem.span(cdef.TextToCamel(@as([*c]const u8, @ptrCast(text))));
|
||||||
|
}
|
||||||
|
|
||||||
pub fn textToInteger(text: [:0]const u8) i32 {
|
pub fn textToInteger(text: [:0]const u8) i32 {
|
||||||
return @as(i32, cdef.TextToInteger(@as([*c]const u8, @ptrCast(text))));
|
return @as(i32, cdef.TextToInteger(@as([*c]const u8, @ptrCast(text))));
|
||||||
}
|
}
|
||||||
@ -3419,8 +3435,8 @@ pub fn waveCopy(wave: Wave) Wave {
|
|||||||
return cdef.WaveCopy(wave);
|
return cdef.WaveCopy(wave);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn waveCrop(wave: *Wave, initSample: i32, finalSample: i32) void {
|
pub fn waveCrop(wave: *Wave, initFrame: i32, finalFrame: i32) void {
|
||||||
cdef.WaveCrop(@as([*c]Wave, @ptrCast(wave)), @as(c_int, initSample), @as(c_int, finalSample));
|
cdef.WaveCrop(@as([*c]Wave, @ptrCast(wave)), @as(c_int, initFrame), @as(c_int, finalFrame));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn waveFormat(wave: *Wave, sampleRate: i32, sampleSize: i32, channels: i32) void {
|
pub fn waveFormat(wave: *Wave, sampleRate: i32, sampleSize: i32, channels: i32) void {
|
||||||
|
@ -78,10 +78,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C" { // Prevents name mangling of functions
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Defines and Macros
|
// Defines and Macros
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -2528,8 +2524,5 @@ RMAPI int QuaternionEquals(Quaternion p, Quaternion q)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if defined(__cplusplus)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // RAYMATH_H
|
#endif // RAYMATH_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user