Raylib 2D/3D for BlitzmaxNG

Started by GW, February 06, 2020, 00:02:36

Previous topic - Next topic

GW

Update!
Brucey has implemented Raylib as a Blitzmax Module that is more complete than my version here. I recomend using that version instead.

Raylib https://www.raylib.com/ is an ultra-cross-platform game framework written in C.
Here is a basic library for BlitzmaxNG that binds to Raylib.
The best way to handle this would be import the C code directly, but NG doesn't like this. So unfortunately, this version is windows only and uses a DLL to access Raylib.

Not all functions we ported to BMax, but most of the 2d and 3d are.

the rotten forum software won't let me post the whole code so it's broken up over multiple posts.  ???

Raylib.bmx

SuperStrict
Framework brl.basic
Import pub.Win32

Import "extra.c"

Extern
    Function model_set_material(mdl:Model, tex:texture2D, Index:Int)
End Extern


Struct Vector2
    Field x:Float, y:Float
    Method New(_x:Float, _y:Float)
        x = _x
        y = _y
    End Method
EndStruct

Struct Vector3
    Field x:Float, y:Float, z:Float
    Method New(_x:Float, _y:Float, _z:Float)
        x = _x
        y = _y
        z = _z
    End Method
EndStruct

Struct Vector4
    Field x:Float, y:Float, z:Float, w:Float
EndStruct

Struct Quaternion
    Field x:Float, y:Float, z:Float, w:Float
EndStruct

Struct Camera2D
   Field offset:Vector2;         '// Camera offset (displacement from target)
   Field target:Vector2;         '// Camera target (rotation and zoom origin)
   Field Rotation:Float         '// Camera rotation in degrees
   Field zoom:Float
EndStruct

Struct Camera3D
   Field Position:Vector3       '// Camera position
   Field target:Vector3        '// Camera target it looks-at
   Field up:Vector3             '// Camera up vector (rotation over its axis)
   Field fovy:Float            '// Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
   Field _Type:Int
EndStruct

'Struct Camera    '' how to make alias
'   Field Position:Vector3       '// Camera position
'   Field target:Vector3        '// Camera target it looks-at
'   Field up:Vector3             '// Camera up vector (rotation over its axis)
'   Field fovy:Float            '// Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
'   Field _Type:Int
'EndStruct

Function MakeCamera:Camera3D(Pos:Float[], targ:Float[], up:Float[], fovy:Float, _Type:Int)
    Local c:Camera3D = New Camera3D
    c.Position.x = Pos[0]
    c.Position.y = Pos[1]
    c.Position.z = Pos[2]
   
    c.target.x = targ[0]
    c.target.y = targ[1]
    c.target.z = targ[2]
   
    c.up.x = up[0]
    c.up.y = up[1]
    c.up.z = up[2]
   
    c.fovy = fovy
    c._Type = _Type
    Return c
EndFunction

Struct Rectangle
   Field x:Float
   Field y:Float
   Field Width:Float
   Field Height:Float
   Method New(_x:Float, _y:Float, _w:Float, _h:Float)
      x = _x
    y = _y
    Width = _w
    Height = _h
   End Method
EndStruct

Struct Image
   Field Data:Byte ptr             '// Image raw data
   Field Width:Int             '// Image base width
   Field Height:Int            '// Image base height
   Field mipmaps:Int            '// Mipmap levels, 1 by default
   Field format:Int             '// Data format (PixelFormat type)
EndStruct

Struct Texture2D
    Field id:uint;        '// OpenGL texture id
    Field Width:Int              '// Texture base width
    Field Height:Int             '// Texture base height
    Field mipmaps:Int            '// Mipmap levels, 1 by default
    Field format:Int             '// Data format (PixelFormat type)
EndStruct

Struct Texture    ' ALIAS
    Field id:uint        '// OpenGL texture id
    Field Width:Int              '// Texture base width
    Field Height:Int             '// Texture base height
    Field mipmaps:Int            '// Mipmap levels, 1 by default
    Field format:Int             '// Data format (PixelFormat type)
EndStruct

Struct Mesh
   Field vertexCount:Int '/ / Number of Vertices stored in arrays
   Field triangleCount:Int; '/ / Number of triangles stored (indexed Or Not)

   '// Default vertex data
   Field Vertices:Float ptr;        '// Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
   Field texcoords:Float ptr       '// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
   Field texcoords2:Float ptr      '// Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
   Field normals:Float ptr         '// Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
   Field tangents:Float ptr        '// Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
   Field colors:Byte ptr  '// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
   Field indices:Short ptr'// Vertex indices (in case vertex data comes indexed)

   '// Animation vertex data
   Field animVertices:Float ptr    '// Animated vertex positions (after bones transformations)
   Field animNormals:Float ptr     '// Animated normals (after bones transformations)
   Field boneIds:Int ptr           '// Vertex bone ids, up to 4 bones influence by vertex (skinning)
   Field boneWeights:Float ptr     '// Vertex bone weight, up to 4 bones influence by vertex (skinning)

   '// OpenGL identifiers
   Field vaoId:uint     '// OpenGL Vertex Array Object id
   Field vboId:uint ptr    '// OpenGL Vertex Buffer Objects id (default vertex data)
EndStruct

Struct Material
    Field Shader:Byte ptr;          '// Material shader
    Field maps:MaterialMap ptr;      '// Material maps array (MAX_MATERIAL_MAPS)
    Field params:Float ptr;          '// Material generic parameters (if required)
EndStruct

Struct MaterialMap
    Field texture:Texture2D      '// Material map texture
    Field Colr:Color            '// Material map color
    Field value:Float            '// Material map value
EndStruct

Struct Matrix
   Field m0:Float, m4:Float, m8:Float, m12:Float
   Field m1:Float, m5:Float, m9:Float, m13:Float
   Field m2:Float, m6:Float, m10:Float, m14:Float
   Field m3:Float, m7:Float, m11:Float, m15:Float
EndStruct

Struct BoneInfo
   Field name:Byte[32]           '// Bone name
   Field parent:Int             '// Bone parent
EndStruct

Struct Transform
   Field Translation:Vector3;    '// Translation
   Field Rotation:Quaternion;    '// Rotation
   Field Scale:Vector3;          '// Scale
EndStruct

rem
Struct Model
   Matrix Transform;       '// Local transform matrix
   Int meshCount;          '// Number of meshes
   Mesh * meshes;           '// Meshes array
   Int materialCount;      '// Number of materials
   Material * materials;    '// Materials array
   Int * meshMaterial;      '// Mesh material number
   '// Animation Data
   Int boneCount;          '// Number of bones
   BoneInfo * bones;        '// Bones information (skeleton)
   Transform * bindPose;    '// Bones base transformation (pose)
EndStruct
endrem

Struct Model
   Field Transform:Matrix       '// Local transform matrix
   Field meshCount:Int          '// Number of meshes
   Field meshes:Byte ptr           '// Meshes array
   Field materialCount:Int      '// Number of materials
   Field materials:Material ptr    '// Materials array
   Field meshMaterial:Int ptr      '// Mesh material number
   '// Animation Data
   Field boneCount:Int          '// Number of bones
   Field bones:Byte ptr        '// Bones information (skeleton)
   Field bindPose:Byte ptr    '// Bones base transformation (pose)
EndStruct

Struct Ray
    Field Position:Vector3       '// Ray position (origin)
    Field Direction:Vector3      '// Ray direction
EndStruct

'// Raycast hit information
Struct RayHitInfo
    Field Hit:Int               '// Did the ray hit something?
    Field distance:Float         '// Distance to nearest hit
    Field Position:Vector3       '// Position of nearest hit
    Field Normal:Vector3        '// Surface normal of hit
EndStruct



Struct NPatchInfo
   Field sourceRec:Rectangle;   '// Region in the texture
   Field Left:Int              '// left border offset
   Field Top:Int              '// top border offset
   Field Right:Int            '// right border offset
   Field bottom:Int            '// bottom border offset
   Field _Type:Int
EndStruct

Struct CharInfo
   Field value:Int              '// Character value (Unicode)
   Field offsetX:Int            '// Character offset X when drawing
   Field offsetY:Int            '// Character offset Y when drawing
   Field advanceX:Int           '// Character advance position X
   Field image:image            '// Character image data
EndStruct

Struct Font
   Field baseSize:Int;           '// Base size (default chars height)
   Field charsCount:Int;         '// Number of characters
   Field texture:Texture2D;      '// Characters texture atlas
   Field recs:Rectangle        '// Characters rectangles in texture
   Field chars:Byte ptr 'CharInfo *       '// Characters info data
End Struct

Struct Wave
   Field sampleCount:UInt       '// Total number of samples
   Field sampleRate:UInt        '// Frequency (samples per second)
   Field sampleSize:UInt        '// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
   Field channels:UInt         '// Number of channels (1-mono, 2-stereo)
   Field Data:Byte ptr                     '// Buffer data pointer
EndStruct

Struct AudioStream
   Field sampleRate:UInt      '// Frequency (samples per second)
   Field sampleSize:UInt      '// Bit depth (bits per sample): 8, 16, 32 (24 Not supported)
   Field channels:UInt        '// Number of channels (1-mono, 2-stereo)
   Field audioBuffer:Byte Ptr '// Pointer To internal data used by the audio system.
   'Field format%              '// Audio format specifier
   'Field source%         '// Audio source id
   'Field buffers%[2]     '// Audio buffers (Double buffering)
EndStruct

Struct Music
   Field ctxType:Int;                    '// Type of music context (audio filetype)
   Field ctxData:Byte ptr;                  '// Audio context data, depends on type
   Field sampleCount:uint;               '// Total number of samples
   Field loopCount:uint;                 '// Loops count (times music will play), 0 means infinite loop
   Field stream:Byte ptr':AudioStream;             '// Audio stream
EndStruct


Struct Sound
   Field sampleCount:Uint;         '// Total number of samples
   Field _stream:AudioStream;     '// Audio stream
EndStruct

Struct Color
    Field r:Byte
    Field g:Byte
    Field b:Byte
    Field a:Byte
    Method New(_r:Byte, _g:Byte, _b:Byte, _a:Byte = 255)
        r = _r
        b = _b
        g = _g
        a = _a
    End Method
EndStruct


Enum TextureFilterMode
    FILTER_POINT = 0, '/ / No Filter, just pixel aproximation
    FILTER_BILINEAR,                '// Linear filtering
    FILTER_TRILINEAR,               '// Trilinear filtering (linear with mipmaps)
    FILTER_ANISOTROPIC_4X,          '// Anisotropic filtering 4x
    FILTER_ANISOTROPIC_8X,          '// Anisotropic filtering 8x
    FILTER_ANISOTROPIC_16X,         '// Anisotropic filtering 16x
EndEnum

Enum CameraMode
    CAMERA_CUSTOM = 0,
    CAMERA_FREE,
    CAMERA_ORBITAL,
    CAMERA_FIRST_PERSON,
    CAMERA_THIRD_PERSON
EndEnum


