mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-19 04:12:22 -07:00
Merge pull request #2983 from perogycook/raylib5
Raylib5 bindings with fixes
This commit is contained in:
Vendored
+1
-1
@@ -39,7 +39,7 @@ features
|
||||
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
|
||||
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
|
||||
- Written in plain C code (C99) using PascalCase/camelCase notation
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
|
||||
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3, ES 2.0 or ES 3.0**)
|
||||
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
|
||||
- Multiple **Fonts** formats supported (TTF, Image fonts, AngelCode fonts)
|
||||
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.so.500
|
||||
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.so.5.0.0
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.5.0.0.dylib
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.5.0.0.dylib
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.5.0.0.dylib
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
libraylib.5.0.0.dylib
|
||||
Vendored
+20
-3
@@ -23,7 +23,9 @@ when ODIN_OS == .Windows {
|
||||
} else when ODIN_OS == .Darwin {
|
||||
when ODIN_ARCH == .arm64 {
|
||||
when RAYGUI_SHARED {
|
||||
// #panic("Cannot link libraygui.450.dylib: not in the vendor collection")
|
||||
foreign import lib {
|
||||
"macos-arm64/libraygui.dylib",
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
"macos-arm64/libraygui.a",
|
||||
@@ -34,7 +36,9 @@ when ODIN_OS == .Windows {
|
||||
}
|
||||
} else {
|
||||
when RAYGUI_SHARED {
|
||||
// #panic("Cannot link libraygui.450.dylib: not in the vendor collection")
|
||||
foreign import lib {
|
||||
"macos/libraygui.dylib",
|
||||
}
|
||||
} else {
|
||||
foreign import lib {
|
||||
"macos/libraygui.a",
|
||||
@@ -72,6 +76,18 @@ GuiTextAlignment :: enum c.int {
|
||||
TEXT_ALIGN_RIGHT,
|
||||
}
|
||||
|
||||
GuiTextAlignmentVertical :: enum c.int {
|
||||
TEXT_ALIGN_TOP = 0,
|
||||
TEXT_ALIGN_MIDDLE,
|
||||
TEXT_ALIGN_BOTTOM,
|
||||
}
|
||||
|
||||
GuiTextWrapMode :: enum c.int {
|
||||
TEXT_WRAP_NONE = 0,
|
||||
TEXT_WRAP_CHAR,
|
||||
TEXT_WRAP_WORD,
|
||||
}
|
||||
|
||||
// Gui controls
|
||||
GuiControl :: enum c.int {
|
||||
// Default -> populates to all controls when set
|
||||
@@ -284,6 +300,7 @@ foreign lib {
|
||||
GuiLabelButton :: proc(bounds: Rectangle, text: cstring) -> bool --- // Label button control, show true when clicked
|
||||
GuiToggle :: proc(bounds: Rectangle, text: cstring, active: ^bool) -> c.int --- // Toggle Button control, returns true when active
|
||||
GuiToggleGroup :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- // Toggle Group control, returns active toggle index
|
||||
GuiToggleSlider :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int ---
|
||||
GuiCheckBox :: proc(bounds: Rectangle, text: cstring, checked: ^bool) -> bool --- // Check Box control, returns true when active
|
||||
GuiComboBox :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- // Combo Box control, returns selected item index
|
||||
|
||||
@@ -573,4 +590,4 @@ GuiIconName :: enum c.int {
|
||||
ICON_253 = 253,
|
||||
ICON_254 = 254,
|
||||
ICON_255 = 255,
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+152
-72
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
Package vendor:raylib implements bindings for version 4.5 of the raylib library (https://www.raylib.com/)
|
||||
Package vendor:raylib implements bindings for version 5.0 of the raylib library (https://www.raylib.com/)
|
||||
|
||||
*********************************************************************************************
|
||||
*
|
||||
* raylib v4.5 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
* raylib v5.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
*
|
||||
* FEATURES:
|
||||
* - NO external dependencies, all required libraries included with raylib
|
||||
@@ -124,7 +124,7 @@ when ODIN_OS == .Windows {
|
||||
// multiple copies of raylib.so, but since these bindings are for
|
||||
// particular version of the library, I better specify it. Ideally,
|
||||
// though, it's best specified in terms of major (.so.4)
|
||||
"linux/libraylib.so.450",
|
||||
"linux/libraylib.so.500",
|
||||
"system:dl",
|
||||
"system:pthread",
|
||||
}
|
||||
@@ -139,7 +139,7 @@ when ODIN_OS == .Windows {
|
||||
when ODIN_ARCH == .arm64 {
|
||||
when RAYLIB_SHARED {
|
||||
foreign import lib {
|
||||
"macos-arm64/libraylib.450.dylib",
|
||||
"macos-arm64/libraylib.500.dylib",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
@@ -155,7 +155,7 @@ when ODIN_OS == .Windows {
|
||||
} else {
|
||||
when RAYLIB_SHARED {
|
||||
foreign import lib {
|
||||
"macos/libraylib.450.dylib",
|
||||
"macos/libraylib.500.dylib",
|
||||
"system:Cocoa.framework",
|
||||
"system:OpenGL.framework",
|
||||
"system:IOKit.framework",
|
||||
@@ -173,7 +173,10 @@ when ODIN_OS == .Windows {
|
||||
foreign import lib "system:raylib"
|
||||
}
|
||||
|
||||
VERSION :: "4.5"
|
||||
VERSION_MAJOR :: 5
|
||||
VERSION_MINOR :: 0
|
||||
VERSION_PATCH :: 0
|
||||
VERSION :: "5.0"
|
||||
|
||||
PI :: 3.14159265358979323846
|
||||
DEG2RAD :: PI/180.0
|
||||
@@ -514,6 +517,19 @@ FilePathList :: struct {
|
||||
paths: [^]cstring, // Filepaths entries
|
||||
}
|
||||
|
||||
// Automation event
|
||||
AutomationEvent :: struct {
|
||||
frame: c.uint, // Event frame
|
||||
type: c.uint, // Event type (AutomationEventType)
|
||||
params: [4]c.int, // Event parameters (if required) ---
|
||||
}
|
||||
|
||||
// Automation event list
|
||||
AutomationEventList :: struct {
|
||||
capacity: c.uint, // Events max entries (MAX_AUTOMATION_EVENTS)
|
||||
count: c.uint, // Events entries count
|
||||
events: [^]AutomationEvent, // Events entries
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Enumerators Definition
|
||||
@@ -535,6 +551,7 @@ ConfigFlag :: enum c.int {
|
||||
WINDOW_TRANSPARENT = 4, // Set to allow transparent framebuffer
|
||||
WINDOW_HIGHDPI = 13, // Set to support HighDPI
|
||||
WINDOW_MOUSE_PASSTHROUGH = 14, // Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
|
||||
BORDERLESS_WINDOWED_MODE = 15, // Set to run program in borderless windowed mode
|
||||
MSAA_4X_HINT = 5, // Set to try enabling MSAA 4X
|
||||
INTERLACED_HINT = 16, // Set to try enabling interlaced video format (for V3D)
|
||||
}
|
||||
@@ -805,6 +822,9 @@ PixelFormat :: enum c.int {
|
||||
UNCOMPRESSED_R32, // 32 bpp (1 channel - float)
|
||||
UNCOMPRESSED_R32G32B32, // 32*3 bpp (3 channels - float)
|
||||
UNCOMPRESSED_R32G32B32A32, // 32*4 bpp (4 channels - float)
|
||||
UNCOMPRESSED_R16, // 16 bpp (1 channel - float)
|
||||
UNCOMPRESSED_R16G16B16, // 16*3 bpp (3 channels - float)
|
||||
UNCOMPRESSED_R16G16B16A16, // 16*4 bpp (4 channels - float)
|
||||
COMPRESSED_DXT1_RGB, // 4 bpp (no alpha)
|
||||
COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha)
|
||||
COMPRESSED_DXT3_RGBA, // 8 bpp
|
||||
@@ -869,7 +889,7 @@ BlendMode :: enum c.int {
|
||||
|
||||
// Gestures
|
||||
// NOTE: It could be used as flags to enable only some gestures
|
||||
Gesture :: enum c.int {
|
||||
Gesture :: enum c.uint {
|
||||
TAP = 0, // Tap gesture
|
||||
DOUBLETAP = 1, // Double tap gesture
|
||||
HOLD = 2, // Hold gesture
|
||||
@@ -881,7 +901,7 @@ Gesture :: enum c.int {
|
||||
PINCH_IN = 8, // Pinch in gesture
|
||||
PINCH_OUT = 9, // Pinch out gesture
|
||||
}
|
||||
Gestures :: distinct bit_set[Gesture; c.int]
|
||||
Gestures :: distinct bit_set[Gesture; c.uint]
|
||||
|
||||
// Camera system modes
|
||||
CameraMode :: enum c.int {
|
||||
@@ -910,8 +930,8 @@ NPatchLayout :: enum c.int {
|
||||
// Callbacks to hook some internal functions
|
||||
// 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
|
||||
LoadFileDataCallback :: #type proc "c"(fileName: cstring, bytesRead: ^c.uint) -> [^]u8 // FileIO: Load binary data
|
||||
SaveFileDataCallback :: #type proc "c" (fileName: cstring, data: rawptr, bytesToWrite: c.uint) -> bool // FileIO: Save 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
|
||||
LoadFileTextCallback :: #type proc "c" (fileName: cstring) -> [^]u8 // FileIO: Load text data
|
||||
SaveFileTextCallback :: #type proc "c" (fileName: cstring, text: cstring) -> bool // FileIO: Save text data
|
||||
|
||||
@@ -932,7 +952,7 @@ foreign lib {
|
||||
// Window-related functions
|
||||
|
||||
InitWindow :: proc(width, height: c.int, title: cstring) --- // Initialize window and OpenGL context
|
||||
WindowShouldClose :: proc() -> bool --- // Check if KEY_ESCAPE pressed or Close icon pressed
|
||||
WindowShouldClose :: proc() -> bool --- // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
|
||||
CloseWindow :: proc() --- // Close window and unload OpenGL context
|
||||
IsWindowReady :: proc() -> bool --- // Check if window has been initialized successfully
|
||||
IsWindowFullscreen :: proc() -> bool --- // Check if window is currently fullscreen
|
||||
@@ -945,17 +965,20 @@ foreign lib {
|
||||
SetWindowState :: proc(flags: ConfigFlags) --- // Set window configuration state using flags (only PLATFORM_DESKTOP)
|
||||
ClearWindowState :: proc(flags: ConfigFlags) --- // Clear window configuration state flags
|
||||
ToggleFullscreen :: proc() --- // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
|
||||
ToggleBorderlessWindowed :: proc() --- // Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
|
||||
MaximizeWindow :: proc() --- // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
|
||||
MinimizeWindow :: proc() --- // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
|
||||
RestoreWindow :: proc() --- // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
|
||||
SetWindowIcon :: proc(image: Image) --- // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
|
||||
SetWindowIcons :: proc(images: [^]Image, count: c.int) --- // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
|
||||
SetWindowTitle :: proc(title: cstring) --- // Set title for window (only PLATFORM_DESKTOP)
|
||||
SetWindowTitle :: proc(title: cstring) --- // Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)
|
||||
SetWindowPosition :: proc(x, y: c.int) --- // Set window position on screen (only PLATFORM_DESKTOP)
|
||||
SetWindowMonitor :: proc(monitor: c.int) --- // Set monitor for the current window (fullscreen mode)
|
||||
SetWindowMonitor :: proc(monitor: c.int) --- // Set monitor for the current window
|
||||
SetWindowMinSize :: proc(width, height: c.int) --- // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
SetWindowMaxSize :: proc(width, height: c.int) --- // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
SetWindowSize :: proc(width, height: c.int) --- // Set window dimensions
|
||||
SetWindowOpacity :: proc(opacity: f32) --- // Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
|
||||
SetWindowFocused :: proc() --- // Set window focused (only PLATFORM_DESKTOP)
|
||||
GetWindowHandle :: proc() -> rawptr --- // Get native window handle
|
||||
GetScreenWidth :: proc() -> c.int --- // Get current screen width
|
||||
GetScreenHeight :: proc() -> c.int --- // Get current screen height
|
||||
@@ -971,7 +994,7 @@ foreign lib {
|
||||
GetMonitorRefreshRate :: proc(monitor: c.int) -> c.int --- // Get specified monitor refresh rate
|
||||
GetWindowPosition :: proc() -> Vector2 --- // Get window position XY on monitor
|
||||
GetWindowScaleDPI :: proc() -> Vector2 --- // Get window scale DPI factor
|
||||
GetMonitorName :: proc(monitor: c.int) -> cstring --- // Get the human-readable, UTF-8 encoded name of the primary monitor
|
||||
GetMonitorName :: proc(monitor: c.int) -> cstring --- // Get the human-readable, UTF-8 encoded name of the specified monitor
|
||||
SetClipboardText :: proc(text: cstring) --- // Set clipboard text content
|
||||
GetClipboardText :: proc() -> cstring --- // Get clipboard text content
|
||||
EnableEventWaiting :: proc() --- // Enable waiting for events on EndDrawing(), no automatic event polling
|
||||
@@ -980,7 +1003,7 @@ foreign lib {
|
||||
|
||||
// Custom frame control functions
|
||||
// NOTE: Those functions are intended for advance users that want full control over the frame processing
|
||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + 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
|
||||
|
||||
SwapScreenBuffer :: proc() --- // Swap back buffer with front buffer (screen drawing)
|
||||
@@ -1053,21 +1076,26 @@ foreign lib {
|
||||
GetFrameTime :: proc() -> f32 --- // Returns time in seconds for last frame drawn (delta time)
|
||||
GetTime :: proc() -> f64 --- // Returns elapsed time in seconds since InitWindow()
|
||||
|
||||
// Misc. functions
|
||||
// Random value generation functions
|
||||
|
||||
GetRandomValue :: proc(min, max: c.int) -> c.int --- // Returns a random value between min and max (both included)
|
||||
SetRandomSeed :: proc(seed: c.uint) --- // Set the seed for the random number generator
|
||||
SetRandomSeed :: proc(seed: c.uint) --- // Set the seed for the random number generator
|
||||
GetRandomValue :: proc(min, max: c.int) -> c.int --- // Get a random value between min and max (both included)
|
||||
LoadRandomSequence :: proc(count : c.uint, min, max: c.int) --- // Load random values sequence, no values repeated
|
||||
UnloadRandomSequence :: proc(sequence : ^c.int) --- // Unload random values sequence
|
||||
|
||||
// Misc. functions
|
||||
TakeScreenshot :: proc(fileName: cstring) --- // Takes a screenshot of current screen (filename extension defines format)
|
||||
SetConfigFlags :: proc(flags: ConfigFlags) --- // Setup init configuration flags (view FLAGS)
|
||||
OpenURL :: proc(url: cstring) --- // Open URL with default system browser (if available)
|
||||
|
||||
// NOTE: Following functions implemented in module [utils]
|
||||
//------------------------------------------------------------------
|
||||
TraceLog :: proc(logLevel: TraceLogLevel, text: cstring, #c_vararg args: ..any) --- // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
|
||||
SetTraceLogLevel :: proc(logLevel: TraceLogLevel) --- // Set the current threshold (minimum) log level
|
||||
MemAlloc :: proc(size: c.uint) -> rawptr --- // Internal memory allocator
|
||||
MemRealloc :: proc(ptr: rawptr, size: c.uint) -> rawptr --- // Internal memory reallocator
|
||||
MemFree :: proc(ptr: rawptr) --- // Internal memory free
|
||||
|
||||
OpenURL :: proc(url: cstring) --- // Open URL with default system browser (if available)
|
||||
|
||||
// Set custom callbacks
|
||||
// WARNING: Callbacks setup is intended for advance users
|
||||
|
||||
@@ -1079,13 +1107,16 @@ foreign lib {
|
||||
|
||||
// Files management functions
|
||||
|
||||
LoadFileData :: proc(fileName: cstring, bytesRead: ^c.uint) -> [^]byte --- // Load file data as byte array (read)
|
||||
UnloadFileData :: proc(data: [^]byte) --- // Unload file data allocated by LoadFileData()
|
||||
SaveFileData :: proc(fileName: cstring, data: rawptr, bytesToWrite: c.uint) -> bool --- // Save data to file from byte array (write), returns true on success
|
||||
ExportDataAsCode :: proc(data: rawptr, size: c.uint, fileName: cstring) -> bool --- // Export data to code (.h), returns true on success
|
||||
LoadFileText :: proc(fileName: cstring) -> [^]byte --- // Load text data from file (read), returns a '\0' terminated string
|
||||
UnloadFileText :: proc(text: [^]byte) --- // Unload file text data allocated by LoadFileText()
|
||||
SaveFileText :: proc(fileName: cstring, text: [^]byte) -> bool --- // Save text data to file (write), string must be '\0' terminated, returns true on success
|
||||
LoadFileData :: proc(fileName: cstring, dataSize: ^c.int) -> [^]byte --- // Load file data as byte array (read)
|
||||
UnloadFileData :: proc(data: [^]byte) --- // Unload file data allocated by LoadFileData()
|
||||
SaveFileData :: proc(fileName: cstring, data: rawptr, dataSize: c.int) -> bool --- // Save data to file from byte array (write), returns true on success
|
||||
ExportDataAsCode :: proc(data: rawptr, dataSize: c.int, fileName: cstring) -> bool --- // Export data to code (.h), returns true on success
|
||||
LoadFileText :: proc(fileName: cstring) -> [^]byte --- // Load text data from file (read), returns a '\0' terminated string
|
||||
UnloadFileText :: proc(text: [^]byte) --- // Unload file text data allocated by LoadFileText()
|
||||
SaveFileText :: proc(fileName: cstring, text: [^]byte) -> bool --- // Save text data to file (write), string must be '\0' terminated, returns true on success
|
||||
|
||||
// File system functions
|
||||
|
||||
FileExists :: proc(fileName: cstring) -> bool --- // Check if file exists
|
||||
DirectoryExists :: proc(dirPath: cstring) -> bool --- // Check if a directory path exists
|
||||
IsFileExtension :: proc(fileName, ext: cstring) -> bool --- // Check file extension (including point: .png, .wav)
|
||||
@@ -1096,7 +1127,7 @@ foreign lib {
|
||||
GetDirectoryPath :: proc(filePath: cstring) -> cstring --- // Get full path for a given fileName with path (uses static string)
|
||||
GetPrevDirectoryPath :: proc(dirPath: cstring) -> cstring --- // Get previous directory path for a given path (uses static string)
|
||||
GetWorkingDirectory :: proc() -> cstring --- // Get current working directory (uses static string)
|
||||
GetApplicationDirectory :: proc() -> cstring --- // Get the directory if the running application (uses static string)
|
||||
GetApplicationDirectory :: proc() -> cstring --- // Get the directory of the running application (uses static string)
|
||||
ChangeDirectory :: proc(dir: cstring) -> bool --- // Change working directory, return true on success
|
||||
IsPathFile :: proc(path: cstring) -> bool --- // Check if a given path is a file or a directory
|
||||
LoadDirectoryFiles :: proc(dirPath: cstring) -> FilePathList --- // Load directory filepaths
|
||||
@@ -1114,19 +1145,31 @@ foreign lib {
|
||||
EncodeDataBase64 :: proc(data: rawptr, dataSize: c.int, outputSize: ^c.int) -> [^]byte --- // Encode data to Base64 string, memory must be MemFree()
|
||||
DecodeDataBase64 :: proc(data: rawptr, outputSize: ^c.int) -> [^]byte --- // Decode Base64 string data, memory must be MemFree()
|
||||
|
||||
// Automation events functionality
|
||||
|
||||
LoadAutomationEventList :: proc(fileName: cstring) -> AutomationEventList --- // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
|
||||
UnloadAutomationEventList :: proc(list: ^AutomationEventList) --- // Unload automation events list from file
|
||||
ExportAutomationEventList :: proc(list: AutomationEventList, fileName: cstring) -> bool --- // Export automation events list as text file
|
||||
SetAutomationEventList :: proc(list: ^AutomationEventList) --- // Set automation event list to record to
|
||||
SetAutomationEventBaseFrame :: proc(frame: c.int) --- // Set automation event internal base frame to start recording
|
||||
StartAutomationEventRecording :: proc() --- // Start recording automation events (AutomationEventList must be set)
|
||||
StopAutomationEventRecording :: proc() --- // Stop recording automation events
|
||||
PlayAutomationEvent :: proc(event: AutomationEvent) --- // Play a recorded automation event
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Input Handling Functions (Module: core)
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
// Input-related functions: keyboard
|
||||
|
||||
IsKeyPressed :: proc(key: KeyboardKey) -> bool --- // Detect if a key has been pressed once
|
||||
IsKeyDown :: proc(key: KeyboardKey) -> bool --- // Detect if a key is being pressed
|
||||
IsKeyReleased :: proc(key: KeyboardKey) -> bool --- // Detect if a key has been released once
|
||||
IsKeyUp :: proc(key: KeyboardKey) -> bool --- // Detect if a key is NOT being pressed
|
||||
SetExitKey :: proc(key: KeyboardKey) --- // Set a custom key to exit program (default is ESC)
|
||||
GetKeyPressed :: proc() -> KeyboardKey --- // Get key pressed (keycode), call it multiple times for keys queued
|
||||
GetCharPressed :: proc() -> rune --- // Get char pressed (unicode), call it multiple times for chars queued
|
||||
IsKeyPressed :: proc(key: KeyboardKey) -> bool --- // Detect if a key has been pressed once
|
||||
IsKeyPressedRepeat :: proc(key: KeyboardKey) -> bool --- // Check if a key has been pressed again (Only PLATFORM_DESKTOP)
|
||||
IsKeyDown :: proc(key: KeyboardKey) -> bool --- // Detect if a key is being pressed
|
||||
IsKeyReleased :: proc(key: KeyboardKey) -> bool --- // Detect if a key has been released once
|
||||
IsKeyUp :: proc(key: KeyboardKey) -> bool --- // Detect if a key is NOT being pressed
|
||||
GetKeyPressed :: proc() -> KeyboardKey --- // Get key pressed (keycode), call it multiple times for keys queued
|
||||
GetCharPressed :: proc() -> rune --- // Get char pressed (unicode), call it multiple times for chars queued
|
||||
SetExitKey :: proc(key: KeyboardKey) --- // Set a custom key to exit program (default is ESC)
|
||||
|
||||
// Input-related functions: gamepads
|
||||
|
||||
@@ -1146,7 +1189,12 @@ foreign lib {
|
||||
IsMouseButtonPressed :: proc(button: MouseButton) -> bool --- // Detect if a mouse button has been pressed once
|
||||
IsMouseButtonDown :: proc(button: MouseButton) -> bool --- // Detect if a mouse button is being pressed
|
||||
IsMouseButtonReleased :: proc(button: MouseButton) -> bool --- // Detect if a mouse button has been released once
|
||||
IsMouseButtonUp :: proc(button: MouseButton) -> bool --- // Detect if a mouse button is NOT being pressed
|
||||
|
||||
when VERSION != "5.0" {
|
||||
#panic("IsMouseButtonUp was broken in Raylib 5.0 but should be fixed in Raylib > 5.0. Remove this panic and the when block around it and also remove the workaround version of IsMouseButtonUp just after the end of the 'foreign lib {' block.")
|
||||
IsMouseButtonUp :: proc(button: MouseButton) -> bool ---
|
||||
}
|
||||
|
||||
GetMouseX :: proc() -> c.int --- // Returns mouse position X
|
||||
GetMouseY :: proc() -> c.int --- // Returns mouse position Y
|
||||
GetMousePosition :: proc() -> Vector2 --- // Returns mouse position XY
|
||||
@@ -1200,18 +1248,17 @@ foreign lib {
|
||||
DrawPixel :: proc(posX, posY: c.int, color: Color) --- // Draw a pixel
|
||||
DrawPixelV :: proc(position: Vector2, color: Color) --- // Draw a pixel (Vector version)
|
||||
DrawLine :: proc(startPosX, startPosY, endPosX, endPosY: c.int, color: Color) --- // Draw a line
|
||||
DrawLineV :: proc(startPos, endPos: Vector2, color: Color) --- // Draw a line (Vector version)
|
||||
DrawLineEx :: proc(startPos, endPos: Vector2, thick: f32, color: Color) --- // Draw a line defining thickness
|
||||
DrawLineBezier :: proc(startPos, endPos: Vector2, thick: f32, color: Color) --- // Draw a line using cubic-bezier curves in-out
|
||||
DrawLineBezierQuad :: proc(startPos, endPos: Vector2, controlPos: Vector2, thick: f32, color: Color) --- // Draw line using quadratic bezier curves with a control point
|
||||
DrawLineBezierCubic :: proc(startPos, endPos: Vector2, startControlPos, endControlPos: Vector2, thick: f32, color: Color) --- // Draw line using cubic bezier curves with 2 control points
|
||||
DrawLineStrip :: proc(points: [^]Vector2, pointCount: c.int, color: Color) --- // Draw lines sequence
|
||||
DrawLineV :: proc(startPos, endPos: Vector2, color: Color) --- // Draw a line (using gl lines)
|
||||
DrawLineEx :: proc(startPos, endPos: Vector2, thick: f32, color: Color) --- // Draw a line (using triangles/quads)
|
||||
DrawLineStrip :: proc(points: [^]Vector2, pointCount: c.int, color: Color) --- // Draw lines sequence (using gl lines)
|
||||
DrawLineBezier :: proc(startPos, endPos: Vector2, thick: f32, color: Color) --- // Draw line segment cubic-bezier in-out interpolation
|
||||
DrawCircle :: proc(centerX, centerY: c.int, radius: f32, color: Color) --- // Draw a color-filled circle
|
||||
DrawCircleSector :: proc(center: Vector2, radius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw a piece of a circle
|
||||
DrawCircleSectorLines :: proc(center: Vector2, radius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw circle sector outline
|
||||
DrawCircleGradient :: proc(centerX, centerY: c.int, radius: f32, color1, color2: Color) --- // Draw a gradient-filled circle
|
||||
DrawCircleV :: proc(center: Vector2, radius: f32, color: Color) --- // Draw a color-filled circle (Vector version)
|
||||
DrawCircleLines :: proc(centerX, centerY: c.int, radius: f32, color: Color) --- // Draw circle outline
|
||||
DrawCircleLinesV :: proc(center: Vector2, radius: f32, color: Color) --- // Draw circle outline (Vector version)
|
||||
DrawEllipse :: proc(centerX, centerY: c.int, radiusH, radiusV: f32, color: Color) --- // Draw ellipse
|
||||
DrawEllipseLines :: proc(centerX, centerY: c.int, radiusH, radiusV: f32, color: Color) --- // Draw ellipse outline
|
||||
DrawRing :: proc(center: Vector2, innerRadius, outerRadius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw ring
|
||||
@@ -1235,6 +1282,24 @@ foreign lib {
|
||||
DrawPolyLines :: proc(center: Vector2, sides: c.int, radius: f32, rotation: f32, color: Color) --- // Draw a polygon outline of n sides
|
||||
DrawPolyLinesEx :: proc(center: Vector2, sides: c.int, radius: f32, rotation: f32, lineThick: f32, color: Color) --- // Draw a polygon outline of n sides with extended parameters
|
||||
|
||||
// Splines drawing functions
|
||||
DrawSplineLinear :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: Linear, minimum 2 points
|
||||
DrawSplineBasis :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: B-Spline, minimum 4 points
|
||||
DrawSplineCatmullRom :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: Catmull-Rom, minimum 4 points
|
||||
DrawSplineBezierQuadratic :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||
DrawSplineBezierCubic :: proc(points: [^]Vector2, pointCount: c.int, thick: f32, color: Color) --- // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||
DrawSplineSegmentLinear :: proc(p1, p2: Vector2, thick: f32, color: Color) --- // Draw spline segment: Linear, 2 points
|
||||
DrawSplineSegmentBasis :: proc(p1, p2, p3, p4: Vector2, thick: f32, color: Color) --- // Draw spline segment: B-Spline, 4 points
|
||||
DrawSplineSegmentCatmullRom :: proc(p1, p2, p3, p4: Vector2, thick: f32, color: Color) --- // Draw spline segment: Catmull-Rom, 4 points
|
||||
DrawSplineSegmentBezierQuadratic :: proc(p1, c2, p3: Vector2, thick: f32, color: Color) --- // Draw spline segment: Quadratic Bezier, 2 points, 1 control point
|
||||
DrawSplineSegmentBezierCubic :: proc(p1, c2, c3, p4: Vector2, thick: f32, color: Color) --- // Draw spline segment: Cubic Bezier, 2 points, 2 control points
|
||||
|
||||
// Spline segment point evaluation functions, for a given t [0.0f .. 1.0f]
|
||||
GetSplinePointLinear :: proc(startPos, endPos: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: Linear
|
||||
GetSplinePointBasis :: proc(p1, p2, p3, p4: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: B-Spline
|
||||
GetSplinePointCatmullRom :: proc(p1, p2, p3, p4: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: Catmull-Rom
|
||||
GetSplinePointBezierQuad :: proc(p1, c2, p3: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: Quadratic Bezier
|
||||
GetSplinePointBezierCubic :: proc(p1, c2, c3, p4: Vector2, t: f32) -> Vector2 --- // Get (evaluate) spline point: Cubic Bezier
|
||||
// Basic shapes collision detection functions
|
||||
CheckCollisionRecs :: proc(rec1, rec2: Rectangle) -> bool --- // Check collision between two rectangles
|
||||
CheckCollisionCircles :: proc(center1: Vector2, radius1: f32, center2: Vector2, radius2: f32) -> bool --- // Check collision between two circles
|
||||
@@ -1254,6 +1319,7 @@ foreign lib {
|
||||
|
||||
LoadImage :: proc(fileName: cstring) -> Image --- // Load image from file into CPU memory (RAM)
|
||||
LoadImageRaw :: proc(fileName: cstring, width, height: c.int, format: PixelFormat, headerSize: c.int) -> Image --- // Load image from RAW file data
|
||||
LoadImageSvg :: proc(fileNameOrString: cstring, width, height: c.int) -> Image --- // Load image from SVG file data or string with specified size
|
||||
LoadImageAnim :: proc(fileName: cstring, frames: [^]c.int) -> Image --- // Load image sequence from file (frames appended to image.data)
|
||||
LoadImageFromMemory :: proc(fileType: cstring, fileData: rawptr, dataSize: c.int) -> Image --- // Load image from memory buffer, fileType refers to extension: i.e. '.png'
|
||||
LoadImageFromTexture :: proc(texture: Texture2D) -> Image --- // Load image from GPU texture data
|
||||
@@ -1261,14 +1327,15 @@ foreign lib {
|
||||
IsImageReady :: proc(image: Image) -> bool --- // Check if an image is ready
|
||||
UnloadImage :: proc(image: Image) --- // Unload image from CPU memory (RAM)
|
||||
ExportImage :: proc(image: Image, fileName: cstring) -> bool --- // Export image data to file, returns true on success
|
||||
ExportImageToMemory :: proc(image: Image, fileType: cstring, fileSize: ^c.int) -> rawptr --- // Export image to memory buffer
|
||||
ExportImageAsCode :: proc(image: Image, fileName: cstring) -> bool --- // Export image as code file defining an array of bytes, returns true on success
|
||||
|
||||
// Image generation functions
|
||||
|
||||
GenImageColor :: proc(width, height: c.int, color: Color) -> Image --- // Generate image: plain color
|
||||
GenImageGradientV :: proc(width, height: c.int, top, bottom: Color) -> Image --- // Generate image: vertical gradient
|
||||
GenImageGradientH :: proc(width, height: c.int, left, right: Color) -> Image --- // Generate image: horizontal gradient
|
||||
GenImageGradientLinear :: proc(width, height, direction: c.int, start, end: Color) -> Image --- // Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient
|
||||
GenImageGradientRadial :: proc(width, height: c.int, density: f32, inner, outer: Color) -> Image --- // Generate image: radial gradient
|
||||
GenImageGradientSquare :: proc(width, height: c.int, density: f32, inner, outer: Color) -> Image --- // Generate image: square gradient
|
||||
GenImageChecked :: proc(width, height: c.int, checksX, checksY: c.int, col1, col2: Color) -> Image --- // Generate image: checked
|
||||
GenImageWhiteNoise :: proc(width, height: c.int, factor: f32) -> Image --- // Generate image: white noise
|
||||
GenImagePerlinNoise :: proc(width, height: c.int, offsetX, offsetY: c.int, scale: f32) -> Image --- // Generate image: perlin noise
|
||||
@@ -1296,6 +1363,7 @@ foreign lib {
|
||||
ImageDither :: proc(image: ^Image, rBpp, gBpp, bBpp, aBpp: c.int) --- // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
ImageFlipVertical :: proc(image: ^Image) --- // Flip image vertically
|
||||
ImageFlipHorizontal :: proc(image: ^Image) --- // Flip image horizontally
|
||||
ImageRotate :: proc(image: ^Image, degrees: c.int) --- // Rotate image by input angle in degrees( -359 to 359)
|
||||
ImageRotateCW :: proc(image: ^Image) --- // Rotate image clockwise 90deg
|
||||
ImageRotateCCW :: proc(image: ^Image) --- // Rotate image counter-clockwise 90deg
|
||||
ImageColorTint :: proc(image: ^Image, color: Color) --- // Modify image color: tint
|
||||
@@ -1386,34 +1454,35 @@ foreign lib {
|
||||
|
||||
// Font loading/unloading functions
|
||||
|
||||
GetFontDefault :: proc() -> Font --- // Get the default Font
|
||||
LoadFont :: proc(fileName: cstring) -> Font --- // Load font from file into GPU memory (VRAM)
|
||||
LoadFontEx :: proc(fileName: cstring, fontSize: c.int, fontChars: [^]rune, glyphCount: c.int) -> Font --- // Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set
|
||||
LoadFontFromImage :: proc(image: Image, key: Color, firstChar: rune) -> Font --- // Load font from Image (XNA style)
|
||||
LoadFontFromMemory :: proc(fileType: cstring, fileData: rawptr, dataSize: c.int, fontSize: c.int, fontChars: [^]rune, glyphCount: c.int) -> Font --- // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
IsFontReady :: proc(font: Font) -> bool --- // Check if a font is ready
|
||||
LoadFontData :: proc(fileData: rawptr, dataSize: c.int, fontSize: c.int, fontChars: [^]rune, glyphCount: c.int, type: FontType) -> [^]GlyphInfo --- // Load font data for further use
|
||||
GenImageFontAtlas :: proc(chars: [^]GlyphInfo, recs: ^[^]Rectangle, glyphCount: c.int, fontSize: c.int, padding: c.int, packMethod: c.int) -> Image --- // Generate image font atlas using chars info
|
||||
UnloadFontData :: proc(chars: [^]GlyphInfo, glyphCount: c.int) --- // Unload font chars info data (RAM)
|
||||
UnloadFont :: proc(font: Font) --- // Unload font from GPU memory (VRAM)
|
||||
ExportFontAsCode :: proc(font: Font, fileName: cstring) -> bool --- // Export font as code file, returns true on success
|
||||
GetFontDefault :: proc() -> Font --- // Get the default Font
|
||||
LoadFont :: proc(fileName: cstring) -> Font --- // Load font from file into GPU memory (VRAM)
|
||||
LoadFontEx :: proc(fileName: cstring, fontSize: c.int, codepoints: [^]rune, codepointCount: c.int) -> Font --- // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set
|
||||
LoadFontFromImage :: proc(image: Image, key: Color, firstChar: rune) -> Font --- // Load font from Image (XNA style)
|
||||
LoadFontFromMemory :: proc(fileType: cstring, fileData: rawptr, dataSize: c.int, fontSize: c.int, codepoints: [^]rune, codepointCount: c.int) -> Font --- // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
IsFontReady :: proc(font: Font) -> bool --- // Check if a font is ready
|
||||
LoadFontData :: proc(fileData: rawptr, dataSize: c.int, fontSize: c.int, codepoints: [^]rune, codepointCount: c.int, type: FontType) -> [^]GlyphInfo --- // Load font data for further use
|
||||
GenImageFontAtlas :: proc(glyphs: [^]GlyphInfo, glyphRecs: ^[^]Rectangle, codepointCount: c.int, fontSize: c.int, padding: c.int, packMethod: c.int) -> Image --- // Generate image font atlas using chars info
|
||||
UnloadFontData :: proc(glyphs: [^]GlyphInfo, glyphCount: c.int) --- // Unload font chars info data (RAM)
|
||||
UnloadFont :: proc(font: Font) --- // Unload font from GPU memory (VRAM)
|
||||
ExportFontAsCode :: proc(font: Font, fileName: cstring) -> bool --- // Export font as code file, returns true on success
|
||||
|
||||
// Text drawing functions
|
||||
|
||||
DrawFPS :: proc(posX, posY: c.int) --- // Draw current FPS
|
||||
DrawText :: proc(text: cstring, posX, posY: c.int, fontSize: c.int, color: Color) --- // Draw text (using default font)
|
||||
DrawTextEx :: proc(font: Font, text: cstring, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw text using font and additional parameters
|
||||
DrawTextPro :: proc(font: Font, text: cstring, position, origin: Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: Color) --- // Draw text using Font and pro parameters (rotation)
|
||||
DrawTextCodepoint :: proc(font: Font, codepoint: rune, position: Vector2, fontSize: f32, tint: Color) --- // Draw one character (codepoint)
|
||||
DrawTextCodepoints :: proc(font: Font, codepoints: [^]rune, count: c.int, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw multiple character (codepoint)
|
||||
DrawFPS :: proc(posX, posY: c.int) --- // Draw current FPS
|
||||
DrawText :: proc(text: cstring, posX, posY: c.int, fontSize: c.int, color: Color) --- // Draw text (using default font)
|
||||
DrawTextEx :: proc(font: Font, text: cstring, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw text using font and additional parameters
|
||||
DrawTextPro :: proc(font: Font, text: cstring, position, origin: Vector2, rotation: f32, fontSize: f32, spacing: f32, tint: Color) --- // Draw text using Font and pro parameters (rotation)
|
||||
DrawTextCodepoint :: proc(font: Font, codepoint: rune, position: Vector2, fontSize: f32, tint: Color) --- // Draw one character (codepoint)
|
||||
DrawTextCodepoints :: proc(font: Font, codepoints: [^]rune, codepointCount: c.int, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw multiple character (codepoint)
|
||||
|
||||
// Text font info functions
|
||||
|
||||
MeasureText :: proc(text: cstring, fontSize: c.int) -> c.int --- // Measure string width for default font
|
||||
MeasureTextEx :: proc(font: Font, text: cstring, fontSize: f32, spacing: f32) -> Vector2 --- // Measure string size for Font
|
||||
GetGlyphIndex :: proc(font: Font, codepoint: rune) -> c.int --- // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
|
||||
GetGlyphInfo :: proc(font: Font, codepoint: rune) -> GlyphInfo --- // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
|
||||
GetGlyphAtlasRec :: proc(font: Font, codepoint: rune) -> Rectangle --- // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
|
||||
SetTextLineSpacing :: proc(spacing: c.int) --- // Set vertical line spacing when drawing with line-breaks
|
||||
MeasureText :: proc(text: cstring, fontSize: c.int) -> c.int --- // Measure string width for default font
|
||||
MeasureTextEx :: proc(font: Font, text: cstring, fontSize: f32, spacing: f32) -> Vector2 --- // Measure string size for Font
|
||||
GetGlyphIndex :: proc(font: Font, codepoint: rune) -> c.int --- // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
|
||||
GetGlyphInfo :: proc(font: Font, codepoint: rune) -> GlyphInfo --- // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
|
||||
GetGlyphAtlasRec :: proc(font: Font, codepoint: rune) -> Rectangle --- // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
|
||||
|
||||
// Text codepoints management functions (unicode characters)
|
||||
|
||||
@@ -1536,10 +1605,10 @@ foreign lib {
|
||||
|
||||
// Model animations loading/unloading functions
|
||||
|
||||
LoadModelAnimations :: proc(fileName: cstring, animCount: ^c.uint) -> [^]ModelAnimation --- // Load model animations from file
|
||||
LoadModelAnimations :: proc(fileName: cstring, animCount: ^c.int) -> [^]ModelAnimation --- // Load model animations from file
|
||||
UpdateModelAnimation :: proc(model: Model, anim: ModelAnimation, frame: c.int) --- // Update model animation pose
|
||||
UnloadModelAnimation :: proc(anim: ModelAnimation) --- // Unload animation data
|
||||
UnloadModelAnimations :: proc(animations: [^]ModelAnimation, count: c.uint) --- // Unload animation array data
|
||||
UnloadModelAnimations :: proc(animations: [^]ModelAnimation, animCount: c.int) --- // Unload animation array data
|
||||
IsModelAnimationValid :: proc(model: Model, anim: ModelAnimation) -> bool --- // Check model animation skeleton match
|
||||
|
||||
// Collision detection functions
|
||||
@@ -1563,6 +1632,7 @@ foreign lib {
|
||||
CloseAudioDevice :: proc() --- // Close the audio device and context
|
||||
IsAudioDeviceReady :: proc() -> bool --- // Check if audio device has been initialized successfully
|
||||
SetMasterVolume :: proc(volume: f32) --- // Set master volume (listener)
|
||||
GetMasterVolume :: proc() -> f32 --- // Get master volume (listener)
|
||||
|
||||
// Wave/Sound loading/unloading functions
|
||||
|
||||
@@ -1571,10 +1641,12 @@ foreign lib {
|
||||
IsWaveReady :: proc(wave: Wave) -> bool --- // Checks if wave data is ready
|
||||
LoadSound :: proc(fileName: cstring) -> Sound --- // Load sound from file
|
||||
LoadSoundFromWave :: proc(wave: Wave) -> Sound --- // Load sound from wave data
|
||||
LoadSoundAlias :: proc(source: Sound) -> Sound --- // Create a new sound that shares the same sample data as the source sound, does not own the sound data
|
||||
IsSoundReady :: proc(sound: Sound) -> bool --- // Checks if a sound is ready
|
||||
UpdateSound :: proc(sound: Sound, data: rawptr, sampleCount: c.int) --- // Update sound buffer with new data
|
||||
UpdateSound :: proc(sound: Sound, data: rawptr, frameCount: c.int) --- // Update sound buffer with new data
|
||||
UnloadWave :: proc(wave: Wave) --- // Unload wave data
|
||||
UnloadSound :: proc(sound: Sound) --- // Unload sound
|
||||
UnloadSoundAlias :: proc(alias: Sound) --- // Unload a sound alias (does not deallocate sample data)
|
||||
ExportWave :: proc(wave: Wave, fileName: cstring) -> bool --- // Export wave data to file, returns true on success
|
||||
ExportWaveAsCode :: proc(wave: Wave, fileName: cstring) -> bool --- // Export wave sample data to code (.h), returns true on success
|
||||
|
||||
@@ -1594,6 +1666,7 @@ foreign lib {
|
||||
LoadWaveSamples :: proc(wave: Wave) -> [^]f32 --- // Load samples data from wave as a 32bit float data array
|
||||
UnloadWaveSamples :: proc(samples: [^]f32) --- // Unload samples data loaded with LoadWaveSamples()
|
||||
|
||||
|
||||
// Music management functions
|
||||
|
||||
LoadMusicStream :: proc(fileName: cstring) -> Music --- // Load music stream from file
|
||||
@@ -1631,14 +1704,21 @@ foreign lib {
|
||||
SetAudioStreamBufferSizeDefault :: proc(size: c.int) --- // Default size for new audio streams
|
||||
SetAudioStreamCallback :: proc(stream: AudioStream, callback: AudioCallback) --- // Audio thread callback to request new data
|
||||
|
||||
AttachAudioStreamProcessor :: proc(stream: AudioStream, processor: AudioCallback) --- // Attach audio stream processor to stream
|
||||
AttachAudioStreamProcessor :: proc(stream: AudioStream, processor: AudioCallback) --- // Attach audio stream processor to stream, receives the samples as <float>s
|
||||
DetachAudioStreamProcessor :: proc(stream: AudioStream, processor: AudioCallback) --- // Detach audio stream processor from stream
|
||||
|
||||
AttachAudioMixedProcessor :: proc(processor: AudioCallback) --- // Attach audio stream processor to the entire audio pipeline
|
||||
AttachAudioMixedProcessor :: proc(processor: AudioCallback) --- // Attach audio stream processor to the entire audio pipeline, receives the samples as <float>s
|
||||
DetachAudioMixedProcessor :: proc(processor: AudioCallback) --- // Detach audio stream processor from the entire audio pipeline
|
||||
}
|
||||
|
||||
|
||||
// Workaround for broken IsMouseButtonUp in Raylib 5.0.
|
||||
when VERSION == "5.0" {
|
||||
IsMouseButtonUp :: proc(button: MouseButton) -> bool {
|
||||
return !IsMouseButtonDown(button)
|
||||
}
|
||||
} else {
|
||||
#panic("Remove this this when block and everything inside it for Raylib > 5.0. It's just here to fix a bug in Raylib 5.0. See IsMouseButtonUp inside 'foreign lib {' block.")
|
||||
}
|
||||
|
||||
// Text formatting with variables (sprintf style)
|
||||
TextFormat :: proc(text: cstring, args: ..any) -> cstring {
|
||||
|
||||
Vendored
+84
-73
@@ -1,83 +1,84 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* rlgl v4.5 - A multi-OpenGL abstraction layer with an immediate-mode style API
|
||||
* rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API
|
||||
*
|
||||
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0)
|
||||
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
|
||||
* DESCRIPTION:
|
||||
* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0)
|
||||
* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...)
|
||||
*
|
||||
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
|
||||
* initialized on rlglInit() to accumulate vertex data.
|
||||
* ADDITIONAL NOTES:
|
||||
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
|
||||
* initialized on rlglInit() to accumulate vertex data.
|
||||
*
|
||||
* When an internal state change is required all the stored vertex data is renderer in batch,
|
||||
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch.
|
||||
* When an internal state change is required all the stored vertex data is renderer in batch,
|
||||
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch.
|
||||
*
|
||||
* Some additional resources are also loaded for convenience, here the complete list:
|
||||
* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data
|
||||
* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8
|
||||
* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs)
|
||||
*
|
||||
* Internal buffer (and additional resources) must be manually unloaded calling rlglClose().
|
||||
* Some resources are also loaded for convenience, here the complete list:
|
||||
* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data
|
||||
* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8
|
||||
* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs)
|
||||
*
|
||||
* Internal buffer (and resources) must be manually unloaded calling rlglClose().
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define GRAPHICS_API_OPENGL_11
|
||||
* #define GRAPHICS_API_OPENGL_21
|
||||
* #define GRAPHICS_API_OPENGL_33
|
||||
* #define GRAPHICS_API_OPENGL_43
|
||||
* #define GRAPHICS_API_OPENGL_ES2
|
||||
* #define GRAPHICS_API_OPENGL_ES3
|
||||
* Use selected OpenGL graphics backend, should be supported by platform
|
||||
* Those preprocessor defines are only used on rlgl module, if OpenGL version is
|
||||
* required by any other module, use rlGetVersion() to check it
|
||||
*
|
||||
* #define GRAPHICS_API_OPENGL_11
|
||||
* #define GRAPHICS_API_OPENGL_21
|
||||
* #define GRAPHICS_API_OPENGL_33
|
||||
* #define GRAPHICS_API_OPENGL_43
|
||||
* #define GRAPHICS_API_OPENGL_ES2
|
||||
* Use selected OpenGL graphics backend, should be supported by platform
|
||||
* Those preprocessor defines are only used on rlgl module, if OpenGL version is
|
||||
* required by any other module, use rlGetVersion() to check it
|
||||
* #define RLGL_IMPLEMENTATION
|
||||
* Generates the implementation of the library into the included file.
|
||||
* If not defined, the library is in header only mode and can be included in other headers
|
||||
* or source files without problems. But only ONE file should hold the implementation.
|
||||
*
|
||||
* #define RLGL_IMPLEMENTATION
|
||||
* Generates the implementation of the library into the included file.
|
||||
* If not defined, the library is in header only mode and can be included in other headers
|
||||
* or source files without problems. But only ONE file should hold the implementation.
|
||||
* #define RLGL_RENDER_TEXTURES_HINT
|
||||
* Enable framebuffer objects (fbo) support (enabled by default)
|
||||
* Some GPUs could not support them despite the OpenGL version
|
||||
*
|
||||
* #define RLGL_RENDER_TEXTURES_HINT
|
||||
* Enable framebuffer objects (fbo) support (enabled by default)
|
||||
* Some GPUs could not support them despite the OpenGL version
|
||||
* #define RLGL_SHOW_GL_DETAILS_INFO
|
||||
* Show OpenGL extensions and capabilities detailed logs on init
|
||||
*
|
||||
* #define RLGL_SHOW_GL_DETAILS_INFO
|
||||
* Show OpenGL extensions and capabilities detailed logs on init
|
||||
* #define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT
|
||||
* Enable debug context (only available on OpenGL 4.3)
|
||||
*
|
||||
* #define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT
|
||||
* Enable debug context (only available on OpenGL 4.3)
|
||||
* rlgl capabilities could be customized just defining some internal
|
||||
* values before library inclusion (default values listed):
|
||||
*
|
||||
* rlgl capabilities could be customized just defining some internal
|
||||
* values before library inclusion (default values listed):
|
||||
* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits
|
||||
* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||
* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||
* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
*
|
||||
* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits
|
||||
* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||
* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||
* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
* #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.01 // Default projection matrix near cull distance
|
||||
* #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance
|
||||
*
|
||||
* #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.01 // Default projection matrix near cull distance
|
||||
* #define RL_CULL_DISTANCE_FAR 1000.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:
|
||||
*
|
||||
* When loading a shader, the following vertex attribute and uniform
|
||||
* location names are tried to be set automatically:
|
||||
*
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: 1
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: 1
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4
|
||||
* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: 5
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
|
||||
* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
||||
* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
*
|
||||
* - OpenGL libraries (depending on platform and OpenGL version selected)
|
||||
* - GLAD OpenGL extensions loading library (only for OpenGL 3.3 Core, 4.3 Core)
|
||||
*
|
||||
@@ -108,6 +109,8 @@ package raylib
|
||||
|
||||
import "core:c"
|
||||
|
||||
RLGL_VERSION :: "4.5"
|
||||
|
||||
when ODIN_OS == .Windows {
|
||||
foreign import lib {
|
||||
"windows/raylib.lib",
|
||||
@@ -143,7 +146,12 @@ RL_GRAPHICS_API_OPENGL_21 :: true
|
||||
RL_GRAPHICS_API_OPENGL_33 :: RL_GRAPHICS_API_OPENGL_21 // default currently
|
||||
RL_GRAPHICS_API_OPENGL_ES2 :: false
|
||||
RL_GRAPHICS_API_OPENGL_43 :: false
|
||||
RL_GRAPHICS_API_OPENGL_ES3 :: false
|
||||
|
||||
when RL_GRAPHICS_API_OPENGL_ES3 {
|
||||
RL_GRAPHICS_API_OPENGL_ES2 :: true
|
||||
}
|
||||
|
||||
when !RL_GRAPHICS_API_OPENGL_ES2 {
|
||||
// This is the maximum amount of elements (quads) per batch
|
||||
// NOTE: Be careful with text, every letter maps to a quad
|
||||
@@ -300,6 +308,7 @@ GlVersion :: enum c.int {
|
||||
OPENGL_33, // OpenGL 3.3 (GLSL 330)
|
||||
OPENGL_43, // OpenGL 4.3 (using GLSL 330)
|
||||
OPENGL_ES_20, // OpenGL ES 2.0 (GLSL 100)
|
||||
OPENGL_ES_30, // OpenGL ES 3.0 (GLSL 300 es)
|
||||
}
|
||||
|
||||
|
||||
@@ -315,13 +324,13 @@ ShaderAttributeDataType :: enum c.int {
|
||||
// NOTE: By default up to 8 color channels defined, but it can be more
|
||||
FramebufferAttachType :: enum c.int {
|
||||
COLOR_CHANNEL0 = 0, // Framebuffer attachment type: color 0
|
||||
COLOR_CHANNEL1, // Framebuffer attachment type: color 1
|
||||
COLOR_CHANNEL2, // Framebuffer attachment type: color 2
|
||||
COLOR_CHANNEL3, // Framebuffer attachment type: color 3
|
||||
COLOR_CHANNEL4, // Framebuffer attachment type: color 4
|
||||
COLOR_CHANNEL5, // Framebuffer attachment type: color 5
|
||||
COLOR_CHANNEL6, // Framebuffer attachment type: color 6
|
||||
COLOR_CHANNEL7, // Framebuffer attachment type: color 7
|
||||
COLOR_CHANNEL1 = 1, // Framebuffer attachment type: color 1
|
||||
COLOR_CHANNEL2 = 2, // Framebuffer attachment type: color 2
|
||||
COLOR_CHANNEL3 = 3, // Framebuffer attachment type: color 3
|
||||
COLOR_CHANNEL4 = 4, // Framebuffer attachment type: color 4
|
||||
COLOR_CHANNEL5 = 5, // Framebuffer attachment type: color 5
|
||||
COLOR_CHANNEL6 = 6, // Framebuffer attachment type: color 6
|
||||
COLOR_CHANNEL7 = 7, // Framebuffer attachment type: color 7
|
||||
DEPTH = 100, // Framebuffer attachment type: depth
|
||||
STENCIL = 200, // Framebuffer attachment type: stencil
|
||||
}
|
||||
@@ -329,11 +338,11 @@ FramebufferAttachType :: enum c.int {
|
||||
// Framebuffer texture attachment type
|
||||
FramebufferAttachTextureType :: enum c.int {
|
||||
CUBEMAP_POSITIVE_X = 0, // Framebuffer texture attachment type: cubemap, +X side
|
||||
CUBEMAP_NEGATIVE_X, // Framebuffer texture attachment type: cubemap, -X side
|
||||
CUBEMAP_POSITIVE_Y, // Framebuffer texture attachment type: cubemap, +Y side
|
||||
CUBEMAP_NEGATIVE_Y, // Framebuffer texture attachment type: cubemap, -Y side
|
||||
CUBEMAP_POSITIVE_Z, // Framebuffer texture attachment type: cubemap, +Z side
|
||||
CUBEMAP_NEGATIVE_Z, // Framebuffer texture attachment type: cubemap, -Z side
|
||||
CUBEMAP_NEGATIVE_X = 1, // Framebuffer texture attachment type: cubemap, -X side
|
||||
CUBEMAP_POSITIVE_Y = 2, // Framebuffer texture attachment type: cubemap, +Y side
|
||||
CUBEMAP_NEGATIVE_Y = 3, // Framebuffer texture attachment type: cubemap, -Y side
|
||||
CUBEMAP_POSITIVE_Z = 4, // Framebuffer texture attachment type: cubemap, +Z side
|
||||
CUBEMAP_NEGATIVE_Z = 5, // Framebuffer texture attachment type: cubemap, -Z side
|
||||
TEXTURE2D = 100, // Framebuffer texture attachment type: texture2d
|
||||
RENDERBUFFER = 200, // Framebuffer texture attachment type: renderbuffer
|
||||
}
|
||||
@@ -411,6 +420,7 @@ foreign lib {
|
||||
rlEnableFramebuffer :: proc(id: c.uint) --- // Enable render texture (fbo)
|
||||
rlDisableFramebuffer :: proc() --- // Disable render texture (fbo), return to default framebuffer
|
||||
rlActiveDrawBuffers :: proc(count: c.int) --- // Activate multiple draw color buffers
|
||||
rlBlitFramebuffer :: proc(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask: c.int) --- // Blit active framebuffer to main framebuffer
|
||||
|
||||
// General render state
|
||||
rlDisableColorBlend :: proc() --- // Disable color blending
|
||||
@@ -425,7 +435,8 @@ foreign lib {
|
||||
rlDisableScissorTest :: proc() --- // Disable scissor test
|
||||
rlScissor :: proc(x, y, width, height: c.int) --- // Scissor test
|
||||
rlEnableWireMode :: proc() --- // Enable wire mode
|
||||
rlDisableWireMode :: proc() --- // Disable wire mode
|
||||
rlEnablePointMode :: proc() --- // Enable point mode
|
||||
rlDisableWireMode :: proc() --- // Disable wire and point modes
|
||||
rlSetLineWidth :: proc(width: f32) --- // Set the line drawing width
|
||||
rlGetLineWidth :: proc() -> f32 --- // Get the line drawing width
|
||||
rlEnableSmoothLines :: proc() --- // Enable line aliasing
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user