diff --git a/vendor/raylib/LICENSE b/vendor/raylib/LICENSE index d7d866436..91da62ed9 100644 --- a/vendor/raylib/LICENSE +++ b/vendor/raylib/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013-2021 Ramon Santamaria (@raysan5) +Copyright (c) 2013-2023 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. diff --git a/vendor/raylib/README.md b/vendor/raylib/README.md index cbfdf22f4..11b4bda48 100644 --- a/vendor/raylib/README.md +++ b/vendor/raylib/README.md @@ -12,15 +12,17 @@ Ready to learn? Jump to [code examples!](https://www.raylib.com/examples.html)
-[![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) +[![GitHub Releases Downloads](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases) +[![GitHub Stars](https://img.shields.io/github/stars/raysan5/raylib?style=flat&label=stars)](https://github.com/raysan5/raylib/stargazers) +[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/4.2.0)](https://github.com/raysan5/raylib/commits/master) +[![GitHub Sponsors](https://img.shields.io/github/sponsors/raysan5?label=sponsors)](https://github.com/sponsors/raysan5) +[![Packaging Status](https://repology.org/badge/tiny-repos/raylib.svg)](https://repology.org/project/raylib/versions) [![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/) +[![Discord Members](https://img.shields.io/discord/426912293134270465.svg?label=Discord&logo=discord)](https://discord.gg/raylib) +[![Subreddit Subscribers](https://img.shields.io/reddit/subreddit-subscribers/raylib?label=reddit%20r%2Fraylib&logo=reddit)](https://www.reddit.com/r/raylib/) +[![Youtube Subscribers](https://img.shields.io/youtube/channel/subscribers/UC8WIBkhYb5sBNqXO1mZ7WSQ?style=flat&label=Youtube&logo=youtube)](https://www.youtube.com/c/raylib) +[![Twitch Status](https://img.shields.io/twitch/status/raysan5?style=flat&label=Twitch&logo=twitch)](https://www.twitch.tv/raysan5) [![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) @@ -36,10 +38,10 @@ 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 + - 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**) - **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 **Fonts** formats supported (TTF, Image 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** @@ -49,7 +51,7 @@ features - 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)! + - Bindings to [+60 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)! - **Free and open source**. basic example @@ -61,25 +63,57 @@ package example import rl "vendor:raylib" main :: proc() { - rl.InitWindow(800, 450, "raylib [core] example - basic window") + 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() - } + 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() + rl.CloseWindow() } ``` + +build and installation +---------------------- + +raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the [Github Releases page](https://github.com/raysan5/raylib/releases). + +raylib is also available via multiple [package managers](https://github.com/raysan5/raylib/issues/613) on multiple OS distributions. + +#### Installing and building raylib on multiple platforms + +[raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms. + + - [Working on Windows](https://github.com/raysan5/raylib/wiki/Working-on-Windows) + - [Working on macOS](https://github.com/raysan5/raylib/wiki/Working-on-macOS) + - [Working on GNU Linux](https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux) + - [Working on Chrome OS](https://github.com/raysan5/raylib/wiki/Working-on-Chrome-OS) + - [Working on FreeBSD](https://github.com/raysan5/raylib/wiki/Working-on-FreeBSD) + - [Working on Raspberry Pi](https://github.com/raysan5/raylib/wiki/Working-on-Raspberry-Pi) + - [Working for Android](https://github.com/raysan5/raylib/wiki/Working-for-Android) + - [Working for Web (HTML5)](https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5)) + - [Working anywhere with CMake](https://github.com/raysan5/raylib/wiki/Working-with-CMake) + +*Note that the Wiki is open for edit, if you find some issues while building raylib for your target platform, feel free to edit the Wiki or open an issue related to it.* + +#### Setup raylib with multiple IDEs + +raylib has been developed on Windows platform using [Notepad++](https://notepad-plus-plus.org/) and [MinGW GCC](https://www.mingw-w64.org/) compiler but it can be used with other IDEs on multiple platforms. + +[Projects directory](https://github.com/raysan5/raylib/tree/master/projects) contains several ready-to-use **project templates** to build raylib and code examples with multiple IDEs. + +*Note that there are lots of IDEs supported, some of the provided templates could require some review, so please, if you find some issue with a template or you think they could be improved, feel free to send a PR or open a related issue.* + 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. +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 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: +Some additional documentation about raylib design can be found in raylib GitHub Wiki. Here are the relevant links: - [raylib cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html) - [raylib architecture](https://github.com/raysan5/raylib/wiki/raylib-architecture) @@ -106,4 +140,4 @@ 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. \ No newline at end of file +raylib uses internally some libraries for window/graphics/inputs management and also to support different file formats 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. diff --git a/vendor/raylib/linux/libraylib.a b/vendor/raylib/linux/libraylib.a index 1c97be57b..7de8b292c 100644 Binary files a/vendor/raylib/linux/libraylib.a and b/vendor/raylib/linux/libraylib.a differ diff --git a/vendor/raylib/linux/libraylib.so b/vendor/raylib/linux/libraylib.so index 134f573c8..80d5c6ae7 100644 Binary files a/vendor/raylib/linux/libraylib.so and b/vendor/raylib/linux/libraylib.so differ diff --git a/vendor/raylib/linux/libraylib.so.4.0.0 b/vendor/raylib/linux/libraylib.so.4.0.0 deleted file mode 100644 index 134f573c8..000000000 Binary files a/vendor/raylib/linux/libraylib.so.4.0.0 and /dev/null differ diff --git a/vendor/raylib/linux/libraylib.so.4.5.0 b/vendor/raylib/linux/libraylib.so.4.5.0 new file mode 100644 index 000000000..80d5c6ae7 Binary files /dev/null and b/vendor/raylib/linux/libraylib.so.4.5.0 differ diff --git a/vendor/raylib/linux/libraylib.so.400 b/vendor/raylib/linux/libraylib.so.400 deleted file mode 100644 index 134f573c8..000000000 Binary files a/vendor/raylib/linux/libraylib.so.400 and /dev/null differ diff --git a/vendor/raylib/linux/libraylib.so.450 b/vendor/raylib/linux/libraylib.so.450 new file mode 100644 index 000000000..80d5c6ae7 Binary files /dev/null and b/vendor/raylib/linux/libraylib.so.450 differ diff --git a/vendor/raylib/macos-arm64/libraylib.4.0.0.dylib b/vendor/raylib/macos-arm64/libraylib.4.0.0.dylib deleted file mode 100644 index a40219baa..000000000 Binary files a/vendor/raylib/macos-arm64/libraylib.4.0.0.dylib and /dev/null differ diff --git a/vendor/raylib/macos-arm64/libraylib.4.5.0.dylib b/vendor/raylib/macos-arm64/libraylib.4.5.0.dylib new file mode 100644 index 000000000..3a3c76982 Binary files /dev/null and b/vendor/raylib/macos-arm64/libraylib.4.5.0.dylib differ diff --git a/vendor/raylib/macos-arm64/libraylib.400.dylib b/vendor/raylib/macos-arm64/libraylib.400.dylib deleted file mode 100644 index a40219baa..000000000 Binary files a/vendor/raylib/macos-arm64/libraylib.400.dylib and /dev/null differ diff --git a/vendor/raylib/macos-arm64/libraylib.450.dylib b/vendor/raylib/macos-arm64/libraylib.450.dylib new file mode 100644 index 000000000..3a3c76982 Binary files /dev/null and b/vendor/raylib/macos-arm64/libraylib.450.dylib differ diff --git a/vendor/raylib/macos-arm64/libraylib.a b/vendor/raylib/macos-arm64/libraylib.a index 5eddcb8fa..4814819b9 100644 Binary files a/vendor/raylib/macos-arm64/libraylib.a and b/vendor/raylib/macos-arm64/libraylib.a differ diff --git a/vendor/raylib/macos-arm64/libraylib.dylib b/vendor/raylib/macos-arm64/libraylib.dylib index a40219baa..3a3c76982 100644 Binary files a/vendor/raylib/macos-arm64/libraylib.dylib and b/vendor/raylib/macos-arm64/libraylib.dylib differ diff --git a/vendor/raylib/macos/libraylib.4.0.0.dylib b/vendor/raylib/macos/libraylib.4.0.0.dylib deleted file mode 100644 index 42da76800..000000000 Binary files a/vendor/raylib/macos/libraylib.4.0.0.dylib and /dev/null differ diff --git a/vendor/raylib/macos/libraylib.4.5.0.dylib b/vendor/raylib/macos/libraylib.4.5.0.dylib new file mode 100644 index 000000000..3a3c76982 Binary files /dev/null and b/vendor/raylib/macos/libraylib.4.5.0.dylib differ diff --git a/vendor/raylib/macos/libraylib.400.dylib b/vendor/raylib/macos/libraylib.400.dylib deleted file mode 100644 index 42da76800..000000000 Binary files a/vendor/raylib/macos/libraylib.400.dylib and /dev/null differ diff --git a/vendor/raylib/macos/libraylib.450.dylib b/vendor/raylib/macos/libraylib.450.dylib new file mode 100644 index 000000000..3a3c76982 Binary files /dev/null and b/vendor/raylib/macos/libraylib.450.dylib differ diff --git a/vendor/raylib/macos/libraylib.a b/vendor/raylib/macos/libraylib.a index 2ef3e490f..4814819b9 100644 Binary files a/vendor/raylib/macos/libraylib.a and b/vendor/raylib/macos/libraylib.a differ diff --git a/vendor/raylib/macos/libraylib.dylib b/vendor/raylib/macos/libraylib.dylib index 42da76800..3a3c76982 100644 Binary files a/vendor/raylib/macos/libraylib.dylib and b/vendor/raylib/macos/libraylib.dylib differ diff --git a/vendor/raylib/raylib.lib b/vendor/raylib/raylib.lib deleted file mode 100644 index a3c99a25e..000000000 Binary files a/vendor/raylib/raylib.lib and /dev/null differ diff --git a/vendor/raylib/raylib.odin b/vendor/raylib/raylib.odin index 97e800392..164d40835 100644 --- a/vendor/raylib/raylib.odin +++ b/vendor/raylib/raylib.odin @@ -1,6 +1,6 @@ /********************************************************************************************** * -* raylib v4.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) +* raylib v4.5 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) * * FEATURES: * - NO external dependencies, all required libraries included with raylib @@ -33,8 +33,8 @@ * * 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 +* [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm +* [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm * [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 @@ -43,6 +43,7 @@ * [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) +* [rmodels] Model3D (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d) * [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 @@ -56,7 +57,7 @@ * 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) +* Copyright (c) 2013-2023 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. @@ -93,7 +94,7 @@ MAX_TEXT_BUFFER_LENGTH :: #config(RAYLIB_MAX_TEXT_BUFFER_LENGTH, 1024) when ODIN_OS == .Windows { foreign import lib { - "raylib.lib", + "windows/raylib.lib", "system:Winmm.lib", "system:Gdi32.lib", "system:User32.lib", @@ -125,7 +126,7 @@ when ODIN_OS == .Windows { foreign import lib "system:raylib" } -VERSION :: "4.0" +VERSION :: "4.5" PI :: 3.14159265358979323846 DEG2RAD :: PI/180.0 @@ -277,8 +278,6 @@ Font :: struct { chars: [^]GlyphInfo, // Characters info data } -SpriteFont :: Font // SpriteFont type fallback, defaults to Font - // Camera type, defines a camera position/orientation in 3d space Camera3D :: struct { position: Vector3, // Camera position @@ -316,7 +315,7 @@ Mesh :: struct { // Animation vertex data animVertices: [^]f32, // Animated vertex positions (after bones transformations) animNormals: [^]f32, // Animated normals (after bones transformations) - boneIds: [^]c.int, // Vertex bone ids, up to 4 bones influence by vertex (skinning) + boneIds: [^]u8, // Vertex bone ids, up to 4 bones influence by vertex (skinning) boneWeights: [^]f32, // Vertex bone weight, up to 4 bones influence by vertex (skinning) // OpenGL identifiers @@ -327,7 +326,7 @@ Mesh :: struct { // Shader type (generic) Shader :: struct { id: c.uint, // Shader program id - locs: [^]i32, // Shader locations array (MAX_SHADER_LOCATIONS) + locs: [^]c.int, // Shader locations array (MAX_SHADER_LOCATIONS) } // Material texture map @@ -353,7 +352,7 @@ Transform :: struct { // Bone information BoneInfo :: struct { - name: [32]byte, // Bone name + name: [32]byte `fmt:"s,0"`, // Bone name parent: c.int, // Bone parent } @@ -378,7 +377,7 @@ ModelAnimation :: struct { boneCount: c.int, // Number of bones frameCount: c.int, // Number of animation frames bones: [^]BoneInfo, // Bones information (skeleton) - framePoses: [^]^Transform, // Poses array by frame + framePoses: [^][^]Transform, // Poses array by frame } // Ray type (useful for raycast) @@ -403,7 +402,7 @@ BoundingBox :: struct { // Wave type, defines audio wave data Wave :: struct { - sampleCount: c.uint, // Total number of samples + frameCount: c.uint, // Total number of frames (considering channels) sampleRate: c.uint, // Frequency (samples per second) sampleSize: c.uint, // Bit depth (bits per sample): 8, 16, 32 (24 not supported) channels: c.uint, // Number of channels (1-mono, 2-stereo) @@ -411,9 +410,10 @@ Wave :: struct { } // Audio stream type -// NOTE: Useful to create custom audio streams not bound to a specific file +// NOTE: Actual structs are defined internally in raudio module AudioStream :: struct { buffer: rawptr, // Pointer to internal data used by the audio system + processor: rawptr, // Pointer to internal data processor, useful for audio effects sampleRate: c.uint, // Frequency (samples per second) sampleSize: c.uint, // Bit depth (bits per sample): 8, 16, 32 (24 not supported) @@ -423,14 +423,14 @@ AudioStream :: struct { // Sound source type Sound :: struct { using stream: AudioStream, // Audio stream - sampleCount: c.uint, // Total number of samples + frameCount: c.uint, // Total number of frames (considering channels) } // Music stream type (audio file streaming from memory) // NOTE: Anything longer than ~10 seconds should be streamed Music :: struct { using stream: AudioStream, // Audio stream - sampleCount: c.uint, // Total number of samples + frameCount: c.uint, // Total number of frames (considering channels) looping: bool, // Music looping enable ctxType: c.int, // Type of music context (audio filetype) @@ -463,6 +463,13 @@ VrStereoConfig :: struct { scaleIn: [2]f32, // VR distortion scale in } +// File path list +FilePathList :: struct { + capacity: c.uint, // Filepaths max entries + count: c.uint, // Filepaths entries count + paths: [^]cstring, // Filepaths entries +} + //---------------------------------------------------------------------------------- // Enumerators Definition @@ -471,403 +478,380 @@ VrStereoConfig :: struct { // NOTE: Every bit registers one state (use it with bit masks) // By default all flags are set to 0 ConfigFlag :: enum c.int { - VSYNC_HINT = 6, // Set to try enabling V-Sync on GPU - FULLSCREEN_MODE = 1, // Set to run program in fullscreen - WINDOW_RESIZABLE = 2, // Set to allow resizable window - WINDOW_UNDECORATED = 3, // Set to disable window decoration (frame and buttons) - WINDOW_HIDDEN = 7, // Set to hide window - WINDOW_MINIMIZED = 9, // Set to minimize window (iconify) - WINDOW_MAXIMIZED = 10, // Set to maximize window (expanded to monitor) - WINDOW_UNFOCUSED = 11, // Set to window non focused - WINDOW_TOPMOST = 12, // Set to window always on top - WINDOW_ALWAYS_RUN = 8, // Set to allow windows running while minimized - WINDOW_TRANSPARENT = 4, // Set to allow transparent framebuffer - WINDOW_HIGHDPI = 13, // Set to support HighDPI - MSAA_4X_HINT = 5, // Set to try enabling MSAA 4X - INTERLACED_HINT = 16, // Set to try enabling interlaced video format (for V3D) + VSYNC_HINT = 6, // Set to try enabling V-Sync on GPU + FULLSCREEN_MODE = 1, // Set to run program in fullscreen + WINDOW_RESIZABLE = 2, // Set to allow resizable window + WINDOW_UNDECORATED = 3, // Set to disable window decoration (frame and buttons) + WINDOW_HIDDEN = 7, // Set to hide window + WINDOW_MINIMIZED = 9, // Set to minimize window (iconify) + WINDOW_MAXIMIZED = 10, // Set to maximize window (expanded to monitor) + WINDOW_UNFOCUSED = 11, // Set to window non focused + WINDOW_TOPMOST = 12, // Set to window always on top + WINDOW_ALWAYS_RUN = 8, // Set to allow windows running while minimized + 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 + MSAA_4X_HINT = 5, // Set to try enabling MSAA 4X + INTERLACED_HINT = 16, // Set to try enabling interlaced video format (for V3D) } ConfigFlags :: distinct bit_set[ConfigFlag; c.int] // Trace log level TraceLogLevel :: enum c.int { - ALL = 0, // Display all logs - TRACE, - DEBUG, - INFO, - WARNING, - ERROR, - FATAL, - NONE, // Disable logging + ALL = 0, // Display all logs + TRACE, // Trace logging, intended for internal use only + DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds + INFO, // Info logging, used for program execution info + WARNING, // Warning logging, used on recoverable failures + ERROR, // Error logging, used on unrecoverable failures + FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE) + NONE, // Disable logging } // Keyboard keys (US keyboard layout) // NOTE: Use GetKeyPressed() to allow redefining // required keys for alternative layouts KeyboardKey :: enum c.int { - NULL = 0, + KEY_NULL = 0, // Key: NULL, used for no key pressed // Alphanumeric keys - APOSTROPHE = 39, - COMMA = 44, - MINUS = 45, - PERIOD = 46, - SLASH = 47, - ZERO = 48, - ONE = 49, - TWO = 50, - THREE = 51, - FOUR = 52, - FIVE = 53, - SIX = 54, - SEVEN = 55, - EIGHT = 56, - NINE = 57, - SEMICOLON = 59, - EQUAL = 61, - A = 65, - B = 66, - C = 67, - D = 68, - E = 69, - F = 70, - G = 71, - H = 72, - I = 73, - J = 74, - K = 75, - L = 76, - M = 77, - N = 78, - O = 79, - P = 80, - Q = 81, - R = 82, - S = 83, - T = 84, - U = 85, - V = 86, - W = 87, - X = 88, - Y = 89, - Z = 90, - + APOSTROPHE = 39, // Key: ' + COMMA = 44, // Key: , + MINUS = 45, // Key: - + PERIOD = 46, // Key: . + SLASH = 47, // Key: / + ZERO = 48, // Key: 0 + ONE = 49, // Key: 1 + TWO = 50, // Key: 2 + THREE = 51, // Key: 3 + FOUR = 52, // Key: 4 + FIVE = 53, // Key: 5 + SIX = 54, // Key: 6 + SEVEN = 55, // Key: 7 + EIGHT = 56, // Key: 8 + NINE = 57, // Key: 9 + SEMICOLON = 59, // Key: ; + EQUAL = 61, // Key: = + A = 65, // Key: A | a + B = 66, // Key: B | b + C = 67, // Key: C | c + D = 68, // Key: D | d + E = 69, // Key: E | e + F = 70, // Key: F | f + G = 71, // Key: G | g + H = 72, // Key: H | h + I = 73, // Key: I | i + J = 74, // Key: J | j + K = 75, // Key: K | k + L = 76, // Key: L | l + M = 77, // Key: M | m + N = 78, // Key: N | n + O = 79, // Key: O | o + P = 80, // Key: P | p + Q = 81, // Key: Q | q + R = 82, // Key: R | r + S = 83, // Key: S | s + T = 84, // Key: T | t + U = 85, // Key: U | u + V = 86, // Key: V | v + W = 87, // Key: W | w + X = 88, // Key: X | x + Y = 89, // Key: Y | y + Z = 90, // Key: Z | z + LEFT_BRACKET = 91, // Key: [ + BACKSLASH = 92, // Key: '\' + RIGHT_BRACKET = 93, // Key: ] + GRAVE = 96, // Key: ` // Function keys - SPACE = 32, - ESCAPE = 256, - ENTER = 257, - TAB = 258, - BACKSPACE = 259, - INSERT = 260, - DELETE = 261, - RIGHT = 262, - LEFT = 263, - DOWN = 264, - UP = 265, - PAGE_UP = 266, - PAGE_DOWN = 267, - HOME = 268, - END = 269, - CAPS_LOCK = 280, - SCROLL_LOCK = 281, - NUM_LOCK = 282, - PRINT_SCREEN = 283, - PAUSE = 284, - F1 = 290, - F2 = 291, - F3 = 292, - F4 = 293, - F5 = 294, - F6 = 295, - F7 = 296, - F8 = 297, - F9 = 298, - F10 = 299, - F11 = 300, - F12 = 301, - LEFT_SHIFT = 340, - LEFT_CONTROL = 341, - LEFT_ALT = 342, - LEFT_SUPER = 343, - RIGHT_SHIFT = 344, - RIGHT_CONTROL = 345, - RIGHT_ALT = 346, - RIGHT_SUPER = 347, - KB_MENU = 348, - LEFT_BRACKET = 91, - BACKSLASH = 92, - RIGHT_BRACKET = 93, - GRAVE = 96, - + SPACE = 32, // Key: Space + ESCAPE = 256, // Key: Esc + ENTER = 257, // Key: Enter + TAB = 258, // Key: Tab + BACKSPACE = 259, // Key: Backspace + INSERT = 260, // Key: Ins + DELETE = 261, // Key: Del + RIGHT = 262, // Key: Cursor right + LEFT = 263, // Key: Cursor left + DOWN = 264, // Key: Cursor down + UP = 265, // Key: Cursor up + PAGE_UP = 266, // Key: Page up + PAGE_DOWN = 267, // Key: Page down + HOME = 268, // Key: Home + END = 269, // Key: End + CAPS_LOCK = 280, // Key: Caps lock + SCROLL_LOCK = 281, // Key: Scroll down + NUM_LOCK = 282, // Key: Num lock + PRINT_SCREEN = 283, // Key: Print screen + PAUSE = 284, // Key: Pause + F1 = 290, // Key: F1 + F2 = 291, // Key: F2 + F3 = 292, // Key: F3 + F4 = 293, // Key: F4 + F5 = 294, // Key: F5 + F6 = 295, // Key: F6 + F7 = 296, // Key: F7 + F8 = 297, // Key: F8 + F9 = 298, // Key: F9 + F10 = 299, // Key: F10 + F11 = 300, // Key: F11 + F12 = 301, // Key: F12 + LEFT_SHIFT = 340, // Key: Shift left + LEFT_CONTROL = 341, // Key: Control left + LEFT_ALT = 342, // Key: Alt left + LEFT_SUPER = 343, // Key: Super left + RIGHT_SHIFT = 344, // Key: Shift right + RIGHT_CONTROL = 345, // Key: Control right + RIGHT_ALT = 346, // Key: Alt right + RIGHT_SUPER = 347, // Key: Super right + KB_MENU = 348, // Key: KB menu // Keypad keys - KP_0 = 320, - KP_1 = 321, - KP_2 = 322, - KP_3 = 323, - KP_4 = 324, - KP_5 = 325, - KP_6 = 326, - KP_7 = 327, - KP_8 = 328, - KP_9 = 329, - KP_DECIMAL = 330, - KP_DIVIDE = 331, - KP_MULTIPLY = 332, - KP_SUBTRACT = 333, - KP_ADD = 334, - KP_ENTER = 335, - KP_EQUAL = 336, + KP_0 = 320, // Key: Keypad 0 + KP_1 = 321, // Key: Keypad 1 + KP_2 = 322, // Key: Keypad 2 + KP_3 = 323, // Key: Keypad 3 + KP_4 = 324, // Key: Keypad 4 + KP_5 = 325, // Key: Keypad 5 + KP_6 = 326, // Key: Keypad 6 + KP_7 = 327, // Key: Keypad 7 + KP_8 = 328, // Key: Keypad 8 + KP_9 = 329, // Key: Keypad 9 + KP_DECIMAL = 330, // Key: Keypad . + KP_DIVIDE = 331, // Key: Keypad / + KP_MULTIPLY = 332, // Key: Keypad * + KP_SUBTRACT = 333, // Key: Keypad - + KP_ADD = 334, // Key: Keypad + + KP_ENTER = 335, // Key: Keypad Enter + KP_EQUAL = 336, // Key: Keypad = // Android key buttons - BACK = 4, - MENU = 82, - VOLUME_UP = 24, - VOLUME_DOWN = 25, + BACK = 4, // Key: Android back button + MENU = 82, // Key: Android menu button + VOLUME_UP = 24, // Key: Android volume up button + VOLUME_DOWN = 25, // Key: Android volume down button } // Mouse buttons MouseButton :: enum c.int { - LEFT = 0, // Mouse button left - RIGHT = 1, // Mouse button right - MIDDLE = 2, // Mouse button middle (pressed wheel) - SIDE = 3, // Mouse button side (advanced mouse device) - EXTRA = 4, // Mouse button extra (advanced mouse device) - FORWARD = 5, // Mouse button fordward (advanced mouse device) - BACK = 6, // Mouse button back (advanced mouse device) + LEFT = 0, // Mouse button left + RIGHT = 1, // Mouse button right + MIDDLE = 2, // Mouse button middle (pressed wheel) + SIDE = 3, // Mouse button side (advanced mouse device) + EXTRA = 4, // Mouse button extra (advanced mouse device) + FORWARD = 5, // Mouse button fordward (advanced mouse device) + BACK = 6, // Mouse button back (advanced mouse device) } // Mouse cursor MouseCursor :: enum c.int { - DEFAULT = 0, - ARROW = 1, - IBEAM = 2, - CROSSHAIR = 3, - POINTING_HAND = 4, - RESIZE_EW = 5, // The horizontal resize/move arrow shape - RESIZE_NS = 6, // The vertical resize/move arrow shape - RESIZE_NWSE = 7, // The top-left to bottom-right diagonal resize/move arrow shape - RESIZE_NESW = 8, // The top-right to bottom-left diagonal resize/move arrow shape - RESIZE_ALL = 9, // The omni-directional resize/move cursor shape - NOT_ALLOWED = 10, // The operation-not-allowed shape + DEFAULT = 0, // Default pointer shape + ARROW = 1, // Arrow shape + IBEAM = 2, // Text writing cursor shape + CROSSHAIR = 3, // Cross shape + POINTING_HAND = 4, // Pointing hand cursor + RESIZE_EW = 5, // Horizontal resize/move arrow shape + RESIZE_NS = 6, // Vertical resize/move arrow shape + RESIZE_NWSE = 7, // Top-left to bottom-right diagonal resize/move arrow shape + RESIZE_NESW = 8, // The top-right to bottom-left diagonal resize/move arrow shape + RESIZE_ALL = 9, // The omnidirectional resize/move cursor shape + NOT_ALLOWED = 10, // The operation-not-allowed shape } // Gamepad buttons GamepadButton :: enum c.int { - // This is here just for error checking - UNKNOWN = 0, - - // This is normally a DPAD - LEFT_FACE_UP, - LEFT_FACE_RIGHT, - LEFT_FACE_DOWN, - LEFT_FACE_LEFT, - - // This normally corresponds with PlayStation and Xbox controllers - // XBOX: [Y,X,A,B] - // PS3: [Triangle,Square,Cross,Circle] - // No support for 6 button controllers though.. - RIGHT_FACE_UP, - RIGHT_FACE_RIGHT, - RIGHT_FACE_DOWN, - RIGHT_FACE_LEFT, - - // Triggers - LEFT_TRIGGER_1, - LEFT_TRIGGER_2, - RIGHT_TRIGGER_1, - RIGHT_TRIGGER_2, - - // These are buttons in the center of the gamepad - MIDDLE_LEFT, // PS3 Select - MIDDLE, // PS Button/XBOX Button - MIDDLE_RIGHT, // PS3 Start - - // These are the joystick press in buttons - LEFT_THUMB, - RIGHT_THUMB, + UNKNOWN = 0, // Unknown button, just for error checking + LEFT_FACE_UP, // Gamepad left DPAD up button + LEFT_FACE_RIGHT, // Gamepad left DPAD right button + LEFT_FACE_DOWN, // Gamepad left DPAD down button + LEFT_FACE_LEFT, // Gamepad left DPAD left button + RIGHT_FACE_UP, // Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) + RIGHT_FACE_RIGHT, // Gamepad right button right (i.e. PS3: Square, Xbox: X) + RIGHT_FACE_DOWN, // Gamepad right button down (i.e. PS3: Cross, Xbox: A) + RIGHT_FACE_LEFT, // Gamepad right button left (i.e. PS3: Circle, Xbox: B) + LEFT_TRIGGER_1, // Gamepad top/back trigger left (first), it could be a trailing button + LEFT_TRIGGER_2, // Gamepad top/back trigger left (second), it could be a trailing button + RIGHT_TRIGGER_1, // Gamepad top/back trigger right (one), it could be a trailing button + RIGHT_TRIGGER_2, // Gamepad top/back trigger right (second), it could be a trailing button + MIDDLE_LEFT, // Gamepad center buttons, left one (i.e. PS3: Select) + MIDDLE, // Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX) + MIDDLE_RIGHT, // Gamepad center buttons, right one (i.e. PS3: Start) + LEFT_THUMB, // Gamepad joystick pressed button left + RIGHT_THUMB, // Gamepad joystick pressed button right } // Gamepad axis GamepadAxis :: enum c.int { - // Left stick - LEFT_X = 0, - LEFT_Y = 1, - - // Right stick - RIGHT_X = 2, - RIGHT_Y = 3, - - // Pressure levels for the back triggers - LEFT_TRIGGER = 4, // [1..-1] (pressure-level) - RIGHT_TRIGGER = 5, // [1..-1] (pressure-level) + LEFT_X = 0, // Gamepad left stick X axis + LEFT_Y = 1, // Gamepad left stick Y axis + RIGHT_X = 2, // Gamepad right stick X axis + RIGHT_Y = 3, // Gamepad right stick Y axis + LEFT_TRIGGER = 4, // Gamepad back trigger left, pressure level: [1..-1] + RIGHT_TRIGGER = 5, // Gamepad back trigger right, pressure level: [1..-1] } // Material map index MaterialMapIndex :: enum c.int { - ALBEDO = 0, // MATERIAL_MAP_DIFFUSE - METALNESS = 1, // MATERIAL_MAP_SPECULAR - NORMAL = 2, - ROUGHNESS = 3, - OCCLUSION, - EMISSION, - HEIGHT, - BRDG, - CUBEMAP, // NOTE: Uses GL_TEXTURE_CUBE_MAP - IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP - PREFILTER, // NOTE: Uses GL_TEXTURE_CUBE_MAP - - DIFFUSE = ALBEDO, - SPECULAR = METALNESS, + ALBEDO = 0, // Albedo material (same as: MATERIAL_MAP_DIFFUSE) + METALNESS, // Metalness material (same as: MATERIAL_MAP_SPECULAR) + NORMAL, // Normal material + ROUGHNESS, // Roughness material + OCCLUSION, // Ambient occlusion material + EMISSION, // Emission material + HEIGHT, // Heightmap material + CUBEMAP, // Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + IRRADIANCE, // Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + PREFILTER, // Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + BRDF, // Brdf material } // Shader location index ShaderLocationIndex :: enum c.int { - VERTEX_POSITION = 0, - VERTEX_TEXCOORD01, - VERTEX_TEXCOORD02, - VERTEX_NORMAL, - VERTEX_TANGENT, - VERTEX_COLOR, - MATRIX_MVP, - MATRIX_VIEW, - MATRIX_PROJECTION, - MATRIX_MODEL, - MATRIX_NORMAL, - VECTOR_VIEW, - COLOR_DIFFUSE, - COLOR_SPECULAR, - COLOR_AMBIENT, - MAP_ALBEDO, - MAP_METALNESS, - MAP_NORMAL, - MAP_ROUGHNESS, - MAP_OCCLUSION, - MAP_EMISSION, - MAP_HEIGHT, - MAP_CUBEMAP, - MAP_IRRADIANCE, - MAP_PREFILTER, - MAP_BRDF, - - MAP_DIFFUSE = MAP_ALBEDO, - MAP_SPECULAR = MAP_METALNESS, + VERTEX_POSITION = 0, // Shader location: vertex attribute: position + VERTEX_TEXCOORD01, // Shader location: vertex attribute: texcoord01 + VERTEX_TEXCOORD02, // Shader location: vertex attribute: texcoord02 + VERTEX_NORMAL, // Shader location: vertex attribute: normal + VERTEX_TANGENT, // Shader location: vertex attribute: tangent + VERTEX_COLOR, // Shader location: vertex attribute: color + MATRIX_MVP, // Shader location: matrix uniform: model-view-projection + MATRIX_VIEW, // Shader location: matrix uniform: view (camera transform) + MATRIX_PROJECTION, // Shader location: matrix uniform: projection + MATRIX_MODEL, // Shader location: matrix uniform: model (transform) + MATRIX_NORMAL, // Shader location: matrix uniform: normal + VECTOR_VIEW, // Shader location: vector uniform: view + COLOR_DIFFUSE, // Shader location: vector uniform: diffuse color + COLOR_SPECULAR, // Shader location: vector uniform: specular color + COLOR_AMBIENT, // Shader location: vector uniform: ambient color + MAP_ALBEDO, // Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE) + MAP_METALNESS, // Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR) + MAP_NORMAL, // Shader location: sampler2d texture: normal + MAP_ROUGHNESS, // Shader location: sampler2d texture: roughness + MAP_OCCLUSION, // Shader location: sampler2d texture: occlusion + MAP_EMISSION, // Shader location: sampler2d texture: emission + MAP_HEIGHT, // Shader location: sampler2d texture: height + MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap + MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance + MAP_PREFILTER, // Shader location: samplerCube texture: prefilter + MAP_BRDF // Shader location: sampler2d texture: brdf } // Shader uniform data type ShaderUniformDataType :: enum c.int { - FLOAT = 0, - VEC2, - VEC3, - VEC4, - INT, - IVEC2, - IVEC3, - IVEC4, - SAMPLER2D, + FLOAT = 0, // Shader uniform type: float + VEC2, // Shader uniform type: vec2 (2 float) + VEC3, // Shader uniform type: vec3 (3 float) + VEC4, // Shader uniform type: vec4 (4 float) + INT, // Shader uniform type: int + IVEC2, // Shader uniform type: ivec2 (2 int) + IVEC3, // Shader uniform type: ivec3 (3 int) + IVEC4, // Shader uniform type: ivec4 (4 int) + SAMPLER2D // Shader uniform type: sampler2d } // Pixel formats // NOTE: Support depends on OpenGL version and platform PixelFormat :: enum c.int { - UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha) - UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels) - UNCOMPRESSED_R5G6B5, // 16 bpp - UNCOMPRESSED_R8G8B8, // 24 bpp - UNCOMPRESSED_R5G5B5A1, // 16 bpp (1 bit alpha) - UNCOMPRESSED_R4G4B4A4, // 16 bpp (4 bit alpha) - UNCOMPRESSED_R8G8B8A8, // 32 bpp - UNCOMPRESSED_R32, // 32 bpp (1 channel - float) - UNCOMPRESSED_R32G32B32, // 32*3 bpp (3 channels - float) - UNCOMPRESSED_R32G32B32A32, // 32*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 - COMPRESSED_DXT5_RGBA, // 8 bpp - COMPRESSED_ETC1_RGB, // 4 bpp - COMPRESSED_ETC2_RGB, // 4 bpp - COMPRESSED_ETC2_EAC_RGBA, // 8 bpp - COMPRESSED_PVRT_RGB, // 4 bpp - COMPRESSED_PVRT_RGBA, // 4 bpp - COMPRESSED_ASTC_4x4_RGBA, // 8 bpp - COMPRESSED_ASTC_8x8_RGBA, // 2 bpp + UNKNOWN = 0, + UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha) + UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels) + UNCOMPRESSED_R5G6B5, // 16 bpp + UNCOMPRESSED_R8G8B8, // 24 bpp + UNCOMPRESSED_R5G5B5A1, // 16 bpp (1 bit alpha) + UNCOMPRESSED_R4G4B4A4, // 16 bpp (4 bit alpha) + UNCOMPRESSED_R8G8B8A8, // 32 bpp + UNCOMPRESSED_R32, // 32 bpp (1 channel - float) + UNCOMPRESSED_R32G32B32, // 32*3 bpp (3 channels - float) + UNCOMPRESSED_R32G32B32A32, // 32*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 + COMPRESSED_DXT5_RGBA, // 8 bpp + COMPRESSED_ETC1_RGB, // 4 bpp + COMPRESSED_ETC2_RGB, // 4 bpp + COMPRESSED_ETC2_EAC_RGBA, // 8 bpp + COMPRESSED_PVRT_RGB, // 4 bpp + COMPRESSED_PVRT_RGBA, // 4 bpp + COMPRESSED_ASTC_4x4_RGBA, // 8 bpp + COMPRESSED_ASTC_8x8_RGBA // 2 bpp } // Texture parameters: filter mode // NOTE 1: Filtering considers mipmaps if available in the texture // NOTE 2: Filter is accordingly set for minification and magnification TextureFilter :: enum c.int { - POINT = 0, // No filter, just pixel aproximation - BILINEAR, // Linear filtering - TRILINEAR, // Trilinear filtering (linear with mipmaps) - ANISOTROPIC_4X, // Anisotropic filtering 4x - ANISOTROPIC_8X, // Anisotropic filtering 8x - ANISOTROPIC_16X, // Anisotropic filtering 16x + POINT = 0, // No filter, just pixel approximation + BILINEAR, // Linear filtering + TRILINEAR, // Trilinear filtering (linear with mipmaps) + ANISOTROPIC_4X, // Anisotropic filtering 4x + ANISOTROPIC_8X, // Anisotropic filtering 8x + ANISOTROPIC_16X, // Anisotropic filtering 16x } // Texture parameters: wrap mode TextureWrap :: enum c.int { - REPEAT = 0, // Repeats texture in tiled mode - CLAMP, // Clamps texture to edge pixel in tiled mode - MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode - MIRROR_CLAMP, // Mirrors and clamps to border the texture in tiled mode + REPEAT = 0, // Repeats texture in tiled mode + CLAMP, // Clamps texture to edge pixel in tiled mode + MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode + MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode } // Cubemap layouts CubemapLayout :: enum c.int { - AUTO_DETECT = 0, // Automatically detect layout type - LINE_VERTICAL, // Layout is defined by a vertical line with faces - LINE_HORIZONTAL, // Layout is defined by an horizontal line with faces - CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces - CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces - PANORAMA, // Layout is defined by a panorama image (equirectangular map) + AUTO_DETECT = 0, // Automatically detect layout type + LINE_VERTICAL, // Layout is defined by a vertical line with faces + LINE_HORIZONTAL, // Layout is defined by an horizontal line with faces + CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces + CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces + PANORAMA, // Layout is defined by a panorama image (equirectangular map) } // Font type, defines generation method FontType :: enum c.int { - DEFAULT = 0, // Default font generation, anti-aliased - BITMAP, // Bitmap font generation, no anti-aliasing - SDF, // SDF font generation, requires external shader + DEFAULT = 0, // Default font generation, anti-aliased + BITMAP, // Bitmap font generation, no anti-aliasing + SDF, // SDF font generation, requires external shader } // Color blending modes (pre-defined) BlendMode :: enum c.int { - ALPHA = 0, // Blend textures considering alpha (default) - ADDITIVE, // Blend textures adding colors - MULTIPLIED, // Blend textures multiplying colors - ADD_COLORS, // Blend textures adding colors (alternative) - SUBTRACT_COLORS, // Blend textures subtracting colors (alternative) - CUSTOM, // Belnd textures using custom src/dst factors (use rlSetBlendMode()) + ALPHA = 0, // Blend textures considering alpha (default) + ADDITIVE, // Blend textures adding colors + MULTIPLIED, // Blend textures multiplying colors + ADD_COLORS, // Blend textures adding colors (alternative) + SUBTRACT_COLORS, // Blend textures subtracting colors (alternative) + ALPHA_PREMULTIPLY, // Blend premultiplied textures considering alpha + CUSTOM, // Blend textures using custom src/dst factors (use rlSetBlendFactors()) + CUSTOM_SEPARATE // Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate()) } // Gestures // NOTE: It could be used as flags to enable only some gestures Gesture :: enum c.int { - TAP = 0, - DOUBLETAP = 1, - HOLD = 2, - DRAG = 3, - SWIPE_RIGHT = 4, - SWIPE_LEFT = 5, - SWIPE_UP = 6, - SWIPE_DOWN = 7, - PINCH_IN = 8, - PINCH_OUT = 9, + TAP = 0, // Tap gesture + DOUBLETAP = 1, // Double tap gesture + HOLD = 2, // Hold gesture + DRAG = 3, // Drag gesture + SWIPE_RIGHT = 4, // Swipe right gesture + SWIPE_LEFT = 5, // Swipe left gesture + SWIPE_UP = 6, // Swipe up gesture + SWIPE_DOWN = 7, // Swipe down gesture + PINCH_IN = 8, // Pinch in gesture + PINCH_OUT = 9, // Pinch out gesture } Gestures :: distinct bit_set[Gesture; c.int] // Camera system modes CameraMode :: enum c.int { - CUSTOM = 0, - FREE, - ORBITAL, - FIRST_PERSON, - THIRD_PERSON, + CUSTOM = 0, // Custom camera + FREE, // Free camera + ORBITAL, // Orbital camera + FIRST_PERSON, // First person camera + THIRD_PERSON, // Third person camera } // Camera projection CameraProjection :: enum c.int { - PERSPECTIVE = 0, - ORTHOGRAPHIC, + PERSPECTIVE = 0, // Perspective projection + ORTHOGRAPHIC, // Orthographic projection } // N-patch layout @@ -881,12 +865,14 @@ 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 +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 LoadFileTextCallback :: #type proc "c" (fileName: cstring) -> [^]u8 // FileIO: Load text data SaveFileTextCallback :: #type proc "c" (fileName: cstring, text: cstring) -> bool // FileIO: Save text data +AudioCallback :: #type proc "c" (bufferData: rawptr, frames: c.uint) + @(default_calling_convention="c") foreign lib { @@ -901,36 +887,40 @@ 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 KEY_ESCAPE pressed or Close icon pressed 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 - IsWindowHidden :: proc() -> bool --- // Check if window is currently hidden (only PLATFORM_DESKTOP) - IsWindowMinimized :: proc() -> bool --- // Check if window is currently minimized (only PLATFORM_DESKTOP) - IsWindowMaximized :: proc() -> bool --- // Check if window is currently maximized (only PLATFORM_DESKTOP) - IsWindowFocused :: proc() -> bool --- // Check if window is currently focused (only PLATFORM_DESKTOP) - IsWindowResized :: proc() -> bool --- // Check if window has been resized last frame - IsWindowState :: proc(flag: ConfigFlags) -> bool --- // Check if one specific window flag is enabled - SetWindowState :: proc(flags: ConfigFlags) --- // Set window configuration state using flags + IsWindowReady :: proc() -> bool --- // Check if window has been initialized successfully + IsWindowFullscreen :: proc() -> bool --- // Check if window is currently fullscreen + IsWindowHidden :: proc() -> bool --- // Check if window is currently hidden (only PLATFORM_DESKTOP) + IsWindowMinimized :: proc() -> bool --- // Check if window is currently minimized (only PLATFORM_DESKTOP) + IsWindowMaximized :: proc() -> bool --- // Check if window is currently maximized (only PLATFORM_DESKTOP) + IsWindowFocused :: proc() -> bool --- // Check if window is currently focused (only PLATFORM_DESKTOP) + IsWindowResized :: proc() -> bool --- // Check if window has been resized last frame + IsWindowState :: proc(flag: ConfigFlag) -> bool --- // Check if one specific window flag is enabled + 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) 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 (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) 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) SetWindowMinSize :: proc(width, height: c.int) --- // Set window minimum 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) GetWindowHandle :: proc() -> rawptr --- // Get native window handle GetScreenWidth :: proc() -> c.int --- // Get current screen width GetScreenHeight :: proc() -> c.int --- // Get current screen height + GetRenderWidth :: proc() -> c.int --- // Get current render width (it considers HiDPI) + GetRenderHeight :: proc() -> c.int --- // Get current render height (it considers HiDPI) GetMonitorCount :: proc() -> c.int --- // Get number of connected monitors GetCurrentMonitor :: proc() -> c.int --- // Get current connected monitor GetMonitorPosition :: proc(monitor: c.int) -> Vector2 --- // Get specified monitor position - GetMonitorWidth :: proc(monitor: c.int) -> c.int --- // Get specified monitor width (max available by monitor) - GetMonitorHeight :: proc(monitor: c.int) -> c.int --- // Get specified monitor height (max available by monitor) + GetMonitorWidth :: proc(monitor: c.int) -> c.int --- // Get specified monitor width (current video mode used by monitor) + GetMonitorHeight :: proc(monitor: c.int) -> c.int --- // Get specified monitor height (current video mode used by monitor) GetMonitorPhysicalWidth :: proc(monitor: c.int) -> c.int --- // Get specified monitor physical width in millimetres GetMonitorPhysicalHeight :: proc(monitor: c.int) -> c.int --- // Get specified monitor physical height in millimetres GetMonitorRefreshRate :: proc(monitor: c.int) -> c.int --- // Get specified monitor refresh rate @@ -939,24 +929,26 @@ foreign lib { GetMonitorName :: proc(monitor: c.int) -> cstring --- // Get the human-readable, UTF-8 encoded name of the primary 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 + DisableEventWaiting :: proc() --- // Disable waiting for events on EndDrawing(), automatic events polling + - // 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) + SwapScreenBuffer :: proc() --- // Swap back buffer with front buffer (screen drawing) + PollInputEvents :: proc() --- // Register all input events + WaitTime :: proc(seconds: f64) --- // Wait for some time (halt program execution) // Cursor-related functions - ShowCursor :: proc() --- // Shows cursor - HideCursor :: proc() --- // Hides cursor - IsCursorHidden :: proc() -> bool --- // Check if cursor is not visible - EnableCursor :: proc() --- // Enables cursor (unlock cursor) - DisableCursor :: proc() --- // Disables cursor (lock cursor) - IsCursorOnScreen :: proc() -> bool --- // Check if cursor is on the current screen. + ShowCursor :: proc() --- // Shows cursor + HideCursor :: proc() --- // Hides cursor + IsCursorHidden :: proc() -> bool --- // Check if cursor is not visible + EnableCursor :: proc() --- // Enables cursor (unlock cursor) + DisableCursor :: proc() --- // Disables cursor (lock cursor) + IsCursorOnScreen :: proc() -> bool --- // Check if cursor is on the current screen. // Drawing-related functions ClearBackground :: proc(color: Color) --- // Set background color (framebuffer clear color) @@ -985,6 +977,7 @@ foreign lib { // NOTE: Shader functionality is not available on OpenGL 1.1 LoadShader :: proc(vsFileName, fsFileName: cstring) -> Shader --- // Load shader from files and bind default locations LoadShaderFromMemory :: proc(vsCode, fsCode: cstring) -> Shader --- // Load shader from code strings and bind default locations + IsShaderReady :: proc(shader: Shader) -> bool --- // Check if a shader is ready GetShaderLocation :: proc(shader: Shader, uniformName: cstring) -> c.int --- // Get shader uniform location GetShaderLocationAttrib :: proc(shader: Shader, attribName: cstring) -> c.int --- // Get shader attribute location SetShaderValue :: proc(shader: Shader, locIndex: ShaderLocationIndex, value: rawptr, uniformType: ShaderUniformDataType) --- // Set shader uniform value @@ -994,13 +987,13 @@ foreign lib { UnloadShader :: proc(shader: Shader) --- // Unload shader from GPU memory (VRAM) // Screen-space-related functions - GetMouseRay :: proc(mousePosition: Vector2, camera: Camera) -> Ray --- // Returns a ray trace from mouse position - GetCameraMatrix :: proc(camera: Camera) -> Matrix --- // Returns camera transform matrix (view matrix) - GetCameraMatrix2D :: proc(camera: Camera2D) -> Matrix --- // Returns camera 2d transform matrix - GetWorldToScreen :: proc(position: Vector3, camera: Camera) -> Vector2 --- // Returns the screen space position for a 3d world space position - GetWorldToScreenEx :: proc(position: Vector3, camera: Camera, width, height: c.int) -> Vector2 --- // Returns size position for a 3d world space position - GetWorldToScreen2D :: proc(position: Vector2, camera: Camera2D) -> Vector2 --- // Returns the screen space position for a 2d camera world space position - GetScreenToWorld2D :: proc(position: Vector2, camera: Camera2D) -> Vector2 --- // Returns the world space position for a 2d camera screen space position + GetMouseRay :: proc(mousePosition: Vector2, camera: Camera) -> Ray --- // Get a ray trace from mouse position + GetCameraMatrix :: proc(camera: Camera) -> Matrix --- // Get camera transform matrix (view matrix) + GetCameraMatrix2D :: proc(camera: Camera2D) -> Matrix --- // Get camera 2d transform matrix + GetWorldToScreen :: proc(position: Vector3, camera: Camera) -> Vector2 --- // Get the screen space position for a 3d world space position + GetScreenToWorld2D :: proc(position: Vector2, camera: Camera2D) -> Vector2 --- // Get the world space position for a 2d camera screen space position + GetWorldToScreenEx :: proc(position: Vector3, camera: Camera, width, height: c.int) -> Vector2 --- // Get size position for a 3d world space position + GetWorldToScreen2D :: proc(position: Vector2, camera: Camera2D) -> Vector2 --- // Get the screen space position for a 2d camera world space position // Timing-related functions SetTargetFPS :: proc(fps: c.int) --- // Set target FPS (maximum) @@ -1016,9 +1009,11 @@ foreign lib { 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.int) -> rawptr --- // Internal memory allocator - MemRealloc :: proc(ptr: rawptr, size: c.int) -> rawptr --- // Internal memory reallocator - MemFree :: proc(ptr: rawptr) --- // Internal memory free + 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 @@ -1029,39 +1024,39 @@ foreign lib { SetSaveFileTextCallback :: proc(callback: SaveFileTextCallback) --- // Set custom file text data saver // Files management functions - LoadFileData :: proc(fileName: cstring, bytesRead: ^c.uint) -> [^]u8 --- // Load file data as byte array (read) - UnloadFileData :: proc(data: [^]u8) --- // 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 - LoadFileText :: proc(fileName: cstring) -> [^]u8 --- // Load text data from file (read), returns a '\0' terminated string - UnloadFileText :: proc(text: cstring) --- // Unload file text data allocated by LoadFileText() - SaveFileText :: proc(fileName: cstring, text: cstring) -> bool --- // Save text data to file (write), string must be '\0' terminated, returns true on success - FileExists :: proc(fileName: cstring) -> bool --- // Check if file exists - DirectoryExists :: proc(dirPath: cstring) -> bool --- // Check if a directory path exists - IsFileExtension :: proc(fileName: cstring, ext: cstring) -> bool --- // Check file extension (including point: .png, .wav) - GetFileExtension :: proc(fileName: cstring) -> cstring --- // Get pointer to extension for a filename string (includes dot: ".png") - GetFileName :: proc(filePath: cstring) -> cstring --- // Get pointer to filename for a path string - GetFileNameWithoutExt :: proc(filePath: cstring) -> cstring --- // Get filename string without extension (uses static string) - 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) - GetDirectoryFiles :: proc(dirPath: cstring, count: ^c.int) -> [^]cstring --- // Get filenames in a directory path (memory should be freed) - ClearDirectoryFiles :: proc() --- // Clear directory files paths buffers (free memory) - ChangeDirectory :: proc(dir: cstring) -> bool --- // Change working directory, return true on success - IsFileDropped :: proc() -> bool --- // Check if a file has been dropped into window - GetDroppedFiles :: proc(count: ^c.int) -> [^]cstring --- // Get dropped files names (memory should be freed) - ClearDroppedFiles :: proc() --- // Clear dropped files paths buffer (free memory) - GetFileModTime :: proc(fileName: cstring) -> c.long --- // Get file modification time (last write time) + 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 + 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) + GetFileLength :: proc(fileName: cstring) -> c.int --- // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) + GetFileExtension :: proc(fileName: cstring) -> cstring --- // Get pointer to extension for a filename string (includes dot: '.png') + GetFileName :: proc(filePath: cstring) -> cstring --- // Get pointer to filename for a path string + GetFileNameWithoutExt :: proc(filePath: cstring) -> cstring --- // Get filename string without extension (uses static string) + 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) + 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 + LoadDirectoryFilesEx :: proc(basePath: cstring, filter: cstring, scanSubdirs: bool) -> FilePathList --- // Load directory filepaths with extension filtering and recursive directory scan + UnloadDirectoryFiles :: proc(files: FilePathList) --- // Unload filepaths + IsFileDropped :: proc() -> bool --- // Check if a file has been dropped into window + LoadDroppedFiles :: proc() -> FilePathList --- // Load dropped filepaths + UnloadDroppedFiles :: proc(files: FilePathList) --- // Unload dropped filepaths + 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) - 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 - LoadStorageValue :: proc(position: c.uint) -> c.int --- // Load integer value from storage file (from defined position) - - OpenURL :: proc(url: cstring) --- // Open URL with default system browser (if available) + // Compression/Encoding functionality + CompressData :: proc(data: rawptr, dataSize: c.int, compDataSize: ^c.int) -> [^]byte --- // Compress data (DEFLATE algorithm), memory must be MemFree() + DecompressData :: proc(compData: rawptr, compDataSize: c.int, dataSize: ^c.int) -> [^]byte --- // Decompress data (DEFLATE algorithm), memory must be MemFree() + 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() //------------------------------------------------------------------------------------ // Input Handling Functions (Module: core) @@ -1077,17 +1072,16 @@ foreign lib { GetCharPressed :: proc() -> rune --- // Get char pressed (unicode), call it multiple times for chars queued // Input-related functions: gamepads - IsGamepadAvailable :: proc(gamepad: c.int) -> bool --- // Detect if a gamepad is available - IsGamepadName :: proc(gamepad: c.int, name: cstring) -> bool --- // Check gamepad name (if available) - GetGamepadName :: proc(gamepad: c.int) -> cstring --- // Return gamepad internal name id - IsGamepadButtonPressed :: proc(gamepad: c.int, button: GamepadButton) -> bool --- // Detect if a gamepad button has been pressed once - IsGamepadButtonDown :: proc(gamepad: c.int, button: GamepadButton) -> bool --- // Detect if a gamepad button is being pressed - IsGamepadButtonReleased :: proc(gamepad: c.int, button: GamepadButton) -> bool --- // Detect if a gamepad button has been released once - IsGamepadButtonUp :: proc(gamepad: c.int, button: GamepadButton) -> bool --- // Detect if a gamepad button is NOT being pressed - GetGamepadButtonPressed :: proc() -> c.int --- // Get the last gamepad button pressed - GetGamepadAxisCount :: proc(gamepad: c.int) -> c.int --- // Return gamepad axis count for a gamepad - GetGamepadAxisMovement :: proc(gamepad: c.int, axis: GamepadAxis) -> f32 --- // Return axis movement value for a gamepad axis - SetGamepadMappings :: proc(mappings: cstring) -> c.int --- // Set internal gamepad mappings (SDL_GameControllerDB) + IsGamepadAvailable :: proc(gamepad: c.int) -> bool --- // Check if a gamepad is available + GetGamepadName :: proc(gamepad: c.int) -> cstring --- // Get gamepad internal name id + IsGamepadButtonPressed :: proc(gamepad: c.int, button: GamepadButton) -> bool --- // Check if a gamepad button has been pressed once + IsGamepadButtonDown :: proc(gamepad: c.int, button: GamepadButton) -> bool --- // Check if a gamepad button is being pressed + IsGamepadButtonReleased :: proc(gamepad: c.int, button: GamepadButton) -> bool --- // Check if a gamepad button has been released once + IsGamepadButtonUp :: proc(gamepad: c.int, button: GamepadButton) -> bool --- // Check if a gamepad button is NOT being pressed + GetGamepadButtonPressed :: proc() -> GamepadButton --- // Get the last gamepad button pressed + GetGamepadAxisCount :: proc(gamepad: c.int) -> c.int --- // Get gamepad axis count for a gamepad + GetGamepadAxisMovement :: proc(gamepad: c.int, axis: GamepadAxis) -> f32 --- // Get axis movement value for a gamepad axis + SetGamepadMappings :: proc(mappings: cstring) -> c.int --- // Set internal gamepad mappings (SDL_GameControllerDB) // Input-related functions: mouse IsMouseButtonPressed :: proc(button: MouseButton) -> bool --- // Detect if a mouse button has been pressed once @@ -1102,6 +1096,7 @@ foreign lib { SetMouseOffset :: proc(offsetX, offsetY: c.int) --- // Set mouse offset SetMouseScale :: proc(scaleX, scaleY: f32) --- // Set mouse scaling GetMouseWheelMove :: proc() -> f32 --- // Returns mouse wheel movement Y + GetMouseWheelMoveV :: proc() -> Vector2 --- // Get mouse wheel movement for both X and Y SetMouseCursor :: proc(cursor: MouseCursor) --- // Set mouse cursor // Input-related functions: touch @@ -1112,7 +1107,7 @@ foreign lib { GetTouchPointCount :: proc() -> c.int --- // Get number of touch points //------------------------------------------------------------------------------------ - // Gestures and Touch Handling Functions (Module: gestures) + // Gestures and Touch Handling Functions (Module: rgestures) //------------------------------------------------------------------------------------ SetGesturesEnabled :: proc(flags: Gestures) --- // Enable a set of gestures using flags IsGestureDetected :: proc(gesture: Gesture) -> bool --- // Check if a gesture have been detected @@ -1126,13 +1121,8 @@ foreign lib { //------------------------------------------------------------------------------------ // Camera System Functions (Module: camera) //------------------------------------------------------------------------------------ - SetCameraMode :: proc(camera: Camera, mode: CameraMode) --- // Set camera mode (multiple camera modes available) - UpdateCamera :: proc(camera: ^Camera) --- // Update camera position for selected mode - - SetCameraPanControl :: proc(keyPan: KeyboardKey) --- // Set camera pan key to combine with mouse movement (free camera) - SetCameraAltControl :: proc(keyAlt: KeyboardKey) --- // Set camera alt key to combine with mouse movement (free camera) - SetCameraSmoothZoomControl :: proc(keySmoothZoom: KeyboardKey) --- // Set camera smooth zoom key to combine with mouse (free camera) - SetCameraMoveControls :: proc(keyFront, keyBack, keyRight, keyLeft, keyUp, keyDown: KeyboardKey) --- // Set camera move controls (1st person and 3rd person cameras) + UpdateCamera :: proc(camera: ^Camera, mode: CameraMode) --- // Set camera mode (multiple camera modes available) + UpdateCameraPro :: proc(camera: ^Camera, movement: Vector3, rotation: Vector3, zoom: f32) --- // Update camera movement/rotation //------------------------------------------------------------------------------------ // Basic Shapes Drawing Functions (Module: shapes) @@ -1143,129 +1133,135 @@ foreign lib { SetShapesTexture :: proc(texture: Texture2D, source: Rectangle) --- // Basic shapes drawing functions - 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, 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 - 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: Color, 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 - DrawEllipse :: proc(centerX, centerY: c.int, radiusH: f32, radiusV: f32, color: Color) --- // Draw ellipse - DrawEllipseLines :: proc(centerX, centerY: c.int, radiusH: f32, radiusV: f32, color: Color) --- // Draw ellipse outline - DrawRing :: proc(center: Vector2, innerRadius, outerRadius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw ring - DrawRingLines :: proc(center: Vector2, innerRadius, outerRadius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw ring outline - DrawRectangle :: proc(posX, posY, width, height: c.int, color: Color) --- // Draw a color-filled rectangle - DrawRectangleV :: proc(position, size: Vector2, color: Color) --- // Draw a color-filled rectangle (Vector version) - DrawRectangleRec :: proc(rec: Rectangle, color: Color) --- // Draw a color-filled rectangle - DrawRectanglePro :: proc(rec: Rectangle, origin: Vector2, rotation: f32, color: Color) --- // Draw a color-filled rectangle with pro parameters - DrawRectangleGradientV :: proc(posX, posY, width, height: c.int, color1: Color, color2: Color) --- // Draw a vertical-gradient-filled rectangle - DrawRectangleGradientH :: proc(posX, posY, width, height: c.int, color1: Color, color2: Color) --- // Draw a horizontal-gradient-filled rectangle - DrawRectangleGradientEx :: proc(rec: Rectangle, col1, col2, col3, col4: Color) --- // Draw a gradient-filled rectangle with custom vertex colors - DrawRectangleLines :: proc(posX, posY, width, height: c.int, color: Color) --- // Draw rectangle outline - DrawRectangleLinesEx :: proc(rec: Rectangle, lineThick: f32, color: Color) --- // Draw rectangle outline with extended parameters - DrawRectangleRounded :: proc(rec: Rectangle, roundness: f32, segments: c.int, color: Color) --- // Draw rectangle with rounded edges - DrawRectangleRoundedLines :: proc(rec: Rectangle, roundness: f32, segments: c.int, lineThick: f32, color: Color) --- // Draw rectangle with rounded edges outline - DrawTriangle :: proc(v1, v2, v3: Vector2, color: Color) --- // Draw a color-filled triangle (vertex in counter-clockwise order!) - DrawTriangleLines :: proc(v1, v2, v3: Vector2, color: Color) --- // Draw triangle outline (vertex in counter-clockwise order!) - DrawTriangleFan :: proc(points: [^]Vector2, pointsCount: c.int, color: Color) --- // Draw a triangle fan defined by points (first vertex is the center) - 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 + 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 + 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 + 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 + DrawRingLines :: proc(center: Vector2, innerRadius, outerRadius: f32, startAngle, endAngle: f32, segments: c.int, color: Color) --- // Draw ring outline + DrawRectangle :: proc(posX, posY: c.int, width, height: c.int, color: Color) --- // Draw a color-filled rectangle + DrawRectangleV :: proc(position: Vector2, size: Vector2, color: Color) --- // Draw a color-filled rectangle (Vector version) + DrawRectangleRec :: proc(rec: Rectangle, color: Color) --- // Draw a color-filled rectangle + DrawRectanglePro :: proc(rec: Rectangle, origin: Vector2, rotation: f32, color: Color) --- // Draw a color-filled rectangle with pro parameters + DrawRectangleGradientV :: proc(posX, posY: c.int, width, height: c.int, color1, color2: Color) --- // Draw a vertical-gradient-filled rectangle + DrawRectangleGradientH :: proc(posX, posY: c.int, width, height: c.int, color1, color2: Color) --- // Draw a horizontal-gradient-filled rectangle + DrawRectangleGradientEx :: proc(rec: Rectangle, col1, col2, col3, col4: Color) --- // Draw a gradient-filled rectangle with custom vertex colors + DrawRectangleLines :: proc(posX, posY: c.int, width, height: c.int, color: Color) --- // Draw rectangle outline + DrawRectangleLinesEx :: proc(rec: Rectangle, lineThick: f32, color: Color) --- // Draw rectangle outline with extended parameters + DrawRectangleRounded :: proc(rec: Rectangle, roundness: f32, segments: c.int, color: Color) --- // Draw rectangle with rounded edges + DrawRectangleRoundedLines :: proc(rec: Rectangle, roundness: f32, segments: c.int, lineThick: f32, color: Color) --- // Draw rectangle with rounded edges outline + DrawTriangle :: proc(v1, v2, v3: Vector2, color: Color) --- // Draw a color-filled triangle (vertex in counter-clockwise order!) + DrawTriangleLines :: proc(v1, v2, v3: Vector2, color: Color) --- // Draw triangle outline (vertex in counter-clockwise order!) + DrawTriangleFan :: proc(points: [^]Vector2, pointCount: c.int, color: Color) --- // Draw a triangle fan defined by points (first vertex is the center) + DrawTriangleStrip :: proc(points: [^]Vector2, pointCount: 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 + CheckCollisionCircles :: proc(center1: Vector2, radius1: f32, center2: Vector2, radius2: f32) -> bool --- // Check collision between two circles + CheckCollisionCircleRec :: proc(center: Vector2, radius: f32, rec: Rectangle) -> bool --- // Check collision between circle and rectangle + CheckCollisionPointRec :: proc(point: Vector2, rec: Rectangle) -> bool --- // Check if point is inside rectangle + CheckCollisionPointCircle :: proc(point, center: Vector2, radius: f32) -> bool --- // Check if point is inside circle + CheckCollisionPointTriangle :: proc(point: Vector2, p1, p2, p3: Vector2) -> bool --- // Check if point is inside a triangle + CheckCollisionPointPoly :: proc(point: Vector2, points: [^]Vector2, pointCount: c.int) -> bool --- // Check if point is within a polygon described by array of vertices + 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: Vector2, 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 - // 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 - CheckCollisionCircleRec :: proc(center: Vector2, radius: f32, rec: Rectangle) -> bool --- // Check collision between circle and rectangle - CheckCollisionPointRec :: proc(point: Vector2, rec: Rectangle) -> bool --- // Check if point is inside rectangle - 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 - //------------------------------------------------------------------------------------ - // Texture Loading and Drawing Functions (Module: textures) - //------------------------------------------------------------------------------------ // Image loading functions - // NOTE: This functions do not require GPU access + // NOTE: These 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" + 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 + LoadImageFromScreen :: proc() -> Image --- // Load image from screen buffer and (screenshot) + 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 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 - 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 - GenImageCellular :: proc(width, height: c.int, tileSize: c.int) -> Image --- // Generate image: cellular algorithm. Bigger tileSize means bigger cells + 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 + 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 + GenImageText :: proc(width, height: c.int, text: cstring) -> Image --- // Generate image: grayscale image from text data // Image manipulation functions - ImageCopy :: proc(image: Image) -> Image --- // Create an image duplicate (useful for transformations) - ImageFromImage :: proc(image: Image, rec: Rectangle) -> Image --- // Create an image from another image piece - ImageText :: proc(text: cstring, fontSize: c.int, color: Color) -> Image --- // Create an image from text (default font) - ImageTextEx :: proc(font: Font, text: cstring, fontSize, spacing: f32, tint: Color) -> Image --- // Create an image from text (custom sprite font) - ImageFormat :: proc(image: ^Image, newFormat: PixelFormat) --- // Convert image data to desired format - ImageToPOT :: proc(image: ^Image, fill: Color) --- // Convert image to POT (power-of-two) - ImageCrop :: proc(image: ^Image, crop: Rectangle) --- // Crop an image to a defined rectangle - ImageAlphaCrop :: proc(image: ^Image, threshold: f32) --- // Crop image depending on alpha value - ImageAlphaClear :: proc(image: ^Image, color: Color, threshold: f32) --- // Clear alpha channel to desired color - ImageAlphaMask :: proc(image: ^Image, alphaMask: Image) --- // Apply alpha mask to image - ImageAlphaPremultiply :: proc(image: ^Image) --- // Premultiply alpha channel - ImageResize :: proc(image: ^Image, newWidth, newHeight: c.int) --- // Resize image (Bicubic scaling algorithm) - ImageResizeNN :: proc(image: ^Image, newWidth, newHeight: c.int) --- // Resize image (Nearest-Neighbor scaling algorithm) - ImageResizeCanvas :: proc(image: ^Image, newWidth, newHeight: c.int, offsetX, offsetY: c.int, fill: Color) --- // Resize canvas and fill with color - ImageMipmaps :: proc(image: ^Image) --- // Generate all mipmap levels for a provided image - 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 - 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 - ImageColorInvert :: proc(image: ^Image) --- // Modify image color: invert - ImageColorGrayscale :: proc(image: ^Image) --- // Modify image color: grayscale - ImageColorContrast :: proc(image: ^Image, contrast: f32) --- // Modify image color: contrast (-100 to 100) - ImageColorBrightness :: proc(image: ^Image, brightness: c.int) --- // Modify image color: brightness (-255 to 255) - ImageColorReplace :: proc(image: ^Image, color, replace: Color) --- // Modify image color: replace color - LoadImageColors :: proc(image: Image) -> [^]Color --- // Load color data from image as a Color array (RGBA - 32bit) - LoadImagePalette :: proc(image: Image, maxPaletteSize: c.int, colorsCount: [^]c.int) -> [^]Color --- // Load colors palette from image as a Color array (RGBA - 32bit) - 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 + ImageCopy :: proc(image: Image) -> Image --- // Create an image duplicate (useful for transformations) + ImageFromImage :: proc(image: Image, rec: Rectangle) -> Image --- // Create an image from another image piece + ImageText :: proc(text: cstring, fontSize: c.int, color: Color) -> Image --- // Create an image from text (default font) + ImageTextEx :: proc(font: Font, text: cstring, fontSize: f32, spacing: f32, tint: Color) -> Image --- // Create an image from text (custom sprite font) + ImageFormat :: proc(image: ^Image, newFormat: PixelFormat) --- // Convert image data to desired format + ImageToPOT :: proc(image: ^Image, fill: Color) --- // Convert image to POT (power-of-two) + ImageCrop :: proc(image: ^Image, crop: Rectangle) --- // Crop an image to a defined rectangle + ImageAlphaCrop :: proc(image: ^Image, threshold: f32) --- // Crop image depending on alpha value + ImageAlphaClear :: proc(image: ^Image, color: Color, threshold: f32) --- // Clear alpha channel to desired color + ImageAlphaMask :: proc(image: ^Image, alphaMask: Image) --- // Apply alpha mask to image + ImageAlphaPremultiply :: proc(image: ^Image) --- // Premultiply alpha channel + ImageBlurGaussian :: proc(image: ^Image, blurSize: c.int) --- // Apply Gaussian blur using a box blur approximation + ImageResize :: proc(image: ^Image, newWidth, newHeight: c.int) --- // Resize image (Bicubic scaling algorithm) + ImageResizeNN :: proc(image: ^Image, newWidth, newHeight: c.int) --- // Resize image (Nearest-Neighbor scaling algorithm) + ImageResizeCanvas :: proc(image: ^Image, newWidth, newHeight: c.int, offsetX, offsetY: c.int, fill: Color) --- // Resize canvas and fill with color + ImageMipmaps :: proc(image: ^Image) --- // Compute all mipmap levels for a provided image + 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 + 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 + ImageColorInvert :: proc(image: ^Image) --- // Modify image color: invert + ImageColorGrayscale :: proc(image: ^Image) --- // Modify image color: grayscale + ImageColorContrast :: proc(image: ^Image, contrast: f32) --- // Modify image color: contrast (-100 to 100) + ImageColorBrightness :: proc(image: ^Image, brightness: c.int) --- // Modify image color: brightness (-255 to 255) + ImageColorReplace :: proc(image: ^Image, color, replace: Color) --- // Modify image color: replace color + LoadImageColors :: proc(image: Image) -> [^]Color --- // Load color data from image as a Color array (RGBA - 32bit) + LoadImagePalette :: proc(image: Image, maxPaletteSize: c.int, colorCount: ^c.int) -> [^]Color --- // Load colors palette from image as a Color array (RGBA - 32bit) + 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) - ImageClearBackground :: proc(dst: ^Image, color: Color) --- // Clear image background with given color - ImageDrawPixel :: proc(dst: ^Image, posX, posY: c.int, color: Color) --- // Draw pixel within an image - ImageDrawPixelV :: proc(dst: ^Image, position: Vector2, color: Color) --- // Draw pixel within an image (Vector version) - ImageDrawLine :: proc(dst: ^Image, startPosX, startPosY, endPosX, endPosY: c.int, color: Color) --- // Draw line within an image - ImageDrawLineV :: proc(dst: ^Image, start, end: Vector2, color: Color) --- // Draw line within an image (Vector version) - ImageDrawCircle :: proc(dst: ^Image, centerX, centerY, radius: c.int, color: Color) --- // Draw circle within an image - ImageDrawCircleV :: proc(dst: ^Image, center: Vector2, radius: c.int, color: Color) --- // Draw circle within an image (Vector version) - ImageDrawRectangle :: proc(dst: ^Image, posX, posY, width, height: c.int, color: Color) --- // Draw rectangle within an image - ImageDrawRectangleV :: proc(dst: ^Image, position, size: Vector2, color: Color) --- // Draw rectangle within an image (Vector version) - ImageDrawRectangleRec :: proc(dst: ^Image, rec: Rectangle, color: Color) --- // Draw rectangle within an image - ImageDrawRectangleLines :: proc(dst: ^Image, rec: Rectangle, thick: c.int, color: Color) --- // Draw rectangle lines within an image - ImageDraw :: proc(dst: ^Image, src: Image, srcRec, dstRec: Rectangle, tint: Color) --- // Draw a source image within a destination image (tint applied to source) - ImageDrawText :: proc(dst: ^Image, text: cstring, posX, posY: c.int, fontSize: c.int, color: Color) --- // Draw text (using default font) within an image (destination) - ImageDrawTextEx :: proc(dst: ^Image, font: Font, text: cstring, position: Vector2, fontSize, spacing: f32, tint: Color) --- // Draw text (custom sprite font) within an image (destination) + ImageClearBackground :: proc(dst: ^Image, color: Color) --- // Clear image background with given color + ImageDrawPixel :: proc(dst: ^Image, posX, posY: c.int, color: Color) --- // Draw pixel within an image + ImageDrawPixelV :: proc(dst: ^Image, position: Vector2, color: Color) --- // Draw pixel within an image (Vector version) + ImageDrawLine :: proc(dst: ^Image, startPosX, startPosY, endPosX, endPosY: c.int, color: Color) --- // Draw line within an image + ImageDrawLineV :: proc(dst: ^Image, start, end: Vector2, color: Color) --- // Draw line within an image (Vector version) + ImageDrawCircle :: proc(dst: ^Image, centerX, centerY: c.int, radius: c.int, color: Color) --- // Draw a filled circle within an image + ImageDrawCircleV :: proc(dst: ^Image, center: Vector2, radius: c.int, color: Color) --- // Draw a filled circle within an image (Vector version) + ImageDrawCircleLines :: proc(dst: ^Image, centerX, centerY: c.int, radius: c.int, color: Color) --- // Draw circle outline within an image + ImageDrawCircleLinesV :: proc(dst: ^Image, center: Vector2, radius: c.int, color: Color) --- // Draw circle outline within an image (Vector version) + ImageDrawRectangle :: proc(dst: ^Image, posX, posY: c.int, width, height: c.int, color: Color) --- // Draw rectangle within an image + ImageDrawRectangleV :: proc(dst: ^Image, position, size: Vector2, color: Color) --- // Draw rectangle within an image (Vector version) + ImageDrawRectangleRec :: proc(dst: ^Image, rec: Rectangle, color: Color) --- // Draw rectangle within an image + ImageDrawRectangleLines :: proc(dst: ^Image, rec: Rectangle, thick: c.int, color: Color) --- // Draw rectangle lines within an image + ImageDraw :: proc(dst: ^Image, src: Image, srcRec, dstRec: Rectangle, tint: Color) --- // Draw a source image within a destination image (tint applied to source) + ImageDrawText :: proc(dst: ^Image, text: cstring, posX, posY: c.int, fontSize: c.int, color: Color) --- // Draw text (using default font) within an image (destination) + ImageDrawTextEx :: proc(dst: ^Image, font: Font, text: cstring, position: Vector2, fontSize: f32, spacing: f32, tint: Color) --- // Draw text (custom sprite font) within an image (destination) // Texture loading functions // NOTE: These functions require GPU access @@ -1273,236 +1269,246 @@ foreign lib { LoadTextureFromImage :: proc(image: Image) -> Texture2D --- // Load texture from image data LoadTextureCubemap :: proc(image: Image, layout: CubemapLayout) -> TextureCubemap --- // Load cubemap from image, multiple image cubemap layouts supported LoadRenderTexture :: proc(width, height: c.int) -> RenderTexture2D --- // Load texture for rendering (framebuffer) + IsTextureReady :: proc(texture: Texture2D) -> bool --- // Check if a texture is ready UnloadTexture :: proc(texture: Texture2D) --- // Unload texture from GPU memory (VRAM) + IsRenderTextureReady :: proc(target: RenderTexture2D) -> bool --- // Check if a render texture is ready 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 // Texture configuration functions - GenTextureMipmaps :: proc(texture: ^Texture2D) --- // Generate GPU mipmaps for a texture - SetTextureFilter :: proc(texture: Texture2D, filter: TextureFilter) --- // Set texture scaling filter mode - SetTextureWrap :: proc(texture: Texture2D, wrap: TextureWrap) --- // Set texture wrapping mode + GenTextureMipmaps :: proc(texture: ^Texture2D) --- // Generate GPU mipmaps for a texture + SetTextureFilter :: proc(texture: Texture2D, filter: TextureFilter) --- // Set texture scaling filter mode + SetTextureWrap :: proc(texture: Texture2D, wrap: TextureWrap) --- // Set texture wrapping mode - // Texture drawing functions - DrawTexture :: proc(texture: Texture2D, posX, posY: c.int, tint: Color) --- // Draw a Texture2D - DrawTextureV :: proc(texture: Texture2D, position: Vector2, tint: Color) --- // Draw a Texture2D with position defined as Vector2 - DrawTextureEx :: proc(texture: Texture2D, position: Vector2, rotation, scale: f32, tint: Color) --- // Draw a Texture2D with extended parameters - DrawTextureRec :: proc(texture: Texture2D, source: Rectangle, position: Vector2, tint: Color) --- // Draw a part of a texture defined by a rectangle - DrawTextureQuad :: proc(texture: Texture2D, tiling: Vector2, offset: Vector2, quad: Rectangle, tint: Color) --- // Draw texture quad with tiling and offset parameters - DrawTextureTiled :: proc(texture: Texture2D, source, dest: Rectangle, origin: Vector2, rotation, scale: f32, tint: Color) --- // Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest. - DrawTexturePro :: proc(texture: Texture2D, source, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color) --- // Draw a part of a texture defined by a rectangle with 'pro' parameters - DrawTextureNPatch :: proc(texture: Texture2D, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color) --- // Draws a texture (or part of it) that stretches or shrinks nicely - DrawTexturePoly :: proc(texture: Texture2D, center: Vector2, points: [^]Vector2, texcoords: [^]Vector2, pointsCount: c.int, tint: Color) --- // Draw a textured polygon + // Texture drawing functions + DrawTexture :: proc(texture: Texture2D, posX, posY: c.int, tint: Color) --- // Draw a Texture2D + DrawTextureV :: proc(texture: Texture2D, position: Vector2, tint: Color) --- // Draw a Texture2D with position defined as Vector2 + DrawTextureEx :: proc(texture: Texture2D, position: Vector2, rotation: f32, scale: f32, tint: Color) --- // Draw a Texture2D with extended parameters + DrawTextureRec :: proc(texture: Texture2D, source: Rectangle, position: Vector2, tint: Color) --- // Draw a part of a texture defined by a rectangle + DrawTexturePro :: proc(texture: Texture2D, source, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color) --- // Draw a part of a texture defined by a rectangle with 'pro' parameters + DrawTextureNPatch :: proc(texture: Texture2D, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: f32, tint: Color) --- // Draws a texture (or part of it) that stretches or shrinks nicely // Color/pixel related functions - Fade :: proc(color: Color, alpha: f32) -> Color --- // Returns color with alpha applied, alpha goes from 0.0f to 1.0f - ColorToInt :: proc(color: Color) -> c.int --- // Returns hexadecimal value for a Color - ColorNormalize :: proc(color: Color) -> Vector4 --- // Returns Color normalized as float [0..1] - ColorFromNormalized :: proc(normalized: Vector4) -> Color --- // Returns Color from normalized values [0..1] - ColorToHSV :: proc(color: Color) -> Vector3 --- // Returns HSV values for a Color, hue [0..360], saturation/value [0..1] - ColorFromHSV :: proc(hue, saturation, value: f32) -> Color --- // Returns a Color from HSV values, hue [0..360], saturation/value [0..1] - ColorAlpha :: proc(color: Color, alpha: f32) -> Color --- // Returns color with alpha applied, alpha goes from 0.0f to 1.0f - ColorAlphaBlend :: proc(dst, src, tint: Color) -> Color --- // Returns src alpha-blended into dst color with tint - GetColor :: proc(hexValue: c.int) -> Color --- // Get Color structure from hexadecimal value + Fade :: proc(color: Color, alpha: f32) -> Color --- // Get color with alpha applied, alpha goes from 0.0f to 1.0f + ColorToInt :: proc(color: Color) -> c.uint --- // Get hexadecimal value for a Color + ColorNormalize :: proc(color: Color) -> Vector4 --- // Get Color normalized as float [0..1] + ColorFromNormalized :: proc(normalized: Vector4) -> Color --- // Get Color from normalized values [0..1] + ColorToHSV :: proc(color: Color) -> Vector3 --- // Get HSV values for a Color, hue [0..360], saturation/value [0..1] + ColorFromHSV :: proc(hue, saturation, value: f32) -> Color --- // Get a Color from HSV values, hue [0..360], saturation/value [0..1] + ColorTint :: proc(color, tint: Color) -> Color --- // Get color multiplied with another color + ColorBrightness :: proc(color: Color, factor: f32) -> Color --- // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f + ColorContrast :: proc(color: Color, contrast: f32) -> Color --- // Get color with contrast correction, contrast values between -1.0f and 1.0f + ColorAlpha :: proc(color: Color, alpha: f32) -> Color --- // Get color with alpha applied, alpha goes from 0.0f to 1.0f + ColorAlphaBlend :: proc(dst, src, tint: Color) -> Color --- // Get src alpha-blended into dst color with tint + GetColor :: proc(hexValue: c.uint) -> Color --- // Get Color structure from hexadecimal value GetPixelColor :: proc(srcPtr: rawptr, format: PixelFormat) -> Color --- // Get Color from a source pixel pointer of certain format SetPixelColor :: proc(dstPtr: rawptr, color: Color, format: PixelFormat) --- // Set color formatted into destination pixel pointer GetPixelDataSize :: proc(width, height: c.int, format: PixelFormat) -> c.int --- // Get pixel data size in bytes for certain format + + + //------------------------------------------------------------------------------------ // Font Loading and Text Drawing Functions (Module: text) //------------------------------------------------------------------------------------ // 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, 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) -> [^]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) + 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 // 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) + 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) - // 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 - 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 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: c.int, spacing: c.int) -> 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) - 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!) + LoadUTF8 :: proc(codepoints: [^]rune, length: c.int) -> [^]byte --- // Load UTF-8 text encoded from codepoints array + UnloadUTF8 :: proc(text: [^]byte) --- // Unload UTF-8 text encoded from codepoints array + LoadCodepoints :: proc(text: rawptr, 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, codepointSize: ^c.int) -> rune --- // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + GetCodepointNext :: proc(text: cstring, codepointSize: ^c.int) -> rune --- // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + GetCodepointPrevious :: proc(text: cstring, codepointSize: ^c.int) -> rune --- // Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + CodepointToUTF8 :: proc(codepoint: rune, utf8Size: ^c.int) -> cstring --- // Encode one codepoint into UTF-8 byte array (array length returned as parameter) - - // Text strings management functions (no utf8 strings, only byte chars) + // Text strings management functions (no UTF-8 strings, only byte chars) // NOTE: Some strings allocate memory internally for returned strings, just be careful! - TextCopy :: proc(dst: [^]u8, src: cstring) -> c.int --- // Copy one string to another, returns bytes copied - TextIsEqual :: proc(text1, text2: cstring) -> bool --- // Check if two text string are equal - TextLength :: proc(text: cstring) -> c.uint --- // Get text length, checks for '\0' ending - TextSubtext :: proc(text: cstring, position: c.int, length: c.int) -> cstring --- // Get a piece of a text string - TextReplace :: proc(text: [^]byte, replace, by: cstring) -> cstring --- // Replace text string (memory must be freed!) - TextInsert :: proc(text, insert: cstring, position: c.int) -> cstring --- // Insert text in a position (memory must be freed!) - TextJoin :: proc(textList: [^]cstring, count: c.int, delimiter: cstring) -> cstring --- // Join text strings with delimiter - TextSplit :: proc(text: cstring, delimiter: byte, count: ^c.int) -> [^]cstring --- // Split text into multiple strings - TextAppend :: proc(text: [^]byte, append: cstring, position: ^c.int) --- // Append text at specific position and move cursor! - TextFindIndex :: proc(text: cstring, find: cstring) -> c.int --- // Find first text occurrence within a string - TextToUpper :: proc(text: cstring) -> cstring --- // Get upper case version of provided string - 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) + TextCopy :: proc(dst: [^]byte, src: cstring) -> c.int --- // Copy one string to another, returns bytes copied + TextIsEqual :: proc(text1, text2: cstring) -> bool --- // Check if two text string are equal + TextLength :: proc(text: cstring) -> c.uint --- // Get text length, checks for '\0' ending + // TextFormat is defined at the bottom of this file + TextSubtext :: proc(text: cstring, position: c.int, length: c.int) -> cstring --- // Get a piece of a text string + TextReplace :: proc(text: [^]byte, replace, by: cstring) -> [^]byte --- // Replace text string (WARNING: memory must be freed!) + TextInsert :: proc(text, insert: cstring, position: c.int) -> [^]byte --- // Insert text in a position (WARNING: memory must be freed!) + TextJoin :: proc(textList: [^]cstring, count: c.int, delimiter: cstring) -> cstring --- // Join text strings with delimiter + TextSplit :: proc(text: cstring, delimiter: byte, count: ^c.int) -> [^]cstring --- // Split text into multiple strings + TextAppend :: proc(text: [^]byte, append: cstring, position: ^c.int) --- // Append text at specific position and move cursor! + TextFindIndex :: proc(text, find: cstring) -> c.int --- // Find first text occurrence within a string + TextToUpper :: proc(text: cstring) -> cstring --- // Get upper case version of provided string + 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) + //------------------------------------------------------------------------------------ // 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 - 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)) + 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, pointCount: 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, size: Vector3, color: Color) --- // Draw cube wires (Vector version) + 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, 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 + DrawCapsule :: proc(startPos, endPos: Vector3, radius: f32, slices, rings: c.int, color: Color) --- // Draw a capsule with the center of its sphere caps at startPos and endPos + DrawCapsuleWires :: proc(startPos, endPos: Vector3, radius: f32, slices, rings: c.int, color: Color) --- // Draw capsule wireframe with the center of its sphere caps at startPos and 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)) //------------------------------------------------------------------------------------ // 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) - GetModelBoundingBox :: proc(model: Model) -> BoundingBox --- // Compute model bounding box limits (considers all meshes) + // Model management 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) + IsModelReady :: proc(model: Model) -> bool --- // Check if a model is ready + UnloadModel :: proc(model: Model) --- // Unload model (including meshes) from memory (RAM and/or VRAM) + GetModelBoundingBox :: proc(model: Model) -> BoundingBox --- // Compute model bounding box limits (considers all meshes) // 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 + 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, position: Vector3, size: f32, tint: Color) --- // Draw a billboard texture + DrawBillboardRec :: proc(camera: Camera, texture: Texture2D, source: Rectangle, position: Vector3, size: Vector2, tint: Color) --- // Draw a billboard texture defined by source + DrawBillboardPro :: proc(camera: Camera, texture: Texture2D, source: Rectangle, position: Vector3, up: Vector3, size: Vector2, 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) --- - + 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 + // 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 + GenMeshPoly :: proc(sides: c.int, radius: f32) -> Mesh --- // Generate polygonal mesh + GenMeshPlane :: proc(width, lengthL: 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, height: f32, slices: c.int) -> Mesh --- // Generate cylinder mesh + GenMeshCone :: proc(radius, height: f32, slices: c.int) -> Mesh --- // Generate cone/pyramid mesh + GenMeshTorus :: proc(radius, size: f32, radSeg, sides: c.int) -> Mesh --- // Generate torus mesh + GenMeshKnot :: proc(radius, size: f32, radSeg, 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 - LoadMaterialDefault :: proc() -> Material --- // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) - UnloadMaterial :: proc(material: Material) --- // Unload material from GPU memory (VRAM) - SetMaterialTexture :: proc(material: ^Material, mapType: MaterialMapIndex, texture: Texture2D) --- // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) - SetModelMeshMaterial :: proc(model: ^Model, meshId: c.int, materialId: c.int) --- // Set material for a mesh + LoadMaterials :: proc(fileName: cstring, materialCount: ^c.int) -> [^]Material --- // Load materials from model file + LoadMaterialDefault :: proc() -> Material --- // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps) + IsMaterialReady :: proc(material: Material) -> bool --- // Check if a material is ready + UnloadMaterial :: proc(material: Material) --- // Unload material from GPU memory (VRAM) + SetMaterialTexture :: proc(material: ^Material, mapType: MaterialMapIndex, texture: Texture2D) --- // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...) + SetModelMeshMaterial :: proc(model: ^Model, meshId: c.int, materialId: c.int) --- // Set material for a mesh // Model animations loading/unloading functions - LoadModelAnimations :: proc(fileName: cstring, animsCount: ^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 - IsModelAnimationValid :: proc(model: Model, anim: ModelAnimation) -> bool --- // Check model animation skeleton match - + LoadModelAnimations :: proc(fileName: cstring, animCount: ^c.uint) -> [^]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 + IsModelAnimationValid :: proc(model: Model, anim: ModelAnimation) -> bool --- // Check model animation skeleton match + // Collision detection functions 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 + 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 + 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) //------------------------------------------------------------------------------------ // Audio device management functions - InitAudioDevice :: proc() --- // Initialize audio device and context - 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) + InitAudioDevice :: proc() --- // Initialize audio device and context + 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) // Wave/Sound loading/unloading functions - LoadWave :: proc(fileName: cstring) -> Wave --- // Load wave data from file - LoadWaveFromMemory :: proc(fileType: cstring, fileData: rawptr, dataSize: c.int) -> Wave --- // Load wave from memory buffer, fileType refers to extension: i.e. ".wav" - LoadSound :: proc(fileName: cstring) -> Sound --- // Load sound from file - LoadSoundFromWave :: proc(wave: Wave) -> Sound --- // Load sound from wave data - UpdateSound :: proc(sound: Sound, data: rawptr, samplesCount: c.int) --- // Update sound buffer with new data - UnloadWave :: proc(wave: Wave) --- // Unload wave data - UnloadSound :: proc(sound: Sound) --- // Unload sound - 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 + LoadWave :: proc(fileName: cstring) -> Wave --- // Load wave data from file + LoadWaveFromMemory :: proc(fileType: cstring, fileData: rawptr, dataSize: c.int) -> Wave --- // Load wave from memory buffer, fileType refers to extension: i.e. '.wav' + 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 + 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 + UnloadWave :: proc(wave: Wave) --- // Unload wave data + UnloadSound :: proc(sound: Sound) --- // Unload sound + 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 // Wave/Sound management functions PlaySound :: proc(sound: Sound) --- // Play a sound StopSound :: proc(sound: Sound) --- // Stop playing a sound PauseSound :: proc(sound: Sound) --- // Pause a sound ResumeSound :: proc(sound: Sound) --- // Resume a paused sound - PlaySoundMulti :: proc(sound: Sound) --- // Play a sound (using multichannel buffer pool) - StopSoundMulti :: proc() --- // Stop any sound playing (using multichannel buffer pool) - GetSoundsPlaying :: proc() -> c.int --- // Get number of sounds playing in the multichannel IsSoundPlaying :: proc(sound: Sound) -> bool --- // Check if a sound is currently playing SetSoundVolume :: proc(sound: Sound, volume: f32) --- // Set volume for a sound (1.0 is max level) SetSoundPitch :: proc(sound: Sound, pitch: f32) --- // Set pitch for a sound (1.0 is base level) - WaveFormat :: proc(wave: ^Wave, sampleRate, sampleSize: c.int, channels: c.int) --- // Convert wave data to desired format + SetSoundPan :: proc(sound: Sound, pan: f32) --- // Set pan for a sound (0.5 is center) WaveCopy :: proc(wave: Wave) -> Wave --- // Copy a wave to a new wave WaveCrop :: proc(wave: ^Wave, initSample, finalSample: c.int) --- // Crop a wave to defined samples range - LoadWaveSamples :: proc(wave: Wave) -> [^]f32 --- // Load samples data from wave as a floats array + WaveFormat :: proc(wave: ^Wave, sampleRate, sampleSize: c.int, channels: c.int) --- // Convert wave data to desired format + 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 LoadMusicStreamFromMemory :: proc(fileType: cstring, data: rawptr, dataSize: c.int) -> Music --- // Load music stream from data + IsMusicReady :: proc(music: Music) -> bool --- // Checks if a music stream is ready UnloadMusicStream :: proc(music: Music) --- // Unload music stream PlayMusicStream :: proc(music: Music) --- // Start music playing IsMusicStreamPlaying :: proc(music: Music) -> bool --- // Check if music is playing @@ -1513,22 +1519,32 @@ foreign lib { 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) + SetMusicPan :: proc(music: Music, pan: f32) --- // Set pan for a music (0.5 is center) 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 - 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 + LoadAudioStream :: proc(sampleRate, sampleSize: c.uint, channels: c.uint) -> AudioStream --- // Load audio stream (to stream raw audio pcm data) + IsAudioStreamReady :: proc(stream: AudioStream) -> bool --- // Checks if an audio stream is ready + 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) + SetAudioStreamPan :: proc(stream: AudioStream, pan: f32) --- // Set pan for audio stream (0.5 is centered) + 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 + 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 + DetachAudioMixedProcessor :: proc(processor: AudioCallback) --- // Detach audio stream processor from the entire audio pipeline } @@ -1565,7 +1581,7 @@ MemAllocatorProc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode, old_memory: rawptr, old_size: int, location := #caller_location) -> (data: []byte, err: mem.Allocator_Error) { switch mode { case .Alloc, .Alloc_Non_Zeroed: - ptr := MemAlloc(c.int(size)) + ptr := MemAlloc(c.uint(size)) if ptr == nil { err = .Out_Of_Memory return @@ -1577,7 +1593,7 @@ MemAllocatorProc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode, return nil, nil case .Resize: - ptr := MemRealloc(old_memory, c.int(size)) + ptr := MemRealloc(old_memory, c.uint(size)) if ptr == nil { err = .Out_Of_Memory return diff --git a/vendor/raylib/rlgl.odin b/vendor/raylib/rlgl.odin index 7e7f2feea..5ef340e3f 100644 --- a/vendor/raylib/rlgl.odin +++ b/vendor/raylib/rlgl.odin @@ -1,10 +1,116 @@ +/********************************************************************************************** +* +* rlgl v4.5 - 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...) +* +* 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. +* +* 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(). +* +* +* 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 +* 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_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_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): +* +* #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 +* +* 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) +* +* DEPENDENCIES: +* +* - OpenGL libraries (depending on platform and OpenGL version selected) +* - GLAD OpenGL extensions loading library (only for OpenGL 3.3 Core, 4.3 Core) +* +* +* LICENSE: zlib/libpng +* +* Copyright (c) 2014-2023 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 "core:c" when ODIN_OS == .Windows { foreign import lib { - "raylib.lib", + "windows/raylib.lib", "system:Winmm.lib", "system:Gdi32.lib", "system:User32.lib", @@ -13,37 +119,51 @@ when ODIN_OS == .Windows { } else when ODIN_OS == .Linux { foreign import lib "linux/libraylib.a" } else when ODIN_OS == .Darwin { - foreign import lib "macos/libraylib.a" + when ODIN_ARCH == .arm64 { + foreign import lib { + "macos-arm64/libraylib.a", + "system:Cocoa.framework", + "system:OpenGL.framework", + "system:IOKit.framework", + } + } else { + foreign import lib { + "macos/libraylib.a", + "system:Cocoa.framework", + "system:OpenGL.framework", + "system:IOKit.framework", + } + } } else { foreign import lib "system:raylib" } -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 +RL_GRAPHICS_API_OPENGL_11 :: false +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 -when !GRAPHICS_API_OPENGL_ES2 { +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 - DEFAULT_BATCH_BUFFER_ELEMENTS :: 8192 + RL_DEFAULT_BATCH_BUFFER_ELEMENTS :: 8192 } else { // We reduce memory sizes for embedded systems (RPI and HTML5) // NOTE: On HTML5 (emscripten) this is allocated on heap, // by default it's only 16MB!...just take care... - DEFAULT_BATCH_BUFFER_ELEMENTS :: 2048 + RL_DEFAULT_BATCH_BUFFER_ELEMENTS :: 2048 } -DEFAULT_BATCH_BUFFERS :: 1 // Default number of batch buffers (multi-buffering) -DEFAULT_BATCH_DRAWCALLS :: 256 // Default number of batch draw calls (by state changes: mode, texture) -MAX_BATCH_ACTIVE_TEXTURES :: 4 // Maximum number of additional textures that can be activated on batch drawing (SetShaderValueTexture()) +RL_DEFAULT_BATCH_BUFFERS :: 1 // Default number of batch buffers (multi-buffering) +RL_DEFAULT_BATCH_DRAWCALLS :: 256 // Default number of batch draw calls (by state changes: mode, texture) +RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS :: 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 +RL_MAX_MATRIX_STACK_SIZE :: 32 // Maximum size of Matrix stack // Shader limits -MAX_SHADER_LOCATIONS :: 32 // Maximum number of shader locations supported +RL_MAX_SHADER_LOCATIONS :: 32 // Maximum number of shader locations supported // Projection matrix culling RL_CULL_DISTANCE_NEAR :: 0.01 // Default near cull distance @@ -98,87 +218,129 @@ RL_FRAGMENT_SHADER :: 0x8B30 // GL_FRAGMENT_SHADER RL_VERTEX_SHADER :: 0x8B31 // GL_VERTEX_SHADER RL_COMPUTE_SHADER :: 0x91B9 // GL_COMPUTE_SHADER +// GL blending factors +RL_ZERO :: 0 // GL_ZERO +RL_ONE :: 1 // GL_ONE +RL_SRC_COLOR :: 0x0300 // GL_SRC_COLOR +RL_ONE_MINUS_SRC_COLOR :: 0x0301 // GL_ONE_MINUS_SRC_COLOR +RL_SRC_ALPHA :: 0x0302 // GL_SRC_ALPHA +RL_ONE_MINUS_SRC_ALPHA :: 0x0303 // GL_ONE_MINUS_SRC_ALPHA +RL_DST_ALPHA :: 0x0304 // GL_DST_ALPHA +RL_ONE_MINUS_DST_ALPHA :: 0x0305 // GL_ONE_MINUS_DST_ALPHA +RL_DST_COLOR :: 0x0306 // GL_DST_COLOR +RL_ONE_MINUS_DST_COLOR :: 0x0307 // GL_ONE_MINUS_DST_COLOR +RL_SRC_ALPHA_SATURATE :: 0x0308 // GL_SRC_ALPHA_SATURATE +RL_CONSTANT_COLOR :: 0x8001 // GL_CONSTANT_COLOR +RL_ONE_MINUS_CONSTANT_COLOR :: 0x8002 // GL_ONE_MINUS_CONSTANT_COLOR +RL_CONSTANT_ALPHA :: 0x8003 // GL_CONSTANT_ALPHA +RL_ONE_MINUS_CONSTANT_ALPHA :: 0x8004 // GL_ONE_MINUS_CONSTANT_ALPHA + +// GL blending functions/equations +RL_FUNC_ADD :: 0x8006 // GL_FUNC_ADD +RL_MIN :: 0x8007 // GL_MIN +RL_MAX :: 0x8008 // GL_MAX +RL_FUNC_SUBTRACT :: 0x800A // GL_FUNC_SUBTRACT +RL_FUNC_REVERSE_SUBTRACT :: 0x800B // GL_FUNC_REVERSE_SUBTRACT +RL_BLEND_EQUATION :: 0x8009 // GL_BLEND_EQUATION +RL_BLEND_EQUATION_RGB :: 0x8009 // GL_BLEND_EQUATION_RGB // (Same as BLEND_EQUATION) +RL_BLEND_EQUATION_ALPHA :: 0x883D // GL_BLEND_EQUATION_ALPHA +RL_BLEND_DST_RGB :: 0x80C8 // GL_BLEND_DST_RGB +RL_BLEND_SRC_RGB :: 0x80C9 // GL_BLEND_SRC_RGB +RL_BLEND_DST_ALPHA :: 0x80CA // GL_BLEND_DST_ALPHA +RL_BLEND_SRC_ALPHA :: 0x80CB // GL_BLEND_SRC_ALPHA +RL_BLEND_COLOR :: 0x8005 // GL_BLEND_COLOR + //---------------------------------------------------------------------------------- // Types and Structures Definition //---------------------------------------------------------------------------------- -GlVersion :: enum c.int { OPENGL_11 = 1, OPENGL_21, OPENGL_33, OPENGL_ES_20 } -FramebufferAttachType :: enum c. int { - COLOR_CHANNEL0 = 0, - COLOR_CHANNEL1, - COLOR_CHANNEL2, - COLOR_CHANNEL3, - COLOR_CHANNEL4, - COLOR_CHANNEL5, - COLOR_CHANNEL6, - COLOR_CHANNEL7, - DEPTH = 100, - STENCIL = 200, -} -FramebufferAttachTextureType :: enum c.int { - CUBEMAP_POSITIVE_X = 0, - CUBEMAP_NEGATIVE_X, - CUBEMAP_POSITIVE_Y, - CUBEMAP_NEGATIVE_Y, - CUBEMAP_POSITIVE_Z, - CUBEMAP_NEGATIVE_Z, - TEXTURE2D = 100, - RENDERBUFFER = 200, -} - -VertexBufferIndexType :: c.ushort when GRAPHICS_API_OPENGL_ES2 else c.uint +VertexBufferIndexType :: c.ushort when RL_GRAPHICS_API_OPENGL_ES2 else c.uint // Dynamic vertex buffers (position + texcoords + colors + indices arrays) VertexBuffer :: struct { - elementsCount: c.int, // Number of elements in the buffer (QUADS) + elementCount: c.int, // Number of elements in the buffer (QUADS) - vCounter: c.int, // Vertex position counter to process (and draw) from full buffer - tcCounter: c.int, // Vertex texcoord counter to process (and draw) from full buffer - cCounter: c.int, // Vertex color counter to process (and draw) from full buffer - - vertices: [^]f32, // Vertex position (XYZ - 3 components per vertex) (shader-location = 0) - texcoords: [^]f32, // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) - colors: [^]u8, // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) - indices: [^]VertexBufferIndexType, // Vertex indices (in case vertex data comes indexed) (6 indices per quad) - vaoId: u32, // OpenGL Vertex Array Object id - vboId: [4]u32, // OpenGL Vertex Buffer Objects id (4 types of vertex data) -} + vertices: [^]f32, // Vertex position (XYZ - 3 components per vertex) (shader-location = 0) + texcoords: [^]f32, // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) + colors: [^]u8, // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) + indices: [^]VertexBufferIndexType, // Vertex indices (in case vertex data comes indexed) (6 indices per quad) + vaoId: c.uint, // OpenGL Vertex Array Object id + vboId: [4]c.uint, // OpenGL Vertex Buffer Objects id (4 types of vertex data) +} // Draw call type // NOTE: Only texture changes register a new draw, other state-change-related elements are not // used at this moment (vaoId, shaderId, matrices), raylib just forces a batch draw call if any // of those state-change happens (this is done in core module) DrawCall :: struct { - mode: c.int, // Drawing mode: LINES, TRIANGLES, QUADS - vertexCount: c.int, // Number of vertex of the draw - vertexAlignment: c.int, // Number of vertex required for index alignment (LINES, TRIANGLES) - //vaoId: u32, // Vertex array id to be used on the draw -> Using RLGL.currentBatch->vertexBuffer.vaoId - //shaderId: u32, // Shader id to be used on the draw -> Using RLGL.currentShader.id - textureId: u32, // Texture id to be used on the draw -> Use to create new draw call if changes - - //projection: Matrix, // Projection matrix for this draw -> Using RLGL.projection by default - //modelview: Matrix, // Modelview matrix for this draw -> Using RLGL.modelview by default -} + mode: c.int, // Drawing mode: LINES, TRIANGLES, QUADS + vertexCount: c.int, // Number of vertex of the draw + vertexAlignment: c.int, // Number of vertex required for index alignment (LINES, TRIANGLES) + textureId: c.uint, // Texture id to be used on the draw -> Use to create new draw call if changes +} // RenderBatch type RenderBatch :: struct { - buffersCount: c.int, // Number of vertex buffers (multi-buffering support) + bufferCount: c.int, // Number of vertex buffers (multi-buffering support) currentBuffer: c.int, // Current buffer tracking in case of multi-buffering vertexBuffer: [^]VertexBuffer, // Dynamic buffer(s) for vertex data - draws: [^]DrawCall, // Draw calls array, depends on textureId - drawsCounter: c.int, // Draw calls counter - currentDepth: f32, // Current depth value for next draw + draws: [^]DrawCall, // Draw calls array, depends on textureId + drawCounter: c.int, // Draw calls counter + currentDepth: f32, // Current depth value for next draw } + +// OpenGL version +GlVersion :: enum c.int { + OPENGL_11 = 1, // OpenGL 1.1 + OPENGL_21, // OpenGL 2.1 (GLSL 120) + OPENGL_33, // OpenGL 3.3 (GLSL 330) + OPENGL_43, // OpenGL 4.3 (using GLSL 330) + OPENGL_ES_20, // OpenGL ES 2.0 (GLSL 100) +} + + // Shader attribute data types ShaderAttributeDataType :: enum c.int { - FLOAT = 0, - VEC2, - VEC3, - VEC4, + FLOAT = 0, // Shader attribute type: float + VEC2, // Shader attribute type: vec2 (2 float) + VEC3, // Shader attribute type: vec3 (3 float) + VEC4, // Shader attribute type: vec4 (4 float) +} + +// Framebuffer attachment type +// 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 + DEPTH = 100, // Framebuffer attachment type: depth + STENCIL = 200, // Framebuffer attachment type: stencil +} + +// 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 + TEXTURE2D = 100, // Framebuffer texture attachment type: texture2d + RENDERBUFFER = 200, // Framebuffer texture attachment type: renderbuffer +} + +CullMode :: enum c.int { + FRONT = 0, + BACK, } @(default_calling_convention="c") @@ -219,38 +381,38 @@ foreign lib { //------------------------------------------------------------------------------------ // Vertex buffers state - rlEnableVertexArray :: proc(vaoId: u32) -> bool --- // Enable vertex array (VAO, if supported) - rlDisableVertexArray :: proc() --- // Disable vertex array (VAO, if supported) - rlEnableVertexBuffer :: proc(id: u32) --- // Enable vertex buffer (VBO) - rlDisableVertexBuffer :: proc() --- // Disable vertex buffer (VBO) - rlEnableVertexBufferElement :: proc(id: u32) --- // Enable vertex buffer element (VBO element) - rlDisableVertexBufferElement :: proc() --- // Disable vertex buffer element (VBO element) - rlEnableVertexAttribute :: proc(index: u32) --- // Enable vertex attribute index - rlDisableVertexAttribute :: proc(index: u32) --- // Disable vertex attribute index - when GRAPHICS_API_OPENGL_11 { + rlEnableVertexArray :: proc(vaoId: c.uint) -> bool --- // Enable vertex array (VAO, if supported) + rlDisableVertexArray :: proc() --- // Disable vertex array (VAO, if supported) + rlEnableVertexBuffer :: proc(id: c.uint) --- // Enable vertex buffer (VBO) + rlDisableVertexBuffer :: proc() --- // Disable vertex buffer (VBO) + rlEnableVertexBufferElement :: proc(id: c.uint) --- // Enable vertex buffer element (VBO element) + rlDisableVertexBufferElement :: proc() --- // Disable vertex buffer element (VBO element) + rlEnableVertexAttribute :: proc(index: c.uint) --- // Enable vertex attribute index + rlDisableVertexAttribute :: proc(index: c.uint) --- // Disable vertex attribute index + when RL_GRAPHICS_API_OPENGL_11 { rlEnableStatePointer :: proc(vertexAttribType: c.int, buffer: rawptr) --- rlDisableStatePointer :: proc(vertexAttribType: c.int) --- } // Textures state - rlActiveTextureSlot :: proc(slot: c.int) --- // Select and active a texture slot - rlEnableTexture :: proc(id: u32) --- // Enable texture - rlDisableTexture :: proc() --- // Disable texture - rlEnableTextureCubemap :: proc(id: u32) --- // Enable texture cubemap - rlDisableTextureCubemap :: proc() --- // Disable texture cubemap - rlTextureParameters :: proc(id: u32, param: c.int, value: c.int) --- // Set texture parameters (filter, wrap) + rlActiveTextureSlot :: proc(slot: c.int) --- // Select and active a texture slot + rlEnableTexture :: proc(id: c.uint) --- // Enable texture + rlDisableTexture :: proc() --- // Disable texture + rlEnableTextureCubemap :: proc(id: c.uint) --- // Enable texture cubemap + rlDisableTextureCubemap :: proc() --- // Disable texture cubemap + rlTextureParameters :: proc(id: c.uint, param: c.int, value: c.int) --- // Set texture parameters (filter, wrap) + rlCubemapParameters :: proc(id: i32, param: c.int, value: c.int) --- // Set cubemap parameters (filter, wrap) // Shader state - rlEnableShader :: proc(id: u32) --- // Enable shader program + rlEnableShader :: proc(id: c.uint) --- // Enable shader program rlDisableShader :: proc() --- // Disable shader program // Framebuffer state - rlEnableFramebuffer :: proc(id: u32) --- // Enable render texture (fbo) + 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 // General render state - rlEnableColorBlend :: proc() --- // Enable color blending rlDisableColorBlend :: proc() --- // Disable color blending rlEnableDepthTest :: proc() --- // Enable depth test rlDisableDepthTest :: proc() --- // Disable depth test @@ -258,6 +420,7 @@ foreign lib { rlDisableDepthMask :: proc() --- // Disable depth write rlEnableBackfaceCulling :: proc() --- // Enable backface culling rlDisableBackfaceCulling :: proc() --- // Disable backface culling + rlSetCullFace :: proc(mode: CullMode) --- // Set face culling mode rlEnableScissorTest :: proc() --- // Enable scissor test rlDisableScissorTest :: proc() --- // Disable scissor test rlScissor :: proc(x, y, width, height: c.int) --- // Scissor test @@ -271,102 +434,107 @@ foreign lib { 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) - rlCheckErrors :: proc() --- // Check and log OpenGL error codes - rlSetBlendMode :: proc(mode: c.int) --- // Set blending mode - rlSetBlendFactors :: proc(glSrcFactor, glDstFactor, glEquation: c.int) --- // Set blending mode factor and equation (using OpenGL factors) + + rlClearColor :: proc(r, g, b, a: u8) --- // Clear color buffer with color + rlClearScreenBuffers :: proc() --- // Clear used screen buffers (color and depth) + rlCheckErrors :: proc() --- // Check and log OpenGL error codes + rlSetBlendMode :: proc(mode: c.int) --- // Set blending mode + rlSetBlendFactors :: proc(glSrcFactor, glDstFactor, glEquation: c.int) --- // Set blending mode factor and equation (using OpenGL factors) + rlSetBlendFactorsSeparate :: proc(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha: c.int) --- // Set blending mode factors and equations separately (using OpenGL factors) //------------------------------------------------------------------------------------ // Functions Declaration - rlgl functionality //------------------------------------------------------------------------------------ // rlgl initialization functions - rlglInit :: proc(width, height: c.int) --- // Initialize rlgl (buffers, shaders, textures, states) - rlglClose :: proc() --- // De-inititialize rlgl (buffers, shaders, textures) - rlLoadExtensions :: proc(loader: rawptr) --- // Load OpenGL extensions (loader function pointer required) - rlGetVersion :: proc() -> GlVersion --- // Returns current OpenGL version - rlGetFramebufferWidth :: proc() -> c.int --- // Get default framebuffer width - rlGetFramebufferHeight :: proc() -> c.int --- // Get default framebuffer height + rlglInit :: proc(width, height: c.int) --- // Initialize rlgl (buffers, shaders, textures, states) + rlglClose :: proc() --- // De-initialize rlgl (buffers, shaders, textures) + rlLoadExtensions :: proc(loader: rawptr) --- // Load OpenGL extensions (loader function required) + rlGetVersion :: proc() -> GlVersion --- // Get current OpenGL version + rlSetFramebufferWidth :: proc(width: c.int) --- // Set current framebuffer width + rlGetFramebufferWidth :: proc() -> c.int --- // Get default framebuffer width + rlSetFramebufferHeight :: proc(height: c.int) --- // Set current framebuffer height + rlGetFramebufferHeight :: proc() -> c.int --- // Get default framebuffer height - rlGetTextureIdDefault :: proc() -> u32 --- // Get default texture id - rlGetShaderIdDefault :: proc() -> u32 --- // Get default shader id - rlGetShaderLocsDefault :: proc() -> [^]i32 --- // Get default shader locations + + rlGetTextureIdDefault :: proc() -> c.uint --- // Get default texture id + rlGetShaderIdDefault :: proc() -> c.uint --- // Get default shader id + rlGetShaderLocsDefault :: proc() -> [^]c.int --- // Get default shader locations // Render batch management // NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode // but this render batch API is exposed in case of custom batches are required - rlLoadRenderBatch :: proc(numBuffers, bufferElements: c.int) -> RenderBatch --- // Load a render batch system - rlUnloadRenderBatch :: proc(batch: RenderBatch) --- // Unload render batch system - rlDrawRenderBatch :: proc(batch: ^RenderBatch) --- // Draw render batch data (Update->Draw->Reset) - rlSetRenderBatchActive :: proc(batch: ^RenderBatch) --- // Set the active render batch for rlgl (NULL for default internal) - rlDrawRenderBatchActive :: proc() --- // Update and draw internal render batch - rlCheckRenderBatchLimit :: proc(vCount: c.int) -> bool --- // Check internal buffer overflow for a given number of vertex - rlSetTexture :: proc(id: u32) --- // Set current texture for render batch and check buffers limits + rlLoadRenderBatch :: proc(numBuffers, bufferElements: c.int) -> RenderBatch --- // Load a render batch system + rlUnloadRenderBatch :: proc(batch: RenderBatch) --- // Unload render batch system + rlDrawRenderBatch :: proc(batch: ^RenderBatch) --- // Draw render batch data (Update->Draw->Reset) + rlSetRenderBatchActive :: proc(batch: ^RenderBatch) --- // Set the active render batch for rlgl (NULL for default internal) + rlDrawRenderBatchActive :: proc() --- // Update and draw internal render batch + rlCheckRenderBatchLimit :: proc(vCount: c.int) -> c.int --- // Check internal buffer overflow for a given number of vertex + + rlSetTexture :: proc(id: c.uint) --- // Set current texture for render batch and check buffers limits //------------------------------------------------------------------------------------------------------------------------ // Vertex buffers management - rlLoadVertexArray :: proc() -> u32 --- // Load vertex array (vao) if supported - rlLoadVertexBuffer :: proc(buffer: rawptr, size: c.int, is_dynamic: bool) -> u32 --- // Load a vertex buffer attribute - rlLoadVertexBufferElement :: proc(buffer: rawptr, size: c.int, is_dynamic: bool) -> u32 --- // Load a new attributes element buffer - rlUpdateVertexBuffer :: proc(bufferId: c.int, data: rawptr, dataSize: c.int, offset: c.int) -> u32 --- // Update GPU buffer with new data - rlUnloadVertexArray :: proc(vaoId: u32) --- - rlUnloadVertexBuffer :: proc(vboId: u32) --- - rlSetVertexAttribute :: proc(index: u32, compSize: c.int, type: c.int, normalized: bool, stride: c.int, pointer: uintptr) --- - rlSetVertexAttributeDivisor :: proc(index: u32, divisor: c.int) --- - rlSetVertexAttributeDefault :: proc(locIndex: c.int, value: rawptr, attribType: c.int, count: c.int) --- // Set vertex attribute default value + rlLoadVertexArray :: proc() -> c.uint --- // Load vertex array (vao) if supported + rlLoadVertexBuffer :: proc(buffer: rawptr, size: c.int, is_dynamic: bool) -> c.uint --- // Load a vertex buffer attribute + rlLoadVertexBufferElement :: proc(buffer: rawptr, size: c.int, is_dynamic: bool) -> c.uint --- // Load a new attributes element buffer + rlUpdateVertexBuffer :: proc(bufferId: c.uint, data: rawptr, dataSize: c.int, offset: c.int) --- // Update GPU buffer with new data + rlUpdateVertexBufferElements :: proc(id: c.uint, data: rawptr, dataSize: c.int, offset: c.int) --- // Update vertex buffer elements with new data + rlUnloadVertexArray :: proc(vaoId: c.uint) --- + rlUnloadVertexBuffer :: proc(vboId: c.uint) --- + rlSetVertexAttribute :: proc(index: c.uint, compSize: c.int, type: c.int, normalized: bool, stride: c.int, pointer: rawptr) --- + rlSetVertexAttributeDivisor :: proc(index: c.uint, divisor: c.int) --- + rlSetVertexAttributeDefault :: proc(locIndex: c.int, value: rawptr, attribType: c.int, count: c.int) --- // Set vertex attribute default value rlDrawVertexArray :: proc(offset: c.int, count: c.int) --- rlDrawVertexArrayElements :: proc(offset: c.int, count: c.int, buffer: rawptr) --- rlDrawVertexArrayInstanced :: proc(offset: c.int, count: c.int, instances: c.int) --- rlDrawVertexArrayElementsInstanced :: proc(offset: c.int, count: c.int, buffer: rawptr, instances: c.int) --- // Textures management - rlLoadTexture :: proc(data: rawptr, width, height: c.int, format: c.int, mipmapCount: c.int) -> u32 --- // Load texture in GPU - rlLoadTextureDepth :: proc(width, height: c.int, useRenderBuffer: bool) -> u32 --- // Load depth texture/renderbuffer (to be attached to fbo) - 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 - rlReadScreenPixels :: proc(width, height: c.int) -> [^]u8 --- // Read screen pixel data (color buffer) + rlLoadTexture :: proc(data: rawptr, width, height: c.int, format: c.int, mipmapCount: c.int) -> c.uint --- // Load texture in GPU + rlLoadTextureDepth :: proc(width, height: c.int, useRenderBuffer: bool) -> c.uint --- // Load depth texture/renderbuffer (to be attached to fbo) + rlLoadTextureCubemap :: proc(data: rawptr, size: c.int, format: c.int) -> c.uint --- // Load texture cubemap + rlUpdateTexture :: proc(id: c.uint, offsetX, offsetY: c.int, width, height: c.int, format: c.int, data: rawptr) --- // Update GPU texture with new data + rlGetGlTextureFormats :: proc(format: c.int, glInternalFormat, glFormat, glType: ^c.uint) --- // Get OpenGL internal formats + rlGetPixelFormatName :: proc(format: c.uint) -> cstring --- // Get name string for pixel format + rlUnloadTexture :: proc(id: c.uint) --- // Unload texture from GPU memory + rlGenTextureMipmaps :: proc(id: c.uint, width, height: c.int, format: c.int, mipmaps: ^c.int) --- // Generate mipmap data for selected texture + rlReadTexturePixels :: proc(id: c.uint, width, height: c.int, format: c.int) -> rawptr --- // Read texture pixel data + rlReadScreenPixels :: proc(width, height: c.int) -> [^]byte --- // Read screen pixel data (color buffer) // Framebuffer management (fbo) - rlLoadFramebuffer :: proc(width, height: c.int) -> u32 --- // Load an empty framebuffer - rlFramebufferAttach :: proc(fboId: u32, texId: u32, attachType: c.int, texType: c.int, mipLevel: c.int) --- // Attach texture/renderbuffer to a framebuffer - rlFramebufferComplete :: proc(id: u32) -> bool --- // Verify framebuffer is complete - rlUnloadFramebuffer :: proc(id: u32) --- // Delete framebuffer from GPU + rlLoadFramebuffer :: proc(width, height: c.int) -> c.uint --- // Load an empty framebuffer + rlFramebufferAttach :: proc(fboId, texId: c.uint, attachType: c.int, texType: c.int, mipLevel: c.int) --- // Attach texture/renderbuffer to a framebuffer + rlFramebufferComplete :: proc(id: c.uint) -> bool --- // Verify framebuffer is complete + rlUnloadFramebuffer :: proc(id: c.uint) --- // Delete framebuffer from GPU // Shaders management - rlLoadShaderCode :: proc(vsCode, fsCode: cstring) -> u32 --- // Load shader from code strings - rlCompileShader :: proc(shaderCode: cstring, type: c.int) -> u32 --- // Compile custom shader and return shader id (type: GL_VERTEX_SHADER, GL_FRAGMENT_SHADER) - rlLoadShaderProgram :: proc(vShaderId, fShaderId: u32) -> u32 --- // Load custom shader program - rlUnloadShaderProgram :: proc(id: u32) --- // Unload shader program - rlGetLocationUniform :: proc(shaderId: u32, uniformName: cstring) -> c.int --- // Get shader location uniform - rlGetLocationAttrib :: proc(shaderId: u32, attribName: cstring) -> c.int --- // Get shader location attribute + rlLoadShaderCode :: proc(vsCode, fsCode: cstring) -> c.uint --- // Load shader from code strings + rlCompileShader :: proc(shaderCode: cstring, type: c.int) -> c.uint --- // Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER) + rlLoadShaderProgram :: proc(vShaderId, fShaderId: c.uint) -> c.uint --- // Load custom shader program + rlUnloadShaderProgram :: proc(id: c.uint) --- // Unload shader program + rlGetLocationUniform :: proc(shaderId: c.uint, uniformName: cstring) -> c.int --- // Get shader location uniform + rlGetLocationAttrib :: proc(shaderId: c.uint, attribName: cstring) -> c.int --- // Get shader location attribute rlSetUniform :: proc(locIndex: c.int, value: rawptr, uniformType: c.int, count: c.int) --- // Set shader value uniform rlSetUniformMatrix :: proc(locIndex: c.int, mat: Matrix) --- // Set shader value matrix - rlSetUniformSampler :: proc(locIndex: c.int, textureId: u32) --- // Set shader value sampler - rlSetShader :: proc(shader: Shader) --- // Set shader currently active + rlSetUniformSampler :: proc(locIndex: c.int, textureId: c.uint) --- // Set shader value sampler + rlSetShader :: proc(id: c.uint, locs: [^]c.int) --- // Set shader currently active (id and locations) // 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) + rlLoadComputeShaderProgram :: proc(shaderId: c.uint) -> c.uint --- // Load compute shader program + rlComputeShaderDispatch :: proc(groupX, groupY, groupZ: c.uint) --- // Dispatch compute shader (equivalent to *draw* for graphics pipeline) - // 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 + rlLoadShaderBuffer :: proc(size: c.uint, data: rawptr, usageHint: c.int) -> c.uint --- // Load shader storage buffer object (SSBO) + rlUnloadShaderBuffer :: proc(ssboId: c.uint) --- // Unload shader storage buffer object (SSBO) + rlUpdateShaderBuffer :: proc(id: c.uint, data: rawptr, dataSize: c.uint, offset: c.uint) --- // Update SSBO buffer data + rlBindShaderBuffer :: proc(id: c.uint, index: c.uint) --- // Bind SSBO buffer + rlReadShaderBuffer :: proc(id: c.uint, dest: rawptr, count: c.uint, offset: c.uint) --- // Read SSBO buffer data (GPU->CPU) + rlCopyShaderBuffer :: proc(destId, srcId: c.uint, destOffset, srcOffset: c.uint, count: c.uint) --- // Copy SSBO data between buffers + rlGetShaderBufferSize :: proc(id: c.uint) -> c.uint --- // Get SSBO buffer size // 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 - + rlBindImageTexture :: proc(id: c.uint, index: c.uint, format: c.int, readonly: bool) --- // Bind image texture // Matrix state management rlGetMatrixModelview :: proc() -> Matrix --- // Get internal modelview matrix diff --git a/vendor/raylib/windows/raylib.dll b/vendor/raylib/windows/raylib.dll new file mode 100644 index 000000000..df58566c0 Binary files /dev/null and b/vendor/raylib/windows/raylib.dll differ diff --git a/vendor/raylib/windows/raylib.lib b/vendor/raylib/windows/raylib.lib new file mode 100644 index 000000000..f42f4714a Binary files /dev/null and b/vendor/raylib/windows/raylib.lib differ diff --git a/vendor/raylib/windows/raylibdll.lib b/vendor/raylib/windows/raylibdll.lib new file mode 100644 index 000000000..d4546131e Binary files /dev/null and b/vendor/raylib/windows/raylibdll.lib differ