Type RL
    Global RLLIB:Byte ptr = LoadLibraryA("raylib.dll")

   
    Global initWindow(Width:Int, Height:Int, title$z) = GetProcAddress(RLLIB, "InitWindow")            'void InitWindow(int width, int height, const char *title);              // Initialize window and OpenGL context
    Global WindowShouldClose:int() = GetProcAddress(RLLIB, "WindowShouldClose")            'bool WindowShouldClose(void);                 // Check if KEY_ESCAPE pressed or Close icon pressed
    Global CloseWindow() = GetProcAddress(RLLIB, "CloseWindow")            'void CloseWindow(void);                       // Close window and unload OpenGL context
    Global IsWindowReady:int() = GetProcAddress(RLLIB, "IsWindowReady")            'bool IsWindowReady(void);                     // Check if window has been initialized successfully
    Global IsWindowMinimized:int() = GetProcAddress(RLLIB, "IsWindowMinimized")            'bool IsWindowMinimized(void);                 // Check if window has been minimized (or lost focus)
    Global IsWindowResized:int() = GetProcAddress(RLLIB, "IsWindowResized")            'bool IsWindowResized(void);                   // Check if window has been resized
    Global IsWindowHidden:int() = GetProcAddress(RLLIB, "IsWindowHidden")            'bool IsWindowHidden(void);                    // Check if window is currently hidden
    Global ToggleFullscreen() = GetProcAddress(RLLIB, "ToggleFullscreen")            'void ToggleFullscreen(void);                  // Toggle fullscreen mode (only PLATFORM_DESKTOP)
    Global UnhideWindow() = GetProcAddress(RLLIB, "UnhideWindow")            'void UnhideWindow(void);                      // Show the window
    Global HideWindow() = GetProcAddress(RLLIB, "HideWindow")            'void HideWindow(void);                        // Hide the window
    Global SetWindowIcon(image:Byte ptr) = GetProcAddress(RLLIB, "SetWindowIcon")            'void SetWindowIcon(Image image);              // Set icon for window (only PLATFORM_DESKTOP)
    Global SetWindowTitle(title$z) = GetProcAddress(RLLIB, "SetWindowTitle")            'void SetWindowTitle(const char *title);       // Set title for window (only PLATFORM_DESKTOP)
    Global SetWindowPosition(x:int, y:int) = GetProcAddress(RLLIB, "SetWindowPosition")            'void SetWindowPosition(int x, int y);         // Set window position on screen (only PLATFORM_DESKTOP)
    Global SetWindowMonitor(monitor:int) = GetProcAddress(RLLIB, "SetWindowMonitor")            'void SetWindowMonitor(int monitor);           // Set monitor for the current window (fullscreen mode)
    Global SetWindowMinSize(width:int, height:int) = GetProcAddress(RLLIB, "SetWindowMinSize")            'void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
    Global SetWindowSize(width:int, height:int) = GetProcAddress(RLLIB, "SetWindowSize")            'void SetWindowSize(int width, int height);    // Set window dimensions
    Global GetWindowHandle:Byte ptr() = GetProcAddress(RLLIB, "GetWindowHandle")            'void *GetWindowHandle(void);                  // Get native window handle
    Global GetScreenWidth:int() = GetProcAddress(RLLIB, "GetScreenWidth")            'int GetScreenWidth(void);                     // Get current screen width
    Global GetScreenHeight:int() = GetProcAddress(RLLIB, "GetScreenHeight")            'int GetScreenHeight(void);                    // Get current screen height
    Global GetMonitorCount:int() = GetProcAddress(RLLIB, "GetMonitorCount")            'int GetMonitorCount(void);                    // Get number of connected monitors
    Global GetMonitorWidth:int(monitor:int) = GetProcAddress(RLLIB, "GetMonitorWidth")            'int GetMonitorWidth(int monitor);             // Get primary monitor width
    Global GetMonitorHeight:int(monitor:int) = GetProcAddress(RLLIB, "GetMonitorHeight")            'int GetMonitorHeight(int monitor);            // Get primary monitor height
    Global GetMonitorPhysicalWidth:int(monitor:int) = GetProcAddress(RLLIB, "GetMonitorPhysicalWidth")            'int GetMonitorPhysicalWidth(int monitor);     // Get primary monitor physical width in millimetres
    Global GetMonitorPhysicalHeight:int(monitor:int) = GetProcAddress(RLLIB, "GetMonitorPhysicalHeight")            'int GetMonitorPhysicalHeight(int monitor);    // Get primary monitor physical height in millimetres
    Global GetWindowPosition:Vector2() = GetProcAddress(RLLIB, "GetWindowPosition")            'Vector2 GetWindowPosition(void);              // Get window position XY on monitor
    Global GetMonitorName$z(monitor:int) = GetProcAddress(RLLIB, "GetMonitorName")            'const char *GetMonitorName(int monitor);      // Get the human-readable, UTF-8 encoded name of the primary monitor
    Global GetClipboardText$z() = GetProcAddress(RLLIB, "GetClipboardText")            'const char *GetClipboardText(void);           // Get clipboard text content
    Global SetClipboardText(text$z) = GetProcAddress(RLLIB, "SetClipboardText")            'void SetClipboardText(const char *text);      // Set clipboard text content
   
                 '// Cursor-related functions       
    Global ShowCursor() = GetProcAddress(RLLIB, "ShowCursor")            'void ShowCursor(void);                        // Shows cursor
    Global HideCursor() = GetProcAddress(RLLIB, "HideCursor")            'void HideCursor(void);                        // Hides cursor
    Global IsCursorHidden:int() = GetProcAddress(RLLIB, "IsCursorHidden")            'bool IsCursorHidden(void);                    // Check if cursor is not visible
    Global EnableCursor() = GetProcAddress(RLLIB, "EnableCursor")            'void EnableCursor(void);                      // Enables cursor (unlock cursor)
    Global DisableCursor() = GetProcAddress(RLLIB, "DisableCursor")            'void DisableCursor(void);                     // Disables cursor (lock cursor)
                 '           
                 '// Drawing-related functions           
    Global ClearBackground(Color:Color) = GetProcAddress(RLLIB, "ClearBackground")            'void ClearBackground(Color color);            // Set background color (framebuffer clear color)
    Global BeginDrawing() = GetProcAddress(RLLIB, "BeginDrawing")            'void BeginDrawing(void);                      // Setup canvas (framebuffer) to start drawing
    Global EndDrawing() = GetProcAddress(RLLIB, "EndDrawing")            'void EndDrawing(void);                        // End canvas drawing and swap buffers (double buffering)
    Global BeginMode2D(camera:Camera2D) = GetProcAddress(RLLIB, "BeginMode2D")            'void BeginMode2D(Camera2D camera);            // Initialize 2D mode with custom camera (2D)
    Global EndMode2D() = GetProcAddress(RLLIB, "EndMode2D")            'void EndMode2D(void);                         // Ends 2D mode with custom camera
    Global BeginMode3D(camera:Camera3D) = GetProcAddress(RLLIB, "BeginMode3D")            'void BeginMode3D(Camera3D camera);            // Initializes 3D mode with custom camera (3D)
    Global EndMode3D() = GetProcAddress(RLLIB, "EndMode3D")            'void EndMode3D(void);                         // Ends 3D mode and returns to default 2D orthographic mode
    'Global BeginTextureMode(target:RenderTexture2D) = GetProcAddress(RLLIB, "BeginTextureMode")            'void BeginTextureMode(RenderTexture2D target);// Initializes render texture for drawing
    Global EndTextureMode() = GetProcAddress(RLLIB, "EndTextureMode")            'void EndTextureMode(void);                    // Ends drawing to render texture
    Global BeginScissorMode(x:int, y:int, width:int, height:int) = GetProcAddress(RLLIB, "BeginScissorMode")            'void BeginScissorMode(int x, int y, int width, int height);             // Begin scissor mode (define screen area for following drawing)
    Global EndScissorMode() = GetProcAddress(RLLIB, "EndScissorMode")            'void EndScissorMode(void);                    // End scissor mode
                 '           
                 '// Screen-space-related functions         
    'Global GetMouseRay:Ray(mousePosition:Vector2, camera:Camera) = GetProcAddress(RLLIB, "GetMouseRay")            'Ray GetMouseRay(Vector2 mousePosition, Camera camera);                  // Returns a ray trace from mouse position
    'Global GetCameraMatrix:Matrix(camera:Camera) = GetProcAddress(RLLIB, "GetCameraMatrix")            'Matrix GetCameraMatrix(Camera camera);        // Returns camera transform matrix (view matrix)
    'Global GetCameraMatrix2D:Matrix(camera:Camera2D) = GetProcAddress(RLLIB, "GetCameraMatrix2D")            'Matrix GetCameraMatrix2D(Camera2D camera);    // Returns camera 2d transform matrix
    'Global GetWorldToScreen:Vector2(position:Vector3, camera:Camera) = GetProcAddress(RLLIB, "GetWorldToScreen")            'Vector2 GetWorldToScreen(Vector3 position, Camera camera);              // Returns the screen space position for a 3d world space position
    'Global GetWorldToScreenEx:Vector2(position:Vector3, camera:Camera, width:int, height:int) = GetProcAddress(RLLIB, "GetWorldToScreenEx")            'Vector2 GetWorldToScreenEx(Vector3 position, Camera camera,int width, int height); // Returns size position for a 3d world space position
    'Global GetWorldToScreen2D:Vector2(position:Vector2, camera:Camera2D) = GetProcAddress(RLLIB, "GetWorldToScreen2D")            'Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera            ); // Returns the screen space position for a 2d camera world space position
    'Global GetScreenToWorld2D:Vector2(position:Vector2, camera:Camera2D) = GetProcAddress(RLLIB, "GetScreenToWorld2D")            'Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera            ); // Returns the world space position for a 2d camera screen space position
                 '           
                 '// Timing-related functions       
    Global SetTargetFPS(fps:int) = GetProcAddress(RLLIB, "SetTargetFPS")            'void SetTargetFPS(int fps);                   // Set target FPS (maximum)
    Global GetFPS:int() = GetProcAddress(RLLIB, "GetFPS")            'int GetFPS(void);   // Returns current FPS
    Global GetFrameTime:float() = GetProcAddress(RLLIB, "GetFrameTime")            'float GetFrameTime(void);                     // Returns time in seconds for last frame drawn
    Global GetTime:double() = GetProcAddress(RLLIB, "GetTime")            'double GetTime(void);                         // Returns elapsed time in seconds since InitWindow()
                 '           
                 '// Color-related functions         
    Global ColorToInt:Int(Color:Byte ptr) = GetProcAddress(RLLIB, "ColorToInt")            'int ColorToInt(Color color);                  // Returns hexadecimal value for a Color
    Global ColorNormalize:Vector4(Color:Byte ptr) = GetProcAddress(RLLIB, "ColorNormalize")            'Vector4 ColorNormalize(Color color);          // Returns color normalized as float [0..1]
    'Global ColorFromNormalized:Color(normalized:Vector4) = GetProcAddress(RLLIB, "ColorFromNormalized")            'Color ColorFromNormalized(Vector4 normalized);// Returns color from normalized values [0..1]
    'Global ColorToHSV:Vector3(color:Color) = GetProcAddress(RLLIB, "ColorToHSV")            'Vector3 ColorToHSV(Color color);              // Returns HSV values for a Color
    'Global ColorFromHSV:Color(hsv:Vector3) = GetProcAddress(RLLIB, "ColorFromHSV")            'Color ColorFromHSV(Vector3 hsv);              // Returns a Color from HSV values
    Global GetColor:Color(hexValue:int) = GetProcAddress(RLLIB, "GetColor")            'Color GetColor(int hexValue);                 // Returns a Color struct from hexadecimal value
    Global Fade:Color(color:Color, alpha:float) = GetProcAddress(RLLIB, "Fade")            'Color Fade(Color color, float alpha);         // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
                 '           
                 '// Misc. functions         
    Global SetConfigFlags(Flags:uint) = GetProcAddress(RLLIB, "SetConfigFlags")            'void SetConfigFlags(unsigned int flags);      // Setup window configuration flags (view FLAGS)
    Global SetTraceLogLevel(logType:int) = GetProcAddress(RLLIB, "SetTraceLogLevel")            'void SetTraceLogLevel(int logType);           // Set the current threshold (minimum) log level
    Global SetTraceLogExit(logType:int) = GetProcAddress(RLLIB, "SetTraceLogExit")            'void SetTraceLogExit(int logType);            // Set the exit threshold (minimum) log level
    'Global SetTraceLogCallback(callback:TraceLogCallback) = GetProcAddress(RLLIB, "SetTraceLogCallback")            'void SetTraceLogCallback(TraceLogCallback callback);                    // Set a trace log callback to enable custom logging
    Global TraceLog(logType:int, text$z) = GetProcAddress(RLLIB, "TraceLog")            'void TraceLog(int logType, const char *text, ...);                      // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
    Global TakeScreenshot(fileName$z) = GetProcAddress(RLLIB, "TakeScreenshot")            'void TakeScreenshot(const char *fileName);    // Takes a screenshot of current screen (saved a .png)
    Global GetRandomValue:int(min:int, max:int) = GetProcAddress(RLLIB, "GetRandomValue")            'int GetRandomValue(int min, int max);         // Returns a random value between min and max (both included)
                 '           
                 '// Files management functions         
    Global FileExists:int(fileName$z) = GetProcAddress(RLLIB, "FileExists")            'bool FileExists(const char *fileName);        // Check if file exists
    Global IsFileExtension:int(fileName$z, ext$z) = GetProcAddress(RLLIB, "IsFileExtension")            'bool IsFileExtension(const char *fileName, const char *ext);            // Check file extension
    Global DirectoryExists:int(dirPath$z) = GetProcAddress(RLLIB, "DirectoryExists")            'bool DirectoryExists(const char *dirPath);    // Check if a directory path exists
    Global GetExtension$z(fileName$z) = GetProcAddress(RLLIB, "GetExtension")            'const char *GetExtension(const char *fileName);                         // Get pointer to extension for a filename string
    Global GetFileName$z(filePath$z) = GetProcAddress(RLLIB, "GetFileName")            'const char *GetFileName(const char *filePath);// Get pointer to filename for a path string
    Global GetFileNameWithoutExt$z(filePath$z) = GetProcAddress(RLLIB, "GetFileNameWithoutExt")            'const char *GetFileNameWithoutExt(const char *filePath);                // Get filename string without extension (uses static string)
    Global GetDirectoryPath$z(filePath$z) = GetProcAddress(RLLIB, "GetDirectoryPath")            'const char *GetDirectoryPath(const char *filePath);                     // Get full path for a given fileName with path (uses static string)
    Global GetPrevDirectoryPath$z(dirPath$z) = GetProcAddress(RLLIB, "GetPrevDirectoryPath")            'const char *GetPrevDirectoryPath(const char *dirPath);                  // Get previous directory path for a given path (uses static string)
    Global GetWorkingDirectory$z() = GetProcAddress(RLLIB, "GetWorkingDirectory")            'const char *GetWorkingDirectory(void);        // Get current working directory (uses static string)
    'Global *GetDirectoryFiles$z(dirPath$z, count:int ptr) = GetProcAddress(RLLIB, "*GetDirectoryFiles")            'char **GetDirectoryFiles(const char *dirPath, int *count);              // Get filenames in a directory path (memory should be freed)
    Global ClearDirectoryFiles() = GetProcAddress(RLLIB, "ClearDirectoryFiles")            'void ClearDirectoryFiles(void);               // Clear directory files paths buffers (free memory)
    Global ChangeDirectory:int(dir$z) = GetProcAddress(RLLIB, "ChangeDirectory")            'bool ChangeDirectory(const char *dir);        // Change working directory, returns true if success
    Global IsFileDropped:int() = GetProcAddress(RLLIB, "IsFileDropped")            'bool IsFileDropped(void);                     // Check if a file has been dropped into window
    'Global *GetDroppedFiles$z(count:int ptr) = GetProcAddress(RLLIB, "*GetDroppedFiles")            'char **GetDroppedFiles(int *count);           // Get dropped files names (memory should be freed)
    Global ClearDroppedFiles() = GetProcAddress(RLLIB, "ClearDroppedFiles")            'void ClearDroppedFiles(void);                 // Clear dropped files paths buffer (free memory)
    Global GetFileModTime:long(fileName$z) = GetProcAddress(RLLIB, "GetFileModTime")            'long GetFileModTime(const char *fileName);    // Get file modification time (last write time)
                 '
    Global CompressData$z(Data$z, dataLength:Int, compDataLength:Int ptr) = GetProcAddress(RLLIB, "CompressData")            'unsigned char *CompressData(unsigned char *data, int dataLength, int *compDataLength);        // Compress data (DEFLATE algorythm)
    Global DecompressData$z(compData$z, compDataLength:Int, dataLength:Int ptr) = GetProcAddress(RLLIB, "DecompressData")            'unsigned char *DecompressData(unsigned char *compData, int compDataLength, int *dataLength);  // Decompress data (DEFLATE algorythm)
                 '
                 '// Persistent storage management
    Global StorageSaveValue(position:int, value:int) = GetProcAddress(RLLIB, "StorageSaveValue")            'void StorageSaveValue(int position, int value);                         // Save integer value to storage file (to defined position)
    Global StorageLoadValue:int(position:int) = GetProcAddress(RLLIB, "StorageLoadValue")            'int StorageLoadValue(int position);           // Load integer value from storage file (from defined position)
                 '
    Global OpenURL(url$z) = GetProcAddress(RLLIB, "OpenURL")            'void OpenURL(const char *url);                // Open URL with default system browser (if available)
                 '
       
    'Global DrawText(Text$z, posX:Int, posY:Int, FontSize:Int, Color:Byte ptr) = GetProcAddress(RLLIB, "DrawText")
               
   
            '//------------------------------------------------------------------------------------
             '// Input Handling Functions
             '//------------------------------------------------------------------------------------
             '
             '// Input-related functions: keyb
    Global IsKeyPressed:int(key:int) = GetProcAddress(RLLIB, "IsKeyPressed")            'bool IsKeyPressed(int key);                   // Detect if a key has been pressed once
    Global IsKeyDown:int(key:int) = GetProcAddress(RLLIB, "IsKeyDown")            'bool IsKeyDown(int key);                      // Detect if a key is being pressed
    Global IsKeyReleased:int(key:int) = GetProcAddress(RLLIB, "IsKeyReleased")            'bool IsKeyReleased(int key);                  // Detect if a key has been released once
    Global IsKeyUp:int(key:int) = GetProcAddress(RLLIB, "IsKeyUp")            'bool IsKeyUp(int key);                        // Detect if a key is NOT being pressed
    Global GetKeyPressed:int() = GetProcAddress(RLLIB, "GetKeyPressed")            'int GetKeyPressed(void);                      // Get latest key pressed
    Global SetExitKey(key:int) = GetProcAddress(RLLIB, "SetExitKey")            'void SetExitKey(int key);                     // Set a custom key to exit program (default is ESC)
                '           
                 '// Input-related functions: gamepads               
    Global IsGamepadAvailable:int(gamepad:int) = GetProcAddress(RLLIB, "IsGamepadAvailable")            'bool IsGamepadAvailable(int gamepad);         // Detect if a gamepad is available
    Global IsGamepadName:int(gamepad:int, name$z) = GetProcAddress(RLLIB, "IsGamepadName")            'bool IsGamepadName(int gamepad, const char *name);                      // Check gamepad name (if available)
    Global GetGamepadName$z(gamepad:int) = GetProcAddress(RLLIB, "GetGamepadName")            'const char *GetGamepadName(int gamepad);      // Return gamepad internal name id
    Global IsGamepadButtonPressed:int(gamepad:int, button:int) = GetProcAddress(RLLIB, "IsGamepadButtonPressed")            'bool IsGamepadButtonPressed(int gamepad, int button);                   // Detect if a gamepad button has been pressed once
    Global IsGamepadButtonDown:int(gamepad:int, button:int) = GetProcAddress(RLLIB, "IsGamepadButtonDown")            'bool IsGamepadButtonDown(int gamepad, int button);                      // Detect if a gamepad button is being pressed
    Global IsGamepadButtonReleased:int(gamepad:int, button:int) = GetProcAddress(RLLIB, "IsGamepadButtonReleased")            'bool IsGamepadButtonReleased(int gamepad, int button);                  // Detect if a gamepad button has been released once
    Global IsGamepadButtonUp:int(gamepad:int, button:int) = GetProcAddress(RLLIB, "IsGamepadButtonUp")            'bool IsGamepadButtonUp(int gamepad, int button);                        // Detect if a gamepad button is NOT being pressed
    Global GetGamepadButtonPressed:int() = GetProcAddress(RLLIB, "GetGamepadButtonPressed")            'int GetGamepadButtonPressed(void);            // Get the last gamepad button pressed
    Global GetGamepadAxisCount:int(gamepad:int) = GetProcAddress(RLLIB, "GetGamepadAxisCount")            'int GetGamepadAxisCount(int gamepad);         // Return gamepad axis count for a gamepad
    Global GetGamepadAxisMovement:float(gamepad:int, axis:int) = GetProcAddress(RLLIB, "GetGamepadAxisMovement")            'float GetGamepadAxisMovement(int gamepad, int axis);                    // Return axis movement value for a gamepad axis
                 '           
                 '// Input-related functions: mouse             
    Global IsMouseButtonPressed:int(button:int) = GetProcAddress(RLLIB, "IsMouseButtonPressed")            'bool IsMouseButtonPressed(int button);        // Detect if a mouse button has been pressed once
    Global IsMouseButtonDown:int(button:int) = GetProcAddress(RLLIB, "IsMouseButtonDown")            'bool IsMouseButtonDown(int button);           // Detect if a mouse button is being pressed
    Global IsMouseButtonReleased:int(button:int) = GetProcAddress(RLLIB, "IsMouseButtonReleased")            'bool IsMouseButtonReleased(int button);       // Detect if a mouse button has been released once
    Global IsMouseButtonUp:int(button:int) = GetProcAddress(RLLIB, "IsMouseButtonUp")            'bool IsMouseButtonUp(int button);             // Detect if a mouse button is NOT being pressed
    Global GetMouseX:int() = GetProcAddress(RLLIB, "GetMouseX")            'int GetMouseX(void);// Returns mouse position X
    Global GetMouseY:int() = GetProcAddress(RLLIB, "GetMouseY")            'int GetMouseY(void);// Returns mouse position Y
    Global GetMousePosition:Vector2() = GetProcAddress(RLLIB, "GetMousePosition")            'Vector2 GetMousePosition(void);               // Returns mouse position XY
    Global SetMousePosition(x:int, y:int) = GetProcAddress(RLLIB, "SetMousePosition")            'void SetMousePosition(int x, int y);          // Set mouse position XY
    Global SetMouseOffset(offsetX:int, offsetY:int) = GetProcAddress(RLLIB, "SetMouseOffset")            'void SetMouseOffset(int offsetX, int offsetY);// Set mouse offset
    Global SetMouseScale(scaleX:float, scaleY:float) = GetProcAddress(RLLIB, "SetMouseScale")            'void SetMouseScale(float scaleX, float scaleY);                         // Set mouse scaling
    Global GetMouseWheelMove:int() = GetProcAddress(RLLIB, "GetMouseWheelMove")            'int GetMouseWheelMove(void);                  // Returns mouse wheel movement Y
                 '
                 '// Input-related functions: touch             
    Global GetTouchX:int() = GetProcAddress(RLLIB, "GetTouchX")            'int GetTouchX(void);// Returns touch position X for touch point 0 (relative to screen size)
    Global GetTouchY:int() = GetProcAddress(RLLIB, "GetTouchY")            'int GetTouchY(void);// Returns touch position Y for touch point 0 (relative to screen size)
    Global GetTouchPosition:Vector2(index:int) = GetProcAddress(RLLIB, "GetTouchPosition")            'Vector2 GetTouchPosition(int index);          // Returns touch position XY for a touch point index (relative to screen size)
                 '
                 '//------------------------------------------------------------------------------------
                 '// Gestures and Touch Handling Functions (Module: gestures)
                 '//------------------------------------------------------------------------------------
    Global SetGesturesEnabled(gestureFlags:uint) = GetProcAddress(RLLIB, "SetGesturesEnabled")            'void SetGesturesEnabled(unsigned int gestureFlags);                     // Enable a set of gestures using flags
    Global IsGestureDetected:int(gesture:int) = GetProcAddress(RLLIB, "IsGestureDetected")            'bool IsGestureDetected(int gesture);          // Check if a gesture have been detected
    Global GetGestureDetected:int() = GetProcAddress(RLLIB, "GetGestureDetected")            'int GetGestureDetected(void);                 // Get latest detected gesture
    Global GetTouchPointsCount:int() = GetProcAddress(RLLIB, "GetTouchPointsCount")            'int GetTouchPointsCount(void);                // Get touch points count
    Global GetGestureHoldDuration:float() = GetProcAddress(RLLIB, "GetGestureHoldDuration")            'float GetGestureHoldDuration(void);           // Get gesture hold time in milliseconds
    Global GetGestureDragVector:Vector2() = GetProcAddress(RLLIB, "GetGestureDragVector")            'Vector2 GetGestureDragVector(void);           // Get gesture drag vector
    Global GetGestureDragAngle:float() = GetProcAddress(RLLIB, "GetGestureDragAngle")            'float GetGestureDragAngle(void);              // Get gesture drag angle
    Global GetGesturePinchVector:Vector2() = GetProcAddress(RLLIB, "GetGesturePinchVector")            'Vector2 GetGesturePinchVector(void);          // Get gesture pinch delta
    Global GetGesturePinchAngle:float() = GetProcAddress(RLLIB, "GetGesturePinchAngle")            'float GetGesturePinchAngle(void);             // Get gesture pinch angle
                 '
                 '//------------------------------------------------------------------------------------
                 '// Camera System Functions (Module: camera)
                 '//------------------------------------------------------------------------------------
    Global SetCameraMode(cam:camera3d, mode:CameraMode) = GetProcAddress(RLLIB, "SetCameraMode")            'void SetCameraMode(Camera camera, int mode);  // Set camera mode (multiple camera modes available)
    Global UpdateCamera(cam:camera3d) = GetProcAddress(RLLIB, "UpdateCamera")            'void UpdateCamera(Camera *camera);            // Update camera position for selected mode
                 '       
    Global SetCameraPanControl(panKey:int) = GetProcAddress(RLLIB, "SetCameraPanControl")            'void SetCameraPanControl(int panKey);         // Set camera pan key to combine with mouse movement (free camera)
    Global SetCameraAltControl(altKey:int) = GetProcAddress(RLLIB, "SetCameraAltControl")            'void SetCameraAltControl(int altKey);         // Set camera alt key to combine with mouse movement (free camera)
    Global SetCameraSmoothZoomControl(szKey:int) = GetProcAddress(RLLIB, "SetCameraSmoothZoomControl")            'void SetCameraSmoothZoomControl(int szKey); 
    Global SetCameraMoveControls(frontKey:int, backKey:int, rightKey:int, leftKey:int, upKey:int, downKey:int) = GetProcAddress(RLLIB, "SetCameraMoveControls")            'void SetCameraMoveControls(int frontKey, int backKey, int rightKey, int leftKey, int upKey, int downKey);                     // Set camera move controls (1st person and 3rd person cameras)
                 '
                 '
                 '
    Global DrawPixel(posX:int, posY:int, _color:Color) = GetProcAddress(RLLIB, "DrawPixel")            'void DrawPixel(int posX, int posY, Color color);// Draw a pixel
    Global DrawPixelV(position:Vector2, _color:Color) = GetProcAddress(RLLIB, "DrawPixelV")            'void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version)
    Global DrawLine(startPosX:int, startPosY:int, endPosX:int, endPosY:int, _color:Color) = GetProcAddress(RLLIB, "DrawLine")            'void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color);                 // Draw a line
    Global DrawLineV(startPos:Vector2, endPos:Vector2, _color:Color) = GetProcAddress(RLLIB, "DrawLineV")            'void DrawLineV(Vector2 startPos, Vector2 endPos, Color color);            // Draw a line (Vector version)
    Global DrawLineEx(startPos:Vector2, endPos:Vector2, thick:float, _color:Color) = GetProcAddress(RLLIB, "DrawLineEx")            'void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color);                        // Draw a line defining thickness
    Global DrawLineBezier(startPos:Vector2, endPos:Vector2, thick:float, _color:Color) = GetProcAddress(RLLIB, "DrawLineBezier")            'void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color);                    // Draw a line using cubic-bezier curves in-out
    Global DrawLineStrip(points:Vector2, numPoints:Int, _color:Color) = GetProcAddress(RLLIB, "DrawLineStrip")            'void DrawLineStrip(Vector2 *points, int numPoints, Color color);          // Draw lines sequence
    Global DrawCircle(centerX:int, centerY:int, radius:float, _color:Color) = GetProcAddress(RLLIB, "DrawCircle")            'void DrawCircle(int centerX, int centerY, float radius, Color color);     // Draw a color-filled circle
    Global DrawCircleSector(center:Vector2, radius:float, startAngle:int, endAngle:int, segments:int, _color:Color) = GetProcAddress(RLLIB, "DrawCircleSector")            'void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color);     // Draw a piece of a circle
    Global DrawCircleSectorLines(center:Vector2, radius:float, startAngle:int, endAngle:int, segments:int, _color:Color) = GetProcAddress(RLLIB, "DrawCircleSectorLines")            'void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color);    // Draw circle sector outline
    Global DrawCircleGradient(centerX:int, centerY:int, radius:float, color1:Color, color2:Color) = GetProcAddress(RLLIB, "DrawCircleGradient")            'void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2);        // Draw a gradient-filled circle
    Global DrawCircleV(center:Vector2, radius:float, _color:Color) = GetProcAddress(RLLIB, "DrawCircleV")            'void DrawCircleV(Vector2 center, float radius, Color color);              // Draw a color-filled circle (Vector version)
    Global DrawCircleLines(centerX:Int, centerY:Int, radius:Float, __color:Color) = GetProcAddress(RLLIB, "DrawCircleLines")            'void DrawCircleLines(int centerX, int centerY, float radius, Color color);// Draw circle outline
    Global DrawEllipse(centerX:int, centerY:int, radiusH:float, radiusV:float, _color:Color) = GetProcAddress(RLLIB, "DrawEllipse")            'void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color);              // Draw ellipse
    Global DrawEllipseLines(centerX:int, centerY:int, radiusH:float, radiusV:float, _color:Color) = GetProcAddress(RLLIB, "DrawEllipseLines")            'void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color);         // Draw ellipse outline
    Global DrawRing(center:Vector2, innerRadius:float, outerRadius:float, startAngle:int, endAngle:int, segments:int, _color:Color) = GetProcAddress(RLLIB, "DrawRing")            'void DrawRing(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color); // Draw ring
    Global DrawRingLines(center:Vector2, innerRadius:float, outerRadius:float, startAngle:int, endAngle:int, segments:int, _color:Color) = GetProcAddress(RLLIB, "DrawRingLines")            'void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color);    // Draw ring outline
    Global DrawRectangle(posX:int, posY:int, width:int, height:int, _color:Color) = GetProcAddress(RLLIB, "DrawRectangle")            'void DrawRectangle(int posX, int posY, int width, int height, Color color);                         // Draw a color-filled rectangle
    Global DrawRectangleV(Position:Vector2, Size:Vector2, __color:Color) = GetProcAddress(RLLIB, "DrawRectangleV")            'void DrawRectangleV(Vector2 position, Vector2 size, Color color);         // Draw a color-filled rectangle (Vector version)
    Global DrawRectangleRec(rec:Rectangle, _color:Color) = GetProcAddress(RLLIB, "DrawRectangleRec")            'void DrawRectangleRec(Rectangle rec, Color color);                        // Draw a color-filled rectangle
    Global DrawRectanglePro(rec:Rectangle, origin:Vector2, rotation:float, _color:Color) = GetProcAddress(RLLIB, "DrawRectanglePro")            'void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color);                  // Draw a color-filled rectangle with pro parameters
    Global DrawRectangleGradientV(posX:int, posY:int, width:int, height:int, color1:Color, color2:Color) = GetProcAddress(RLLIB, "DrawRectangleGradientV")            'void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a vertical-gradient-filled rectangle
    Global DrawRectangleGradientH(posX:int, posY:int, width:int, height:int, color1:Color, color2:Color) = GetProcAddress(RLLIB, "DrawRectangleGradientH")            'void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a horizontal-gradient-filled rectangle
    Global DrawRectangleGradientEx(rec:Rectangle, col1:Color, col2:Color, col3:Color, col4:Color) = GetProcAddress(RLLIB, "DrawRectangleGradientEx")            'void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4);        // Draw a gradient-filled rectangle with custom vertex colors
    Global DrawRectangleLines(posX:int, posY:int, width:int, height:int, _color:Color) = GetProcAddress(RLLIB, "DrawRectangleLines")            'void DrawRectangleLines(int posX, int posY, int width, int height, Color color);                    // Draw rectangle outline
    Global DrawRectangleLinesEx(rec:Rectangle, lineThick:int, _color:Color) = GetProcAddress(RLLIB, "DrawRectangleLinesEx")            'void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color);     // Draw rectangle outline with extended parameters
    Global DrawRectangleRounded(rec:Rectangle, roundness:float, segments:int, _color:Color) = GetProcAddress(RLLIB, "DrawRectangleRounded")            'void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color);               // Draw rectangle with rounded edges
    Global DrawRectangleRoundedLines(rec:Rectangle, roundness:float, segments:int, lineThick:int, _color:Color) = GetProcAddress(RLLIB, "DrawRectangleRoundedLines")            'void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color); // Draw rectangle with rounded edges outline
    Global DrawTriangle(v1:Vector2, v2:Vector2, v3:Vector2, _color:Color) = GetProcAddress(RLLIB, "DrawTriangle")            'void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color);       // Draw a color-filled triangle (vertex in counter-clockwise order!)
    Global DrawTriangleLines(v1:Vector2, v2:Vector2, v3:Vector2, _color:Color) = GetProcAddress(RLLIB, "DrawTriangleLines")            'void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color);  // Draw triangle outline (vertex in counter-clockwise order!)
    Global DrawTriangleFan(points:Vector2, numPoints:Int, _color:Color) = GetProcAddress(RLLIB, "DrawTriangleFan")            'void DrawTriangleFan(Vector2 *points, int numPoints, Color color);        // Draw a triangle fan defined by points (first vertex is the center)
    Global DrawTriangleStrip(points:Vector2, pointsCount:Int, _color:Color) = GetProcAddress(RLLIB, "DrawTriangleStrip")            'void DrawTriangleStrip(Vector2 *points, int pointsCount, Color color);    // Draw a triangle strip defined by points
    Global DrawPoly(center:Vector2, sides:int, radius:float, rotation:float, _color:Color) = GetProcAddress(RLLIB, "DrawPoly")            'void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color);                // Draw a regular polygon (Vector version)
    Global DrawPolyLines(center:Vector2, sides:int, radius:float, rotation:float, _color:Color) = GetProcAddress(RLLIB, "DrawPolyLines")            'void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color);           // Draw a polygon outline of n sides
                 '
                 '// Basic shapes collision detection functions
    Global CheckCollisionRecs:int(rec1:Rectangle, rec2:Rectangle) = GetProcAddress(RLLIB, "CheckCollisionRecs")            'bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2);                  // Check collision between two rectangles
    Global CheckCollisionCircles:int(center1:Vector2, radius1:float, center2:Vector2, radius2:float) = GetProcAddress(RLLIB, "CheckCollisionCircles")            'bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2);         // Check collision between two circles
    Global CheckCollisionCircleRec:int(center:Vector2, radius:float, rec:Rectangle) = GetProcAddress(RLLIB, "CheckCollisionCircleRec")            'bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);// Check collision between circle and rectangle
    Global GetCollisionRec:Rectangle(rec1:Rectangle, rec2:Rectangle) = GetProcAddress(RLLIB, "GetCollisionRec")            'Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2);                // Get collision rectangle for two rectangles collision
    Global CheckCollisionPointRec:int(point:Vector2, rec:Rectangle) = GetProcAddress(RLLIB, "CheckCollisionPointRec")            'bool CheckCollisionPointRec(Vector2 point, Rectangle rec);                // Check if point is inside rectangle
    Global CheckCollisionPointCircle:int(point:Vector2, center:Vector2, radius:float) = GetProcAddress(RLLIB, "CheckCollisionPointCircle")            'bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius);                        // Check if point is inside circle
    Global CheckCollisionPointTriangle:int(point:Vector2, p1:Vector2, p2:Vector2, p3:Vector2) = GetProcAddress(RLLIB, "CheckCollisionPointTriangle")            'bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3);                // Check if point is inside a triangle
                 '
                 '
                 '
    Global LoadImage:Image(fileName$z) = GetProcAddress(RLLIB, "LoadImage")            'Image LoadImage(const char *fileName);          // Load image from file into CPU memory (RAM)
    'Global LoadImageEx:Image(*pixels:Color, width:int, height:int) = GetProcAddress(RLLIB, "LoadImageEx")            'Image LoadImageEx(Color *pixels, int width, int height);                  // Load image from Color array data (RGBA - 32bit)
    Global LoadImagePro:Image(Data:Byte ptr, Width:Int, Height:Int, format:Int) = GetProcAddress(RLLIB, "LoadImagePro")            'Image LoadImagePro(void *data, int width, int height, int format);        // Load image from raw data with parameters
    Global LoadImageRaw:Image(fileName$z, width:int, height:int, format:int, headerSize:int) = GetProcAddress(RLLIB, "LoadImageRaw")            'Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize);        // Load image from RAW file data
    Global ExportImage(image:Image, fileName$z) = GetProcAddress(RLLIB, "ExportImage")            'void ExportImage(Image image, const char *fileName);                      // Export image data to file
    Global ExportImageAsCode(image:Image, fileName$z) = GetProcAddress(RLLIB, "ExportImageAsCode")            'void ExportImageAsCode(Image image, const char *fileName);                // Export image as code file defining an array of bytes
    Global LoadTexture:Texture2D(fileName$z) = GetProcAddress(RLLIB, "LoadTexture")            'Texture2D LoadTexture(const char *fileName);    // Load texture from file into GPU memory (VRAM)
    Global LoadTextureFromImage:Texture2D(image:Image) = GetProcAddress(RLLIB, "LoadTextureFromImage")            'Texture2D LoadTextureFromImage(Image image);    // Load texture from image data
    'Global LoadTextureCubemap:TextureCubemap(image:Image, layoutType:int) = GetProcAddress(RLLIB, "LoadTextureCubemap")            'TextureCubemap LoadTextureCubemap(Image image, int layoutType);           // Load cubemap from image, multiple image cubemap layouts supported
    'Global LoadRenderTexture:RenderTexture2D(width:int, height:int) = GetProcAddress(RLLIB, "LoadRenderTexture")            'RenderTexture2D LoadRenderTexture(int width, int height);                 // Load texture for rendering (framebuffer)
    Global UnloadImage(image:Image) = GetProcAddress(RLLIB, "UnloadImage")            'void UnloadImage(Image image);                  // Unload image from CPU memory (RAM)
    Global UnloadTexture(texture:Texture2D) = GetProcAddress(RLLIB, "UnloadTexture")            'void UnloadTexture(Texture2D texture);          // Unload texture from GPU memory (VRAM)
    'Global UnloadRenderTexture(target:RenderTexture2D) = GetProcAddress(RLLIB, "UnloadRenderTexture")            'void UnloadRenderTexture(RenderTexture2D target);                         // Unload render texture from GPU memory (VRAM)
    'Global *GetImageData:Color(image:Image) = GetProcAddress(RLLIB, "*GetImageData")            'Color *GetImageData(Image image);               // Get pixel data from image as a Color struct array
    'Global *GetImageDataNormalized:Vector4(image:Image) = GetProcAddress(RLLIB, "*GetImageDataNormalized")            'Vector4 *GetImageDataNormalized(Image image);   // Get pixel data from image as Vector4 array (float normalized)
    Global GetImageAlphaBorder:Rectangle(image:Image, threshold:float) = GetProcAddress(RLLIB, "GetImageAlphaBorder")            'Rectangle GetImageAlphaBorder(Image image, float threshold);              // Get image alpha border rectangle
    Global GetPixelDataSize:int(width:int, height:int, format:int) = GetProcAddress(RLLIB, "GetPixelDataSize")            'int GetPixelDataSize(int width, int height, int format);                  // Get pixel data size in bytes (image or texture)
    Global GetTextureData:Image(texture:Texture2D) = GetProcAddress(RLLIB, "GetTextureData")            'Image GetTextureData(Texture2D texture);        // Get pixel data from GPU texture and return an Image
    Global GetScreenData:Image() = GetProcAddress(RLLIB, "GetScreenData")            'Image GetScreenData(void);                      // Get pixel data from screen buffer and return an Image (screenshot)
    Global UpdateTexture(texture:Texture2D, Pixels:Byte ptr) = GetProcAddress(RLLIB, "UpdateTexture")            'void UpdateTexture(Texture2D texture, const void *pixels);                // Update GPU texture with new data
                 '                                                                                                   

