Merge branch 'odin-lang:master' into parser-fix

This commit is contained in:
DanielGavin
2021-11-09 14:30:34 +01:00
committed by GitHub
19 changed files with 441 additions and 188 deletions

View File

@@ -1,7 +1,6 @@
package os2
import "core:mem"
import "core:io"
import "core:strconv"
import "core:unicode/utf8"

View File

@@ -1,7 +1,6 @@
//+private
package os2
import "core:runtime"
import "core:mem"
import win32 "core:sys/windows"

View File

@@ -137,11 +137,17 @@ i32 linker_stage(lbGenerator *gen) {
if (is_arch_wasm()) {
timings_start_section(timings, str_lit("wasm-ld"));
#if defined(GB_SYSTEM_WINDOWS)
result = system_exec_command_line_app("wasm-ld",
"\"%.*s\\bin\\wasm-ld\" \"%.*s.wasm.o\" -o \"%.*s.wasm\" %.*s %.*s",
LIT(build_context.ODIN_ROOT),
LIT(output_base), LIT(output_base), LIT(build_context.link_flags), LIT(build_context.extra_linker_flags));
#else
result = system_exec_command_line_app("wasm-ld",
"wasm-ld \"%.*s.wasm.o\" -o \"%.*s.wasm\" %.*s %.*s",
LIT(output_base), LIT(output_base), LIT(build_context.link_flags), LIT(build_context.extra_linker_flags));
#endif
return result;
}

109
vendor/raylib/README.md vendored Normal file
View File

@@ -0,0 +1,109 @@
<img align="left" src="https://github.com/raysan5/raylib/blob/master/logo/raylib_logo_animation.gif" width="288px">
**raylib is a simple and easy-to-use library to enjoy videogames programming.**
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education.
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
---
<br>
[![GitHub contributors](https://img.shields.io/github/contributors/raysan5/raylib)](https://github.com/raysan5/raylib/graphs/contributors)
[![GitHub All Releases](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/4.0.0)](https://github.com/raysan5/raylib/commits/master)
[![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE)
[![Chat on Discord](https://img.shields.io/discord/426912293134270465.svg?logo=discord)](https://discord.gg/raylib)
[![GitHub stars](https://img.shields.io/github/stars/raysan5/raylib?style=social)](https://github.com/raysan5/raylib/stargazers)
[![Twitter Follow](https://img.shields.io/twitter/follow/raysan5?style=social)](https://twitter.com/raysan5)
[![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/raylib?style=social)](https://www.reddit.com/r/raylib/)
[![Windows](https://github.com/raysan5/raylib/workflows/Windows/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AWindows)
[![Linux](https://github.com/raysan5/raylib/workflows/Linux/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3ALinux)
[![macOS](https://github.com/raysan5/raylib/workflows/macOS/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AmacOS)
[![Android](https://github.com/raysan5/raylib/workflows/Android/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AAndroid)
[![WebAssembly](https://github.com/raysan5/raylib/workflows/WebAssembly/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3AWebAssembly)
[![CMakeBuilds](https://github.com/raysan5/raylib/workflows/CMakeBuilds/badge.svg)](https://github.com/raysan5/raylib/actions?query=workflow%3ACMakeBuilds)
[![Windows Examples](https://github.com/raysan5/raylib/actions/workflows/windows_examples.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/windows_examples.yml)
[![Linux Examples](https://github.com/raysan5/raylib/actions/workflows/linux_examples.yml/badge.svg)](https://github.com/raysan5/raylib/actions/workflows/linux_examples.yml)
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) in PascalCase/camelCase notation
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.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, XNA fonts, AngelCode fonts)
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
- Flexible Materials system, supporting classic maps and **PBR maps**
- **Animated 3D models** supported (skeletal bones animation) (IQM)
- Shaders support, including model and **postprocessing** shaders.
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
- **VR stereo rendering** support with configurable HMD device parameters
- Huge examples collection with [+120 code examples](https://github.com/raysan5/raylib/tree/master/examples)!
- Bindings to [+50 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- **Free and open source**.
basic example
--------------
This is a basic raylib example, it creates a window and it draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
```odin
package example
import rl "vendor:raylib"
main :: proc() {
rl.InitWindow(800, 450, "raylib [core] example - basic window")
for !rl.WindowShouldClose() {
rl.BeginDrawing()
rl.ClearBackground(rl.RAYWHITE)
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY)
rl.EndDrawing()
}
rl.CloseWindow()
}
```
learning and docs
------------------
raylib is designed to be learned using [the examples](https://github.com/raysan5/raylib/tree/master/examples) as the main reference. There is no standard API documentation but there is a [**cheatsheet**](https://www.raylib.com/cheatsheet/cheatsheet.html) containing all the functions available on the library and a short description of each one of them, input parameters and result value names should be intuitive enough to understand how each function works.
Some additional documentation about raylib design can be found in raylib GitHub Wiki. Here the more relevant links:
- [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html)
- [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture)
- [raylib library design](https://github.com/raysan5/raylib/wiki)
- [raylib examples collection](https://github.com/raysan5/raylib/tree/master/examples)
- [raylib games collection](https://github.com/raysan5/raylib-games)
contact and networks
---------------------
raylib is present in several networks and raylib community is growing everyday. If you are using raylib and enjoying it, feel free to join us in any of these networks. The most active network is our [Discord server](https://discord.gg/raylib)! :)
- Webpage: [https://www.raylib.com](https://www.raylib.com)
- Discord: [https://discord.gg/raylib](https://discord.gg/raylib)
- Twitter: [https://www.twitter.com/raysan5](https://www.twitter.com/raysan5)
- Twitch: [https://www.twitch.tv/raysan5](https://www.twitch.tv/raysan5)
- Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
- Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
- YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/c/raylib)
license
-------
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
raylib uses internally some libraries for window/graphics/inputs management and also to support different fileformats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on raylib Wiki for details.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
vendor/raylib/linux/libraylib.so.4.0.0 vendored Normal file

Binary file not shown.

BIN
vendor/raylib/linux/libraylib.so.400 vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
vendor/raylib/macos/libraylib.400.dylib vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,3 +1,79 @@
/**********************************************************************************************
*
* raylib v4.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
* - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly,
* MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5.
* - Written in plain C code (C99) in PascalCase/camelCase notation
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3 or ES2 - choose at compile)
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
* - Multiple Fonts formats supported (TTF, XNA fonts, AngelCode fonts)
* - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
* - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
* - Flexible Materials system, supporting classic maps and PBR maps
* - Animated 3D models supported (skeletal bones animation) (IQM)
* - Shaders support, including Model shaders and Postprocessing shaders
* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
* - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
* - VR stereo rendering with configurable HMD device parameters
* - Bindings to multiple programming languages available!
*
* NOTES:
* - One default Font is loaded on InitWindow()->LoadFontDefault() [core, text]
* - One default Texture2D is loaded on rlglInit(), 1x1 white pixel R8G8B8A8 [rlgl] (OpenGL 3.3 or ES2)
* - One default Shader is loaded on rlglInit()->rlLoadShaderDefault() [rlgl] (OpenGL 3.3 or ES2)
* - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2)
*
* DEPENDENCIES (included):
* [rcore] rglfw (Camilla Löwy - github.com/glfw/glfw) for window/context management and input (PLATFORM_DESKTOP)
* [rlgl] glad (David Herberth - github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading (PLATFORM_DESKTOP)
* [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management
*
* OPTIONAL DEPENDENCIES (included):
* [rcore] msf_gif (Miles Fogle) for GIF recording
* [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorythm
* [rcore] sdefl (Micha Mettke) for DEFLATE compression algorythm
* [rtextures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...)
* [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG)
* [rtextures] stb_image_resize (Sean Barret) for image resizing algorithms
* [rtext] stb_truetype (Sean Barret) for ttf fonts loading
* [rtext] stb_rect_pack (Sean Barret) for rectangles packing
* [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation
* [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL)
* [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF)
* [raudio] dr_wav (David Reid) for WAV audio file loading
* [raudio] dr_flac (David Reid) for FLAC audio file loading
* [raudio] dr_mp3 (David Reid) for MP3 audio file loading
* [raudio] stb_vorbis (Sean Barret) for OGG audio loading
* [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading
* [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading
*
*
* LICENSE: zlib/libpng
*
* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software:
*
* Copyright (c) 2013-2021 Ramon Santamaria (@raysan5)
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose, including commercial
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not claim that you
* wrote the original software. If you use this software in a product, an acknowledgment
* in the product documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
* as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
**********************************************************************************************/
package raylib
import c "core:c/libc"
@@ -33,9 +109,12 @@ when ODIN_OS == "linux" {
}
when ODIN_OS == "darwin" { foreign import lib "macos/libraylib.a" }
VERSION :: "3.7"
VERSION :: "4.0"
PI :: 3.14159265358979323846
DEG2RAD :: PI/180.0
RAD2DEG :: 180.0/PI
PI :: 3.14159265358979323846
// Some Basic Colors
// NOTE: Custom raylib color palette for amazing visuals on WHITE background
@@ -91,27 +170,30 @@ when USE_LINALG {
// Quaternion type
Quaternion :: distinct quaternion128
// Matrix type (OpenGL style 4x4 - right handed, column major)
// Matrix, 4x4 components, column major, OpenGL style, right handed
Matrix :: struct {
m0, m4, m8, m12: f32,
m1, m5, m9, m13: f32,
m2, m6, m10, m14: f32,
m3, m7, m11, m15: f32,
m0, m4, m8, m12: f32, // Matrix first row (4 components)
m1, m5, m9, m13: f32, // Matrix second row (4 components)
m2, m6, m10, m14: f32, // Matrix third row (4 components)
m3, m7, m11, m15: f32, // Matrix fourth row (4 components)
}
}
// Color type, RGBA (32bit)
// Color, 4 components, R8G8B8A8 (32bit)
Color :: struct {
r, g, b, a: u8,
r: u8, // Color red value
g: u8, // Color green value
b: u8, // Color blue value
a: u8, // Color alpha value
}
// Rectangle type
Rectangle :: struct {
x: f32,
y: f32,
width: f32,
height: f32,
x: f32, // Rectangle top-left corner position x
y: f32, // Rectangle top-left corner position y
width: f32, // Rectangle width
height: f32, // Rectangle height
}
// Image type, bpp always RGBA (32bit)
@@ -161,7 +243,7 @@ NPatchInfo :: struct {
}
// Font character info
CharInfo :: struct {
GlyphInfo :: struct {
value: rune, // Character value (Unicode)
offsetX: c.int, // Character offset X when drawing
offsetY: c.int, // Character offset Y when drawing
@@ -176,7 +258,7 @@ Font :: struct {
charsPadding: c.int, // Padding around the chars
texture: Texture2D, // Characters texture atlas
recs: [^]Rectangle, // Characters rectangles in texture
chars: [^]CharInfo, // Characters info data
chars: [^]GlyphInfo, // Characters info data
}
SpriteFont :: Font // SpriteFont type fallback, defaults to Font
@@ -289,11 +371,11 @@ Ray :: struct {
direction: Vector3, // Ray direction
}
// Raycast hit information
RayHitInfo :: struct {
// RayCollision, ray hit information
RayCollision :: struct {
hit: bool, // Did the ray hit something?
distance: f32, // Distance to nearest hit
position: Vector3, // Position of nearest hit
point: Vector3, // Point of nearest hit
normal: Vector3, // Surface normal of hit
}
@@ -838,6 +920,16 @@ foreign lib {
SetClipboardText :: proc(text: cstring) --- // Set clipboard text content
GetClipboardText :: proc() -> cstring --- // Get clipboard text content
// 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()
// 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)
PollInputEvents :: proc() --- // Register all input events
WaitTime :: proc(ms: f32) --- // Wait for some milliseconds (halt program execution)
// Cursor-related functions
ShowCursor :: proc() --- // Shows cursor
HideCursor :: proc() --- // Hides cursor
@@ -898,6 +990,7 @@ foreign lib {
// Misc. 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
TakeScreenshot :: proc(fileName: cstring) --- // Takes a screenshot of current screen (filename extension defines format)
SetConfigFlags :: proc(flags: ConfigFlags) --- // Setup init configuration flags (view FLAGS)
@@ -939,8 +1032,10 @@ foreign lib {
ClearDroppedFiles :: proc() --- // Clear dropped files paths buffer (free memory)
GetFileModTime :: proc(fileName: cstring) -> c.long --- // Get file modification time (last write time)
CompressData :: proc(data: [^]u8, dataLength: c.int, compDataLength: ^c.int) -> [^]u8 --- // Compress data (DEFLATE algorithm)
DecompressData :: proc(compData: [^]u8, compDataLength: c.int, dataLength: ^c.int) -> [^]u8 --- // Decompress data (DEFLATE algorithm)
CompressData :: proc(data: [^]u8, dataLength: c.int, compDataLength: ^c.int) -> [^]u8 --- // Compress data (DEFLATE algorithm)
DecompressData :: proc(compData: [^]u8, compDataLength: c.int, dataLength: ^c.int) -> [^]u8 --- // Decompress data (DEFLATE algorithm)
EncodeDataBase64 :: proc(data: [^]u8, dataLength: c.int, outputLength: ^c.int) -> [^]u8 --- // Encode data to Base64 string
DecodeDataBase64 :: proc(data: [^]u8, outputLength: ^c.int) -> [^]u8 --- // Decode Base64 string data
// Persistent storage management
SaveStorageValue :: proc(position: c.uint, value: c.int) -> bool --- // Save integer value to storage file (to defined position), returns true on success
@@ -989,9 +1084,11 @@ foreign lib {
SetMouseCursor :: proc(cursor: MouseCursor) --- // Set mouse cursor
// Input-related functions: touch
GetTouchX :: proc() -> c.int --- // Returns touch position X for touch point 0 (relative to screen size)
GetTouchY :: proc() -> c.int --- // Returns touch position Y for touch point 0 (relative to screen size)
GetTouchPosition :: proc(index: c.int) -> Vector2 --- // Returns touch position XY for a touch point index (relative to screen size)
GetTouchX :: proc() -> c.int --- // Returns touch position X for touch point 0 (relative to screen size)
GetTouchY :: proc() -> c.int --- // Returns touch position Y for touch point 0 (relative to screen size)
GetTouchPosition :: proc(index: c.int) -> Vector2 --- // Returns touch position XY for a touch point index (relative to screen size)
GetTouchPointId :: proc(index: c.int) -> c.int --- // Get touch point identifier for given index
GetTouchPointCount :: proc() -> c.int --- // Get number of touch points
//------------------------------------------------------------------------------------
// Gestures and Touch Handling Functions (Module: gestures)
@@ -999,7 +1096,6 @@ foreign lib {
SetGesturesEnabled :: proc(flags: Gestures) --- // Enable a set of gestures using flags
IsGestureDetected :: proc(gesture: Gesture) -> bool --- // Check if a gesture have been detected
GetGestureDetected :: proc() -> Gesture --- // Get latest detected gesture
GetTouchPointsCount :: proc() -> c.int --- // Get touch points count
GetGestureHoldDuration :: proc() -> f32 --- // Get gesture hold time in milliseconds
GetGestureDragVector :: proc() -> Vector2 --- // Get gesture drag vector
GetGestureDragAngle :: proc() -> f32 --- // Get gesture drag angle
@@ -1033,6 +1129,7 @@ foreign lib {
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, pointsCount: c.int, color: Color) --- // Draw lines sequence
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
@@ -1061,6 +1158,7 @@ foreign lib {
DrawTriangleStrip :: proc(points: [^]Vector2, pointsCount: c.int, color: Color) --- // Draw a triangle strip defined by points
DrawPoly :: proc(center: Vector2, sides: c.int, radius: f32, rotation: f32, color: Color) --- // Draw a regular polygon (Vector version)
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
// Basic shapes collision detection functions
CheckCollisionRecs :: proc(rec1, rec2: Rectangle) -> bool --- // Check collision between two rectangles
@@ -1070,6 +1168,7 @@ foreign lib {
CheckCollisionPointCircle :: proc(point: Vector2, center: Vector2, radius: f32) -> bool --- // Check if point is inside circle
CheckCollisionPointTriangle :: proc(point, p1, p2, p3: Vector2) -> bool --- // Check if point is inside a triangle
CheckCollisionLines :: proc(startPos1, endPos1, startPos2, endPos2: Vector2, collisionPoint: ^Vector2) -> bool --- // Check the collision between two lines defined by two points each, returns collision point by reference
CheckCollisionPointLine :: proc(point, p1, p2: Vector2, threshold: c.int) -> bool --- // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
GetCollisionRec :: proc(rec1, rec2: Rectangle) -> Rectangle --- // Get collision rectangle for two rectangles collision
//------------------------------------------------------------------------------------
@@ -1078,13 +1177,14 @@ foreign lib {
// Image loading functions
// NOTE: This functions do not require GPU access
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
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"
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
ExportImageAsCode :: proc(image: Image, fileName: cstring) -> bool --- // Export image as code file defining an array of bytes, returns true on success
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
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
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
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
@@ -1093,7 +1193,6 @@ foreign lib {
GenImageGradientRadial :: proc(width, height: c.int, density: f32, inner, outer: Color) -> Image --- // Generate image: radial 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
GenImageCellular :: proc(width, height: c.int, tileSize: c.int) -> Image --- // Generate image: cellular algorithm. Bigger tileSize means bigger cells
// Image manipulation functions
@@ -1128,6 +1227,7 @@ foreign lib {
UnloadImageColors :: proc(colors: [^]Color) --- // Unload color data loaded with LoadImageColors()
UnloadImagePalette :: proc(colors: [^]Color) --- // Unload colors palette loaded with LoadImagePalette()
GetImageAlphaBorder :: proc(image: Image, threshold: f32) -> Rectangle --- // Get image alpha border rectangle
GetImageColor :: proc(image: Image, x, y: c.int) -> Color --- // Get image pixel color at (x, y) position
// Image drawing functions
// NOTE: Image software-rendering functions (CPU)
@@ -1156,8 +1256,6 @@ foreign lib {
UnloadRenderTexture :: proc(target: RenderTexture2D) --- // Unload render texture from GPU memory (VRAM)
UpdateTexture :: proc(texture: Texture2D, pixels: rawptr) --- // Update GPU texture with new data
UpdateTextureRec :: proc(texture: Texture2D, rec: Rectangle, pixels: rawptr) --- // Update GPU texture rectangle with new data
GetTextureData :: proc(texture: Texture2D) -> Image --- // Get pixel data from GPU texture and return an Image
GetScreenData :: proc() -> Image --- // Get pixel data from screen buffer and return an Image (screenshot)
// Texture configuration functions
GenTextureMipmaps :: proc(texture: ^Texture2D) --- // Generate GPU mipmaps for a texture
@@ -1199,24 +1297,34 @@ foreign lib {
LoadFontEx :: proc(fileName: cstring, fontSize: c.int, fontChars: [^]rune, charsCount: c.int) -> Font --- // Load font from file with extended parameters
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, charsCount: c.int) -> Font --- // Load font from memory buffer, fileType refers to extension: i.e. ".ttf"
LoadFontData :: proc(fileData: rawptr, dataSize: c.int, fontSize: c.int, fontChars: [^]rune, charsCount: c.int, type: FontType) -> [^]CharInfo --- // Load font data for further use
GenImageFontAtlas :: proc(chars: [^]CharInfo, recs: ^[^]Rectangle, charsCount: c.int, fontSize: c.int, padding: c.int, packMethod: c.int) -> Image --- // Generate image font atlas using chars info
UnloadFontData :: proc(chars: [^]CharInfo, charsCount: c.int) --- // Unload font chars info data (RAM)
LoadFontData :: proc(fileData: rawptr, dataSize: c.int, fontSize: c.int, fontChars: [^]rune, charsCount: c.int, type: FontType) -> [^]GlyphInfo --- // Load font data for further use
GenImageFontAtlas :: proc(chars: [^]GlyphInfo, recs: ^[^]Rectangle, charsCount: c.int, fontSize: c.int, padding: c.int, packMethod: c.int) -> Image --- // Generate image font atlas using chars info
UnloadFontData :: proc(chars: [^]GlyphInfo, charsCount: c.int) --- // Unload font chars info data (RAM)
UnloadFont :: proc(font: Font) --- // Unload Font from GPU memory (VRAM)
// 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
DrawTextRec :: proc(font: Font, text: cstring, rec: Rectangle, fontSize, spacing: f32, wordWrap: bool, tint: Color) --- // Draw text using font inside rectangle limits
DrawTextRecEx :: proc(font: Font, text: cstring, rec: Rectangle, fontSize, spacing: f32, wordWrap: bool, tint: Color,
selectStart, selectLength: c.int, selectTint, selectBackTint: Color) --- // Draw text using font inside rectangle limits with support for text selection
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)
// Text misc. functions
MeasureText :: proc(text: cstring, fontSize: c.int) -> c.int --- // Measure string width for default font
MeasureTextEx :: proc(font: Font, text: cstring, fontSize, spacing: f32) -> Vector2 --- // Measure string size for Font
GetGlyphIndex :: proc(font: Font, codepoint: rune) -> c.int --- // Get index position for a unicode character on font
MeasureText :: proc(text: cstring, fontSize: c.int) -> c.int --- // Measure string width for default font
MeasureTextEx :: proc(font: Font, text: cstring, fontSize, spacing: f32) -> Vector2 --- // Measure string size for Font
GetGlyphIndex :: proc(font: Font, codepoint: rune) -> c.int --- // Get index position for a unicode character on font
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)
LoadCodepoints :: proc(text: cstring, count: ^c.int) -> [^]rune --- // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
UnloadCodepoints :: proc(codepoints: [^]rune) --- // Unload codepoints data from memory
GetCodepointCount :: proc(text: cstring) -> c.int --- // Get total number of codepoints in a UTF-8 encoded string
GetCodepoint :: proc(text: cstring, bytesProcessed: ^c.int) -> c.int --- // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
CodepointToUTF8 :: proc(codepoint: rune, byteSize: ^c.int) -> cstring --- // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
TextCodepointsToUTF8 :: proc(codepoints: [^]rune, length: c.int) -> cstring --- // Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!)
// Text strings management functions (no utf8 strings, only byte chars)
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
@@ -1234,56 +1342,79 @@ foreign lib {
TextToLower :: proc(text: cstring) -> cstring --- // Get lower case version of provided string
TextToPascal :: proc(text: cstring) -> cstring --- // Get Pascal case notation version of provided string
TextToInteger :: proc(text: cstring) -> c.int --- // Get integer value from text (negative values not supported)
TextToUtf8 :: proc(codepoints: [^]rune, length: c.int) -> [^]byte --- // Encode text codepoint into utf8 text (memory must be freed!)
// UTF8 text strings management functions
GetCodepoints :: proc(text: cstring, count: ^c.int) -> [^]rune --- // Get all codepoints in a string, codepoints count returned by parameters
GetCodepointsCount :: proc(text: cstring) -> c.int --- // Get total number of characters (codepoints) in a UTF8 encoded string
GetNextCodepoint :: proc(text: cstring, bytesProcessed: ^c.int) -> c.int --- // Returns next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure
CodepointToUtf8 :: proc(codepoint: rune, byteLength: ^c.int) -> cstring --- // Encode codepoint into utf8 text (char array length returned as parameter)
//------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models)
//------------------------------------------------------------------------------------
// Basic geometric 3D shapes drawing functions
DrawLine3D :: proc(startPos, endPos: Vector3, color: Color) --- // Draw a line in 3D world space
DrawPoint3D :: proc(position: Vector3, color: Color) --- // Draw a point in 3D space, actually a small line
DrawCircle3D :: proc(center: Vector3, radius: f32, rotationAxis: Vector3, rotationAngle: f32, color: Color) --- // Draw a circle in 3D world space
DrawTriangle3D :: proc(v1, v2, v3: Vector3, color: Color) --- // Draw a color-filled triangle (vertex in counter-clockwise order!)
DrawTriangleStrip3D :: proc(points: [^]Vector3, pointsCount: c.int, color: Color) --- // Draw a triangle strip defined by points
DrawCube :: proc(position: Vector3, width, height, length: f32, color: Color) --- // Draw cube
DrawCubeV :: proc(position: Vector3, size: Vector3, color: Color) --- // Draw cube (Vector version)
DrawCubeWires :: proc(position: Vector3, width, height, length: f32, color: Color) --- // Draw cube wires
DrawCubeWiresV :: proc(position: Vector3, size: Vector3, color: Color) --- // Draw cube wires (Vector version)
DrawCubeTexture :: proc(texture: Texture2D, position: Vector3, width, height, length: f32, color: Color) --- // Draw cube textured
DrawSphere :: proc(centerPos: Vector3, radius: f32, color: Color) --- // Draw sphere
DrawSphereEx :: proc(centerPos: Vector3, radius: f32, rings, slices: c.int, color: Color) --- // Draw sphere with extended parameters
DrawSphereWires :: proc(centerPos: Vector3, radius: f32, rings, slices: c.int, color: Color) --- // Draw sphere wires
DrawCylinder :: proc(position: Vector3, radiusTop, radiusBottom: f32, height: f32, slices: c.int, color: Color) --- // Draw a cylinder/cone
DrawCylinderWires :: proc(position: Vector3, radiusTop, radiusBottom: f32, height: f32, slices: c.int, color: Color) --- // Draw a cylinder/cone wires
DrawLine3D :: proc(startPos, endPos: Vector3, color: Color) --- // Draw a line in 3D world space
DrawPoint3D :: proc(position: Vector3, color: Color) --- // Draw a point in 3D space, actually a small line
DrawCircle3D :: proc(center: Vector3, radius: f32, rotationAxis: Vector3, rotationAngle: f32, color: Color) --- // Draw a circle in 3D world space
DrawTriangle3D :: proc(v1, v2, v3: Vector3, color: Color) --- // Draw a color-filled triangle (vertex in counter-clockwise order!)
DrawTriangleStrip3D :: proc(points: [^]Vector3, pointsCount: c.int, color: Color) --- // Draw a triangle strip defined by points
DrawCube :: proc(position: Vector3, width, height, length: f32, color: Color) --- // Draw cube
DrawCubeV :: proc(position: Vector3, size: Vector3, color: Color) --- // Draw cube (Vector version)
DrawCubeWires :: proc(position: Vector3, width, height, length: f32, color: Color) --- // Draw cube wires
DrawCubeWiresV :: proc(position: Vector3, size: Vector3, color: Color) --- // Draw cube wires (Vector version)
DrawCubeTexture :: proc(texture: Texture2D, position: Vector3, width, height, length: f32, color: Color) --- // Draw cube textured
DrawCubeTextureRec :: proc(texture: Texture2D, source: Rectangle, position: Vector3, width, height, length: f32, color: Color) --- // Draw cube with a region of a texture
DrawSphere :: proc(centerPos: Vector3, radius: f32, color: Color) --- // Draw sphere
DrawSphereEx :: proc(centerPos: Vector3, radius: f32, rings, slices: c.int, color: Color) --- // Draw sphere with extended parameters
DrawSphereWires :: proc(centerPos: Vector3, radius: f32, rings, slices: c.int, color: Color) --- // Draw sphere wires
DrawCylinder :: proc(position: Vector3, radiusTop, radiusBottom: f32, height: f32, slices: c.int, color: Color) --- // Draw a cylinder/cone
DrawCylinderEx :: proc(startPos, endPos: Vector3, startRadius, endRadius: f32, sides: c.int, color: Color) --- // Draw a cylinder with base at startPos and top at endPos
DrawCylinderWires :: proc(position: Vector3, radiusTop, radiusBottom: f32, height: f32, slices: c.int, color: Color) --- // Draw a cylinder/cone wires
DrawCylinderWiresEx :: proc(startPos, endPos: Vector3, startRadius, endRadius: f32, sides: c.int, color: Color) --- // Draw a cylinder wires with base at startPos and top at endPos
DrawPlane :: proc(centerPos: Vector3, size: Vector2, color: Color) --- // Draw a plane XZ
DrawRay :: proc(ray: Ray, color: Color) --- // Draw a ray line
DrawGrid :: proc(slices: c.int, spacing: f32) --- // Draw a grid (centered at (0, 0, 0))
DrawRay :: proc(ray: Ray, color: Color) --- // Draw a ray line
DrawGrid :: proc(slices: c.int, spacing: f32) --- // Draw a grid (centered at (0, 0, 0))
//------------------------------------------------------------------------------------
// Model 3d Loading and Drawing Functions (Module: models)
//------------------------------------------------------------------------------------
// Model loading/unloading functions
LoadModel :: proc(fileName: cstring) -> Model --- // Load model from files (meshes and materials)
LoadModelFromMesh :: proc(mesh: Mesh) -> Model --- // Load model from generated mesh (default material)
UnloadModel :: proc(model: Model) --- // Unload model (including meshes) from memory (RAM and/or VRAM)
UnloadModelKeepMeshes :: proc(model: Model) --- // Unload model (but not meshes) from memory (RAM and/or VRAM)
LoadModel :: proc(fileName: cstring) -> Model --- // Load model from files (meshes and materials)
LoadModelFromMesh :: proc(mesh: Mesh) -> Model --- // Load model from generated mesh (default material)
UnloadModel :: proc(model: Model) --- // Unload model (including meshes) from memory (RAM and/or VRAM)
UnloadModelKeepMeshes :: proc(model: Model) --- // Unload model (but not meshes) from memory (RAM and/or VRAM)
GetModelBoundingBox :: proc(model: Model) -> BoundingBox --- // Compute model bounding box limits (considers all meshes)
// Mesh loading/unloading functions
UploadMesh :: proc(mesh: ^Mesh, is_dynamic: bool) --- // Upload mesh vertex data in GPU and provide VAO/VBO ids
UpdateMeshBuffer :: proc(mesh: Mesh, index: c.int, data:rawptr, dataSize, offset: c.int) --- // Update mesh vertex data in GPU for a specific buffer index
DrawMesh :: proc(mesh: Mesh, material: Material, transform: Matrix) --- // Draw a 3d mesh with material and transform
DrawMeshInstanced :: proc(mesh: Mesh, material: Material, transforms: [^]Matrix, instances: c.int) --- // Draw multiple mesh instances with material and different transforms
UnloadMesh :: proc(mesh: Mesh) --- // Unload mesh data from CPU and GPU
ExportMesh :: proc(mesh: Mesh, fileName: cstring) -> bool --- // Export mesh data to file, returns true on success
// Model drawing functions
DrawModel :: proc(model: Model, position: Vector3, scale: f32, tint: Color) --- // Draw a model (with texture if set)
DrawModelEx :: proc(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) --- // Draw a model with extended parameters
DrawModelWires :: proc(model: Model, position: Vector3, scale: f32, tint: Color) --- // Draw a model wires (with texture if set)
DrawModelWiresEx :: proc(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) --- // Draw a model wires (with texture if set) with extended parameters
DrawBoundingBox :: proc(box: BoundingBox, color: Color) --- // Draw bounding box (wires)
DrawBillboard :: proc(camera: Camera, texture: Texture2D, center: Vector3, size: f32, tint: Color) --- // Draw a billboard texture
DrawBillboardRec :: proc(camera: Camera, texture: Texture2D, source: Rectangle, center: Vector3, size: f32, tint: Color) --- // Draw a billboard texture defined by source
DrawBillboardPro :: proc(camera: Camera, texture: Texture2D, source: Rectangle,
position, up: Vector3, size, origin: Vector2, rotation: f32, tint: Color) --- // Draw a billboard texture defined by source and rotation
// Mesh management functions
UploadMesh :: proc(mesh: ^Mesh, is_dynamic: bool) --- // Upload mesh vertex data in GPU and provide VAO/VBO ids
UpdateMeshBuffer :: proc(mesh: Mesh, index: c.int, data: rawptr, dataSize: c.int, offset: c.int) --- // Update mesh vertex data in GPU for a specific buffer index
UnloadMesh :: proc(mesh: Mesh) --- // Unload mesh data from CPU and GPU
DrawMesh :: proc(mesh: Mesh, material: Material, transform: Matrix) --- // Draw a 3d mesh with material and transform
DrawMeshInstanced :: proc(mesh: Mesh, material: Material, transforms: [^]Matrix, instances: c.int) --- // Draw multiple mesh instances with material and different transforms
ExportMesh :: proc(mesh: Mesh, fileName: cstring) -> bool --- // Export mesh data to file, returns true on success
GetMeshBoundingBox :: proc(mesh: Mesh) -> BoundingBox --- // Compute mesh bounding box limits
GenMeshTangents :: proc(mesh: ^Mesh) --- // Compute mesh tangents
GenMeshBinormals :: proc(mesh: ^Mesh) ---
// Mesh generation functions
GenMeshPoly :: proc(sides: c.int, radius: f32) -> Mesh --- // Generate polygonal mesh
GenMeshPlane :: proc(width, length: f32, resX, resZ: c.int) -> Mesh --- // Generate plane mesh (with subdivisions)
GenMeshCube :: proc(width, height, length: f32) -> Mesh --- // Generate cuboid mesh
GenMeshSphere :: proc(radius: f32, rings, slices: c.int) -> Mesh --- // Generate sphere mesh (standard sphere)
GenMeshHemiSphere :: proc(radius: f32, rings, slices: c.int) -> Mesh --- // Generate half-sphere mesh (no bottom cap)
GenMeshCylinder :: proc(radius: f32, height: f32, slices: c.int) -> Mesh --- // Generate cylinder mesh
GenMeshCone :: proc(radius: f32, height: f32, slices: c.int) -> Mesh --- // Generate cone/pyramid mesh
GenMeshTorus :: proc(radius: f32, size: f32, radSeg: c.int, sides: c.int) -> Mesh --- // Generate torus mesh
GenMeshKnot :: proc(radius: f32, size: f32, radSeg: c.int, sides: c.int) -> Mesh --- // Generate trefoil knot mesh
GenMeshHeightmap :: proc(heightmap: Image, size: Vector3) -> Mesh --- // Generate heightmap mesh from image data
GenMeshCubicmap :: proc(cubicmap: Image, cubeSize: Vector3) -> Mesh --- // Generate cubes-based map mesh from image data
// Material loading/unloading functions
LoadMaterials :: proc(fileName: cstring, materialCount: ^c.int) -> [^]Material --- // Load materials from model file
@@ -1298,45 +1429,17 @@ foreign lib {
UnloadModelAnimation :: proc(anim: ModelAnimation) --- // Unload animation data
UnloadModelAnimations :: proc(animations: [^]ModelAnimation, count: c.uint) --- // Unload animation array data
IsModelAnimationValid :: proc(model: Model, anim: ModelAnimation) -> bool --- // Check model animation skeleton match
// Mesh generation functions
GenMeshPoly :: proc(sides: c.int, radius: f32) -> Mesh --- // Generate polygonal mesh
GenMeshPlane :: proc(width, length: f32, resX, resZ: c.int) -> Mesh --- // Generate plane mesh (with subdivisions)
GenMeshCube :: proc(width, height, length: f32) -> Mesh --- // Generate cuboid mesh
GenMeshSphere :: proc(radius: f32, rings, slices: c.int) -> Mesh --- // Generate sphere mesh (standard sphere)
GenMeshHemiSphere :: proc(radius: f32, rings, slices: c.int) -> Mesh --- // Generate half-sphere mesh (no bottom cap)
GenMeshCylinder :: proc(radius: f32, height: f32, slices: c.int) -> Mesh --- // Generate cylinder mesh
GenMeshTorus :: proc(radius: f32, size: f32, radSeg: c.int, sides: c.int) -> Mesh --- // Generate torus mesh
GenMeshKnot :: proc(radius: f32, size: f32, radSeg: c.int, sides: c.int) -> Mesh --- // Generate trefoil knot mesh
GenMeshHeightmap :: proc(heightmap: Image, size: Vector3) -> Mesh --- // Generate heightmap mesh from image data
GenMeshCubicmap :: proc(cubicmap: Image, cubeSize: Vector3) -> Mesh --- // Generate cubes-based map mesh from image data
// Mesh manipulation functions
MeshBoundingBox :: proc(mesh: Mesh) -> BoundingBox --- // Compute mesh bounding box limits
MeshTangents :: proc(mesh: ^Mesh) --- // Compute mesh tangents
MeshBinormals :: proc(mesh: ^Mesh) --- // Compute mesh binormals
// Model drawing functions
DrawModel :: proc(model: Model, position: Vector3, scale: f32, tint: Color) --- // Draw a model (with texture if set)
DrawModelEx :: proc(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) --- // Draw a model with extended parameters
DrawModelWires :: proc(model: Model, position: Vector3, scale: f32, tint: Color) --- // Draw a model wires (with texture if set)
DrawModelWiresEx :: proc(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) --- // Draw a model wires (with texture if set) with extended parameters
DrawBoundingBox :: proc(box: BoundingBox, color: Color) --- // Draw bounding box (wires)
DrawBillboard :: proc(camera: Camera, texture: Texture2D, center: Vector3, size: f32, tint: Color) --- // Draw a billboard texture
DrawBillboardRec :: proc(camera: Camera, texture: Texture2D, source: Rectangle, center: Vector3, size: f32, tint: Color) --- // Draw a billboard texture defined by source
// Collision detection functions
CheckCollisionSpheres :: proc(center1: Vector3, radius1: f32, center2: Vector3, radius2: f32) -> bool --- // Detect collision between two spheres
CheckCollisionBoxes :: proc(box1, box2: BoundingBox) -> bool --- // Detect collision between two bounding boxes
CheckCollisionBoxSphere :: proc(box: BoundingBox, center: Vector3, radius: f32) -> bool --- // Detect collision between box and sphere
CheckCollisionRaySphere :: proc(ray: Ray, center: Vector3, radius: f32) -> bool --- // Detect collision between ray and sphere
CheckCollisionRaySphereEx :: proc(ray: Ray, center: Vector3, radius: f32, collisionPoint: [^]Vector3) -> bool --- // Detect collision between ray and sphere, returns collision point
CheckCollisionRayBox :: proc(ray: Ray, box: BoundingBox) -> bool --- // Detect collision between ray and box
GetCollisionRayMesh :: proc(ray: Ray, mesh: Mesh, transform: Matrix) -> RayHitInfo --- // Get collision info between ray and mesh
GetCollisionRayModel :: proc(ray: Ray, model: Model) -> RayHitInfo --- // Get collision info between ray and model
GetCollisionRayTriangle :: proc(ray: Ray, p1, p2, p3: Vector3) -> RayHitInfo --- // Get collision info between ray and triangle
GetCollisionRayGround :: proc(ray: Ray, groundHeight: f32) -> RayHitInfo --- // Get collision info between ray and ground plane (Y-normal plane)
CheckCollisionSpheres :: proc(center1: Vector3, radius1: f32, center2: Vector3, radius2: f32) -> bool --- // Check collision between two spheres
CheckCollisionBoxes :: proc(box1, box2: BoundingBox) -> bool --- // Check collision between two bounding boxes
CheckCollisionBoxSphere :: proc(box: BoundingBox, center: Vector3, radius: f32) -> bool --- // Check collision between box and sphere
GetRayCollisionSphere :: proc(ray: Ray, center: Vector3, radius: f32) -> RayCollision --- // Get collision info between ray and sphere
GetRayCollisionBox :: proc(ray: Ray, box: BoundingBox) -> RayCollision --- // Get collision info between ray and box
GetRayCollisionModel :: proc(ray: Ray, model: Model) -> RayCollision --- // Get collision info between ray and model
GetRayCollisionMesh :: proc(ray: Ray, mesh: Mesh, transform: Matrix) -> RayCollision --- // Get collision info between ray and mesh
GetRayCollisionTriangle :: proc(ray: Ray, p1, p2, p3: Vector3) -> RayCollision --- // Get collision info between ray and triangle
GetRayCollisionQuad :: proc(ray: Ray, p1, p2, p3, p4: Vector3) -> RayCollision --- // Get collision info between ray and quad
//------------------------------------------------------------------------------------
// Audio Loading and Playing Functions (Module: audio)
@@ -1377,33 +1480,34 @@ foreign lib {
UnloadWaveSamples :: proc(samples: [^]f32) --- // Unload samples data loaded with LoadWaveSamples()
// Music management functions
LoadMusicStream :: proc(fileName: cstring) -> Music --- // Load music stream from file
LoadMusicStream :: proc(fileName: cstring) -> Music --- // Load music stream from file
LoadMusicStreamFromMemory :: proc(fileType: cstring, data: rawptr, dataSize: c.int) -> Music --- // Load music stream from data
UnloadMusicStream :: proc(music: Music) --- // Unload music stream
PlayMusicStream :: proc(music: Music) --- // Start music playing
IsMusicPlaying :: proc(music: Music) -> bool --- // Check if music is playing
UpdateMusicStream :: proc(music: Music) --- // Updates buffers for music streaming
StopMusicStream :: proc(music: Music) --- // Stop music playing
PauseMusicStream :: proc(music: Music) --- // Pause music playing
ResumeMusicStream :: proc(music: Music) --- // Resume playing paused music
SetMusicVolume :: proc(music: Music, volume: f32) --- // Set volume for music (1.0 is max level)
SetMusicPitch :: proc(music: Music, pitch: f32) --- // Set pitch for a music (1.0 is base level)
GetMusicTimeLength :: proc(music: Music) -> f32 --- // Get music time length (in seconds)
GetMusicTimePlayed :: proc(music: Music) -> f32 --- // Get current music time played (in seconds)
UnloadMusicStream :: proc(music: Music) --- // Unload music stream
PlayMusicStream :: proc(music: Music) --- // Start music playing
IsMusicStreamPlaying :: proc(music: Music) -> bool --- // Check if music is playing
UpdateMusicStream :: proc(music: Music) --- // Updates buffers for music streaming
StopMusicStream :: proc(music: Music) --- // Stop music playing
PauseMusicStream :: proc(music: Music) --- // Pause music playing
ResumeMusicStream :: proc(music: Music) --- // Resume playing paused music
SeekMusicStream :: proc(music: Music, position: f32) --- // Seek music to a position (in seconds)
SetMusicVolume :: proc(music: Music, volume: f32) --- // Set volume for music (1.0 is max level)
SetMusicPitch :: proc(music: Music, pitch: f32) --- // Set pitch for a music (1.0 is base level)
GetMusicTimeLength :: proc(music: Music) -> f32 --- // Get music time length (in seconds)
GetMusicTimePlayed :: proc(music: Music) -> f32 --- // Get current music time played (in seconds)
// AudioStream management functions
InitAudioStream :: proc(sampleRate, sampleSize, channels: c.uint) -> AudioStream --- // Init audio stream (to stream raw audio pcm data)
UpdateAudioStream :: proc(stream: AudioStream, data: rawptr, samplesCount: c.int) --- // Update audio stream buffers with data
CloseAudioStream :: proc(stream: AudioStream) --- // Close audio stream and free memory
IsAudioStreamProcessed :: proc(stream: AudioStream) -> AudioStream --- // Check if any audio stream buffers requires refill
PlayAudioStream :: proc(stream: AudioStream) --- // Play audio stream
PauseAudioStream :: proc(stream: AudioStream) --- // Pause audio stream
ResumeAudioStream :: proc(stream: AudioStream) --- // Resume audio stream
IsAudioStreamPlaying :: proc(stream: AudioStream) -> AudioStream --- // Check if audio stream is playing
StopAudioStream :: proc(stream: AudioStream) --- // Stop audio stream
SetAudioStreamVolume :: proc(stream: AudioStream, volume: f32) --- // Set volume for audio stream (1.0 is max level)
SetAudioStreamPitch :: proc(stream: AudioStream, pitch: f32) --- // Set pitch for audio stream (1.0 is base level)
SetAudioStreamBufferSizeDefault :: proc(size: c.int) --- // Default size for new audio streams
LoadAudioStream :: proc(sampleRate, sampleSize, channels: c.uint) -> AudioStream --- // Load audio stream (to stream raw audio pcm data)
UnloadAudioStream :: proc(stream: AudioStream) --- // Unload audio stream and free memory
UpdateAudioStream :: proc(stream: AudioStream, data: rawptr, frameCount: c.int) --- // Update audio stream buffers with data
IsAudioStreamProcessed :: proc(stream: AudioStream) -> bool --- // Check if any audio stream buffers requires refill
PlayAudioStream :: proc(stream: AudioStream) --- // Play audio stream
PauseAudioStream :: proc(stream: AudioStream) --- // Pause audio stream
ResumeAudioStream :: proc(stream: AudioStream) --- // Resume audio stream
IsAudioStreamPlaying :: proc(stream: AudioStream) -> bool --- // Check if audio stream is playing
StopAudioStream :: proc(stream: AudioStream) --- // Stop audio stream
SetAudioStreamVolume :: proc(stream: AudioStream, volume: f32) --- // Set volume for audio stream (1.0 is max level)
SetAudioStreamPitch :: proc(stream: AudioStream, pitch: f32) --- // Set pitch for audio stream (1.0 is base level)
SetAudioStreamBufferSizeDefault :: proc(size: c.int) --- // Default size for new audio streams
}

View File

@@ -14,10 +14,11 @@ when ODIN_OS == "windows" {
when ODIN_OS == "linux" { foreign import lib "linux/libraylib.a" }
when ODIN_OS == "darwin" { foreign import lib "macos/libraylib.a" }
GRAPHICS_API_OPENGL_11 :: false
GRAPHICS_API_OPENGL_21 :: true
GRAPHICS_API_OPENGL_33 :: GRAPHICS_API_OPENGL_21
GRAPHICS_API_OPENGL_11 :: false
GRAPHICS_API_OPENGL_21 :: true
GRAPHICS_API_OPENGL_33 :: GRAPHICS_API_OPENGL_21
GRAPHICS_API_OPENGL_ES2 :: false
GRAPHICS_API_OPENGL_43 :: false
when !GRAPHICS_API_OPENGL_ES2 {
// This is the maximum amount of elements (quads) per batch
@@ -35,24 +36,20 @@ DEFAULT_BATCH_DRAWCALLS :: 256 // Default number of batc
MAX_BATCH_ACTIVE_TEXTURES :: 4 // Maximum number of additional textures that can be activated on batch drawing (SetShaderValueTexture())
// Internal Matrix stack
MAX_MATRIX_STACK_SIZE :: 32 // Maximum size of Matrix stack
MAX_MATRIX_STACK_SIZE :: 32 // Maximum size of Matrix stack
// Vertex buffers id limit
MAX_MESH_VERTEX_BUFFERS :: 7 // Maximum vertex buffers (VBO) per mesh
// Shader and material limits
MAX_SHADER_LOCATIONS :: 32 // Maximum number of shader locations supported
MAX_MATERIAL_MAPS :: 12 // Maximum number of shader maps supported
// Shader limits
MAX_SHADER_LOCATIONS :: 32 // Maximum number of shader locations supported
// Projection matrix culling
RL_CULL_DISTANCE_NEAR :: 0.01 // Default near cull distance
RL_CULL_DISTANCE_FAR :: 1000.0 // Default far cull distance
RL_CULL_DISTANCE_NEAR :: 0.01 // Default near cull distance
RL_CULL_DISTANCE_FAR :: 1000.0 // Default far cull distance
// Texture parameters (equivalent to OpenGL defines)
RL_TEXTURE_WRAP_S :: 0x2802 // GL_TEXTURE_WRAP_S
RL_TEXTURE_WRAP_T :: 0x2803 // GL_TEXTURE_WRAP_T
RL_TEXTURE_MAG_FILTER :: 0x2800 // GL_TEXTURE_MAG_FILTER
RL_TEXTURE_MIN_FILTER :: 0x2801 // GL_TEXTURE_MIN_FILTER
RL_TEXTURE_WRAP_S :: 0x2802 // GL_TEXTURE_WRAP_S
RL_TEXTURE_WRAP_T :: 0x2803 // GL_TEXTURE_WRAP_T
RL_TEXTURE_MAG_FILTER :: 0x2800 // GL_TEXTURE_MAG_FILTER
RL_TEXTURE_MIN_FILTER :: 0x2801 // GL_TEXTURE_MIN_FILTER
RL_TEXTURE_FILTER_NEAREST :: 0x2600 // GL_NEAREST
RL_TEXTURE_FILTER_LINEAR :: 0x2601 // GL_LINEAR
@@ -68,18 +65,34 @@ RL_TEXTURE_WRAP_MIRROR_REPEAT :: 0x8370 // GL_MIRRORED_REPEAT
RL_TEXTURE_WRAP_MIRROR_CLAMP :: 0x8742 // GL_MIRROR_CLAMP_EXT
// Matrix modes (equivalent to OpenGL)
RL_MODELVIEW :: 0x1700 // GL_MODELVIEW
RL_PROJECTION :: 0x1701 // GL_PROJECTION
RL_TEXTURE :: 0x1702 // GL_TEXTURE
RL_MODELVIEW :: 0x1700 // GL_MODELVIEW
RL_PROJECTION :: 0x1701 // GL_PROJECTION
RL_TEXTURE :: 0x1702 // GL_TEXTURE
// Primitive assembly draw modes
RL_LINES :: 0x0001 // GL_LINES
RL_TRIANGLES :: 0x0004 // GL_TRIANGLES
RL_QUADS :: 0x0007 // GL_QUADS
RL_LINES :: 0x0001 // GL_LINES
RL_TRIANGLES :: 0x0004 // GL_TRIANGLES
RL_QUADS :: 0x0007 // GL_QUADS
// GL equivalent data types
RL_UNSIGNED_BYTE :: 0x1401 // GL_UNSIGNED_BYTE
RL_f32 :: 0x1406 // GL_f32
RL_UNSIGNED_BYTE :: 0x1401 // GL_UNSIGNED_BYTE
RL_FLOAT :: 0x1406 // GL_FLOAT
// Buffer usage hint
RL_STREAM_DRAW :: 0x88E0 // GL_STREAM_DRAW
RL_STREAM_READ :: 0x88E1 // GL_STREAM_READ
RL_STREAM_COPY :: 0x88E2 // GL_STREAM_COPY
RL_STATIC_DRAW :: 0x88E4 // GL_STATIC_DRAW
RL_STATIC_READ :: 0x88E5 // GL_STATIC_READ
RL_STATIC_COPY :: 0x88E6 // GL_STATIC_COPY
RL_DYNAMIC_DRAW :: 0x88E8 // GL_DYNAMIC_DRAW
RL_DYNAMIC_READ :: 0x88E9 // GL_DYNAMIC_READ
RL_DYNAMIC_COPY :: 0x88EA // GL_DYNAMIC_COPY
// GL Shader type
RL_FRAGMENT_SHADER :: 0x8B30 // GL_FRAGMENT_SHADER
RL_VERTEX_SHADER :: 0x8B31 // GL_VERTEX_SHADER
RL_COMPUTE_SHADER :: 0x91B9 // GL_COMPUTE_SHADER
//----------------------------------------------------------------------------------
@@ -230,26 +243,29 @@ foreign lib {
// Framebuffer state
rlEnableFramebuffer :: proc(id: u32) --- // Enable render texture (fbo)
rlDisableFramebuffer :: proc() --- // Disable render texture (fbo), return to default framebuffer
rlActiveDrawBuffers :: proc(count: c.int) --- // Activate multiple draw color buffers
// General render state
rlEnableDepthTest :: proc() --- // Enable depth test
rlDisableDepthTest :: proc() --- // Disable depth test
rlEnableDepthMask :: proc() --- // Enable depth write
rlDisableDepthMask :: proc() --- // Disable depth write
rlEnableBackfaceCulling :: proc() --- // Enable backface culling
rlDisableBackfaceCulling :: proc() --- // Disable backface culling
rlEnableScissorTest :: proc() --- // Enable scissor test
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
rlSetLineWidth :: proc(width: f32) --- // Set the line drawing width
rlGetLineWidth :: proc() -> f32 --- // Get the line drawing width
rlEnableSmoothLines :: proc() --- // Enable line aliasing
rlDisableSmoothLines :: proc() --- // Disable line aliasing
rlEnableStereoRender :: proc() --- // Enable stereo rendering
rlDisableStereoRender :: proc() --- // Disable stereo rendering
rlIsStereoRenderEnabled :: proc() -> bool --- // Check if stereo render is enabled
rlEnableColorBlend :: proc() --- // Enable color blending
rlDisableColorBlend :: proc() --- // Disable color blending
rlEnableDepthTest :: proc() --- // Enable depth test
rlDisableDepthTest :: proc() --- // Disable depth test
rlEnableDepthMask :: proc() --- // Enable depth write
rlDisableDepthMask :: proc() --- // Disable depth write
rlEnableBackfaceCulling :: proc() --- // Enable backface culling
rlDisableBackfaceCulling :: proc() --- // Disable backface culling
rlEnableScissorTest :: proc() --- // Enable scissor test
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
rlSetLineWidth :: proc(width: f32) --- // Set the line drawing width
rlGetLineWidth :: proc() -> f32 --- // Get the line drawing width
rlEnableSmoothLines :: proc() --- // Enable line aliasing
rlDisableSmoothLines :: proc() --- // Disable line aliasing
rlEnableStereoRender :: proc() --- // Enable stereo rendering
rlDisableStereoRender :: proc() --- // Disable stereo rendering
rlIsStereoRenderEnabled :: proc() -> bool --- // Check if stereo render is enabled
rlClearColor :: proc(r, g, b, a: u8) --- // Clear color buffer with color
rlClearScreenBuffers :: proc() --- // Clear used screen buffers (color and depth)
@@ -268,8 +284,9 @@ foreign lib {
rlGetFramebufferWidth :: proc() -> c.int --- // Get default framebuffer width
rlGetFramebufferHeight :: proc() -> c.int --- // Get default framebuffer height
rlGetShaderDefault :: proc() -> Shader --- // Get default shader
rlGetTextureDefault :: proc() -> Texture2D --- // Get default texture
rlGetTextureIdDefault :: proc() -> u32 --- // Get default texture id
rlGetShaderIdDefault :: proc() -> u32 --- // Get default shader id
rlGetShaderLocsDefault :: proc() -> [^]i32 --- // Get default shader locations
// Render batch management
// NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode
@@ -305,6 +322,7 @@ foreign lib {
rlLoadTextureCubemap :: proc(data: rawptr, size: c.int, format: c.int) -> u32 --- // Load texture cubemap
rlUpdateTexture :: proc(id: u32, offsetX, offsetY, width, height: c.int, format: c.int, data: rawptr) --- // Update GPU texture with new data
rlGetGlTextureFormats :: proc(format: c.int, glInternalFormat: ^u32, glFormat: ^u32, glType: ^u32) --- // Get OpenGL internal formats
rlGetPixelFormatName :: proc(format: PixelFormat) -> cstring --- // Get name string for pixel format
rlUnloadTexture :: proc(id: u32) --- // Unload texture from GPU memory
rlGenerateMipmaps :: proc(texture: ^Texture2D) --- // Generate mipmap data for selected texture
rlReadTexturePixels :: proc(texture: Texture2D) -> rawptr --- // Read texture pixel data
@@ -328,6 +346,24 @@ foreign lib {
rlSetUniformSampler :: proc(locIndex: c.int, textureId: u32) --- // Set shader value sampler
rlSetShader :: proc(shader: Shader) --- // Set shader currently active
// Compute shader management
rlLoadComputeShaderProgram :: proc(shaderId: u32) -> u32 --- // Load compute shader program
rlComputeShaderDispatch :: proc(groupX, groupY, groupZ: u32) --- // Dispatch compute shader (equivalent to *draw* for graphics pilepine)
// Shader buffer storage object management (ssbo)
rlLoadShaderBuffer :: proc(size: u64, data: rawptr, usageHint: c.int) -> u32 --- // Load shader storage buffer object (SSBO)
rlUnloadShaderBuffer :: proc(ssboId: u32) --- // Unload shader storage buffer object (SSBO)
rlUpdateShaderBufferElements :: proc(id: u32, data: rawptr, dataSize: u64, offset: u64) --- // Update SSBO buffer data
rlGetShaderBufferSize :: proc(id: u32) -> u64 --- // Get SSBO buffer size
rlReadShaderBufferElements :: proc(id: u32, dest: rawptr, count: u64, offset: u64) --- // Bind SSBO buffer
rlBindShaderBuffer :: proc(id: u32, index: u32) --- // Copy SSBO buffer data
// Buffer management
rlCopyBuffersElements :: proc(destId, srcId: u32, destOffset, srcOffset: u64, count: u64) --- // Copy SSBO buffer data
rlBindImageTexture :: proc(id: u32, index: u32, format: u32, readonly: b32) --- // Bind image texture
// Matrix state management
rlGetMatrixModelview :: proc() -> Matrix --- // Get internal modelview matrix
rlGetMatrixProjection :: proc() -> Matrix --- // Get internal projection matrix