mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
makes raylib and stb_rect_pack free of libc
This commit is contained in:
Vendored
+5
-2
@@ -1,6 +1,6 @@
|
|||||||
package raylib
|
package raylib
|
||||||
|
|
||||||
import c "core:c/libc"
|
import c "core:c"
|
||||||
|
|
||||||
RAYGUI_SHARED :: #config(RAYGUI_SHARED, false)
|
RAYGUI_SHARED :: #config(RAYGUI_SHARED, false)
|
||||||
|
|
||||||
@@ -240,7 +240,10 @@ SCROLLBAR_RIGHT_SIDE :: 1
|
|||||||
|
|
||||||
@(default_calling_convention="c")
|
@(default_calling_convention="c")
|
||||||
foreign lib {
|
foreign lib {
|
||||||
@(link_name="raylib_version") version: cstring
|
// WASM does not have foreign variable declarations.
|
||||||
|
when ODIN_ARCH != .wasm32 && ODIN_ARCH != .wasm64p32 {
|
||||||
|
@(link_name="raylib_version") version: cstring
|
||||||
|
}
|
||||||
// Global gui state control functions
|
// Global gui state control functions
|
||||||
|
|
||||||
GuiEnable :: proc() --- // Enable gui controls (global state)
|
GuiEnable :: proc() --- // Enable gui controls (global state)
|
||||||
|
|||||||
Vendored
+9
-5
@@ -81,7 +81,7 @@ Package vendor:raylib implements bindings for version 5.0 of the raylib library
|
|||||||
*/
|
*/
|
||||||
package raylib
|
package raylib
|
||||||
|
|
||||||
import c "core:c/libc"
|
import c "core:c"
|
||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
import "core:mem"
|
import "core:mem"
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
@@ -925,13 +925,17 @@ NPatchLayout :: enum c.int {
|
|||||||
THREE_PATCH_HORIZONTAL, // Npatch layout: 3x1 tiles
|
THREE_PATCH_HORIZONTAL, // Npatch layout: 3x1 tiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Castable to `core:c/libc`'s `va_list`.
|
||||||
|
// But some use cases of raylib do not want `libc` imported.
|
||||||
|
va_list :: struct #align(16) {
|
||||||
|
_: [4096]u8,
|
||||||
|
}
|
||||||
|
|
||||||
// Callbacks to hook some internal functions
|
// Callbacks to hook some internal functions
|
||||||
// WARNING: This callbacks are intended for advance users
|
// WARNING: This callbacks are intended for advance users
|
||||||
TraceLogCallback :: #type proc "c" (logLevel: TraceLogLevel, text: cstring, args: c.va_list) // Logging: Redirect trace log messages
|
TraceLogCallback :: #type proc "c" (logLevel: TraceLogLevel, text: cstring, args: va_list) // Logging: Redirect trace log messages
|
||||||
LoadFileDataCallback :: #type proc "c"(fileName: cstring, dataSize: ^c.int) -> [^]u8 // FileIO: Load binary data
|
LoadFileDataCallback :: #type proc "c"(fileName: cstring, dataSize: ^c.int) -> [^]u8 // FileIO: Load binary data
|
||||||
SaveFileDataCallback :: #type proc "c" (fileName: cstring, data: rawptr, dataSize: c.int) -> bool // FileIO: Save binary data
|
SaveFileDataCallback :: #type proc "c" (fileName: cstring, data: rawptr, dataSize: c.int) -> bool // FileIO: Save binary data
|
||||||
LoadFileTextCallback :: #type proc "c" (fileName: cstring) -> [^]u8 // FileIO: Load text data
|
LoadFileTextCallback :: #type proc "c" (fileName: cstring) -> [^]u8 // FileIO: Load text data
|
||||||
SaveFileTextCallback :: #type proc "c" (fileName: cstring, text: cstring) -> bool // FileIO: Save text data
|
SaveFileTextCallback :: #type proc "c" (fileName: cstring, text: cstring) -> bool // FileIO: Save text data
|
||||||
|
|
||||||
|
|||||||
Vendored
+19
-3
@@ -1,6 +1,5 @@
|
|||||||
package raylib
|
package raylib
|
||||||
|
|
||||||
import c "core:c/libc"
|
|
||||||
import "core:math"
|
import "core:math"
|
||||||
import "core:math/linalg"
|
import "core:math/linalg"
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ Wrap :: proc "c" (value: f32, min, max: f32) -> f32 {
|
|||||||
// Check whether two given floats are almost equal
|
// Check whether two given floats are almost equal
|
||||||
@(require_results)
|
@(require_results)
|
||||||
FloatEquals :: proc "c" (x, y: f32) -> bool {
|
FloatEquals :: proc "c" (x, y: f32) -> bool {
|
||||||
return abs(x - y) <= EPSILON*c.fmaxf(1.0, c.fmaxf(abs(x), abs(y)))
|
return abs(x - y) <= EPSILON*fmaxf(1.0, fmaxf(abs(x), abs(y)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -815,4 +814,21 @@ QuaternionEquals :: proc "c" (p, q: Quaternion) -> bool {
|
|||||||
FloatEquals(p.y, q.y) &&
|
FloatEquals(p.y, q.y) &&
|
||||||
FloatEquals(p.z, q.z) &&
|
FloatEquals(p.z, q.z) &&
|
||||||
FloatEquals(p.w, q.w)
|
FloatEquals(p.w, q.w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@(private, require_results)
|
||||||
|
fmaxf :: proc "contextless" (x, y: f32) -> f32 {
|
||||||
|
if math.is_nan(x) {
|
||||||
|
return y
|
||||||
|
}
|
||||||
|
|
||||||
|
if math.is_nan(y) {
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
|
if math.signbit(x) != math.signbit(y) {
|
||||||
|
return y if math.signbit(x) else x
|
||||||
|
}
|
||||||
|
|
||||||
|
return y if x < y else x
|
||||||
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package stb_rect_pack
|
package stb_rect_pack
|
||||||
|
|
||||||
import c "core:c/libc"
|
import c "core:c"
|
||||||
|
|
||||||
#assert(size_of(b32) == size_of(c.int))
|
#assert(size_of(b32) == size_of(c.int))
|
||||||
|
|
||||||
@@ -111,4 +111,4 @@ foreign lib {
|
|||||||
// heuristics will produce better/worse results for different data sets.
|
// heuristics will produce better/worse results for different data sets.
|
||||||
// If you call init again, this will be reset to the default.
|
// If you call init again, this will be reset to the default.
|
||||||
setup_heuristic :: proc(ctx: ^Context, heuristic: Heuristic) ---
|
setup_heuristic :: proc(ctx: ^Context, heuristic: Heuristic) ---
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user