GW

#1
Raylib.bmx part 2

rem             '// Image manipulation functions                    Global ImageCopy:Image(image:Image) = GetProcAddress(RLLIB, "ImageCopy")            'Image ImageCopy(Image image);                   // Create an image duplicate (useful for transformations)
    Global ImageFromImage:Image(image:Image, rec:Rectangle) = GetProcAddress(RLLIB, "ImageFromImage")            'Image ImageFromImage(Image image, Rectangle rec);                         // Create an image from another image piece
    'Global ImageToPOT(*image:Image, fillColor:Color) = GetProcAddress(RLLIB, "ImageToPOT")            'void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two)
    Global ImageFormat(*image:Image, newFormat:int) = GetProcAddress(RLLIB, "ImageFormat")            'void ImageFormat(Image *image, int newFormat);  // Convert image data to desired format
    Global ImageAlphaMask(*image:Image, alphaMask:Image) = GetProcAddress(RLLIB, "ImageAlphaMask")            'void ImageAlphaMask(Image *image, Image alphaMask);                       // Apply alpha mask to image
    Global ImageAlphaClear(*image:Image, _color:Color, threshold:float) = GetProcAddress(RLLIB, "ImageAlphaClear")            'void ImageAlphaClear(Image *image, Color color, float threshold);         // Clear alpha channel to desired color
    Global ImageAlphaCrop(*image:Image, threshold:float) = GetProcAddress(RLLIB, "ImageAlphaCrop")            'void ImageAlphaCrop(Image *image, float threshold);                       // Crop image depending on alpha value
    Global ImageAlphaPremultiply(*image:Image) = GetProcAddress(RLLIB, "ImageAlphaPremultiply")            'void ImageAlphaPremultiply(Image *image);       // Premultiply alpha channel
    Global ImageCrop(*image:Image, crop:Rectangle) = GetProcAddress(RLLIB, "ImageCrop")            'void ImageCrop(Image *image, Rectangle crop);   // Crop an image to a defined rectangle
    Global ImageResize(*image:Image, newWidth:int, newHeight:int) = GetProcAddress(RLLIB, "ImageResize")            'void ImageResize(Image *image, int newWidth, int newHeight);              // Resize image (Bicubic scaling algorithm)
    Global ImageResizeNN(*image:Image, newWidth:int, newHeight:int) = GetProcAddress(RLLIB, "ImageResizeNN")            'void ImageResizeNN(Image *image, int newWidth,int newHeight);             // Resize image (Nearest-Neighbor scaling algorithm)
    Global ImageResizeCanvas(*image:Image, newWidth:int, newHeight:int, offsetX:int, offsetY:int, _color:Color) = GetProcAddress(RLLIB, "ImageResizeCanvas")            'void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color color);  // Resize canvas and fill with color
    Global ImageMipmaps(*image:Image) = GetProcAddress(RLLIB, "ImageMipmaps")            'void ImageMipmaps(Image *image);                // Generate all mipmap levels for a provided image
    Global ImageDither(*image:Image, rBpp:int, gBpp:int, bBpp:int, aBpp:int) = GetProcAddress(RLLIB, "ImageDither")            'void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp);   // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
    Global *ImageExtractPalette:Color(image:Image, maxPaletteSize:int, extractCount:int_ptr) = GetProcAddress(RLLIB, "*ImageExtractPalette")            'Color *ImageExtractPalette(Image image, int maxPaletteSize, int *extractCount);                     // Extract color palette from image to maximum size (memory should be freed)
    Global ImageText:Image(text:stringz, fontSize:int, _color:Color) = GetProcAddress(RLLIB, "ImageText")            'Image ImageText(const char *text, int fontSize, Color color);             // Create an image from text (default font)
    Global ImageTextEx:Image(font:Font, text:stringz, fontSize:float, spacing:float, tint:Color) = GetProcAddress(RLLIB, "ImageTextEx")            'Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint);          // Create an image from text (custom sprite font)
    Global ImageDraw(*dst:Image, src:Image, srcRec:Rectangle, dstRec:Rectangle, tint:Color) = GetProcAddress(RLLIB, "ImageDraw")            'void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint);              // Draw a source image within a destination image (tint applied to source)
    Global ImageDrawRectangle(*dst:Image, rec:Rectangle, _color:Color) = GetProcAddress(RLLIB, "ImageDrawRectangle")            'void ImageDrawRectangle(Image *dst, Rectangle rec, Color color);          // Draw rectangle within an image
    Global ImageDrawRectangleLines(*dst:Image, rec:Rectangle, thick:int, _color:Color) = GetProcAddress(RLLIB, "ImageDrawRectangleLines")            'void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color);                    // Draw rectangle lines within an image
    Global ImageDrawText(*dst:Image, position:Vector2, text:stringz, fontSize:int, _color:Color) = GetProcAddress(RLLIB, "ImageDrawText")            'void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color);      // Draw text (default font) within an image (destination)
    Global ImageDrawTextEx(*dst:Image, position:Vector2, font:Font, text:stringz, fontSize:float, spacing:float, _color:Color) = GetProcAddress(RLLIB, "ImageDrawTextEx")            'void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color); // Draw text (custom sprite font) within an image (destination)
    Global ImageFlipVertical(*image:Image) = GetProcAddress(RLLIB, "ImageFlipVertical")            'void ImageFlipVertical(Image *image);           // Flip image vertically
    Global ImageFlipHorizontal(*image:Image) = GetProcAddress(RLLIB, "ImageFlipHorizontal")            'void ImageFlipHorizontal(Image *image);         // Flip image horizontally
    Global ImageRotateCW(*image:Image) = GetProcAddress(RLLIB, "ImageRotateCW")            'void ImageRotateCW(Image *image);               // Rotate image clockwise 90deg
    Global ImageRotateCCW(*image:Image) = GetProcAddress(RLLIB, "ImageRotateCCW")            'void ImageRotateCCW(Image *image);              // Rotate image counter-clockwise 90deg
    Global ImageColorTint(*image:Image, _color:Color) = GetProcAddress(RLLIB, "ImageColorTint")            'void ImageColorTint(Image *image, Color color); // Modify image color: tint
    Global ImageColorInvert(*image:Image) = GetProcAddress(RLLIB, "ImageColorInvert")            'void ImageColorInvert(Image *image);            // Modify image color: invert
    Global ImageColorGrayscale(*image:Image) = GetProcAddress(RLLIB, "ImageColorGrayscale")            'void ImageColorGrayscale(Image *image);         // Modify image color: grayscale
    Global ImageColorContrast(*image:Image, contrast:float) = GetProcAddress(RLLIB, "ImageColorContrast")            'void ImageColorContrast(Image *image, float contrast);                    // Modify image color: contrast (-100 to 100)
    Global ImageColorBrightness(*image:Image, brightness:int) = GetProcAddress(RLLIB, "ImageColorBrightness")            'void ImageColorBrightness(Image *image, int brightness);                  // Modify image color: brightness (-255 to 255)
    Global ImageColorReplace(*image:Image, _color:Color, replace:Color) = GetProcAddress(RLLIB, "ImageColorReplace")            'void ImageColorReplace(Image *image, Color color, Color replace);         // Modify image color: replace color
    endrem             '                                                                                                   
                 '// Image generation functions                 
    Global GenImageColor:Image(width:int, height:int, _color:Color) = GetProcAddress(RLLIB, "GenImageColor")            'Image GenImageColor(int width, int height, Color color);                  // Generate image: plain color
    Global GenImageGradientV:Image(width:int, height:int, top:Color, bottom:Color) = GetProcAddress(RLLIB, "GenImageGradientV")            'Image GenImageGradientV(int width, int height, Color top, Color bottom);  // Generate image: vertical gradient
    Global GenImageGradientH:Image(width:int, height:int, left:Color, right:Color) = GetProcAddress(RLLIB, "GenImageGradientH")            'Image GenImageGradientH(int width, int height, Color left, Color right);  // Generate image: horizontal gradient
    Global GenImageGradientRadial:Image(width:int, height:int, density:float, inner:Color, outer:Color) = GetProcAddress(RLLIB, "GenImageGradientRadial")            'Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer);       // Generate image: radial gradient
    Global GenImageChecked:Image(width:int, height:int, checksX:int, checksY:int, col1:Color, col2:Color) = GetProcAddress(RLLIB, "GenImageChecked")            'Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2);     // Generate image: checked
    Global GenImageWhiteNoise:Image(width:int, height:int, factor:float) = GetProcAddress(RLLIB, "GenImageWhiteNoise")            'Image GenImageWhiteNoise(int width, int height, float factor);            // Generate image: white noise
    Global GenImagePerlinNoise:Image(width:int, height:int, offsetX:int, offsetY:int, scale:float) = GetProcAddress(RLLIB, "GenImagePerlinNoise")            'Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale);            // Generate image: perlin noise
    Global GenImageCellular:Image(width:int, height:int, tileSize:int) = GetProcAddress(RLLIB, "GenImageCellular")            'Image GenImageCellular(int width, int height, int tileSize);              // Generate image: cellular algorithm. Bigger tileSize means bigger cells
                 '                                                                                                   
                 '// Texture2D configuration functions           
    Global GenTextureMipmaps(texture:Texture2D) = GetProcAddress(RLLIB, "GenTextureMipmaps")            'void GenTextureMipmaps(Texture2D *texture);     // Generate GPU mipmaps for a texture
    'Global SetTextureFilter(texture:Texture2D, filterMode:int) = GetProcAddress(RLLIB, "SetTextureFilter")            'void SetTextureFilter(Texture2D texture, int filterMode);                 // Set texture scaling filter mode
    'Global SetTextureWrap(texture:Texture2D, wrapMode:int) = GetProcAddress(RLLIB, "SetTextureWrap")            'void SetTextureWrap(Texture2D texture, int wrapMode);                     // Set texture wrapping mode
                 '                                                                                                   
                 '// Texture2D configuration functions           
    'Global GenTextureMipmaps(*texture:Texture2D) = GetProcAddress(RLLIB, "GenTextureMipmaps")            'void GenTextureMipmaps(Texture2D *texture);     // Generate GPU mipmaps for a texture
    Global SetTextureFilter(texture:Texture2D, filterMode:TextureFilterMode) = GetProcAddress(RLLIB, "SetTextureFilter")            'void SetTextureFilter(Texture2D texture, int filterMode);                 // Set texture scaling filter mode
    Global SetTextureWrap(texture:Texture2D, wrapMode:int) = GetProcAddress(RLLIB, "SetTextureWrap")            'void SetTextureWrap(Texture2D texture, int wrapMode);                     // Set texture wrapping mode
                 '                                                                                                   
                 '// Texture2D drawing functions                 
    Global DrawTexture(texture:Texture2D, posX:int, posY:int, tint:Color) = GetProcAddress(RLLIB, "DrawTexture")            'void DrawTexture(Texture2D texture, int posX, int posY, Color tint);      // Draw a Texture2D
    Global DrawTextureV(texture:Texture2D, position:Vector2, tint:Color) = GetProcAddress(RLLIB, "DrawTextureV")            'void DrawTextureV(Texture2D texture, Vector2 position, Color tint);       // Draw a Texture2D with position defined as Vector2
    Global DrawTextureEx(texture:Texture2D, position:Vector2, rotation:float, scale:float, tint:Color) = GetProcAddress(RLLIB, "DrawTextureEx")            'void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint);   // Draw a Texture2D with extended parameters
    Global DrawTextureRec(texture:Texture2D, sourceRec:Rectangle, position:Vector2, tint:Color) = GetProcAddress(RLLIB, "DrawTextureRec")            'void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint);          // Draw a part of a texture defined by a rectangle
    Global DrawTextureQuad(texture:Texture2D, tiling:Vector2, offset:Vector2, quad:Rectangle, tint:Color) = GetProcAddress(RLLIB, "DrawTextureQuad")            'void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint);  // Draw texture quad with tiling and offset parameters
    Global DrawTexturePro(texture:Texture2D, sourceRec:Rectangle, destRec:Rectangle, origin:Vector2, rotation:float, tint:Color) = GetProcAddress(RLLIB, "DrawTexturePro")            'void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint);       // Draw a part of a texture defined by a rectangle with 'pro' parameters
    Global DrawTextureNPatch(texture:Texture2D, nPatchInfo:NPatchInfo, destRec:Rectangle, origin:Vector2, rotation:float, tint:Color) = GetProcAddress(RLLIB, "DrawTextureNPatch")            'void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle destRec, Vector2 origin, float rotation, Color tint);  // Draws a texture (or part o
                 '
                 '
    Global GetFontDefault:Font() = GetProcAddress(RLLIB, "GetFontDefault")            'Font GetFontDefault(void);                    // Get the default Font
    Global LoadFont:Font(fileName$z) = GetProcAddress(RLLIB, "LoadFont")            'Font LoadFont(const char *fileName);          // Load font from file into GPU memory (VRAM)
    Global LoadFontEx:Font(fileName$z, fontSize:int, fontChars:int ptr, charsCount:int) = GetProcAddress(RLLIB, "LoadFontEx")            'Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount);              // Load font from file with extended parameters
    Global LoadFontFromImage:Font(image:Image, key:Color, firstChar:int) = GetProcAddress(RLLIB, "LoadFontFromImage")            'Font LoadFontFromImage(Image image, Color key, int firstChar);          // Load font from Image (XNA style)
    'Global *LoadFontData:CharInfo(fileName$z, fontSize:int, fontChars:int ptr, charsCount:int, type:int) = GetProcAddress(RLLIB, "*LoadFontData")            'CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type); // Load font data for further use
                 '//   Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod);  // Generate image font atlas using chars info
    Global UnloadFont(font:Font) = GetProcAddress(RLLIB, "UnloadFont")            'void UnloadFont(Font font);                   // Unload Font from GPU memory (VRAM)
                 '
                 '// Text drawing functions
    Global DrawFPS(posX:int, posY:int) = GetProcAddress(RLLIB, "DrawFPS")            'void DrawFPS(int posX, int posY);             // Shows current FPS
    Global DrawText(text$z, posX:int, posY:int, fontSize:int, _color:Color) = GetProcAddress(RLLIB, "DrawText")            'void DrawText(const char *text, int posX, int posY, int fontSize, Color color);                   // Draw text (using default font)
    Global DrawTextEx(_font:Font, Text$z, Position:Vector2, FontSize:Float, spacing:Float, tint:Color) = GetProcAddress(RLLIB, "DrawTextEx")            'void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint);                // Draw text using font and additional parameters
    Global DrawTextRec(_font:Font, Text$z, rec:Rectangle, FontSize:Float, spacing:Float, wordWrap:Int, tint:Color) = GetProcAddress(RLLIB, "DrawTextRec")            'void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint);   // Draw text using font inside rectangle limits
    Global DrawTextRecEx(_font:Font, Text$z, rec:Rectangle, FontSize:Float, spacing:Float, wordWrap:Int, tint:Color, selectStart:Int, selectLength:Int, selectTint:Color, selectBackTint:Color) = GetProcAddress(RLLIB, "DrawTextRecEx")            'void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint,
    'Global :int(selectStart:int, selectLength:int, selectTint:Color, selectBackTint:Color) = GetProcAddress(RLLIB, "")            '                int selectStart, int selectLength, Color selectTint, Color selectBackTint);       // Draw text using font inside rectangle limits with support for text selection
    Global DrawTextCodepoint(_font:Font, codepoint:Int, Position:Vector2, Scale:Float, tint:Color) = GetProcAddress(RLLIB, "DrawTextCodepoint")            'void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float scale, Color tint);      // Draw one character (codepoint)
                 '
                 '// Text misc. functions
    Global MeasureText:int(text$z, fontSize:int) = GetProcAddress(RLLIB, "MeasureText")            'int MeasureText(const char *text, int fontSize);                        // Measure string width for default font
    Global MeasureTextEx:Vector2(_font:Font, Text$z, FontSize:Float, spacing:Float) = GetProcAddress(RLLIB, "MeasureTextEx")            'Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing);                // Measure string size for Font
    Global GetGlyphIndex:Int(_font:Font, codepoint:Int) = GetProcAddress(RLLIB, "GetGlyphIndex")            'int GetGlyphIndex(Font font, int codepoint);  // Get index position for a unicode character on font
                 '
                 '// Text strings management functions (no utf8 strings, only byte chars)
                 '// NOTE: Some strings allocate memory internally for returned strings, just be careful!
    rem
    Global TextCopy:int(dst$z, src$z) = GetProcAddress(RLLIB, "TextCopy")            'int TextCopy(char *dst, const char *src);     // Copy one string to another, returns bytes copied
    Global TextIsEqual:int(text1$z, text2$z) = GetProcAddress(RLLIB, "TextIsEqual")            'bool TextIsEqual(const char *text1, const char *text2);                 // Check if two text string are equal
    Global TextLength:uint(text$z) = GetProcAddress(RLLIB, "TextLength")            'unsigned int TextLength(const char *text);    // Get text length, checks for '\0' ending
    Global TextFormat$z(text$z) = GetProcAddress(RLLIB, "TextFormat")            'const char *TextFormat(const char *text, ...);// Text formatting with variables (sprintf style)
    Global TextSubtext$z(text$z, position:int, length:int) = GetProcAddress(RLLIB, "TextSubtext")            'const char *TextSubtext(const char *text, int position, int length);    // Get a piece of a text string
    Global TextReplace$z(text$z, replace$z, by$z) = GetProcAddress(RLLIB, "TextReplace")            'char *TextReplace(char *text, const char *replace, const char *by);     // Replace text string (memory must be freed!)
    Global TextInsert$z(text$z, insert$z, position:int) = GetProcAddress(RLLIB, "TextInsert")            'char *TextInsert(const char *text, const char *insert, int position);   // Insert text in a position (memory must be freed!)
    'Global TextJoin$z(*textList$z, count:int, delimiter$z) = GetProcAddress(RLLIB, "TextJoin")            'const char *TextJoin(const char **textList, int count, const char *delimiter);                    // Join text strings with delimiter
    Global *TextSplit$z(text$z, delimiter:char, count:int_ptr) = GetProcAddress(RLLIB, "*TextSplit")            'const char **TextSplit(const char *text, char delimiter, int *count);   // Split text into multiple strings
    Global TextAppend(text$z, append$z, position:int_ptr) = GetProcAddress(RLLIB, "TextAppend")            'void TextAppend(char *text, const char *append, int *position);         // Append text at specific position and move cursor!
    Global TextFindIndex:int(text$z, find$z) = GetProcAddress(RLLIB, "TextFindIndex")            'int TextFindIndex(const char *text, const char *find);                  // Find first text occurrence within a string
    Global TextToUpper$z(text$z) = GetProcAddress(RLLIB, "TextToUpper")            'const char *TextToUpper(const char *text);    // Get upper case version of provided string
    Global TextToLower$z(text$z) = GetProcAddress(RLLIB, "TextToLower")            'const char *TextToLower(const char *text);    // Get lower case version of provided string
    Global TextToPascal$z(text$z) = GetProcAddress(RLLIB, "TextToPascal")            'const char *TextToPascal(const char *text);   // Get Pascal case notation version of provided string
    Global TextToInteger:int(text$z) = GetProcAddress(RLLIB, "TextToInteger")            'int TextToInteger(const char *text);          // Get integer value from text (negative values not supported)
    Global TextToUtf8$z(codepoints:int_ptr, length:int) = GetProcAddress(RLLIB, "TextToUtf8")            'char *TextToUtf8(int *codepoints, int length);// Encode text codepoint into utf8 text (memory must be freed!)
     endrem
                 '                                                                                                 
                 '// UTF8 text strings management functions   
    Global GetCodepoints:int ptr(text$z, count:int ptr) = GetProcAddress(RLLIB, "GetCodepoints")            'int *GetCodepoints(const char *text, int *count);                       // Get all codepoints in a string, codepoints count returned by parameters
    Global GetCodepointsCount:int(text$z) = GetProcAddress(RLLIB, "GetCodepointsCount")            'int GetCodepointsCount(const char *text);     // Get total number of characters (codepoints) in a UTF8 encoded string
    Global GetNextCodepoint:int(text$z, bytesProcessed:int ptr) = GetProcAddress(RLLIB, "GetNextCodepoint")            'int GetNextCodepoint(const char *text, int *bytesProcessed);            // Returns next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure
    Global CodepointToUtf8$z(codepoint:int, byteLength:int ptr) = GetProcAddress(RLLIB, "CodepointToUtf8")            'const char *CodepointToUtf8(int codepoint, int *byteLength);            // Encode codepoint into utf8 text (char array length returned as parameter)
                 '
   
                 '// Audio device management functions
    Global InitAudioDevice() = GetProcAddress(RLLIB, "InitAudioDevice")            'void InitAudioDevice(void); // Initialize audio device and context
    Global CloseAudioDevice() = GetProcAddress(RLLIB, "CloseAudioDevice")            'void CloseAudioDevice(void);// Close the audio device and context (and music stream)
    Global IsAudioDeviceReady:int() = GetProcAddress(RLLIB, "IsAudioDeviceReady")            'bool IsAudioDeviceReady(void);                        // Check if audio device is ready
    Global SetMasterVolume(volume:float) = GetProcAddress(RLLIB, "SetMasterVolume")            'void SetMasterVolume(float volume);                   // Set master volume (listener)
                 '
                 '// Wave/Sound loading/unloading functions
    Global LoadWave:Wave(fileName$z) = GetProcAddress(RLLIB, "LoadWave")            'Wave LoadWave(const char *fileName);                  // Load wave data from file
    Global LoadWaveEx:Wave(Data:Byte ptr, sampleCount:Int, sampleRate:Int, sampleSize:Int, channels:Int) = GetProcAddress(RLLIB, "LoadWaveEx")            'Wave LoadWaveEx(void *data, int sampleCount, int sampleRate, int sampleSize, int channels); // Load wave data from raw array data
    Global LoadSound:Sound(fileName$z) = GetProcAddress(RLLIB, "LoadSound")            'Sound LoadSound(const char *fileName);                // Load sound from file
    Global LoadSoundFromWave:Sound(_wave:Wave) = GetProcAddress(RLLIB, "LoadSoundFromWave")            'Sound LoadSoundFromWave(Wave wave);                   // Load sound from wave data
    Global UpdateSound(_sound:Sound, Data:Byte ptr, samplesCount:Int) = GetProcAddress(RLLIB, "UpdateSound")            'void UpdateSound(Sound sound, const void *data, int samplesCount);              // Update sound buffer with new data
    Global UnloadWave(_wave:Wave) = GetProcAddress(RLLIB, "UnloadWave")            'void UnloadWave(Wave wave); // Unload wave data
    Global UnloadSound(_sound:Sound) = GetProcAddress(RLLIB, "UnloadSound")            'void UnloadSound(Sound sound);                        // Unload sound
    Global ExportWave(_wave:Wave, fileName$z) = GetProcAddress(RLLIB, "ExportWave")            'void ExportWave(Wave wave, const char *fileName);     // Export wave data to file
    Global ExportWaveAsCode(_wave:Wave, fileName$z) = GetProcAddress(RLLIB, "ExportWaveAsCode")            'void ExportWaveAsCode(Wave wave, const char *fileName);                         // Export wave sample data to code (.h)
                 '
                 '// Wave/Sound management functions
    Global PlaySound(_sound:Sound) = GetProcAddress(RLLIB, "PlaySound")            'void PlaySound(Sound sound);// Play a sound
    Global StopSound(_sound:Sound) = GetProcAddress(RLLIB, "StopSound")            'void StopSound(Sound sound);// Stop playing a sound
    Global PauseSound(_sound:Sound) = GetProcAddress(RLLIB, "PauseSound")            'void PauseSound(Sound sound);                         // Pause a sound
    Global ResumeSound(_sound:Sound) = GetProcAddress(RLLIB, "ResumeSound")            'void ResumeSound(Sound sound);                        // Resume a paused sound
    Global PlaySoundMulti(_sound:Sound) = GetProcAddress(RLLIB, "PlaySoundMulti")            'void PlaySoundMulti(Sound sound);                     // Play a sound (using multichannel buffer pool)
    Global StopSoundMulti() = GetProcAddress(RLLIB, "StopSoundMulti")            'void StopSoundMulti(void);  // Stop any sound playing (using multichannel buffer pool)
    Global GetSoundsPlaying:int() = GetProcAddress(RLLIB, "GetSoundsPlaying")            'int GetSoundsPlaying(void); // Get number of sounds playing in the multichannel
    Global IsSoundPlaying:int(_sound:Sound) = GetProcAddress(RLLIB, "IsSoundPlaying")            'bool IsSoundPlaying(Sound sound);                     // Check if a sound is currently playing
    Global SetSoundVolume(_sound:Sound, volume:float) = GetProcAddress(RLLIB, "SetSoundVolume")            'void SetSoundVolume(Sound sound, float volume);       // Set volume for a sound (1.0 is max level)
    Global SetSoundPitch(_sound:Sound, pitch:float) = GetProcAddress(RLLIB, "SetSoundPitch")            'void SetSoundPitch(Sound sound, float pitch);         // Set pitch for a sound (1.0 is base level)
    Global WaveFormat(_wave:Byte ptr, sampleRate:Int, sampleSize:Int, channels:Int) = GetProcAddress(RLLIB, "WaveFormat")            'void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels);      // Convert wave data to desired format
    Global WaveCopy:Wave(_wave:Wave) = GetProcAddress(RLLIB, "WaveCopy")            'Wave WaveCopy(Wave wave);   // Copy a wave to a new wave
    Global WaveCrop(_wave:byte ptr, initSample:int, finalSample:int) = GetProcAddress(RLLIB, "WaveCrop")            'void WaveCrop(Wave *wave, int initSample, int finalSample);                     // Crop a wave to defined samples range
    Global GetWaveData:float ptr(_wave:Wave) = GetProcAddress(RLLIB, "*GetWaveData")            'float *GetWaveData(Wave wave);                        // Get samples data from wave as a floats array
                 '
                 '// Music management functions
    Global LoadMusicStream:Byte ptr(fileName$z) = GetProcAddress(RLLIB, "LoadMusicStream")            'Music LoadMusicStream(const char *fileName);          // Load music stream from file
    Global UnloadMusicStream(_music:Music) = GetProcAddress(RLLIB, "UnloadMusicStream")            'void UnloadMusicStream(Music music);                  // Unload music stream
    Global PlayMusicStream(_music:Byte ptr) = GetProcAddress(RLLIB, "PlayMusicStream")            'void PlayMusicStream(Music music);                    // Start music playing
    Global UpdateMusicStream(_music:Music) = GetProcAddress(RLLIB, "UpdateMusicStream")            'void UpdateMusicStream(Music music);                  // Updates buffers for music streaming
    Global StopMusicStream(_music:Music) = GetProcAddress(RLLIB, "StopMusicStream")            'void StopMusicStream(Music music);                    // Stop music playing
    Global PauseMusicStream(_music:Music) = GetProcAddress(RLLIB, "PauseMusicStream")            'void PauseMusicStream(Music music);                   // Pause music playing
    Global ResumeMusicStream(_music:Music) = GetProcAddress(RLLIB, "ResumeMusicStream")            'void ResumeMusicStream(Music music);                  // Resume playing paused music
    Global IsMusicPlaying:Int(_music:Music) = GetProcAddress(RLLIB, "IsMusicPlaying")            'bool IsMusicPlaying(Music music);                     // Check if music is playing
    Global SetMusicVolume(_music:Music, volume:Float) = GetProcAddress(RLLIB, "SetMusicVolume")            'void SetMusicVolume(Music music, float volume);       // Set volume for music (1.0 is max level)
    Global SetMusicPitch(_music:Music, Pitch:Float) = GetProcAddress(RLLIB, "SetMusicPitch")            'void SetMusicPitch(Music music, float pitch);         // Set pitch for a music (1.0 is base level)
    Global SetMusicLoopCount(_music:Music, Count:Int) = GetProcAddress(RLLIB, "SetMusicLoopCount")            'void SetMusicLoopCount(Music music, int count);       // Set music loop count (loop repeats)
    Global GetMusicTimeLength:Float(_music:Music) = GetProcAddress(RLLIB, "GetMusicTimeLength")            'float GetMusicTimeLength(Music music);                // Get music time length (in seconds)
    Global GetMusicTimePlayed:Float(_music:Music) = GetProcAddress(RLLIB, "GetMusicTimePlayed")            'float GetMusicTimePlayed(Music music);                // Get current music time played (in seconds)
                 '
                 '// AudioStream management functions
    Global InitAudioStream:AudioStream(sampleRate:uint, sampleSize:uint, channels:uint) = GetProcAddress(RLLIB, "InitAudioStream")            'AudioStream InitAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Init audio stream (to stream raw audio pcm data)
    Global UpdateAudioStream(_stream:AudioStream, Data:Byte ptr, samplesCount:Int) = GetProcAddress(RLLIB, "UpdateAudioStream")            'void UpdateAudioStream(AudioStream stream, const void *data, int samplesCount); // Update audio stream buffers with data
    Global CloseAudioStream(_stream:AudioStream) = GetProcAddress(RLLIB, "CloseAudioStream")            'void CloseAudioStream(AudioStream stream);            // Close audio stream and free memory
    Global IsAudioBufferProcessed:Int(_stream:AudioStream) = GetProcAddress(RLLIB, "IsAudioBufferProcessed")            'bool IsAudioBufferProcessed(AudioStream stream);      // Check if any audio stream buffers requires refill
    Global PlayAudioStream(_stream:AudioStream) = GetProcAddress(RLLIB, "PlayAudioStream")            'void PlayAudioStream(AudioStream stream);             // Play audio stream
    Global PauseAudioStream(_stream:AudioStream) = GetProcAddress(RLLIB, "PauseAudioStream")            'void PauseAudioStream(AudioStream stream);            // Pause audio stream
    Global ResumeAudioStream(_stream:AudioStream) = GetProcAddress(RLLIB, "ResumeAudioStream")            'void ResumeAudioStream(AudioStream stream);           // Resume audio stream
    Global IsAudioStreamPlaying:Int(_stream:AudioStream) = GetProcAddress(RLLIB, "IsAudioStreamPlaying")            'bool IsAudioStreamPlaying(AudioStream stream);        // Check if audio stream is playing
    Global StopAudioStream(_stream:AudioStream) = GetProcAddress(RLLIB, "StopAudioStream")            'void StopAudioStream(AudioStream stream);             // Stop audio stream
    Global SetAudioStreamVolume(_stream:AudioStream, volume:Float) = GetProcAddress(RLLIB, "SetAudioStreamVolume")            'void SetAudioStreamVolume(AudioStream stream, float volume);                    // Set volume for audio stream (1.0 is max level)
    Global SetAudioStreamPitch(_stream:AudioStream, Pitch:Float) = GetProcAddress(RLLIB, "SetAudioStreamPitch")            'void SetAudioStreamPitch(AudioStream stream, float pitch);                      // Set pitch for audio stream (1.0 is base level)
       
   
    '==========================================
    '// Basic geometric 3D shapes drawing functions
    Global DrawLine3D(startPos:Vector3, endPos:Vector3, color:Color) = GetProcAddress(RLLIB, "DrawLine3D")            '    void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color);          // Draw a line in 3D world space
    Global DrawPoint3D(position:Vector3, color:Color) = GetProcAddress(RLLIB, "DrawPoint3D")            '    void DrawPoint3D(Vector3 position, Color color);                         // Draw a point in 3D space, actually a small line
    Global DrawCircle3D(center:Vector3, radius:float, rotationAxis:Vector3, rotationAngle:float, color:Color) = GetProcAddress(RLLIB, "DrawCircle3D")            '    void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
    Global DrawCube(position:Vector3, width:float, height:float, length:float, color:Color) = GetProcAddress(RLLIB, "DrawCube")            '    void DrawCube(Vector3 position, float width, float height, float length, Color color);             // Draw cube
    Global DrawCubeV(position:Vector3, size:Vector3, color:Color) = GetProcAddress(RLLIB, "DrawCubeV")            '    void DrawCubeV(Vector3 position, Vector3 size, Color color);             // Draw cube (Vector version)
    Global DrawCubeWires(position:Vector3, width:float, height:float, length:float, color:Color) = GetProcAddress(RLLIB, "DrawCubeWires")            '    void DrawCubeWires(Vector3 position, float width, float height, float length, Color color);        // Draw cube wires
    Global DrawCubeWiresV(position:Vector3, size:Vector3, color:Color) = GetProcAddress(RLLIB, "DrawCubeWiresV")            '    void DrawCubeWiresV(Vector3 position, Vector3 size, Color color);        // Draw cube wires (Vector version)
    Global DrawCubeTexture(texture:Texture2D, position:Vector3, width:float, height:float, length:float, color:Color) = GetProcAddress(RLLIB, "DrawCubeTexture")            '    void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, Color color); // Draw cube textured
    Global DrawSphere(centerPos:Vector3, radius:float, color:Color) = GetProcAddress(RLLIB, "DrawSphere")            '    void DrawSphere(Vector3 centerPos, float radius, Color color);           // Draw sphere
    Global DrawSphereEx(centerPos:Vector3, radius:float, rings:int, slices:int, color:Color) = GetProcAddress(RLLIB, "DrawSphereEx")            '    void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color);            // Draw sphere with extended parameters
    Global DrawSphereWires(centerPos:Vector3, radius:float, rings:int, slices:int, color:Color) = GetProcAddress(RLLIB, "DrawSphereWires")            '    void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color);         // Draw sphere wires
    Global DrawCylinder(position:Vector3, radiusTop:float, radiusBottom:float, height:float, slices:int, color:Color) = GetProcAddress(RLLIB, "DrawCylinder")            '    void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone
    Global DrawCylinderWires(position:Vector3, radiusTop:float, radiusBottom:float, height:float, slices:int, color:Color) = GetProcAddress(RLLIB, "DrawCylinderWires")            '    void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone wires
    Global DrawPlane(centerPos:Vector3, size:Vector2, color:Color) = GetProcAddress(RLLIB, "DrawPlane")            '    void DrawPlane(Vector3 centerPos, Vector2 size, Color color);            // Draw a plane XZ
    Global DrawRay(ray:Ray, color:Color) = GetProcAddress(RLLIB, "DrawRay")            '    void DrawRay(Ray ray, Color color);            // Draw a ray line
    Global DrawGrid(slices:int, spacing:float) = GetProcAddress(RLLIB, "DrawGrid")            '    void DrawGrid(int slices, float spacing);      // Draw a grid (centered at (0, 0, 0))
    Global DrawGizmo(position:Vector3) = GetProcAddress(RLLIB, "DrawGizmo")            '    void DrawGizmo(Vector3 position);              // Draw simple gizmo
                 '   
                 '    // Model loading/unloading functions
    Global LoadModel:Model(fileName$z) = GetProcAddress(RLLIB, "LoadModel")            '    Model LoadModel(const char *fileName);         // Load model from files (meshes and materials)
    Global LoadModelFromMesh:Model(mesh:Mesh) = GetProcAddress(RLLIB, "LoadModelFromMesh")            '    Model LoadModelFromMesh(Mesh mesh);            // Load model from generated mesh (default material)
    Global UnloadModel(model:Model) = GetProcAddress(RLLIB, "UnloadModel")            '    void UnloadModel(Model model);                 // Unload model from memory (RAM and/or VRAM)
                 '   
                 '    // Mesh loading/unloading functions
    Global LoadMeshes:Mesh ptr(fileName$z, meshCount:Int ptr) = GetProcAddress(RLLIB, "*LoadMeshes")            '    Mesh *LoadMeshes(const char *fileName, int *meshCount);                  // Load meshes from model file
    Global ExportMesh(mesh:Mesh, fileName$z) = GetProcAddress(RLLIB, "ExportMesh")            '    void ExportMesh(Mesh mesh, const char *fileName);                        // Export mesh data to file
    Global UnloadMesh(mesh:Mesh) = GetProcAddress(RLLIB, "UnloadMesh")            '    void UnloadMesh(Mesh mesh);                    // Unload mesh from memory (RAM and/or VRAM)
                 '   
                 '    // Material loading/unloading functions
    Global LoadMaterials:Material ptr(fileName$z, materialCount:Int ptr) = GetProcAddress(RLLIB, "*LoadMaterials")            '    Material *LoadMaterials(const char *fileName, int *materialCount);       // Load materials from model file
    Global LoadMaterialDefault:Material() = GetProcAddress(RLLIB, "LoadMaterialDefault")            '    Material LoadMaterialDefault(void);            // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
    Global UnloadMaterial(material:Material) = GetProcAddress(RLLIB, "UnloadMaterial")            '    void UnloadMaterial(Material material);        // Unload material from GPU memory (VRAM)
    Global SetMaterialTexture(Material:Material ptr, mapType:Int, texture:Texture2D) = GetProcAddress(RLLIB, "SetMaterialTexture")            '    void SetMaterialTexture(Material *material, int mapType, Texture2D texture);                       // Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
    Global SetModelMeshMaterial(model:Model ptr, meshId:Int, materialId:Int) = GetProcAddress(RLLIB, "SetModelMeshMaterial")            '    void SetModelMeshMaterial(Model *model, int meshId, int materialId);     // Set material for a mesh
                 '   
                 '    // Model animations loading/unloading functions
    'Global LoadModelAnimations:ModelAnimation ptr(fileName$z, animsCount:int_ptr) = GetProcAddress(RLLIB, "*LoadModelAnimations")            '    ModelAnimation *LoadModelAnimations(const char *fileName, int *animsCount);                        // Load model animations from file
    'Global UpdateModelAnimation(model:Model, anim:ModelAnimation, frame:int) = GetProcAddress(RLLIB, "UpdateModelAnimation")            '    void UpdateModelAnimation(Model model, ModelAnimation anim, int frame);  // Update model animation pose
    'Global UnloadModelAnimation(anim:ModelAnimation) = GetProcAddress(RLLIB, "UnloadModelAnimation")            '    void UnloadModelAnimation(ModelAnimation anim);// Unload animation data
    'Global IsModelAnimationValid:int(model:Model, anim:ModelAnimation) = GetProcAddress(RLLIB, "IsModelAnimationValid")            '    bool IsModelAnimationValid(Model model, ModelAnimation anim);            // Check model animation skeleton match
                 '   
                 '    // Mesh generation functions
    Global GenMeshPoly:Mesh(sides:int, radius:float) = GetProcAddress(RLLIB, "GenMeshPoly")            '    Mesh GenMeshPoly(int sides, float radius);     // Generate polygonal mesh
    Global GenMeshPlane:Mesh(width:float, length:float, resX:int, resZ:int) = GetProcAddress(RLLIB, "GenMeshPlane")            '    Mesh GenMeshPlane(float width, float length, int resX, int resZ);        // Generate plane mesh (with subdivisions)
    Global GenMeshCube:Mesh(width:float, height:float, length:float) = GetProcAddress(RLLIB, "GenMeshCube")            '    Mesh GenMeshCube(float width, float height, float length);               // Generate cuboid mesh
    Global GenMeshSphere:Mesh(radius:float, rings:int, slices:int) = GetProcAddress(RLLIB, "GenMeshSphere")            '    Mesh GenMeshSphere(float radius, int rings, int slices);                 // Generate sphere mesh (standard sphere)
    Global GenMeshHemiSphere:Mesh(radius:float, rings:int, slices:int) = GetProcAddress(RLLIB, "GenMeshHemiSphere")            '    Mesh GenMeshHemiSphere(float radius, int rings, int slices);             // Generate half-sphere mesh (no bottom cap)
    Global GenMeshCylinder:Mesh(radius:float, height:float, slices:int) = GetProcAddress(RLLIB, "GenMeshCylinder")            '    Mesh GenMeshCylinder(float radius, float height, int slices);            // Generate cylinder mesh
    Global GenMeshTorus:Mesh(radius:float, size:float, radSeg:int, sides:int) = GetProcAddress(RLLIB, "GenMeshTorus")            '    Mesh GenMeshTorus(float radius, float size, int radSeg, int sides);      // Generate torus mesh
    Global GenMeshKnot:Mesh(radius:float, size:float, radSeg:int, sides:int) = GetProcAddress(RLLIB, "GenMeshKnot")            '    Mesh GenMeshKnot(float radius, float size, int radSeg, int sides);       // Generate trefoil knot mesh
    Global GenMeshHeightmap:Mesh(heightmap:Image, size:Vector3) = GetProcAddress(RLLIB, "GenMeshHeightmap")            '    Mesh GenMeshHeightmap(Image heightmap, Vector3 size);                    // Generate heightmap mesh from image data
    Global GenMeshCubicmap:Mesh(cubicmap:Image, cubeSize:Vector3) = GetProcAddress(RLLIB, "GenMeshCubicmap")            '    Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);                  // Generate cubes-based map mesh from image data
                 '   
                 '    // Mesh manipulation functions
    'Global MeshBoundingBox:BoundingBox(mesh:Mesh) = GetProcAddress(RLLIB, "MeshBoundingBox")            '    BoundingBox MeshBoundingBox(Mesh mesh);        // Compute mesh bounding box limits
    Global MeshTangents(mesh:Mesh ptr) = GetProcAddress(RLLIB, "MeshTangents")            '    void MeshTangents(Mesh *mesh);                 // Compute mesh tangents
    Global MeshBinormals(mesh:Mesh ptr) = GetProcAddress(RLLIB, "MeshBinormals")            '    void MeshBinormals(Mesh *mesh);                // Compute mesh binormals
                 '   
                 '    // Model drawing functions
    Global DrawModel(model:Model, position:Vector3, scale:float, tint:Color) = GetProcAddress(RLLIB, "DrawModel")            '    void DrawModel(Model model, Vector3 position, float scale, Color tint);  // Draw a model (with texture if set)
    Global DrawModelEx(model:Model, position:Vector3, rotationAxis:Vector3, rotationAngle:float, scale:Vector3, tint:Color) = GetProcAddress(RLLIB, "DrawModelEx")            '    void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
    Global DrawModelWires(model:Model, position:Vector3, scale:float, tint:Color) = GetProcAddress(RLLIB, "DrawModelWires")            '    void DrawModelWires(Model model, Vector3 position, float scale, Color tint);                       // Draw a model wires (with texture if set)
    Global DrawModelWiresEx(model:Model, position:Vector3, rotationAxis:Vector3, rotationAngle:float, scale:Vector3, tint:Color) = GetProcAddress(RLLIB, "DrawModelWiresEx")            '    void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
    'Global DrawBoundingBox(box:BoundingBox, color:Color) = GetProcAddress(RLLIB, "DrawBoundingBox")            '    void DrawBoundingBox(BoundingBox box, Color color);                      // Draw bounding box (wires)
    Global DrawBillboard(camera:Camera3D, texture:Texture2D, center:Vector3, Size:Float, tint:Color) = GetProcAddress(RLLIB, "DrawBillboard")            '    void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint);      // Draw a billboard texture
    Global DrawBillboardRec(camera:Camera3D, texture:Texture2D, sourceRec:Rectangle, center:Vector3, Size:Float, tint:Color) = GetProcAddress(RLLIB, "DrawBillboardRec")            '    void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec
                 '   
                 '    // Collision detection functions
    Global CheckCollisionSpheres:int(centerA:Vector3, radiusA:float, centerB:Vector3, radiusB:float) = GetProcAddress(RLLIB, "CheckCollisionSpheres")            '    bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB);        // Detect collision between two spheres
    'Global CheckCollisionBoxes:int(box1:BoundingBox, box2:BoundingBox) = GetProcAddress(RLLIB, "CheckCollisionBoxes")            '    bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2);            // Detect collision between two bounding boxes
    'Global CheckCollisionBoxSphere:int(box:BoundingBox, center:Vector3, radius:float) = GetProcAddress(RLLIB, "CheckCollisionBoxSphere")            '    bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius);                       // Detect collision between box and sphere
    Global CheckCollisionRaySphere:int(ray:Ray, center:Vector3, radius:float) = GetProcAddress(RLLIB, "CheckCollisionRaySphere")            '    bool CheckCollisionRaySphere(Ray ray, Vector3 center, float radius);     // Detect collision between ray and sphere
    Global CheckCollisionRaySphereEx:Int(ray:Ray, center:Vector3, radius:Float, collisionPoint:Vector3 ptr) = GetProcAddress(RLLIB, "CheckCollisionRaySphereEx")            '    bool CheckCollisionRaySphereEx(Ray ray, Vector3 center, float radius, Vector3 *collisionPoint);    // Detect collision between ray and sphere, returns collision point
    'Global CheckCollisionRayBox:int(ray:Ray, box:BoundingBox) = GetProcAddress(RLLIB, "CheckCollisionRayBox")            '    bool CheckCollisionRayBox(Ray ray, BoundingBox box);                     // Detect collision between ray and box
    Global GetCollisionRayModel:RayHitInfo(ray:Ray, model:Model) = GetProcAddress(RLLIB, "GetCollisionRayModel")            '    RayHitInfo GetCollisionRayModel(Ray ray, Model model);                   // Get collision info between ray and model
    Global GetCollisionRayTriangle:RayHitInfo(ray:Ray, p1:Vector3, p2:Vector3, p3:Vector3) = GetProcAddress(RLLIB, "GetCollisionRayTriangle")            '    RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3);                   // Get collision info between ray and triangle
    Global GetCollisionRayGround:RayHitInfo(ray:Ray, groundHeight:float) = GetProcAddress(RLLIB, "GetCollisionRayGround")            '    RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight);           // Get collision info between ray and ground plane (Y-normal plane)   
       

    Function Check()
        Print(Int(GetProcAddress(RLLIB, "LoadMusicStream")))
        'DebugStop
    End Function
   
    Function DrawTextureEx2(texture:Texture2D, x:Float, y:Float, Rotation:Float = 0, Scale:Float = 1, tint:Color)
        Global Pos:Vector2
        Pos.x = x
        Pos.y = y
        DrawTextureEx(texture, Pos, Rotation, Scale, tint)
    End Function   
End Type


GW

#2
Extra.c

typedef struct Color {
    unsigned char r;
    unsigned char g;
    unsigned char b;
    unsigned char a;
} Color;

// Vector4 type
typedef struct Vector4 {
    float x;
    float y;
    float z;
    float w;
} Vector4;

// Vector3 type
typedef struct Vector3 {
    float x;
    float y;
    float z;
} Vector3;

typedef Vector4 Quaternion;

typedef struct Matrix {
    float m0, m4, m8, m12;
    float m1, m5, m9, m13;
    float m2, m6, m10, m14;
    float m3, m7, m11, m15;
} Matrix;


typedef struct Texture2D {
    unsigned int id;        // OpenGL texture id
    int width;              // Texture base width
    int height;             // Texture base height
    int mipmaps;            // Mipmap levels, 1 by default
    int format;             // Data format (PixelFormat type)
} Texture2D;

typedef struct Mesh {
    int vertexCount;        // Number of vertices stored in arrays
    int triangleCount;      // Number of triangles stored (indexed or not)

    // Default vertex data
    float *vertices;        // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
    float *texcoords;       // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
    float *texcoords2;      // Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
    float *normals;         // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
    float *tangents;        // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
    unsigned char *colors;  // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
    unsigned short *indices;// Vertex indices (in case vertex data comes indexed)

    // Animation vertex data
    float *animVertices;    // Animated vertex positions (after bones transformations)
    float *animNormals;     // Animated normals (after bones transformations)
    int *boneIds;           // Vertex bone ids, up to 4 bones influence by vertex (skinning)
    float *boneWeights;     // Vertex bone weight, up to 4 bones influence by vertex (skinning)

    // OpenGL identifiers
    unsigned int vaoId;     // OpenGL Vertex Array Object id
    unsigned int *vboId;    // OpenGL Vertex Buffer Objects id (default vertex data)
} Mesh;

// Shader type (generic)
typedef struct Shader {
    unsigned int id;        // Shader program id
    int *locs;              // Shader locations array (MAX_SHADER_LOCATIONS)
} Shader;

// Material texture map
typedef struct MaterialMap {
    Texture2D texture;      // Material map texture
    Color color;            // Material map color
    float value;            // Material map value
} MaterialMap;

// Material type (generic)
typedef struct Material {
    Shader shader;          // Material shader
    MaterialMap *maps;      // Material maps array (MAX_MATERIAL_MAPS)
    float *params;          // Material generic parameters (if required)
} Material;

// Transformation properties
typedef struct Transform {
    Vector3 translation;    // Translation
    Quaternion rotation;    // Rotation
    Vector3 scale;          // Scale
} Transform;

// Bone information
typedef struct BoneInfo {
    char name[32];          // Bone name
    int parent;             // Bone parent
} BoneInfo;

// Model type
typedef struct Model {
    Matrix transform;       // Local transform matrix

    int meshCount;          // Number of meshes
    Mesh *meshes;           // Meshes array

    int materialCount;      // Number of materials
    Material *materials;    // Materials array
    int *meshMaterial;      // Mesh material number

    // Animation data
    int boneCount;          // Number of bones
    BoneInfo *bones;        // Bones information (skeleton)
    Transform *bindPose;    // Bones base transformation (pose)
} Model;

// Model animation
typedef struct ModelAnimation {
    int boneCount;          // Number of bones
    BoneInfo *bones;        // Bones information (skeleton)

    int frameCount;         // Number of animation frames
    Transform **framePoses; // Poses array by frame
} ModelAnimation;


//-------------------------------------------------------------------------------------------------------------------------------
void model_set_material(Model mdl, Texture2D tex, int index)
{
    mdl.materials[index].maps[0].texture = tex;
}

GW

#3
Example usage: (images are from the Raylib source examples)SuperStrict
Framework brl.basic

Import "Raylib.bmx"

Local RAYWHITE:Color = New Color(255, 255, 255)
Local LIGHTGRAY:Color = New Color(111, 111, 111)

RL.initWindow(800, 450, "Raylib BMax")
RL.SetTargetFPS(60)

Local cam:Camera3d = MakeCamera([16.0, 14.0, 16.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0)
   
Local img:Image = RL.LoadImage("cubicmap.png")
Local cubicmap:texture2d = RL.LoadTextureFromImage(img)

Local msh:mesh = RL.GenMeshCubicmap(img, New Vector3(1, 1, 1))
Local mdl:model = RL.LoadModelFromMesh(msh)

Local tex:texture2d = RL.LoadTexture("cubicmap_atlas.png")

model_set_material(mdl, tex, 0)

Local mapPosition:vector3 = New vector3(-16.0, 0.0, -8.0)

RL.UnloadImage(img)

RL.SetCameraMode(cam, CameraMode.CAMERA_ORBITAL)    '// auto orbit isnt working for some reason


While Not RL.WindowShouldClose()
    RL.UpdateCamera(cam)
   
    RL.BeginDrawing()
        RL.ClearBackground(RAYWHITE)
        RL.BeginMode3D(cam)
            RL.DrawModel(mdl, mapPosition, 1, RAYWHITE)
        RL.EndMode3D()
        RL.DrawText("Fps:" + String(RL.GetFPS()) , 1, 1, 10, LIGHTGRAY)
    RL.EndDrawing()
Wend

'''''''''''''''
'// 2D test //
'''''''''''''''

rem
Local img:Image = RL.LoadImage("c:\download\dtile_Diffuse.png")
Local texture:texture2d = RL.LoadTextureFromImage(img)
Local timer:Int
RL.UnloadImage(img)

'Local mus:Byte ptr = RL.LoadMusicStream("c:/download/option_gradius2_.wav")
'RL.PlayMusicStream(mus)
'Local mus:Sound = RL.LoadSound("c:/download/audiocheck.net_sweep_10Hz_20000Hz_-3dBFS_1s.wav")

Local f:Font = RL.LoadFontEx("C:\Users\AW\Desktop\fonts\binchrt.ttf", 96, 0, 0)
RL.GenTextureMipmaps(f.texture)

Local FontSize% = f.baseSize
RL.SetTextureFilter(f.texture, TextureFilterMode.FILTER_BILINEAR)  'FILTER_POINT

While Not RL.WindowShouldClose()
    RL.BeginDrawing()
       
        RL.ClearBackground(RAYWHITE)
       
        RL.DrawTextureEx2(texture, RL.GetMousePosition().x, RL.GetMousePosition().y, timer Mod 360, 1, RAYWHITE)
       
        RL.DrawLine(0, 0, RL.GetMousePosition().x, RL.GetMousePosition().y, makeColor(255, 0, 0))
       
        RL.DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY)
        RL.DrawText(String(RL.GetFPS()) , 1, 1, 10, LIGHTGRAY)
       
        RL.DrawTextEx(f, "Here 123", New vector2(50, 50), 20, 0, LIGHTGRAY)
       
       
        If RL.IsMouseButtonReleased(0) Then
            RL.PlaySound(mus)
            'debugstop
        End If
       
    RL.EndDrawing()
    timer:+1
Wend
endrem

RL.CloseWindow()

Derron

Nice work - hope you enjoyed wrapping the stuff - and have use for it!


bye
Ron

Brucey

Hallo,

You may find this interesting : https://github.com/bmx-ng/ray.mod

So far, tested on Windows and Linux.

GW

Wow! That's amazing.
Even RayGui is included.  definitely gonna give this a workout. 
Great job Brucey!

Brucey

I'm still working through the examples and adding missing stuff as I get to it.

There are a couple of APIs that I don't have a plan for atm, and one struct that I'm not happy with, but generally it's translated into BlitzMax quite well.

Brucey

I should add, that it requires the very latest brl.mod, which has some new String/UTF-8 conversion code that I'm using.
To use that, you should be on the latest compiler release (bcc 0.116) too...

I decided not to make Enums of the enums, and just use plain Consts, as it required less changes to the examples.

Brucey

I've implemented raylib's audio stuff now.

There's some shader-specific bits left, but I think most of the API has been implemented.

There are still many examples to convert...

MikeHart