diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 228514c..a32a309 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - 'v*' + - "v*" jobs: create_release: runs-on: ubuntu-latest @@ -214,4 +214,4 @@ jobs: upload_url: ${{ needs.create_release.outputs.upload_url }} asset_path: ./build/Release/node-raylib.node asset_name: node-raylib-darwin-x64.node - asset_content_type: application/octet-stream + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fa51eb..47b2969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ include(FetchContent) -cmake_minimum_required(VERSION 3.11) +# 2025-02-15: based on https://github.com/raysan5/raylib/blob/master/src/external/glfw/CMakeLists.txt, make sure the CMake version are between 3.4 and 3.28 or the whole raylib lib will face fatal errors +cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR) project (node-raylib VERSION 0.10.0 DESCRIPTION "Node.js bindings for raylib" @@ -11,8 +12,12 @@ if ( CMAKE_COMPILER_IS_GNUCC ) set(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS} -Wno-unused-result") set(CMAKE_CXX_FLAGS "-Wall -Wextra") endif() +# 2025-02-15: based on @link: https://learn.microsoft.com/en-us/cpp/build/reference/o-options-optimize-code?view=msvc-170. MSVC only accept O2 and don't have O3 optimization flag if ( MSVC ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w") + set(CMAKE_CXX_FLAGS_RELEASE "-O2") +else() + set(CMAKE_CXX_FLAGS_RELEASE "-O3") endif() if(NOT CMAKE_BUILD_TYPE) @@ -20,24 +25,22 @@ if(NOT CMAKE_BUILD_TYPE) endif() set(CMAKE_CXX_FLAGS_DEBUG "-g") -set(CMAKE_CXX_FLAGS_RELEASE "-O3") # version doesn't seem to pick correct version -#find_package(raylib 4.5 QUIET EXACT) +#find_package(raylib 5.5 QUIET EXACT) if (NOT raylib_FOUND) include(FetchContent) FetchContent_Declare( raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git - GIT_TAG 4.5.0 + GIT_TAG 5.5 GIT_SHALLOW TRUE ) FetchContent_GetProperties(raylib) if (NOT raylib_POPULATED) set(FETCHCONTENT_QUIET NO) - FetchContent_Populate(raylib) + FetchContent_MakeAvailable(raylib) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) - add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR}) endif() endif() @@ -75,7 +78,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".node" ) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_JS_INC}" diff --git a/docs/API.md b/docs/API.md index ab2e930..646c50f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -4,12 +4,12 @@
InitWindow(width, height, title)undefined

Initialize window and OpenGL context

-
WindowShouldClose()boolean
-

Check if KEY_ESCAPE pressed or Close icon pressed

-
CloseWindow()undefined

Close window and unload OpenGL context

+
WindowShouldClose()boolean
+

Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)

+
IsWindowReady()boolean

Check if window has been initialized successfully

@@ -17,16 +17,16 @@

Check if window is currently fullscreen

IsWindowHidden()boolean
-

Check if window is currently hidden (only PLATFORM_DESKTOP)

+

Check if window is currently hidden

IsWindowMinimized()boolean
-

Check if window is currently minimized (only PLATFORM_DESKTOP)

+

Check if window is currently minimized

IsWindowMaximized()boolean
-

Check if window is currently maximized (only PLATFORM_DESKTOP)

+

Check if window is currently maximized

IsWindowFocused()boolean
-

Check if window is currently focused (only PLATFORM_DESKTOP)

+

Check if window is currently focused

IsWindowResized()boolean

Check if window has been resized last frame

@@ -35,46 +35,55 @@

Check if one specific window flag is enabled

SetWindowState(flags)undefined
-

Set window configuration state using flags (only PLATFORM_DESKTOP)

+

Set window configuration state using flags

ClearWindowState(flags)undefined

Clear window configuration state flags

ToggleFullscreen()undefined
-

Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)

+

Toggle window state: fullscreen/windowed, resizes monitor to match window resolution

+
+
ToggleBorderlessWindowed()undefined
+

Toggle window state: borderless windowed, resizes window to match monitor resolution

MaximizeWindow()undefined
-

Set window state: maximized, if resizable (only PLATFORM_DESKTOP)

+

Set window state: maximized, if resizable

MinimizeWindow()undefined
-

Set window state: minimized, if resizable (only PLATFORM_DESKTOP)

+

Set window state: minimized, if resizable

RestoreWindow()undefined
-

Set window state: not minimized/maximized (only PLATFORM_DESKTOP)

+

Set window state: not minimized/maximized

SetWindowIcon(image)undefined
-

Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)

+

Set icon for window (single image, RGBA 32bit)

SetWindowIcons(images, count)undefined
-

Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)

+

Set icon for window (multiple images, RGBA 32bit)

SetWindowTitle(title)undefined
-

Set title for window (only PLATFORM_DESKTOP)

+

Set title for window

SetWindowPosition(x, y)undefined
-

Set window position on screen (only PLATFORM_DESKTOP)

+

Set window position on screen

SetWindowMonitor(monitor)undefined
-

Set monitor for the current window (fullscreen mode)

+

Set monitor for the current window

SetWindowMinSize(width, height)undefined

Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)

+
SetWindowMaxSize(width, height)undefined
+

Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)

+
SetWindowSize(width, height)undefined

Set window dimensions

SetWindowOpacity(opacity)undefined
-

Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)

+

Set window opacity [0.0f..1.0f]

+
+
SetWindowFocused()undefined
+

Set window focused

GetWindowHandle()number

Get native window handle

@@ -95,7 +104,7 @@

Get number of connected monitors

GetCurrentMonitor()number
-

Get current connected monitor

+

Get current monitor where window is placed

GetMonitorPosition(monitor)Vector2

Get specified monitor position

@@ -122,7 +131,7 @@

Get window scale DPI factor

GetMonitorName(monitor)string
-

Get the human-readable, UTF-8 encoded name of the primary monitor

+

Get the human-readable, UTF-8 encoded name of the specified monitor

SetClipboardText(text)undefined

Set clipboard text content

@@ -130,21 +139,15 @@
GetClipboardText()string

Get clipboard text content

+
GetClipboardImage()Image
+

Get clipboard image content

+
EnableEventWaiting()undefined

Enable waiting for events on EndDrawing(), no automatic event polling

DisableEventWaiting()undefined

Disable waiting for events on EndDrawing(), automatic events polling

-
SwapScreenBuffer()undefined
-

Swap back buffer with front buffer (screen drawing)

-
-
PollInputEvents()undefined
-

Register all input events

-
-
WaitTime(seconds)undefined
-

Wait for some time (halt program execution)

-
ShowCursor()undefined

Shows cursor

@@ -217,8 +220,8 @@
LoadShaderFromMemory(vsCode, fsCode)Shader

Load shader from code strings and bind default locations

-
IsShaderReady(shader)boolean
-

Check if a shader is ready

+
IsShaderValid(shader)boolean
+

Check if a shader is valid (loaded on GPU)

GetShaderLocation(shader, uniformName)number

Get shader uniform location

@@ -235,51 +238,72 @@
UnloadShader(shader)undefined

Unload shader from GPU memory (VRAM)

-
GetMouseRay(mousePosition, camera)Ray
-

Get a ray trace from mouse position

-
-
GetCameraMatrix(camera)Matrix
-

Get camera transform matrix (view matrix)

+
GetScreenToWorldRay(position, camera)Ray
+

Get a ray trace from screen position (i.e mouse)

-
GetCameraMatrix2D(camera)Matrix
-

Get camera 2d transform matrix

+
GetScreenToWorldRayEx(position, camera, width, height)Ray
+

Get a ray trace from screen position (i.e mouse) in a viewport

GetWorldToScreen(position, camera)Vector2

Get the screen space position for a 3d world space position

-
GetScreenToWorld2D(position, camera)Vector2
-

Get the world space position for a 2d camera screen space position

-
GetWorldToScreenEx(position, camera, width, height)Vector2

Get size position for a 3d world space position

GetWorldToScreen2D(position, camera)Vector2

Get the screen space position for a 2d camera world space position

+
GetScreenToWorld2D(position, camera)Vector2
+

Get the world space position for a 2d camera screen space position

+
+
GetCameraMatrix(camera)Matrix
+

Get camera transform matrix (view matrix)

+
+
GetCameraMatrix2D(camera)Matrix
+

Get camera 2d transform matrix

+
SetTargetFPS(fps)undefined

Set target FPS (maximum)

-
GetFPS()number
-

Get current FPS

-
GetFrameTime()number

Get time in seconds for last frame drawn (delta time)

GetTime()number

Get elapsed time in seconds since InitWindow()

-
GetRandomValue(min, max)number
-

Get a random value between min and max (both included)

+
GetFPS()number
+

Get current FPS

+
+
SwapScreenBuffer()undefined
+

Swap back buffer with front buffer (screen drawing)

+
+
PollInputEvents()undefined
+

Register all input events

+
+
WaitTime(seconds)undefined
+

Wait for some time (halt program execution)

SetRandomSeed(seed)undefined

Set the seed for the random number generator

+
GetRandomValue(min, max)number
+

Get a random value between min and max (both included)

+
+
LoadRandomSequence(count, min, max)number
+

Load random values sequence, no values repeated

+
+
UnloadRandomSequence(sequence)undefined
+

Unload random values sequence

+
TakeScreenshot(fileName)undefined

Takes a screenshot of current screen (filename extension defines format)

SetConfigFlags(flags)undefined

Setup init configuration flags (view FLAGS)

+
OpenURL(url)undefined
+

Open URL with default system browser (if available)

+
SetTraceLogLevel(logLevel)undefined

Set the current threshold (minimum) log level

@@ -292,19 +316,16 @@
MemFree(ptr)undefined

Internal memory free

-
OpenURL(url)undefined
-

Open URL with default system browser (if available)

-
-
LoadFileData(fileName, bytesRead)Buffer
+
LoadFileData(fileName, dataSize)Buffer

Load file data as byte array (read)

UnloadFileData(data)undefined

Unload file data allocated by LoadFileData()

-
SaveFileData(fileName, data, bytesToWrite)boolean
+
SaveFileData(fileName, data, dataSize)boolean

Save data to file from byte array (write), returns true on success

-
ExportDataAsCode(data, size, fileName)boolean
+
ExportDataAsCode(data, dataSize, fileName)boolean

Export data to code (.h), returns true on success

LoadFileText(fileName)string
@@ -347,7 +368,10 @@

Get current working directory (uses static string)

GetApplicationDirectory()string
-

Get the directory if the running application (uses static string)

+

Get the directory of the running application (uses static string)

+
+
MakeDirectory(dirPath)number
+

Create directories (including full path requested), returns 0 on success

ChangeDirectory(dir)boolean

Change working directory, return true on success

@@ -355,11 +379,14 @@
IsPathFile(path)boolean

Check if a given path is a file or a directory

+
IsFileNameValid(fileName)boolean
+

Check if fileName is valid for the platform/OS

+
LoadDirectoryFiles(dirPath)FilePathList

Load directory filepaths

LoadDirectoryFilesEx(basePath, filter, scanSubdirs)FilePathList
-

Load directory filepaths with extension filtering and recursive directory scan

+

Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result

UnloadDirectoryFiles(files)undefined

Unload filepaths

@@ -388,9 +415,45 @@
DecodeDataBase64(data, outputSize)Buffer

Decode Base64 string data, memory must be MemFree()

+
ComputeCRC32(data, dataSize)number
+

Compute CRC32 hash code

+
+
ComputeMD5(data, dataSize)number
+

Compute MD5 hash code, returns static int[4] (16 bytes)

+
+
ComputeSHA1(data, dataSize)number
+

Compute SHA1 hash code, returns static int[5] (20 bytes)

+
+
LoadAutomationEventList(fileName)AutomationEventList
+

Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS

+
+
UnloadAutomationEventList(list)undefined
+

Unload automation events list from file

+
+
ExportAutomationEventList(list, fileName)boolean
+

Export automation events list as text file

+
+
SetAutomationEventList(list)undefined
+

Set automation event list to record to

+
+
SetAutomationEventBaseFrame(frame)undefined
+

Set automation event internal base frame to start recording

+
+
StartAutomationEventRecording()undefined
+

Start recording automation events (AutomationEventList must be set)

+
+
StopAutomationEventRecording()undefined
+

Stop recording automation events

+
+
PlayAutomationEvent(event)undefined
+

Play a recorded automation event

+
IsKeyPressed(key)boolean

Check if a key has been pressed once

+
IsKeyPressedRepeat(key)boolean
+

Check if a key has been pressed again

+
IsKeyDown(key)boolean

Check if a key is being pressed

@@ -400,15 +463,15 @@
IsKeyUp(key)boolean

Check if a key is NOT being pressed

-
SetExitKey(key)undefined
-

Set a custom key to exit program (default is ESC)

-
GetKeyPressed()number

Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty

GetCharPressed()number

Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty

+
SetExitKey(key)undefined
+

Set a custom key to exit program (default is ESC)

+
IsGamepadAvailable(gamepad)boolean

Check if a gamepad is available

@@ -439,6 +502,9 @@
SetGamepadMappings(mappings)number

Set internal gamepad mappings (SDL_GameControllerDB)

+
SetGamepadVibration(gamepad, leftMotor, rightMotor, duration)undefined
+

Set gamepad vibration for both motors (duration in seconds)

+
IsMouseButtonPressed(button)boolean

Check if a mouse button has been pressed once

@@ -506,7 +572,7 @@

Get latest detected gesture

GetGestureHoldDuration()number
-

Get gesture hold time in milliseconds

+

Get gesture hold time in seconds

GetGestureDragVector()Vector2

Get gesture drag vector

@@ -526,32 +592,32 @@
SetShapesTexture(texture, source)undefined

Set texture and rectangle to be used on shapes drawing

+
GetShapesTexture()Texture2D
+

Get texture that is used for shapes drawing

+
+
GetShapesTextureRectangle()Rectangle
+

Get texture source rectangle that is used for shapes drawing

+
DrawPixel(posX, posY, color)undefined
-

Draw a pixel

+

Draw a pixel using geometry [Can be slow, use with care]

DrawPixelV(position, color)undefined
-

Draw a pixel (Vector version)

+

Draw a pixel using geometry (Vector version) [Can be slow, use with care]

DrawLine(startPosX, startPosY, endPosX, endPosY, color)undefined

Draw a line

DrawLineV(startPos, endPos, color)undefined
-

Draw a line (Vector version)

+

Draw a line (using gl lines)

DrawLineEx(startPos, endPos, thick, color)undefined
-

Draw a line defining thickness

-
-
DrawLineBezier(startPos, endPos, thick, color)undefined
-

Draw a line using cubic-bezier curves in-out

-
-
DrawLineBezierQuad(startPos, endPos, controlPos, thick, color)undefined
-

Draw line using quadratic bezier curves with a control point

-
-
DrawLineBezierCubic(startPos, endPos, startControlPos, endControlPos, thick, color)undefined
-

Draw line using cubic bezier curves with 2 control points

+

Draw a line (using triangles/quads)

DrawLineStrip(points, pointCount, color)undefined
-

Draw lines sequence

+

Draw lines sequence (using gl lines)

+
+
DrawLineBezier(startPos, endPos, thick, color)undefined
+

Draw line segment cubic-bezier in-out interpolation

DrawCircle(centerX, centerY, radius, color)undefined

Draw a color-filled circle

@@ -562,7 +628,7 @@
DrawCircleSectorLines(center, radius, startAngle, endAngle, segments, color)undefined

Draw circle sector outline

-
DrawCircleGradient(centerX, centerY, radius, color1, color2)undefined
+
DrawCircleGradient(centerX, centerY, radius, inner, outer)undefined

Draw a gradient-filled circle

DrawCircleV(center, radius, color)undefined
@@ -571,6 +637,9 @@
DrawCircleLines(centerX, centerY, radius, color)undefined

Draw circle outline

+
DrawCircleLinesV(center, radius, color)undefined
+

Draw circle outline (Vector version)

+
DrawEllipse(centerX, centerY, radiusH, radiusV, color)undefined

Draw ellipse

@@ -595,13 +664,13 @@
DrawRectanglePro(rec, origin, rotation, color)undefined

Draw a color-filled rectangle with pro parameters

-
DrawRectangleGradientV(posX, posY, width, height, color1, color2)undefined
+
DrawRectangleGradientV(posX, posY, width, height, top, bottom)undefined

Draw a vertical-gradient-filled rectangle

-
DrawRectangleGradientH(posX, posY, width, height, color1, color2)undefined
+
DrawRectangleGradientH(posX, posY, width, height, left, right)undefined

Draw a horizontal-gradient-filled rectangle

-
DrawRectangleGradientEx(rec, col1, col2, col3, col4)undefined
+
DrawRectangleGradientEx(rec, topLeft, bottomLeft, topRight, bottomRight)undefined

Draw a gradient-filled rectangle with custom vertex colors

DrawRectangleLines(posX, posY, width, height, color)undefined
@@ -613,7 +682,10 @@
DrawRectangleRounded(rec, roundness, segments, color)undefined

Draw rectangle with rounded edges

-
DrawRectangleRoundedLines(rec, roundness, segments, lineThick, color)undefined
+
DrawRectangleRoundedLines(rec, roundness, segments, color)undefined
+

Draw rectangle lines with rounded edges

+
+
DrawRectangleRoundedLinesEx(rec, roundness, segments, lineThick, color)undefined

Draw rectangle with rounded edges outline

DrawTriangle(v1, v2, v3, color)undefined
@@ -637,6 +709,51 @@
DrawPolyLinesEx(center, sides, radius, rotation, lineThick, color)undefined

Draw a polygon outline of n sides with extended parameters

+
DrawSplineLinear(points, pointCount, thick, color)undefined
+

Draw spline: Linear, minimum 2 points

+
+
DrawSplineBasis(points, pointCount, thick, color)undefined
+

Draw spline: B-Spline, minimum 4 points

+
+
DrawSplineCatmullRom(points, pointCount, thick, color)undefined
+

Draw spline: Catmull-Rom, minimum 4 points

+
+
DrawSplineBezierQuadratic(points, pointCount, thick, color)undefined
+

Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]

+
+
DrawSplineBezierCubic(points, pointCount, thick, color)undefined
+

Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]

+
+
DrawSplineSegmentLinear(p1, p2, thick, color)undefined
+

Draw spline segment: Linear, 2 points

+
+
DrawSplineSegmentBasis(p1, p2, p3, p4, thick, color)undefined
+

Draw spline segment: B-Spline, 4 points

+
+
DrawSplineSegmentCatmullRom(p1, p2, p3, p4, thick, color)undefined
+

Draw spline segment: Catmull-Rom, 4 points

+
+
DrawSplineSegmentBezierQuadratic(p1, c2, p3, thick, color)undefined
+

Draw spline segment: Quadratic Bezier, 2 points, 1 control point

+
+
DrawSplineSegmentBezierCubic(p1, c2, c3, p4, thick, color)undefined
+

Draw spline segment: Cubic Bezier, 2 points, 2 control points

+
+
GetSplinePointLinear(startPos, endPos, t)Vector2
+

Get (evaluate) spline point: Linear

+
+
GetSplinePointBasis(p1, p2, p3, p4, t)Vector2
+

Get (evaluate) spline point: B-Spline

+
+
GetSplinePointCatmullRom(p1, p2, p3, p4, t)Vector2
+

Get (evaluate) spline point: Catmull-Rom

+
+
GetSplinePointBezierQuad(p1, c2, p3, t)Vector2
+

Get (evaluate) spline point: Quadratic Bezier

+
+
GetSplinePointBezierCubic(p1, c2, c3, p4, t)Vector2
+

Get (evaluate) spline point: Cubic Bezier

+
CheckCollisionRecs(rec1, rec2)boolean

Check collision between two rectangles

@@ -646,6 +763,9 @@
CheckCollisionCircleRec(center, radius, rec)boolean

Check collision between circle and rectangle

+
CheckCollisionCircleLine(center, radius, p1, p2)boolean
+

Check if circle collides with a line created betweeen two points [p1] and [p2]

+
CheckCollisionPointRec(point, rec)boolean

Check if point is inside rectangle

@@ -655,15 +775,15 @@
CheckCollisionPointTriangle(point, p1, p2, p3)boolean

Check if point is inside a triangle

+
CheckCollisionPointLine(point, p1, p2, threshold)boolean
+

Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]

+
CheckCollisionPointPoly(point, points, pointCount)boolean

Check if point is within a polygon described by array of vertices

CheckCollisionLines(startPos1, endPos1, startPos2, endPos2, collisionPoint)boolean

Check the collision between two lines defined by two points each, returns collision point by reference

-
CheckCollisionPointLine(point, p1, p2, threshold)boolean
-

Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]

-
GetCollisionRec(rec1, rec2)Rectangle

Get collision rectangle for two rectangles collision

@@ -676,6 +796,9 @@
LoadImageAnim(fileName, frames)Image

Load image sequence from file (frames appended to image.data)

+
LoadImageAnimFromMemory(fileType, fileData, dataSize, frames)Image
+

Load image sequence from memory buffer

+
LoadImageFromMemory(fileType, fileData, dataSize)Image

Load image from memory buffer, fileType refers to extension: i.e. '.png'

@@ -685,8 +808,8 @@
LoadImageFromScreen()Image

Load image from screen buffer and (screenshot)

-
IsImageReady(image)boolean
-

Check if an image is ready

+
IsImageValid(image)boolean
+

Check if an image is valid (data and parameters)

UnloadImage(image)undefined

Unload image from CPU memory (RAM)

@@ -694,21 +817,24 @@
ExportImage(image, fileName)boolean

Export image data to file, returns true on success

+
ExportImageToMemory(image, fileType, fileSize)Buffer
+

Export image to memory buffer

+
ExportImageAsCode(image, fileName)boolean

Export image as code file defining an array of bytes, returns true on success

GenImageColor(width, height, color)Image

Generate image: plain color

-
GenImageGradientV(width, height, top, bottom)Image
-

Generate image: vertical gradient

-
-
GenImageGradientH(width, height, left, right)Image
-

Generate image: horizontal gradient

+
GenImageGradientLinear(width, height, direction, start, end)Image
+

Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient

GenImageGradientRadial(width, height, density, inner, outer)Image

Generate image: radial gradient

+
GenImageGradientSquare(width, height, density, inner, outer)Image
+

Generate image: square gradient

+
GenImageChecked(width, height, checksX, checksY, col1, col2)Image

Generate image: checked

@@ -730,6 +856,9 @@
ImageFromImage(image, rec)Image

Create an image from another image piece

+
ImageFromChannel(image, selectedChannel)Image
+

Create an image from a selected channel of another image (GRAYSCALE)

+
ImageText(text, fontSize, color)Image

Create an image from text (default font)

@@ -739,6 +868,12 @@
ImageBlurGaussian(image, blurSize)undefined

Apply Gaussian blur using a box blur approximation

+
ImageKernelConvolution(image, kernel, kernelSize)undefined
+

Apply custom square convolution kernel to image

+
+
ImageRotate(image, degrees)undefined
+

Rotate image by input angle in degrees (-359 to 359)

+
LoadImageColors(image)number

Load color data from image as a Color array (RGBA - 32bit)

@@ -757,12 +892,30 @@
GetImageColor(image, x, y)Color

Get image pixel color at (x, y) position

+
ImageDrawLineEx(dst, start, end, thick, color)undefined
+

Draw a line defining thickness within an image

+
ImageDrawCircleLines(dst, centerX, centerY, radius, color)undefined

Draw circle outline within an image

ImageDrawCircleLinesV(dst, center, radius, color)undefined

Draw circle outline within an image (Vector version)

+
ImageDrawTriangle(dst, v1, v2, v3, color)undefined
+

Draw triangle within an image

+
+
ImageDrawTriangleEx(dst, v1, v2, v3, c1, c2, c3)undefined
+

Draw triangle with interpolated colors within an image

+
+
ImageDrawTriangleLines(dst, v1, v2, v3, color)undefined
+

Draw triangle outline within an image

+
+
ImageDrawTriangleFan(dst, points, pointCount, color)undefined
+

Draw a triangle fan defined by points within an image (first vertex is the center)

+
+
ImageDrawTriangleStrip(dst, points, pointCount, color)undefined
+

Draw a triangle strip defined by points within an image

+
LoadTexture(fileName)Texture2D

Load texture from file into GPU memory (VRAM)

@@ -775,14 +928,14 @@
LoadRenderTexture(width, height)RenderTexture2D

Load texture for rendering (framebuffer)

-
IsTextureReady(texture)boolean
-

Check if a texture is ready

+
IsTextureValid(texture)boolean
+

Check if a texture is valid (loaded in GPU)

UnloadTexture(texture)undefined

Unload texture from GPU memory (VRAM)

-
IsRenderTextureReady(target)boolean
-

Check if a render texture is ready

+
IsRenderTextureValid(target)boolean
+

Check if a render texture is valid (loaded in GPU)

UnloadRenderTexture(target)undefined

Unload render texture from GPU memory (VRAM)

@@ -817,11 +970,14 @@
DrawTextureNPatch(texture, nPatchInfo, dest, origin, rotation, tint)undefined

Draws a texture (or part of it) that stretches or shrinks nicely

+
ColorIsEqual(col1, col2)boolean
+

Check if two colors are equal

+
Fade(color, alpha)Color

Get color with alpha applied, alpha goes from 0.0f to 1.0f

ColorToInt(color)number
-

Get hexadecimal value for a Color

+

Get hexadecimal value for a Color (0xRRGGBBAA)

ColorNormalize(color)Vector4

Get Color normalized as float [0..1]

@@ -850,6 +1006,9 @@
ColorAlphaBlend(dst, src, tint)Color

Get src alpha-blended into dst color with tint

+
ColorLerp(color1, color2, factor)Color
+

Get color lerp interpolation between two colors, factor [0.0f..1.0f]

+
GetColor(hexValue)Color

Get Color structure from hexadecimal value

@@ -868,25 +1027,25 @@
LoadFont(fileName)Font

Load font from file into GPU memory (VRAM)

-
LoadFontEx(fileName, fontSize, fontChars, glyphCount)Font
-

Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set

+
LoadFontEx(fileName, fontSize, codepoints, codepointCount)Font
+

Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height

LoadFontFromImage(image, key, firstChar)Font

Load font from Image (XNA style)

-
LoadFontFromMemory(fileType, fileData, dataSize, fontSize, fontChars, glyphCount)Font
+
LoadFontFromMemory(fileType, fileData, dataSize, fontSize, codepoints, codepointCount)Font

Load font from memory buffer, fileType refers to extension: i.e. '.ttf'

-
IsFontReady(font)boolean
-

Check if a font is ready

+
IsFontValid(font)boolean
+

Check if a font is valid (font data loaded, WARNING: GPU texture not checked)

-
LoadFontData(fileData, dataSize, fontSize, fontChars, glyphCount, type)number
+
LoadFontData(fileData, dataSize, fontSize, codepoints, codepointCount, type)number

Load font data for further use

-
GenImageFontAtlas(chars, recs, glyphCount, fontSize, padding, packMethod)Image
+
GenImageFontAtlas(glyphs, glyphRecs, glyphCount, fontSize, padding, packMethod)Image

Generate image font atlas using chars info

-
UnloadFontData(chars, glyphCount)undefined
+
UnloadFontData(glyphs, glyphCount)undefined

Unload font chars info data (RAM)

UnloadFont(font)undefined
@@ -910,9 +1069,12 @@
DrawTextCodepoint(font, codepoint, position, fontSize, tint)undefined

Draw one character (codepoint)

-
DrawTextCodepoints(font, codepoints, count, position, fontSize, spacing, tint)undefined
+
DrawTextCodepoints(font, codepoints, codepointCount, position, fontSize, spacing, tint)undefined

Draw multiple character (codepoint)

+
SetTextLineSpacing(spacing)undefined
+

Set vertical line spacing when drawing with line-breaks

+
MeasureText(text, fontSize)number

Measure string width for default font

@@ -994,9 +1156,18 @@
TextToPascal(text)string

Get Pascal case notation version of provided string

+
TextToSnake(text)string
+

Get Snake case notation version of provided string

+
+
TextToCamel(text)string
+

Get Camel case notation version of provided string

+
TextToInteger(text)number

Get integer value from text (negative values not supported)

+
TextToFloat(text)number
+

Get float value from text (negative values not supported)

+
DrawLine3D(startPos, endPos, color)undefined

Draw a line in 3D world space

@@ -1066,8 +1237,8 @@
LoadModelFromMesh(mesh)Model

Load model from generated mesh (default material)

-
IsModelReady(model)boolean
-

Check if a model is ready

+
IsModelValid(model)boolean
+

Check if a model is valid (loaded in GPU, VAO/VBOs)

UnloadModel(model)undefined

Unload model (including meshes) from memory (RAM and/or VRAM)

@@ -1087,10 +1258,16 @@
DrawModelWiresEx(model, position, rotationAxis, rotationAngle, scale, tint)undefined

Draw a model wires (with texture if set) with extended parameters

+
DrawModelPoints(model, position, scale, tint)undefined
+

Draw a model as points

+
+
DrawModelPointsEx(model, position, rotationAxis, rotationAngle, scale, tint)undefined
+

Draw a model as points with extended parameters

+
DrawBoundingBox(box, color)undefined

Draw bounding box (wires)

-
DrawBillboard(camera, texture, position, size, tint)undefined
+
DrawBillboard(camera, texture, position, scale, tint)undefined

Draw a billboard texture

DrawBillboardRec(camera, texture, source, position, size, tint)undefined
@@ -1105,11 +1282,14 @@
UnloadMesh(mesh)undefined

Unload mesh data from CPU and GPU

+
GetMeshBoundingBox(mesh)BoundingBox
+

Compute mesh bounding box limits

+
ExportMesh(mesh, fileName)boolean

Export mesh data to file, returns true on success

-
GetMeshBoundingBox(mesh)BoundingBox
-

Compute mesh bounding box limits

+
ExportMeshAsCode(mesh, fileName)boolean
+

Export mesh as code file (.h) defining multiple arrays of vertex attributes

GenMeshPoly(sides, radius)Mesh

Generate polygonal mesh

@@ -1148,12 +1328,15 @@

Load model animations from file

UpdateModelAnimation(model, anim, frame)undefined
-

Update model animation pose

+

Update model animation pose (CPU)

+
+
UpdateModelAnimationBones(model, anim, frame)undefined
+

Update model animation mesh bone matrices (GPU skinning)

UnloadModelAnimation(anim)undefined

Unload animation data

-
UnloadModelAnimations(animations, count)undefined
+
UnloadModelAnimations(animations, animCount)undefined

Unload animation array data

IsModelAnimationValid(model, anim)boolean
@@ -1195,14 +1378,17 @@
SetMasterVolume(volume)undefined

Set master volume (listener)

+
GetMasterVolume()number
+

Get master volume (listener)

+
LoadWave(fileName)Wave

Load wave data from file

LoadWaveFromMemory(fileType, fileData, dataSize)Wave

Load wave from memory buffer, fileType refers to extension: i.e. '.wav'

-
IsWaveReady(wave)boolean
-

Checks if wave data is ready

+
IsWaveValid(wave)boolean
+

Checks if wave data is valid (data loaded and parameters)

LoadSound(fileName)Sound

Load sound from file

@@ -1210,8 +1396,11 @@
LoadSoundFromWave(wave)Sound

Load sound from wave data

-
IsSoundReady(sound)boolean
-

Checks if a sound is ready

+
LoadSoundAlias(source)Sound
+

Create a new sound that shares the same sample data as the source sound, does not own the sound data

+
+
IsSoundValid(sound)boolean
+

Checks if a sound is valid (data loaded and buffers initialized)

UpdateSound(sound, data, sampleCount)undefined

Update sound buffer with new data

@@ -1222,6 +1411,9 @@
UnloadSound(sound)undefined

Unload sound

+
UnloadSoundAlias(alias)undefined
+

Unload a sound alias (does not deallocate sample data)

+
ExportWave(wave, fileName)boolean

Export wave data to file, returns true on success

@@ -1267,8 +1459,8 @@
LoadMusicStreamFromMemory(fileType, data, dataSize)Music

Load music stream from data

-
IsMusicReady(music)boolean
-

Checks if a music stream is ready

+
IsMusicValid(music)boolean
+

Checks if a music stream is valid (context and buffers initialized)

UnloadMusicStream(music)undefined

Unload music stream

@@ -1312,8 +1504,8 @@
LoadAudioStream(sampleRate, sampleSize, channels)AudioStream

Load audio stream (to stream raw audio pcm data)

-
IsAudioStreamReady(stream)boolean
-

Checks if an audio stream is ready

+
IsAudioStreamValid(stream)boolean
+

Checks if an audio stream is valid (buffers initialized)

UnloadAudioStream(stream)undefined

Unload audio stream and free memory

@@ -1450,7 +1642,7 @@
GuiIsLocked()boolean

Check if gui is locked (global state)

-
GuiFade(alpha)undefined
+
GuiSetAlpha(alpha)undefined

Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f

GuiSetState(state)undefined
@@ -1471,82 +1663,115 @@
GuiGetStyle(control, property)number

Get one style property

-
GuiWindowBox(bounds, title)boolean
+
GuiLoadStyle(fileName)undefined
+

Load style file over global style variable (.rgs)

+
+
GuiLoadStyleDefault()undefined
+

Load style default over global style

+
+
GuiEnableTooltip()undefined
+

Enable gui tooltips (global state)

+
+
GuiDisableTooltip()undefined
+

Disable gui tooltips (global state)

+
+
GuiSetTooltip(tooltip)undefined
+

Set tooltip string

+
+
GuiIconText(iconId, text)string
+

Get text with icon id prepended (if supported)

+
+
GuiSetIconScale(scale)undefined
+

Set default icon drawing size

+
+
GuiGetIcons()number
+

Get raygui icons data pointer

+
+
GuiLoadIcons(fileName, loadIconsName)number
+

Load raygui icons file (.rgi) into internal icons data

+
+
GuiDrawIcon(iconId, posX, posY, pixelSize, color)undefined
+

Draw icon using pixel size at specified position

+
+
GuiWindowBox(bounds, title)number

Window Box control, shows a window that can be closed

-
GuiGroupBox(bounds, text)undefined
+
GuiGroupBox(bounds, text)number

Group Box control with text name

-
GuiLine(bounds, text)undefined
+
GuiLine(bounds, text)number

Line separator control, could contain text

-
GuiPanel(bounds, text)undefined
+
GuiPanel(bounds, text)number

Panel control, useful to group controls

GuiTabBar(bounds, text, count, active)number

Tab Bar control, returns TAB to be closed or -1

-
GuiScrollPanel(bounds, text, content, scroll)Rectangle
+
GuiScrollPanel(bounds, text, content, scroll, view)number

Scroll Panel control

-
GuiLabel(bounds, text)undefined
-

Label control, shows text

+
GuiLabel(bounds, text)number
+

Label control

-
GuiButton(bounds, text)boolean
+
GuiButton(bounds, text)number

Button control, returns true when clicked

-
GuiLabelButton(bounds, text)boolean
-

Label button control, show true when clicked

+
GuiLabelButton(bounds, text)number
+

Label button control, returns true when clicked

-
GuiToggle(bounds, text, active)boolean
-

Toggle Button control, returns true when active

+
GuiToggle(bounds, text, active)number
+

Toggle Button control

GuiToggleGroup(bounds, text, active)number
-

Toggle Group control, returns active toggle index

+

Toggle Group control

+
+
GuiToggleSlider(bounds, text, active)number
+

Toggle Slider control

-
GuiCheckBox(bounds, text, checked)boolean
+
GuiCheckBox(bounds, text, checked)number

Check Box control, returns true when active

GuiComboBox(bounds, text, active)number
-

Combo Box control, returns selected item index

+

Combo Box control

-
GuiDropdownBox(bounds, text, active, editMode)boolean
-

Dropdown Box control, returns selected item

+
GuiDropdownBox(bounds, text, active, editMode)number
+

Dropdown Box control

-
GuiSpinner(bounds, text, value, minValue, maxValue, editMode)boolean
-

Spinner control, returns selected value

+
GuiSpinner(bounds, text, value, minValue, maxValue, editMode)number
+

Spinner control

-
GuiValueBox(bounds, text, value, minValue, maxValue, editMode)boolean
+
GuiValueBox(bounds, text, value, minValue, maxValue, editMode)number

Value Box control, updates input text with numbers

-
GuiTextBox(bounds, text, textSize, editMode)boolean
-

Text Box control, updates input text

+
GuiValueBoxFloat(bounds, text, textValue, value, editMode)number
+

Value box control for float values

-
GuiTextBoxMulti(bounds, text, textSize, editMode)boolean
-

Text Box control with multiple lines

+
GuiTextBox(bounds, text, textSize, editMode)number
+

Text Box control, updates input text

GuiSlider(bounds, textLeft, textRight, value, minValue, maxValue)number
-

Slider control, returns selected value

+

Slider control

GuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue)number
-

Slider Bar control, returns selected value

+

Slider Bar control

GuiProgressBar(bounds, textLeft, textRight, value, minValue, maxValue)number
-

Progress Bar control, shows current progress value

+

Progress Bar control

-
GuiStatusBar(bounds, text)undefined
+
GuiStatusBar(bounds, text)number

Status Bar control, shows info text

-
GuiDummyRec(bounds, text)undefined
+
GuiDummyRec(bounds, text)number

Dummy control for placeholders

-
GuiGrid(bounds, text, spacing, subdivs)Vector2
-

Grid control, returns mouse cell position

+
GuiGrid(bounds, text, spacing, subdivs, mouseCell)number
+

Grid control

GuiListView(bounds, text, scrollIndex, active)number
-

List View control, returns selected list item index

+

List View control

-
GuiListViewEx(bounds, text, count, focus, scrollIndex, active)number
+
GuiListViewEx(bounds, text, count, scrollIndex, active, focus)number

List View with extended parameters

GuiMessageBox(bounds, title, message, buttons)number
@@ -1555,10 +1780,10 @@
GuiTextInputBox(bounds, title, message, buttons, text, textMaxSize, secretViewActive)number

Text Input Box control, ask for text, supports secret

-
GuiColorPicker(bounds, text, color)Color
+
GuiColorPicker(bounds, text, color)number

Color Picker control (multiple color controls)

-
GuiColorPanel(bounds, text, color)Color
+
GuiColorPanel(bounds, text, color)number

Color Panel control

GuiColorBarAlpha(bounds, text, alpha)number
@@ -1567,32 +1792,11 @@
GuiColorBarHue(bounds, text, value)number

Color Bar Hue control

-
GuiLoadStyle(fileName)undefined
-

Load style file over global style variable (.rgs)

-
-
GuiLoadStyleDefault()undefined
-

Load style default over global style

-
-
GuiEnableTooltip()undefined
-

Enable gui tooltips (global state)

-
-
GuiDisableTooltip()undefined
-

Disable gui tooltips (global state)

-
-
GuiSetTooltip(tooltip)undefined
-

Set tooltip string

-
-
GuiIconText(iconId, text)string
-

Get text with icon id prepended (if supported)

-
-
GuiGetIcons()number
-

Get raygui icons data pointer

-
-
GuiLoadIcons(fileName, loadIconsName)number
-

Load raygui icons file (.rgi) into internal icons data

+
GuiColorPickerHSV(bounds, text, colorHsv)number
+

Color Picker control that avoids conversion to RGB on each call (multiple color controls)

-
GuiSetIconScale(scale)undefined
-

Set icon drawing size

+
GuiColorPanelHSV(bounds, text, colorHsv)number
+

Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV()

rlMatrixMode(mode)undefined

Choose the current matrix to be transformed

@@ -1621,6 +1825,15 @@
rlViewport(x, y, width, height)undefined

Set the viewport area

+
rlSetClipPlanes(nearPlane, farPlane)undefined
+

Set clip planes distances

+
+
rlGetCullDistanceNear()number
+

Get cull plane distance near

+
+
rlGetCullDistanceFar()number
+

Get cull plane distance far

+
rlBegin(mode)undefined

Initialize drawing mode (how to organize vertex)

@@ -1708,9 +1921,18 @@
rlDisableFramebuffer()undefined

Disable render texture (fbo), return to default framebuffer

+
rlGetActiveFramebuffer()number
+

Get the currently active render texture (fbo), 0 for default framebuffer

+
rlActiveDrawBuffers(count)undefined

Activate multiple draw color buffers

+
rlBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask)undefined
+

Blit active framebuffer to main framebuffer

+
+
rlBindFramebuffer(target, framebuffer)undefined
+

Bind framebuffer (FBO)

+
rlEnableColorBlend()undefined

Enable color blending

@@ -1735,6 +1957,9 @@
rlDisableBackfaceCulling()undefined

Disable backface culling

+
rlColorMask(r, g, b, a)undefined
+

Color mask control

+
rlSetCullFace(mode)undefined

Set face culling mode

@@ -1750,8 +1975,11 @@
rlEnableWireMode()undefined

Enable wire mode

+
rlEnablePointMode()undefined
+

Enable point mode

+
rlDisableWireMode()undefined
-

Disable wire mode

+

Disable wire (and point) mode

rlSetLineWidth(width)undefined

Set the line drawing width

@@ -1850,31 +2078,55 @@

Load vertex array (vao) if supported

rlLoadVertexBuffer(buffer, size, dynamic)number
-

Load a vertex buffer attribute

+

Load a vertex buffer object

rlLoadVertexBufferElement(buffer, size, dynamic)number
-

Load a new attributes element buffer

+

Load vertex buffer elements object

rlUpdateVertexBuffer(bufferId, data, dataSize, offset)undefined
-

Update GPU buffer with new data

+

Update vertex buffer object data on GPU buffer

rlUpdateVertexBufferElements(id, data, dataSize, offset)undefined
-

Update vertex buffer elements with new data

+

Update vertex buffer elements data on GPU buffer

+
+
rlUnloadVertexArray(vaoId)undefined
+

Unload vertex array (vao)

+
+
rlUnloadVertexBuffer(vboId)undefined
+

Unload vertex buffer object

+
+
rlSetVertexAttribute(index, compSize, type, normalized, stride, offset)undefined
+

Set vertex attribute data configuration

+
+
rlSetVertexAttributeDivisor(index, divisor)undefined
+

Set vertex attribute data divisor

rlSetVertexAttributeDefault(locIndex, value, attribType, count)undefined
-

Set vertex attribute default value

+

Set vertex attribute default value, when attribute to provided

+
+
rlDrawVertexArray(offset, count)undefined
+

Draw vertex array (currently active vao)

+
+
rlDrawVertexArrayElements(offset, count, buffer)undefined
+

Draw vertex array elements

+
+
rlDrawVertexArrayInstanced(offset, count, instances)undefined
+

Draw vertex array (currently active vao) with instancing

+
+
rlDrawVertexArrayElementsInstanced(offset, count, buffer, instances)undefined
+

Draw vertex array elements with instancing

rlLoadTexture(data, width, height, format, mipmapCount)number
-

Load texture in GPU

+

Load texture data

rlLoadTextureDepth(width, height, useRenderBuffer)number

Load depth texture/renderbuffer (to be attached to fbo)

-
rlLoadTextureCubemap(data, size, format)number
-

Load texture cubemap

+
rlLoadTextureCubemap(data, size, format, mipmapCount)number
+

Load texture cubemap data

rlUpdateTexture(id, offsetX, offsetY, width, height, format, data)undefined
-

Update GPU texture with new data

+

Update texture with new data on GPU

rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType)undefined

Get OpenGL internal formats

@@ -1894,7 +2146,7 @@
rlReadScreenPixels(width, height)Buffer

Read screen pixel data (color buffer)

-
rlLoadFramebuffer(width, height)number
+
rlLoadFramebuffer()number

Load an empty framebuffer

rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel)undefined
@@ -1930,6 +2182,9 @@
rlSetUniformMatrix(locIndex, mat)undefined

Set shader value matrix

+
rlSetUniformMatrices(locIndex, mat, count)undefined
+

Set shader value matrices

+
rlSetUniformSampler(locIndex, textureId)undefined

Set shader value sampler

@@ -2122,8 +2377,8 @@
SetModelMeshMaterial(model, meshId, materialId)undefined

Set material for a mesh

-
WaveCrop(wave, initSample, finalSample)undefined
-

Crop a wave to defined samples range

+
WaveCrop(wave, initFrame, finalFrame)undefined
+

Crop a wave to defined frames range

WaveFormat(wave, sampleRate, sampleSize, channels)undefined

Convert wave data to desired format

@@ -2179,19 +2434,19 @@ Initialize window and OpenGL context | height | number | | title | string | - - -## WindowShouldClose() ⇒ boolean -Check if KEY_ESCAPE pressed or Close icon pressed - -**Kind**: global function -**Returns**: boolean - The resulting bool. ## CloseWindow() ⇒ undefined Close window and unload OpenGL context **Kind**: global function + + +## WindowShouldClose() ⇒ boolean +Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) + +**Kind**: global function +**Returns**: boolean - The resulting bool. ## IsWindowReady() ⇒ boolean @@ -2209,28 +2464,28 @@ Check if window is currently fullscreen ## IsWindowHidden() ⇒ boolean -Check if window is currently hidden (only PLATFORM_DESKTOP) +Check if window is currently hidden **Kind**: global function **Returns**: boolean - The resulting bool. ## IsWindowMinimized() ⇒ boolean -Check if window is currently minimized (only PLATFORM_DESKTOP) +Check if window is currently minimized **Kind**: global function **Returns**: boolean - The resulting bool. ## IsWindowMaximized() ⇒ boolean -Check if window is currently maximized (only PLATFORM_DESKTOP) +Check if window is currently maximized **Kind**: global function **Returns**: boolean - The resulting bool. ## IsWindowFocused() ⇒ boolean -Check if window is currently focused (only PLATFORM_DESKTOP) +Check if window is currently focused **Kind**: global function **Returns**: boolean - The resulting bool. @@ -2256,7 +2511,7 @@ Check if one specific window flag is enabled ## SetWindowState(flags) ⇒ undefined -Set window configuration state using flags (only PLATFORM_DESKTOP) +Set window configuration state using flags **Kind**: global function @@ -2278,31 +2533,37 @@ Clear window configuration state flags ## ToggleFullscreen() ⇒ undefined -Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) +Toggle window state: fullscreen/windowed, resizes monitor to match window resolution + +**Kind**: global function + + +## ToggleBorderlessWindowed() ⇒ undefined +Toggle window state: borderless windowed, resizes window to match monitor resolution **Kind**: global function ## MaximizeWindow() ⇒ undefined -Set window state: maximized, if resizable (only PLATFORM_DESKTOP) +Set window state: maximized, if resizable **Kind**: global function ## MinimizeWindow() ⇒ undefined -Set window state: minimized, if resizable (only PLATFORM_DESKTOP) +Set window state: minimized, if resizable **Kind**: global function ## RestoreWindow() ⇒ undefined -Set window state: not minimized/maximized (only PLATFORM_DESKTOP) +Set window state: not minimized/maximized **Kind**: global function ## SetWindowIcon(image) ⇒ undefined -Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) +Set icon for window (single image, RGBA 32bit) **Kind**: global function @@ -2313,7 +2574,7 @@ Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) ## SetWindowIcons(images, count) ⇒ undefined -Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) +Set icon for window (multiple images, RGBA 32bit) **Kind**: global function @@ -2325,7 +2586,7 @@ Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) ## SetWindowTitle(title) ⇒ undefined -Set title for window (only PLATFORM_DESKTOP) +Set title for window **Kind**: global function @@ -2336,7 +2597,7 @@ Set title for window (only PLATFORM_DESKTOP) ## SetWindowPosition(x, y) ⇒ undefined -Set window position on screen (only PLATFORM_DESKTOP) +Set window position on screen **Kind**: global function @@ -2348,7 +2609,7 @@ Set window position on screen (only PLATFORM_DESKTOP) ## SetWindowMonitor(monitor) ⇒ undefined -Set monitor for the current window (fullscreen mode) +Set monitor for the current window **Kind**: global function @@ -2368,6 +2629,18 @@ Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) | width | number | | height | number | + + +## SetWindowMaxSize(width, height) ⇒ undefined +Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| width | number | +| height | number | + ## SetWindowSize(width, height) ⇒ undefined @@ -2383,7 +2656,7 @@ Set window dimensions ## SetWindowOpacity(opacity) ⇒ undefined -Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) +Set window opacity [0.0f..1.0f] **Kind**: global function @@ -2391,6 +2664,12 @@ Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) | --- | --- | | opacity | number | + + +## SetWindowFocused() ⇒ undefined +Set window focused + +**Kind**: global function ## GetWindowHandle() ⇒ number @@ -2436,7 +2715,7 @@ Get number of connected monitors ## GetCurrentMonitor() ⇒ number -Get current connected monitor +Get current monitor where window is placed **Kind**: global function **Returns**: number - The resulting int. @@ -2529,7 +2808,7 @@ Get window scale DPI factor ## GetMonitorName(monitor) ⇒ string -Get the human-readable, UTF-8 encoded name of the primary monitor +Get the human-readable, UTF-8 encoded name of the specified monitor **Kind**: global function **Returns**: string - The resulting const char *. @@ -2556,6 +2835,13 @@ Get clipboard text content **Kind**: global function **Returns**: string - The resulting const char *. + + +## GetClipboardImage() ⇒ Image +Get clipboard image content + +**Kind**: global function +**Returns**: Image - The resulting Image. ## EnableEventWaiting() ⇒ undefined @@ -2568,36 +2854,13 @@ Enable waiting for events on EndDrawing(), no automatic event polling Disable waiting for events on EndDrawing(), automatic events polling **Kind**: global function - + -## SwapScreenBuffer() ⇒ undefined -Swap back buffer with front buffer (screen drawing) +## ShowCursor() ⇒ undefined +Shows cursor **Kind**: global function - - -## PollInputEvents() ⇒ undefined -Register all input events - -**Kind**: global function - - -## WaitTime(seconds) ⇒ undefined -Wait for some time (halt program execution) - -**Kind**: global function - -| Param | Type | -| --- | --- | -| seconds | number | - - - -## ShowCursor() ⇒ undefined -Shows cursor - -**Kind**: global function - + ## HideCursor() ⇒ undefined Hides cursor @@ -2789,10 +3052,10 @@ Load shader from code strings and bind default locations | vsCode | string | | fsCode | string | - + -## IsShaderReady(shader) ⇒ boolean -Check if a shader is ready +## IsShaderValid(shader) ⇒ boolean +Check if a shader is valid (loaded on GPU) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -2864,47 +3127,51 @@ Unload shader from GPU memory (VRAM) | --- | --- | | shader | Shader | - + -## GetMouseRay(mousePosition, camera) ⇒ Ray -Get a ray trace from mouse position +## GetScreenToWorldRay(position, camera) ⇒ Ray +Get a ray trace from screen position (i.e mouse) **Kind**: global function **Returns**: Ray - The resulting Ray. | Param | Type | | --- | --- | -| mousePosition | [Vector2](#Vector2) | +| position | [Vector2](#Vector2) | | camera | [Camera3D](#Camera3D) | - + -## GetCameraMatrix(camera) ⇒ Matrix -Get camera transform matrix (view matrix) +## GetScreenToWorldRayEx(position, camera, width, height) ⇒ Ray +Get a ray trace from screen position (i.e mouse) in a viewport **Kind**: global function -**Returns**: Matrix - The resulting Matrix. +**Returns**: Ray - The resulting Ray. | Param | Type | | --- | --- | +| position | [Vector2](#Vector2) | | camera | [Camera3D](#Camera3D) | +| width | number | +| height | number | - + -## GetCameraMatrix2D(camera) ⇒ Matrix -Get camera 2d transform matrix +## GetWorldToScreen(position, camera) ⇒ [Vector2](#Vector2) +Get the screen space position for a 3d world space position **Kind**: global function -**Returns**: Matrix - The resulting Matrix. +**Returns**: [Vector2](#Vector2) - The resulting Vector2. | Param | Type | | --- | --- | -| camera | [Camera2D](#Camera2D) | +| position | [Vector3](#Vector3) | +| camera | [Camera3D](#Camera3D) | - + -## GetWorldToScreen(position, camera) ⇒ [Vector2](#Vector2) -Get the screen space position for a 3d world space position +## GetWorldToScreenEx(position, camera, width, height) ⇒ [Vector2](#Vector2) +Get size position for a 3d world space position **Kind**: global function **Returns**: [Vector2](#Vector2) - The resulting Vector2. @@ -2913,6 +3180,21 @@ Get the screen space position for a 3d world space position | --- | --- | | position | [Vector3](#Vector3) | | camera | [Camera3D](#Camera3D) | +| width | number | +| height | number | + + + +## GetWorldToScreen2D(position, camera) ⇒ [Vector2](#Vector2) +Get the screen space position for a 2d camera world space position + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. + +| Param | Type | +| --- | --- | +| position | [Vector2](#Vector2) | +| camera | [Camera2D](#Camera2D) | @@ -2927,32 +3209,28 @@ Get the world space position for a 2d camera screen space position | position | [Vector2](#Vector2) | | camera | [Camera2D](#Camera2D) | - + -## GetWorldToScreenEx(position, camera, width, height) ⇒ [Vector2](#Vector2) -Get size position for a 3d world space position +## GetCameraMatrix(camera) ⇒ Matrix +Get camera transform matrix (view matrix) **Kind**: global function -**Returns**: [Vector2](#Vector2) - The resulting Vector2. +**Returns**: Matrix - The resulting Matrix. | Param | Type | | --- | --- | -| position | [Vector3](#Vector3) | | camera | [Camera3D](#Camera3D) | -| width | number | -| height | number | - + -## GetWorldToScreen2D(position, camera) ⇒ [Vector2](#Vector2) -Get the screen space position for a 2d camera world space position +## GetCameraMatrix2D(camera) ⇒ Matrix +Get camera 2d transform matrix **Kind**: global function -**Returns**: [Vector2](#Vector2) - The resulting Vector2. +**Returns**: Matrix - The resulting Matrix. | Param | Type | | --- | --- | -| position | [Vector2](#Vector2) | | camera | [Camera2D](#Camera2D) | @@ -2966,13 +3244,6 @@ Set target FPS (maximum) | --- | --- | | fps | number | - - -## GetFPS() ⇒ number -Get current FPS - -**Kind**: global function -**Returns**: number - The resulting int. ## GetFrameTime() ⇒ number @@ -2987,6 +3258,47 @@ Get elapsed time in seconds since InitWindow() **Kind**: global function **Returns**: number - The resulting double. + + +## GetFPS() ⇒ number +Get current FPS + +**Kind**: global function +**Returns**: number - The resulting int. + + +## SwapScreenBuffer() ⇒ undefined +Swap back buffer with front buffer (screen drawing) + +**Kind**: global function + + +## PollInputEvents() ⇒ undefined +Register all input events + +**Kind**: global function + + +## WaitTime(seconds) ⇒ undefined +Wait for some time (halt program execution) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| seconds | number | + + + +## SetRandomSeed(seed) ⇒ undefined +Set the seed for the random number generator + +**Kind**: global function + +| Param | Type | +| --- | --- | +| seed | number | + ## GetRandomValue(min, max) ⇒ number @@ -3000,16 +3312,30 @@ Get a random value between min and max (both included) | min | number | | max | number | - + -## SetRandomSeed(seed) ⇒ undefined -Set the seed for the random number generator +## LoadRandomSequence(count, min, max) ⇒ number +Load random values sequence, no values repeated **Kind**: global function +**Returns**: number - The resulting int *. | Param | Type | | --- | --- | -| seed | number | +| count | number | +| min | number | +| max | number | + + + +## UnloadRandomSequence(sequence) ⇒ undefined +Unload random values sequence + +**Kind**: global function + +| Param | Type | +| --- | --- | +| sequence | number | @@ -3033,6 +3359,17 @@ Setup init configuration flags (view FLAGS) | --- | --- | | flags | number | + + +## OpenURL(url) ⇒ undefined +Open URL with default system browser (if available) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| url | string | + ## SetTraceLogLevel(logLevel) ⇒ undefined @@ -3080,20 +3417,9 @@ Internal memory free | --- | --- | | ptr | number | - - -## OpenURL(url) ⇒ undefined -Open URL with default system browser (if available) - -**Kind**: global function - -| Param | Type | -| --- | --- | -| url | string | - -## LoadFileData(fileName, bytesRead) ⇒ Buffer +## LoadFileData(fileName, dataSize) ⇒ Buffer Load file data as byte array (read) **Kind**: global function @@ -3102,7 +3428,7 @@ Load file data as byte array (read) | Param | Type | | --- | --- | | fileName | string | -| bytesRead | number | +| dataSize | number | @@ -3117,7 +3443,7 @@ Unload file data allocated by LoadFileData() -## SaveFileData(fileName, data, bytesToWrite) ⇒ boolean +## SaveFileData(fileName, data, dataSize) ⇒ boolean Save data to file from byte array (write), returns true on success **Kind**: global function @@ -3127,11 +3453,11 @@ Save data to file from byte array (write), returns true on success | --- | --- | | fileName | string | | data | number | -| bytesToWrite | number | +| dataSize | number | -## ExportDataAsCode(data, size, fileName) ⇒ boolean +## ExportDataAsCode(data, dataSize, fileName) ⇒ boolean Export data to code (.h), returns true on success **Kind**: global function @@ -3140,7 +3466,7 @@ Export data to code (.h), returns true on success | Param | Type | | --- | --- | | data | Buffer | -| size | number | +| dataSize | number | | fileName | string | @@ -3298,10 +3624,22 @@ Get current working directory (uses static string) ## GetApplicationDirectory() ⇒ string -Get the directory if the running application (uses static string) +Get the directory of the running application (uses static string) **Kind**: global function **Returns**: string - The resulting const char *. + + +## MakeDirectory(dirPath) ⇒ number +Create directories (including full path requested), returns 0 on success + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| dirPath | string | + ## ChangeDirectory(dir) ⇒ boolean @@ -3326,6 +3664,18 @@ Check if a given path is a file or a directory | --- | --- | | path | string | + + +## IsFileNameValid(fileName) ⇒ boolean +Check if fileName is valid for the platform/OS + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| fileName | string | + ## LoadDirectoryFiles(dirPath) ⇒ FilePathList @@ -3341,7 +3691,7 @@ Load directory filepaths ## LoadDirectoryFilesEx(basePath, filter, scanSubdirs) ⇒ FilePathList -Load directory filepaths with extension filtering and recursive directory scan +Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result **Kind**: global function **Returns**: FilePathList - The resulting FilePathList. @@ -3455,115 +3805,247 @@ Decode Base64 string data, memory must be MemFree() | data | Buffer | | outputSize | number | - + -## IsKeyPressed(key) ⇒ boolean -Check if a key has been pressed once +## ComputeCRC32(data, dataSize) ⇒ number +Compute CRC32 hash code **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting unsigned int. | Param | Type | | --- | --- | -| key | number | +| data | Buffer | +| dataSize | number | - + -## IsKeyDown(key) ⇒ boolean -Check if a key is being pressed +## ComputeMD5(data, dataSize) ⇒ number +Compute MD5 hash code, returns static int[4] (16 bytes) **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting unsigned int *. | Param | Type | | --- | --- | -| key | number | +| data | Buffer | +| dataSize | number | - + -## IsKeyReleased(key) ⇒ boolean -Check if a key has been released once +## ComputeSHA1(data, dataSize) ⇒ number +Compute SHA1 hash code, returns static int[5] (20 bytes) **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting unsigned int *. | Param | Type | | --- | --- | -| key | number | +| data | Buffer | +| dataSize | number | - + -## IsKeyUp(key) ⇒ boolean -Check if a key is NOT being pressed +## LoadAutomationEventList(fileName) ⇒ AutomationEventList +Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: AutomationEventList - The resulting AutomationEventList. | Param | Type | | --- | --- | -| key | number | +| fileName | string | - + -## SetExitKey(key) ⇒ undefined -Set a custom key to exit program (default is ESC) +## UnloadAutomationEventList(list) ⇒ undefined +Unload automation events list from file **Kind**: global function | Param | Type | | --- | --- | -| key | number | +| list | AutomationEventList | - + -## GetKeyPressed() ⇒ number -Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty +## ExportAutomationEventList(list, fileName) ⇒ boolean +Export automation events list as text file **Kind**: global function -**Returns**: number - The resulting int. - +**Returns**: boolean - The resulting bool. -## GetCharPressed() ⇒ number -Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty +| Param | Type | +| --- | --- | +| list | AutomationEventList | +| fileName | string | -**Kind**: global function -**Returns**: number - The resulting int. - + -## IsGamepadAvailable(gamepad) ⇒ boolean -Check if a gamepad is available +## SetAutomationEventList(list) ⇒ undefined +Set automation event list to record to **Kind**: global function -**Returns**: boolean - The resulting bool. | Param | Type | | --- | --- | -| gamepad | number | +| list | number | - + -## GetGamepadName(gamepad) ⇒ string -Get gamepad internal name id +## SetAutomationEventBaseFrame(frame) ⇒ undefined +Set automation event internal base frame to start recording **Kind**: global function -**Returns**: string - The resulting const char *. | Param | Type | | --- | --- | -| gamepad | number | +| frame | number | - + -## IsGamepadButtonPressed(gamepad, button) ⇒ boolean -Check if a gamepad button has been pressed once +## StartAutomationEventRecording() ⇒ undefined +Start recording automation events (AutomationEventList must be set) **Kind**: global function -**Returns**: boolean - The resulting bool. + -| Param | Type | -| --- | --- | -| gamepad | number | -| button | number | +## StopAutomationEventRecording() ⇒ undefined +Stop recording automation events + +**Kind**: global function + + +## PlayAutomationEvent(event) ⇒ undefined +Play a recorded automation event + +**Kind**: global function + +| Param | Type | +| --- | --- | +| event | AutomationEvent | + + + +## IsKeyPressed(key) ⇒ boolean +Check if a key has been pressed once + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| key | number | + + + +## IsKeyPressedRepeat(key) ⇒ boolean +Check if a key has been pressed again + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| key | number | + + + +## IsKeyDown(key) ⇒ boolean +Check if a key is being pressed + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| key | number | + + + +## IsKeyReleased(key) ⇒ boolean +Check if a key has been released once + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| key | number | + + + +## IsKeyUp(key) ⇒ boolean +Check if a key is NOT being pressed + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| key | number | + + + +## GetKeyPressed() ⇒ number +Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty + +**Kind**: global function +**Returns**: number - The resulting int. + + +## GetCharPressed() ⇒ number +Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty + +**Kind**: global function +**Returns**: number - The resulting int. + + +## SetExitKey(key) ⇒ undefined +Set a custom key to exit program (default is ESC) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| key | number | + + + +## IsGamepadAvailable(gamepad) ⇒ boolean +Check if a gamepad is available + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| gamepad | number | + + + +## GetGamepadName(gamepad) ⇒ string +Get gamepad internal name id + +**Kind**: global function +**Returns**: string - The resulting const char *. + +| Param | Type | +| --- | --- | +| gamepad | number | + + + +## IsGamepadButtonPressed(gamepad, button) ⇒ boolean +Check if a gamepad button has been pressed once + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| gamepad | number | +| button | number | @@ -3648,6 +4130,20 @@ Set internal gamepad mappings (SDL_GameControllerDB) | --- | --- | | mappings | string | + + +## SetGamepadVibration(gamepad, leftMotor, rightMotor, duration) ⇒ undefined +Set gamepad vibration for both motors (duration in seconds) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| gamepad | number | +| leftMotor | number | +| rightMotor | number | +| duration | number | + ## IsMouseButtonPressed(button) ⇒ boolean @@ -3863,7 +4359,7 @@ Get latest detected gesture ## GetGestureHoldDuration() ⇒ number -Get gesture hold time in milliseconds +Get gesture hold time in seconds **Kind**: global function **Returns**: number - The resulting float. @@ -3921,10 +4417,24 @@ Set texture and rectangle to be used on shapes drawing | texture | Texture | | source | [Rectangle](#Rectangle) | + + +## GetShapesTexture() ⇒ Texture2D +Get texture that is used for shapes drawing + +**Kind**: global function +**Returns**: Texture2D - The resulting Texture2D. + + +## GetShapesTextureRectangle() ⇒ [Rectangle](#Rectangle) +Get texture source rectangle that is used for shapes drawing + +**Kind**: global function +**Returns**: [Rectangle](#Rectangle) - The resulting Rectangle. ## DrawPixel(posX, posY, color) ⇒ undefined -Draw a pixel +Draw a pixel using geometry [Can be slow, use with care] **Kind**: global function @@ -3937,7 +4447,7 @@ Draw a pixel ## DrawPixelV(position, color) ⇒ undefined -Draw a pixel (Vector version) +Draw a pixel using geometry (Vector version) [Can be slow, use with care] **Kind**: global function @@ -3964,7 +4474,7 @@ Draw a line ## DrawLineV(startPos, endPos, color) ⇒ undefined -Draw a line (Vector version) +Draw a line (using gl lines) **Kind**: global function @@ -3977,21 +4487,7 @@ Draw a line (Vector version) ## DrawLineEx(startPos, endPos, thick, color) ⇒ undefined -Draw a line defining thickness - -**Kind**: global function - -| Param | Type | -| --- | --- | -| startPos | [Vector2](#Vector2) | -| endPos | [Vector2](#Vector2) | -| thick | number | -| color | [Color](#Color) | - - - -## DrawLineBezier(startPos, endPos, thick, color) ⇒ undefined -Draw a line using cubic-bezier curves in-out +Draw a line (using triangles/quads) **Kind**: global function @@ -4002,25 +4498,23 @@ Draw a line using cubic-bezier curves in-out | thick | number | | color | [Color](#Color) | - + -## DrawLineBezierQuad(startPos, endPos, controlPos, thick, color) ⇒ undefined -Draw line using quadratic bezier curves with a control point +## DrawLineStrip(points, pointCount, color) ⇒ undefined +Draw lines sequence (using gl lines) **Kind**: global function | Param | Type | | --- | --- | -| startPos | [Vector2](#Vector2) | -| endPos | [Vector2](#Vector2) | -| controlPos | [Vector2](#Vector2) | -| thick | number | +| points | number | +| pointCount | number | | color | [Color](#Color) | - + -## DrawLineBezierCubic(startPos, endPos, startControlPos, endControlPos, thick, color) ⇒ undefined -Draw line using cubic bezier curves with 2 control points +## DrawLineBezier(startPos, endPos, thick, color) ⇒ undefined +Draw line segment cubic-bezier in-out interpolation **Kind**: global function @@ -4028,24 +4522,9 @@ Draw line using cubic bezier curves with 2 control points | --- | --- | | startPos | [Vector2](#Vector2) | | endPos | [Vector2](#Vector2) | -| startControlPos | [Vector2](#Vector2) | -| endControlPos | [Vector2](#Vector2) | | thick | number | | color | [Color](#Color) | - - -## DrawLineStrip(points, pointCount, color) ⇒ undefined -Draw lines sequence - -**Kind**: global function - -| Param | Type | -| --- | --- | -| points | number | -| pointCount | number | -| color | [Color](#Color) | - ## DrawCircle(centerX, centerY, radius, color) ⇒ undefined @@ -4094,7 +4573,7 @@ Draw circle sector outline -## DrawCircleGradient(centerX, centerY, radius, color1, color2) ⇒ undefined +## DrawCircleGradient(centerX, centerY, radius, inner, outer) ⇒ undefined Draw a gradient-filled circle **Kind**: global function @@ -4104,8 +4583,8 @@ Draw a gradient-filled circle | centerX | number | | centerY | number | | radius | number | -| color1 | [Color](#Color) | -| color2 | [Color](#Color) | +| inner | [Color](#Color) | +| outer | [Color](#Color) | @@ -4134,6 +4613,19 @@ Draw circle outline | radius | number | | color | [Color](#Color) | + + +## DrawCircleLinesV(center, radius, color) ⇒ undefined +Draw circle outline (Vector version) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| center | [Vector2](#Vector2) | +| radius | number | +| color | [Color](#Color) | + ## DrawEllipse(centerX, centerY, radiusH, radiusV, color) ⇒ undefined @@ -4254,7 +4746,7 @@ Draw a color-filled rectangle with pro parameters -## DrawRectangleGradientV(posX, posY, width, height, color1, color2) ⇒ undefined +## DrawRectangleGradientV(posX, posY, width, height, top, bottom) ⇒ undefined Draw a vertical-gradient-filled rectangle **Kind**: global function @@ -4265,12 +4757,12 @@ Draw a vertical-gradient-filled rectangle | posY | number | | width | number | | height | number | -| color1 | [Color](#Color) | -| color2 | [Color](#Color) | +| top | [Color](#Color) | +| bottom | [Color](#Color) | -## DrawRectangleGradientH(posX, posY, width, height, color1, color2) ⇒ undefined +## DrawRectangleGradientH(posX, posY, width, height, left, right) ⇒ undefined Draw a horizontal-gradient-filled rectangle **Kind**: global function @@ -4281,12 +4773,12 @@ Draw a horizontal-gradient-filled rectangle | posY | number | | width | number | | height | number | -| color1 | [Color](#Color) | -| color2 | [Color](#Color) | +| left | [Color](#Color) | +| right | [Color](#Color) | -## DrawRectangleGradientEx(rec, col1, col2, col3, col4) ⇒ undefined +## DrawRectangleGradientEx(rec, topLeft, bottomLeft, topRight, bottomRight) ⇒ undefined Draw a gradient-filled rectangle with custom vertex colors **Kind**: global function @@ -4294,10 +4786,10 @@ Draw a gradient-filled rectangle with custom vertex colors | Param | Type | | --- | --- | | rec | [Rectangle](#Rectangle) | -| col1 | [Color](#Color) | -| col2 | [Color](#Color) | -| col3 | [Color](#Color) | -| col4 | [Color](#Color) | +| topLeft | [Color](#Color) | +| bottomLeft | [Color](#Color) | +| topRight | [Color](#Color) | +| bottomRight | [Color](#Color) | @@ -4343,7 +4835,21 @@ Draw rectangle with rounded edges -## DrawRectangleRoundedLines(rec, roundness, segments, lineThick, color) ⇒ undefined +## DrawRectangleRoundedLines(rec, roundness, segments, color) ⇒ undefined +Draw rectangle lines with rounded edges + +**Kind**: global function + +| Param | Type | +| --- | --- | +| rec | [Rectangle](#Rectangle) | +| roundness | number | +| segments | number | +| color | [Color](#Color) | + + + +## DrawRectangleRoundedLinesEx(rec, roundness, segments, lineThick, color) ⇒ undefined Draw rectangle with rounded edges outline **Kind**: global function @@ -4456,62 +4962,301 @@ Draw a polygon outline of n sides with extended parameters | lineThick | number | | color | [Color](#Color) | - + -## CheckCollisionRecs(rec1, rec2) ⇒ boolean -Check collision between two rectangles +## DrawSplineLinear(points, pointCount, thick, color) ⇒ undefined +Draw spline: Linear, minimum 2 points **Kind**: global function -**Returns**: boolean - The resulting bool. | Param | Type | | --- | --- | -| rec1 | [Rectangle](#Rectangle) | -| rec2 | [Rectangle](#Rectangle) | +| points | number | +| pointCount | number | +| thick | number | +| color | [Color](#Color) | - + -## CheckCollisionCircles(center1, radius1, center2, radius2) ⇒ boolean -Check collision between two circles +## DrawSplineBasis(points, pointCount, thick, color) ⇒ undefined +Draw spline: B-Spline, minimum 4 points **Kind**: global function -**Returns**: boolean - The resulting bool. | Param | Type | | --- | --- | -| center1 | [Vector2](#Vector2) | -| radius1 | number | -| center2 | [Vector2](#Vector2) | -| radius2 | number | +| points | number | +| pointCount | number | +| thick | number | +| color | [Color](#Color) | - + -## CheckCollisionCircleRec(center, radius, rec) ⇒ boolean -Check collision between circle and rectangle +## DrawSplineCatmullRom(points, pointCount, thick, color) ⇒ undefined +Draw spline: Catmull-Rom, minimum 4 points **Kind**: global function -**Returns**: boolean - The resulting bool. | Param | Type | | --- | --- | -| center | [Vector2](#Vector2) | -| radius | number | -| rec | [Rectangle](#Rectangle) | +| points | number | +| pointCount | number | +| thick | number | +| color | [Color](#Color) | - + -## CheckCollisionPointRec(point, rec) ⇒ boolean -Check if point is inside rectangle +## DrawSplineBezierQuadratic(points, pointCount, thick, color) ⇒ undefined +Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] **Kind**: global function -**Returns**: boolean - The resulting bool. | Param | Type | | --- | --- | -| point | [Vector2](#Vector2) | -| rec | [Rectangle](#Rectangle) | +| points | number | +| pointCount | number | +| thick | number | +| color | [Color](#Color) | - + + +## DrawSplineBezierCubic(points, pointCount, thick, color) ⇒ undefined +Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] + +**Kind**: global function + +| Param | Type | +| --- | --- | +| points | number | +| pointCount | number | +| thick | number | +| color | [Color](#Color) | + + + +## DrawSplineSegmentLinear(p1, p2, thick, color) ⇒ undefined +Draw spline segment: Linear, 2 points + +**Kind**: global function + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| p2 | [Vector2](#Vector2) | +| thick | number | +| color | [Color](#Color) | + + + +## DrawSplineSegmentBasis(p1, p2, p3, p4, thick, color) ⇒ undefined +Draw spline segment: B-Spline, 4 points + +**Kind**: global function + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| p2 | [Vector2](#Vector2) | +| p3 | [Vector2](#Vector2) | +| p4 | [Vector2](#Vector2) | +| thick | number | +| color | [Color](#Color) | + + + +## DrawSplineSegmentCatmullRom(p1, p2, p3, p4, thick, color) ⇒ undefined +Draw spline segment: Catmull-Rom, 4 points + +**Kind**: global function + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| p2 | [Vector2](#Vector2) | +| p3 | [Vector2](#Vector2) | +| p4 | [Vector2](#Vector2) | +| thick | number | +| color | [Color](#Color) | + + + +## DrawSplineSegmentBezierQuadratic(p1, c2, p3, thick, color) ⇒ undefined +Draw spline segment: Quadratic Bezier, 2 points, 1 control point + +**Kind**: global function + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| c2 | [Vector2](#Vector2) | +| p3 | [Vector2](#Vector2) | +| thick | number | +| color | [Color](#Color) | + + + +## DrawSplineSegmentBezierCubic(p1, c2, c3, p4, thick, color) ⇒ undefined +Draw spline segment: Cubic Bezier, 2 points, 2 control points + +**Kind**: global function + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| c2 | [Vector2](#Vector2) | +| c3 | [Vector2](#Vector2) | +| p4 | [Vector2](#Vector2) | +| thick | number | +| color | [Color](#Color) | + + + +## GetSplinePointLinear(startPos, endPos, t) ⇒ [Vector2](#Vector2) +Get (evaluate) spline point: Linear + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. + +| Param | Type | +| --- | --- | +| startPos | [Vector2](#Vector2) | +| endPos | [Vector2](#Vector2) | +| t | number | + + + +## GetSplinePointBasis(p1, p2, p3, p4, t) ⇒ [Vector2](#Vector2) +Get (evaluate) spline point: B-Spline + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| p2 | [Vector2](#Vector2) | +| p3 | [Vector2](#Vector2) | +| p4 | [Vector2](#Vector2) | +| t | number | + + + +## GetSplinePointCatmullRom(p1, p2, p3, p4, t) ⇒ [Vector2](#Vector2) +Get (evaluate) spline point: Catmull-Rom + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| p2 | [Vector2](#Vector2) | +| p3 | [Vector2](#Vector2) | +| p4 | [Vector2](#Vector2) | +| t | number | + + + +## GetSplinePointBezierQuad(p1, c2, p3, t) ⇒ [Vector2](#Vector2) +Get (evaluate) spline point: Quadratic Bezier + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| c2 | [Vector2](#Vector2) | +| p3 | [Vector2](#Vector2) | +| t | number | + + + +## GetSplinePointBezierCubic(p1, c2, c3, p4, t) ⇒ [Vector2](#Vector2) +Get (evaluate) spline point: Cubic Bezier + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. + +| Param | Type | +| --- | --- | +| p1 | [Vector2](#Vector2) | +| c2 | [Vector2](#Vector2) | +| c3 | [Vector2](#Vector2) | +| p4 | [Vector2](#Vector2) | +| t | number | + + + +## CheckCollisionRecs(rec1, rec2) ⇒ boolean +Check collision between two rectangles + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| rec1 | [Rectangle](#Rectangle) | +| rec2 | [Rectangle](#Rectangle) | + + + +## CheckCollisionCircles(center1, radius1, center2, radius2) ⇒ boolean +Check collision between two circles + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| center1 | [Vector2](#Vector2) | +| radius1 | number | +| center2 | [Vector2](#Vector2) | +| radius2 | number | + + + +## CheckCollisionCircleRec(center, radius, rec) ⇒ boolean +Check collision between circle and rectangle + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| center | [Vector2](#Vector2) | +| radius | number | +| rec | [Rectangle](#Rectangle) | + + + +## CheckCollisionCircleLine(center, radius, p1, p2) ⇒ boolean +Check if circle collides with a line created betweeen two points [p1] and [p2] + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| center | [Vector2](#Vector2) | +| radius | number | +| p1 | [Vector2](#Vector2) | +| p2 | [Vector2](#Vector2) | + + + +## CheckCollisionPointRec(point, rec) ⇒ boolean +Check if point is inside rectangle + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| point | [Vector2](#Vector2) | +| rec | [Rectangle](#Rectangle) | + + ## CheckCollisionPointCircle(point, center, radius) ⇒ boolean Check if point is inside circle @@ -4540,6 +5285,21 @@ Check if point is inside a triangle | p2 | [Vector2](#Vector2) | | p3 | [Vector2](#Vector2) | + + +## CheckCollisionPointLine(point, p1, p2, threshold) ⇒ boolean +Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| point | [Vector2](#Vector2) | +| p1 | [Vector2](#Vector2) | +| p2 | [Vector2](#Vector2) | +| threshold | number | + ## CheckCollisionPointPoly(point, points, pointCount) ⇒ boolean @@ -4570,21 +5330,6 @@ Check the collision between two lines defined by two points each, returns collis | endPos2 | [Vector2](#Vector2) | | collisionPoint | number | - - -## CheckCollisionPointLine(point, p1, p2, threshold) ⇒ boolean -Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] - -**Kind**: global function -**Returns**: boolean - The resulting bool. - -| Param | Type | -| --- | --- | -| point | [Vector2](#Vector2) | -| p1 | [Vector2](#Vector2) | -| p2 | [Vector2](#Vector2) | -| threshold | number | - ## GetCollisionRec(rec1, rec2) ⇒ [Rectangle](#Rectangle) @@ -4639,6 +5384,21 @@ Load image sequence from file (frames appended to image.data) | fileName | string | | frames | number | + + +## LoadImageAnimFromMemory(fileType, fileData, dataSize, frames) ⇒ Image +Load image sequence from memory buffer + +**Kind**: global function +**Returns**: Image - The resulting Image. + +| Param | Type | +| --- | --- | +| fileType | string | +| fileData | Buffer | +| dataSize | number | +| frames | number | + ## LoadImageFromMemory(fileType, fileData, dataSize) ⇒ Image @@ -4672,10 +5432,10 @@ Load image from screen buffer and (screenshot) **Kind**: global function **Returns**: Image - The resulting Image. - + -## IsImageReady(image) ⇒ boolean -Check if an image is ready +## IsImageValid(image) ⇒ boolean +Check if an image is valid (data and parameters) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -4708,6 +5468,20 @@ Export image data to file, returns true on success | image | Image | | fileName | string | + + +## ExportImageToMemory(image, fileType, fileSize) ⇒ Buffer +Export image to memory buffer + +**Kind**: global function +**Returns**: Buffer - The resulting unsigned char *. + +| Param | Type | +| --- | --- | +| image | Image | +| fileType | string | +| fileSize | number | + ## ExportImageAsCode(image, fileName) ⇒ boolean @@ -4735,10 +5509,10 @@ Generate image: plain color | height | number | | color | [Color](#Color) | - + -## GenImageGradientV(width, height, top, bottom) ⇒ Image -Generate image: vertical gradient +## GenImageGradientLinear(width, height, direction, start, end) ⇒ Image +Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient **Kind**: global function **Returns**: Image - The resulting Image. @@ -4747,13 +5521,14 @@ Generate image: vertical gradient | --- | --- | | width | number | | height | number | -| top | [Color](#Color) | -| bottom | [Color](#Color) | +| direction | number | +| start | [Color](#Color) | +| end | [Color](#Color) | - + -## GenImageGradientH(width, height, left, right) ⇒ Image -Generate image: horizontal gradient +## GenImageGradientRadial(width, height, density, inner, outer) ⇒ Image +Generate image: radial gradient **Kind**: global function **Returns**: Image - The resulting Image. @@ -4762,13 +5537,14 @@ Generate image: horizontal gradient | --- | --- | | width | number | | height | number | -| left | [Color](#Color) | -| right | [Color](#Color) | +| density | number | +| inner | [Color](#Color) | +| outer | [Color](#Color) | - + -## GenImageGradientRadial(width, height, density, inner, outer) ⇒ Image -Generate image: radial gradient +## GenImageGradientSquare(width, height, density, inner, outer) ⇒ Image +Generate image: square gradient **Kind**: global function **Returns**: Image - The resulting Image. @@ -4881,6 +5657,19 @@ Create an image from another image piece | image | Image | | rec | [Rectangle](#Rectangle) | + + +## ImageFromChannel(image, selectedChannel) ⇒ Image +Create an image from a selected channel of another image (GRAYSCALE) + +**Kind**: global function +**Returns**: Image - The resulting Image. + +| Param | Type | +| --- | --- | +| image | Image | +| selectedChannel | number | + ## ImageText(text, fontSize, color) ⇒ Image @@ -4923,6 +5712,31 @@ Apply Gaussian blur using a box blur approximation | image | number | | blurSize | number | + + +## ImageKernelConvolution(image, kernel, kernelSize) ⇒ undefined +Apply custom square convolution kernel to image + +**Kind**: global function + +| Param | Type | +| --- | --- | +| image | number | +| kernel | number | +| kernelSize | number | + + + +## ImageRotate(image, degrees) ⇒ undefined +Rotate image by input angle in degrees (-359 to 359) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| image | number | +| degrees | number | + ## LoadImageColors(image) ⇒ number @@ -4998,6 +5812,21 @@ Get image pixel color at (x, y) position | x | number | | y | number | + + +## ImageDrawLineEx(dst, start, end, thick, color) ⇒ undefined +Draw a line defining thickness within an image + +**Kind**: global function + +| Param | Type | +| --- | --- | +| dst | number | +| start | [Vector2](#Vector2) | +| end | [Vector2](#Vector2) | +| thick | number | +| color | [Color](#Color) | + ## ImageDrawCircleLines(dst, centerX, centerY, radius, color) ⇒ undefined @@ -5023,8 +5852,83 @@ Draw circle outline within an image (Vector version) | Param | Type | | --- | --- | | dst | number | -| center | [Vector2](#Vector2) | -| radius | number | +| center | [Vector2](#Vector2) | +| radius | number | +| color | [Color](#Color) | + + + +## ImageDrawTriangle(dst, v1, v2, v3, color) ⇒ undefined +Draw triangle within an image + +**Kind**: global function + +| Param | Type | +| --- | --- | +| dst | number | +| v1 | [Vector2](#Vector2) | +| v2 | [Vector2](#Vector2) | +| v3 | [Vector2](#Vector2) | +| color | [Color](#Color) | + + + +## ImageDrawTriangleEx(dst, v1, v2, v3, c1, c2, c3) ⇒ undefined +Draw triangle with interpolated colors within an image + +**Kind**: global function + +| Param | Type | +| --- | --- | +| dst | number | +| v1 | [Vector2](#Vector2) | +| v2 | [Vector2](#Vector2) | +| v3 | [Vector2](#Vector2) | +| c1 | [Color](#Color) | +| c2 | [Color](#Color) | +| c3 | [Color](#Color) | + + + +## ImageDrawTriangleLines(dst, v1, v2, v3, color) ⇒ undefined +Draw triangle outline within an image + +**Kind**: global function + +| Param | Type | +| --- | --- | +| dst | number | +| v1 | [Vector2](#Vector2) | +| v2 | [Vector2](#Vector2) | +| v3 | [Vector2](#Vector2) | +| color | [Color](#Color) | + + + +## ImageDrawTriangleFan(dst, points, pointCount, color) ⇒ undefined +Draw a triangle fan defined by points within an image (first vertex is the center) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| dst | number | +| points | number | +| pointCount | number | +| color | [Color](#Color) | + + + +## ImageDrawTriangleStrip(dst, points, pointCount, color) ⇒ undefined +Draw a triangle strip defined by points within an image + +**Kind**: global function + +| Param | Type | +| --- | --- | +| dst | number | +| points | number | +| pointCount | number | | color | [Color](#Color) | @@ -5077,10 +5981,10 @@ Load texture for rendering (framebuffer) | width | number | | height | number | - + -## IsTextureReady(texture) ⇒ boolean -Check if a texture is ready +## IsTextureValid(texture) ⇒ boolean +Check if a texture is valid (loaded in GPU) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -5100,10 +6004,10 @@ Unload texture from GPU memory (VRAM) | --- | --- | | texture | Texture | - + -## IsRenderTextureReady(target) ⇒ boolean -Check if a render texture is ready +## IsRenderTextureValid(target) ⇒ boolean +Check if a render texture is valid (loaded in GPU) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -5260,6 +6164,19 @@ Draws a texture (or part of it) that stretches or shrinks nicely | rotation | number | | tint | [Color](#Color) | + + +## ColorIsEqual(col1, col2) ⇒ boolean +Check if two colors are equal + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| col1 | [Color](#Color) | +| col2 | [Color](#Color) | + ## Fade(color, alpha) ⇒ [Color](#Color) @@ -5276,7 +6193,7 @@ Get color with alpha applied, alpha goes from 0.0f to 1.0f ## ColorToInt(color) ⇒ number -Get hexadecimal value for a Color +Get hexadecimal value for a Color (0xRRGGBBAA) **Kind**: global function **Returns**: number - The resulting int. @@ -5401,6 +6318,20 @@ Get src alpha-blended into dst color with tint | src | [Color](#Color) | | tint | [Color](#Color) | + + +## ColorLerp(color1, color2, factor) ⇒ [Color](#Color) +Get color lerp interpolation between two colors, factor [0.0f..1.0f] + +**Kind**: global function +**Returns**: [Color](#Color) - The resulting Color. + +| Param | Type | +| --- | --- | +| color1 | [Color](#Color) | +| color2 | [Color](#Color) | +| factor | number | + ## GetColor(hexValue) ⇒ [Color](#Color) @@ -5474,8 +6405,8 @@ Load font from file into GPU memory (VRAM) -## LoadFontEx(fileName, fontSize, fontChars, glyphCount) ⇒ Font -Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set +## LoadFontEx(fileName, fontSize, codepoints, codepointCount) ⇒ Font +Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height **Kind**: global function **Returns**: Font - The resulting Font. @@ -5484,8 +6415,8 @@ Load font from file with extended parameters, use NULL for fontChars and 0 for g | --- | --- | | fileName | string | | fontSize | number | -| fontChars | number | -| glyphCount | number | +| codepoints | number | +| codepointCount | number | @@ -5503,7 +6434,7 @@ Load font from Image (XNA style) -## LoadFontFromMemory(fileType, fileData, dataSize, fontSize, fontChars, glyphCount) ⇒ Font +## LoadFontFromMemory(fileType, fileData, dataSize, fontSize, codepoints, codepointCount) ⇒ Font Load font from memory buffer, fileType refers to extension: i.e. '.ttf' **Kind**: global function @@ -5515,13 +6446,13 @@ Load font from memory buffer, fileType refers to extension: i.e. '.ttf' | fileData | Buffer | | dataSize | number | | fontSize | number | -| fontChars | number | -| glyphCount | number | +| codepoints | number | +| codepointCount | number | - + -## IsFontReady(font) ⇒ boolean -Check if a font is ready +## IsFontValid(font) ⇒ boolean +Check if a font is valid (font data loaded, WARNING: GPU texture not checked) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -5532,7 +6463,7 @@ Check if a font is ready -## LoadFontData(fileData, dataSize, fontSize, fontChars, glyphCount, type) ⇒ number +## LoadFontData(fileData, dataSize, fontSize, codepoints, codepointCount, type) ⇒ number Load font data for further use **Kind**: global function @@ -5543,13 +6474,13 @@ Load font data for further use | fileData | Buffer | | dataSize | number | | fontSize | number | -| fontChars | number | -| glyphCount | number | +| codepoints | number | +| codepointCount | number | | type | number | -## GenImageFontAtlas(chars, recs, glyphCount, fontSize, padding, packMethod) ⇒ Image +## GenImageFontAtlas(glyphs, glyphRecs, glyphCount, fontSize, padding, packMethod) ⇒ Image Generate image font atlas using chars info **Kind**: global function @@ -5557,8 +6488,8 @@ Generate image font atlas using chars info | Param | Type | | --- | --- | -| chars | number | -| recs | number | +| glyphs | number | +| glyphRecs | number | | glyphCount | number | | fontSize | number | | padding | number | @@ -5566,14 +6497,14 @@ Generate image font atlas using chars info -## UnloadFontData(chars, glyphCount) ⇒ undefined +## UnloadFontData(glyphs, glyphCount) ⇒ undefined Unload font chars info data (RAM) **Kind**: global function | Param | Type | | --- | --- | -| chars | number | +| glyphs | number | | glyphCount | number | @@ -5678,7 +6609,7 @@ Draw one character (codepoint) -## DrawTextCodepoints(font, codepoints, count, position, fontSize, spacing, tint) ⇒ undefined +## DrawTextCodepoints(font, codepoints, codepointCount, position, fontSize, spacing, tint) ⇒ undefined Draw multiple character (codepoint) **Kind**: global function @@ -5687,12 +6618,23 @@ Draw multiple character (codepoint) | --- | --- | | font | Font | | codepoints | number | -| count | number | +| codepointCount | number | | position | [Vector2](#Vector2) | | fontSize | number | | spacing | number | | tint | [Color](#Color) | + + +## SetTextLineSpacing(spacing) ⇒ undefined +Set vertical line spacing when drawing with line-breaks + +**Kind**: global function + +| Param | Type | +| --- | --- | +| spacing | number | + ## MeasureText(text, fontSize) ⇒ number @@ -6042,6 +6984,30 @@ Get Pascal case notation version of provided string | --- | --- | | text | string | + + +## TextToSnake(text) ⇒ string +Get Snake case notation version of provided string + +**Kind**: global function +**Returns**: string - The resulting const char *. + +| Param | Type | +| --- | --- | +| text | string | + + + +## TextToCamel(text) ⇒ string +Get Camel case notation version of provided string + +**Kind**: global function +**Returns**: string - The resulting const char *. + +| Param | Type | +| --- | --- | +| text | string | + ## TextToInteger(text) ⇒ number @@ -6054,6 +7020,18 @@ Get integer value from text (negative values not supported) | --- | --- | | text | string | + + +## TextToFloat(text) ⇒ number +Get float value from text (negative values not supported) + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| text | string | + ## DrawLine3D(startPos, endPos, color) ⇒ undefined @@ -6377,10 +7355,10 @@ Load model from generated mesh (default material) | --- | --- | | mesh | Mesh | - + -## IsModelReady(model) ⇒ boolean -Check if a model is ready +## IsModelValid(model) ⇒ boolean +Check if a model is valid (loaded in GPU, VAO/VBOs) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -6472,6 +7450,36 @@ Draw a model wires (with texture if set) with extended parameters | scale | [Vector3](#Vector3) | | tint | [Color](#Color) | + + +## DrawModelPoints(model, position, scale, tint) ⇒ undefined +Draw a model as points + +**Kind**: global function + +| Param | Type | +| --- | --- | +| model | Model | +| position | [Vector3](#Vector3) | +| scale | number | +| tint | [Color](#Color) | + + + +## DrawModelPointsEx(model, position, rotationAxis, rotationAngle, scale, tint) ⇒ undefined +Draw a model as points with extended parameters + +**Kind**: global function + +| Param | Type | +| --- | --- | +| model | Model | +| position | [Vector3](#Vector3) | +| rotationAxis | [Vector3](#Vector3) | +| rotationAngle | number | +| scale | [Vector3](#Vector3) | +| tint | [Color](#Color) | + ## DrawBoundingBox(box, color) ⇒ undefined @@ -6486,7 +7494,7 @@ Draw bounding box (wires) -## DrawBillboard(camera, texture, position, size, tint) ⇒ undefined +## DrawBillboard(camera, texture, position, scale, tint) ⇒ undefined Draw a billboard texture **Kind**: global function @@ -6496,7 +7504,7 @@ Draw a billboard texture | camera | [Camera3D](#Camera3D) | | texture | Texture | | position | [Vector3](#Vector3) | -| size | number | +| scale | number | | tint | [Color](#Color) | @@ -6560,6 +7568,18 @@ Unload mesh data from CPU and GPU | --- | --- | | mesh | Mesh | + + +## GetMeshBoundingBox(mesh) ⇒ BoundingBox +Compute mesh bounding box limits + +**Kind**: global function +**Returns**: BoundingBox - The resulting BoundingBox. + +| Param | Type | +| --- | --- | +| mesh | Mesh | + ## ExportMesh(mesh, fileName) ⇒ boolean @@ -6573,17 +7593,18 @@ Export mesh data to file, returns true on success | mesh | Mesh | | fileName | string | - + -## GetMeshBoundingBox(mesh) ⇒ BoundingBox -Compute mesh bounding box limits +## ExportMeshAsCode(mesh, fileName) ⇒ boolean +Export mesh as code file (.h) defining multiple arrays of vertex attributes **Kind**: global function -**Returns**: BoundingBox - The resulting BoundingBox. +**Returns**: boolean - The resulting bool. | Param | Type | | --- | --- | | mesh | Mesh | +| fileName | string | @@ -6755,7 +7776,20 @@ Load model animations from file ## UpdateModelAnimation(model, anim, frame) ⇒ undefined -Update model animation pose +Update model animation pose (CPU) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| model | Model | +| anim | ModelAnimation | +| frame | number | + + + +## UpdateModelAnimationBones(model, anim, frame) ⇒ undefined +Update model animation mesh bone matrices (GPU skinning) **Kind**: global function @@ -6778,7 +7812,7 @@ Unload animation data -## UnloadModelAnimations(animations, count) ⇒ undefined +## UnloadModelAnimations(animations, animCount) ⇒ undefined Unload animation array data **Kind**: global function @@ -6786,7 +7820,7 @@ Unload animation array data | Param | Type | | --- | --- | | animations | number | -| count | number | +| animCount | number | @@ -6945,6 +7979,13 @@ Set master volume (listener) | --- | --- | | volume | number | + + +## GetMasterVolume() ⇒ number +Get master volume (listener) + +**Kind**: global function +**Returns**: number - The resulting float. ## LoadWave(fileName) ⇒ Wave @@ -6971,10 +8012,10 @@ Load wave from memory buffer, fileType refers to extension: i.e. '.wav' | fileData | Buffer | | dataSize | number | - + -## IsWaveReady(wave) ⇒ boolean -Checks if wave data is ready +## IsWaveValid(wave) ⇒ boolean +Checks if wave data is valid (data loaded and parameters) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -7007,10 +8048,22 @@ Load sound from wave data | --- | --- | | wave | Wave | - + + +## LoadSoundAlias(source) ⇒ Sound +Create a new sound that shares the same sample data as the source sound, does not own the sound data -## IsSoundReady(sound) ⇒ boolean -Checks if a sound is ready +**Kind**: global function +**Returns**: Sound - The resulting Sound. + +| Param | Type | +| --- | --- | +| source | Sound | + + + +## IsSoundValid(sound) ⇒ boolean +Checks if a sound is valid (data loaded and buffers initialized) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -7054,6 +8107,17 @@ Unload sound | --- | --- | | sound | Sound | + + +## UnloadSoundAlias(alias) ⇒ undefined +Unload a sound alias (does not deallocate sample data) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| alias | Sound | + ## ExportWave(wave, fileName) ⇒ boolean @@ -7233,10 +8297,10 @@ Load music stream from data | data | Buffer | | dataSize | number | - + -## IsMusicReady(music) ⇒ boolean -Checks if a music stream is ready +## IsMusicValid(music) ⇒ boolean +Checks if a music stream is valid (context and buffers initialized) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -7409,10 +8473,10 @@ Load audio stream (to stream raw audio pcm data) | sampleSize | number | | channels | number | - + -## IsAudioStreamReady(stream) ⇒ boolean -Checks if an audio stream is ready +## IsAudioStreamValid(stream) ⇒ boolean +Checks if an audio stream is valid (buffers initialized) **Kind**: global function **Returns**: boolean - The resulting bool. @@ -8011,9 +9075,9 @@ Check if gui is locked (global state) **Kind**: global function **Returns**: boolean - The resulting bool. - + -## GuiFade(alpha) ⇒ undefined +## GuiSetAlpha(alpha) ⇒ undefined Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f **Kind**: global function @@ -8084,13 +9148,112 @@ Get one style property | control | number | | property | number | + + +## GuiLoadStyle(fileName) ⇒ undefined +Load style file over global style variable (.rgs) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| fileName | string | + + + +## GuiLoadStyleDefault() ⇒ undefined +Load style default over global style + +**Kind**: global function + + +## GuiEnableTooltip() ⇒ undefined +Enable gui tooltips (global state) + +**Kind**: global function + + +## GuiDisableTooltip() ⇒ undefined +Disable gui tooltips (global state) + +**Kind**: global function + + +## GuiSetTooltip(tooltip) ⇒ undefined +Set tooltip string + +**Kind**: global function + +| Param | Type | +| --- | --- | +| tooltip | string | + + + +## GuiIconText(iconId, text) ⇒ string +Get text with icon id prepended (if supported) + +**Kind**: global function +**Returns**: string - The resulting const char *. + +| Param | Type | +| --- | --- | +| iconId | number | +| text | string | + + + +## GuiSetIconScale(scale) ⇒ undefined +Set default icon drawing size + +**Kind**: global function + +| Param | Type | +| --- | --- | +| scale | number | + + + +## GuiGetIcons() ⇒ number +Get raygui icons data pointer + +**Kind**: global function +**Returns**: number - The resulting unsigned int *. + + +## GuiLoadIcons(fileName, loadIconsName) ⇒ number +Load raygui icons file (.rgi) into internal icons data + +**Kind**: global function +**Returns**: number - The resulting char **. + +| Param | Type | +| --- | --- | +| fileName | string | +| loadIconsName | boolean | + + + +## GuiDrawIcon(iconId, posX, posY, pixelSize, color) ⇒ undefined +Draw icon using pixel size at specified position + +**Kind**: global function + +| Param | Type | +| --- | --- | +| iconId | number | +| posX | number | +| posY | number | +| pixelSize | number | +| color | [Color](#Color) | + -## GuiWindowBox(bounds, title) ⇒ boolean +## GuiWindowBox(bounds, title) ⇒ number Window Box control, shows a window that can be closed **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8099,10 +9262,11 @@ Window Box control, shows a window that can be closed -## GuiGroupBox(bounds, text) ⇒ undefined +## GuiGroupBox(bounds, text) ⇒ number Group Box control with text name **Kind**: global function +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8111,10 +9275,11 @@ Group Box control with text name -## GuiLine(bounds, text) ⇒ undefined +## GuiLine(bounds, text) ⇒ number Line separator control, could contain text **Kind**: global function +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8123,10 +9288,11 @@ Line separator control, could contain text -## GuiPanel(bounds, text) ⇒ undefined +## GuiPanel(bounds, text) ⇒ number Panel control, useful to group controls **Kind**: global function +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8150,11 +9316,11 @@ Tab Bar control, returns TAB to be closed or -1 -## GuiScrollPanel(bounds, text, content, scroll) ⇒ [Rectangle](#Rectangle) +## GuiScrollPanel(bounds, text, content, scroll, view) ⇒ number Scroll Panel control **Kind**: global function -**Returns**: [Rectangle](#Rectangle) - The resulting Rectangle. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8162,13 +9328,15 @@ Scroll Panel control | text | string | | content | [Rectangle](#Rectangle) | | scroll | number | +| view | number | -## GuiLabel(bounds, text) ⇒ undefined -Label control, shows text +## GuiLabel(bounds, text) ⇒ number +Label control **Kind**: global function +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8177,11 +9345,11 @@ Label control, shows text -## GuiButton(bounds, text) ⇒ boolean +## GuiButton(bounds, text) ⇒ number Button control, returns true when clicked **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8190,35 +9358,49 @@ Button control, returns true when clicked -## GuiLabelButton(bounds, text) ⇒ boolean -Label button control, show true when clicked +## GuiLabelButton(bounds, text) ⇒ number +Label button control, returns true when clicked + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | + + + +## GuiToggle(bounds, text, active) ⇒ number +Toggle Button control **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | | bounds | [Rectangle](#Rectangle) | | text | string | +| active | number | - + -## GuiToggle(bounds, text, active) ⇒ boolean -Toggle Button control, returns true when active +## GuiToggleGroup(bounds, text, active) ⇒ number +Toggle Group control **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | | bounds | [Rectangle](#Rectangle) | | text | string | -| active | boolean | +| active | number | - + -## GuiToggleGroup(bounds, text, active) ⇒ number -Toggle Group control, returns active toggle index +## GuiToggleSlider(bounds, text, active) ⇒ number +Toggle Slider control **Kind**: global function **Returns**: number - The resulting int. @@ -8231,22 +9413,22 @@ Toggle Group control, returns active toggle index -## GuiCheckBox(bounds, text, checked) ⇒ boolean +## GuiCheckBox(bounds, text, checked) ⇒ number Check Box control, returns true when active **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | | bounds | [Rectangle](#Rectangle) | | text | string | -| checked | boolean | +| checked | number | ## GuiComboBox(bounds, text, active) ⇒ number -Combo Box control, returns selected item index +Combo Box control **Kind**: global function **Returns**: number - The resulting int. @@ -8259,11 +9441,11 @@ Combo Box control, returns selected item index -## GuiDropdownBox(bounds, text, active, editMode) ⇒ boolean -Dropdown Box control, returns selected item +## GuiDropdownBox(bounds, text, active, editMode) ⇒ number +Dropdown Box control **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8274,11 +9456,11 @@ Dropdown Box control, returns selected item -## GuiSpinner(bounds, text, value, minValue, maxValue, editMode) ⇒ boolean -Spinner control, returns selected value +## GuiSpinner(bounds, text, value, minValue, maxValue, editMode) ⇒ number +Spinner control **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8291,11 +9473,11 @@ Spinner control, returns selected value -## GuiValueBox(bounds, text, value, minValue, maxValue, editMode) ⇒ boolean +## GuiValueBox(bounds, text, value, minValue, maxValue, editMode) ⇒ number Value Box control, updates input text with numbers **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8306,28 +9488,29 @@ Value Box control, updates input text with numbers | maxValue | number | | editMode | boolean | - + -## GuiTextBox(bounds, text, textSize, editMode) ⇒ boolean -Text Box control, updates input text +## GuiValueBoxFloat(bounds, text, textValue, value, editMode) ⇒ number +Value box control for float values **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | | bounds | [Rectangle](#Rectangle) | | text | string | -| textSize | number | +| textValue | string | +| value | number | | editMode | boolean | - + -## GuiTextBoxMulti(bounds, text, textSize, editMode) ⇒ boolean -Text Box control with multiple lines +## GuiTextBox(bounds, text, textSize, editMode) ⇒ number +Text Box control, updates input text **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8339,10 +9522,10 @@ Text Box control with multiple lines ## GuiSlider(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number -Slider control, returns selected value +Slider control **Kind**: global function -**Returns**: number - The resulting float. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8356,10 +9539,10 @@ Slider control, returns selected value ## GuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number -Slider Bar control, returns selected value +Slider Bar control **Kind**: global function -**Returns**: number - The resulting float. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8373,10 +9556,10 @@ Slider Bar control, returns selected value ## GuiProgressBar(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number -Progress Bar control, shows current progress value +Progress Bar control **Kind**: global function -**Returns**: number - The resulting float. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8389,10 +9572,11 @@ Progress Bar control, shows current progress value -## GuiStatusBar(bounds, text) ⇒ undefined +## GuiStatusBar(bounds, text) ⇒ number Status Bar control, shows info text **Kind**: global function +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8401,10 +9585,11 @@ Status Bar control, shows info text -## GuiDummyRec(bounds, text) ⇒ undefined +## GuiDummyRec(bounds, text) ⇒ number Dummy control for placeholders **Kind**: global function +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8413,11 +9598,11 @@ Dummy control for placeholders -## GuiGrid(bounds, text, spacing, subdivs) ⇒ [Vector2](#Vector2) -Grid control, returns mouse cell position +## GuiGrid(bounds, text, spacing, subdivs, mouseCell) ⇒ number +Grid control **Kind**: global function -**Returns**: [Vector2](#Vector2) - The resulting Vector2. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8425,11 +9610,12 @@ Grid control, returns mouse cell position | text | string | | spacing | number | | subdivs | number | +| mouseCell | number | ## GuiListView(bounds, text, scrollIndex, active) ⇒ number -List View control, returns selected list item index +List View control **Kind**: global function **Returns**: number - The resulting int. @@ -8443,7 +9629,7 @@ List View control, returns selected list item index -## GuiListViewEx(bounds, text, count, focus, scrollIndex, active) ⇒ number +## GuiListViewEx(bounds, text, count, scrollIndex, active, focus) ⇒ number List View with extended parameters **Kind**: global function @@ -8454,9 +9640,9 @@ List View with extended parameters | bounds | [Rectangle](#Rectangle) | | text | number | | count | number | -| focus | number | | scrollIndex | number | | active | number | +| focus | number | @@ -8493,31 +9679,31 @@ Text Input Box control, ask for text, supports secret -## GuiColorPicker(bounds, text, color) ⇒ [Color](#Color) +## GuiColorPicker(bounds, text, color) ⇒ number Color Picker control (multiple color controls) **Kind**: global function -**Returns**: [Color](#Color) - The resulting Color. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | | bounds | [Rectangle](#Rectangle) | | text | string | -| color | [Color](#Color) | +| color | number | -## GuiColorPanel(bounds, text, color) ⇒ [Color](#Color) +## GuiColorPanel(bounds, text, color) ⇒ number Color Panel control **Kind**: global function -**Returns**: [Color](#Color) - The resulting Color. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | | bounds | [Rectangle](#Rectangle) | | text | string | -| color | [Color](#Color) | +| color | number | @@ -8525,7 +9711,7 @@ Color Panel control Color Bar Alpha control **Kind**: global function -**Returns**: number - The resulting float. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8539,7 +9725,7 @@ Color Bar Alpha control Color Bar Hue control **Kind**: global function -**Returns**: number - The resulting float. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | @@ -8547,89 +9733,33 @@ Color Bar Hue control | text | string | | value | number | - - -## GuiLoadStyle(fileName) ⇒ undefined -Load style file over global style variable (.rgs) - -**Kind**: global function - -| Param | Type | -| --- | --- | -| fileName | string | - - - -## GuiLoadStyleDefault() ⇒ undefined -Load style default over global style - -**Kind**: global function - - -## GuiEnableTooltip() ⇒ undefined -Enable gui tooltips (global state) - -**Kind**: global function - - -## GuiDisableTooltip() ⇒ undefined -Disable gui tooltips (global state) - -**Kind**: global function - - -## GuiSetTooltip(tooltip) ⇒ undefined -Set tooltip string - -**Kind**: global function - -| Param | Type | -| --- | --- | -| tooltip | string | - - + -## GuiIconText(iconId, text) ⇒ string -Get text with icon id prepended (if supported) +## GuiColorPickerHSV(bounds, text, colorHsv) ⇒ number +Color Picker control that avoids conversion to RGB on each call (multiple color controls) **Kind**: global function -**Returns**: string - The resulting const char *. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | -| iconId | number | +| bounds | [Rectangle](#Rectangle) | | text | string | +| colorHsv | number | - - -## GuiGetIcons() ⇒ number -Get raygui icons data pointer - -**Kind**: global function -**Returns**: number - The resulting unsigned int *. - - -## GuiLoadIcons(fileName, loadIconsName) ⇒ number -Load raygui icons file (.rgi) into internal icons data - -**Kind**: global function -**Returns**: number - The resulting char **. - -| Param | Type | -| --- | --- | -| fileName | string | -| loadIconsName | boolean | - - + -## GuiSetIconScale(scale) ⇒ undefined -Set icon drawing size +## GuiColorPanelHSV(bounds, text, colorHsv) ⇒ number +Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV() **Kind**: global function +**Returns**: number - The resulting int. | Param | Type | | --- | --- | -| scale | number | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| colorHsv | number | @@ -8725,6 +9855,32 @@ Set the viewport area | width | number | | height | number | + + +## rlSetClipPlanes(nearPlane, farPlane) ⇒ undefined +Set clip planes distances + +**Kind**: global function + +| Param | Type | +| --- | --- | +| nearPlane | number | +| farPlane | number | + + + +## rlGetCullDistanceNear() ⇒ number +Get cull plane distance near + +**Kind**: global function +**Returns**: number - The resulting double. + + +## rlGetCullDistanceFar() ⇒ number +Get cull plane distance far + +**Kind**: global function +**Returns**: number - The resulting double. ## rlBegin(mode) ⇒ undefined @@ -9024,6 +10180,13 @@ Enable render texture (fbo) Disable render texture (fbo), return to default framebuffer **Kind**: global function + + +## rlGetActiveFramebuffer() ⇒ number +Get the currently active render texture (fbo), 0 for default framebuffer + +**Kind**: global function +**Returns**: number - The resulting unsigned int. ## rlActiveDrawBuffers(count) ⇒ undefined @@ -9035,6 +10198,37 @@ Activate multiple draw color buffers | --- | --- | | count | number | + + +## rlBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask) ⇒ undefined +Blit active framebuffer to main framebuffer + +**Kind**: global function + +| Param | Type | +| --- | --- | +| srcX | number | +| srcY | number | +| srcWidth | number | +| srcHeight | number | +| dstX | number | +| dstY | number | +| dstWidth | number | +| dstHeight | number | +| bufferMask | number | + + + +## rlBindFramebuffer(target, framebuffer) ⇒ undefined +Bind framebuffer (FBO) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| target | number | +| framebuffer | number | + ## rlEnableColorBlend() ⇒ undefined @@ -9083,6 +10277,20 @@ Enable backface culling Disable backface culling **Kind**: global function + + +## rlColorMask(r, g, b, a) ⇒ undefined +Color mask control + +**Kind**: global function + +| Param | Type | +| --- | --- | +| r | boolean | +| g | boolean | +| b | boolean | +| a | boolean | + ## rlSetCullFace(mode) ⇒ undefined @@ -9125,11 +10333,17 @@ Scissor test ## rlEnableWireMode() ⇒ undefined Enable wire mode +**Kind**: global function + + +## rlEnablePointMode() ⇒ undefined +Enable point mode + **Kind**: global function ## rlDisableWireMode() ⇒ undefined -Disable wire mode +Disable wire (and point) mode **Kind**: global function @@ -9425,7 +10639,7 @@ Load vertex array (vao) if supported ## rlLoadVertexBuffer(buffer, size, dynamic) ⇒ number -Load a vertex buffer attribute +Load a vertex buffer object **Kind**: global function **Returns**: number - The resulting unsigned int. @@ -9439,7 +10653,7 @@ Load a vertex buffer attribute ## rlLoadVertexBufferElement(buffer, size, dynamic) ⇒ number -Load a new attributes element buffer +Load vertex buffer elements object **Kind**: global function **Returns**: number - The resulting unsigned int. @@ -9453,7 +10667,7 @@ Load a new attributes element buffer ## rlUpdateVertexBuffer(bufferId, data, dataSize, offset) ⇒ undefined -Update GPU buffer with new data +Update vertex buffer object data on GPU buffer **Kind**: global function @@ -9467,7 +10681,7 @@ Update GPU buffer with new data ## rlUpdateVertexBufferElements(id, data, dataSize, offset) ⇒ undefined -Update vertex buffer elements with new data +Update vertex buffer elements data on GPU buffer **Kind**: global function @@ -9478,10 +10692,60 @@ Update vertex buffer elements with new data | dataSize | number | | offset | number | + + +## rlUnloadVertexArray(vaoId) ⇒ undefined +Unload vertex array (vao) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| vaoId | number | + + + +## rlUnloadVertexBuffer(vboId) ⇒ undefined +Unload vertex buffer object + +**Kind**: global function + +| Param | Type | +| --- | --- | +| vboId | number | + + + +## rlSetVertexAttribute(index, compSize, type, normalized, stride, offset) ⇒ undefined +Set vertex attribute data configuration + +**Kind**: global function + +| Param | Type | +| --- | --- | +| index | number | +| compSize | number | +| type | number | +| normalized | boolean | +| stride | number | +| offset | number | + + + +## rlSetVertexAttributeDivisor(index, divisor) ⇒ undefined +Set vertex attribute data divisor + +**Kind**: global function + +| Param | Type | +| --- | --- | +| index | number | +| divisor | number | + ## rlSetVertexAttributeDefault(locIndex, value, attribType, count) ⇒ undefined -Set vertex attribute default value +Set vertex attribute default value, when attribute to provided **Kind**: global function @@ -9492,10 +10756,62 @@ Set vertex attribute default value | attribType | number | | count | number | + + +## rlDrawVertexArray(offset, count) ⇒ undefined +Draw vertex array (currently active vao) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| offset | number | +| count | number | + + + +## rlDrawVertexArrayElements(offset, count, buffer) ⇒ undefined +Draw vertex array elements + +**Kind**: global function + +| Param | Type | +| --- | --- | +| offset | number | +| count | number | +| buffer | number | + + + +## rlDrawVertexArrayInstanced(offset, count, instances) ⇒ undefined +Draw vertex array (currently active vao) with instancing + +**Kind**: global function + +| Param | Type | +| --- | --- | +| offset | number | +| count | number | +| instances | number | + + + +## rlDrawVertexArrayElementsInstanced(offset, count, buffer, instances) ⇒ undefined +Draw vertex array elements with instancing + +**Kind**: global function + +| Param | Type | +| --- | --- | +| offset | number | +| count | number | +| buffer | number | +| instances | number | + ## rlLoadTexture(data, width, height, format, mipmapCount) ⇒ number -Load texture in GPU +Load texture data **Kind**: global function **Returns**: number - The resulting unsigned int. @@ -9524,8 +10840,8 @@ Load depth texture/renderbuffer (to be attached to fbo) -## rlLoadTextureCubemap(data, size, format) ⇒ number -Load texture cubemap +## rlLoadTextureCubemap(data, size, format, mipmapCount) ⇒ number +Load texture cubemap data **Kind**: global function **Returns**: number - The resulting unsigned int. @@ -9535,11 +10851,12 @@ Load texture cubemap | data | number | | size | number | | format | number | +| mipmapCount | number | ## rlUpdateTexture(id, offsetX, offsetY, width, height, format, data) ⇒ undefined -Update GPU texture with new data +Update texture with new data on GPU **Kind**: global function @@ -9635,17 +10952,11 @@ Read screen pixel data (color buffer) -## rlLoadFramebuffer(width, height) ⇒ number +## rlLoadFramebuffer() ⇒ number Load an empty framebuffer **Kind**: global function **Returns**: number - The resulting unsigned int. - -| Param | Type | -| --- | --- | -| width | number | -| height | number | - ## rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel) ⇒ undefined @@ -9786,6 +11097,19 @@ Set shader value matrix | locIndex | number | | mat | Matrix | + + +## rlSetUniformMatrices(locIndex, mat, count) ⇒ undefined +Set shader value matrices + +**Kind**: global function + +| Param | Type | +| --- | --- | +| locIndex | number | +| mat | number | +| count | number | + ## rlSetUniformSampler(locIndex, textureId) ⇒ undefined @@ -10575,16 +11899,16 @@ Set material for a mesh -## WaveCrop(wave, initSample, finalSample) ⇒ undefined -Crop a wave to defined samples range +## WaveCrop(wave, initFrame, finalFrame) ⇒ undefined +Crop a wave to defined frames range **Kind**: global function | Param | Type | | --- | --- | | wave | Wave | -| initSample | number | -| finalSample | number | +| initFrame | number | +| finalFrame | number | diff --git a/drm/index.js b/drm/index.js index 92999b9..2d46217 100644 --- a/drm/index.js +++ b/drm/index.js @@ -5,7 +5,7 @@ */ const raylib = require('../src/generated/node-raylib-drm') -const { format } = require('util') +const { format } = require('node:util') // Constants raylib.MAX_GAMEPADS = 4 diff --git a/examples/audio/audio_module_playing.js b/examples/audio/audio_module_playing.js index ae06e33..3a00b08 100644 --- a/examples/audio/audio_module_playing.js +++ b/examples/audio/audio_module_playing.js @@ -10,7 +10,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') const MAX_CIRCLES = 64 diff --git a/examples/audio/audio_multichannel_sound.js b/examples/audio/audio_multichannel_sound.js index 398e01b..e42593a 100644 --- a/examples/audio/audio_multichannel_sound.js +++ b/examples/audio/audio_multichannel_sound.js @@ -11,8 +11,8 @@ * ********************************************************************************************/ -const r = require('raylib') -const { join } = require('path') +const r = require('../../index.js') +const { join } = require('node:path') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/audio/audio_music_stream.js b/examples/audio/audio_music_stream.js index 10b920f..43bcad6 100644 --- a/examples/audio/audio_music_stream.js +++ b/examples/audio/audio_music_stream.js @@ -9,8 +9,8 @@ * ********************************************************************************************/ -const r = require('raylib') -const { join } = require('path') +const r = require('../../index.js') +const { join } = require('node:path') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/audio/audio_raw_stream.js b/examples/audio/audio_raw_stream.js index e2a16c3..9c981b2 100644 --- a/examples/audio/audio_raw_stream.js +++ b/examples/audio/audio_raw_stream.js @@ -12,7 +12,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') function memcpy (src, srcOffset, dst, dstOffset, length) { let i diff --git a/examples/audio/audio_sound_loading.js b/examples/audio/audio_sound_loading.js index 4973f10..10c3b77 100644 --- a/examples/audio/audio_sound_loading.js +++ b/examples/audio/audio_sound_loading.js @@ -9,8 +9,8 @@ * ********************************************************************************************/ -const r = require('raylib') -const { join } = require('path') +const r = require('../../index.js') +const { join } = require('node:path') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/core/core_2d_camera.js b/examples/core/core_2d_camera.js index ec3d3a4..fb7a2b3 100644 --- a/examples/core/core_2d_camera.js +++ b/examples/core/core_2d_camera.js @@ -1,136 +1,158 @@ /******************************************************************************************* -* -* raylib [core] example - 2d camera -* -* This example has been created using raylib 1.5 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2016 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ + * + * raylib [core] example - 2d camera + * + * This example has been created using raylib 1.5 (www.raylib.com) + * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) + * + * Copyright (c) 2016 Ramon Santamaria (@raysan5) + * + ********************************************************************************************/ -const r = require('raylib') +const r = require("../../index.js"); -const MAX_BUILDINGS = 100 +const MAX_BUILDINGS = 100; // Initialization // -------------------------------------------------------------------------------------- -const screenWidth = 800 -const screenHeight = 450 +const screenWidth = 800; +const screenHeight = 450; -r.InitWindow(screenWidth, screenHeight, 'raylib [core] example - 2d camera') +r.InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera"); -const player = r.Rectangle(400, 280, 40, 40) -const buildings = [] -const buildColors = [] +const player = r.Rectangle(400, 280, 40, 40); +const buildings = []; +const buildColors = []; -let spacing = 0 +let spacing = 0; for (let i = 0; i < MAX_BUILDINGS; i++) { - const height = r.GetRandomValue(100, 800) + const height = r.GetRandomValue(100, 800); const newBuilding = r.Rectangle( -6000 + spacing, screenHeight - 130 - height, r.GetRandomValue(50, 200), height - ) - spacing += newBuilding.width - buildings.push(newBuilding) - buildColors.push(r.Color(r.GetRandomValue(200, 240), r.GetRandomValue(200, 240), r.GetRandomValue(200, 250), 255)) + ); + spacing += newBuilding.width; + buildings.push(newBuilding); + buildColors.push( + r.Color( + r.GetRandomValue(200, 240), + r.GetRandomValue(200, 240), + r.GetRandomValue(200, 250), + 255 + ) + ); } const camera = r.Camera2D( r.Vector2(screenWidth / 2, screenHeight / 2), r.Vector2(player.x + 20, player.y + 20), - 0, 1) + 0, + 1 +); -r.SetTargetFPS(60) // Set our game to run at 60 frames-per-second +r.SetTargetFPS(60); // Set our game to run at 60 frames-per-second // -------------------------------------------------------------------------------------- // Main game loop -while (!r.WindowShouldClose()) { // Detect window close button or ESC key +while (!r.WindowShouldClose()) { + // Detect window close button or ESC key // Update // ---------------------------------------------------------------------------------- if (r.IsKeyDown(r.KEY_RIGHT)) { - player.x += 2 // Player movement - camera.offset.x -= 2 // Camera displacement with player movement + player.x += 2; // Player movement + camera.offset.x -= 2; // Camera displacement with player movement } else if (r.IsKeyDown(r.KEY_LEFT)) { - player.x -= 2 // Player movement - camera.offset.x += 2 // Camera displacement with player movement + player.x -= 2; // Player movement + camera.offset.x += 2; // Camera displacement with player movement } // Camera target follows player - camera.target = r.Vector2(player.x + 20, player.y + 20) + camera.target = r.Vector2(player.x + 20, player.y + 20); // Camera rotation controls if (r.IsKeyDown(r.KEY_A)) { - camera.rotation-- + camera.rotation--; } else if (r.IsKeyDown(r.KEY_S)) { - camera.rotation++ + camera.rotation++; } // Limit camera rotation to 80 degrees (-40 to 40) if (camera.rotation > 40) { - camera.rotation = 40 + camera.rotation = 40; } else if (camera.rotation < -40) { - camera.rotation = -40 + camera.rotation = -40; } // Camera zoom controls - camera.zoom += r.GetMouseWheelMove() * 0.05 + camera.zoom += r.GetMouseWheelMove() * 0.05; - if (camera.zoom > 3) camera.zoom = 3 - else if (camera.zoom < 0.1) camera.zoom = 0.1 + if (camera.zoom > 3) camera.zoom = 3; + else if (camera.zoom < 0.1) camera.zoom = 0.1; // Camera reset (zoom and rotation) if (r.IsKeyPressed(r.KEY_R)) { - camera.zoom = 1.0 - camera.rotation = 0 + camera.zoom = 1.0; + camera.rotation = 0; } // ---------------------------------------------------------------------------------- // Draw // ---------------------------------------------------------------------------------- - r.BeginDrawing() + r.BeginDrawing(); - r.ClearBackground(r.RAYWHITE) + r.ClearBackground(r.RAYWHITE); - r.BeginMode2D(camera) + r.BeginMode2D(camera); - r.DrawRectangle(-6000, 320, 13000, 8000, r.DARKGRAY) + r.DrawRectangle(-6000, 320, 13000, 8000, r.DARKGRAY); for (let i = 0; i < MAX_BUILDINGS; i++) { - r.DrawRectangleRec(buildings[i], buildColors[i]) + r.DrawRectangleRec(buildings[i], buildColors[i]); } - r.DrawRectangleRec(player, r.RED) - - r.DrawLine(camera.target.x, -screenHeight * 10, camera.target.x, screenHeight * 10, r.GREEN) - r.DrawLine(-screenWidth * 10, camera.target.y, screenWidth * 10, camera.target.y, r.GREEN) - - r.EndMode2D() - - r.DrawText('SCREEN AREA', 640, 10, 20, r.RED) - - r.DrawRectangle(0, 0, screenWidth, 5, r.RED) - r.DrawRectangle(0, 5, 5, screenHeight - 10, r.RED) - r.DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, r.RED) - r.DrawRectangle(0, screenHeight - 5, screenWidth, 5, r.RED) - - r.DrawRectangle(10, 10, 250, 113, r.Fade(r.SKYBLUE, 0.5)) - r.DrawRectangleLines(10, 10, 250, 113, r.BLUE) - - r.DrawText('Free 2d camera controls:', 20, 20, 10, r.BLACK) - r.DrawText('- Right/Left to move Offset', 40, 40, 10, r.DARKGRAY) - r.DrawText('- Mouse Wheel to Zoom in-out', 40, 60, 10, r.DARKGRAY) - r.DrawText('- A / S to Rotate', 40, 80, 10, r.DARKGRAY) - r.DrawText('- R to reset Zoom and Rotation', 40, 100, 10, r.DARKGRAY) - - r.EndDrawing() + r.DrawRectangleRec(player, r.RED); + + r.DrawLine( + camera.target.x, + -screenHeight * 10, + camera.target.x, + screenHeight * 10, + r.GREEN + ); + r.DrawLine( + -screenWidth * 10, + camera.target.y, + screenWidth * 10, + camera.target.y, + r.GREEN + ); + + r.EndMode2D(); + + r.DrawText("SCREEN AREA", 640, 10, 20, r.RED); + + r.DrawRectangle(0, 0, screenWidth, 5, r.RED); + r.DrawRectangle(0, 5, 5, screenHeight - 10, r.RED); + r.DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, r.RED); + r.DrawRectangle(0, screenHeight - 5, screenWidth, 5, r.RED); + + r.DrawRectangle(10, 10, 250, 113, r.Fade(r.SKYBLUE, 0.5)); + r.DrawRectangleLines(10, 10, 250, 113, r.BLUE); + + r.DrawText("Free 2d camera controls:", 20, 20, 10, r.BLACK); + r.DrawText("- Right/Left to move Offset", 40, 40, 10, r.DARKGRAY); + r.DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, r.DARKGRAY); + r.DrawText("- A / S to Rotate", 40, 80, 10, r.DARKGRAY); + r.DrawText("- R to reset Zoom and Rotation", 40, 100, 10, r.DARKGRAY); + + r.EndDrawing(); // ---------------------------------------------------------------------------------- } // De-Initialization // -------------------------------------------------------------------------------------- -r.CloseWindow() // Close window and OpenGL context +r.CloseWindow(); // Close window and OpenGL context // -------------------------------------------------------------------------------------- diff --git a/examples/core/core_3d_camera_first_person.js b/examples/core/core_3d_camera_first_person.js index 626ae42..b854066 100644 --- a/examples/core/core_3d_camera_first_person.js +++ b/examples/core/core_3d_camera_first_person.js @@ -9,7 +9,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') const MAX_COLUMNS = 20 diff --git a/examples/core/core_3d_camera_mode.js b/examples/core/core_3d_camera_mode.js index 788ba43..679a113 100644 --- a/examples/core/core_3d_camera_mode.js +++ b/examples/core/core_3d_camera_mode.js @@ -9,7 +9,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/core/core_basic_window.js b/examples/core/core_basic_window.js index b70d01e..ccf26fc 100644 --- a/examples/core/core_basic_window.js +++ b/examples/core/core_basic_window.js @@ -8,7 +8,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/core/core_input_mouse.js b/examples/core/core_input_mouse.js index 95c0ce8..0cf5a6d 100644 --- a/examples/core/core_input_mouse.js +++ b/examples/core/core_input_mouse.js @@ -9,7 +9,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/core/core_random_values.js b/examples/core/core_random_values.js index a4ac18a..67f092c 100644 --- a/examples/core/core_random_values.js +++ b/examples/core/core_random_values.js @@ -9,7 +9,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/core/core_split_screen.js b/examples/core/core_split_screen.js index 82b8a86..b2503c6 100644 --- a/examples/core/core_split_screen.js +++ b/examples/core/core_split_screen.js @@ -11,7 +11,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') function InitCamera () { return { diff --git a/examples/core/core_vr_simulator.js b/examples/core/core_vr_simulator.js index 9318a1f..aca727a 100644 --- a/examples/core/core_vr_simulator.js +++ b/examples/core/core_vr_simulator.js @@ -9,8 +9,8 @@ * ********************************************************************************************/ -const r = require('raylib') -const { join } = require('path') +const r = require('../../index.js') +const { join } = require('node:path') // #if defined(PLATFORM_DESKTOP) const GLSL_VERSION = 330 diff --git a/examples/core/core_world_screen.js b/examples/core/core_world_screen.js index b95c6d4..d4bfd6c 100644 --- a/examples/core/core_world_screen.js +++ b/examples/core/core_world_screen.js @@ -9,7 +9,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/models/models_rlgl_solar_system.js b/examples/models/models_rlgl_solar_system.js index cc2aa0d..db2b2a4 100644 --- a/examples/models/models_rlgl_solar_system.js +++ b/examples/models/models_rlgl_solar_system.js @@ -13,7 +13,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // ------------------------------------------------------------------------------------ // Module Functions Declaration // ------------------------------------------------------------------------------------ diff --git a/examples/others/easings_testbed.js b/examples/others/easings_testbed.js index ee24671..c285eae 100644 --- a/examples/others/easings_testbed.js +++ b/examples/others/easings_testbed.js @@ -11,8 +11,7 @@ * Ported to javascript 2022 by David Konsumer (@konsumer) * ********************************************************************************************/ - -const r = require('raylib') +const r = require('../../index.js') const FONT_SIZE = 20 diff --git a/examples/raw/bunnymark.js b/examples/raw/bunnymark.js index 061dacf..22d66df 100644 --- a/examples/raw/bunnymark.js +++ b/examples/raw/bunnymark.js @@ -1,7 +1,7 @@ // performance test of drawing a bunch of bunnies with current code const r = require('../../index.js') -const { join } = require('path') +const { join } = require('node:path') const MAX_BUNNIES = 1000000 diff --git a/examples/raygui/raygui_basic_window.js b/examples/raygui/raygui_basic_window.js index 0163d35..46c162b 100644 --- a/examples/raygui/raygui_basic_window.js +++ b/examples/raygui/raygui_basic_window.js @@ -7,8 +7,7 @@ * Copyright (c) 2022 Rob Loach (@RobLoach) * ********************************************************************************************/ - -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/shaders/shaders_and_uniforms.js b/examples/shaders/shaders_and_uniforms.js index 784b7b1..7d974e8 100644 --- a/examples/shaders/shaders_and_uniforms.js +++ b/examples/shaders/shaders_and_uniforms.js @@ -3,9 +3,9 @@ * raylib [shaders] example - Drawing textures with an effective shader * ********************************************************************************************/ -const { readFileSync } = require('fs') -const { resolve, join } = require('path') -const r = require('raylib') +const r = require('../../index.js') +const { readFileSync } = require('node:fs') +const { resolve, join } = require('node:path') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/shapes/shapes_basic_shapes.js b/examples/shapes/shapes_basic_shapes.js index 138748a..70562ea 100644 --- a/examples/shapes/shapes_basic_shapes.js +++ b/examples/shapes/shapes_basic_shapes.js @@ -9,7 +9,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/shapes/shapes_easings_ball_anim.js b/examples/shapes/shapes_easings_ball_anim.js index 9b262d2..8d9a8a5 100644 --- a/examples/shapes/shapes_easings_ball_anim.js +++ b/examples/shapes/shapes_easings_ball_anim.js @@ -9,7 +9,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/shapes/shapes_logo_raylib.js b/examples/shapes/shapes_logo_raylib.js index 9078eb4..36d0ec4 100644 --- a/examples/shapes/shapes_logo_raylib.js +++ b/examples/shapes/shapes_logo_raylib.js @@ -9,7 +9,7 @@ * ********************************************************************************************/ -const r = require('raylib') +const r = require('../../index.js') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/text/text_font_drawtextrec.js b/examples/text/text_font_drawtextrec.js index 75cb764..096ceff 100644 --- a/examples/text/text_font_drawtextrec.js +++ b/examples/text/text_font_drawtextrec.js @@ -12,7 +12,7 @@ // Initialization // -------------------------------------------------------------------------------------- -const r = require('raylib') +const r = require('../../index.js') const rec = r.Rectangle(100, 100, 500, 500) diff --git a/examples/text/text_font_loading.js b/examples/text/text_font_loading.js index bef40c2..22ae154 100644 --- a/examples/text/text_font_loading.js +++ b/examples/text/text_font_loading.js @@ -18,8 +18,8 @@ * ********************************************************************************************/ -const r = require('raylib') -const { join } = require('path') +const r = require('../../index.js') +const { join } = require('node:path') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/textures/textures_bunnymark.js b/examples/textures/textures_bunnymark.js index 8cc24a2..a31395e 100644 --- a/examples/textures/textures_bunnymark.js +++ b/examples/textures/textures_bunnymark.js @@ -1,7 +1,7 @@ // performance test of drawing a bunch of bunnies with current code -const r = require('raylib') -const { join } = require('path') +const r = require('../../index.js') +const { join } = require('node:path') const MAX_BUNNIES = 1000000 diff --git a/examples/textures/textures_from_memory.js b/examples/textures/textures_from_memory.js index 49143ed..b699ed8 100644 --- a/examples/textures/textures_from_memory.js +++ b/examples/textures/textures_from_memory.js @@ -9,9 +9,9 @@ * ********************************************************************************************/ -const r = require('raylib') -const { resolve } = require('path') -const { readFileSync } = require('fs') +const r = require('../../index.js') +const { resolve } = require('node:path') +const { readFileSync } = require('node:fs') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/textures/textures_image_loading.js b/examples/textures/textures_image_loading.js index a580f47..d55748a 100644 --- a/examples/textures/textures_image_loading.js +++ b/examples/textures/textures_image_loading.js @@ -11,8 +11,8 @@ * ********************************************************************************************/ -const r = require('raylib') -const { join } = require('path') +const r = require('../../index.js') +const { join } = require('node:path') // Initialization // -------------------------------------------------------------------------------------- diff --git a/examples/textures/textures_logo_raylib.js b/examples/textures/textures_logo_raylib.js index e3728b9..6af3894 100644 --- a/examples/textures/textures_logo_raylib.js +++ b/examples/textures/textures_logo_raylib.js @@ -9,8 +9,8 @@ * ********************************************************************************************/ -const r = require('raylib') -const { join } = require('path') +const r = require('../../index.js') +const { join } = require('node:path') // Initialization // -------------------------------------------------------------------------------------- diff --git a/index.js b/index.js index bedf39c..11ce42e 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ */ const raylib = require('./src/generated/node-raylib') -const { format } = require('util') +const { format } = require('node:util') // Constants raylib.MAX_GAMEPADS = 4 diff --git a/package-lock.json b/package-lock.json index 6ed9173..b2578b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "raylib", - "version": "0.14.0", + "version": "0.20.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "raylib", - "version": "0.14.0", + "version": "0.20.0", "hasInstallScript": true, "license": "Zlib", "dependencies": { @@ -17,7 +17,7 @@ "raylib": "bin/node-raylib" }, "devDependencies": { - "@raylib/api": "~4.5.0", + "@raylib/api": "5.5.0", "@vitest/ui": "^0.29.7", "archiver": "^5.3.1", "jsdoc-to-markdown": "^8.0.0", @@ -630,10 +630,11 @@ "dev": true }, "node_modules/@raylib/api": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@raylib/api/-/api-4.5.0.tgz", - "integrity": "sha512-T2jRHIHV2QNERbqgZFPkRGtyAnLDXSd3jOEV7SKIORcHp40k4W/pbqbscIsdF+LfC3e9dmilgNTRRGkJafo3Tg==", - "dev": true + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@raylib/api/-/api-5.5.0.tgz", + "integrity": "sha512-raBAGXlhbMqScDhq1j1iYpuOhWilJi+42mrYcqb7NPE+cH0bi7zDv1J9p7E3Q6b1IB4xfAIaHGJSkgavgl7shg==", + "dev": true, + "license": "Zlib" }, "node_modules/@types/chai": { "version": "4.3.4", @@ -6546,9 +6547,9 @@ "dev": true }, "@raylib/api": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@raylib/api/-/api-4.5.0.tgz", - "integrity": "sha512-T2jRHIHV2QNERbqgZFPkRGtyAnLDXSd3jOEV7SKIORcHp40k4W/pbqbscIsdF+LfC3e9dmilgNTRRGkJafo3Tg==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@raylib/api/-/api-5.5.0.tgz", + "integrity": "sha512-raBAGXlhbMqScDhq1j1iYpuOhWilJi+42mrYcqb7NPE+cH0bi7zDv1J9p7E3Q6b1IB4xfAIaHGJSkgavgl7shg==", "dev": true }, "@types/chai": { diff --git a/package.json b/package.json index d4cbb3a..5a9f035 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "raylib", - "version": "0.14.0", - "description": "Node.js bindings for raylib.", + "version": "0.20.0", + "description": "Node.js bindings for raylib 5.5", "main": "index.js", "types": "src/generated/node-raylib.d.ts", "scripts": { @@ -22,7 +22,7 @@ "gen:code": "node tools/generate.js", "gen:docs": "jsdoc2md > docs/API.md" }, - "repository": "github:RobLoach/node-raylib", + "repository": "RobLoach/node-raylib", "engines": { "node": ">=10" }, @@ -43,6 +43,10 @@ { "name": "twuky", "url": "http://tuckie.zone" + }, + { + "name": "The 99's Puppycat", + "url": "https://github.com/huyhoang160593" } ], "license": "Zlib", @@ -66,7 +70,7 @@ "module-alias": "^2.2.2" }, "devDependencies": { - "@raylib/api": "~4.5.0", + "@raylib/api": "5.5.0", "@vitest/ui": "^0.29.7", "archiver": "^5.3.1", "jsdoc-to-markdown": "^8.0.0", diff --git a/src/extras/raygui.h b/src/extras/raygui.h index 833725d..e5bacb1 100644 --- a/src/extras/raygui.h +++ b/src/extras/raygui.h @@ -1,32 +1,55 @@ /******************************************************************************************* * -* raygui v3.5-dev - A simple and easy-to-use immediate-mode gui library +* raygui v4.5-dev - A simple and easy-to-use immediate-mode gui library * * DESCRIPTION: +* raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also +* available as a standalone library, as long as input and drawing functions are provided. * -* raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also -* available as a standalone library, as long as input and drawing functions are provided. +* FEATURES: +* - Immediate-mode gui, minimal retained data +* - +25 controls provided (basic and advanced) +* - Styling system for colors, font and metrics +* - Icons supported, embedded as a 1-bit icons pack +* - Standalone mode option (custom input/graphics backend) +* - Multiple support tools provided for raygui development * -* Controls provided: +* POSSIBLE IMPROVEMENTS: +* - Better standalone mode API for easy plug of custom backends +* - Externalize required inputs, allow user easier customization * -* # Container/separators Controls +* LIMITATIONS: +* - No editable multi-line word-wraped text box supported +* - No auto-layout mechanism, up to the user to define controls position and size +* - Standalone mode requires library modification and some user work to plug another backend +* +* NOTES: +* - WARNING: GuiLoadStyle() and GuiLoadStyle{Custom}() functions, allocate memory for +* font atlas recs and glyphs, freeing that memory is (usually) up to the user, +* no unload function is explicitly provided... but note that GuiLoadStyleDefault() unloads +* by default any previously loaded font (texture, recs, glyphs). +* - Global UI alpha (guiAlpha) is applied inside GuiDrawRectangle() and GuiDrawText() functions +* +* CONTROLS PROVIDED: +* # Container/separators Controls * - WindowBox --> StatusBar, Panel * - GroupBox --> Line * - Line * - Panel --> StatusBar * - ScrollPanel --> StatusBar +* - TabBar --> Button * -* # Basic Controls +* # Basic Controls * - Label -* - Button * - LabelButton --> Label +* - Button * - Toggle * - ToggleGroup --> Toggle +* - ToggleSlider * - CheckBox * - ComboBox * - DropdownBox * - TextBox -* - TextBoxMulti * - ValueBox --> TextBox * - Spinner --> Button, ValueBox * - Slider @@ -36,88 +59,159 @@ * - DummyRec * - Grid * -* # Advance Controls +* # Advance Controls * - ListView * - ColorPicker --> ColorPanel, ColorBarHue * - MessageBox --> Window, Label, Button * - TextInputBox --> Window, Label, TextBox, Button * -* It also provides a set of functions for styling the controls based on its properties (size, color). +* It also provides a set of functions for styling the controls based on its properties (size, color). * * * RAYGUI STYLE (guiStyle): +* raygui uses a global data array for all gui style properties (allocated on data segment by default), +* when a new style is loaded, it is loaded over the global style... but a default gui style could always be +* recovered with GuiLoadStyleDefault() function, that overwrites the current style to the default one * -* raygui uses a global data array for all gui style properties (allocated on data segment by default), -* when a new style is loaded, it is loaded over the global style... but a default gui style could always be -* recovered with GuiLoadStyleDefault() function, that overwrites the current style to the default one +* The global style array size is fixed and depends on the number of controls and properties: * -* The global style array size is fixed and depends on the number of controls and properties: +* static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)]; * -* static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)]; +* guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB * -* guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB +* Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style +* used for all controls, when any of those base values is set, it is automatically populated to all +* controls, so, specific control values overwriting generic style should be set after base values. * -* Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style -* used for all controls, when any of those base values is set, it is automatically populated to all -* controls, so, specific control values overwriting generic style should be set after base values. +* After the first BASE set we have the EXTENDED properties (by default guiStyle[16..23]), those +* properties are actually common to all controls and can not be overwritten individually (like BASE ones) +* Some of those properties are: TEXT_SIZE, TEXT_SPACING, LINE_COLOR, BACKGROUND_COLOR * -* After the first BASE set we have the EXTENDED properties (by default guiStyle[16..23]), those -* properties are actually common to all controls and can not be overwritten individually (like BASE ones) -* Some of those properties are: TEXT_SIZE, TEXT_SPACING, LINE_COLOR, BACKGROUND_COLOR +* Custom control properties can be defined using the EXTENDED properties for each independent control. * -* Custom control properties can be defined using the EXTENDED properties for each independent control. -* -* TOOL: rGuiStyler is a visual tool to customize raygui style. +* TOOL: rGuiStyler is a visual tool to customize raygui style: github.com/raysan5/rguistyler * * * RAYGUI ICONS (guiIcons): +* raygui could use a global array containing icons data (allocated on data segment by default), +* a custom icons set could be loaded over this array using GuiLoadIcons(), but loaded icons set +* must be same RAYGUI_ICON_SIZE and no more than RAYGUI_ICON_MAX_ICONS will be loaded * -* raygui could use a global array containing icons data (allocated on data segment by default), -* a custom icons set could be loaded over this array using GuiLoadIcons(), but loaded icons set -* must be same RAYGUI_ICON_SIZE and no more than RAYGUI_ICON_MAX_ICONS will be loaded +* Every icon is codified in binary form, using 1 bit per pixel, so, every 16x16 icon +* requires 8 integers (16*16/32) to be stored in memory. * -* Every icon is codified in binary form, using 1 bit per pixel, so, every 16x16 icon -* requires 8 integers (16*16/32) to be stored in memory. +* When the icon is draw, actually one quad per pixel is drawn if the bit for that pixel is set. * -* When the icon is draw, actually one quad per pixel is drawn if the bit for that pixel is set. +* The global icons array size is fixed and depends on the number of icons and size: * -* The global icons array size is fixed and depends on the number of icons and size: +* static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS]; * -* static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS]; +* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB * -* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB +* TOOL: rGuiIcons is a visual tool to customize/create raygui icons: github.com/raysan5/rguiicons * -* TOOL: rGuiIcons is a visual tool to customize raygui icons and create new ones. +* RAYGUI LAYOUT: +* raygui currently does not provide an auto-layout mechanism like other libraries, +* layouts must be defined manually on controls drawing, providing the right bounds Rectangle for it. * +* TOOL: rGuiLayout is a visual tool to create raygui layouts: github.com/raysan5/rguilayout * * CONFIGURATION: +* #define RAYGUI_IMPLEMENTATION +* Generates the implementation of the library into the included file. +* If not defined, the library is in header only mode and can be included in other headers +* or source files without problems. But only ONE file should hold the implementation. * -* #define RAYGUI_IMPLEMENTATION -* Generates the implementation of the library into the included file. -* If not defined, the library is in header only mode and can be included in other headers -* or source files without problems. But only ONE file should hold the implementation. +* #define RAYGUI_STANDALONE +* Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined +* internally in the library and input management and drawing functions must be provided by +* the user (check library implementation for further details). * -* #define RAYGUI_STANDALONE -* Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined -* internally in the library and input management and drawing functions must be provided by -* the user (check library implementation for further details). +* #define RAYGUI_NO_ICONS +* Avoid including embedded ricons data (256 icons, 16x16 pixels, 1-bit per pixel, 2KB) * -* #define RAYGUI_NO_ICONS -* Avoid including embedded ricons data (256 icons, 16x16 pixels, 1-bit per pixel, 2KB) +* #define RAYGUI_CUSTOM_ICONS +* Includes custom ricons.h header defining a set of custom icons, +* this file can be generated using rGuiIcons tool * -* #define RAYGUI_CUSTOM_ICONS -* Includes custom ricons.h header defining a set of custom icons, -* this file can be generated using rGuiIcons tool +* #define RAYGUI_DEBUG_RECS_BOUNDS +* Draw control bounds rectangles for debug * +* #define RAYGUI_DEBUG_TEXT_BOUNDS +* Draw text bounds rectangles for debug * * VERSIONS HISTORY: -* 3.5 (xx-xxx-2022) ADDED: Multiple new icons, useful for code editing tools -* ADDED: GuiTabBar(), based on GuiToggle() +* 4.5-dev (Sep-2024) Current dev version... +* ADDED: guiControlExclusiveMode and guiControlExclusiveRec for exclusive modes +* ADDED: GuiValueBoxFloat() +* ADDED: GuiDropdonwBox() properties: DROPDOWN_ARROW_HIDDEN, DROPDOWN_ROLL_UP +* ADDED: GuiListView() property: LIST_ITEMS_BORDER_WIDTH +* ADDED: Multiple new icons +* REVIEWED: GuiTabBar(), close tab with mouse middle button +* REVIEWED: GuiScrollPanel(), scroll speed proportional to content +* REVIEWED: GuiDropdownBox(), support roll up and hidden arrow +* REVIEWED: GuiTextBox(), cursor position initialization +* REVIEWED: GuiSliderPro(), control value change check +* REVIEWED: GuiGrid(), simplified implementation +* REVIEWED: GuiIconText(), increase buffer size and reviewed padding +* REVIEWED: GuiDrawText(), improved wrap mode drawing +* REVIEWED: GuiScrollBar(), minor tweaks +* REVIEWED: Functions descriptions, removed wrong return value reference +* REDESIGNED: GuiColorPanel(), improved HSV <-> RGBA convertion +* +* 4.0 (12-Sep-2023) ADDED: GuiToggleSlider() +* ADDED: GuiColorPickerHSV() and GuiColorPanelHSV() +* ADDED: Multiple new icons, mostly compiler related +* ADDED: New DEFAULT properties: TEXT_LINE_SPACING, TEXT_ALIGNMENT_VERTICAL, TEXT_WRAP_MODE +* ADDED: New enum values: GuiTextAlignment, GuiTextAlignmentVertical, GuiTextWrapMode +* ADDED: Support loading styles with custom font charset from external file +* REDESIGNED: GuiTextBox(), support mouse cursor positioning +* REDESIGNED: GuiDrawText(), support multiline and word-wrap modes (read only) +* REDESIGNED: GuiProgressBar() to be more visual, progress affects border color +* REDESIGNED: Global alpha consideration moved to GuiDrawRectangle() and GuiDrawText() +* REDESIGNED: GuiScrollPanel(), get parameters by reference and return result value +* REDESIGNED: GuiToggleGroup(), get parameters by reference and return result value +* REDESIGNED: GuiComboBox(), get parameters by reference and return result value +* REDESIGNED: GuiCheckBox(), get parameters by reference and return result value +* REDESIGNED: GuiSlider(), get parameters by reference and return result value +* REDESIGNED: GuiSliderBar(), get parameters by reference and return result value +* REDESIGNED: GuiProgressBar(), get parameters by reference and return result value +* REDESIGNED: GuiListView(), get parameters by reference and return result value +* REDESIGNED: GuiColorPicker(), get parameters by reference and return result value +* REDESIGNED: GuiColorPanel(), get parameters by reference and return result value +* REDESIGNED: GuiColorBarAlpha(), get parameters by reference and return result value +* REDESIGNED: GuiColorBarHue(), get parameters by reference and return result value +* REDESIGNED: GuiGrid(), get parameters by reference and return result value +* REDESIGNED: GuiGrid(), added extra parameter +* REDESIGNED: GuiListViewEx(), change parameters order +* REDESIGNED: All controls return result as int value +* REVIEWED: GuiScrollPanel() to avoid smallish scroll-bars +* REVIEWED: All examples and specially controls_test_suite +* RENAMED: gui_file_dialog module to gui_window_file_dialog +* UPDATED: All styles to include ISO-8859-15 charset (as much as possible) +* +* 3.6 (10-May-2023) ADDED: New icon: SAND_TIMER +* ADDED: GuiLoadStyleFromMemory() (binary only) +* REVIEWED: GuiScrollBar() horizontal movement key +* REVIEWED: GuiTextBox() crash on cursor movement +* REVIEWED: GuiTextBox(), additional inputs support +* REVIEWED: GuiLabelButton(), avoid text cut +* REVIEWED: GuiTextInputBox(), password input +* REVIEWED: Local GetCodepointNext(), aligned with raylib +* REDESIGNED: GuiSlider*()/GuiScrollBar() to support out-of-bounds +* +* 3.5 (20-Apr-2023) ADDED: GuiTabBar(), based on GuiToggle() +* ADDED: Helper functions to split text in separate lines +* ADDED: Multiple new icons, useful for code editing tools * REMOVED: Unneeded icon editing functions -* REDESIGNED: GuiDrawText() to divide drawing by lines +* REMOVED: GuiTextBoxMulti(), very limited and broken * REMOVED: MeasureTextEx() dependency, logic directly implemented * REMOVED: DrawTextEx() dependency, logic directly implemented -* ADDED: Helper functions to split text in separate lines +* REVIEWED: GuiScrollBar(), improve mouse-click behaviour +* REVIEWED: Library header info, more info, better organized +* REDESIGNED: GuiTextBox() to support cursor movement +* REDESIGNED: GuiDrawText() to divide drawing by lines +* * 3.2 (22-May-2022) RENAMED: Some enum values, for unification, avoiding prefixes * REMOVED: GuiScrollBar(), only internal * REDESIGNED: GuiPanel() to support text parameter @@ -127,6 +221,7 @@ * REDESIGNED: GuiColorBarAlpha() to support text parameter * REDESIGNED: GuiColorBarHue() to support text parameter * REDESIGNED: GuiTextInputBox() to support password +* * 3.1 (12-Jan-2022) REVIEWED: Default style for consistency (aligned with rGuiLayout v2.5 tool) * REVIEWED: GuiLoadStyle() to support compressed font atlas image data and unload previous textures * REVIEWED: External icons usage logic @@ -134,10 +229,12 @@ * RENAMED: Multiple controls properties definitions to prepend RAYGUI_ * RENAMED: RICON_ references to RAYGUI_ICON_ for library consistency * Projects updated and multiple tweaks +* * 3.0 (04-Nov-2021) Integrated ricons data to avoid external file * REDESIGNED: GuiTextBoxMulti() * REMOVED: GuiImageButton*() * Multiple minor tweaks and bugs corrected +* * 2.9 (17-Mar-2021) REMOVED: Tooltip API * 2.8 (03-May-2020) Centralized rectangles drawing to GuiDrawRectangle() * 2.7 (20-Feb-2020) ADDED: Possible tooltips API @@ -147,6 +244,7 @@ * Replaced property INNER_PADDING by TEXT_PADDING, renamed some properties * ADDED: 8 new custom styles ready to use * Multiple minor tweaks and bugs corrected +* * 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner() * 2.3 (29-Apr-2019) ADDED: rIcons auxiliar library and support for it, multiple controls reviewed * Refactor all controls drawing mechanism to use control state @@ -165,14 +263,44 @@ * 0.9 (07-Mar-2016) Reviewed and tested by Albert Martos, Ian Eito, Sergio Martinez and Ramon Santamaria. * 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria. * +* DEPENDENCIES: +* raylib 5.0 - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing * -* CONTRIBUTORS: +* STANDALONE MODE: +* By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled +* with the config flag RAYGUI_STANDALONE. In that case is up to the user to provide another backend to cover library needs. +* +* The following functions should be redefined for a custom backend: +* +* - Vector2 GetMousePosition(void); +* - float GetMouseWheelMove(void); +* - bool IsMouseButtonDown(int button); +* - bool IsMouseButtonPressed(int button); +* - bool IsMouseButtonReleased(int button); +* - bool IsKeyDown(int key); +* - bool IsKeyPressed(int key); +* - int GetCharPressed(void); // -- GuiTextBox(), GuiValueBox() * +* - void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() +* - void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() +* +* - Font GetFontDefault(void); // -- GuiLoadStyleDefault() +* - Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle() +* - Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image +* - void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) +* - char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data +* - void UnloadFileText(char *text); // -- GuiLoadStyle(), required to unload charset data +* - const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle(), required to find charset/font file from text .rgs +* - int *LoadCodepoints(const char *text, int *count); // -- GuiLoadStyle(), required to load required font codepoints list +* - void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle(), required to unload codepoints list +* - unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle() +* +* CONTRIBUTORS: * Ramon Santamaria: Supervision, review, redesign, update and maintenance * Vlad Adrian: Complete rewrite of GuiTextBox() to support extended features (2019) * Sergio Martinez: Review, testing (2015) and redesign of multiple controls (2018) -* Adria Arranz: Testing and Implementation of additional controls (2018) -* Jordi Jorba: Testing and Implementation of additional controls (2018) +* Adria Arranz: Testing and implementation of additional controls (2018) +* Jordi Jorba: Testing and implementation of additional controls (2018) * Albert Martos: Review and testing of the library (2015) * Ian Eito: Review and testing of the library (2015) * Kevin Gato: Initial implementation of basic components (2014) @@ -181,7 +309,7 @@ * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2023 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. @@ -203,7 +331,10 @@ #ifndef RAYGUI_H #define RAYGUI_H -#define RAYGUI_VERSION "3.2" +#define RAYGUI_VERSION_MAJOR 4 +#define RAYGUI_VERSION_MINOR 5 +#define RAYGUI_VERSION_PATCH 0 +#define RAYGUI_VERSION "4.5-dev" #if !defined(RAYGUI_STANDALONE) #include "raylib.h" @@ -329,36 +460,67 @@ #endif // Style property +// NOTE: Used when exporting style as code for convenience typedef struct GuiStyleProp { - unsigned short controlId; - unsigned short propertyId; - unsigned int propertyValue; + unsigned short controlId; // Control identifier + unsigned short propertyId; // Property identifier + int propertyValue; // Property value } GuiStyleProp; +/* +// Controls text style -NOT USED- +// NOTE: Text style is defined by control +typedef struct GuiTextStyle { + unsigned int size; + int charSpacing; + int lineSpacing; + int alignmentH; + int alignmentV; + int padding; +} GuiTextStyle; +*/ + // Gui control state typedef enum { STATE_NORMAL = 0, STATE_FOCUSED, STATE_PRESSED, - STATE_DISABLED, + STATE_DISABLED } GuiState; // Gui control text alignment typedef enum { TEXT_ALIGN_LEFT = 0, TEXT_ALIGN_CENTER, - TEXT_ALIGN_RIGHT, + TEXT_ALIGN_RIGHT } GuiTextAlignment; +// Gui control text alignment vertical +// NOTE: Text vertical position inside the text bounds +typedef enum { + TEXT_ALIGN_TOP = 0, + TEXT_ALIGN_MIDDLE, + TEXT_ALIGN_BOTTOM +} GuiTextAlignmentVertical; + +// Gui control text wrap mode +// NOTE: Useful for multiline text +typedef enum { + TEXT_WRAP_NONE = 0, + TEXT_WRAP_CHAR, + TEXT_WRAP_WORD +} GuiTextWrapMode; + // Gui controls typedef enum { // Default -> populates to all controls when set DEFAULT = 0, + // Basic controls LABEL, // Used also for: LABELBUTTON BUTTON, TOGGLE, // Used also for: TOGGLEGROUP - SLIDER, // Used also for: SLIDERBAR + SLIDER, // Used also for: SLIDERBAR, TOGGLESLIDER PROGRESSBAR, CHECKBOX, COMBOBOX, @@ -375,37 +537,54 @@ typedef enum { // Gui base properties for every control // NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties) typedef enum { - BORDER_COLOR_NORMAL = 0, - BASE_COLOR_NORMAL, - TEXT_COLOR_NORMAL, - BORDER_COLOR_FOCUSED, - BASE_COLOR_FOCUSED, - TEXT_COLOR_FOCUSED, - BORDER_COLOR_PRESSED, - BASE_COLOR_PRESSED, - TEXT_COLOR_PRESSED, - BORDER_COLOR_DISABLED, - BASE_COLOR_DISABLED, - TEXT_COLOR_DISABLED, - BORDER_WIDTH, - TEXT_PADDING, - TEXT_ALIGNMENT, - RESERVED + BORDER_COLOR_NORMAL = 0, // Control border color in STATE_NORMAL + BASE_COLOR_NORMAL, // Control base color in STATE_NORMAL + TEXT_COLOR_NORMAL, // Control text color in STATE_NORMAL + BORDER_COLOR_FOCUSED, // Control border color in STATE_FOCUSED + BASE_COLOR_FOCUSED, // Control base color in STATE_FOCUSED + TEXT_COLOR_FOCUSED, // Control text color in STATE_FOCUSED + BORDER_COLOR_PRESSED, // Control border color in STATE_PRESSED + BASE_COLOR_PRESSED, // Control base color in STATE_PRESSED + TEXT_COLOR_PRESSED, // Control text color in STATE_PRESSED + BORDER_COLOR_DISABLED, // Control border color in STATE_DISABLED + BASE_COLOR_DISABLED, // Control base color in STATE_DISABLED + TEXT_COLOR_DISABLED, // Control text color in STATE_DISABLED + BORDER_WIDTH, // Control border size, 0 for no border + //TEXT_SIZE, // Control text size (glyphs max height) -> GLOBAL for all controls + //TEXT_SPACING, // Control text spacing between glyphs -> GLOBAL for all controls + //TEXT_LINE_SPACING // Control text spacing between lines -> GLOBAL for all controls + TEXT_PADDING, // Control text padding, not considering border + TEXT_ALIGNMENT, // Control text horizontal alignment inside control text bound (after border and padding) + //TEXT_WRAP_MODE // Control text wrap-mode inside text bounds -> GLOBAL for all controls } GuiControlProperty; +// TODO: Which text styling properties should be global or per-control? +// At this moment TEXT_PADDING and TEXT_ALIGNMENT is configured and saved per control while +// TEXT_SIZE, TEXT_SPACING, TEXT_LINE_SPACING, TEXT_ALIGNMENT_VERTICAL, TEXT_WRAP_MODE are global and +// should be configured by user as needed while defining the UI layout + // Gui extended properties depend on control -// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default 8 properties) +// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default, max 8 properties) //---------------------------------------------------------------------------------- - // DEFAULT extended properties // NOTE: Those properties are common to all controls or global +// WARNING: We only have 8 slots for those properties by default!!! -> New global control: TEXT? typedef enum { TEXT_SIZE = 16, // Text size (glyphs max height) TEXT_SPACING, // Text spacing between glyphs LINE_COLOR, // Line control color BACKGROUND_COLOR, // Background color + TEXT_LINE_SPACING, // Text spacing between lines + TEXT_ALIGNMENT_VERTICAL, // Text vertical alignment inside text bounds (after border and padding) + TEXT_WRAP_MODE // Text wrap-mode inside text bounds + //TEXT_DECORATION // Text decoration: 0-None, 1-Underline, 2-Line-through, 3-Overline + //TEXT_DECORATION_THICK // Text decoration line thickness } GuiDefaultProperty; +// Other possible text properties: +// TEXT_WEIGHT // Normal, Italic, Bold -> Requires specific font change +// TEXT_INDENT // Text indentation -> Now using TEXT_PADDING... + // Label //typedef enum { } GuiLabelProperty; @@ -430,12 +609,12 @@ typedef enum { // ScrollBar typedef enum { - ARROWS_SIZE = 16, - ARROWS_VISIBLE, - SCROLL_SLIDER_PADDING, // (SLIDERBAR, SLIDER_PADDING) - SCROLL_SLIDER_SIZE, - SCROLL_PADDING, - SCROLL_SPEED, + ARROWS_SIZE = 16, // ScrollBar arrows size + ARROWS_VISIBLE, // ScrollBar arrows visible + SCROLL_SLIDER_PADDING, // ScrollBar slider internal padding + SCROLL_SLIDER_SIZE, // ScrollBar slider size + SCROLL_PADDING, // ScrollBar scroll padding from arrows + SCROLL_SPEED, // ScrollBar scrolling speed } GuiScrollBarProperty; // CheckBox @@ -452,13 +631,14 @@ typedef enum { // DropdownBox typedef enum { ARROW_PADDING = 16, // DropdownBox arrow separation from border and items - DROPDOWN_ITEMS_SPACING // DropdownBox items separation + DROPDOWN_ITEMS_SPACING, // DropdownBox items separation + DROPDOWN_ARROW_HIDDEN, // DropdownBox arrow hidden + DROPDOWN_ROLL_UP // DropdownBox roll up flag (default rolls down) } GuiDropdownBoxProperty; // TextBox/TextBoxMulti/ValueBox/Spinner typedef enum { - TEXT_INNER_PADDING = 16, // TextBox/TextBoxMulti/ValueBox/Spinner inner text padding - TEXT_LINES_SPACING, // TextBoxMulti lines separation + TEXT_READONLY = 16, // TextBox in read-only mode: 0-text editable, 1-text no-editable } GuiTextBoxProperty; // Spinner @@ -472,7 +652,8 @@ typedef enum { LIST_ITEMS_HEIGHT = 16, // ListView items height LIST_ITEMS_SPACING, // ListView items separation SCROLLBAR_WIDTH, // ListView scrollbar size (usually width) - SCROLLBAR_SIDE, // ListView scrollbar side (0-left, 1-right) + SCROLLBAR_SIDE, // ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) + LIST_ITEMS_BORDER_WIDTH // ListView items border width } GuiListViewProperty; // ColorPicker @@ -501,78 +682,88 @@ extern "C" { // Prevents name mangling of functions #endif // Global gui state control functions -RAYGUIAPI void GuiEnable(void); // Enable gui controls (global state) -RAYGUIAPI void GuiDisable(void); // Disable gui controls (global state) -RAYGUIAPI void GuiLock(void); // Lock gui controls (global state) -RAYGUIAPI void GuiUnlock(void); // Unlock gui controls (global state) -RAYGUIAPI bool GuiIsLocked(void); // Check if gui is locked (global state) -RAYGUIAPI void GuiFade(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f -RAYGUIAPI void GuiSetState(int state); // Set gui state (global state) -RAYGUIAPI int GuiGetState(void); // Get gui state (global state) +RAYGUIAPI void GuiEnable(void); // Enable gui controls (global state) +RAYGUIAPI void GuiDisable(void); // Disable gui controls (global state) +RAYGUIAPI void GuiLock(void); // Lock gui controls (global state) +RAYGUIAPI void GuiUnlock(void); // Unlock gui controls (global state) +RAYGUIAPI bool GuiIsLocked(void); // Check if gui is locked (global state) +RAYGUIAPI void GuiSetAlpha(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f +RAYGUIAPI void GuiSetState(int state); // Set gui state (global state) +RAYGUIAPI int GuiGetState(void); // Get gui state (global state) // Font set/get functions -RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state) -RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state) +RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state) +RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state) // Style set/get functions -RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property -RAYGUIAPI int GuiGetStyle(int control, int property); // Get one style property - -// Container/separator controls, useful for controls organization -RAYGUIAPI bool GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed -RAYGUIAPI void GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name -RAYGUIAPI void GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text -RAYGUIAPI void GuiPanel(Rectangle bounds, const char *text); // Panel control, useful to group controls -RAYGUIAPI int GuiTabBar(Rectangle bounds, const char **text, int count, int *active); // Tab Bar control, returns TAB to be closed or -1 -RAYGUIAPI Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll); // Scroll Panel control - -// Basic controls set -RAYGUIAPI void GuiLabel(Rectangle bounds, const char *text); // Label control, shows text -RAYGUIAPI bool GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked -RAYGUIAPI bool GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked -RAYGUIAPI bool GuiToggle(Rectangle bounds, const char *text, bool active); // Toggle Button control, returns true when active -RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int active); // Toggle Group control, returns active toggle index -RAYGUIAPI bool GuiCheckBox(Rectangle bounds, const char *text, bool checked); // Check Box control, returns true when active -RAYGUIAPI int GuiComboBox(Rectangle bounds, const char *text, int active); // Combo Box control, returns selected item index -RAYGUIAPI bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control, returns selected item -RAYGUIAPI bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value -RAYGUIAPI bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers -RAYGUIAPI bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text -RAYGUIAPI bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control with multiple lines -RAYGUIAPI float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider control, returns selected value -RAYGUIAPI float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider Bar control, returns selected value -RAYGUIAPI float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Progress Bar control, shows current progress value -RAYGUIAPI void GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text -RAYGUIAPI void GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders -RAYGUIAPI Vector2 GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs); // Grid control, returns mouse cell position - -// Advance controls set -RAYGUIAPI int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active); // List View control, returns selected list item index -RAYGUIAPI int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active); // List View with extended parameters -RAYGUIAPI int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message -RAYGUIAPI int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, int *secretViewActive); // Text Input Box control, ask for text, supports secret -RAYGUIAPI Color GuiColorPicker(Rectangle bounds, const char *text, Color color); // Color Picker control (multiple color controls) -RAYGUIAPI Color GuiColorPanel(Rectangle bounds, const char *text, Color color); // Color Panel control -RAYGUIAPI float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha); // Color Bar Alpha control -RAYGUIAPI float GuiColorBarHue(Rectangle bounds, const char *text, float value); // Color Bar Hue control +RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property +RAYGUIAPI int GuiGetStyle(int control, int property); // Get one style property // Styles loading functions RAYGUIAPI void GuiLoadStyle(const char *fileName); // Load style file over global style variable (.rgs) RAYGUIAPI void GuiLoadStyleDefault(void); // Load style default over global style // Tooltips management functions -RAYGUIAPI void GuiEnableTooltip(void); // Enable gui tooltips (global state) -RAYGUIAPI void GuiDisableTooltip(void); // Disable gui tooltips (global state) -RAYGUIAPI void GuiSetTooltip(const char *tooltip); // Set tooltip string +RAYGUIAPI void GuiEnableTooltip(void); // Enable gui tooltips (global state) +RAYGUIAPI void GuiDisableTooltip(void); // Disable gui tooltips (global state) +RAYGUIAPI void GuiSetTooltip(const char *tooltip); // Set tooltip string // Icons functionality RAYGUIAPI const char *GuiIconText(int iconId, const char *text); // Get text with icon id prepended (if supported) - #if !defined(RAYGUI_NO_ICONS) +RAYGUIAPI void GuiSetIconScale(int scale); // Set default icon drawing size RAYGUIAPI unsigned int *GuiGetIcons(void); // Get raygui icons data pointer -RAYGUIAPI char **GuiLoadIcons(const char *fileName, bool loadIconsName); // Load raygui icons file (.rgi) into internal icons data -RAYGUIAPI void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color); -RAYGUIAPI void GuiSetIconScale(int scale); // Set icon drawing size +RAYGUIAPI char **GuiLoadIcons(const char *fileName, bool loadIconsName); // Load raygui icons file (.rgi) into internal icons data +RAYGUIAPI void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color); // Draw icon using pixel size at specified position +#endif + +// Controls +//---------------------------------------------------------------------------------------------------------- +// Container/separator controls, useful for controls organization +RAYGUIAPI int GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed +RAYGUIAPI int GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name +RAYGUIAPI int GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text +RAYGUIAPI int GuiPanel(Rectangle bounds, const char *text); // Panel control, useful to group controls +RAYGUIAPI int GuiTabBar(Rectangle bounds, const char **text, int count, int *active); // Tab Bar control, returns TAB to be closed or -1 +RAYGUIAPI int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view); // Scroll Panel control + +// Basic controls set +RAYGUIAPI int GuiLabel(Rectangle bounds, const char *text); // Label control +RAYGUIAPI int GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked +RAYGUIAPI int GuiLabelButton(Rectangle bounds, const char *text); // Label button control, returns true when clicked +RAYGUIAPI int GuiToggle(Rectangle bounds, const char *text, bool *active); // Toggle Button control +RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int *active); // Toggle Group control +RAYGUIAPI int GuiToggleSlider(Rectangle bounds, const char *text, int *active); // Toggle Slider control +RAYGUIAPI int GuiCheckBox(Rectangle bounds, const char *text, bool *checked); // Check Box control, returns true when active +RAYGUIAPI int GuiComboBox(Rectangle bounds, const char *text, int *active); // Combo Box control + +RAYGUIAPI int GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control +RAYGUIAPI int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control +RAYGUIAPI int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers +RAYGUIAPI int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float *value, bool editMode); // Value box control for float values +RAYGUIAPI int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text + +RAYGUIAPI int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider control +RAYGUIAPI int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Slider Bar control +RAYGUIAPI int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue); // Progress Bar control +RAYGUIAPI int GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text +RAYGUIAPI int GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders +RAYGUIAPI int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell); // Grid control + +// Advance controls set +RAYGUIAPI int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active); // List View control +RAYGUIAPI int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollIndex, int *active, int *focus); // List View with extended parameters +RAYGUIAPI int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message +RAYGUIAPI int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, bool *secretViewActive); // Text Input Box control, ask for text, supports secret +RAYGUIAPI int GuiColorPicker(Rectangle bounds, const char *text, Color *color); // Color Picker control (multiple color controls) +RAYGUIAPI int GuiColorPanel(Rectangle bounds, const char *text, Color *color); // Color Panel control +RAYGUIAPI int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha); // Color Bar Alpha control +RAYGUIAPI int GuiColorBarHue(Rectangle bounds, const char *text, float *value); // Color Bar Hue control +RAYGUIAPI int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Picker control that avoids conversion to RGB on each call (multiple color controls) +RAYGUIAPI int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv); // Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV() +//---------------------------------------------------------------------------------------------------------- + +#if !defined(RAYGUI_NO_ICONS) #if !defined(RAYGUI_CUSTOM_ICONS) //---------------------------------------------------------------------------------- @@ -798,16 +989,16 @@ typedef enum { ICON_REG_EXP = 216, ICON_FOLDER = 217, ICON_FILE = 218, - ICON_219 = 219, - ICON_220 = 220, - ICON_221 = 221, - ICON_222 = 222, - ICON_223 = 223, - ICON_224 = 224, - ICON_225 = 225, - ICON_226 = 226, - ICON_227 = 227, - ICON_228 = 228, + ICON_SAND_TIMER = 219, + ICON_WARNING = 220, + ICON_HELP_BOX = 221, + ICON_INFO_BOX = 222, + ICON_PRIORITY = 223, + ICON_LAYERS_ISO = 224, + ICON_LAYERS2 = 225, + ICON_MLAYERS = 226, + ICON_MAPS = 227, + ICON_HOT = 228, ICON_229 = 229, ICON_230 = 230, ICON_231 = 231, @@ -854,9 +1045,10 @@ typedef enum { #if defined(RAYGUI_IMPLEMENTATION) +#include // required for: isspace() [GuiTextBox()] #include // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), vsprintf() [GuiLoadStyle(), GuiLoadIcons()] #include // Required for: malloc(), calloc(), free() [GuiLoadStyle(), GuiLoadIcons()] -#include // Required for: strlen() [GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()], memset(), memcpy() +#include // Required for: strlen() [GuiTextBox(), GuiValueBox()], memset(), memcpy() #include // Required for: va_list, va_start(), vfprintf(), va_end() [TextFormat()] #include // Required for: roundf() [GuiColorPicker()] @@ -866,6 +1058,11 @@ typedef enum { #define RAYGUI_CLITERAL(name) (name) #endif +// Check if two rectangles are equal, used to validate a slider bounds as an id +#ifndef CHECK_BOUNDS_ID + #define CHECK_BOUNDS_ID(src, dst) ((src.x == dst.x) && (src.y == dst.y) && (src.width == dst.width) && (src.height == dst.height)) +#endif + #if !defined(RAYGUI_NO_ICONS) && !defined(RAYGUI_CUSTOM_ICONS) // Embedded icons, no external file provided @@ -1056,11 +1253,11 @@ static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = 0x78040000, 0x501f600e, 0x0ef44004, 0x12f41284, 0x0ef41284, 0x10140004, 0x7ffc300c, 0x10003000, // ICON_MODE_3D 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // ICON_CUBE 0x7fe00000, 0x5ff87ff0, 0x47fe4ffc, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // ICON_CUBE_FACE_TOP - 0x7fe00000, 0x50386030, 0x47fe483c, 0x443e443e, 0x443e443e, 0x241e75fe, 0x0c06140e, 0x000007fe, // ICON_CUBE_FACE_LEFT + 0x7fe00000, 0x50386030, 0x47c2483c, 0x443e443e, 0x443e443e, 0x241e75fe, 0x0c06140e, 0x000007fe, // ICON_CUBE_FACE_LEFT 0x7fe00000, 0x50286030, 0x47fe4804, 0x47fe47fe, 0x47fe47fe, 0x27fe77fe, 0x0ffe17fe, 0x000007fe, // ICON_CUBE_FACE_FRONT - 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3ff27fe2, 0x0ffe1ffa, 0x000007fe, // ICON_CUBE_FACE_BOTTOM + 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3bf27be2, 0x0bfe1bfa, 0x000007fe, // ICON_CUBE_FACE_BOTTOM 0x7fe00000, 0x70286030, 0x7ffe7804, 0x7c227c02, 0x7c227c22, 0x3c127de2, 0x0c061c0a, 0x000007fe, // ICON_CUBE_FACE_RIGHT - 0x7fe00000, 0x7fe87ff0, 0x7ffe7fe4, 0x7fe27fe2, 0x7fe27fe2, 0x24127fe2, 0x0c06140a, 0x000007fe, // ICON_CUBE_FACE_BACK + 0x7fe00000, 0x6fe85ff0, 0x781e77e4, 0x7be27be2, 0x7be27be2, 0x24127be2, 0x0c06140a, 0x000007fe, // ICON_CUBE_FACE_BACK 0x00000000, 0x2a0233fe, 0x22022602, 0x22022202, 0x2a022602, 0x00a033fe, 0x02080110, 0x00000000, // ICON_CAMERA 0x00000000, 0x200c3ffc, 0x000c000c, 0x3ffc000c, 0x30003000, 0x30003000, 0x3ffc3004, 0x00000000, // ICON_SPECIAL 0x00000000, 0x0022003e, 0x012201e2, 0x0100013e, 0x01000100, 0x79000100, 0x4f004900, 0x00007800, // ICON_LINK_NET @@ -1111,16 +1308,16 @@ static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = 0x00000000, 0x02000000, 0x07000a80, 0x07001fc0, 0x02000a80, 0x00300030, 0x00000000, 0x00000000, // ICON_REG_EXP 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // ICON_FOLDER 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x00003ffc, // ICON_FILE - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_219 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_220 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_221 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_222 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_223 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_224 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_225 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_226 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_227 - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_228 + 0x1ff00000, 0x20082008, 0x17d02fe8, 0x05400ba0, 0x09200540, 0x23881010, 0x2fe827c8, 0x00001ff0, // ICON_SAND_TIMER + 0x01800000, 0x02400240, 0x05a00420, 0x09900990, 0x11881188, 0x21842004, 0x40024182, 0x00003ffc, // ICON_WARNING + 0x7ffe0000, 0x4ff24002, 0x4c324ff2, 0x4f824c02, 0x41824f82, 0x41824002, 0x40024182, 0x00007ffe, // ICON_HELP_BOX + 0x7ffe0000, 0x41824002, 0x40024182, 0x41824182, 0x41824182, 0x41824182, 0x40024182, 0x00007ffe, // ICON_INFO_BOX + 0x01800000, 0x04200240, 0x10080810, 0x7bde2004, 0x0a500a50, 0x08500bd0, 0x08100850, 0x00000ff0, // ICON_PRIORITY + 0x01800000, 0x18180660, 0x80016006, 0x98196006, 0x99996666, 0x19986666, 0x01800660, 0x00000000, // ICON_LAYERS_ISO + 0x07fe0000, 0x1c020402, 0x74021402, 0x54025402, 0x54025402, 0x500857fe, 0x40205ff8, 0x00007fe0, // ICON_LAYERS2 + 0x0ffe0000, 0x3ffa0802, 0x7fea200a, 0x402a402a, 0x422a422a, 0x422e422a, 0x40384e28, 0x00007fe0, // ICON_MLAYERS + 0x0ffe0000, 0x3ffa0802, 0x7fea200a, 0x402a402a, 0x5b2a512a, 0x512e552a, 0x40385128, 0x00007fe0, // ICON_MAPS + 0x04200000, 0x1cf00c60, 0x11f019f0, 0x0f3807b8, 0x1e3c0f3c, 0x1c1c1e1c, 0x1e3c1c1c, 0x00000f70, // ICON_HOT 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_229 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_230 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_231 @@ -1150,7 +1347,7 @@ static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_255 }; -// NOTE: We keep a pointer to the icons array, useful to point to other sets if required +// NOTE: A pointer to current icons array should be defined static unsigned int *guiIconsPtr = guiIcons; #endif // !RAYGUI_NO_ICONS && !RAYGUI_CUSTOM_ICONS @@ -1159,8 +1356,10 @@ static unsigned int *guiIconsPtr = guiIcons; #define RAYGUI_ICON_SIZE 0 #endif -#define RAYGUI_MAX_CONTROLS 16 // Maximum number of standard controls -#define RAYGUI_MAX_PROPS_BASE 16 // Maximum number of standard properties +// WARNING: Those values define the total size of the style data array, +// if changed, previous saved styles could become incompatible +#define RAYGUI_MAX_CONTROLS 16 // Maximum number of controls +#define RAYGUI_MAX_PROPS_BASE 16 // Maximum number of base properties #define RAYGUI_MAX_PROPS_EXTENDED 8 // Maximum number of extended properties //---------------------------------------------------------------------------------- @@ -1172,17 +1371,24 @@ typedef enum { BORDER = 0, BASE, TEXT, OTHER } GuiPropertyElement; //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -static GuiState guiState = STATE_NORMAL; // Gui global state, if !STATE_NORMAL, forces defined state +static GuiState guiState = STATE_NORMAL; // Gui global state, if !STATE_NORMAL, forces defined state -static Font guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib) -static bool guiLocked = false; // Gui lock state (no inputs processed) -static float guiAlpha = 1.0f; // Gui element transpacency on drawing +static Font guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib) +static bool guiLocked = false; // Gui lock state (no inputs processed) +static float guiAlpha = 1.0f; // Gui controls transparency -static unsigned int guiIconScale = 1; // Gui icon default scale (if icons enabled) +static unsigned int guiIconScale = 1; // Gui icon default scale (if icons enabled) -static bool guiTooltip = false; // Tooltip enabled/disabled -static const char *guiTooltipPtr = NULL; // Tooltip string pointer (string provided by user) +static bool guiTooltip = false; // Tooltip enabled/disabled +static const char *guiTooltipPtr = NULL; // Tooltip string pointer (string provided by user) +static bool guiControlExclusiveMode = false; // Gui control exclusive mode (no inputs processed except current control) +static Rectangle guiControlExclusiveRec = { 0 }; // Gui control exclusive bounds rectangle, used as an unique identifier + +static int textBoxCursorIndex = 0; // Cursor index, shared by all GuiTextBox*() +//static int blinkCursorFrameCounter = 0; // Frame counter for cursor blinking +static int autoCursorCooldownCounter = 0; // Cooldown frame counter for automatic cursor movement on key-down +static int autoCursorDelayCounter = 0; // Delay frame counter for automatic cursor movement //---------------------------------------------------------------------------------- // Style data array for all gui style properties (allocated on data segment by default) @@ -1227,35 +1433,43 @@ static bool IsMouseButtonReleased(int button); static bool IsKeyDown(int key); static bool IsKeyPressed(int key); -static int GetCharPressed(void); // -- GuiTextBox(), GuiTextBoxMulti(), GuiValueBox() +static int GetCharPressed(void); // -- GuiTextBox(), GuiValueBox() //------------------------------------------------------------------------------- // Drawing required functions //------------------------------------------------------------------------------- -static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle(), GuiDrawIcon() - +static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() //------------------------------------------------------------------------------- // Text required functions //------------------------------------------------------------------------------- -static Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount); // -- GuiLoadStyle() -static Font GetFontDefault(void); // -- GuiLoadStyleDefault() -static Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle() -static void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle() -static char *LoadFileText(const char *fileName); // -- GuiLoadStyle() -static const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle() +static Font GetFontDefault(void); // -- GuiLoadStyleDefault() +static Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle(), load font + +static Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image +static void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) + +static char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data +static void UnloadFileText(char *text); // -- GuiLoadStyle(), required to unload charset data + +static const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle(), required to find charset/font file from text .rgs + +static int *LoadCodepoints(const char *text, int *count); // -- GuiLoadStyle(), required to load required font codepoints list +static void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle(), required to unload codepoints list + +static unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle() //------------------------------------------------------------------------------- // raylib functions already implemented in raygui //------------------------------------------------------------------------------- static Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value static int ColorToInt(Color color); // Returns hexadecimal value for a Color -static Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f static bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle static const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed' static const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings static int TextToInteger(const char *text); // Get integer value from text +static float TextToFloat(const char *text); // Get float value from text static int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded text static const char *CodepointToUTF8(int codepoint, int *byteSize); // Encode codepoint into UTF-8 text (char array size returned as parameter) @@ -1268,11 +1482,13 @@ static void DrawRectangleGradientV(int posX, int posY, int width, int height, Co //---------------------------------------------------------------------------------- // Module specific Functions Declaration //---------------------------------------------------------------------------------- +static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize); // Load style from memory (binary only) + static int GetTextWidth(const char *text); // Gui get text width using gui font and style static Rectangle GetTextBounds(int control, Rectangle bounds); // Get text bounds considering control bounds static const char *GetTextIcon(const char *text, int *iconId); // Get text icon if provided and move text cursor -static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint); // Gui draw text using default font +static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, Color tint); // Gui draw text using default font static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color); // Gui draw rectangle using default raygui style static const char **GuiTextSplit(const char *text, char delimiter, int *count, int *textRow); // Split controls text into multiple strings @@ -1282,6 +1498,7 @@ static Vector3 ConvertRGBtoHSV(Vector3 rgb); // Convert color static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue); // Scroll bar control, used by GuiScrollPanel() static void GuiTooltip(Rectangle controlRec); // Draw tooltip using control rec position +static Color GuiFade(Color color, float alpha); // Fade color by an alpha factor //---------------------------------------------------------------------------------- // Gui Setup Functions Definition @@ -1304,7 +1521,7 @@ void GuiUnlock(void) { guiLocked = false; } bool GuiIsLocked(void) { return guiLocked; } // Set gui controls alpha global state -void GuiFade(float alpha) +void GuiSetAlpha(float alpha) { if (alpha < 0.0f) alpha = 0.0f; else if (alpha > 1.0f) alpha = 1.0f; @@ -1330,7 +1547,6 @@ void GuiSetFont(Font font) if (!guiStyleLoaded) GuiLoadStyleDefault(); guiFont = font; - GuiSetStyle(DEFAULT, TEXT_SIZE, font.baseSize); } } @@ -1365,7 +1581,7 @@ int GuiGetStyle(int control, int property) //---------------------------------------------------------------------------------- // Window Box control -bool GuiWindowBox(Rectangle bounds, const char *title) +int GuiWindowBox(Rectangle bounds, const char *title) { // Window title bar height (including borders) // NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox() @@ -1373,8 +1589,8 @@ bool GuiWindowBox(Rectangle bounds, const char *title) #define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 24 #endif + int result = 0; //GuiState state = guiState; - bool clicked = false; int statusBarHeight = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT; @@ -1401,38 +1617,41 @@ bool GuiWindowBox(Rectangle bounds, const char *title) GuiSetStyle(BUTTON, BORDER_WIDTH, 1); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); #if defined(RAYGUI_NO_ICONS) - clicked = GuiButton(closeButtonRec, "x"); + result = GuiButton(closeButtonRec, "x"); #else - clicked = GuiButton(closeButtonRec, GuiIconText(ICON_CROSS_SMALL, NULL)); + result = GuiButton(closeButtonRec, GuiIconText(ICON_CROSS_SMALL, NULL)); #endif GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); //-------------------------------------------------------------------- - return clicked; + return result; // Window close button clicked: result = 1 } // Group Box control with text name -void GuiGroupBox(Rectangle bounds, const char *text) +int GuiGroupBox(Rectangle bounds, const char *text) { #if !defined(RAYGUI_GROUPBOX_LINE_THICK) #define RAYGUI_GROUPBOX_LINE_THICK 1 #endif + int result = 0; GuiState state = guiState; // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha)); - GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, RAYGUI_GROUPBOX_LINE_THICK }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha)); - GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha)); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, RAYGUI_GROUPBOX_LINE_THICK }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y, RAYGUI_GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR))); GuiLine(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y - GuiGetStyle(DEFAULT, TEXT_SIZE)/2, bounds.width, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) }, text); //-------------------------------------------------------------------- + + return result; } // Line control -void GuiLine(Rectangle bounds, const char *text) +int GuiLine(Rectangle bounds, const char *text) { #if !defined(RAYGUI_LINE_ORIGIN_SIZE) #define RAYGUI_LINE_MARGIN_TEXT 12 @@ -1441,9 +1660,10 @@ void GuiLine(Rectangle bounds, const char *text) #define RAYGUI_LINE_TEXT_PADDING 4 #endif + int result = 0; GuiState state = guiState; - Color color = Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha); + Color color = GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED : (int)LINE_COLOR)); // Draw control //-------------------------------------------------------------------- @@ -1451,7 +1671,7 @@ void GuiLine(Rectangle bounds, const char *text) else { Rectangle textBounds = { 0 }; - textBounds.width = (float)GetTextWidth(text); + textBounds.width = (float)GetTextWidth(text) + 2; textBounds.height = bounds.height; textBounds.x = bounds.x + RAYGUI_LINE_MARGIN_TEXT; textBounds.y = bounds.y; @@ -1462,15 +1682,18 @@ void GuiLine(Rectangle bounds, const char *text) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + 12 + textBounds.width + 4, bounds.y + bounds.height/2, bounds.width - textBounds.width - RAYGUI_LINE_MARGIN_TEXT - RAYGUI_LINE_TEXT_PADDING, 1 }, 0, BLANK, color); } //-------------------------------------------------------------------- + + return result; } // Panel control -void GuiPanel(Rectangle bounds, const char *text) +int GuiPanel(Rectangle bounds, const char *text) { #if !defined(RAYGUI_PANEL_BORDER_WIDTH) #define RAYGUI_PANEL_BORDER_WIDTH 1 #endif + int result = 0; GuiState state = guiState; // Text will be drawn as a header bar (if provided) @@ -1481,16 +1704,18 @@ void GuiPanel(Rectangle bounds, const char *text) { // Move panel bounds after the header bar bounds.y += (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; - bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + 1; + bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; } // Draw control //-------------------------------------------------------------------- if (text != NULL) GuiStatusBar(statusBar, text); // Draw panel header as status bar - GuiDrawRectangle(bounds, RAYGUI_PANEL_BORDER_WIDTH, Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED: LINE_COLOR)), guiAlpha), - Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR)), guiAlpha)); + GuiDrawRectangle(bounds, RAYGUI_PANEL_BORDER_WIDTH, GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? (int)BORDER_COLOR_DISABLED: (int)LINE_COLOR)), + GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BASE_COLOR_DISABLED : BACKGROUND_COLOR))); //-------------------------------------------------------------------- + + return result; } // Tab Bar control @@ -1499,9 +1724,9 @@ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) { #define RAYGUI_TABBAR_ITEM_WIDTH 160 - GuiState state = guiState; + int result = -1; + //GuiState state = guiState; - int closing = -1; Rectangle tabBounds = { bounds.x, bounds.y, RAYGUI_TABBAR_ITEM_WIDTH, bounds.height }; if (*active < 0) *active = 0; @@ -1511,6 +1736,8 @@ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) offsetX = (*active + 2)*RAYGUI_TABBAR_ITEM_WIDTH - GetScreenWidth(); if (offsetX < 0) offsetX = 0; + bool toggle = false; // Required for individual toggles + // Draw control //-------------------------------------------------------------------- for (int i = 0; i < count; i++) @@ -1524,21 +1751,35 @@ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) int textPadding = GuiGetStyle(TOGGLE, TEXT_PADDING); GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); GuiSetStyle(TOGGLE, TEXT_PADDING, 8); - if (i == *active) GuiToggle(tabBounds, GuiIconText(12, text[i]), true); - else if (GuiToggle(tabBounds, GuiIconText(12, text[i]), false) == true) *active = i; + + if (i == (*active)) + { + toggle = true; + GuiToggle(tabBounds, GuiIconText(12, text[i]), &toggle); + } + else + { + toggle = false; + GuiToggle(tabBounds, GuiIconText(12, text[i]), &toggle); + if (toggle) *active = i; + } + + // Close tab with middle mouse button pressed + if (CheckCollisionPointRec(GetMousePosition(), tabBounds) && IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) result = i; + GuiSetStyle(TOGGLE, TEXT_PADDING, textPadding); GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, textAlignment); // Draw tab close button - // NOTE: Only draw close button for curren tab: if (CheckCollisionPointRec(mousePoint, tabBounds)) + // NOTE: Only draw close button for current tab: if (CheckCollisionPointRec(mousePosition, tabBounds)) int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); int tempTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); GuiSetStyle(BUTTON, BORDER_WIDTH, 1); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); #if defined(RAYGUI_NO_ICONS) - if (GuiButton(closeButtonRec, "x")) closing = i; + if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, "x")) result = i; #else - if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, GuiIconText(ICON_CROSS_SMALL, NULL))) closing = i; + if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, GuiIconText(ICON_CROSS_SMALL, NULL))) result = i; #endif GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); @@ -1549,14 +1790,22 @@ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, 1 }, 0, BLANK, GetColor(GuiGetStyle(TOGGLE, BORDER_COLOR_NORMAL))); //-------------------------------------------------------------------- - return closing; // Return closing tab requested + return result; // Return as result the current TAB closing requested } // Scroll Panel control -Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll) +int GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll, Rectangle *view) { + #define RAYGUI_MIN_SCROLLBAR_WIDTH 40 + #define RAYGUI_MIN_SCROLLBAR_HEIGHT 40 + #define RAYGUI_MIN_MOUSE_WHEEL_SPEED 20 + + int result = 0; GuiState state = guiState; + Rectangle temp = { 0 }; + if (view == NULL) view = &temp; + Vector2 scrollPos = { 0.0f, 0.0f }; if (scroll != NULL) scrollPos = *scroll; @@ -1580,17 +1829,31 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, int horizontalScrollBarWidth = hasHorizontalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0; int verticalScrollBarWidth = hasVerticalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0; - Rectangle horizontalScrollBar = { (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + verticalScrollBarWidth : (float)bounds.x) + GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)bounds.y + bounds.height - horizontalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)bounds.width - verticalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)horizontalScrollBarWidth }; - Rectangle verticalScrollBar = { (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)bounds.x + bounds.width - verticalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH)), (float)bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)verticalScrollBarWidth, (float)bounds.height - horizontalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) }; + Rectangle horizontalScrollBar = { + (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + verticalScrollBarWidth : (float)bounds.x) + GuiGetStyle(DEFAULT, BORDER_WIDTH), + (float)bounds.y + bounds.height - horizontalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH), + (float)bounds.width - verticalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH), + (float)horizontalScrollBarWidth + }; + Rectangle verticalScrollBar = { + (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)bounds.x + bounds.width - verticalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH)), + (float)bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), + (float)verticalScrollBarWidth, + (float)bounds.height - horizontalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) + }; + + // Make sure scroll bars have a minimum width/height + if (horizontalScrollBar.width < RAYGUI_MIN_SCROLLBAR_WIDTH) horizontalScrollBar.width = RAYGUI_MIN_SCROLLBAR_WIDTH; + if (verticalScrollBar.height < RAYGUI_MIN_SCROLLBAR_HEIGHT) verticalScrollBar.height = RAYGUI_MIN_SCROLLBAR_HEIGHT; // Calculate view area (area without the scrollbars) - Rectangle view = (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? + *view = (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? RAYGUI_CLITERAL(Rectangle){ bounds.x + verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth } : RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth }; // Clip view area to the actual content size - if (view.width > content.width) view.width = content.width; - if (view.height > content.height) view.height = content.height; + if (view->width > content.width) view->width = content.width; + if (view->height > content.height) view->height = content.height; float horizontalMin = hasHorizontalScrollBar? ((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH); float horizontalMax = hasHorizontalScrollBar? content.width - bounds.width + (float)verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH) - (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)verticalScrollBarWidth : 0) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH); @@ -1624,9 +1887,14 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, #endif float wheelMove = GetMouseWheelMove(); - // Horizontal scroll (Shift + Mouse wheel) - if (hasHorizontalScrollBar && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_SHIFT))) scrollPos.x += wheelMove*20; - else scrollPos.y += wheelMove*20; // Vertical scroll + // Set scrolling speed with mouse wheel based on ratio between bounds and content + Vector2 mouseWheelSpeed = { content.width/bounds.width, content.height/bounds.height }; + if (mouseWheelSpeed.x < RAYGUI_MIN_MOUSE_WHEEL_SPEED) mouseWheelSpeed.x = RAYGUI_MIN_MOUSE_WHEEL_SPEED; + if (mouseWheelSpeed.y < RAYGUI_MIN_MOUSE_WHEEL_SPEED) mouseWheelSpeed.y = RAYGUI_MIN_MOUSE_WHEEL_SPEED; + + // Horizontal and vertical scrolling with mouse wheel + if (hasHorizontalScrollBar && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_LEFT_SHIFT))) scrollPos.x += wheelMove*mouseWheelSpeed.x; + else scrollPos.y += wheelMove*mouseWheelSpeed.y; // Vertical scroll } } @@ -1641,7 +1909,7 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, //-------------------------------------------------------------------- if (text != NULL) GuiStatusBar(statusBar, text); // Draw panel header as status bar - GuiDrawRectangle(bounds, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR)), guiAlpha)); // Draw background + GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background // Save size of the scrollbar slider const int slider = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); @@ -1668,11 +1936,11 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, if (hasHorizontalScrollBar && hasVerticalScrollBar) { Rectangle corner = { (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) + 2) : (horizontalScrollBar.x + horizontalScrollBar.width + 2), verticalScrollBar.y + verticalScrollBar.height + 2, (float)horizontalScrollBarWidth - 4, (float)verticalScrollBarWidth - 4 }; - GuiDrawRectangle(corner, 0, BLANK, Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT + (state*3))), guiAlpha)); + GuiDrawRectangle(corner, 0, BLANK, GetColor(GuiGetStyle(LISTVIEW, TEXT + (state*3)))); } // Draw scrollbar lines depending on current state - GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), BLANK); // Set scrollbar slider size back to the way it was before GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, slider); @@ -1680,12 +1948,13 @@ Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, if (scroll != NULL) *scroll = scrollPos; - return view; + return result; } // Label control -void GuiLabel(Rectangle bounds, const char *text) +int GuiLabel(Rectangle bounds, const char *text) { + int result = 0; GuiState state = guiState; // Update control @@ -1695,19 +1964,21 @@ void GuiLabel(Rectangle bounds, const char *text) // Draw control //-------------------------------------------------------------------- - GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- + + return result; } // Button control, returns true when clicked -bool GuiButton(Rectangle bounds, const char *text) +int GuiButton(Rectangle bounds, const char *text) { + int result = 0; GuiState state = guiState; - bool pressed = false; // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -1717,35 +1988,35 @@ bool GuiButton(Rectangle bounds, const char *text) if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; else state = STATE_FOCUSED; - if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; } } //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(BUTTON, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(BUTTON, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(BUTTON, BASE + (state*3))), guiAlpha)); - GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(BUTTON, TEXT + (state*3))), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(BUTTON, BORDER_WIDTH), GetColor(GuiGetStyle(BUTTON, BORDER + (state*3))), GetColor(GuiGetStyle(BUTTON, BASE + (state*3)))); + GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), GetColor(GuiGetStyle(BUTTON, TEXT + (state*3)))); if (state == STATE_FOCUSED) GuiTooltip(bounds); //------------------------------------------------------------------ - return pressed; + return result; // Button pressed: result = 1 } // Label button control -bool GuiLabelButton(Rectangle bounds, const char *text) +int GuiLabelButton(Rectangle bounds, const char *text) { GuiState state = guiState; bool pressed = false; // NOTE: We force bounds.width to be all text float textWidth = (float)GetTextWidth(text); - if (bounds.width < textWidth) bounds.width = textWidth; + if ((bounds.width - 2*GuiGetStyle(LABEL, BORDER_WIDTH) - 2*GuiGetStyle(LABEL, TEXT_PADDING)) < textWidth) bounds.width = textWidth + 2*GuiGetStyle(LABEL, BORDER_WIDTH) + 2*GuiGetStyle(LABEL, TEXT_PADDING) + 2; // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -1762,20 +2033,24 @@ bool GuiLabelButton(Rectangle bounds, const char *text) // Draw control //-------------------------------------------------------------------- - GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- return pressed; } -// Toggle Button control, returns true when active -bool GuiToggle(Rectangle bounds, const char *text, bool active) +// Toggle Button control +int GuiToggle(Rectangle bounds, const char *text, bool *active) { + int result = 0; GuiState state = guiState; + bool temp = false; + if (active == NULL) active = &temp; + // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -1786,7 +2061,7 @@ bool GuiToggle(Rectangle bounds, const char *text, bool active) else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) { state = STATE_NORMAL; - active = !active; + *active = !(*active); } else state = STATE_FOCUSED; } @@ -1797,30 +2072,36 @@ bool GuiToggle(Rectangle bounds, const char *text, bool active) //-------------------------------------------------------------------- if (state == STATE_NORMAL) { - GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TOGGLE, (active? BORDER_COLOR_PRESSED : (BORDER + state*3)))), guiAlpha), Fade(GetColor(GuiGetStyle(TOGGLE, (active? BASE_COLOR_PRESSED : (BASE + state*3)))), guiAlpha)); - GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, (active? TEXT_COLOR_PRESSED : (TEXT + state*3)))), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), GetColor(GuiGetStyle(TOGGLE, ((*active)? BORDER_COLOR_PRESSED : (BORDER + state*3)))), GetColor(GuiGetStyle(TOGGLE, ((*active)? BASE_COLOR_PRESSED : (BASE + state*3))))); + GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TOGGLE, ((*active)? TEXT_COLOR_PRESSED : (TEXT + state*3))))); } else { - GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TOGGLE, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(TOGGLE, BASE + state*3)), guiAlpha)); - GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, TEXT + state*3)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), GetColor(GuiGetStyle(TOGGLE, BORDER + state*3)), GetColor(GuiGetStyle(TOGGLE, BASE + state*3))); + GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TOGGLE, TEXT + state*3))); } if (state == STATE_FOCUSED) GuiTooltip(bounds); //-------------------------------------------------------------------- - return active; + return result; } -// Toggle Group control, returns toggled button codepointIndex -int GuiToggleGroup(Rectangle bounds, const char *text, int active) +// Toggle Group control +int GuiToggleGroup(Rectangle bounds, const char *text, int *active) { #if !defined(RAYGUI_TOGGLEGROUP_MAX_ITEMS) #define RAYGUI_TOGGLEGROUP_MAX_ITEMS 32 #endif + int result = 0; float initBoundsX = bounds.x; + int temp = 0; + if (active == NULL) active = &temp; + + bool toggle = false; // Required for individual toggles + // Get substrings items from text (items pointers) int rows[RAYGUI_TOGGLEGROUP_MAX_ITEMS] = { 0 }; int itemCount = 0; @@ -1837,26 +2118,113 @@ int GuiToggleGroup(Rectangle bounds, const char *text, int active) prevRow = rows[i]; } - if (i == active) GuiToggle(bounds, items[i], true); - else if (GuiToggle(bounds, items[i], false) == true) active = i; + if (i == (*active)) + { + toggle = true; + GuiToggle(bounds, items[i], &toggle); + } + else + { + toggle = false; + GuiToggle(bounds, items[i], &toggle); + if (toggle) *active = i; + } bounds.x += (bounds.width + GuiGetStyle(TOGGLE, GROUP_PADDING)); } - return active; + return result; } -// Check Box control, returns true when active -bool GuiCheckBox(Rectangle bounds, const char *text, bool checked) +// Toggle Slider control extended +int GuiToggleSlider(Rectangle bounds, const char *text, int *active) { + int result = 0; GuiState state = guiState; - Rectangle textBounds = { 0 }; + int temp = 0; + if (active == NULL) active = &temp; + + //bool toggle = false; // Required for individual toggles + + // Get substrings items from text (items pointers) + int itemCount = 0; + const char **items = NULL; + + if (text != NULL) items = GuiTextSplit(text, ';', &itemCount, NULL); + + Rectangle slider = { + 0, // Calculated later depending on the active toggle + bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING), + (bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - (itemCount + 1)*GuiGetStyle(SLIDER, SLIDER_PADDING))/itemCount, + bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + state = STATE_PRESSED; + (*active)++; + result = 1; + } + else state = STATE_FOCUSED; + } + + if ((*active) && (state != STATE_FOCUSED)) state = STATE_PRESSED; + } + + if (*active >= itemCount) *active = 0; + slider.x = bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH) + (*active + 1)*GuiGetStyle(SLIDER, SLIDER_PADDING) + (*active)*slider.width; + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), GetColor(GuiGetStyle(TOGGLE, BORDER + (state*3))), + GetColor(GuiGetStyle(TOGGLE, BASE_COLOR_NORMAL))); + // Draw internal slider + if (state == STATE_NORMAL) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); + else if (state == STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_FOCUSED))); + else if (state == STATE_PRESSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); + + // Draw text in slider if (text != NULL) { + Rectangle textBounds = { 0 }; textBounds.width = (float)GetTextWidth(text); textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + textBounds.x = slider.x + slider.width/2 - textBounds.width/2; + textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; + + GuiDrawText(items[*active], textBounds, GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, TEXT + (state*3))), guiAlpha)); + } + //-------------------------------------------------------------------- + + return result; +} + +// Check Box control, returns 1 when state changed +int GuiCheckBox(Rectangle bounds, const char *text, bool *checked) +{ + int result = 0; + GuiState state = guiState; + + bool temp = false; + if (checked == NULL) checked = &temp; + + Rectangle textBounds = { 0 }; + + if (text != NULL) + { + textBounds.width = (float)GetTextWidth(text) + 2; + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); textBounds.x = bounds.x + bounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; if (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(CHECKBOX, TEXT_PADDING); @@ -1864,7 +2232,7 @@ bool GuiCheckBox(Rectangle bounds, const char *text, bool checked) // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -1881,35 +2249,43 @@ bool GuiCheckBox(Rectangle bounds, const char *text, bool checked) if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; else state = STATE_FOCUSED; - if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) checked = !checked; + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + *checked = !(*checked); + result = 1; + } } } //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), BLANK); - if (checked) + if (*checked) { Rectangle check = { bounds.x + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING), bounds.y + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING), bounds.width - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)), bounds.height - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)) }; - GuiDrawRectangle(check, 0, BLANK, Fade(GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3)), guiAlpha)); + GuiDrawRectangle(check, 0, BLANK, GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3))); } - GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- - return checked; + return result; } -// Combo Box control, returns selected item codepointIndex -int GuiComboBox(Rectangle bounds, const char *text, int active) +// Combo Box control +int GuiComboBox(Rectangle bounds, const char *text, int *active) { + int result = 0; GuiState state = guiState; + int temp = 0; + if (active == NULL) active = &temp; + bounds.width -= (GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH) + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING)); Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING), @@ -1919,12 +2295,12 @@ int GuiComboBox(Rectangle bounds, const char *text, int active) int itemCount = 0; const char **items = GuiTextSplit(text, ';', &itemCount, NULL); - if (active < 0) active = 0; - else if (active > itemCount - 1) active = itemCount - 1; + if (*active < 0) *active = 0; + else if (*active > (itemCount - 1)) *active = itemCount - 1; // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked && (itemCount > 1)) + if ((state != STATE_DISABLED) && !guiLocked && (itemCount > 1) && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -1933,8 +2309,8 @@ int GuiComboBox(Rectangle bounds, const char *text, int active) { if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { - active += 1; - if (active >= itemCount) active = 0; + *active += 1; + if (*active >= itemCount) *active = 0; // Cyclic combobox } if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; @@ -1946,8 +2322,8 @@ int GuiComboBox(Rectangle bounds, const char *text, int active) // Draw control //-------------------------------------------------------------------- // Draw combo box main - GuiDrawRectangle(bounds, GuiGetStyle(COMBOBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COMBOBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(COMBOBOX, BASE + (state*3))), guiAlpha)); - GuiDrawText(items[active], GetTextBounds(COMBOBOX, bounds), GuiGetStyle(COMBOBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(COMBOBOX, TEXT + (state*3))), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(COMBOBOX, BORDER_WIDTH), GetColor(GuiGetStyle(COMBOBOX, BORDER + (state*3))), GetColor(GuiGetStyle(COMBOBOX, BASE + (state*3)))); + GuiDrawText(items[*active], GetTextBounds(COMBOBOX, bounds), GuiGetStyle(COMBOBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(COMBOBOX, TEXT + (state*3)))); // Draw selector using a custom button // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values @@ -1956,37 +2332,44 @@ int GuiComboBox(Rectangle bounds, const char *text, int active) GuiSetStyle(BUTTON, BORDER_WIDTH, 1); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); - GuiButton(selector, TextFormat("%i/%i", active + 1, itemCount)); + GuiButton(selector, TextFormat("%i/%i", *active + 1, itemCount)); GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign); GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); //-------------------------------------------------------------------- - return active; + return result; } // Dropdown Box control // NOTE: Returns mouse click -bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode) +int GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode) { + int result = 0; GuiState state = guiState; + + int temp = 0; + if (active == NULL) active = &temp; + int itemSelected = *active; int itemFocused = -1; + int direction = 0; // Dropdown box open direction: down (default) + if (GuiGetStyle(DROPDOWNBOX, DROPDOWN_ROLL_UP) == 1) direction = 1; // Up + // Get substrings items from text (items pointers, lengths and count) int itemCount = 0; const char **items = GuiTextSplit(text, ';', &itemCount, NULL); Rectangle boundsOpen = bounds; boundsOpen.height = (itemCount + 1)*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); + if (direction == 1) boundsOpen.y -= itemCount*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)) + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING); Rectangle itemBounds = bounds; - bool pressed = false; // Check mouse button pressed - // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1)) + if ((state != STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1) && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -1997,17 +2380,18 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo // Check if mouse has been pressed or released outside limits if (!CheckCollisionPointRec(mousePoint, boundsOpen)) { - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) || IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) result = 1; } // Check if already selected item has been pressed again - if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; // Check focused and selected item for (int i = 0; i < itemCount; i++) { // Update item rectangle y position for next item - itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); + if (direction == 0) itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); + else itemBounds.y -= (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); if (CheckCollisionPointRec(mousePoint, itemBounds)) { @@ -2015,7 +2399,7 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) { itemSelected = i; - pressed = true; // Item selected, change to editMode = false + result = 1; // Item selected } break; } @@ -2029,7 +2413,7 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo { if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { - pressed = true; + result = 1; state = STATE_PRESSED; } else state = STATE_FOCUSED; @@ -2042,8 +2426,8 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo //-------------------------------------------------------------------- if (editMode) GuiPanel(boundsOpen, NULL); - GuiDrawRectangle(bounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE + state*3)), guiAlpha)); - GuiDrawText(items[itemSelected], GetTextBounds(DEFAULT, bounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + state*3)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER + state*3)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE + state*3))); + GuiDrawText(items[itemSelected], GetTextBounds(DROPDOWNBOX, bounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + state*3))); if (editMode) { @@ -2051,164 +2435,407 @@ bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMo for (int i = 0; i < itemCount; i++) { // Update item rectangle y position for next item - itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); + if (direction == 0) itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); + else itemBounds.y -= (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING)); if (i == itemSelected) { - GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_PRESSED)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_PRESSED)), guiAlpha)); - GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_PRESSED)), guiAlpha)); + GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_PRESSED)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_PRESSED))); + GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_PRESSED))); } else if (i == itemFocused) { - GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_FOCUSED)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_FOCUSED)), guiAlpha)); - GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_FOCUSED)), guiAlpha)); + GuiDrawRectangle(itemBounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), GetColor(GuiGetStyle(DROPDOWNBOX, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(DROPDOWNBOX, BASE_COLOR_FOCUSED))); + GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_FOCUSED))); } - else GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL)), guiAlpha)); + else GuiDrawText(items[i], GetTextBounds(DROPDOWNBOX, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL))); } } - // Draw arrows (using icon if available) + if (!GuiGetStyle(DROPDOWNBOX, DROPDOWN_ARROW_HIDDEN)) + { + // Draw arrows (using icon if available) #if defined(RAYGUI_NO_ICONS) - GuiDrawText("v", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 2, 10, 10 }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); + GuiDrawText("v", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 2, 10, 10 }, + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); #else - GuiDrawText("#120#", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 6, 10, 10 }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); // ICON_ARROW_DOWN_FILL + GuiDrawText(direction? "#121#" : "#120#", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 6, 10, 10 }, + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); // ICON_ARROW_DOWN_FILL #endif + } //-------------------------------------------------------------------- *active = itemSelected; - return pressed; + + // TODO: Use result to return more internal states: mouse-press out-of-bounds, mouse-press over selected-item... + return result; // Mouse click: result = 1 } -// Text Box control, updates input text -// NOTE 2: Returns if KEY_ENTER pressed (useful for data validation) -bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode) +// Text Box control +// NOTE: Returns true on ENTER pressed (useful for data validation) +int GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode) { + #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN) + #define RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN 40 // Frames to wait for autocursor movement + #endif + #if !defined(RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) + #define RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY 1 // Frames delay for autocursor movement + #endif + + int result = 0; GuiState state = guiState; - Rectangle textBounds = GetTextBounds(TEXTBOX, bounds); - bool pressed = false; - int textWidth = GetTextWidth(text); + bool multiline = false; // TODO: Consider multiline text input + int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE); + Rectangle textBounds = GetTextBounds(TEXTBOX, bounds); + int textLength = (int)strlen(text); // Get current text length + int thisCursorIndex = textBoxCursorIndex; + if (thisCursorIndex > textLength) thisCursorIndex = textLength; + int textWidth = GetTextWidth(text) - GetTextWidth(text + thisCursorIndex); + int textIndexOffset = 0; // Text index offset to start drawing in the box + + // Cursor rectangle + // NOTE: Position X value should be updated Rectangle cursor = { - bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + textWidth + 2, - bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE), - 4, + textBounds.x + textWidth + GuiGetStyle(DEFAULT, TEXT_SPACING), + textBounds.y + textBounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE), + 2, (float)GuiGetStyle(DEFAULT, TEXT_SIZE)*2 }; if (cursor.height >= bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2; if (cursor.y < (bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH))) cursor.y = bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH); + // Mouse cursor rectangle + // NOTE: Initialized outside of screen + Rectangle mouseCursor = cursor; + mouseCursor.x = -1; + mouseCursor.width = 1; + + // Auto-cursor movement logic + // NOTE: Cursor moves automatically when key down after some time + if (IsKeyDown(KEY_LEFT) || IsKeyDown(KEY_RIGHT) || IsKeyDown(KEY_UP) || IsKeyDown(KEY_DOWN) || IsKeyDown(KEY_BACKSPACE) || IsKeyDown(KEY_DELETE)) autoCursorCooldownCounter++; + else + { + autoCursorCooldownCounter = 0; // GLOBAL: Cursor cooldown counter + autoCursorDelayCounter = 0; // GLOBAL: Cursor delay counter + } + + // Blink-cursor frame counter + //if (!autoCursorMode) blinkCursorFrameCounter++; + //else blinkCursorFrameCounter = 0; + // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + // WARNING: Text editing is only supported under certain conditions: + if ((state != STATE_DISABLED) && // Control not disabled + !GuiGetStyle(TEXTBOX, TEXT_READONLY) && // TextBox not on read-only mode + !guiLocked && // Gui not locked + !guiControlExclusiveMode && // No gui slider on dragging + (wrapMode == TEXT_WRAP_NONE)) // No wrap mode { - Vector2 mousePoint = GetMousePosition(); + Vector2 mousePosition = GetMousePosition(); if (editMode) { state = STATE_PRESSED; - int key = GetCharPressed(); // Returns codepoint as Unicode - int keyCount = (int)strlen(text); - int byteSize = 0; - const char *textUTF8 = CodepointToUTF8(key, &byteSize); + if (textBoxCursorIndex > textLength) textBoxCursorIndex = textLength; - // Only allow keys in range [32..125] - if ((keyCount + byteSize) < textSize) + // If text does not fit in the textbox and current cursor position is out of bounds, + // we add an index offset to text for drawing only what requires depending on cursor + while (textWidth >= textBounds.width) { - //float maxWidth = (bounds.width - (GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)*2)); + int nextCodepointSize = 0; + GetCodepointNext(text + textIndexOffset, &nextCodepointSize); - if (key >= 32) - { - for (int i = 0; i < byteSize; i++) - { - text[keyCount] = textUTF8[i]; - keyCount++; - } + textIndexOffset += nextCodepointSize; - text[keyCount] = '\0'; - } + textWidth = GetTextWidth(text + textIndexOffset) - GetTextWidth(text + textBoxCursorIndex); } - // Delete text - if (keyCount > 0) + int codepoint = GetCharPressed(); // Get Unicode codepoint + if (multiline && IsKeyPressed(KEY_ENTER)) codepoint = (int)'\n'; + + // Encode codepoint as UTF-8 + int codepointSize = 0; + const char *charEncoded = CodepointToUTF8(codepoint, &codepointSize); + + // Add codepoint to text, at current cursor position + // NOTE: Make sure we do not overflow buffer size + if (((multiline && (codepoint == (int)'\n')) || (codepoint >= 32)) && ((textLength + codepointSize) < textSize)) { - if (IsKeyPressed(KEY_BACKSPACE)) + // Move forward data from cursor position + for (int i = (textLength + codepointSize); i > textBoxCursorIndex; i--) text[i] = text[i - codepointSize]; + + // Add new codepoint in current cursor position + for (int i = 0; i < codepointSize; i++) text[textBoxCursorIndex + i] = charEncoded[i]; + + textBoxCursorIndex += codepointSize; + textLength += codepointSize; + + // Make sure text last character is EOL + text[textLength] = '\0'; + } + + // Move cursor to start + if ((textLength > 0) && IsKeyPressed(KEY_HOME)) textBoxCursorIndex = 0; + + // Move cursor to end + if ((textLength > textBoxCursorIndex) && IsKeyPressed(KEY_END)) textBoxCursorIndex = textLength; + + // Delete codepoint from text, after current cursor position + if ((textLength > textBoxCursorIndex) && (IsKeyPressed(KEY_DELETE) || (IsKeyDown(KEY_DELETE) && (autoCursorCooldownCounter >= RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN)))) + { + autoCursorDelayCounter++; + + if (IsKeyPressed(KEY_DELETE) || (autoCursorDelayCounter%RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0) // Delay every movement some frames { - while ((keyCount > 0) && ((text[--keyCount] & 0xc0) == 0x80)); - text[keyCount] = '\0'; + int nextCodepointSize = 0; + GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); + + // Move backward text from cursor position + for (int i = textBoxCursorIndex; i < textLength; i++) text[i] = text[i + nextCodepointSize]; + + textLength -= codepointSize; + if (textBoxCursorIndex > textLength) textBoxCursorIndex = textLength; + + // Make sure text last character is EOL + text[textLength] = '\0'; } } - if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true; - } - else - { - if (CheckCollisionPointRec(mousePoint, bounds)) + // Delete related codepoints from text, before current cursor position + if ((textLength > 0) && IsKeyPressed(KEY_BACKSPACE) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL))) { - state = STATE_FOCUSED; - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; - } - } - } - //-------------------------------------------------------------------- + int i = textBoxCursorIndex - 1; + int accCodepointSize = 0; - // Draw control - //-------------------------------------------------------------------- - if (state == STATE_PRESSED) - { - GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha)); - } - else if (state == STATE_DISABLED) - { - GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)), guiAlpha)); - } - else GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK); + // Move cursor to the end of word if on space already + while ((i > 0) && isspace(text[i])) + { + int prevCodepointSize = 0; + GetCodepointPrevious(text + i, &prevCodepointSize); + i -= prevCodepointSize; + accCodepointSize += prevCodepointSize; + } - if (editMode) - { - // In case we edit and text does not fit in the textbox, - // we move text pointer to a position it fits inside the text box - while ((textWidth >= textBounds.width) && (text[0] != '\0')) - { - int codepointSize = 0; - GetCodepointNext(text, &codepointSize); - text += codepointSize; - textWidth = GetTextWidth(text); - cursor.x = textBounds.x + textWidth + 2; - } - } + // Move cursor to the start of the word + while ((i > 0) && !isspace(text[i])) + { + int prevCodepointSize = 0; + GetCodepointPrevious(text + i, &prevCodepointSize); + i -= prevCodepointSize; + accCodepointSize += prevCodepointSize; + } - GuiDrawText(text, textBounds, GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha)); + // Move forward text from cursor position + for (int j = (textBoxCursorIndex - accCodepointSize); j < textLength; j++) text[j] = text[j + accCodepointSize]; - // Draw cursor - if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha)); - else if (state == STATE_FOCUSED) GuiTooltip(bounds); - //-------------------------------------------------------------------- + // Prevent cursor index from decrementing past 0 + if (textBoxCursorIndex > 0) + { + textBoxCursorIndex -= accCodepointSize; + textLength -= accCodepointSize; + } - return pressed; -} + // Make sure text last character is EOL + text[textLength] = '\0'; + } + else if ((textLength > 0) && (IsKeyPressed(KEY_BACKSPACE) || (IsKeyDown(KEY_BACKSPACE) && (autoCursorCooldownCounter >= RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN)))) + { + autoCursorDelayCounter++; -// Spinner control, returns selected value -bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) -{ - GuiState state = guiState; + if (IsKeyPressed(KEY_BACKSPACE) || (autoCursorDelayCounter%RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0) // Delay every movement some frames + { + int prevCodepointSize = 0; - bool pressed = false; - int tempValue = *value; + // Prevent cursor index from decrementing past 0 + if (textBoxCursorIndex > 0) + { + GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); - Rectangle spinner = { bounds.x + GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_SPACING), bounds.y, - bounds.width - 2*(GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_SPACING)), bounds.height }; - Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height }; - Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height }; + // Move backward text from cursor position + for (int i = (textBoxCursorIndex - prevCodepointSize); i < textLength; i++) text[i] = text[i + prevCodepointSize]; - Rectangle textBounds = { 0 }; - if (text != NULL) - { - textBounds.width = (float)GetTextWidth(text); + textBoxCursorIndex -= codepointSize; + textLength -= codepointSize; + } + + // Make sure text last character is EOL + text[textLength] = '\0'; + } + } + + // Move cursor position with keys + if (IsKeyPressed(KEY_LEFT) || (IsKeyDown(KEY_LEFT) && (autoCursorCooldownCounter > RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN))) + { + autoCursorDelayCounter++; + + if (IsKeyPressed(KEY_LEFT) || (autoCursorDelayCounter%RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0) // Delay every movement some frames + { + int prevCodepointSize = 0; + if (textBoxCursorIndex > 0) GetCodepointPrevious(text + textBoxCursorIndex, &prevCodepointSize); + + if (textBoxCursorIndex >= prevCodepointSize) textBoxCursorIndex -= prevCodepointSize; + } + } + else if (IsKeyPressed(KEY_RIGHT) || (IsKeyDown(KEY_RIGHT) && (autoCursorCooldownCounter > RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN))) + { + autoCursorDelayCounter++; + + if (IsKeyPressed(KEY_RIGHT) || (autoCursorDelayCounter%RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY) == 0) // Delay every movement some frames + { + int nextCodepointSize = 0; + GetCodepointNext(text + textBoxCursorIndex, &nextCodepointSize); + + if ((textBoxCursorIndex + nextCodepointSize) <= textLength) textBoxCursorIndex += nextCodepointSize; + } + } + + // Move cursor position with mouse + if (CheckCollisionPointRec(mousePosition, textBounds)) // Mouse hover text + { + float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize; + int codepointIndex = 0; + float glyphWidth = 0.0f; + float widthToMouseX = 0; + int mouseCursorIndex = 0; + + for (int i = textIndexOffset; i < textLength; i++) + { + codepoint = GetCodepointNext(&text[i], &codepointSize); + codepointIndex = GetGlyphIndex(guiFont, codepoint); + + if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor); + else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor); + + if (mousePosition.x <= (textBounds.x + (widthToMouseX + glyphWidth/2))) + { + mouseCursor.x = textBounds.x + widthToMouseX; + mouseCursorIndex = i; + break; + } + + widthToMouseX += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + } + + // Check if mouse cursor is at the last position + int textEndWidth = GetTextWidth(text + textIndexOffset); + if (GetMousePosition().x >= (textBounds.x + textEndWidth - glyphWidth/2)) + { + mouseCursor.x = textBounds.x + textEndWidth; + mouseCursorIndex = textLength; + } + + // Place cursor at required index on mouse click + if ((mouseCursor.x >= 0) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + cursor.x = mouseCursor.x; + textBoxCursorIndex = mouseCursorIndex; + } + } + else mouseCursor.x = -1; + + // Recalculate cursor position.y depending on textBoxCursorIndex + cursor.x = bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GetTextWidth(text + textIndexOffset) - GetTextWidth(text + textBoxCursorIndex) + GuiGetStyle(DEFAULT, TEXT_SPACING); + //if (multiline) cursor.y = GetTextLines() + + // Finish text editing on ENTER or mouse click outside bounds + if ((!multiline && IsKeyPressed(KEY_ENTER)) || + (!CheckCollisionPointRec(mousePosition, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) + { + textBoxCursorIndex = 0; // GLOBAL: Reset the shared cursor index + result = 1; + } + } + else + { + if (CheckCollisionPointRec(mousePosition, bounds)) + { + state = STATE_FOCUSED; + + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + textBoxCursorIndex = textLength; // GLOBAL: Place cursor index to the end of current text + result = 1; + } + } + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + if (state == STATE_PRESSED) + { + GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED))); + } + else if (state == STATE_DISABLED) + { + GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED))); + } + else GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), BLANK); + + // Draw text considering index offset if required + // NOTE: Text index offset depends on cursor position + GuiDrawText(text + textIndexOffset, textBounds, GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3)))); + + // Draw cursor + if (editMode && !GuiGetStyle(TEXTBOX, TEXT_READONLY)) + { + //if (autoCursorMode || ((blinkCursorFrameCounter/40)%2 == 0)) + GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED))); + + // Draw mouse position cursor (if required) + if (mouseCursor.x >= 0) GuiDrawRectangle(mouseCursor, 0, BLANK, GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED))); + } + else if (state == STATE_FOCUSED) GuiTooltip(bounds); + //-------------------------------------------------------------------- + + return result; // Mouse button pressed: result = 1 +} + +/* +// Text Box control with multiple lines and word-wrap +// NOTE: This text-box is readonly, no editing supported by default +bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode) +{ + bool pressed = false; + + GuiSetStyle(TEXTBOX, TEXT_READONLY, 1); + GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_WORD); // WARNING: If wrap mode enabled, text editing is not supported + GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_TOP); + + // TODO: Implement methods to calculate cursor position properly + pressed = GuiTextBox(bounds, text, textSize, editMode); + + GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_MIDDLE); + GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_NONE); + GuiSetStyle(TEXTBOX, TEXT_READONLY, 0); + + return pressed; +} +*/ + +// Spinner control, returns selected value +int GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) +{ + int result = 1; + GuiState state = guiState; + + int tempValue = *value; + + Rectangle spinner = { bounds.x + GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_SPACING), bounds.y, + bounds.width - 2*(GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_SPACING)), bounds.height }; + Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height }; + Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height }; + + Rectangle textBounds = { 0 }; + if (text != NULL) + { + textBounds.width = (float)GetTextWidth(text) + 2; textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); textBounds.x = bounds.x + bounds.width + GuiGetStyle(SPINNER, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; @@ -2217,7 +2844,7 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -2246,8 +2873,7 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in // Draw control //-------------------------------------------------------------------- - // TODO: Set Spinner properties for ValueBox - pressed = GuiValueBox(spinner, NULL, &tempValue, minValue, maxValue, editMode); + result = GuiValueBox(spinner, NULL, &tempValue, minValue, maxValue, editMode); // Draw value selector custom buttons // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values @@ -2260,23 +2886,23 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); // Draw text label if provided - GuiDrawText(text, textBounds, (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, textBounds, (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- *value = tempValue; - return pressed; + return result; } // Value Box control, updates input text with numbers // NOTE: Requires static variables: frameCounter -bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) +int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) { #if !defined(RAYGUI_VALUEBOX_MAX_CHARS) #define RAYGUI_VALUEBOX_MAX_CHARS 32 #endif + int result = 0; GuiState state = guiState; - bool pressed = false; char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = "\0"; sprintf(textValue, "%i", *value); @@ -2284,7 +2910,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i Rectangle textBounds = { 0 }; if (text != NULL) { - textBounds.width = (float)GetTextWidth(text); + textBounds.width = (float)GetTextWidth(text) + 2; textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; @@ -2293,7 +2919,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -2337,7 +2963,13 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i //if (*value > maxValue) *value = maxValue; //else if (*value < minValue) *value = minValue; - if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true; + if ((IsKeyPressed(KEY_ENTER) || IsKeyPressed(KEY_KP_ENTER)) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) + { + if (*value > maxValue) *value = maxValue; + else if (*value < minValue) *value = minValue; + + result = 1; + } } else { @@ -2347,7 +2979,7 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i if (CheckCollisionPointRec(mousePoint, bounds)) { state = STATE_FOCUSED; - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; } } } @@ -2359,109 +2991,102 @@ bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, i if (state == STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED)); else if (state == STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED)); - // WARNING: BLANK color does not work properly with Fade() - GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), guiAlpha), baseColor); - GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3))), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), baseColor); + GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3)))); // Draw cursor if (editMode) { // NOTE: ValueBox internal text is always centered Rectangle cursor = { bounds.x + GetTextWidth(textValue)/2 + bounds.width/2 + 1, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH) }; - GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha)); + GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED))); } // Draw text label if provided - GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- - return pressed; + return result; } -// Text Box control with multiple lines -bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode) +// Floating point Value Box control, updates input val_str with numbers +// NOTE: Requires static variables: frameCounter +int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float *value, bool editMode) { - GuiState state = guiState; - bool pressed = false; + #if !defined(RAYGUI_VALUEBOX_MAX_CHARS) + #define RAYGUI_VALUEBOX_MAX_CHARS 32 + #endif - Rectangle textAreaBounds = { - bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING), - bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING), - bounds.width - 2*(GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)), - bounds.height - 2*(GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)) - }; + int result = 0; + GuiState state = guiState; - // Cursor position, [x, y] values should be updated - Rectangle cursor = { 0, -1, 4, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 }; + //char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = "\0"; + //sprintf(textValue, "%2.2f", *value); - float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize; // Character rectangle scaling factor + Rectangle textBounds = {0}; + if (text != NULL) + { + textBounds.width = (float)GetTextWidth(text) + 2; + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING); + textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; + if (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(VALUEBOX, TEXT_PADDING); + } // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); + bool valueHasChanged = false; + if (editMode) { state = STATE_PRESSED; - // We get an Unicode codepoint - int codepoint = GetCharPressed(); - int textLength = (int)strlen(text); // Length in bytes (UTF-8 string) - int byteSize = 0; - const char *textUTF8 = CodepointToUTF8(codepoint, &byteSize); + int keyCount = (int)strlen(textValue); - // Introduce characters - if ((textLength + byteSize) < textSize) + // Only allow keys in range [48..57] + if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS) { - if (IsKeyPressed(KEY_ENTER)) - { - text[textLength] = '\n'; - textLength++; - } - else if (codepoint >= 32) + if (GetTextWidth(textValue) < bounds.width) { - // Supports Unicode inputs -> Encoded to UTF-8 - int charUTF8Length = 0; - const char *charEncoded = CodepointToUTF8(codepoint, &charUTF8Length); - memcpy(text + textLength, charEncoded, charUTF8Length); - textLength += charUTF8Length; + int key = GetCharPressed(); + if (((key >= 48) && (key <= 57)) || + (key == '.') || + ((keyCount == 0) && (key == '+')) || // NOTE: Sign can only be in first position + ((keyCount == 0) && (key == '-'))) + { + textValue[keyCount] = (char)key; + keyCount++; + + valueHasChanged = true; + } } } - // Delete characters - if (textLength > 0) + // Pressed backspace + if (IsKeyPressed(KEY_BACKSPACE)) { - if (IsKeyPressed(KEY_BACKSPACE)) + if (keyCount > 0) { - if ((unsigned char)text[textLength - 1] < 127) - { - // Remove ASCII equivalent character (1 byte) - textLength--; - text[textLength] = '\0'; - } - else - { - // Remove latest UTF-8 unicode character introduced (n bytes) - int charUTF8Length = 0; - while ((charUTF8Length < textLength) && ((unsigned char)text[textLength - 1 - charUTF8Length] & 0b01000000) == 0) charUTF8Length++; - - textLength -= (charUTF8Length + 1); - text[textLength] = '\0'; - } + keyCount--; + textValue[keyCount] = '\0'; + valueHasChanged = true; } } - // Exit edit mode - if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + if (valueHasChanged) *value = TextToFloat(textValue); + + if ((IsKeyPressed(KEY_ENTER) || IsKeyPressed(KEY_KP_ENTER)) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) result = 1; } else { if (CheckCollisionPointRec(mousePoint, bounds)) { state = STATE_FOCUSED; - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) result = 1; } } } @@ -2469,157 +3094,119 @@ bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode) // Draw control //-------------------------------------------------------------------- - if (state == STATE_PRESSED) - { - GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha)); - } - else if (state == STATE_DISABLED) - { - GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)), guiAlpha)); - } - else GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK); - - int wrapMode = 1; // 0-No wrap, 1-Char wrap, 2-Word wrap - Vector2 cursorPos = { textAreaBounds.x, textAreaBounds.y }; + Color baseColor = BLANK; + if (state == STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED)); + else if (state == STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED)); - //int lastSpacePos = 0; - //int lastSpaceWidth = 0; - //int lastSpaceCursorPos = 0; + GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), baseColor); + GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3)))); - for (int i = 0, codepointSize = 0; (text != NULL) && (text[i] != '\0'); i += codepointSize) + // Draw cursor + if (editMode) { - int codepoint = GetCodepointNext(text + i, &codepointSize); - int index = GetGlyphIndex(guiFont, codepoint); // If requested codepoint is not found, we get '?' (0x3f) - Rectangle atlasRec = guiFont.recs[index]; - GlyphInfo glyphInfo = guiFont.glyphs[index]; // Glyph measures - - if ((codepointSize == 1) && (codepoint == '\n')) - { - cursorPos.y += (guiFont.baseSize*scaleFactor + GuiGetStyle(TEXTBOX, TEXT_LINES_SPACING)); // Line feed - cursorPos.x = textAreaBounds.x; // Carriage return - } - else - { - if (wrapMode == 1) - { - int glyphWidth = 0; - if (glyphInfo.advanceX != 0) glyphWidth += glyphInfo.advanceX; - else glyphWidth += (int)(atlasRec.width + glyphInfo.offsetX); - - // Jump line if the end of the text box area has been reached - if ((cursorPos.x + (glyphWidth*scaleFactor)) > (textAreaBounds.x + textAreaBounds.width)) - { - cursorPos.y += (guiFont.baseSize*scaleFactor + GuiGetStyle(TEXTBOX, TEXT_LINES_SPACING)); // Line feed - cursorPos.x = textAreaBounds.x; // Carriage return - } - } - else if (wrapMode == 2) - { - /* - if ((codepointSize == 1) && (codepoint == ' ')) - { - lastSpacePos = i; - lastSpaceWidth = 0; - lastSpaceCursorPos = cursorPos.x; - } - - // Jump line if last word reaches end of text box area - if ((lastSpaceCursorPos + lastSpaceWidth) > (textAreaBounds.x + textAreaBounds.width)) - { - cursorPos.y += 12; // Line feed - cursorPos.x = textAreaBounds.x; // Carriage return - } - */ - } - - // Draw current character glyph - DrawTextCodepoint(guiFont, codepoint, cursorPos, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha)); - - int glyphWidth = 0; - if (glyphInfo.advanceX != 0) glyphWidth += glyphInfo.advanceX; - else glyphWidth += (int)(atlasRec.width + glyphInfo.offsetX); - - cursorPos.x += (glyphWidth*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); - //if (i > lastSpacePos) lastSpaceWidth += (atlasRec.width + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); - } + // NOTE: ValueBox internal text is always centered + Rectangle cursor = {bounds.x + GetTextWidth(textValue)/2 + bounds.width/2 + 1, + bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, + bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH)}; + GuiDrawRectangle(cursor, 0, BLANK, GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED))); } - cursor.x = cursorPos.x; - cursor.y = cursorPos.y; - - // Draw cursor position considering text glyphs - if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha)); + // Draw text label if provided + GuiDrawText(text, textBounds, + (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, + GetColor(GuiGetStyle(LABEL, TEXT + (state*3)))); //-------------------------------------------------------------------- - return pressed; + return result; } // Slider control with pro parameters // NOTE: Other GuiSlider*() controls use this one -float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue, int sliderWidth) +int GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue, int sliderWidth) { + int result = 0; GuiState state = guiState; - int sliderValue = (int)(((value - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))); + float temp = (maxValue - minValue)/2.0f; + if (value == NULL) value = &temp; + float oldValue = *value; Rectangle slider = { bounds.x, bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING), 0, bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) }; - if (sliderWidth > 0) // Slider - { - slider.x += (sliderValue - sliderWidth/2); - slider.width = (float)sliderWidth; - } - else if (sliderWidth == 0) // SliderBar - { - slider.x += GuiGetStyle(SLIDER, BORDER_WIDTH); - slider.width = (float)sliderValue; - } - // Update control //-------------------------------------------------------------------- if ((state != STATE_DISABLED) && !guiLocked) { Vector2 mousePoint = GetMousePosition(); - if (CheckCollisionPointRec(mousePoint, bounds)) + if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) + { + state = STATE_PRESSED; + // Get equivalent value and slider position from mousePosition.x + *value = (maxValue - minValue)*((mousePoint.x - bounds.x - sliderWidth/2)/(bounds.width-sliderWidth)) + minValue; + } + } + else + { + guiControlExclusiveMode = false; + guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds)) { if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { state = STATE_PRESSED; + guiControlExclusiveMode = true; + guiControlExclusiveRec = bounds; // Store bounds as an identifier when dragging starts - // Get equivalent value and slider position from mousePoint.x - value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue; - - if (sliderWidth > 0) slider.x = mousePoint.x - slider.width/2; // Slider - else if (sliderWidth == 0) slider.width = (float)sliderValue; // SliderBar + if (!CheckCollisionPointRec(mousePoint, slider)) + { + // Get equivalent value and slider position from mousePosition.x + *value = (maxValue - minValue)*((mousePoint.x - bounds.x - sliderWidth/2)/(bounds.width-sliderWidth)) + minValue; + } } else state = STATE_FOCUSED; } - if (value > maxValue) value = maxValue; - else if (value < minValue) value = minValue; + if (*value > maxValue) *value = maxValue; + else if (*value < minValue) *value = minValue; } - // Bar limits check + // Control value change check + if (oldValue == *value) result = 0; + else result = 1; + + // Slider bar limits check + float sliderValue = (((*value - minValue)/(maxValue - minValue))*(bounds.width - sliderWidth - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))); if (sliderWidth > 0) // Slider { + slider.x += sliderValue; + slider.width = (float)sliderWidth; if (slider.x <= (bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH))) slider.x = bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH); else if ((slider.x + slider.width) >= (bounds.x + bounds.width)) slider.x = bounds.x + bounds.width - slider.width - GuiGetStyle(SLIDER, BORDER_WIDTH); } else if (sliderWidth == 0) // SliderBar { + slider.x += GuiGetStyle(SLIDER, BORDER_WIDTH); + slider.width = sliderValue; if (slider.width > bounds.width) slider.width = bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH); } //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(SLIDER, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), GetColor(GuiGetStyle(SLIDER, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED))); // Draw slider internal bar (depends on state) - if ((state == STATE_NORMAL) || (state == STATE_PRESSED)) GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED)), guiAlpha)); - else if (state == STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED)), guiAlpha)); + if (state == STATE_NORMAL) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED))); + else if (state == STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED))); + else if (state == STATE_PRESSED) GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_PRESSED))); // Draw left/right text if provided if (textLeft != NULL) @@ -2630,7 +3217,7 @@ float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SLIDER, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; - GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha)); + GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(SLIDER, TEXT + (state*3)))); } if (textRight != NULL) @@ -2641,48 +3228,76 @@ float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight textBounds.x = bounds.x + bounds.width + GuiGetStyle(SLIDER, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; - GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha)); + GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, GetColor(GuiGetStyle(SLIDER, TEXT + (state*3)))); } //-------------------------------------------------------------------- - return value; + return result; } // Slider control extended, returns selected value and has text -float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue) +int GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) { return GuiSliderPro(bounds, textLeft, textRight, value, minValue, maxValue, GuiGetStyle(SLIDER, SLIDER_WIDTH)); } // Slider Bar control extended, returns selected value -float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue) +int GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) { return GuiSliderPro(bounds, textLeft, textRight, value, minValue, maxValue, 0); } // Progress Bar control extended, shows current progress value -float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue) +int GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float *value, float minValue, float maxValue) { + int result = 0; GuiState state = guiState; + float temp = (maxValue - minValue)/2.0f; + if (value == NULL) value = &temp; + + // Progress bar Rectangle progress = { bounds.x + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.y + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) + GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING), 0, bounds.height - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) - 2*GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING) }; // Update control //-------------------------------------------------------------------- - if (value > maxValue) value = maxValue; + if (*value > maxValue) *value = maxValue; - if (state != STATE_DISABLED) progress.width = ((float)(value/(maxValue - minValue))*(float)(bounds.width - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH))); + // WARNING: Working with floats could lead to rounding issues + if ((state != STATE_DISABLED)) progress.width = (float)(*value/(maxValue - minValue))*bounds.width - ((*value >= maxValue)? (float)(2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH)) : 0.0f); //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), guiAlpha), BLANK); + if (state == STATE_DISABLED) + { + GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), BLANK); + } + else + { + if (*value > minValue) + { + // Draw progress bar with colored border, more visual + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, (int)progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height - 2 }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, (int)progress.width + (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); + } + else GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); + + if (*value >= maxValue) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + progress.width + 1, bounds.y, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_FOCUSED))); + else + { + // Draw borders not yet reached by value + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + (int)progress.width + 1, bounds.y, bounds.width - (int)progress.width - 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + (int)progress.width + 1, bounds.y + bounds.height - 1, bounds.width - (int)progress.width - 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y + 1, (float)GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), bounds.height - 2 }, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BORDER_COLOR_NORMAL))); + } - // Draw slider internal progress bar (depends on state) - if ((state == STATE_NORMAL) || (state == STATE_PRESSED)) GuiDrawRectangle(progress, 0, BLANK, Fade(GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED)), guiAlpha)); - else if (state == STATE_FOCUSED) GuiDrawRectangle(progress, 0, BLANK, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT_COLOR_FOCUSED)), guiAlpha)); + // Draw slider internal progress bar (depends on state) + GuiDrawRectangle(progress, 0, BLANK, GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED))); + } // Draw left/right text if provided if (textLeft != NULL) @@ -2693,7 +3308,7 @@ float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRig textBounds.x = bounds.x - textBounds.width - GuiGetStyle(PROGRESSBAR, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; - GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3))), guiAlpha)); + GuiDrawText(textLeft, textBounds, TEXT_ALIGN_RIGHT, GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3)))); } if (textRight != NULL) @@ -2704,34 +3319,37 @@ float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRig textBounds.x = bounds.x + bounds.width + GuiGetStyle(PROGRESSBAR, TEXT_PADDING); textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2; - GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3))), guiAlpha)); + GuiDrawText(textRight, textBounds, TEXT_ALIGN_LEFT, GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3)))); } //-------------------------------------------------------------------- - return value; + return result; } // Status Bar control -void GuiStatusBar(Rectangle bounds, const char *text) +int GuiStatusBar(Rectangle bounds, const char *text) { + int result = 0; GuiState state = guiState; // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(STATUSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(STATUSBAR, (state != STATE_DISABLED)? BORDER_COLOR_NORMAL : BORDER_COLOR_DISABLED)), guiAlpha), - Fade(GetColor(GuiGetStyle(STATUSBAR, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha)); - GuiDrawText(text, GetTextBounds(STATUSBAR, bounds), GuiGetStyle(STATUSBAR, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(STATUSBAR, (state != STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED)), guiAlpha)); + GuiDrawRectangle(bounds, GuiGetStyle(STATUSBAR, BORDER_WIDTH), GetColor(GuiGetStyle(STATUSBAR, BORDER + (state*3))), GetColor(GuiGetStyle(STATUSBAR, BASE + (state*3)))); + GuiDrawText(text, GetTextBounds(STATUSBAR, bounds), GuiGetStyle(STATUSBAR, TEXT_ALIGNMENT), GetColor(GuiGetStyle(STATUSBAR, TEXT + (state*3)))); //-------------------------------------------------------------------- + + return result; } // Dummy rectangle control, intended for placeholding -void GuiDummyRec(Rectangle bounds, const char *text) +int GuiDummyRec(Rectangle bounds, const char *text) { + int result = 0; GuiState state = guiState; // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -2746,28 +3364,35 @@ void GuiDummyRec(Rectangle bounds, const char *text) // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha)); - GuiDrawText(text, GetTextBounds(DEFAULT, bounds), TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(BUTTON, (state != STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED)), guiAlpha)); + GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, (state != STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED))); + GuiDrawText(text, GetTextBounds(DEFAULT, bounds), TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(BUTTON, (state != STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED))); //------------------------------------------------------------------ + + return result; } // List View control -int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active) +int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int *active) { + int result = 0; int itemCount = 0; const char **items = NULL; if (text != NULL) items = GuiTextSplit(text, ';', &itemCount, NULL); - return GuiListViewEx(bounds, items, itemCount, NULL, scrollIndex, active); + result = GuiListViewEx(bounds, items, itemCount, scrollIndex, active, NULL); + + return result; } // List View control with extended parameters -int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active) +int GuiListViewEx(Rectangle bounds, const char **text, int count, int *scrollIndex, int *active, int *focus) { + int result = 0; GuiState state = guiState; + int itemFocused = (focus == NULL)? -1 : *focus; - int itemSelected = active; + int itemSelected = (active == NULL)? -1 : *active; // Check if we need a scroll bar bool useScrollBar = false; @@ -2791,7 +3416,7 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, in // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { Vector2 mousePoint = GetMousePosition(); @@ -2839,35 +3464,37 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, in // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background + GuiDrawRectangle(bounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background // Draw visible items for (int i = 0; ((i < visibleItems) && (text != NULL)); i++) { + GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, LIST_ITEMS_BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_NORMAL)), BLANK); + if (state == STATE_DISABLED) { - if ((startIndex + i) == itemSelected) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED)), guiAlpha)); + if ((startIndex + i) == itemSelected) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED))); - GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)), guiAlpha)); + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED))); } else { - if ((startIndex + i) == itemSelected) + if (((startIndex + i) == itemSelected) && (active != NULL)) { // Draw item selected - GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED)), guiAlpha)); - GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED)), guiAlpha)); + GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_PRESSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_PRESSED))); + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED))); } - else if ((startIndex + i) == itemFocused) + else if (((startIndex + i) == itemFocused)) // && (focus != NULL)) // NOTE: We want items focused, despite not returned! { // Draw item focused - GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED)), guiAlpha)); - GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED)), guiAlpha)); + GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_FOCUSED)), GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_FOCUSED))); + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED))); } else { // Draw item normal - GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)), guiAlpha)); + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL))); } } @@ -2899,102 +3526,53 @@ int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, in } //-------------------------------------------------------------------- + if (active != NULL) *active = itemSelected; if (focus != NULL) *focus = itemFocused; if (scrollIndex != NULL) *scrollIndex = startIndex; - return itemSelected; + return result; } -// Color Panel control -Color GuiColorPanel(Rectangle bounds, const char *text, Color color) +// Color Panel control - Color (RGBA) variant. +int GuiColorPanel(Rectangle bounds, const char *text, Color *color) { - const Color colWhite = { 255, 255, 255, 255 }; - const Color colBlack = { 0, 0, 0, 255 }; - - GuiState state = guiState; - Vector2 pickerSelector = { 0 }; + int result = 0; - Vector3 vcolor = { (float)color.r/255.0f, (float)color.g/255.0f, (float)color.b/255.0f }; + Vector3 vcolor = { (float)color->r/255.0f, (float)color->g/255.0f, (float)color->b/255.0f }; Vector3 hsv = ConvertRGBtoHSV(vcolor); + Vector3 prevHsv = hsv; // workaround to see if GuiColorPanelHSV modifies the hsv. - pickerSelector.x = bounds.x + (float)hsv.y*bounds.width; // HSV: Saturation - pickerSelector.y = bounds.y + (1.0f - (float)hsv.z)*bounds.height; // HSV: Value - - float hue = -1.0f; - Vector3 maxHue = { hue >= 0.0f ? hue : hsv.x, 1.0f, 1.0f }; - Vector3 rgbHue = ConvertHSVtoRGB(maxHue); - Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x), - (unsigned char)(255.0f*rgbHue.y), - (unsigned char)(255.0f*rgbHue.z), 255 }; + GuiColorPanelHSV(bounds, text, &hsv); - // Update control - //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + // Check if the hsv was changed, only then change the color. + // This is required, because the Color->HSV->Color conversion has precision errors. + // Thus the assignment from HSV to Color should only be made, if the HSV has a new user-entered value. + // Otherwise GuiColorPanel would often modify it's color without user input. + // TODO: GuiColorPanelHSV could return 1 if the slider was dragged, to simplify this check. + if (hsv.x != prevHsv.x || hsv.y != prevHsv.y || hsv.z != prevHsv.z) { - Vector2 mousePoint = GetMousePosition(); + Vector3 rgb = ConvertHSVtoRGB(hsv); - if (CheckCollisionPointRec(mousePoint, bounds)) - { - if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) - { - state = STATE_PRESSED; - pickerSelector = mousePoint; - - // Calculate color from picker - Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y }; - - colorPick.x /= (float)bounds.width; // Get normalized value on x - colorPick.y /= (float)bounds.height; // Get normalized value on y - - hsv.y = colorPick.x; - hsv.z = 1.0f - colorPick.y; - - Vector3 rgb = ConvertHSVtoRGB(hsv); - - // NOTE: Vector3ToColor() only available on raylib 1.8.1 - color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x), - (unsigned char)(255.0f*rgb.y), - (unsigned char)(255.0f*rgb.z), - (unsigned char)(255.0f*(float)color.a/255.0f) }; - - } - else state = STATE_FOCUSED; - } - } - //-------------------------------------------------------------------- - - // Draw control - //-------------------------------------------------------------------- - if (state != STATE_DISABLED) - { - DrawRectangleGradientEx(bounds, Fade(colWhite, guiAlpha), Fade(colWhite, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha)); - DrawRectangleGradientEx(bounds, Fade(colBlack, 0), Fade(colBlack, guiAlpha), Fade(colBlack, guiAlpha), Fade(colBlack, 0)); - - // Draw color picker: selector - Rectangle selector = { pickerSelector.x - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, pickerSelector.y - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE), (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE) }; - GuiDrawRectangle(selector, 0, BLANK, Fade(colWhite, guiAlpha)); - } - else - { - DrawRectangleGradientEx(bounds, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.6f), guiAlpha)); + // NOTE: Vector3ToColor() only available on raylib 1.8.1 + *color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x), + (unsigned char)(255.0f*rgb.y), + (unsigned char)(255.0f*rgb.z), + color->a }; } - - GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK); - //-------------------------------------------------------------------- - - return color; + return result; } // Color Bar Alpha control // NOTE: Returns alpha value normalized [0..1] -float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) +int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha) { #if !defined(RAYGUI_COLORBARALPHA_CHECKED_SIZE) #define RAYGUI_COLORBARALPHA_CHECKED_SIZE 10 #endif + int result = 0; GuiState state = guiState; - Rectangle selector = { (float)bounds.x + alpha*bounds.width - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.y - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT), (float)bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2 }; + Rectangle selector = { (float)bounds.x + (*alpha)*bounds.width - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.y - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT), (float)bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2 }; // Update control //-------------------------------------------------------------------- @@ -3002,16 +3580,36 @@ float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) { Vector2 mousePoint = GetMousePosition(); - if (CheckCollisionPointRec(mousePoint, bounds) || - CheckCollisionPointRec(mousePoint, selector)) + if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) + { + state = STATE_PRESSED; + + *alpha = (mousePoint.x - bounds.x)/bounds.width; + if (*alpha <= 0.0f) *alpha = 0.0f; + if (*alpha >= 1.0f) *alpha = 1.0f; + } + } + else + { + guiControlExclusiveMode = false; + guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds) || CheckCollisionPointRec(mousePoint, selector)) { if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { state = STATE_PRESSED; + guiControlExclusiveMode = true; + guiControlExclusiveRec = bounds; // Store bounds as an identifier when dragging starts - alpha = (mousePoint.x - bounds.x)/bounds.width; - if (alpha <= 0.0f) alpha = 0.0f; - if (alpha >= 1.0f) alpha = 1.0f; + *alpha = (mousePoint.x - bounds.x)/bounds.width; + if (*alpha <= 0.0f) *alpha = 0.0f; + if (*alpha >= 1.0f) *alpha = 1.0f; //selector.x = bounds.x + (int)(((alpha - 0)/(100 - 0))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))) - selector.width/2; } else state = STATE_FOCUSED; @@ -3033,7 +3631,7 @@ float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) for (int y = 0; y < checksY; y++) { Rectangle check = { bounds.x + x*RAYGUI_COLORBARALPHA_CHECKED_SIZE, bounds.y + y*RAYGUI_COLORBARALPHA_CHECKED_SIZE, RAYGUI_COLORBARALPHA_CHECKED_SIZE, RAYGUI_COLORBARALPHA_CHECKED_SIZE }; - GuiDrawRectangle(check, 0, BLANK, ((x + y)%2)? Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.4f), guiAlpha) : Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.4f), guiAlpha)); + GuiDrawRectangle(check, 0, BLANK, ((x + y)%2)? Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.4f) : Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.4f)); } } @@ -3041,13 +3639,13 @@ float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) } else DrawRectangleGradientEx(bounds, Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha)); - GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); // Draw alpha bar: selector - GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha)); + GuiDrawRectangle(selector, 0, BLANK, GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3))); //-------------------------------------------------------------------- - return alpha; + return result; } // Color Bar Hue control @@ -3056,10 +3654,11 @@ float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) // Color GuiColorBarSat() [WHITE->color] // Color GuiColorBarValue() [BLACK->color], HSV/HSL // float GuiColorBarLuminance() [BLACK->WHITE] -float GuiColorBarHue(Rectangle bounds, const char *text, float hue) +int GuiColorBarHue(Rectangle bounds, const char *text, float *hue) { + int result = 0; GuiState state = guiState; - Rectangle selector = { (float)bounds.x - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)bounds.y + hue/360.0f*bounds.height - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2, (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT) }; + Rectangle selector = { (float)bounds.x - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)bounds.y + (*hue)/360.0f*bounds.height - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT)/2, (float)bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2, (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT) }; // Update control //-------------------------------------------------------------------- @@ -3067,16 +3666,36 @@ float GuiColorBarHue(Rectangle bounds, const char *text, float hue) { Vector2 mousePoint = GetMousePosition(); - if (CheckCollisionPointRec(mousePoint, bounds) || - CheckCollisionPointRec(mousePoint, selector)) + if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) + { + state = STATE_PRESSED; + + *hue = (mousePoint.y - bounds.y)*360/bounds.height; + if (*hue <= 0.0f) *hue = 0.0f; + if (*hue >= 359.0f) *hue = 359.0f; + } + } + else + { + guiControlExclusiveMode = false; + guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds) || CheckCollisionPointRec(mousePoint, selector)) { if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { state = STATE_PRESSED; + guiControlExclusiveMode = true; + guiControlExclusiveRec = bounds; // Store bounds as an identifier when dragging starts - hue = (mousePoint.y - bounds.y)*360/bounds.height; - if (hue <= 0.0f) hue = 0.0f; - if (hue >= 359.0f) hue = 359.0f; + *hue = (mousePoint.y - bounds.y)*360/bounds.height; + if (*hue <= 0.0f) *hue = 0.0f; + if (*hue >= 359.0f) *hue = 359.0f; } else state = STATE_FOCUSED; @@ -3100,7 +3719,8 @@ float GuiColorBarHue(Rectangle bounds, const char *text, float hue) if (state != STATE_DISABLED) { // Draw hue bar:color bars - DrawRectangleGradientV((int)bounds.x, (int)(bounds.y), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 255, 0, 255 }, guiAlpha)); + // TODO: Use directly DrawRectangleGradientEx(bounds, color1, color2, color2, color1); + DrawRectangleGradientV((int)bounds.x, (int)(bounds.y), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 255, 255, 0, 255 }, guiAlpha)); DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + bounds.height/6), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 255, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 0, 255 }, guiAlpha)); DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 2*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 255, 255 }, guiAlpha)); DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 3*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color){ 0, 255, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 255, 255 }, guiAlpha)); @@ -3109,13 +3729,13 @@ float GuiColorBarHue(Rectangle bounds, const char *text, float hue) } else DrawRectangleGradientV((int)bounds.x, (int)bounds.y, (int)bounds.width, (int)bounds.height, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha)); - GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK); + GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); // Draw hue bar: selector - GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha)); + GuiDrawRectangle(selector, 0, BLANK, GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3))); //-------------------------------------------------------------------- - return hue; + return result; } // Color Picker control @@ -3124,21 +3744,159 @@ float GuiColorBarHue(Rectangle bounds, const char *text, float hue) // float GuiColorBarAlpha(Rectangle bounds, float alpha) // float GuiColorBarHue(Rectangle bounds, float value) // NOTE: bounds define GuiColorPanel() size -Color GuiColorPicker(Rectangle bounds, const char *text, Color color) +// NOTE: this picker converts RGB to HSV, which can cause the Hue control to jump. If you have this problem, consider using the HSV variant instead +int GuiColorPicker(Rectangle bounds, const char *text, Color *color) { - color = GuiColorPanel(bounds, NULL, color); + int result = 0; + + Color temp = { 200, 0, 0, 255 }; + if (color == NULL) color = &temp; + + GuiColorPanel(bounds, NULL, color); Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height }; //Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) }; - Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ color.r/255.0f, color.g/255.0f, color.b/255.0f }); - hsv.x = GuiColorBarHue(boundsHue, NULL, hsv.x); + // NOTE: this conversion can cause low hue-resolution, if the r, g and b value are very similar, which causes the hue bar to shift around when only the GuiColorPanel is used. + Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ (*color).r/255.0f, (*color).g/255.0f, (*color).b/255.0f }); + + GuiColorBarHue(boundsHue, NULL, &hsv.x); + //color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f); Vector3 rgb = ConvertHSVtoRGB(hsv); - color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), color.a }; + *color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), (*color).a }; - return color; + return result; +} + +// Color Picker control that avoids conversion to RGB and back to HSV on each call, thus avoiding jittering. +// The user can call ConvertHSVtoRGB() to convert *colorHsv value to RGB. +// NOTE: It's divided in multiple controls: +// int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) +// int GuiColorBarAlpha(Rectangle bounds, const char *text, float *alpha) +// float GuiColorBarHue(Rectangle bounds, float value) +// NOTE: bounds define GuiColorPanelHSV() size +int GuiColorPickerHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) +{ + int result = 0; + + Vector3 tempHsv = { 0 }; + + if (colorHsv == NULL) + { + const Vector3 tempColor = { 200.0f/255.0f, 0.0f, 0.0f }; + tempHsv = ConvertRGBtoHSV(tempColor); + colorHsv = &tempHsv; + } + + GuiColorPanelHSV(bounds, NULL, colorHsv); + + const Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height }; + + GuiColorBarHue(boundsHue, NULL, &colorHsv->x); + + return result; +} + +// Color Panel control - HSV variant +int GuiColorPanelHSV(Rectangle bounds, const char *text, Vector3 *colorHsv) +{ + int result = 0; + GuiState state = guiState; + Vector2 pickerSelector = { 0 }; + + const Color colWhite = { 255, 255, 255, 255 }; + const Color colBlack = { 0, 0, 0, 255 }; + + pickerSelector.x = bounds.x + (float)colorHsv->y*bounds.width; // HSV: Saturation + pickerSelector.y = bounds.y + (1.0f - (float)colorHsv->z)*bounds.height; // HSV: Value + + Vector3 maxHue = { colorHsv->x, 1.0f, 1.0f }; + Vector3 rgbHue = ConvertHSVtoRGB(maxHue); + Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x), + (unsigned char)(255.0f*rgbHue.y), + (unsigned char)(255.0f*rgbHue.z), 255 }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) + { + pickerSelector = mousePoint; + + if (pickerSelector.x < bounds.x) pickerSelector.x = bounds.x; + if (pickerSelector.x > bounds.x + bounds.width) pickerSelector.x = bounds.x + bounds.width; + if (pickerSelector.y < bounds.y) pickerSelector.y = bounds.y; + if (pickerSelector.y > bounds.y + bounds.height) pickerSelector.y = bounds.y + bounds.height; + + // Calculate color from picker + Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y }; + + colorPick.x /= (float)bounds.width; // Get normalized value on x + colorPick.y /= (float)bounds.height; // Get normalized value on y + + colorHsv->y = colorPick.x; + colorHsv->z = 1.0f - colorPick.y; + + } + } + else + { + guiControlExclusiveMode = false; + guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + state = STATE_PRESSED; + guiControlExclusiveMode = true; + guiControlExclusiveRec = bounds; + pickerSelector = mousePoint; + + // Calculate color from picker + Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y }; + + colorPick.x /= (float)bounds.width; // Get normalized value on x + colorPick.y /= (float)bounds.height; // Get normalized value on y + + colorHsv->y = colorPick.x; + colorHsv->z = 1.0f - colorPick.y; + } + else state = STATE_FOCUSED; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + if (state != STATE_DISABLED) + { + DrawRectangleGradientEx(bounds, Fade(colWhite, guiAlpha), Fade(colWhite, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha)); + DrawRectangleGradientEx(bounds, Fade(colBlack, 0), Fade(colBlack, guiAlpha), Fade(colBlack, guiAlpha), Fade(colBlack, 0)); + + // Draw color picker: selector + Rectangle selector = { pickerSelector.x - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, pickerSelector.y - GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE)/2, (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE), (float)GuiGetStyle(COLORPICKER, COLOR_SELECTOR_SIZE) }; + GuiDrawRectangle(selector, 0, BLANK, colWhite); + } + else + { + DrawRectangleGradientEx(bounds, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.6f), guiAlpha)); + } + + GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), BLANK); + //-------------------------------------------------------------------- + + return result; } // Message Box control @@ -3151,7 +3909,7 @@ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, cons #define RAYGUI_MESSAGEBOX_BUTTON_PADDING 12 #endif - int clicked = -1; // Returns clicked button from buttons list, 0 refers to closed window button + int result = -1; // Returns clicked button from buttons list, 0 refers to closed window button int buttonCount = 0; const char **buttonsText = GuiTextSplit(buttons, ';', &buttonCount, NULL); @@ -3161,17 +3919,17 @@ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, cons buttonBounds.width = (bounds.width - RAYGUI_MESSAGEBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount; buttonBounds.height = RAYGUI_MESSAGEBOX_BUTTON_HEIGHT; - int textWidth = GetTextWidth(message); + //int textWidth = GetTextWidth(message) + 2; Rectangle textBounds = { 0 }; - textBounds.x = bounds.x + bounds.width/2 - textWidth/2; + textBounds.x = bounds.x + RAYGUI_MESSAGEBOX_BUTTON_PADDING; textBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + RAYGUI_MESSAGEBOX_BUTTON_PADDING; - textBounds.width = (float)textWidth; + textBounds.width = bounds.width - RAYGUI_MESSAGEBOX_BUTTON_PADDING*2; textBounds.height = bounds.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 3*RAYGUI_MESSAGEBOX_BUTTON_PADDING - RAYGUI_MESSAGEBOX_BUTTON_HEIGHT; // Draw control //-------------------------------------------------------------------- - if (GuiWindowBox(bounds, title)) clicked = 0; + if (GuiWindowBox(bounds, title)) result = 0; int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); @@ -3183,18 +3941,18 @@ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, cons for (int i = 0; i < buttonCount; i++) { - if (GuiButton(buttonBounds, buttonsText[i])) clicked = i + 1; + if (GuiButton(buttonBounds, buttonsText[i])) result = i + 1; buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); } GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevTextAlignment); //-------------------------------------------------------------------- - return clicked; + return result; } // Text Input Box control, ask for text -int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, int *secretViewActive) +int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text, int textMaxSize, bool *secretViewActive) { #if !defined(RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT) #define RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT 24 @@ -3210,7 +3968,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co // WARNING: No more than one GuiTextInputBox() should be open at the same time static bool textEditMode = false; - int btnIndex = -1; + int result = -1; int buttonCount = 0; const char **buttonsText = GuiTextSplit(buttons, ';', &buttonCount, NULL); @@ -3225,7 +3983,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co Rectangle textBounds = { 0 }; if (message != NULL) { - int textSize = GetTextWidth(message); + int textSize = GetTextWidth(message) + 2; textBounds.x = bounds.x + bounds.width/2 - textSize/2; textBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + messageInputHeight/4 - (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/2; @@ -3243,7 +4001,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co // Draw control //-------------------------------------------------------------------- - if (GuiWindowBox(bounds, title)) btnIndex = 0; + if (GuiWindowBox(bounds, title)) result = 0; // Draw message if available if (message != NULL) @@ -3260,7 +4018,7 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co if (GuiTextBox(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x, textBoxBounds.y, textBoxBounds.width - 4 - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.height }, ((*secretViewActive == 1) || textEditMode)? text : stars, textMaxSize, textEditMode)) textEditMode = !textEditMode; - *secretViewActive = GuiToggle(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x + textBoxBounds.width - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.y, RAYGUI_TEXTINPUTBOX_HEIGHT, RAYGUI_TEXTINPUTBOX_HEIGHT }, (*secretViewActive == 1)? "#44#" : "#45#", *secretViewActive); + GuiToggle(RAYGUI_CLITERAL(Rectangle){ textBoxBounds.x + textBoxBounds.width - RAYGUI_TEXTINPUTBOX_HEIGHT, textBoxBounds.y, RAYGUI_TEXTINPUTBOX_HEIGHT, RAYGUI_TEXTINPUTBOX_HEIGHT }, (*secretViewActive == 1)? "#44#" : "#45#", secretViewActive); } else { @@ -3272,77 +4030,77 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co for (int i = 0; i < buttonCount; i++) { - if (GuiButton(buttonBounds, buttonsText[i])) btnIndex = i + 1; + if (GuiButton(buttonBounds, buttonsText[i])) result = i + 1; buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); } + if (result >= 0) textEditMode = false; + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevBtnTextAlignment); //-------------------------------------------------------------------- - return btnIndex; + return result; // Result is the pressed button index } // Grid control // NOTE: Returns grid mouse-hover selected cell // About drawing lines at subpixel spacing, simple put, not easy solution: // https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster -Vector2 GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs) +int GuiGrid(Rectangle bounds, const char *text, float spacing, int subdivs, Vector2 *mouseCell) { // Grid lines alpha amount #if !defined(RAYGUI_GRID_ALPHA) #define RAYGUI_GRID_ALPHA 0.15f #endif + int result = 0; GuiState state = guiState; + Vector2 mousePoint = GetMousePosition(); - Vector2 currentCell = { -1, -1 }; + Vector2 currentMouseCell = { -1, -1 }; + + float spaceWidth = spacing/(float)subdivs; + int linesV = (int)(bounds.width/spaceWidth) + 1; + int linesH = (int)(bounds.height/spaceWidth) + 1; - int linesV = ((int)(bounds.width/spacing))*subdivs + 1; - int linesH = ((int)(bounds.height/spacing))*subdivs + 1; + int color = GuiGetStyle(DEFAULT, LINE_COLOR); // Update control //-------------------------------------------------------------------- - if ((state != STATE_DISABLED) && !guiLocked) + if ((state != STATE_DISABLED) && !guiLocked && !guiControlExclusiveMode) { if (CheckCollisionPointRec(mousePoint, bounds)) { // NOTE: Cell values must be the upper left of the cell the mouse is in - currentCell.x = floorf((mousePoint.x - bounds.x)/spacing); - currentCell.y = floorf((mousePoint.y - bounds.y)/spacing); + currentMouseCell.x = floorf((mousePoint.x - bounds.x)/spacing); + currentMouseCell.y = floorf((mousePoint.y - bounds.y)/spacing); } } //-------------------------------------------------------------------- // Draw control //-------------------------------------------------------------------- + if (state == STATE_DISABLED) color = GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED); - // TODO: Draw background panel? - - switch (state) + if (subdivs > 0) { - case STATE_NORMAL: + // Draw vertical grid lines + for (int i = 0; i < linesV; i++) { - if (subdivs > 0) - { - // Draw vertical grid lines - for (int i = 0; i < linesV; i++) - { - Rectangle lineV = { bounds.x + spacing*i/subdivs, bounds.y, 1, bounds.height }; - GuiDrawRectangle(lineV, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), RAYGUI_GRID_ALPHA*4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), RAYGUI_GRID_ALPHA)); - } + Rectangle lineV = { bounds.x + spacing*i/subdivs, bounds.y, 1, bounds.height + 1 }; + GuiDrawRectangle(lineV, 0, BLANK, ((i%subdivs) == 0)? GuiFade(GetColor(color), RAYGUI_GRID_ALPHA*4) : GuiFade(GetColor(color), RAYGUI_GRID_ALPHA)); + } - // Draw horizontal grid lines - for (int i = 0; i < linesH; i++) - { - Rectangle lineH = { bounds.x, bounds.y + spacing*i/subdivs, bounds.width, 1 }; - GuiDrawRectangle(lineH, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), RAYGUI_GRID_ALPHA*4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), RAYGUI_GRID_ALPHA)); - } - } - } break; - default: break; + // Draw horizontal grid lines + for (int i = 0; i < linesH; i++) + { + Rectangle lineH = { bounds.x, bounds.y + spacing*i/subdivs, bounds.width + 1, 1 }; + GuiDrawRectangle(lineH, 0, BLANK, ((i%subdivs) == 0)? GuiFade(GetColor(color), RAYGUI_GRID_ALPHA*4) : GuiFade(GetColor(color), RAYGUI_GRID_ALPHA)); + } } - return currentCell; + if (mouseCell != NULL) *mouseCell = currentMouseCell; + return result; } //---------------------------------------------------------------------------------- @@ -3358,7 +4116,6 @@ void GuiDisableTooltip(void) { guiTooltip = false; } // Set tooltip string void GuiSetTooltip(const char *tooltip) { guiTooltipPtr = tooltip; } - //---------------------------------------------------------------------------------- // Styles loading functions //---------------------------------------------------------------------------------- @@ -3371,6 +4128,7 @@ void GuiLoadStyle(const char *fileName) #define MAX_LINE_BUFFER_SIZE 256 bool tryBinary = false; + if (!guiStyleLoaded) GuiLoadStyleDefault(); // Try reading the files as text file first FILE *rgsFile = fopen(fileName, "rt"); @@ -3408,171 +4166,73 @@ void GuiLoadStyle(const char *fileName) sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName); Font font = { 0 }; + int *codepoints = NULL; + int codepointCount = 0; if (charmapFileName[0] != '0') { - // Load characters from charmap file, - // expected '\n' separated list of integer values - char *charValues = LoadFileText(charmapFileName); - if (charValues != NULL) - { - int glyphCount = 0; - const char **chars = TextSplit(charValues, '\n', &glyphCount); - - int *values = (int *)RAYGUI_MALLOC(glyphCount*sizeof(int)); - for (int i = 0; i < glyphCount; i++) values[i] = TextToInteger(chars[i]); - - if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); - font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, values, glyphCount); - if (font.texture.id == 0) font = GetFontDefault(); - - RAYGUI_FREE(values); - } + // Load text data from file + // NOTE: Expected an UTF-8 array of codepoints, no separation + char *textData = LoadFileText(TextFormat("%s/%s", GetDirectoryPath(fileName), charmapFileName)); + codepoints = LoadCodepoints(textData, &codepointCount); + UnloadFileText(textData); } - else + + if (fontFileName[0] != '\0') { + // In case a font is already loaded and it is not default internal font, unload it if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); - font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0); - if (font.texture.id == 0) font = GetFontDefault(); - } - - if ((font.texture.id > 0) && (font.glyphCount > 0)) GuiSetFont(font); - - } break; - default: break; - } - - fgets(buffer, MAX_LINE_BUFFER_SIZE, rgsFile); - } - } - else tryBinary = true; - - fclose(rgsFile); - } - - if (tryBinary) - { - rgsFile = fopen(fileName, "rb"); - - if (rgsFile == NULL) return; - - char signature[5] = { 0 }; - short version = 0; - short reserved = 0; - int propertyCount = 0; - fread(signature, 1, 4, rgsFile); - fread(&version, sizeof(short), 1, rgsFile); - fread(&reserved, sizeof(short), 1, rgsFile); - fread(&propertyCount, sizeof(int), 1, rgsFile); - - if ((signature[0] == 'r') && - (signature[1] == 'G') && - (signature[2] == 'S') && - (signature[3] == ' ')) - { - short controlId = 0; - short propertyId = 0; - unsigned int propertyValue = 0; - - for (int i = 0; i < propertyCount; i++) - { - fread(&controlId, sizeof(short), 1, rgsFile); - fread(&propertyId, sizeof(short), 1, rgsFile); - fread(&propertyValue, sizeof(unsigned int), 1, rgsFile); - - if (controlId == 0) // DEFAULT control - { - // If a DEFAULT property is loaded, it is propagated to all controls - // NOTE: All DEFAULT properties should be defined first in the file - GuiSetStyle(0, (int)propertyId, propertyValue); - - if (propertyId < RAYGUI_MAX_PROPS_BASE) for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) GuiSetStyle(i, (int)propertyId, propertyValue); - } - else GuiSetStyle((int)controlId, (int)propertyId, propertyValue); - } + if (codepointCount > 0) font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, codepoints, codepointCount); + else font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0); // Default to 95 standard codepoints + } - // Font loading is highly dependant on raylib API to load font data and image -#if !defined(RAYGUI_STANDALONE) - // Load custom font if available - int fontDataSize = 0; - fread(&fontDataSize, sizeof(int), 1, rgsFile); + // If font texture not properly loaded, revert to default font and size/spacing + if (font.texture.id == 0) + { + font = GetFontDefault(); + GuiSetStyle(DEFAULT, TEXT_SIZE, 10); + GuiSetStyle(DEFAULT, TEXT_SPACING, 1); + } - if (fontDataSize > 0) - { - Font font = { 0 }; - int fontType = 0; // 0-Normal, 1-SDF - Rectangle whiteRec = { 0 }; - - fread(&font.baseSize, sizeof(int), 1, rgsFile); - fread(&font.glyphCount, sizeof(int), 1, rgsFile); - fread(&fontType, sizeof(int), 1, rgsFile); - - // Load font white rectangle - fread(&whiteRec, sizeof(Rectangle), 1, rgsFile); - - // Load font image parameters - int fontImageUncompSize = 0; - int fontImageCompSize = 0; - fread(&fontImageUncompSize, sizeof(int), 1, rgsFile); - fread(&fontImageCompSize, sizeof(int), 1, rgsFile); - - Image imFont = { 0 }; - imFont.mipmaps = 1; - fread(&imFont.width, sizeof(int), 1, rgsFile); - fread(&imFont.height, sizeof(int), 1, rgsFile); - fread(&imFont.format, sizeof(int), 1, rgsFile); - - if (fontImageCompSize < fontImageUncompSize) - { - // Compressed font atlas image data (DEFLATE), it requires DecompressData() - int dataUncompSize = 0; - unsigned char *compData = (unsigned char *)RAYGUI_MALLOC(fontImageCompSize); - fread(compData, 1, fontImageCompSize, rgsFile); - imFont.data = DecompressData(compData, fontImageCompSize, &dataUncompSize); + UnloadCodepoints(codepoints); - // Security check, dataUncompSize must match the provided fontImageUncompSize - if (dataUncompSize != fontImageUncompSize) RAYGUI_LOG("WARNING: Uncompressed font atlas image data could be corrupted"); + if ((font.texture.id > 0) && (font.glyphCount > 0)) GuiSetFont(font); - RAYGUI_FREE(compData); - } - else - { - // Font atlas image data is not compressed - imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageUncompSize); - fread(imFont.data, 1, fontImageUncompSize, rgsFile); + } break; + default: break; } - if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); - font.texture = LoadTextureFromImage(imFont); - if (font.texture.id == 0) font = GetFontDefault(); + fgets(buffer, MAX_LINE_BUFFER_SIZE, rgsFile); + } + } + else tryBinary = true; + + fclose(rgsFile); + } - RAYGUI_FREE(imFont.data); + if (tryBinary) + { + rgsFile = fopen(fileName, "rb"); - // Load font recs data - font.recs = (Rectangle *)RAYGUI_CALLOC(font.glyphCount, sizeof(Rectangle)); - for (int i = 0; i < font.glyphCount; i++) fread(&font.recs[i], sizeof(Rectangle), 1, rgsFile); + if (rgsFile != NULL) + { + fseek(rgsFile, 0, SEEK_END); + int fileDataSize = ftell(rgsFile); + fseek(rgsFile, 0, SEEK_SET); - // Load font chars info data - font.glyphs = (GlyphInfo *)RAYGUI_CALLOC(font.glyphCount, sizeof(GlyphInfo)); - for (int i = 0; i < font.glyphCount; i++) - { - fread(&font.glyphs[i].value, sizeof(int), 1, rgsFile); - fread(&font.glyphs[i].offsetX, sizeof(int), 1, rgsFile); - fread(&font.glyphs[i].offsetY, sizeof(int), 1, rgsFile); - fread(&font.glyphs[i].advanceX, sizeof(int), 1, rgsFile); - } + if (fileDataSize > 0) + { + unsigned char *fileData = (unsigned char *)RAYGUI_MALLOC(fileDataSize*sizeof(unsigned char)); + fread(fileData, sizeof(unsigned char), fileDataSize, rgsFile); - GuiSetFont(font); + GuiLoadStyleFromMemory(fileData, fileDataSize); - // Set font texture source rectangle to be used as white texture to draw shapes - // NOTE: This way, all gui can be draw using a single draw call - if ((whiteRec.width != 0) && (whiteRec.height != 0)) SetShapesTexture(font.texture, whiteRec); + RAYGUI_FREE(fileData); } -#endif - } - fclose(rgsFile); + fclose(rgsFile); + } } } @@ -3584,6 +4244,8 @@ void GuiLoadStyleDefault(void) guiStyleLoaded = true; // Initialize default LIGHT style property values + // WARNING: Default value are applied to all controls on set but + // they can be overwritten later on for every custom control GuiSetStyle(DEFAULT, BORDER_COLOR_NORMAL, 0x838383ff); GuiSetStyle(DEFAULT, BASE_COLOR_NORMAL, 0xc9c9c9ff); GuiSetStyle(DEFAULT, TEXT_COLOR_NORMAL, 0x686868ff); @@ -3596,17 +4258,29 @@ void GuiLoadStyleDefault(void) GuiSetStyle(DEFAULT, BORDER_COLOR_DISABLED, 0xb5c1c2ff); GuiSetStyle(DEFAULT, BASE_COLOR_DISABLED, 0xe6e9e9ff); GuiSetStyle(DEFAULT, TEXT_COLOR_DISABLED, 0xaeb7b8ff); - GuiSetStyle(DEFAULT, BORDER_WIDTH, 1); // WARNING: Some controls use other values - GuiSetStyle(DEFAULT, TEXT_PADDING, 0); // WARNING: Some controls use other values - GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); // WARNING: Some controls use other values + GuiSetStyle(DEFAULT, BORDER_WIDTH, 1); + GuiSetStyle(DEFAULT, TEXT_PADDING, 0); + GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + // Initialize default extended property values + // NOTE: By default, extended property values are initialized to 0 + GuiSetStyle(DEFAULT, TEXT_SIZE, 10); // DEFAULT, shared by all controls + GuiSetStyle(DEFAULT, TEXT_SPACING, 1); // DEFAULT, shared by all controls + GuiSetStyle(DEFAULT, LINE_COLOR, 0x90abb5ff); // DEFAULT specific property + GuiSetStyle(DEFAULT, BACKGROUND_COLOR, 0xf5f5f5ff); // DEFAULT specific property + GuiSetStyle(DEFAULT, TEXT_LINE_SPACING, 15); // DEFAULT, 15 pixels between lines + GuiSetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL, TEXT_ALIGN_MIDDLE); // DEFAULT, text aligned vertically to middle of text-bounds // Initialize control-specific property values // NOTE: Those properties are in default list but require specific values by control type GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); GuiSetStyle(BUTTON, BORDER_WIDTH, 2); GuiSetStyle(SLIDER, TEXT_PADDING, 4); + GuiSetStyle(PROGRESSBAR, TEXT_PADDING, 4); GuiSetStyle(CHECKBOX, TEXT_PADDING, 4); GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_RIGHT); + GuiSetStyle(DROPDOWNBOX, TEXT_PADDING, 0); + GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); GuiSetStyle(TEXTBOX, TEXT_PADDING, 4); GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); GuiSetStyle(VALUEBOX, TEXT_PADDING, 0); @@ -3618,10 +4292,6 @@ void GuiLoadStyleDefault(void) // Initialize extended property values // NOTE: By default, extended property values are initialized to 0 - GuiSetStyle(DEFAULT, TEXT_SIZE, 10); // DEFAULT, shared by all controls - GuiSetStyle(DEFAULT, TEXT_SPACING, 1); // DEFAULT, shared by all controls - GuiSetStyle(DEFAULT, LINE_COLOR, 0x90abb5ff); // DEFAULT specific property - GuiSetStyle(DEFAULT, BACKGROUND_COLOR, 0xf5f5f5ff); // DEFAULT specific property GuiSetStyle(TOGGLE, GROUP_PADDING, 2); GuiSetStyle(SLIDER, SLIDER_WIDTH, 16); GuiSetStyle(SLIDER, SLIDER_PADDING, 1); @@ -3631,8 +4301,6 @@ void GuiLoadStyleDefault(void) GuiSetStyle(COMBOBOX, COMBO_BUTTON_SPACING, 2); GuiSetStyle(DROPDOWNBOX, ARROW_PADDING, 16); GuiSetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_SPACING, 2); - GuiSetStyle(TEXTBOX, TEXT_LINES_SPACING, 4); - GuiSetStyle(TEXTBOX, TEXT_INNER_PADDING, 4); GuiSetStyle(SPINNER, SPIN_BUTTON_WIDTH, 24); GuiSetStyle(SPINNER, SPIN_BUTTON_SPACING, 2); GuiSetStyle(SCROLLBAR, BORDER_WIDTH, 0); @@ -3656,13 +4324,19 @@ void GuiLoadStyleDefault(void) { // Unload previous font texture UnloadTexture(guiFont.texture); + RL_FREE(guiFont.recs); + RL_FREE(guiFont.glyphs); + guiFont.recs = NULL; + guiFont.glyphs = NULL; // Setup default raylib font guiFont = GetFontDefault(); - // Setup default raylib font rectangle - Rectangle whiteChar = { 41, 46, 2, 8 }; - SetShapesTexture(guiFont.texture, whiteChar); + // NOTE: Default raylib font character 95 is a white square + Rectangle whiteChar = guiFont.recs[95]; + + // NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering + SetShapesTexture(guiFont.texture, RAYGUI_CLITERAL(Rectangle){ whiteChar.x + 1, whiteChar.y + 1, whiteChar.width - 2, whiteChar.height - 2 }); } } @@ -3675,7 +4349,7 @@ const char *GuiIconText(int iconId, const char *text) return NULL; #else static char buffer[1024] = { 0 }; - static char iconBuffer[6] = { 0 }; + static char iconBuffer[16] = { 0 }; if (text != NULL) { @@ -3692,7 +4366,7 @@ const char *GuiIconText(int iconId, const char *text) } else { - sprintf(iconBuffer, "#%03i#", iconId & 0x1ff); + sprintf(iconBuffer, "#%03i#", iconId); return iconBuffer; } @@ -3789,7 +4463,7 @@ void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color) if (BIT_CHECK(guiIconsPtr[iconId*RAYGUI_ICON_DATA_ELEMENTS + i], k)) { #if !defined(RAYGUI_STANDALONE) - DrawRectangle(posX + (k%RAYGUI_ICON_SIZE)*pixelSize, posY + y*pixelSize, pixelSize, pixelSize, color); + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ (float)posX + (k%RAYGUI_ICON_SIZE)*pixelSize, (float)posY + y*pixelSize, (float)pixelSize, (float)pixelSize }, 0, BLANK, color); #endif } @@ -3809,6 +4483,229 @@ void GuiSetIconScale(int scale) //---------------------------------------------------------------------------------- // Module specific Functions Definition //---------------------------------------------------------------------------------- + +// Load style from memory +// WARNING: Binary files only +static void GuiLoadStyleFromMemory(const unsigned char *fileData, int dataSize) +{ + unsigned char *fileDataPtr = (unsigned char *)fileData; + + char signature[5] = { 0 }; + short version = 0; + short reserved = 0; + int propertyCount = 0; + + memcpy(signature, fileDataPtr, 4); + memcpy(&version, fileDataPtr + 4, sizeof(short)); + memcpy(&reserved, fileDataPtr + 4 + 2, sizeof(short)); + memcpy(&propertyCount, fileDataPtr + 4 + 2 + 2, sizeof(int)); + fileDataPtr += 12; + + if ((signature[0] == 'r') && + (signature[1] == 'G') && + (signature[2] == 'S') && + (signature[3] == ' ')) + { + short controlId = 0; + short propertyId = 0; + unsigned int propertyValue = 0; + + for (int i = 0; i < propertyCount; i++) + { + memcpy(&controlId, fileDataPtr, sizeof(short)); + memcpy(&propertyId, fileDataPtr + 2, sizeof(short)); + memcpy(&propertyValue, fileDataPtr + 2 + 2, sizeof(unsigned int)); + fileDataPtr += 8; + + if (controlId == 0) // DEFAULT control + { + // If a DEFAULT property is loaded, it is propagated to all controls + // NOTE: All DEFAULT properties should be defined first in the file + GuiSetStyle(0, (int)propertyId, propertyValue); + + if (propertyId < RAYGUI_MAX_PROPS_BASE) for (int j = 1; j < RAYGUI_MAX_CONTROLS; j++) GuiSetStyle(j, (int)propertyId, propertyValue); + } + else GuiSetStyle((int)controlId, (int)propertyId, propertyValue); + } + + // Font loading is highly dependant on raylib API to load font data and image + +#if !defined(RAYGUI_STANDALONE) + // Load custom font if available + int fontDataSize = 0; + memcpy(&fontDataSize, fileDataPtr, sizeof(int)); + fileDataPtr += 4; + + if (fontDataSize > 0) + { + Font font = { 0 }; + int fontType = 0; // 0-Normal, 1-SDF + + memcpy(&font.baseSize, fileDataPtr, sizeof(int)); + memcpy(&font.glyphCount, fileDataPtr + 4, sizeof(int)); + memcpy(&fontType, fileDataPtr + 4 + 4, sizeof(int)); + fileDataPtr += 12; + + // Load font white rectangle + Rectangle fontWhiteRec = { 0 }; + memcpy(&fontWhiteRec, fileDataPtr, sizeof(Rectangle)); + fileDataPtr += 16; + + // Load font image parameters + int fontImageUncompSize = 0; + int fontImageCompSize = 0; + memcpy(&fontImageUncompSize, fileDataPtr, sizeof(int)); + memcpy(&fontImageCompSize, fileDataPtr + 4, sizeof(int)); + fileDataPtr += 8; + + Image imFont = { 0 }; + imFont.mipmaps = 1; + memcpy(&imFont.width, fileDataPtr, sizeof(int)); + memcpy(&imFont.height, fileDataPtr + 4, sizeof(int)); + memcpy(&imFont.format, fileDataPtr + 4 + 4, sizeof(int)); + fileDataPtr += 12; + + if ((fontImageCompSize > 0) && (fontImageCompSize != fontImageUncompSize)) + { + // Compressed font atlas image data (DEFLATE), it requires DecompressData() + int dataUncompSize = 0; + unsigned char *compData = (unsigned char *)RAYGUI_MALLOC(fontImageCompSize); + memcpy(compData, fileDataPtr, fontImageCompSize); + fileDataPtr += fontImageCompSize; + + imFont.data = DecompressData(compData, fontImageCompSize, &dataUncompSize); + + // Security check, dataUncompSize must match the provided fontImageUncompSize + if (dataUncompSize != fontImageUncompSize) RAYGUI_LOG("WARNING: Uncompressed font atlas image data could be corrupted"); + + RAYGUI_FREE(compData); + } + else + { + // Font atlas image data is not compressed + imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageUncompSize); + memcpy(imFont.data, fileDataPtr, fontImageUncompSize); + fileDataPtr += fontImageUncompSize; + } + + if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); + font.texture = LoadTextureFromImage(imFont); + + RAYGUI_FREE(imFont.data); + + // Validate font atlas texture was loaded correctly + if (font.texture.id != 0) + { + // Load font recs data + int recsDataSize = font.glyphCount*sizeof(Rectangle); + int recsDataCompressedSize = 0; + + // WARNING: Version 400 adds the compression size parameter + if (version >= 400) + { + // RGS files version 400 support compressed recs data + memcpy(&recsDataCompressedSize, fileDataPtr, sizeof(int)); + fileDataPtr += sizeof(int); + } + + if ((recsDataCompressedSize > 0) && (recsDataCompressedSize != recsDataSize)) + { + // Recs data is compressed, uncompress it + unsigned char *recsDataCompressed = (unsigned char *)RAYGUI_MALLOC(recsDataCompressedSize); + + memcpy(recsDataCompressed, fileDataPtr, recsDataCompressedSize); + fileDataPtr += recsDataCompressedSize; + + int recsDataUncompSize = 0; + font.recs = (Rectangle *)DecompressData(recsDataCompressed, recsDataCompressedSize, &recsDataUncompSize); + + // Security check, data uncompressed size must match the expected original data size + if (recsDataUncompSize != recsDataSize) RAYGUI_LOG("WARNING: Uncompressed font recs data could be corrupted"); + + RAYGUI_FREE(recsDataCompressed); + } + else + { + // Recs data is uncompressed + font.recs = (Rectangle *)RAYGUI_CALLOC(font.glyphCount, sizeof(Rectangle)); + for (int i = 0; i < font.glyphCount; i++) + { + memcpy(&font.recs[i], fileDataPtr, sizeof(Rectangle)); + fileDataPtr += sizeof(Rectangle); + } + } + + // Load font glyphs info data + int glyphsDataSize = font.glyphCount*16; // 16 bytes data per glyph + int glyphsDataCompressedSize = 0; + + // WARNING: Version 400 adds the compression size parameter + if (version >= 400) + { + // RGS files version 400 support compressed glyphs data + memcpy(&glyphsDataCompressedSize, fileDataPtr, sizeof(int)); + fileDataPtr += sizeof(int); + } + + // Allocate required glyphs space to fill with data + font.glyphs = (GlyphInfo *)RAYGUI_CALLOC(font.glyphCount, sizeof(GlyphInfo)); + + if ((glyphsDataCompressedSize > 0) && (glyphsDataCompressedSize != glyphsDataSize)) + { + // Glyphs data is compressed, uncompress it + unsigned char *glypsDataCompressed = (unsigned char *)RAYGUI_MALLOC(glyphsDataCompressedSize); + + memcpy(glypsDataCompressed, fileDataPtr, glyphsDataCompressedSize); + fileDataPtr += glyphsDataCompressedSize; + + int glyphsDataUncompSize = 0; + unsigned char *glyphsDataUncomp = DecompressData(glypsDataCompressed, glyphsDataCompressedSize, &glyphsDataUncompSize); + + // Security check, data uncompressed size must match the expected original data size + if (glyphsDataUncompSize != glyphsDataSize) RAYGUI_LOG("WARNING: Uncompressed font glyphs data could be corrupted"); + + unsigned char *glyphsDataUncompPtr = glyphsDataUncomp; + + for (int i = 0; i < font.glyphCount; i++) + { + memcpy(&font.glyphs[i].value, glyphsDataUncompPtr, sizeof(int)); + memcpy(&font.glyphs[i].offsetX, glyphsDataUncompPtr + 4, sizeof(int)); + memcpy(&font.glyphs[i].offsetY, glyphsDataUncompPtr + 8, sizeof(int)); + memcpy(&font.glyphs[i].advanceX, glyphsDataUncompPtr + 12, sizeof(int)); + glyphsDataUncompPtr += 16; + } + + RAYGUI_FREE(glypsDataCompressed); + RAYGUI_FREE(glyphsDataUncomp); + } + else + { + // Glyphs data is uncompressed + for (int i = 0; i < font.glyphCount; i++) + { + memcpy(&font.glyphs[i].value, fileDataPtr, sizeof(int)); + memcpy(&font.glyphs[i].offsetX, fileDataPtr + 4, sizeof(int)); + memcpy(&font.glyphs[i].offsetY, fileDataPtr + 8, sizeof(int)); + memcpy(&font.glyphs[i].advanceX, fileDataPtr + 12, sizeof(int)); + fileDataPtr += 16; + } + } + } + else font = GetFontDefault(); // Fallback in case of errors loading font atlas texture + + GuiSetFont(font); + + // Set font texture source rectangle to be used as white texture to draw shapes + // NOTE: It makes possible to draw shapes and text (full UI) in a single draw call + if ((fontWhiteRec.x > 0) && + (fontWhiteRec.y > 0) && + (fontWhiteRec.width > 0) && + (fontWhiteRec.height > 0)) SetShapesTexture(font.texture, fontWhiteRec); + } +#endif + } +} + // Gui get text width considering icon static int GetTextWidth(const char *text) { @@ -3823,7 +4720,7 @@ static int GetTextWidth(const char *text) { if (text[0] == '#') { - for (int i = 1; (text[i] != '\0') && (i < 5); i++) + for (int i = 1; (i < 5) && (text[i] != '\0'); i++) { if (text[i] == '#') { @@ -3858,14 +4755,14 @@ static int GetTextWidth(const char *text) int codepoint = GetCodepointNext(&text[i], &codepointSize); int codepointIndex = GetGlyphIndex(guiFont, codepoint); - if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); - else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor + GuiGetStyle(DEFAULT, TEXT_SPACING)); + if (guiFont.glyphs[codepointIndex].advanceX == 0) glyphWidth = ((float)guiFont.recs[codepointIndex].width*scaleFactor); + else glyphWidth = ((float)guiFont.glyphs[codepointIndex].advanceX*scaleFactor); - textSize.x += glyphWidth; + textSize.x += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); } } - if (textIconOffset > 0) textSize.x += (RAYGUI_ICON_SIZE - ICON_TEXT_PADDING); + if (textIconOffset > 0) textSize.x += (RAYGUI_ICON_SIZE + ICON_TEXT_PADDING); } return (int)textSize.x; @@ -3877,27 +4774,31 @@ static Rectangle GetTextBounds(int control, Rectangle bounds) Rectangle textBounds = bounds; textBounds.x = bounds.x + GuiGetStyle(control, BORDER_WIDTH); - textBounds.y = bounds.y + GuiGetStyle(control, BORDER_WIDTH); + textBounds.y = bounds.y + GuiGetStyle(control, BORDER_WIDTH) + GuiGetStyle(control, TEXT_PADDING); textBounds.width = bounds.width - 2*GuiGetStyle(control, BORDER_WIDTH) - 2*GuiGetStyle(control, TEXT_PADDING); - textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH); + textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH) - 2*GuiGetStyle(control, TEXT_PADDING); // NOTE: Text is processed line per line! - // Consider TEXT_PADDING properly, depends on control type and TEXT_ALIGNMENT + // Depending on control, TEXT_PADDING and TEXT_ALIGNMENT properties could affect the text-bounds switch (control) { - case COMBOBOX: textBounds.width -= (GuiGetStyle(control, COMBO_BUTTON_WIDTH) + GuiGetStyle(control, COMBO_BUTTON_SPACING)); break; - //case VALUEBOX: break; // NOTE: ValueBox text value always centered, text padding applies to label + case COMBOBOX: + case DROPDOWNBOX: + case LISTVIEW: + // TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW + case SLIDER: + case CHECKBOX: + case VALUEBOX: + case SPINNER: + // TODO: More special cases (label on side): SLIDER, CHECKBOX, VALUEBOX, SPINNER default: { + // TODO: WARNING: TEXT_ALIGNMENT is already considered in GuiDrawText() if (GuiGetStyle(control, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT) textBounds.x -= GuiGetStyle(control, TEXT_PADDING); else textBounds.x += GuiGetStyle(control, TEXT_PADDING); - textBounds.width -= 2 * GuiGetStyle(control, TEXT_PADDING); } break; } - // TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW (scrollbar?) - // More special cases (label on side): CHECKBOX, SLIDER, VALUEBOX, SPINNER - return textBounds; } @@ -3945,13 +4846,13 @@ const char **GetTextLines(const char *text, int *count) lines[0] = text; int len = 0; *count = 1; - int lineSize = 0; // Stores current line size, not returned + //int lineSize = 0; // Stores current line size, not returned for (int i = 0, k = 0; (i < textSize) && (*count < RAYGUI_MAX_TEXT_LINES); i++) { if (text[i] == '\n') { - lineSize = len; + //lineSize = len; k++; lines[k] = &text[i + 1]; // WARNING: next value is valid? len = 0; @@ -3965,8 +4866,37 @@ const char **GetTextLines(const char *text, int *count) return lines; } +// Get text width to next space for provided string +static float GetNextSpaceWidth(const char *text, int *nextSpaceIndex) +{ + float width = 0; + int codepointByteCount = 0; + int codepoint = 0; + int index = 0; + float glyphWidth = 0; + float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/guiFont.baseSize; + + for (int i = 0; text[i] != '\0'; i++) + { + if (text[i] != ' ') + { + codepoint = GetCodepoint(&text[i], &codepointByteCount); + index = GetGlyphIndex(guiFont, codepoint); + glyphWidth = (guiFont.glyphs[index].advanceX == 0)? guiFont.recs[index].width*scaleFactor : guiFont.glyphs[index].advanceX*scaleFactor; + width += (glyphWidth + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + } + else + { + *nextSpaceIndex = i; + break; + } + } + + return width; +} + // Gui draw text using default font -static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint) +static void GuiDrawText(const char *text, Rectangle textBounds, int alignment, Color tint) { #define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect @@ -3974,118 +4904,214 @@ static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color #define ICON_TEXT_PADDING 4 #endif - // We process the text lines one by one - if ((text != NULL) && (text[0] != '\0')) + if ((text == NULL) || (text[0] == '\0')) return; // Security check + + // PROCEDURE: + // - Text is processed line per line + // - For every line, horizontal alignment is defined + // - For all text, vertical alignment is defined (multiline text only) + // - For every line, wordwrap mode is checked (useful for GuitextBox(), read-only) + + // Get text lines (using '\n' as delimiter) to be processed individually + // WARNING: We can't use GuiTextSplit() function because it can be already used + // before the GuiDrawText() call and its buffer is static, it would be overriden :( + int lineCount = 0; + const char **lines = GetTextLines(text, &lineCount); + + // Text style variables + //int alignment = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT); + int alignmentVertical = GuiGetStyle(DEFAULT, TEXT_ALIGNMENT_VERTICAL); + int wrapMode = GuiGetStyle(DEFAULT, TEXT_WRAP_MODE); // Wrap-mode only available in read-only mode, no for text editing + + // TODO: WARNING: This totalHeight is not valid for vertical alignment in case of word-wrap + float totalHeight = (float)(lineCount*GuiGetStyle(DEFAULT, TEXT_SIZE) + (lineCount - 1)*GuiGetStyle(DEFAULT, TEXT_SIZE)/2); + float posOffsetY = 0.0f; + + for (int i = 0; i < lineCount; i++) { - // Get text lines ('\n' delimiter) to process lines individually - // NOTE: We can't use GuiTextSplit() because it can be already use before calling - // GuiDrawText() and static buffer would be overriden :( - int lineCount = 0; - const char **lines = GetTextLines(text, &lineCount); + int iconId = 0; + lines[i] = GetTextIcon(lines[i], &iconId); // Check text for icon and move cursor - //Rectangle textBounds = GetTextBounds(LABEL, bounds); - float totalHeight = (float)(lineCount*GuiGetStyle(DEFAULT, TEXT_SIZE) + (lineCount - 1)*GuiGetStyle(DEFAULT, TEXT_SIZE)/2); - float posOffsetY = 0; + // Get text position depending on alignment and iconId + //--------------------------------------------------------------------------------- + Vector2 textBoundsPosition = { textBounds.x, textBounds.y }; + float textBoundsWidthOffset = 0.0f; - for (int i = 0; i < lineCount; i++) - { - int iconId = 0; - lines[i] = GetTextIcon(lines[i], &iconId); // Check text for icon and move cursor + // NOTE: We get text size after icon has been processed + // WARNING: GetTextWidth() also processes text icon to get width! -> Really needed? + int textSizeX = GetTextWidth(lines[i]); - // Get text position depending on alignment and iconId - //--------------------------------------------------------------------------------- - Vector2 position = { bounds.x, bounds.y }; + // If text requires an icon, add size to measure + if (iconId >= 0) + { + textSizeX += RAYGUI_ICON_SIZE*guiIconScale; - // TODO: We get text size after icon has been processed - // WARNING: GetTextWidth() also processes text icon to get width! -> Really needed? - int textSizeX = GetTextWidth(lines[i]); + // WARNING: If only icon provided, text could be pointing to EOF character: '\0' +#if !defined(RAYGUI_NO_ICONS) + if ((lines[i] != NULL) && (lines[i][0] != '\0')) textSizeX += ICON_TEXT_PADDING; +#endif + } - // If text requires an icon, add size to measure - if (iconId >= 0) - { - textSizeX += RAYGUI_ICON_SIZE*guiIconScale; + // Check guiTextAlign global variables + switch (alignment) + { + case TEXT_ALIGN_LEFT: textBoundsPosition.x = textBounds.x; break; + case TEXT_ALIGN_CENTER: textBoundsPosition.x = textBounds.x + textBounds.width/2 - textSizeX/2; break; + case TEXT_ALIGN_RIGHT: textBoundsPosition.x = textBounds.x + textBounds.width - textSizeX; break; + default: break; + } - // WARNING: If only icon provided, text could be pointing to EOF character: '\0' - if ((lines[i] != NULL) && (lines[i][0] != '\0')) textSizeX += ICON_TEXT_PADDING; - } + if (textSizeX > textBounds.width && (lines[i] != NULL) && (lines[i][0] != '\0')) textBoundsPosition.x = textBounds.x; - // Check guiTextAlign global variables - switch (alignment) - { - case TEXT_ALIGN_LEFT: - { - position.x = bounds.x; - position.y = bounds.y + posOffsetY + bounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height); - } break; - case TEXT_ALIGN_CENTER: - { - position.x = bounds.x + bounds.width/2 - textSizeX/2; - position.y = bounds.y + posOffsetY + bounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height); - } break; - case TEXT_ALIGN_RIGHT: - { - position.x = bounds.x + bounds.width - textSizeX; - position.y = bounds.y + posOffsetY + bounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height); - } break; - default: break; - } + switch (alignmentVertical) + { + // Only valid in case of wordWrap = 0; + case TEXT_ALIGN_TOP: textBoundsPosition.y = textBounds.y + posOffsetY; break; + case TEXT_ALIGN_MIDDLE: textBoundsPosition.y = textBounds.y + posOffsetY + textBounds.height/2 - totalHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height); break; + case TEXT_ALIGN_BOTTOM: textBoundsPosition.y = textBounds.y + posOffsetY + textBounds.height - totalHeight + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height); break; + default: break; + } - // NOTE: Make sure we get pixel-perfect coordinates, - // In case of decimals we got weird text positioning - position.x = (float)((int)position.x); - position.y = (float)((int)position.y); - //--------------------------------------------------------------------------------- + // NOTE: Make sure we get pixel-perfect coordinates, + // In case of decimals we got weird text positioning + textBoundsPosition.x = (float)((int)textBoundsPosition.x); + textBoundsPosition.y = (float)((int)textBoundsPosition.y); + //--------------------------------------------------------------------------------- - // Draw text (with icon if available) - //--------------------------------------------------------------------------------- + // Draw text (with icon if available) + //--------------------------------------------------------------------------------- #if !defined(RAYGUI_NO_ICONS) - if (iconId >= 0) - { - // NOTE: We consider icon height, probably different than text size - GuiDrawIcon(iconId, (int)position.x, (int)(bounds.y + bounds.height/2 - RAYGUI_ICON_SIZE*guiIconScale/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height)), guiIconScale, tint); - position.x += (RAYGUI_ICON_SIZE*guiIconScale + ICON_TEXT_PADDING); - } + if (iconId >= 0) + { + // NOTE: We consider icon height, probably different than text size + GuiDrawIcon(iconId, (int)textBoundsPosition.x, (int)(textBounds.y + textBounds.height/2 - RAYGUI_ICON_SIZE*guiIconScale/2 + TEXT_VALIGN_PIXEL_OFFSET(textBounds.height)), guiIconScale, tint); + textBoundsPosition.x += (float)(RAYGUI_ICON_SIZE*guiIconScale + ICON_TEXT_PADDING); + textBoundsWidthOffset = (float)(RAYGUI_ICON_SIZE*guiIconScale + ICON_TEXT_PADDING); + } #endif - //DrawTextEx(guiFont, text, position, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING), tint); + // Get size in bytes of text, + // considering end of line and line break + int lineSize = 0; + for (int c = 0; (lines[i][c] != '\0') && (lines[i][c] != '\n') && (lines[i][c] != '\r'); c++, lineSize++){ } + float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/guiFont.baseSize; + + int lastSpaceIndex = 0; + bool tempWrapCharMode = false; + + int textOffsetY = 0; + float textOffsetX = 0.0f; + float glyphWidth = 0; + + int ellipsisWidth = GetTextWidth("..."); + bool textOverflow = false; + for (int c = 0, codepointSize = 0; c < lineSize; c += codepointSize) + { + int codepoint = GetCodepointNext(&lines[i][c], &codepointSize); + int index = GetGlyphIndex(guiFont, codepoint); - // Get size in bytes of text, - // considering end of line and line break - int size = 0; - for (int c = 0; (lines[i][c] != '\0') && (lines[i][c] != '\n'); c++, size++){ } - float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/guiFont.baseSize; + // NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f) + // but we need to draw all of the bad bytes using the '?' symbol moving one byte + if (codepoint == 0x3f) codepointSize = 1; // TODO: Review not recognized codepoints size + + // Get glyph width to check if it goes out of bounds + if (guiFont.glyphs[index].advanceX == 0) glyphWidth = ((float)guiFont.recs[index].width*scaleFactor); + else glyphWidth = (float)guiFont.glyphs[index].advanceX*scaleFactor; + + // Wrap mode text measuring, to validate if + // it can be drawn or a new line is required + if (wrapMode == TEXT_WRAP_CHAR) + { + // Jump to next line if current character reach end of the box limits + if ((textOffsetX + glyphWidth) > textBounds.width - textBoundsWidthOffset) + { + textOffsetX = 0.0f; + textOffsetY += GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); - int textOffsetY = 0; - float textOffsetX = 0.0f; - for (int c = 0, codepointSize = 0; c < size; c += codepointSize) + if (tempWrapCharMode) // Wrap at char level when too long words + { + wrapMode = TEXT_WRAP_WORD; + tempWrapCharMode = false; + } + } + } + else if (wrapMode == TEXT_WRAP_WORD) { - int codepoint = GetCodepointNext(&lines[i][c], &codepointSize); - int index = GetGlyphIndex(guiFont, codepoint); + if (codepoint == 32) lastSpaceIndex = c; - // NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f) - // but we need to draw all of the bad bytes using the '?' symbol moving one byte - if (codepoint == 0x3f) codepointSize = 1; + // Get width to next space in line + int nextSpaceIndex = 0; + float nextSpaceWidth = GetNextSpaceWidth(lines[i] + c, &nextSpaceIndex); - if (codepoint == '\n') break; // WARNING: Lines are already processed manually, no need to keep drawing after this codepoint - else + int nextSpaceIndex2 = 0; + float nextWordSize = GetNextSpaceWidth(lines[i] + lastSpaceIndex + 1, &nextSpaceIndex2); + + if (nextWordSize > textBounds.width - textBoundsWidthOffset) + { + // Considering the case the next word is longer than bounds + tempWrapCharMode = true; + wrapMode = TEXT_WRAP_CHAR; + } + else if ((textOffsetX + nextSpaceWidth) > textBounds.width - textBoundsWidthOffset) + { + textOffsetX = 0.0f; + textOffsetY += GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); + } + } + + if (codepoint == '\n') break; // WARNING: Lines are already processed manually, no need to keep drawing after this codepoint + else + { + // TODO: There are multiple types of spaces in Unicode, + // maybe it's a good idea to add support for more: http://jkorpela.fi/chars/spaces.html + if ((codepoint != ' ') && (codepoint != '\t')) // Do not draw codepoints with no glyph { - if ((codepoint != ' ') && (codepoint != '\t')) + if (wrapMode == TEXT_WRAP_NONE) + { + // Draw only required text glyphs fitting the textBounds.width + if (textSizeX > textBounds.width) + { + if (textOffsetX <= (textBounds.width - glyphWidth - textBoundsWidthOffset - ellipsisWidth)) + { + DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); + } + else if (!textOverflow) + { + textOverflow = true; + + for (int j = 0; j < ellipsisWidth; j += ellipsisWidth/3) + { + DrawTextCodepoint(guiFont, '.', RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX + j, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); + } + } + } + else + { + DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); + } + } + else if ((wrapMode == TEXT_WRAP_CHAR) || (wrapMode == TEXT_WRAP_WORD)) { - // TODO: Draw only required text glyphs fitting the bounds.width, '...' can be appended at the end of the text - if (textOffsetX < bounds.width) + // Draw only glyphs inside the bounds + if ((textBoundsPosition.y + textOffsetY) <= (textBounds.y + textBounds.height - GuiGetStyle(DEFAULT, TEXT_SIZE))) { - DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ position.x + textOffsetX, position.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), tint); + DrawTextCodepoint(guiFont, codepoint, RAYGUI_CLITERAL(Vector2){ textBoundsPosition.x + textOffsetX, textBoundsPosition.y + textOffsetY }, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), GuiFade(tint, guiAlpha)); } } - - if (guiFont.glyphs[index].advanceX == 0) textOffsetX += ((float)guiFont.recs[index].width*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); - else textOffsetX += ((float)guiFont.glyphs[index].advanceX*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); } - } - posOffsetY += (float)GuiGetStyle(DEFAULT, TEXT_SIZE)*1.5f; // TODO: GuiGetStyle(DEFAULT, TEXT_LINE_SPACING)? - //--------------------------------------------------------------------------------- + if (guiFont.glyphs[index].advanceX == 0) textOffsetX += ((float)guiFont.recs[index].width*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + else textOffsetX += ((float)guiFont.glyphs[index].advanceX*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + } } + + if (wrapMode == TEXT_WRAP_NONE) posOffsetY += (float)GuiGetStyle(DEFAULT, TEXT_LINE_SPACING); + else if ((wrapMode == TEXT_WRAP_CHAR) || (wrapMode == TEXT_WRAP_WORD)) posOffsetY += (textOffsetY + (float)GuiGetStyle(DEFAULT, TEXT_LINE_SPACING)); + //--------------------------------------------------------------------------------- } + +#if defined(RAYGUI_DEBUG_TEXT_BOUNDS) + GuiDrawRectangle(textBounds, 0, WHITE, Fade(BLUE, 0.4f)); +#endif } // Gui draw rectangle using default raygui plain style with borders @@ -4094,25 +5120,29 @@ static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, if (color.a > 0) { // Draw rectangle filled with color - DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, color); + DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, GuiFade(color, guiAlpha)); } if (borderWidth > 0) { // Draw rectangle border lines with color - DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, borderWidth, borderColor); - DrawRectangle((int)rec.x, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, borderColor); - DrawRectangle((int)rec.x + (int)rec.width - borderWidth, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, borderColor); - DrawRectangle((int)rec.x, (int)rec.y + (int)rec.height - borderWidth, (int)rec.width, borderWidth, borderColor); + DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, borderWidth, GuiFade(borderColor, guiAlpha)); + DrawRectangle((int)rec.x, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, GuiFade(borderColor, guiAlpha)); + DrawRectangle((int)rec.x + (int)rec.width - borderWidth, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, GuiFade(borderColor, guiAlpha)); + DrawRectangle((int)rec.x, (int)rec.y + (int)rec.height - borderWidth, (int)rec.width, borderWidth, GuiFade(borderColor, guiAlpha)); } + +#if defined(RAYGUI_DEBUG_RECS_BOUNDS) + DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, Fade(RED, 0.4f)); +#endif } // Draw tooltip using control bounds static void GuiTooltip(Rectangle controlRec) { - if (!guiLocked && guiTooltip && (guiTooltipPtr != NULL)) + if (!guiLocked && guiTooltip && (guiTooltipPtr != NULL) && !guiControlExclusiveMode) { - Vector2 textSize = MeasureTextEx(GuiGetFont(), guiTooltipPtr, GuiGetStyle(DEFAULT, TEXT_SIZE), GuiGetStyle(DEFAULT, TEXT_SPACING)); + Vector2 textSize = MeasureTextEx(GuiGetFont(), guiTooltipPtr, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); if ((controlRec.x + textSize.x + 16) > GetScreenWidth()) controlRec.x -= (textSize.x + 16 - controlRec.width); @@ -4139,7 +5169,7 @@ static const char **GuiTextSplit(const char *text, char delimiter, int *count, i // 2. Maximum size of text to split is RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE // NOTE: Those definitions could be externally provided if required - // WARNING: HACK: TODO: Review! + // TODO: HACK: GuiTextSplit() - Review how textRows are returned to user // textRow is an externally provided array of integers that stores row number for every splitted string #if !defined(RAYGUI_TEXTSPLIT_MAX_ITEMS) @@ -4176,7 +5206,7 @@ static const char **GuiTextSplit(const char *text, char delimiter, int *count, i buffer[i] = '\0'; // Set an end of string at this point counter++; - if (counter == RAYGUI_TEXTSPLIT_MAX_ITEMS) break; + if (counter > RAYGUI_TEXTSPLIT_MAX_ITEMS) break; } } @@ -4336,8 +5366,11 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) if (value > maxValue) value = maxValue; if (value < minValue) value = minValue; - const int range = maxValue - minValue; + int valueRange = maxValue - minValue; + if (valueRange <= 0) valueRange = 1; + int sliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); + if (sliderSize < 1) sliderSize = 1; // TODO: Consider a minimum slider size // Calculate rectangles for all of the components arrowUpLeft = RAYGUI_CLITERAL(Rectangle){ @@ -4349,15 +5382,27 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) { arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + bounds.height - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize }; scrollbar = RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), arrowUpLeft.y + arrowUpLeft.height, bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING)), bounds.height - arrowUpLeft.height - arrowDownRight.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) }; - sliderSize = (sliderSize >= scrollbar.height)? ((int)scrollbar.height - 2) : sliderSize; // Make sure the slider won't get outside of the scrollbar - slider = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), (float)scrollbar.y + (int)(((float)(value - minValue)/range)*(scrollbar.height - sliderSize)), (float)bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)), (float)sliderSize }; + + // Make sure the slider won't get outside of the scrollbar + sliderSize = (sliderSize >= scrollbar.height)? ((int)scrollbar.height - 2) : sliderSize; + slider = RAYGUI_CLITERAL(Rectangle){ + bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), + scrollbar.y + (int)(((float)(value - minValue)/valueRange)*(scrollbar.height - sliderSize)), + bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)), + (float)sliderSize }; } else // horizontal { arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + bounds.width - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize }; scrollbar = RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x + arrowUpLeft.width, bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), bounds.width - arrowUpLeft.width - arrowDownRight.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING)) }; - sliderSize = (sliderSize >= scrollbar.width)? ((int)scrollbar.width - 2) : sliderSize; // Make sure the slider won't get outside of the scrollbar - slider = RAYGUI_CLITERAL(Rectangle){ (float)scrollbar.x + (int)(((float)(value - minValue)/range)*(scrollbar.width - sliderSize)), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), (float)sliderSize, (float)bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)) }; + + // Make sure the slider won't get outside of the scrollbar + sliderSize = (sliderSize >= scrollbar.width)? ((int)scrollbar.width - 2) : sliderSize; + slider = RAYGUI_CLITERAL(Rectangle){ + scrollbar.x + (int)(((float)(value - minValue)/valueRange)*(scrollbar.width - sliderSize)), + bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), + (float)sliderSize, + bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)) }; } // Update control @@ -4366,7 +5411,27 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) { Vector2 mousePoint = GetMousePosition(); - if (CheckCollisionPointRec(mousePoint, bounds)) + if (guiControlExclusiveMode) // Allows to keep dragging outside of bounds + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON) && + !CheckCollisionPointRec(mousePoint, arrowUpLeft) && + !CheckCollisionPointRec(mousePoint, arrowDownRight)) + { + if (CHECK_BOUNDS_ID(bounds, guiControlExclusiveRec)) + { + state = STATE_PRESSED; + + if (isVertical) value = (int)(((float)(mousePoint.y - scrollbar.y - slider.height/2)*valueRange)/(scrollbar.height - slider.height) + minValue); + else value = (int)(((float)(mousePoint.x - scrollbar.x - slider.width/2)*valueRange)/(scrollbar.width - slider.width) + minValue); + } + } + else + { + guiControlExclusiveMode = false; + guiControlExclusiveRec = RAYGUI_CLITERAL(Rectangle){ 0, 0, 0, 0 }; + } + } + else if (CheckCollisionPointRec(mousePoint, bounds)) { state = STATE_FOCUSED; @@ -4374,26 +5439,38 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) int wheel = (int)GetMouseWheelMove(); if (wheel != 0) value += wheel; + // Handle mouse button down if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { - if (CheckCollisionPointRec(mousePoint, arrowUpLeft)) value -= range/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); - else if (CheckCollisionPointRec(mousePoint, arrowDownRight)) value += range/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + guiControlExclusiveMode = true; + guiControlExclusiveRec = bounds; // Store bounds as an identifier when dragging starts + + // Check arrows click + if (CheckCollisionPointRec(mousePoint, arrowUpLeft)) value -= valueRange/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + else if (CheckCollisionPointRec(mousePoint, arrowDownRight)) value += valueRange/GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + else if (!CheckCollisionPointRec(mousePoint, slider)) + { + // If click on scrollbar position but not on slider, place slider directly on that position + if (isVertical) value = (int)(((float)(mousePoint.y - scrollbar.y - slider.height/2)*valueRange)/(scrollbar.height - slider.height) + minValue); + else value = (int)(((float)(mousePoint.x - scrollbar.x - slider.width/2)*valueRange)/(scrollbar.width - slider.width) + minValue); + } state = STATE_PRESSED; } - else if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + + // Keyboard control on mouse hover scrollbar + /* + if (isVertical) { - if (!isVertical) - { - Rectangle scrollArea = { arrowUpLeft.x + arrowUpLeft.width, arrowUpLeft.y, scrollbar.width, bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) }; - if (CheckCollisionPointRec(mousePoint, scrollArea)) value = (int)(((float)(mousePoint.x - scrollArea.x - slider.width/2)*range)/(scrollArea.width - slider.width) + minValue); - } - else - { - Rectangle scrollArea = { arrowUpLeft.x, arrowUpLeft.y+arrowUpLeft.height, bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), scrollbar.height }; - if (CheckCollisionPointRec(mousePoint, scrollArea)) value = (int)(((float)(mousePoint.y - scrollArea.y - slider.height/2)*range)/(scrollArea.height - slider.height) + minValue); - } + if (IsKeyDown(KEY_DOWN)) value += 5; + else if (IsKeyDown(KEY_UP)) value -= 5; } + else + { + if (IsKeyDown(KEY_RIGHT)) value += 5; + else if (IsKeyDown(KEY_LEFT)) value -= 5; + } + */ } // Normalize value @@ -4404,10 +5481,10 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) // Draw control //-------------------------------------------------------------------- - GuiDrawRectangle(bounds, GuiGetStyle(SCROLLBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED)), guiAlpha)); // Draw the background + GuiDrawRectangle(bounds, GuiGetStyle(SCROLLBAR, BORDER_WIDTH), GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED))); // Draw the background - GuiDrawRectangle(scrollbar, 0, BLANK, Fade(GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL)), guiAlpha)); // Draw the scrollbar active area background - GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BORDER + state*3)), guiAlpha)); // Draw the slider bar + GuiDrawRectangle(scrollbar, 0, BLANK, GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL))); // Draw the scrollbar active area background + GuiDrawRectangle(slider, 0, BLANK, GetColor(GuiGetStyle(SLIDER, BORDER + state*3))); // Draw the slider bar // Draw arrows (using icon if available) if (GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)) @@ -4415,17 +5492,17 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) #if defined(RAYGUI_NO_ICONS) GuiDrawText(isVertical? "^" : "<", RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); GuiDrawText(isVertical? "v" : ">", RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3)))); #else GuiDrawText(isVertical? "#121#" : "#118#", RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3)), guiAlpha)); // ICON_ARROW_UP_FILL / ICON_ARROW_LEFT_FILL + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3))); // ICON_ARROW_UP_FILL / ICON_ARROW_LEFT_FILL GuiDrawText(isVertical? "#120#" : "#119#", RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height }, - TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3)), guiAlpha)); // ICON_ARROW_DOWN_FILL / ICON_ARROW_RIGHT_FILL + TEXT_ALIGN_CENTER, GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3))); // ICON_ARROW_DOWN_FILL / ICON_ARROW_RIGHT_FILL #endif } //-------------------------------------------------------------------- @@ -4433,6 +5510,18 @@ static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) return value; } +// Color fade-in or fade-out, alpha goes from 0.0f to 1.0f +// WARNING: It multiplies current alpha by alpha scale factor +static Color GuiFade(Color color, float alpha) +{ + if (alpha < 0.0f) alpha = 0.0f; + else if (alpha > 1.0f) alpha = 1.0f; + + Color result = { color.r, color.g, color.b, (unsigned char)(color.a*alpha) }; + + return result; +} + #if defined(RAYGUI_STANDALONE) // Returns a Color struct from hexadecimal value static Color GetColor(int hexValue) @@ -4464,17 +5553,6 @@ static bool CheckCollisionPointRec(Vector2 point, Rectangle rec) return collision; } -// Color fade-in or fade-out, alpha goes from 0.0f to 1.0f -static Color Fade(Color color, float alpha) -{ - if (alpha < 0.0f) alpha = 0.0f; - else if (alpha > 1.0f) alpha = 1.0f; - - Color result = { color.r, color.g, color.b, (unsigned char)(255.0f*alpha) }; - - return result; -} - // Formatting of text with variables to 'embed' static const char *TextFormat(const char *text, ...) { @@ -4510,7 +5588,7 @@ const char **TextSplit(const char *text, char delimiter, int *count) // 2. Maximum size of text to split is RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE #if !defined(RAYGUI_TEXTSPLIT_MAX_ITEMS) - #define RAYGUI_TEXTSPLIT_MAX_ITEMS 128 + #define RAYGUI_TEXTSPLIT_MAX_ITEMS 128 #endif #if !defined(RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE) #define RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE 1024 @@ -4565,6 +5643,37 @@ static int TextToInteger(const char *text) return value*sign; } +// Get float value from text +// NOTE: This function replaces atof() [stdlib.h] +// WARNING: Only '.' character is understood as decimal point +static float TextToFloat(const char *text) +{ + float value = 0.0f; + float sign = 1.0f; + + if ((text[0] == '+') || (text[0] == '-')) + { + if (text[0] == '-') sign = -1.0f; + text++; + } + + int i = 0; + for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0'); + + if (text[i++] != '.') value *= sign; + else + { + float divisor = 10.0f; + for (; ((text[i] >= '0') && (text[i] <= '9')); i++) + { + value += ((float)(text[i] - '0'))/divisor; + divisor = divisor*10.0f; + } + } + + return value; +} + // Encode codepoint into UTF-8 text (char array size returned as parameter) static const char *CodepointToUTF8(int codepoint, int *byteSize) { @@ -4612,28 +5721,31 @@ static int GetCodepointNext(const char *text, int *codepointSize) { const char *ptr = text; int codepoint = 0x3f; // Codepoint (defaults to '?') - *codepointSize = 0; + *codepointSize = 1; // Get current codepoint and bytes processed if (0xf0 == (0xf8 & ptr[0])) { // 4 byte UTF-8 codepoint + if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80) || ((ptr[3] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks codepoint = ((0x07 & ptr[0]) << 18) | ((0x3f & ptr[1]) << 12) | ((0x3f & ptr[2]) << 6) | (0x3f & ptr[3]); *codepointSize = 4; } else if (0xe0 == (0xf0 & ptr[0])) { // 3 byte UTF-8 codepoint */ + if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80)) { return codepoint; } //10xxxxxx checks codepoint = ((0x0f & ptr[0]) << 12) | ((0x3f & ptr[1]) << 6) | (0x3f & ptr[2]); *codepointSize = 3; } else if (0xc0 == (0xe0 & ptr[0])) { // 2 byte UTF-8 codepoint + if ((ptr[1] & 0xC0) ^ 0x80) { return codepoint; } //10xxxxxx checks codepoint = ((0x1f & ptr[0]) << 6) | (0x3f & ptr[1]); *codepointSize = 2; } - else + else if (0x00 == (0x80 & ptr[0])) { // 1 byte UTF-8 codepoint codepoint = ptr[0]; @@ -4644,4 +5756,4 @@ static int GetCodepointNext(const char *text, int *codepointSize) } #endif // RAYGUI_STANDALONE -#endif // RAYGUI_IMPLEMENTATION +#endif // RAYGUI_IMPLEMENTATION \ No newline at end of file diff --git a/src/extras/reasings.h b/src/extras/reasings.h index eff5161..9cffe90 100644 --- a/src/extras/reasings.h +++ b/src/extras/reasings.h @@ -60,7 +60,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. * --------------------------------------------------------------------------------- * -* Copyright (c) 2015-2023 Ramon Santamaria (@raysan5) +* Copyright (c) 2015-2024 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. @@ -84,11 +84,13 @@ #define REASINGS_STATIC_INLINE // NOTE: By default, compile functions as static inline +#ifndef EASEDEF #if defined(REASINGS_STATIC_INLINE) #define EASEDEF static inline #else #define EASEDEF extern #endif +#endif #include // Required for: sinf(), cosf(), sqrtf(), powf() @@ -260,4 +262,4 @@ EASEDEF float EaseElasticInOut(float t, float b, float c, float d) // Ease: Elas } #endif -#endif // REASINGS_H +#endif // REASINGS_H \ No newline at end of file diff --git a/src/extras/rlgl.h b/src/extras/rlgl.h index 86208de..93600de 100644 --- a/src/extras/rlgl.h +++ b/src/extras/rlgl.h @@ -1,90 +1,94 @@ /********************************************************************************************** * -* rlgl v4.5 - A multi-OpenGL abstraction layer with an immediate-mode style API +* rlgl v5.0 - A multi-OpenGL abstraction layer with an immediate-mode style API * -* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0) -* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...) +* DESCRIPTION: +* An abstraction layer for multiple OpenGL versions (1.1, 2.1, 3.3 Core, 4.3 Core, ES 2.0, ES 3.0) +* that provides a pseudo-OpenGL 1.1 immediate-mode style API (rlVertex, rlTranslate, rlRotate...) * -* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are -* initialized on rlglInit() to accumulate vertex data. +* ADDITIONAL NOTES: +* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are +* initialized on rlglInit() to accumulate vertex data * -* When an internal state change is required all the stored vertex data is renderer in batch, -* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch. +* When an internal state change is required all the stored vertex data is rendered in batch, +* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch * -* Some additional resources are also loaded for convenience, here the complete list: -* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data -* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8 -* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs) -* -* Internal buffer (and additional resources) must be manually unloaded calling rlglClose(). +* Some resources are also loaded for convenience, here the complete list: +* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data +* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8 +* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs) * +* Internal buffer (and resources) must be manually unloaded calling rlglClose() * * CONFIGURATION: +* #define GRAPHICS_API_OPENGL_11 +* #define GRAPHICS_API_OPENGL_21 +* #define GRAPHICS_API_OPENGL_33 +* #define GRAPHICS_API_OPENGL_43 +* #define GRAPHICS_API_OPENGL_ES2 +* #define GRAPHICS_API_OPENGL_ES3 +* Use selected OpenGL graphics backend, should be supported by platform +* Those preprocessor defines are only used on rlgl module, if OpenGL version is +* required by any other module, use rlGetVersion() to check it * -* #define GRAPHICS_API_OPENGL_11 -* #define GRAPHICS_API_OPENGL_21 -* #define GRAPHICS_API_OPENGL_33 -* #define GRAPHICS_API_OPENGL_43 -* #define GRAPHICS_API_OPENGL_ES2 -* Use selected OpenGL graphics backend, should be supported by platform -* Those preprocessor defines are only used on rlgl module, if OpenGL version is -* required by any other module, use rlGetVersion() to check it -* -* #define RLGL_IMPLEMENTATION -* Generates the implementation of the library into the included file. -* If not defined, the library is in header only mode and can be included in other headers -* or source files without problems. But only ONE file should hold the implementation. +* #define RLGL_IMPLEMENTATION +* Generates the implementation of the library into the included file +* If not defined, the library is in header only mode and can be included in other headers +* or source files without problems. But only ONE file should hold the implementation * -* #define RLGL_RENDER_TEXTURES_HINT -* Enable framebuffer objects (fbo) support (enabled by default) -* Some GPUs could not support them despite the OpenGL version +* #define RLGL_RENDER_TEXTURES_HINT +* Enable framebuffer objects (fbo) support (enabled by default) +* Some GPUs could not support them despite the OpenGL version * -* #define RLGL_SHOW_GL_DETAILS_INFO -* Show OpenGL extensions and capabilities detailed logs on init +* #define RLGL_SHOW_GL_DETAILS_INFO +* Show OpenGL extensions and capabilities detailed logs on init * -* #define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT -* Enable debug context (only available on OpenGL 4.3) +* #define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT +* Enable debug context (only available on OpenGL 4.3) * -* rlgl capabilities could be customized just defining some internal -* values before library inclusion (default values listed): +* rlgl capabilities could be customized just defining some internal +* values before library inclusion (default values listed): * -* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits -* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering) -* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture) -* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture()) +* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits +* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering) +* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture) +* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture()) * -* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack -* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported -* #define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance -* #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance +* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack +* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported +* #define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance +* #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance * -* When loading a shader, the following vertex attribute and uniform -* location names are tried to be set automatically: +* When loading a shader, the following vertex attributes and uniform +* location names are tried to be set automatically: * -* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0 -* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: 1 -* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2 -* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3 -* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4 -* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix -* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix -* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix -* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix -* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)) -* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color) -* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0) -* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1) -* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2) +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS "vertexBoneIds" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))) +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color) +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES "boneMatrices" // bone matrices +* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0) +* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1) +* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2) * * DEPENDENCIES: -* * - OpenGL libraries (depending on platform and OpenGL version selected) * - GLAD OpenGL extensions loading library (only for OpenGL 3.3 Core, 4.3 Core) * * * LICENSE: zlib/libpng * -* Copyright (c) 2014-2023 Ramon Santamaria (@raysan5) +* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. @@ -106,16 +110,17 @@ #ifndef RLGL_H #define RLGL_H -#define RLGL_VERSION "4.5" +#define RLGL_VERSION "5.0" -// Function specifiers in case library is build/used as a shared library (Windows) +// Function specifiers in case library is build/used as a shared library // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll -#if defined(_WIN32) - #if defined(BUILD_LIBTYPE_SHARED) - #define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) - #elif defined(USE_LIBTYPE_SHARED) - #define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) - #endif +// NOTE: visibility(default) attribute makes symbols "visible" when compiled with -fvisibility=hidden +#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED) + #define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) +#elif defined(BUILD_LIBTYPE_SHARED) + #define RLAPI __attribute__((visibility("default"))) // We are building the library as a Unix shared library (.so/.dylib) +#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED) + #define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) #endif // Function specifiers definition @@ -148,7 +153,8 @@ !defined(GRAPHICS_API_OPENGL_21) && \ !defined(GRAPHICS_API_OPENGL_33) && \ !defined(GRAPHICS_API_OPENGL_43) && \ - !defined(GRAPHICS_API_OPENGL_ES2) + !defined(GRAPHICS_API_OPENGL_ES2) && \ + !defined(GRAPHICS_API_OPENGL_ES3) #define GRAPHICS_API_OPENGL_33 #endif @@ -179,6 +185,11 @@ #define GRAPHICS_API_OPENGL_33 #endif +// OpenGL ES 3.0 uses OpenGL ES 2.0 functionality (and more) +#if defined(GRAPHICS_API_OPENGL_ES3) + #define GRAPHICS_API_OPENGL_ES2 +#endif + // Support framebuffer objects by default // NOTE: Some driver implementation do not support it, despite they should #define RLGL_RENDER_TEXTURES_HINT @@ -311,6 +322,42 @@ #define RL_BLEND_SRC_ALPHA 0x80CB // GL_BLEND_SRC_ALPHA #define RL_BLEND_COLOR 0x8005 // GL_BLEND_COLOR +#define RL_READ_FRAMEBUFFER 0x8CA8 // GL_READ_FRAMEBUFFER +#define RL_DRAW_FRAMEBUFFER 0x8CA9 // GL_DRAW_FRAMEBUFFER + +// Default shader vertex attribute locations +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3 +#endif + #ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT +#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES 6 +#endif +#ifdef RL_SUPPORT_MESH_GPU_SKINNING +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS 7 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8 +#endif +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCE_TX + #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCE_TX 9 +#endif //---------------------------------------------------------------------------------- // Types and Structures Definition @@ -339,6 +386,7 @@ typedef struct rlVertexBuffer { 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 *normals; // Vertex normal (XYZ - 3 components per vertex) (shader-location = 2) unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) unsigned int *indices; // Vertex indices (in case vertex data comes indexed) (6 indices per quad) @@ -347,7 +395,7 @@ typedef struct rlVertexBuffer { unsigned short *indices; // Vertex indices (in case vertex data comes indexed) (6 indices per quad) #endif unsigned int vaoId; // OpenGL Vertex Array Object id - unsigned int vboId[4]; // OpenGL Vertex Buffer Objects id (4 types of vertex data) + unsigned int vboId[5]; // OpenGL Vertex Buffer Objects id (5 types of vertex data) } rlVertexBuffer; // Draw call type @@ -383,7 +431,8 @@ typedef enum { RL_OPENGL_21, // OpenGL 2.1 (GLSL 120) RL_OPENGL_33, // OpenGL 3.3 (GLSL 330) RL_OPENGL_43, // OpenGL 4.3 (using GLSL 330) - RL_OPENGL_ES_20 // OpenGL ES 2.0 (GLSL 100) + RL_OPENGL_ES_20, // OpenGL ES 2.0 (GLSL 100) + RL_OPENGL_ES_30 // OpenGL ES 3.0 (GLSL 300 es) } rlGlVersion; // Trace log level @@ -412,6 +461,9 @@ typedef enum { RL_PIXELFORMAT_UNCOMPRESSED_R32, // 32 bpp (1 channel - float) RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32, // 32*3 bpp (3 channels - float) RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32, // 32*4 bpp (4 channels - float) + RL_PIXELFORMAT_UNCOMPRESSED_R16, // 16 bpp (1 channel - half float) + RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, // 16*3 bpp (3 channels - half float) + RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16, // 16*4 bpp (4 channels - half float) RL_PIXELFORMAT_COMPRESSED_DXT1_RGB, // 4 bpp (no alpha) RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha) RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA, // 8 bpp @@ -492,6 +544,10 @@ typedef enum { RL_SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int) RL_SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int) RL_SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int) + RL_SHADER_UNIFORM_UINT, // Shader uniform type: unsigned int + RL_SHADER_UNIFORM_UIVEC2, // Shader uniform type: uivec2 (2 unsigned int) + RL_SHADER_UNIFORM_UIVEC3, // Shader uniform type: uivec3 (3 unsigned int) + RL_SHADER_UNIFORM_UIVEC4, // Shader uniform type: uivec4 (4 unsigned int) RL_SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d } rlShaderUniformDataType; @@ -506,28 +562,28 @@ typedef enum { // Framebuffer attachment type // NOTE: By default up to 8 color channels defined, but it can be more typedef enum { - RL_ATTACHMENT_COLOR_CHANNEL0 = 0, // Framebuffer attachment type: color 0 - RL_ATTACHMENT_COLOR_CHANNEL1, // Framebuffer attachment type: color 1 - RL_ATTACHMENT_COLOR_CHANNEL2, // Framebuffer attachment type: color 2 - RL_ATTACHMENT_COLOR_CHANNEL3, // Framebuffer attachment type: color 3 - RL_ATTACHMENT_COLOR_CHANNEL4, // Framebuffer attachment type: color 4 - RL_ATTACHMENT_COLOR_CHANNEL5, // Framebuffer attachment type: color 5 - RL_ATTACHMENT_COLOR_CHANNEL6, // Framebuffer attachment type: color 6 - RL_ATTACHMENT_COLOR_CHANNEL7, // Framebuffer attachment type: color 7 - RL_ATTACHMENT_DEPTH = 100, // Framebuffer attachment type: depth - RL_ATTACHMENT_STENCIL = 200, // Framebuffer attachment type: stencil + RL_ATTACHMENT_COLOR_CHANNEL0 = 0, // Framebuffer attachment type: color 0 + RL_ATTACHMENT_COLOR_CHANNEL1 = 1, // Framebuffer attachment type: color 1 + RL_ATTACHMENT_COLOR_CHANNEL2 = 2, // Framebuffer attachment type: color 2 + RL_ATTACHMENT_COLOR_CHANNEL3 = 3, // Framebuffer attachment type: color 3 + RL_ATTACHMENT_COLOR_CHANNEL4 = 4, // Framebuffer attachment type: color 4 + RL_ATTACHMENT_COLOR_CHANNEL5 = 5, // Framebuffer attachment type: color 5 + RL_ATTACHMENT_COLOR_CHANNEL6 = 6, // Framebuffer attachment type: color 6 + RL_ATTACHMENT_COLOR_CHANNEL7 = 7, // Framebuffer attachment type: color 7 + RL_ATTACHMENT_DEPTH = 100, // Framebuffer attachment type: depth + RL_ATTACHMENT_STENCIL = 200, // Framebuffer attachment type: stencil } rlFramebufferAttachType; // Framebuffer texture attachment type typedef enum { - RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, // Framebuffer texture attachment type: cubemap, +X side - RL_ATTACHMENT_CUBEMAP_NEGATIVE_X, // Framebuffer texture attachment type: cubemap, -X side - RL_ATTACHMENT_CUBEMAP_POSITIVE_Y, // Framebuffer texture attachment type: cubemap, +Y side - RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y, // Framebuffer texture attachment type: cubemap, -Y side - RL_ATTACHMENT_CUBEMAP_POSITIVE_Z, // Framebuffer texture attachment type: cubemap, +Z side - RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z, // Framebuffer texture attachment type: cubemap, -Z side - RL_ATTACHMENT_TEXTURE2D = 100, // Framebuffer texture attachment type: texture2d - RL_ATTACHMENT_RENDERBUFFER = 200, // Framebuffer texture attachment type: renderbuffer + RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, // Framebuffer texture attachment type: cubemap, +X side + RL_ATTACHMENT_CUBEMAP_NEGATIVE_X = 1, // Framebuffer texture attachment type: cubemap, -X side + RL_ATTACHMENT_CUBEMAP_POSITIVE_Y = 2, // Framebuffer texture attachment type: cubemap, +Y side + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y = 3, // Framebuffer texture attachment type: cubemap, -Y side + RL_ATTACHMENT_CUBEMAP_POSITIVE_Z = 4, // Framebuffer texture attachment type: cubemap, +Z side + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z = 5, // Framebuffer texture attachment type: cubemap, -Z side + RL_ATTACHMENT_TEXTURE2D = 100, // Framebuffer texture attachment type: texture2d + RL_ATTACHMENT_RENDERBUFFER = 200, // Framebuffer texture attachment type: renderbuffer } rlFramebufferAttachTextureType; // Face culling mode @@ -544,30 +600,33 @@ typedef enum { extern "C" { // Prevents name mangling of functions #endif -RLAPI void rlMatrixMode(int mode); // Choose the current matrix to be transformed -RLAPI void rlPushMatrix(void); // Push the current matrix to stack -RLAPI void rlPopMatrix(void); // Pop latest inserted matrix from stack -RLAPI void rlLoadIdentity(void); // Reset current matrix to identity matrix -RLAPI void rlTranslatef(float x, float y, float z); // Multiply the current matrix by a translation matrix -RLAPI void rlRotatef(float angle, float x, float y, float z); // Multiply the current matrix by a rotation matrix -RLAPI void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix -RLAPI void rlMultMatrixf(const float *matf); // Multiply the current matrix by another matrix +RLAPI void rlMatrixMode(int mode); // Choose the current matrix to be transformed +RLAPI void rlPushMatrix(void); // Push the current matrix to stack +RLAPI void rlPopMatrix(void); // Pop latest inserted matrix from stack +RLAPI void rlLoadIdentity(void); // Reset current matrix to identity matrix +RLAPI void rlTranslatef(float x, float y, float z); // Multiply the current matrix by a translation matrix +RLAPI void rlRotatef(float angle, float x, float y, float z); // Multiply the current matrix by a rotation matrix +RLAPI void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix +RLAPI void rlMultMatrixf(const float *matf); // Multiply the current matrix by another matrix RLAPI void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar); RLAPI void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar); RLAPI void rlViewport(int x, int y, int width, int height); // Set the viewport area +RLAPI void rlSetClipPlanes(double nearPlane, double farPlane); // Set clip planes distances +RLAPI double rlGetCullDistanceNear(void); // Get cull plane distance near +RLAPI double rlGetCullDistanceFar(void); // Get cull plane distance far //------------------------------------------------------------------------------------ // Functions Declaration - Vertex level operations //------------------------------------------------------------------------------------ -RLAPI void rlBegin(int mode); // Initialize drawing mode (how to organize vertex) -RLAPI void rlEnd(void); // Finish vertex providing -RLAPI void rlVertex2i(int x, int y); // Define one vertex (position) - 2 int -RLAPI void rlVertex2f(float x, float y); // Define one vertex (position) - 2 float -RLAPI void rlVertex3f(float x, float y, float z); // Define one vertex (position) - 3 float -RLAPI void rlTexCoord2f(float x, float y); // Define one vertex (texture coordinate) - 2 float -RLAPI void rlNormal3f(float x, float y, float z); // Define one vertex (normal) - 3 float -RLAPI void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a); // Define one vertex (color) - 4 byte -RLAPI void rlColor3f(float x, float y, float z); // Define one vertex (color) - 3 float +RLAPI void rlBegin(int mode); // Initialize drawing mode (how to organize vertex) +RLAPI void rlEnd(void); // Finish vertex providing +RLAPI void rlVertex2i(int x, int y); // Define one vertex (position) - 2 int +RLAPI void rlVertex2f(float x, float y); // Define one vertex (position) - 2 float +RLAPI void rlVertex3f(float x, float y, float z); // Define one vertex (position) - 3 float +RLAPI void rlTexCoord2f(float x, float y); // Define one vertex (texture coordinate) - 2 float +RLAPI void rlNormal3f(float x, float y, float z); // Define one vertex (normal) - 3 float +RLAPI void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a); // Define one vertex (color) - 4 byte +RLAPI void rlColor3f(float x, float y, float z); // Define one vertex (color) - 3 float RLAPI void rlColor4f(float x, float y, float z, float w); // Define one vertex (color) - 4 float //------------------------------------------------------------------------------------ @@ -581,13 +640,13 @@ RLAPI bool rlEnableVertexArray(unsigned int vaoId); // Enable vertex array ( RLAPI void rlDisableVertexArray(void); // Disable vertex array (VAO, if supported) RLAPI void rlEnableVertexBuffer(unsigned int id); // Enable vertex buffer (VBO) RLAPI void rlDisableVertexBuffer(void); // Disable vertex buffer (VBO) -RLAPI void rlEnableVertexBufferElement(unsigned int id);// Enable vertex buffer element (VBO element) +RLAPI void rlEnableVertexBufferElement(unsigned int id); // Enable vertex buffer element (VBO element) RLAPI void rlDisableVertexBufferElement(void); // Disable vertex buffer element (VBO element) RLAPI void rlEnableVertexAttribute(unsigned int index); // Enable vertex attribute index -RLAPI void rlDisableVertexAttribute(unsigned int index);// Disable vertex attribute index +RLAPI void rlDisableVertexAttribute(unsigned int index); // Disable vertex attribute index #if defined(GRAPHICS_API_OPENGL_11) -RLAPI void rlEnableStatePointer(int vertexAttribType, void *buffer); // Enable attribute state pointer -RLAPI void rlDisableStatePointer(int vertexAttribType); // Disable attribute state pointer +RLAPI void rlEnableStatePointer(int vertexAttribType, void *buffer); // Enable attribute state pointer +RLAPI void rlDisableStatePointer(int vertexAttribType); // Disable attribute state pointer #endif // Textures state @@ -606,10 +665,13 @@ RLAPI void rlDisableShader(void); // Disable shader progra // Framebuffer state RLAPI void rlEnableFramebuffer(unsigned int id); // Enable render texture (fbo) RLAPI void rlDisableFramebuffer(void); // Disable render texture (fbo), return to default framebuffer +RLAPI unsigned int rlGetActiveFramebuffer(void); // Get the currently active render texture (fbo), 0 for default framebuffer RLAPI void rlActiveDrawBuffers(int count); // Activate multiple draw color buffers +RLAPI void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask); // Blit active framebuffer to main framebuffer +RLAPI void rlBindFramebuffer(unsigned int target, unsigned int framebuffer); // Bind framebuffer (FBO) // General render state -RLAPI void rlEnableColorBlend(void); // Enable color blending +RLAPI void rlEnableColorBlend(void); // Enable color blending RLAPI void rlDisableColorBlend(void); // Disable color blending RLAPI void rlEnableDepthTest(void); // Enable depth test RLAPI void rlDisableDepthTest(void); // Disable depth test @@ -617,12 +679,14 @@ RLAPI void rlEnableDepthMask(void); // Enable depth write RLAPI void rlDisableDepthMask(void); // Disable depth write RLAPI void rlEnableBackfaceCulling(void); // Enable backface culling RLAPI void rlDisableBackfaceCulling(void); // Disable backface culling +RLAPI void rlColorMask(bool r, bool g, bool b, bool a); // Color mask control RLAPI void rlSetCullFace(int mode); // Set face culling mode RLAPI void rlEnableScissorTest(void); // Enable scissor test RLAPI void rlDisableScissorTest(void); // Disable scissor test RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test RLAPI void rlEnableWireMode(void); // Enable wire mode -RLAPI void rlDisableWireMode(void); // Disable wire mode +RLAPI void rlEnablePointMode(void); // Enable point mode +RLAPI void rlDisableWireMode(void); // Disable wire (and point) mode RLAPI void rlSetLineWidth(float width); // Set the line drawing width RLAPI float rlGetLineWidth(void); // Get the line drawing width RLAPI void rlEnableSmoothLines(void); // Enable line aliasing @@ -658,48 +722,48 @@ RLAPI int *rlGetShaderLocsDefault(void); // Get default shader lo // Render batch management // NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode // but this render batch API is exposed in case of custom batches are required -RLAPI rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements); // Load a render batch system -RLAPI void rlUnloadRenderBatch(rlRenderBatch batch); // Unload render batch system -RLAPI void rlDrawRenderBatch(rlRenderBatch *batch); // Draw render batch data (Update->Draw->Reset) -RLAPI void rlSetRenderBatchActive(rlRenderBatch *batch); // Set the active render batch for rlgl (NULL for default internal) -RLAPI void rlDrawRenderBatchActive(void); // Update and draw internal render batch -RLAPI bool rlCheckRenderBatchLimit(int vCount); // Check internal buffer overflow for a given number of vertex +RLAPI rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements); // Load a render batch system +RLAPI void rlUnloadRenderBatch(rlRenderBatch batch); // Unload render batch system +RLAPI void rlDrawRenderBatch(rlRenderBatch *batch); // Draw render batch data (Update->Draw->Reset) +RLAPI void rlSetRenderBatchActive(rlRenderBatch *batch); // Set the active render batch for rlgl (NULL for default internal) +RLAPI void rlDrawRenderBatchActive(void); // Update and draw internal render batch +RLAPI bool rlCheckRenderBatchLimit(int vCount); // Check internal buffer overflow for a given number of vertex RLAPI void rlSetTexture(unsigned int id); // Set current texture for render batch and check buffers limits //------------------------------------------------------------------------------------------------------------------------ // Vertex buffers management -RLAPI unsigned int rlLoadVertexArray(void); // Load vertex array (vao) if supported -RLAPI unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic); // Load a vertex buffer attribute -RLAPI unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic); // Load a new attributes element buffer -RLAPI void rlUpdateVertexBuffer(unsigned int bufferId, const void *data, int dataSize, int offset); // Update GPU buffer with new data -RLAPI void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset); // Update vertex buffer elements with new data -RLAPI void rlUnloadVertexArray(unsigned int vaoId); -RLAPI void rlUnloadVertexBuffer(unsigned int vboId); -RLAPI void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, const void *pointer); -RLAPI void rlSetVertexAttributeDivisor(unsigned int index, int divisor); -RLAPI void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count); // Set vertex attribute default value -RLAPI void rlDrawVertexArray(int offset, int count); -RLAPI void rlDrawVertexArrayElements(int offset, int count, const void *buffer); -RLAPI void rlDrawVertexArrayInstanced(int offset, int count, int instances); -RLAPI void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances); +RLAPI unsigned int rlLoadVertexArray(void); // Load vertex array (vao) if supported +RLAPI unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic); // Load a vertex buffer object +RLAPI unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic); // Load vertex buffer elements object +RLAPI void rlUpdateVertexBuffer(unsigned int bufferId, const void *data, int dataSize, int offset); // Update vertex buffer object data on GPU buffer +RLAPI void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset); // Update vertex buffer elements data on GPU buffer +RLAPI void rlUnloadVertexArray(unsigned int vaoId); // Unload vertex array (vao) +RLAPI void rlUnloadVertexBuffer(unsigned int vboId); // Unload vertex buffer object +RLAPI void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, int offset); // Set vertex attribute data configuration +RLAPI void rlSetVertexAttributeDivisor(unsigned int index, int divisor); // Set vertex attribute data divisor +RLAPI void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count); // Set vertex attribute default value, when attribute to provided +RLAPI void rlDrawVertexArray(int offset, int count); // Draw vertex array (currently active vao) +RLAPI void rlDrawVertexArrayElements(int offset, int count, const void *buffer); // Draw vertex array elements +RLAPI void rlDrawVertexArrayInstanced(int offset, int count, int instances); // Draw vertex array (currently active vao) with instancing +RLAPI void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances); // Draw vertex array elements with instancing // Textures management -RLAPI unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture in GPU -RLAPI unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo) -RLAPI unsigned int rlLoadTextureCubemap(const void *data, int size, int format); // Load texture cubemap -RLAPI void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update GPU texture with new data -RLAPI void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats +RLAPI unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount); // Load texture data +RLAPI unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo) +RLAPI unsigned int rlLoadTextureCubemap(const void *data, int size, int format, int mipmapCount); // Load texture cubemap data +RLAPI void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update texture with new data on GPU +RLAPI void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats RLAPI const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format RLAPI void rlUnloadTexture(unsigned int id); // Unload texture from GPU memory RLAPI void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps); // Generate mipmap data for selected texture -RLAPI void *rlReadTexturePixels(unsigned int id, int width, int height, int format); // Read texture pixel data +RLAPI void *rlReadTexturePixels(unsigned int id, int width, int height, int format); // Read texture pixel data RLAPI unsigned char *rlReadScreenPixels(int width, int height); // Read screen pixel data (color buffer) // Framebuffer management (fbo) -RLAPI unsigned int rlLoadFramebuffer(int width, int height); // Load an empty framebuffer -RLAPI void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer +RLAPI unsigned int rlLoadFramebuffer(void); // Load an empty framebuffer +RLAPI void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel); // Attach texture/renderbuffer to a framebuffer RLAPI bool rlFramebufferComplete(unsigned int id); // Verify framebuffer is complete RLAPI void rlUnloadFramebuffer(unsigned int id); // Delete framebuffer from GPU @@ -710,14 +774,15 @@ RLAPI unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fSha RLAPI void rlUnloadShaderProgram(unsigned int id); // Unload shader program RLAPI int rlGetLocationUniform(unsigned int shaderId, const char *uniformName); // Get shader location uniform RLAPI int rlGetLocationAttrib(unsigned int shaderId, const char *attribName); // Get shader location attribute -RLAPI void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform +RLAPI void rlSetUniform(int locIndex, const void *value, int uniformType, int count); // Set shader value uniform RLAPI void rlSetUniformMatrix(int locIndex, Matrix mat); // Set shader value matrix +RLAPI void rlSetUniformMatrices(int locIndex, const Matrix *mat, int count); // Set shader value matrices RLAPI void rlSetUniformSampler(int locIndex, unsigned int textureId); // Set shader value sampler RLAPI void rlSetShader(unsigned int id, int *locs); // Set shader currently active (id and locations) // Compute shader management RLAPI unsigned int rlLoadComputeShaderProgram(unsigned int shaderId); // Load compute shader program -RLAPI void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ); // Dispatch compute shader (equivalent to *draw* for graphics pipeline) +RLAPI void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ); // Dispatch compute shader (equivalent to *draw* for graphics pipeline) // Shader buffer storage object management (ssbo) RLAPI unsigned int rlLoadShaderBuffer(unsigned int size, const void *data, int usageHint); // Load shader storage buffer object (SSBO) @@ -760,6 +825,12 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #if defined(RLGL_IMPLEMENTATION) +// Expose OpenGL functions from glad in raylib +#if defined(BUILD_LIBTYPE_SHARED) + #define GLAD_API_CALL_EXPORT + #define GLAD_API_CALL_EXPORT_BUILD +#endif + #if defined(GRAPHICS_API_OPENGL_11) #if defined(__APPLE__) #include // OpenGL 1.1 library for OSX @@ -787,13 +858,17 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #define GLAD_FREE RL_FREE #define GLAD_GL_IMPLEMENTATION - #include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers + #include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers #endif -#if defined(GRAPHICS_API_OPENGL_ES2) - // NOTE: OpenGL ES 2.0 can be enabled on PLATFORM_DESKTOP, +#if defined(GRAPHICS_API_OPENGL_ES3) + #include // OpenGL ES 3.0 library + #define GL_GLEXT_PROTOTYPES + #include // OpenGL ES 2.0 extensions library +#elif defined(GRAPHICS_API_OPENGL_ES2) + // NOTE: OpenGL ES 2.0 can be enabled on Desktop platforms, // in that case, functions are loaded from a custom glad for OpenGL ES 2.0 - #if defined(PLATFORM_DESKTOP) + #if defined(PLATFORM_DESKTOP_GLFW) || defined(PLATFORM_DESKTOP_SDL) #define GLAD_GLES2_IMPLEMENTATION #include "external/glad_gles2.h" #else @@ -805,7 +880,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad // It seems OpenGL ES 2.0 instancing entry points are not defined on Raspberry Pi // provided headers (despite being defined in official Khronos GLES2 headers) - #if defined(PLATFORM_RPI) || defined(PLATFORM_DRM) + #if defined(PLATFORM_DRM) typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor); @@ -874,6 +949,14 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #endif +#ifndef GL_PROGRAM_POINT_SIZE + #define GL_PROGRAM_POINT_SIZE 0x8642 +#endif + +#ifndef GL_LINE_WIDTH + #define GL_LINE_WIDTH 0x0B21 +#endif + #if defined(GRAPHICS_API_OPENGL_11) #define GL_UNSIGNED_SHORT_5_6_5 0x8363 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 @@ -887,28 +970,39 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #if defined(GRAPHICS_API_OPENGL_ES2) #define glClearDepth glClearDepthf - #define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER - #define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER + #if !defined(GRAPHICS_API_OPENGL_ES3) + #define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER + #define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER + #endif #endif // Default shader vertex attribute names to set location points #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION - #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION #endif #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD - #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: 1 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD #endif #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL - #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL #endif #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR - #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR #endif #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT - #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT #endif #ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 - #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: 5 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS + #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS "vertexBoneIds" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS + #define RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS "vertexBoneWeights" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCE_TX + #define RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCE_TX "instanceTransform" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCE_TX #endif #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MVP @@ -929,6 +1023,9 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color) #endif +#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES + #define RL_DEFAULT_SHADER_UNIFORM_NAME_BONE_MATRICES "boneMatrices" // bone matrices +#endif #ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0) #endif @@ -999,6 +1096,7 @@ typedef struct rlglData { bool texDepth; // Depth textures supported (GL_ARB_depth_texture, GL_OES_depth_texture) bool texDepthWebGL; // Depth textures supported WebGL specific (GL_WEBGL_depth_texture) bool texFloat32; // float textures support (32 bit per channel) (GL_OES_texture_float) + bool texFloat16; // half float textures support (16 bit per channel) (GL_OES_texture_half_float) bool texCompDXT; // DDS texture compression support (GL_EXT_texture_compression_s3tc, GL_WEBGL_compressed_texture_s3tc, GL_WEBKIT_WEBGL_compressed_texture_s3tc) bool texCompETC1; // ETC1 texture compression support (GL_OES_compressed_ETC1_RGB8_texture, GL_WEBGL_compressed_texture_etc1) bool texCompETC2; // ETC2/EAC texture compression support (GL_ARB_ES3_compatibility) @@ -1022,11 +1120,14 @@ typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- +static double rlCullDistanceNear = RL_CULL_DISTANCE_NEAR; +static double rlCullDistanceFar = RL_CULL_DISTANCE_FAR; + #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) static rlglData RLGL = { 0 }; #endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 -#if defined(GRAPHICS_API_OPENGL_ES2) +#if defined(GRAPHICS_API_OPENGL_ES2) && !defined(GRAPHICS_API_OPENGL_ES3) // NOTE: VAO functionality is exposed through extensions (OES) static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL; static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL; @@ -1045,15 +1146,22 @@ static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL; static void rlLoadShaderDefault(void); // Load default shader static void rlUnloadShaderDefault(void); // Unload default shader #if defined(RLGL_SHOW_GL_DETAILS_INFO) -static char *rlGetCompressedFormatName(int format); // Get compressed format official GL identifier name +static const char *rlGetCompressedFormatName(int format); // Get compressed format official GL identifier name #endif // RLGL_SHOW_GL_DETAILS_INFO #endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 static int rlGetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes (image or texture) // Auxiliar matrix math functions +typedef struct rl_float16 { + float v[16]; +} rl_float16; +static rl_float16 rlMatrixToFloatV(Matrix mat); // Get float array of matrix data +#define rlMatrixToFloat(mat) (rlMatrixToFloatV(mat).v) // Get float vector for Matrix static Matrix rlMatrixIdentity(void); // Get identity matrix static Matrix rlMatrixMultiply(Matrix left, Matrix right); // Multiply two matrices +static Matrix rlMatrixTranspose(Matrix mat); // Transposes provided matrix +static Matrix rlMatrixInvert(Matrix mat); // Invert provided matrix //---------------------------------------------------------------------------------- // Module Functions Definition - Matrix operations @@ -1222,7 +1330,7 @@ void rlMultMatrixf(const float *matf) matf[2], matf[6], matf[10], matf[14], matf[3], matf[7], matf[11], matf[15] }; - *RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, mat); + *RLGL.State.currentMatrix = rlMatrixMultiply(mat, *RLGL.State.currentMatrix); } // Multiply the current matrix by a perspective matrix generated by parameters @@ -1296,6 +1404,25 @@ void rlViewport(int x, int y, int width, int height) glViewport(x, y, width, height); } +// Set clip planes distances +void rlSetClipPlanes(double nearPlane, double farPlane) +{ + rlCullDistanceNear = nearPlane; + rlCullDistanceFar = farPlane; +} + +// Get cull plane distance near +double rlGetCullDistanceNear(void) +{ + return rlCullDistanceNear; +} + +// Get cull plane distance far +double rlGetCullDistanceFar(void) +{ + return rlCullDistanceFar; +} + //---------------------------------------------------------------------------------- // Module Functions Definition - Vertex level operations //---------------------------------------------------------------------------------- @@ -1313,7 +1440,7 @@ void rlBegin(int mode) } } -void rlEnd() { glEnd(); } +void rlEnd(void) { glEnd(); } void rlVertex2i(int x, int y) { glVertex2i(x, y); } void rlVertex2f(float x, float y) { glVertex2f(x, y); } void rlVertex3f(float x, float y, float z) { glVertex3f(x, y, z); } @@ -1382,8 +1509,8 @@ void rlVertex3f(float x, float y, float z) tz = RLGL.State.transform.m2*x + RLGL.State.transform.m6*y + RLGL.State.transform.m10*z + RLGL.State.transform.m14; } - // WARNING: We can't break primitives when launching a new batch. - // RL_LINES comes in pairs, RL_TRIANGLES come in groups of 3 vertices and RL_QUADS come in groups of 4 vertices. + // WARNING: We can't break primitives when launching a new batch + // RL_LINES comes in pairs, RL_TRIANGLES come in groups of 3 vertices and RL_QUADS come in groups of 4 vertices // We must check current draw.mode when a new vertex is required and finish the batch only if the draw.mode draw.vertexCount is %2, %3 or %4 if (RLGL.State.vertexCounter > (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4 - 4)) { @@ -1416,8 +1543,10 @@ void rlVertex3f(float x, float y, float z) RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].texcoords[2*RLGL.State.vertexCounter] = RLGL.State.texcoordx; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].texcoords[2*RLGL.State.vertexCounter + 1] = RLGL.State.texcoordy; - // TODO: Add current normal - // By default rlVertexBuffer type does not store normals + // Add current normal + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].normals[3*RLGL.State.vertexCounter] = RLGL.State.normalx; + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].normals[3*RLGL.State.vertexCounter + 1] = RLGL.State.normaly; + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].normals[3*RLGL.State.vertexCounter + 2] = RLGL.State.normalz; // Add current color RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter] = RLGL.State.colorr; @@ -1453,9 +1582,26 @@ void rlTexCoord2f(float x, float y) // NOTE: Normals limited to TRIANGLES only? void rlNormal3f(float x, float y, float z) { - RLGL.State.normalx = x; - RLGL.State.normaly = y; - RLGL.State.normalz = z; + float normalx = x; + float normaly = y; + float normalz = z; + if (RLGL.State.transformRequired) + { + normalx = RLGL.State.transform.m0*x + RLGL.State.transform.m4*y + RLGL.State.transform.m8*z; + normaly = RLGL.State.transform.m1*x + RLGL.State.transform.m5*y + RLGL.State.transform.m9*z; + normalz = RLGL.State.transform.m2*x + RLGL.State.transform.m6*y + RLGL.State.transform.m10*z; + } + float length = sqrtf(normalx*normalx + normaly*normaly + normalz*normalz); + if (length != 0.0f) + { + float ilength = 1.0f/length; + normalx *= ilength; + normaly *= ilength; + normalz *= ilength; + } + RLGL.State.normalx = normalx; + RLGL.State.normaly = normaly; + RLGL.State.normalz = normalz; } // Define one vertex (color) @@ -1694,6 +1840,16 @@ void rlEnableFramebuffer(unsigned int id) #endif } +// return the active render texture (fbo) +unsigned int rlGetActiveFramebuffer(void) +{ + GLint fboId = 0; +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES3)) && defined(RLGL_RENDER_TEXTURES_HINT) + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fboId); +#endif + return fboId; +} + // Disable rendering to texture void rlDisableFramebuffer(void) { @@ -1702,11 +1858,27 @@ void rlDisableFramebuffer(void) #endif } +// Blit active framebuffer to main framebuffer +void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES3)) && defined(RLGL_RENDER_TEXTURES_HINT) + glBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask, GL_NEAREST); +#endif +} + +// Bind framebuffer object (fbo) +void rlBindFramebuffer(unsigned int target, unsigned int framebuffer) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(RLGL_RENDER_TEXTURES_HINT) + glBindFramebuffer(target, framebuffer); +#endif +} + // Activate multiple draw color buffers // NOTE: One color buffer is always active by default void rlActiveDrawBuffers(int count) { -#if (defined(GRAPHICS_API_OPENGL_33) && defined(RLGL_RENDER_TEXTURES_HINT)) +#if ((defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES3)) && defined(RLGL_RENDER_TEXTURES_HINT)) // NOTE: Maximum number of draw buffers supported is implementation dependant, // it can be queried with glGet*() but it must be at least 8 //GLint maxDrawBuffers = 0; @@ -1763,6 +1935,9 @@ void rlEnableBackfaceCulling(void) { glEnable(GL_CULL_FACE); } // Disable backface culling void rlDisableBackfaceCulling(void) { glDisable(GL_CULL_FACE); } +// Set color mask active for screen read/draw +void rlColorMask(bool r, bool g, bool b, bool a) { glColorMask(r, g, b, a); } + // Set face culling mode void rlSetCullFace(int mode) { @@ -1792,6 +1967,16 @@ void rlEnableWireMode(void) #endif } +// Enable point mode +void rlEnablePointMode(void) +{ +#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) + // NOTE: glPolygonMode() not available on OpenGL ES + glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); + glEnable(GL_PROGRAM_POINT_SIZE); +#endif +} + // Disable wire mode void rlDisableWireMode(void) { @@ -1874,7 +2059,7 @@ void rlClearScreenBuffers(void) } // Check and log OpenGL error codes -void rlCheckErrors() +void rlCheckErrors(void) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) int check = 1; @@ -2047,7 +2232,7 @@ void rlglInit(int width, int height) if ((glDebugMessageCallback != NULL) && (glDebugMessageControl != NULL)) { glDebugMessageCallback(rlDebugMessageCallback, 0); - // glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, GL_DEBUG_SEVERITY_HIGH, 0, 0, GL_TRUE); // TODO: Filter message + // glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR, GL_DEBUG_SEVERITY_HIGH, 0, 0, GL_TRUE); // Debug context options: // - GL_DEBUG_OUTPUT - Faster version but not useful for breakpoints @@ -2072,7 +2257,10 @@ void rlglInit(int width, int height) RLGL.State.currentShaderLocs = RLGL.State.defaultShaderLocs; // Init default vertex arrays buffers + // Simulate that the default shader has the location RL_SHADER_LOC_VERTEX_NORMAL to bind the normal buffer for the default render batch + RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL] = RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL; RLGL.defaultBatch = rlLoadRenderBatch(RL_DEFAULT_BATCH_BUFFERS, RL_DEFAULT_BATCH_BUFFER_ELEMENTS); + RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL] = -1; RLGL.currentBatch = &RLGL.defaultBatch; // Init stack matrices (emulating OpenGL 1.1) @@ -2168,6 +2356,7 @@ void rlLoadExtensions(void *loader) RLGL.ExtSupported.instancing = (GLAD_GL_EXT_draw_instanced && GLAD_GL_ARB_instanced_arrays); RLGL.ExtSupported.texNPOT = GLAD_GL_ARB_texture_non_power_of_two; RLGL.ExtSupported.texFloat32 = GLAD_GL_ARB_texture_float; + RLGL.ExtSupported.texFloat16 = GLAD_GL_ARB_texture_float; RLGL.ExtSupported.texDepth = GLAD_GL_ARB_depth_texture; RLGL.ExtSupported.maxDepthBits = 32; RLGL.ExtSupported.texAnisoFilter = GLAD_GL_EXT_texture_filter_anisotropic; @@ -2179,6 +2368,7 @@ void rlLoadExtensions(void *loader) RLGL.ExtSupported.instancing = true; RLGL.ExtSupported.texNPOT = true; RLGL.ExtSupported.texFloat32 = true; + RLGL.ExtSupported.texFloat16 = true; RLGL.ExtSupported.texDepth = true; RLGL.ExtSupported.maxDepthBits = 32; RLGL.ExtSupported.texAnisoFilter = true; @@ -2196,11 +2386,35 @@ void rlLoadExtensions(void *loader) #endif // GRAPHICS_API_OPENGL_33 -#if defined(GRAPHICS_API_OPENGL_ES2) - - #if defined(PLATFORM_DESKTOP) +#if defined(GRAPHICS_API_OPENGL_ES3) + // Register supported extensions flags + // OpenGL ES 3.0 extensions supported by default (or it should be) + RLGL.ExtSupported.vao = true; + RLGL.ExtSupported.instancing = true; + RLGL.ExtSupported.texNPOT = true; + RLGL.ExtSupported.texFloat32 = true; + RLGL.ExtSupported.texFloat16 = true; + RLGL.ExtSupported.texDepth = true; + RLGL.ExtSupported.texDepthWebGL = true; + RLGL.ExtSupported.maxDepthBits = 24; + RLGL.ExtSupported.texAnisoFilter = true; + RLGL.ExtSupported.texMirrorClamp = true; + // TODO: Check for additional OpenGL ES 3.0 supported extensions: + //RLGL.ExtSupported.texCompDXT = true; + //RLGL.ExtSupported.texCompETC1 = true; + //RLGL.ExtSupported.texCompETC2 = true; + //RLGL.ExtSupported.texCompPVRT = true; + //RLGL.ExtSupported.texCompASTC = true; + //RLGL.ExtSupported.maxAnisotropyLevel = true; + //RLGL.ExtSupported.computeShader = true; + //RLGL.ExtSupported.ssbo = true; + +#elif defined(GRAPHICS_API_OPENGL_ES2) + + #if defined(PLATFORM_DESKTOP_GLFW) || defined(PLATFORM_DESKTOP_SDL) + // TODO: Support GLAD loader for OpenGL ES 3.0 if (gladLoadGLES2((GLADloadfunc)loader) == 0) TRACELOG(RL_LOG_WARNING, "GLAD: Cannot load OpenGL ES2.0 functions"); - else TRACELOG(RL_LOG_INFO, "GLAD: OpenGL ES2.0 loaded successfully"); + else TRACELOG(RL_LOG_INFO, "GLAD: OpenGL ES 2.0 loaded successfully"); #endif // Get supported extensions list @@ -2249,25 +2463,47 @@ void rlLoadExtensions(void *loader) } // Check instanced rendering support - if (strcmp(extList[i], (const char *)"GL_ANGLE_instanced_arrays") == 0) // Web ANGLE + if (strstr(extList[i], (const char*)"instanced_arrays") != NULL) // Broad check for instanced_arrays { - glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedANGLE"); - glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedANGLE"); - glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorANGLE"); + // Specific check + if (strcmp(extList[i], (const char *)"GL_ANGLE_instanced_arrays") == 0) // ANGLE + { + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedANGLE"); + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedANGLE"); + glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorANGLE"); + } + else if (strcmp(extList[i], (const char *)"GL_EXT_instanced_arrays") == 0) // EXT + { + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedEXT"); + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedEXT"); + glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorEXT"); + } + else if (strcmp(extList[i], (const char *)"GL_NV_instanced_arrays") == 0) // NVIDIA GLES + { + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedNV"); + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedNV"); + glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorNV"); + } + // The feature will only be marked as supported if the elements from GL_XXX_instanced_arrays are present if ((glDrawArraysInstanced != NULL) && (glDrawElementsInstanced != NULL) && (glVertexAttribDivisor != NULL)) RLGL.ExtSupported.instancing = true; } - else + else if (strstr(extList[i], (const char *)"draw_instanced") != NULL) { - if ((strcmp(extList[i], (const char *)"GL_EXT_draw_instanced") == 0) && // Standard EXT - (strcmp(extList[i], (const char *)"GL_EXT_instanced_arrays") == 0)) + // GL_ANGLE_draw_instanced doesn't exist + if (strcmp(extList[i], (const char *)"GL_EXT_draw_instanced") == 0) { glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedEXT"); glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedEXT"); - glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorEXT"); - - if ((glDrawArraysInstanced != NULL) && (glDrawElementsInstanced != NULL) && (glVertexAttribDivisor != NULL)) RLGL.ExtSupported.instancing = true; } + else if (strcmp(extList[i], (const char*)"GL_NV_draw_instanced") == 0) + { + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedNV"); + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedNV"); + } + + // But the functions will at least be loaded if only GL_XX_EXT_draw_instanced exist + if ((glDrawArraysInstanced != NULL) && (glDrawElementsInstanced != NULL) && (glVertexAttribDivisor != NULL)) RLGL.ExtSupported.instancing = true; } // Check NPOT textures support @@ -2276,6 +2512,7 @@ void rlLoadExtensions(void *loader) // Check texture float support if (strcmp(extList[i], (const char *)"GL_OES_texture_float") == 0) RLGL.ExtSupported.texFloat32 = true; + if (strcmp(extList[i], (const char *)"GL_OES_texture_half_float") == 0) RLGL.ExtSupported.texFloat16 = true; // Check depth texture support if (strcmp(extList[i], (const char *)"GL_OES_depth_texture") == 0) RLGL.ExtSupported.texDepth = true; @@ -2391,15 +2628,17 @@ int rlGetVersion(void) #endif #if defined(GRAPHICS_API_OPENGL_21) glVersion = RL_OPENGL_21; +#elif defined(GRAPHICS_API_OPENGL_43) + glVersion = RL_OPENGL_43; #elif defined(GRAPHICS_API_OPENGL_33) glVersion = RL_OPENGL_33; #endif -#if defined(GRAPHICS_API_OPENGL_43) - glVersion = RL_OPENGL_43; -#endif -#if defined(GRAPHICS_API_OPENGL_ES2) +#if defined(GRAPHICS_API_OPENGL_ES3) + glVersion = RL_OPENGL_ES_30; +#elif defined(GRAPHICS_API_OPENGL_ES2) glVersion = RL_OPENGL_ES_20; #endif + return glVersion; } @@ -2488,6 +2727,7 @@ rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements) batch.vertexBuffer[i].vertices = (float *)RL_MALLOC(bufferElements*3*4*sizeof(float)); // 3 float by vertex, 4 vertex by quad batch.vertexBuffer[i].texcoords = (float *)RL_MALLOC(bufferElements*2*4*sizeof(float)); // 2 float by texcoord, 4 texcoord by quad + batch.vertexBuffer[i].normals = (float *)RL_MALLOC(bufferElements*3*4*sizeof(float)); // 3 float by vertex, 4 vertex by quad batch.vertexBuffer[i].colors = (unsigned char *)RL_MALLOC(bufferElements*4*4*sizeof(unsigned char)); // 4 float by color, 4 colors by quad #if defined(GRAPHICS_API_OPENGL_33) batch.vertexBuffer[i].indices = (unsigned int *)RL_MALLOC(bufferElements*6*sizeof(unsigned int)); // 6 int by quad (indices) @@ -2498,6 +2738,7 @@ rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements) for (int j = 0; j < (3*4*bufferElements); j++) batch.vertexBuffer[i].vertices[j] = 0.0f; for (int j = 0; j < (2*4*bufferElements); j++) batch.vertexBuffer[i].texcoords[j] = 0.0f; + for (int j = 0; j < (3*4*bufferElements); j++) batch.vertexBuffer[i].normals[j] = 0.0f; for (int j = 0; j < (4*4*bufferElements); j++) batch.vertexBuffer[i].colors[j] = 0; int k = 0; @@ -2547,16 +2788,23 @@ rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements) glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01]); glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01], 2, GL_FLOAT, 0, 0, 0); - // Vertex color buffer (shader-location = 3) + // Vertex normal buffer (shader-location = 2) glGenBuffers(1, &batch.vertexBuffer[i].vboId[2]); glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[2]); + glBufferData(GL_ARRAY_BUFFER, bufferElements*3*4*sizeof(float), batch.vertexBuffer[i].normals, GL_DYNAMIC_DRAW); + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL]); + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL], 3, GL_FLOAT, 0, 0, 0); + + // Vertex color buffer (shader-location = 3) + glGenBuffers(1, &batch.vertexBuffer[i].vboId[3]); + glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[3]); glBufferData(GL_ARRAY_BUFFER, bufferElements*4*4*sizeof(unsigned char), batch.vertexBuffer[i].colors, GL_DYNAMIC_DRAW); glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_COLOR]); glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_COLOR], 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, 0); // Fill index buffer - glGenBuffers(1, &batch.vertexBuffer[i].vboId[3]); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[3]); + glGenBuffers(1, &batch.vertexBuffer[i].vboId[4]); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[4]); #if defined(GRAPHICS_API_OPENGL_33) glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufferElements*6*sizeof(int), batch.vertexBuffer[i].indices, GL_STATIC_DRAW); #endif @@ -2611,10 +2859,10 @@ void rlUnloadRenderBatch(rlRenderBatch batch) if (RLGL.ExtSupported.vao) { glBindVertexArray(batch.vertexBuffer[i].vaoId); - glDisableVertexAttribArray(0); - glDisableVertexAttribArray(1); - glDisableVertexAttribArray(2); - glDisableVertexAttribArray(3); + glDisableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION); + glDisableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD); + glDisableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL); + glDisableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR); glBindVertexArray(0); } @@ -2623,6 +2871,7 @@ void rlUnloadRenderBatch(rlRenderBatch batch) glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[1]); glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[2]); glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[3]); + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[4]); // Delete VAOs from GPU (VRAM) if (RLGL.ExtSupported.vao) glDeleteVertexArrays(1, &batch.vertexBuffer[i].vaoId); @@ -2630,6 +2879,7 @@ void rlUnloadRenderBatch(rlRenderBatch batch) // Free vertex arrays memory from CPU (RAM) RL_FREE(batch.vertexBuffer[i].vertices); RL_FREE(batch.vertexBuffer[i].texcoords); + RL_FREE(batch.vertexBuffer[i].normals); RL_FREE(batch.vertexBuffer[i].colors); RL_FREE(batch.vertexBuffer[i].indices); } @@ -2648,7 +2898,7 @@ void rlDrawRenderBatch(rlRenderBatch *batch) // Update batch vertex buffers //------------------------------------------------------------------------------------------------------------ // NOTE: If there is not vertex data, buffers doesn't need to be updated (vertexCount > 0) - // TODO: If no data changed on the CPU arrays --> No need to re-update GPU arrays (change flag required) + // TODO: If no data changed on the CPU arrays --> No need to re-update GPU arrays (use a change detector flag?) if (RLGL.State.vertexCounter > 0) { // Activate elements VAO @@ -2664,16 +2914,21 @@ void rlDrawRenderBatch(rlRenderBatch *batch) glBufferSubData(GL_ARRAY_BUFFER, 0, RLGL.State.vertexCounter*2*sizeof(float), batch->vertexBuffer[batch->currentBuffer].texcoords); //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*2*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].texcoords, GL_DYNAMIC_DRAW); // Update all buffer - // Colors buffer + // Normals buffer glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[2]); + glBufferSubData(GL_ARRAY_BUFFER, 0, RLGL.State.vertexCounter*3*sizeof(float), batch->vertexBuffer[batch->currentBuffer].normals); + //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].normals, GL_DYNAMIC_DRAW); // Update all buffer + + // Colors buffer + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[3]); glBufferSubData(GL_ARRAY_BUFFER, 0, RLGL.State.vertexCounter*4*sizeof(unsigned char), batch->vertexBuffer[batch->currentBuffer].colors); //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*4*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].colors, GL_DYNAMIC_DRAW); // Update all buffer - // NOTE: glMapBuffer() causes sync issue. - // If GPU is working with this buffer, glMapBuffer() will wait(stall) until GPU to finish its job. - // To avoid waiting (idle), you can call first glBufferData() with NULL pointer before glMapBuffer(). + // NOTE: glMapBuffer() causes sync issue + // If GPU is working with this buffer, glMapBuffer() will wait(stall) until GPU to finish its job + // To avoid waiting (idle), you can call first glBufferData() with NULL pointer before glMapBuffer() // If you do that, the previous data in PBO will be discarded and glMapBuffer() returns a new - // allocated pointer immediately even if GPU is still working with the previous data. + // allocated pointer immediately even if GPU is still working with the previous data // Another option: map the buffer object into client's memory // Probably this code could be moved somewhere else... @@ -2718,13 +2973,30 @@ void rlDrawRenderBatch(rlRenderBatch *batch) // Create modelview-projection matrix and upload to shader Matrix matMVP = rlMatrixMultiply(RLGL.State.modelview, RLGL.State.projection); - float matMVPfloat[16] = { - matMVP.m0, matMVP.m1, matMVP.m2, matMVP.m3, - matMVP.m4, matMVP.m5, matMVP.m6, matMVP.m7, - matMVP.m8, matMVP.m9, matMVP.m10, matMVP.m11, - matMVP.m12, matMVP.m13, matMVP.m14, matMVP.m15 - }; - glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_MVP], 1, false, matMVPfloat); + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_MVP], 1, false, rlMatrixToFloat(matMVP)); + + if (RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_PROJECTION] != -1) + { + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_PROJECTION], 1, false, rlMatrixToFloat(RLGL.State.projection)); + } + + // WARNING: For the following setup of the view, model, and normal matrices, it is expected that + // transformations and rendering occur between rlPushMatrix() and rlPopMatrix() + + if (RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_VIEW] != -1) + { + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_VIEW], 1, false, rlMatrixToFloat(RLGL.State.modelview)); + } + + if (RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_MODEL] != -1) + { + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_MODEL], 1, false, rlMatrixToFloat(RLGL.State.transform)); + } + + if (RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_NORMAL] != -1) + { + glUniformMatrix4fv(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MATRIX_NORMAL], 1, false, rlMatrixToFloat(rlMatrixTranspose(rlMatrixInvert(RLGL.State.transform)))); + } if (RLGL.ExtSupported.vao) glBindVertexArray(batch->vertexBuffer[batch->currentBuffer].vaoId); else @@ -2739,12 +3011,17 @@ void rlDrawRenderBatch(rlRenderBatch *batch) glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01], 2, GL_FLOAT, 0, 0, 0); glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01]); - // Bind vertex attrib: color (shader-location = 3) + // Bind vertex attrib: normal (shader-location = 2) glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[2]); + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL], 3, GL_FLOAT, 0, 0, 0); + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_NORMAL]); + + // Bind vertex attrib: color (shader-location = 3) + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[3]); glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_COLOR], 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, 0); glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_COLOR]); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[3]); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[4]); } // Setup some default shader values @@ -2774,15 +3051,15 @@ void rlDrawRenderBatch(rlRenderBatch *batch) if ((batch->draws[i].mode == RL_LINES) || (batch->draws[i].mode == RL_TRIANGLES)) glDrawArrays(batch->draws[i].mode, vertexOffset, batch->draws[i].vertexCount); else { -#if defined(GRAPHICS_API_OPENGL_33) + #if defined(GRAPHICS_API_OPENGL_33) // We need to define the number of indices to be processed: elementCount*6 // NOTE: The final parameter tells the GPU the offset in bytes from the // start of the index buffer to the location of the first index to process glDrawElements(GL_TRIANGLES, batch->draws[i].vertexCount/4*6, GL_UNSIGNED_INT, (GLvoid *)(vertexOffset/4*6*sizeof(GLuint))); -#endif -#if defined(GRAPHICS_API_OPENGL_ES2) + #endif + #if defined(GRAPHICS_API_OPENGL_ES2) glDrawElements(GL_TRIANGLES, batch->draws[i].vertexCount/4*6, GL_UNSIGNED_SHORT, (GLvoid *)(vertexOffset/4*6*sizeof(GLushort))); -#endif + #endif } vertexOffset += (batch->draws[i].vertexCount + batch->draws[i].vertexAlignment); @@ -2943,7 +3220,11 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipWidth = width; int mipHeight = height; - int mipOffset = 0; // Mipmap data offset + int mipOffset = 0; // Mipmap data offset, only used for tracelog + + // NOTE: Added pointer math separately from function to avoid UBSAN complaining + unsigned char *dataPtr = NULL; + if (data != NULL) dataPtr = (unsigned char *)data; // Load the different mipmap levels for (int i = 0; i < mipmapCount; i++) @@ -2955,11 +3236,11 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format, TRACELOGD("TEXTURE: Load mipmap level %i (%i x %i), size: %i, offset: %i", i, mipWidth, mipHeight, mipSize, mipOffset); - if (glInternalFormat != -1) + if (glInternalFormat != 0) { - if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) glTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, glFormat, glType, (unsigned char *)data + mipOffset); + if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) glTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, glFormat, glType, dataPtr); #if !defined(GRAPHICS_API_OPENGL_11) - else glCompressedTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, mipSize, (unsigned char *)data + mipOffset); + else glCompressedTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, mipSize, dataPtr); #endif #if defined(GRAPHICS_API_OPENGL_33) @@ -2982,7 +3263,8 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format, mipWidth /= 2; mipHeight /= 2; - mipOffset += mipSize; + mipOffset += mipSize; // Increment offset position to next mipmap + if (data != NULL) dataPtr += mipSize; // Increment data pointer to next mipmap // Security check for NPOT textures if (mipWidth < 1) mipWidth = 1; @@ -3019,6 +3301,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format, // Activate Trilinear filtering if mipmaps are available glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapCount); // user defined mip count would break without this. } #endif @@ -3049,7 +3332,7 @@ unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer) // Possible formats: GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT32 and GL_DEPTH_COMPONENT32F unsigned int glInternalFormat = GL_DEPTH_COMPONENT; -#if defined(GRAPHICS_API_OPENGL_ES2) +#if (defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_ES3)) // WARNING: WebGL platform requires unsized internal format definition (GL_DEPTH_COMPONENT) // while other platforms using OpenGL ES 2.0 require/support sized internal formats depending on the GPU capabilities if (!RLGL.ExtSupported.texDepthWebGL || useRenderBuffer) @@ -3095,11 +3378,17 @@ unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer) // Load texture cubemap // NOTE: Cubemap data is expected to be 6 images in a single data array (one after the other), // expected the following convention: +X, -X, +Y, -Y, +Z, -Z -unsigned int rlLoadTextureCubemap(const void *data, int size, int format) +unsigned int rlLoadTextureCubemap(const void *data, int size, int format, int mipmapCount) { unsigned int id = 0; #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + int mipSize = size; + + // NOTE: Added pointer math separately from function to avoid UBSAN complaining + unsigned char *dataPtr = NULL; + if (data != NULL) dataPtr = (unsigned char *)data; + unsigned int dataSize = rlGetPixelDataSize(size, size, format); glGenTextures(1, &id); @@ -3108,30 +3397,30 @@ unsigned int rlLoadTextureCubemap(const void *data, int size, int format) unsigned int glInternalFormat, glFormat, glType; rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); - if (glInternalFormat != -1) + if (glInternalFormat != 0) { - // Load cubemap faces - for (unsigned int i = 0; i < 6; i++) + // Load cubemap faces/mipmaps + for (int i = 0; i < 6*mipmapCount; i++) { + int mipmapLevel = i/6; + int face = i%6; + if (data == NULL) { if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) { - if (format == RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32) - { - // Instead of using a sized internal texture format (GL_RGB16F, GL_RGB32F), we let the driver to choose the better format for us (GL_RGB) - if (RLGL.ExtSupported.texFloat32) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, size, size, 0, GL_RGB, GL_FLOAT, NULL); - else TRACELOG(RL_LOG_WARNING, "TEXTURES: Cubemap requested format not supported"); - } - else if ((format == RL_PIXELFORMAT_UNCOMPRESSED_R32) || (format == RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32)) TRACELOG(RL_LOG_WARNING, "TEXTURES: Cubemap requested format not supported"); - else glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, size, size, 0, glFormat, glType, NULL); + if ((format == RL_PIXELFORMAT_UNCOMPRESSED_R32) || + (format == RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32) || + (format == RL_PIXELFORMAT_UNCOMPRESSED_R16) || + (format == RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16)) TRACELOG(RL_LOG_WARNING, "TEXTURES: Cubemap requested format not supported"); + else glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, mipmapLevel, glInternalFormat, mipSize, mipSize, 0, glFormat, glType, NULL); } else TRACELOG(RL_LOG_WARNING, "TEXTURES: Empty cubemap creation does not support compressed format"); } else { - if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, size, size, 0, glFormat, glType, (unsigned char *)data + i*dataSize); - else glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, size, size, 0, dataSize, (unsigned char *)data + i*dataSize); + if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, mipmapLevel, glInternalFormat, mipSize, mipSize, 0, glFormat, glType, (unsigned char *)dataPtr + face*dataSize); + else glCompressedTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, mipmapLevel, glInternalFormat, mipSize, mipSize, 0, dataSize, (unsigned char *)dataPtr + face*dataSize); } #if defined(GRAPHICS_API_OPENGL_33) @@ -3150,11 +3439,23 @@ unsigned int rlLoadTextureCubemap(const void *data, int size, int format) glTexParameteriv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); } #endif + if (face == 5) + { + mipSize /= 2; + if (data != NULL) dataPtr += dataSize*6; // Increment data pointer to next mipmap + + // Security check for NPOT textures + if (mipSize < 1) mipSize = 1; + + dataSize = rlGetPixelDataSize(mipSize, mipSize, format); + } } } // Set cubemap texture sampling parameters - glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + if (mipmapCount > 1) glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + else glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -3180,7 +3481,7 @@ void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int h unsigned int glInternalFormat, glFormat, glType; rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); - if ((glInternalFormat != -1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) + if ((glInternalFormat != 0) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) { glTexSubImage2D(GL_TEXTURE_2D, 0, offsetX, offsetY, width, height, glFormat, glType, data); } @@ -3206,9 +3507,27 @@ void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned case RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_SHORT_4_4_4_4; break; case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_BYTE; break; #if !defined(GRAPHICS_API_OPENGL_11) - case RL_PIXELFORMAT_UNCOMPRESSED_R32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float - case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float - case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float + #if defined(GRAPHICS_API_OPENGL_ES3) + case RL_PIXELFORMAT_UNCOMPRESSED_R32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_R32F_EXT; *glFormat = GL_RED_EXT; *glType = GL_FLOAT; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGB32F_EXT; *glFormat = GL_RGB; *glType = GL_FLOAT; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGBA32F_EXT; *glFormat = GL_RGBA; *glType = GL_FLOAT; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_R16F_EXT; *glFormat = GL_RED_EXT; *glType = GL_HALF_FLOAT; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGB16F_EXT; *glFormat = GL_RGB; *glType = GL_HALF_FLOAT; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGBA16F_EXT; *glFormat = GL_RGBA; *glType = GL_HALF_FLOAT; break; + #else + case RL_PIXELFORMAT_UNCOMPRESSED_R32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float + case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_FLOAT; break; // NOTE: Requires extension OES_texture_float + #if defined(GRAPHICS_API_OPENGL_21) + case RL_PIXELFORMAT_UNCOMPRESSED_R16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_HALF_FLOAT_ARB; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_HALF_FLOAT_ARB; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_HALF_FLOAT_ARB; break; + #else // defined(GRAPHICS_API_OPENGL_ES2) + case RL_PIXELFORMAT_UNCOMPRESSED_R16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_HALF_FLOAT_OES; break; // NOTE: Requires extension OES_texture_half_float + #endif + #endif #endif #elif defined(GRAPHICS_API_OPENGL_33) case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: *glInternalFormat = GL_R8; *glFormat = GL_RED; *glType = GL_UNSIGNED_BYTE; break; @@ -3221,6 +3540,9 @@ void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned case RL_PIXELFORMAT_UNCOMPRESSED_R32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_R32F; *glFormat = GL_RED; *glType = GL_FLOAT; break; case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGB32F; *glFormat = GL_RGB; *glType = GL_FLOAT; break; case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: if (RLGL.ExtSupported.texFloat32) *glInternalFormat = GL_RGBA32F; *glFormat = GL_RGBA; *glType = GL_FLOAT; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_R16F; *glFormat = GL_RED; *glType = GL_HALF_FLOAT; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGB16F; *glFormat = GL_RGB; *glType = GL_HALF_FLOAT; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: if (RLGL.ExtSupported.texFloat16) *glInternalFormat = GL_RGBA16F; *glFormat = GL_RGBA; *glType = GL_HALF_FLOAT; break; #endif #if !defined(GRAPHICS_API_OPENGL_11) case RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: if (RLGL.ExtSupported.texCompDXT) *glInternalFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; break; @@ -3277,7 +3599,6 @@ void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int #endif } - // Read texture pixel data void *rlReadTexturePixels(unsigned int id, int width, int height, int format) { @@ -3293,8 +3614,8 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format) //glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); //glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &format); - // NOTE: Each row written to or read from by OpenGL pixel operations like glGetTexImage are aligned to a 4 byte boundary by default, which may add some padding. - // Use glPixelStorei to modify padding with the GL_[UN]PACK_ALIGNMENT setting. + // NOTE: Each row written to or read from by OpenGL pixel operations like glGetTexImage are aligned to a 4 byte boundary by default, which may add some padding + // Use glPixelStorei to modify padding with the GL_[UN]PACK_ALIGNMENT setting // GL_PACK_ALIGNMENT affects operations that read from OpenGL memory (glReadPixels, glGetTexImage, etc.) // GL_UNPACK_ALIGNMENT affects operations that write to OpenGL memory (glTexImage, etc.) glPixelStorei(GL_PACK_ALIGNMENT, 1); @@ -3303,7 +3624,7 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format) rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); unsigned int size = rlGetPixelDataSize(width, height, format); - if ((glInternalFormat != -1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) + if ((glInternalFormat != 0) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) { pixels = RL_MALLOC(size); glGetTexImage(GL_TEXTURE_2D, 0, glFormat, glType, pixels); @@ -3315,13 +3636,13 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format) #if defined(GRAPHICS_API_OPENGL_ES2) // glGetTexImage() is not available on OpenGL ES 2.0 - // Texture width and height are required on OpenGL ES 2.0. There is no way to get it from texture id. + // Texture width and height are required on OpenGL ES 2.0, there is no way to get it from texture id // Two possible Options: // 1 - Bind texture to color fbo attachment and glReadPixels() // 2 - Create an fbo, activate it, render quad with texture, glReadPixels() // We are using Option 1, just need to care for texture format on retrieval // NOTE: This behaviour could be conditioned by graphic driver... - unsigned int fboId = rlLoadFramebuffer(width, height); + unsigned int fboId = rlLoadFramebuffer(); glBindFramebuffer(GL_FRAMEBUFFER, fboId); glBindTexture(GL_TEXTURE_2D, 0); @@ -3375,7 +3696,7 @@ unsigned char *rlReadScreenPixels(int width, int height) //----------------------------------------------------------------------------------------- // Load a framebuffer to be used for rendering // NOTE: No textures attached -unsigned int rlLoadFramebuffer(int width, int height) +unsigned int rlLoadFramebuffer(void) { unsigned int fboId = 0; @@ -3466,11 +3787,14 @@ bool rlFramebufferComplete(unsigned int id) void rlUnloadFramebuffer(unsigned int id) { #if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(RLGL_RENDER_TEXTURES_HINT) - // Query depth attachment to automatically delete texture/renderbuffer int depthType = 0, depthId = 0; glBindFramebuffer(GL_FRAMEBUFFER, id); // Bind framebuffer to query depth texture type glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &depthType); + + // TODO: Review warning retrieving object name in WebGL + // WARNING: WebGL: INVALID_ENUM: getFramebufferAttachmentParameter: invalid parameter name + // https://registry.khronos.org/webgl/specs/latest/1.0/ glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depthId); unsigned int depthIdU = (unsigned int)depthId; @@ -3478,7 +3802,7 @@ void rlUnloadFramebuffer(unsigned int id) else if (depthType == GL_TEXTURE) glDeleteTextures(1, &depthIdU); // NOTE: If a texture object is deleted while its image is attached to the *currently bound* framebuffer, - // the texture image is automatically detached from the currently bound framebuffer. + // the texture image is automatically detached from the currently bound framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); glDeleteFramebuffers(1, &id); @@ -3616,14 +3940,18 @@ void rlDrawVertexArray(int offset, int count) // Draw vertex array elements void rlDrawVertexArrayElements(int offset, int count, const void *buffer) { - glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)buffer + offset); + // NOTE: Added pointer math separately from function to avoid UBSAN complaining + unsigned short *bufferPtr = (unsigned short *)buffer; + if (offset > 0) bufferPtr += offset; + + glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)bufferPtr); } // Draw vertex array instanced void rlDrawVertexArrayInstanced(int offset, int count, int instances) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) - glDrawArraysInstanced(GL_TRIANGLES, 0, count, instances); + glDrawArraysInstanced(GL_TRIANGLES, offset, count, instances); #endif } @@ -3631,7 +3959,11 @@ void rlDrawVertexArrayInstanced(int offset, int count, int instances) void rlDrawVertexArrayElementsInstanced(int offset, int count, const void *buffer, int instances) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) - glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)buffer + offset, instances); + // NOTE: Added pointer math separately from function to avoid UBSAN complaining + unsigned short *bufferPtr = (unsigned short *)buffer; + if (offset > 0) bufferPtr += offset; + + glDrawElementsInstanced(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)bufferPtr, instances); #endif } @@ -3672,10 +4004,16 @@ unsigned int rlLoadVertexArray(void) } // Set vertex attribute -void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, const void *pointer) +void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, int offset) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) - glVertexAttribPointer(index, compSize, type, normalized, stride, pointer); + // NOTE: Data type could be: GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT + // Additional types (depends on OpenGL version or extensions): + // - GL_HALF_FLOAT, GL_FLOAT, GL_DOUBLE, GL_FIXED, + // - GL_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_10F_11F_11F_REV + + size_t offsetNative = offset; + glVertexAttribPointer(index, compSize, type, normalized, stride, (void *)offsetNative); #endif } @@ -3722,18 +4060,18 @@ unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode) unsigned int fragmentShaderId = 0; // Compile vertex shader (if provided) + // NOTE: If not vertex shader is provided, use default one if (vsCode != NULL) vertexShaderId = rlCompileShader(vsCode, GL_VERTEX_SHADER); - // In case no vertex shader was provided or compilation failed, we use default vertex shader - if (vertexShaderId == 0) vertexShaderId = RLGL.State.defaultVShaderId; + else vertexShaderId = RLGL.State.defaultVShaderId; // Compile fragment shader (if provided) + // NOTE: If not vertex shader is provided, use default one if (fsCode != NULL) fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER); - // In case no fragment shader was provided or compilation failed, we use default fragment shader - if (fragmentShaderId == 0) fragmentShaderId = RLGL.State.defaultFShaderId; + else fragmentShaderId = RLGL.State.defaultFShaderId; // In case vertex and fragment shader are the default ones, no need to recompile, we can just assign the default shader program id if ((vertexShaderId == RLGL.State.defaultVShaderId) && (fragmentShaderId == RLGL.State.defaultFShaderId)) id = RLGL.State.defaultShaderId; - else + else if ((vertexShaderId > 0) && (fragmentShaderId > 0)) { // One of or both shader are new, we need to compile a new shader program id = rlLoadShaderProgram(vertexShaderId, fragmentShaderId); @@ -3811,6 +4149,8 @@ unsigned int rlCompileShader(const char *shaderCode, int type) //case GL_GEOMETRY_SHADER: #if defined(GRAPHICS_API_OPENGL_43) case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to compile compute shader code", shader); break; + #elif defined(GRAPHICS_API_OPENGL_33) + case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not enabled. Define GRAPHICS_API_OPENGL_43", shader); break; #endif default: break; } @@ -3826,6 +4166,8 @@ unsigned int rlCompileShader(const char *shaderCode, int type) TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Compile error: %s", shader, log); RL_FREE(log); } + + shader = 0; } else { @@ -3836,6 +4178,8 @@ unsigned int rlCompileShader(const char *shaderCode, int type) //case GL_GEOMETRY_SHADER: #if defined(GRAPHICS_API_OPENGL_43) case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Compute shader compiled successfully", shader); break; + #elif defined(GRAPHICS_API_OPENGL_33) + case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not enabled. Define GRAPHICS_API_OPENGL_43", shader); break; #endif default: break; } @@ -3858,12 +4202,18 @@ unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fShaderId) glAttachShader(program, fShaderId); // NOTE: Default attribute shader locations must be Bound before linking - glBindAttribLocation(program, 0, RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION); - glBindAttribLocation(program, 1, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD); - glBindAttribLocation(program, 2, RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL); - glBindAttribLocation(program, 3, RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR); - glBindAttribLocation(program, 4, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT); - glBindAttribLocation(program, 5, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2); + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION, RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION); + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD); + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL, RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL); + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR, RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR); + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT); + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2); + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCE_TX, RL_DEFAULT_SHADER_ATTRIB_NAME_INSTANCE_TX); + +#ifdef RL_SUPPORT_MESH_GPU_SKINNING + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEIDS); + glBindAttribLocation(program, RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS, RL_DEFAULT_SHADER_ATTRIB_NAME_BONEWEIGHTS); +#endif // NOTE: If some attrib name is no found on the shader, it locations becomes -1 @@ -3896,7 +4246,7 @@ unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fShaderId) else { // Get the size of compiled shader program (not available on OpenGL ES 2.0) - // NOTE: If GL_LINK_STATUS is GL_FALSE, program binary length is zero. + // NOTE: If GL_LINK_STATUS is GL_FALSE, program binary length is zero //GLint binarySize = 0; //glGetProgramiv(id, GL_PROGRAM_BINARY_LENGTH, &binarySize); @@ -3923,8 +4273,8 @@ int rlGetLocationUniform(unsigned int shaderId, const char *uniformName) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) location = glGetUniformLocation(shaderId, uniformName); - if (location == -1) TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to find shader uniform: %s", shaderId, uniformName); - else TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Shader uniform (%s) set at location: %i", shaderId, uniformName, location); + //if (location == -1) TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to find shader uniform: %s", shaderId, uniformName); + //else TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Shader uniform (%s) set at location: %i", shaderId, uniformName, location); #endif return location; } @@ -3936,8 +4286,8 @@ int rlGetLocationAttrib(unsigned int shaderId, const char *attribName) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) location = glGetAttribLocation(shaderId, attribName); - if (location == -1) TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to find shader attribute: %s", shaderId, attribName); - else TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Shader attribute (%s) set at location: %i", shaderId, attribName, location); + //if (location == -1) TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to find shader attribute: %s", shaderId, attribName); + //else TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Shader attribute (%s) set at location: %i", shaderId, attribName, location); #endif return location; } @@ -3956,8 +4306,16 @@ void rlSetUniform(int locIndex, const void *value, int uniformType, int count) case RL_SHADER_UNIFORM_IVEC2: glUniform2iv(locIndex, count, (int *)value); break; case RL_SHADER_UNIFORM_IVEC3: glUniform3iv(locIndex, count, (int *)value); break; case RL_SHADER_UNIFORM_IVEC4: glUniform4iv(locIndex, count, (int *)value); break; + #if !defined(GRAPHICS_API_OPENGL_ES2) + case RL_SHADER_UNIFORM_UINT: glUniform1uiv(locIndex, count, (unsigned int *)value); break; + case RL_SHADER_UNIFORM_UIVEC2: glUniform2uiv(locIndex, count, (unsigned int *)value); break; + case RL_SHADER_UNIFORM_UIVEC3: glUniform3uiv(locIndex, count, (unsigned int *)value); break; + case RL_SHADER_UNIFORM_UIVEC4: glUniform4uiv(locIndex, count, (unsigned int *)value); break; + #endif case RL_SHADER_UNIFORM_SAMPLER2D: glUniform1iv(locIndex, count, (int *)value); break; default: TRACELOG(RL_LOG_WARNING, "SHADER: Failed to set uniform value, data type not recognized"); + + // TODO: Support glUniform1uiv(), glUniform2uiv(), glUniform3uiv(), glUniform4uiv() } #endif } @@ -3991,12 +4349,31 @@ void rlSetUniformMatrix(int locIndex, Matrix mat) #endif } +// Set shader value uniform matrix +void rlSetUniformMatrices(int locIndex, const Matrix *matrices, int count) +{ +#if defined(GRAPHICS_API_OPENGL_33) + glUniformMatrix4fv(locIndex, count, true, (const float *)matrices); +#elif defined(GRAPHICS_API_OPENGL_ES2) + // WARNING: WebGL does not support Matrix transpose ("true" parameter) + // REF: https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniformMatrix + glUniformMatrix4fv(locIndex, count, false, (const float *)matrices); +#endif +} + // Set shader value uniform sampler void rlSetUniformSampler(int locIndex, unsigned int textureId) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) // Check if texture is already active - for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) if (RLGL.State.activeTextureId[i] == textureId) return; + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) + { + if (RLGL.State.activeTextureId[i] == textureId) + { + glUniform1i(locIndex, 1 + i); + return; + } + } // Register a new active texture for the internal batch system // NOTE: Default texture is always activated as GL_TEXTURE0 @@ -4063,12 +4440,14 @@ unsigned int rlLoadComputeShaderProgram(unsigned int shaderId) else { // Get the size of compiled shader program (not available on OpenGL ES 2.0) - // NOTE: If GL_LINK_STATUS is GL_FALSE, program binary length is zero. + // NOTE: If GL_LINK_STATUS is GL_FALSE, program binary length is zero //GLint binarySize = 0; //glGetProgramiv(id, GL_PROGRAM_BINARY_LENGTH, &binarySize); TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Compute shader program loaded successfully", program); } +#else + TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not enabled. Define GRAPHICS_API_OPENGL_43"); #endif return program; @@ -4091,8 +4470,10 @@ unsigned int rlLoadShaderBuffer(unsigned int size, const void *data, int usageHi glGenBuffers(1, &ssbo); glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo); glBufferData(GL_SHADER_STORAGE_BUFFER, size, data, usageHint? usageHint : RL_STREAM_COPY); - glClearBufferData(GL_SHADER_STORAGE_BUFFER, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, 0); + if (data == NULL) glClearBufferData(GL_SHADER_STORAGE_BUFFER, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL); // Clear buffer data to 0 glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); +#else + TRACELOG(RL_LOG_WARNING, "SSBO: SSBO not enabled. Define GRAPHICS_API_OPENGL_43"); #endif return ssbo; @@ -4103,7 +4484,10 @@ void rlUnloadShaderBuffer(unsigned int ssboId) { #if defined(GRAPHICS_API_OPENGL_43) glDeleteBuffers(1, &ssboId); +#else + TRACELOG(RL_LOG_WARNING, "SSBO: SSBO not enabled. Define GRAPHICS_API_OPENGL_43"); #endif + } // Update SSBO buffer data @@ -4118,14 +4502,14 @@ void rlUpdateShaderBuffer(unsigned int id, const void *data, unsigned int dataSi // Get SSBO buffer size unsigned int rlGetShaderBufferSize(unsigned int id) { - long long size = 0; - #if defined(GRAPHICS_API_OPENGL_43) + GLint64 size = 0; glBindBuffer(GL_SHADER_STORAGE_BUFFER, id); - glGetInteger64v(GL_SHADER_STORAGE_BUFFER_SIZE, &size); -#endif - + glGetBufferParameteri64v(GL_SHADER_STORAGE_BUFFER, GL_BUFFER_SIZE, &size); return (size > 0)? (unsigned int)size : 0; +#else + return 0; +#endif } // Read SSBO buffer data (GPU->CPU) @@ -4162,7 +4546,9 @@ void rlBindImageTexture(unsigned int id, unsigned int index, int format, bool re unsigned int glInternalFormat = 0, glFormat = 0, glType = 0; rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); - glBindImageTexture(index, id, 0, 0, 0, readonly ? GL_READ_ONLY : GL_READ_WRITE, glInternalFormat); + glBindImageTexture(index, id, 0, 0, 0, readonly? GL_READ_ONLY : GL_READ_WRITE, glInternalFormat); +#else + TRACELOG(RL_LOG_WARNING, "TEXTURE: Image texture binding not enabled. Define GRAPHICS_API_OPENGL_43"); #endif } @@ -4241,7 +4627,7 @@ Matrix rlGetMatrixTransform(void) } // Get internal projection matrix for stereo render (selected eye) -RLAPI Matrix rlGetMatrixProjectionStereo(int eye) +Matrix rlGetMatrixProjectionStereo(int eye) { Matrix mat = rlMatrixIdentity(); #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) @@ -4251,7 +4637,7 @@ RLAPI Matrix rlGetMatrixProjectionStereo(int eye) } // Get internal view offset matrix for stereo render (selected eye) -RLAPI Matrix rlGetMatrixViewOffsetStereo(int eye) +Matrix rlGetMatrixViewOffsetStereo(int eye) { Matrix mat = rlMatrixIdentity(); #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) @@ -4319,10 +4705,10 @@ void rlLoadDrawQuad(void) glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), &vertices, GL_STATIC_DRAW); // Bind vertex attributes (position, texcoords) - glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void *)0); // Positions - glEnableVertexAttribArray(1); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void *)(3*sizeof(float))); // Texcoords + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION); + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION, 3, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void *)0); // Positions + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD); + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void *)(3*sizeof(float))); // Texcoords // Draw quad glBindVertexArray(quadVAO); @@ -4393,12 +4779,12 @@ void rlLoadDrawCube(void) // Bind vertex attributes (position, normals, texcoords) glBindVertexArray(cubeVAO); - glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)0); // Positions - glEnableVertexAttribArray(1); - glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)(3*sizeof(float))); // Normals - glEnableVertexAttribArray(2); - glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)(6*sizeof(float))); // Texcoords + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION); + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)0); // Positions + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL); + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)(3*sizeof(float))); // Normals + glEnableVertexAttribArray(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD); + glVertexAttribPointer(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void *)(6*sizeof(float))); // Texcoords glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); @@ -4428,6 +4814,9 @@ const char *rlGetPixelFormatName(unsigned int format) case RL_PIXELFORMAT_UNCOMPRESSED_R32: return "R32"; break; // 32 bpp (1 channel - float) case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: return "R32G32B32"; break; // 32*3 bpp (3 channels - float) case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: return "R32G32B32A32"; break; // 32*4 bpp (4 channels - float) + case RL_PIXELFORMAT_UNCOMPRESSED_R16: return "R16"; break; // 16 bpp (1 channel - half float) + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: return "R16G16B16"; break; // 16*3 bpp (3 channels - half float) + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: return "R16G16B16A16"; break; // 16*4 bpp (4 channels - half float) case RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: return "DXT1_RGB"; break; // 4 bpp (no alpha) case RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: return "DXT1_RGBA"; break; // 4 bpp (1 bit alpha) case RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: return "DXT3_RGBA"; break; // 8 bpp @@ -4474,14 +4863,25 @@ static void rlLoadShaderDefault(void) "out vec2 fragTexCoord; \n" "out vec4 fragColor; \n" #endif -#if defined(GRAPHICS_API_OPENGL_ES2) + +#if defined(GRAPHICS_API_OPENGL_ES3) + "#version 300 es \n" + "precision mediump float; \n" // Precision required for OpenGL ES3 (WebGL 2) (on some browsers) + "in vec3 vertexPosition; \n" + "in vec2 vertexTexCoord; \n" + "in vec4 vertexColor; \n" + "out vec2 fragTexCoord; \n" + "out vec4 fragColor; \n" +#elif defined(GRAPHICS_API_OPENGL_ES2) "#version 100 \n" + "precision mediump float; \n" // Precision required for OpenGL ES2 (WebGL) (on some browsers) "attribute vec3 vertexPosition; \n" "attribute vec2 vertexTexCoord; \n" "attribute vec4 vertexColor; \n" "varying vec2 fragTexCoord; \n" "varying vec4 fragColor; \n" #endif + "uniform mat4 mvp; \n" "void main() \n" "{ \n" @@ -4516,7 +4916,21 @@ static void rlLoadShaderDefault(void) " finalColor = texelColor*colDiffuse*fragColor; \n" "} \n"; #endif -#if defined(GRAPHICS_API_OPENGL_ES2) + +#if defined(GRAPHICS_API_OPENGL_ES3) + "#version 300 es \n" + "precision mediump float; \n" // Precision required for OpenGL ES3 (WebGL 2) + "in vec2 fragTexCoord; \n" + "in vec4 fragColor; \n" + "out vec4 finalColor; \n" + "uniform sampler2D texture0; \n" + "uniform vec4 colDiffuse; \n" + "void main() \n" + "{ \n" + " vec4 texelColor = texture(texture0, fragTexCoord); \n" + " finalColor = texelColor*colDiffuse*fragColor; \n" + "} \n"; +#elif defined(GRAPHICS_API_OPENGL_ES2) "#version 100 \n" "precision mediump float; \n" // Precision required for OpenGL ES2 (WebGL) "varying vec2 fragTexCoord; \n" @@ -4542,14 +4956,14 @@ static void rlLoadShaderDefault(void) TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Default shader loaded successfully", RLGL.State.defaultShaderId); // Set default shader locations: attributes locations - RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_POSITION] = glGetAttribLocation(RLGL.State.defaultShaderId, "vertexPosition"); - RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01] = glGetAttribLocation(RLGL.State.defaultShaderId, "vertexTexCoord"); - RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_COLOR] = glGetAttribLocation(RLGL.State.defaultShaderId, "vertexColor"); + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_POSITION] = glGetAttribLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION); + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_TEXCOORD01] = glGetAttribLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD); + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_VERTEX_COLOR] = glGetAttribLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR); // Set default shader locations: uniform locations - RLGL.State.defaultShaderLocs[RL_SHADER_LOC_MATRIX_MVP] = glGetUniformLocation(RLGL.State.defaultShaderId, "mvp"); - RLGL.State.defaultShaderLocs[RL_SHADER_LOC_COLOR_DIFFUSE] = glGetUniformLocation(RLGL.State.defaultShaderId, "colDiffuse"); - RLGL.State.defaultShaderLocs[RL_SHADER_LOC_MAP_DIFFUSE] = glGetUniformLocation(RLGL.State.defaultShaderId, "texture0"); + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_MATRIX_MVP] = glGetUniformLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_UNIFORM_NAME_MVP); + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_COLOR_DIFFUSE] = glGetUniformLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR); + RLGL.State.defaultShaderLocs[RL_SHADER_LOC_MAP_DIFFUSE] = glGetUniformLocation(RLGL.State.defaultShaderId, RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0); } else TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to load default shader", RLGL.State.defaultShaderId); } @@ -4574,7 +4988,7 @@ static void rlUnloadShaderDefault(void) #if defined(RLGL_SHOW_GL_DETAILS_INFO) // Get compressed format official GL identifier name -static char *rlGetCompressedFormatName(int format) +static const char *rlGetCompressedFormatName(int format) { switch (format) { @@ -4669,6 +5083,9 @@ static int rlGetPixelDataSize(int width, int height, int format) case RL_PIXELFORMAT_UNCOMPRESSED_R32: bpp = 32; break; case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: bpp = 32*3; break; case RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: bpp = 32*4; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16: bpp = 16; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16: bpp = 16*3; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16: bpp = 16*4; break; case RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: case RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: case RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: @@ -4683,7 +5100,8 @@ static int rlGetPixelDataSize(int width, int height, int format) default: break; } - dataSize = width*height*bpp/8; // Total data size in bytes + double bytesPerPixel = (double)bpp/8.0; + dataSize = (int)(bytesPerPixel*width*height); // Total data size in bytes // Most compressed formats works on 4x4 blocks, // if texture is smaller, minimum dataSize is 8 or 16 @@ -4698,6 +5116,31 @@ static int rlGetPixelDataSize(int width, int height, int format) // Auxiliar math functions +// Get float array of matrix data +static rl_float16 rlMatrixToFloatV(Matrix mat) +{ + rl_float16 result = { 0 }; + + result.v[0] = mat.m0; + result.v[1] = mat.m1; + result.v[2] = mat.m2; + result.v[3] = mat.m3; + result.v[4] = mat.m4; + result.v[5] = mat.m5; + result.v[6] = mat.m6; + result.v[7] = mat.m7; + result.v[8] = mat.m8; + result.v[9] = mat.m9; + result.v[10] = mat.m10; + result.v[11] = mat.m11; + result.v[12] = mat.m12; + result.v[13] = mat.m13; + result.v[14] = mat.m14; + result.v[15] = mat.m15; + + return result; +} + // Get identity matrix static Matrix rlMatrixIdentity(void) { @@ -4737,4 +5180,76 @@ static Matrix rlMatrixMultiply(Matrix left, Matrix right) return result; } -#endif // RLGL_IMPLEMENTATION +// Transposes provided matrix +static Matrix rlMatrixTranspose(Matrix mat) +{ + Matrix result = { 0 }; + + result.m0 = mat.m0; + result.m1 = mat.m4; + result.m2 = mat.m8; + result.m3 = mat.m12; + result.m4 = mat.m1; + result.m5 = mat.m5; + result.m6 = mat.m9; + result.m7 = mat.m13; + result.m8 = mat.m2; + result.m9 = mat.m6; + result.m10 = mat.m10; + result.m11 = mat.m14; + result.m12 = mat.m3; + result.m13 = mat.m7; + result.m14 = mat.m11; + result.m15 = mat.m15; + + return result; +} + +// Invert provided matrix +static Matrix rlMatrixInvert(Matrix mat) +{ + Matrix result = { 0 }; + + // Cache the matrix values (speed optimization) + float a00 = mat.m0, a01 = mat.m1, a02 = mat.m2, a03 = mat.m3; + float a10 = mat.m4, a11 = mat.m5, a12 = mat.m6, a13 = mat.m7; + float a20 = mat.m8, a21 = mat.m9, a22 = mat.m10, a23 = mat.m11; + float a30 = mat.m12, a31 = mat.m13, a32 = mat.m14, a33 = mat.m15; + + float b00 = a00*a11 - a01*a10; + float b01 = a00*a12 - a02*a10; + float b02 = a00*a13 - a03*a10; + float b03 = a01*a12 - a02*a11; + float b04 = a01*a13 - a03*a11; + float b05 = a02*a13 - a03*a12; + float b06 = a20*a31 - a21*a30; + float b07 = a20*a32 - a22*a30; + float b08 = a20*a33 - a23*a30; + float b09 = a21*a32 - a22*a31; + float b10 = a21*a33 - a23*a31; + float b11 = a22*a33 - a23*a32; + + // Calculate the invert determinant (inlined to avoid double-caching) + float invDet = 1.0f/(b00*b11 - b01*b10 + b02*b09 + b03*b08 - b04*b07 + b05*b06); + + result.m0 = (a11*b11 - a12*b10 + a13*b09)*invDet; + result.m1 = (-a01*b11 + a02*b10 - a03*b09)*invDet; + result.m2 = (a31*b05 - a32*b04 + a33*b03)*invDet; + result.m3 = (-a21*b05 + a22*b04 - a23*b03)*invDet; + result.m4 = (-a10*b11 + a12*b08 - a13*b07)*invDet; + result.m5 = (a00*b11 - a02*b08 + a03*b07)*invDet; + result.m6 = (-a30*b05 + a32*b02 - a33*b01)*invDet; + result.m7 = (a20*b05 - a22*b02 + a23*b01)*invDet; + result.m8 = (a10*b10 - a11*b08 + a13*b06)*invDet; + result.m9 = (-a00*b10 + a01*b08 - a03*b06)*invDet; + result.m10 = (a30*b04 - a31*b02 + a33*b00)*invDet; + result.m11 = (-a20*b04 + a21*b02 - a23*b00)*invDet; + result.m12 = (-a10*b09 + a11*b07 - a12*b06)*invDet; + result.m13 = (a00*b09 - a01*b07 + a02*b06)*invDet; + result.m14 = (-a30*b03 + a31*b01 - a32*b00)*invDet; + result.m15 = (a20*b03 - a21*b01 + a22*b00)*invDet; + + return result; +} + +#endif // RLGL_IMPLEMENTATION \ No newline at end of file diff --git a/src/generated/node-raylib-drm.js b/src/generated/node-raylib-drm.js index fc21812..f51771b 100644 --- a/src/generated/node-raylib-drm.js +++ b/src/generated/node-raylib-drm.js @@ -20,7 +20,7 @@ const raylib = {} * * @return {undefined} */ -function InitWindow (width, height, title) { +function InitWindow(width, height, title) { return r.BindInitWindow( width, height, @@ -30,31 +30,31 @@ function InitWindow (width, height, title) { raylib.InitWindow = InitWindow /** - * Check if KEY_ESCAPE pressed or Close icon pressed + * Close window and unload OpenGL context * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function WindowShouldClose () { - return r.BindWindowShouldClose() +function CloseWindow() { + return r.BindCloseWindow() } -raylib.WindowShouldClose = WindowShouldClose +raylib.CloseWindow = CloseWindow /** - * Close window and unload OpenGL context + * Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function CloseWindow () { - return r.BindCloseWindow() +function WindowShouldClose() { + return r.BindWindowShouldClose() } -raylib.CloseWindow = CloseWindow +raylib.WindowShouldClose = WindowShouldClose /** * Check if window has been initialized successfully * * @return {boolean} The resulting bool. */ -function IsWindowReady () { +function IsWindowReady() { return r.BindIsWindowReady() } raylib.IsWindowReady = IsWindowReady @@ -64,47 +64,47 @@ raylib.IsWindowReady = IsWindowReady * * @return {boolean} The resulting bool. */ -function IsWindowFullscreen () { +function IsWindowFullscreen() { return r.BindIsWindowFullscreen() } raylib.IsWindowFullscreen = IsWindowFullscreen /** - * Check if window is currently hidden (only PLATFORM_DESKTOP) + * Check if window is currently hidden * * @return {boolean} The resulting bool. */ -function IsWindowHidden () { +function IsWindowHidden() { return r.BindIsWindowHidden() } raylib.IsWindowHidden = IsWindowHidden /** - * Check if window is currently minimized (only PLATFORM_DESKTOP) + * Check if window is currently minimized * * @return {boolean} The resulting bool. */ -function IsWindowMinimized () { +function IsWindowMinimized() { return r.BindIsWindowMinimized() } raylib.IsWindowMinimized = IsWindowMinimized /** - * Check if window is currently maximized (only PLATFORM_DESKTOP) + * Check if window is currently maximized * * @return {boolean} The resulting bool. */ -function IsWindowMaximized () { +function IsWindowMaximized() { return r.BindIsWindowMaximized() } raylib.IsWindowMaximized = IsWindowMaximized /** - * Check if window is currently focused (only PLATFORM_DESKTOP) + * Check if window is currently focused * * @return {boolean} The resulting bool. */ -function IsWindowFocused () { +function IsWindowFocused() { return r.BindIsWindowFocused() } raylib.IsWindowFocused = IsWindowFocused @@ -114,7 +114,7 @@ raylib.IsWindowFocused = IsWindowFocused * * @return {boolean} The resulting bool. */ -function IsWindowResized () { +function IsWindowResized() { return r.BindIsWindowResized() } raylib.IsWindowResized = IsWindowResized @@ -126,7 +126,7 @@ raylib.IsWindowResized = IsWindowResized * * @return {boolean} The resulting bool. */ -function IsWindowState (flag) { +function IsWindowState(flag) { return r.BindIsWindowState( flag ) @@ -134,13 +134,13 @@ function IsWindowState (flag) { raylib.IsWindowState = IsWindowState /** - * Set window configuration state using flags (only PLATFORM_DESKTOP) + * Set window configuration state using flags * * @param {number} flags * * @return {undefined} */ -function SetWindowState (flags) { +function SetWindowState(flags) { return r.BindSetWindowState( flags ) @@ -154,7 +154,7 @@ raylib.SetWindowState = SetWindowState * * @return {undefined} */ -function ClearWindowState (flags) { +function ClearWindowState(flags) { return r.BindClearWindowState( flags ) @@ -162,53 +162,63 @@ function ClearWindowState (flags) { raylib.ClearWindowState = ClearWindowState /** - * Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) + * Toggle window state: fullscreen/windowed, resizes monitor to match window resolution * * @return {undefined} */ -function ToggleFullscreen () { +function ToggleFullscreen() { return r.BindToggleFullscreen() } raylib.ToggleFullscreen = ToggleFullscreen /** - * Set window state: maximized, if resizable (only PLATFORM_DESKTOP) + * Toggle window state: borderless windowed, resizes window to match monitor resolution + * + * @return {undefined} + */ +function ToggleBorderlessWindowed() { + return r.BindToggleBorderlessWindowed() +} +raylib.ToggleBorderlessWindowed = ToggleBorderlessWindowed + +/** + * Set window state: maximized, if resizable * * @return {undefined} */ -function MaximizeWindow () { +function MaximizeWindow() { return r.BindMaximizeWindow() } raylib.MaximizeWindow = MaximizeWindow /** - * Set window state: minimized, if resizable (only PLATFORM_DESKTOP) + * Set window state: minimized, if resizable * * @return {undefined} */ -function MinimizeWindow () { +function MinimizeWindow() { return r.BindMinimizeWindow() } raylib.MinimizeWindow = MinimizeWindow /** - * Set window state: not minimized/maximized (only PLATFORM_DESKTOP) + * Set window state: not minimized/maximized * * @return {undefined} */ -function RestoreWindow () { +function RestoreWindow() { return r.BindRestoreWindow() } raylib.RestoreWindow = RestoreWindow /** - * Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) + * Set icon for window (single image, RGBA 32bit) * * @param {Image} image * * @return {undefined} */ -function SetWindowIcon (image) { +function SetWindowIcon(image) { return r.BindSetWindowIcon( image.data, image.width, @@ -220,14 +230,14 @@ function SetWindowIcon (image) { raylib.SetWindowIcon = SetWindowIcon /** - * Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) + * Set icon for window (multiple images, RGBA 32bit) * * @param {number} images * @param {number} count * * @return {undefined} */ -function SetWindowIcons (images, count) { +function SetWindowIcons(images, count) { return r.BindSetWindowIcons( images, count @@ -236,13 +246,13 @@ function SetWindowIcons (images, count) { raylib.SetWindowIcons = SetWindowIcons /** - * Set title for window (only PLATFORM_DESKTOP) + * Set title for window * * @param {string} title * * @return {undefined} */ -function SetWindowTitle (title) { +function SetWindowTitle(title) { return r.BindSetWindowTitle( title ) @@ -250,14 +260,14 @@ function SetWindowTitle (title) { raylib.SetWindowTitle = SetWindowTitle /** - * Set window position on screen (only PLATFORM_DESKTOP) + * Set window position on screen * * @param {number} x * @param {number} y * * @return {undefined} */ -function SetWindowPosition (x, y) { +function SetWindowPosition(x, y) { return r.BindSetWindowPosition( x, y @@ -266,13 +276,13 @@ function SetWindowPosition (x, y) { raylib.SetWindowPosition = SetWindowPosition /** - * Set monitor for the current window (fullscreen mode) + * Set monitor for the current window * * @param {number} monitor * * @return {undefined} */ -function SetWindowMonitor (monitor) { +function SetWindowMonitor(monitor) { return r.BindSetWindowMonitor( monitor ) @@ -287,7 +297,7 @@ raylib.SetWindowMonitor = SetWindowMonitor * * @return {undefined} */ -function SetWindowMinSize (width, height) { +function SetWindowMinSize(width, height) { return r.BindSetWindowMinSize( width, height @@ -295,6 +305,22 @@ function SetWindowMinSize (width, height) { } raylib.SetWindowMinSize = SetWindowMinSize +/** + * Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) + * + * @param {number} width + * @param {number} height + * + * @return {undefined} + */ +function SetWindowMaxSize(width, height) { + return r.BindSetWindowMaxSize( + width, + height + ) +} +raylib.SetWindowMaxSize = SetWindowMaxSize + /** * Set window dimensions * @@ -303,7 +329,7 @@ raylib.SetWindowMinSize = SetWindowMinSize * * @return {undefined} */ -function SetWindowSize (width, height) { +function SetWindowSize(width, height) { return r.BindSetWindowSize( width, height @@ -312,25 +338,35 @@ function SetWindowSize (width, height) { raylib.SetWindowSize = SetWindowSize /** - * Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) + * Set window opacity [0.0f..1.0f] * * @param {number} opacity * * @return {undefined} */ -function SetWindowOpacity (opacity) { +function SetWindowOpacity(opacity) { return r.BindSetWindowOpacity( opacity ) } raylib.SetWindowOpacity = SetWindowOpacity +/** + * Set window focused + * + * @return {undefined} + */ +function SetWindowFocused() { + return r.BindSetWindowFocused() +} +raylib.SetWindowFocused = SetWindowFocused + /** * Get native window handle * * @return {number} The resulting void *. */ -function GetWindowHandle () { +function GetWindowHandle() { return r.BindGetWindowHandle() } raylib.GetWindowHandle = GetWindowHandle @@ -340,7 +376,7 @@ raylib.GetWindowHandle = GetWindowHandle * * @return {number} The resulting int. */ -function GetScreenWidth () { +function GetScreenWidth() { return r.BindGetScreenWidth() } raylib.GetScreenWidth = GetScreenWidth @@ -350,7 +386,7 @@ raylib.GetScreenWidth = GetScreenWidth * * @return {number} The resulting int. */ -function GetScreenHeight () { +function GetScreenHeight() { return r.BindGetScreenHeight() } raylib.GetScreenHeight = GetScreenHeight @@ -360,7 +396,7 @@ raylib.GetScreenHeight = GetScreenHeight * * @return {number} The resulting int. */ -function GetRenderWidth () { +function GetRenderWidth() { return r.BindGetRenderWidth() } raylib.GetRenderWidth = GetRenderWidth @@ -370,7 +406,7 @@ raylib.GetRenderWidth = GetRenderWidth * * @return {number} The resulting int. */ -function GetRenderHeight () { +function GetRenderHeight() { return r.BindGetRenderHeight() } raylib.GetRenderHeight = GetRenderHeight @@ -380,17 +416,17 @@ raylib.GetRenderHeight = GetRenderHeight * * @return {number} The resulting int. */ -function GetMonitorCount () { +function GetMonitorCount() { return r.BindGetMonitorCount() } raylib.GetMonitorCount = GetMonitorCount /** - * Get current connected monitor + * Get current monitor where window is placed * * @return {number} The resulting int. */ -function GetCurrentMonitor () { +function GetCurrentMonitor() { return r.BindGetCurrentMonitor() } raylib.GetCurrentMonitor = GetCurrentMonitor @@ -402,7 +438,7 @@ raylib.GetCurrentMonitor = GetCurrentMonitor * * @return {Vector2} The resulting Vector2. */ -function GetMonitorPosition (monitor) { +function GetMonitorPosition(monitor) { return r.BindGetMonitorPosition( monitor ) @@ -416,7 +452,7 @@ raylib.GetMonitorPosition = GetMonitorPosition * * @return {number} The resulting int. */ -function GetMonitorWidth (monitor) { +function GetMonitorWidth(monitor) { return r.BindGetMonitorWidth( monitor ) @@ -430,7 +466,7 @@ raylib.GetMonitorWidth = GetMonitorWidth * * @return {number} The resulting int. */ -function GetMonitorHeight (monitor) { +function GetMonitorHeight(monitor) { return r.BindGetMonitorHeight( monitor ) @@ -444,7 +480,7 @@ raylib.GetMonitorHeight = GetMonitorHeight * * @return {number} The resulting int. */ -function GetMonitorPhysicalWidth (monitor) { +function GetMonitorPhysicalWidth(monitor) { return r.BindGetMonitorPhysicalWidth( monitor ) @@ -458,7 +494,7 @@ raylib.GetMonitorPhysicalWidth = GetMonitorPhysicalWidth * * @return {number} The resulting int. */ -function GetMonitorPhysicalHeight (monitor) { +function GetMonitorPhysicalHeight(monitor) { return r.BindGetMonitorPhysicalHeight( monitor ) @@ -472,7 +508,7 @@ raylib.GetMonitorPhysicalHeight = GetMonitorPhysicalHeight * * @return {number} The resulting int. */ -function GetMonitorRefreshRate (monitor) { +function GetMonitorRefreshRate(monitor) { return r.BindGetMonitorRefreshRate( monitor ) @@ -484,7 +520,7 @@ raylib.GetMonitorRefreshRate = GetMonitorRefreshRate * * @return {Vector2} The resulting Vector2. */ -function GetWindowPosition () { +function GetWindowPosition() { return r.BindGetWindowPosition() } raylib.GetWindowPosition = GetWindowPosition @@ -494,19 +530,19 @@ raylib.GetWindowPosition = GetWindowPosition * * @return {Vector2} The resulting Vector2. */ -function GetWindowScaleDPI () { +function GetWindowScaleDPI() { return r.BindGetWindowScaleDPI() } raylib.GetWindowScaleDPI = GetWindowScaleDPI /** - * Get the human-readable, UTF-8 encoded name of the primary monitor + * Get the human-readable, UTF-8 encoded name of the specified monitor * * @param {number} monitor * * @return {string} The resulting const char *. */ -function GetMonitorName (monitor) { +function GetMonitorName(monitor) { return r.BindGetMonitorName( monitor ) @@ -520,7 +556,7 @@ raylib.GetMonitorName = GetMonitorName * * @return {undefined} */ -function SetClipboardText (text) { +function SetClipboardText(text) { return r.BindSetClipboardText( text ) @@ -532,17 +568,27 @@ raylib.SetClipboardText = SetClipboardText * * @return {string} The resulting const char *. */ -function GetClipboardText () { +function GetClipboardText() { return r.BindGetClipboardText() } raylib.GetClipboardText = GetClipboardText +/** + * Get clipboard image content + * + * @return {Image} The resulting Image. + */ +function GetClipboardImage() { + return r.BindGetClipboardImage() +} +raylib.GetClipboardImage = GetClipboardImage + /** * Enable waiting for events on EndDrawing(), no automatic event polling * * @return {undefined} */ -function EnableEventWaiting () { +function EnableEventWaiting() { return r.BindEnableEventWaiting() } raylib.EnableEventWaiting = EnableEventWaiting @@ -552,51 +598,17 @@ raylib.EnableEventWaiting = EnableEventWaiting * * @return {undefined} */ -function DisableEventWaiting () { +function DisableEventWaiting() { return r.BindDisableEventWaiting() } raylib.DisableEventWaiting = DisableEventWaiting -/** - * Swap back buffer with front buffer (screen drawing) - * - * @return {undefined} - */ -function SwapScreenBuffer () { - return r.BindSwapScreenBuffer() -} -raylib.SwapScreenBuffer = SwapScreenBuffer - -/** - * Register all input events - * - * @return {undefined} - */ -function PollInputEvents () { - return r.BindPollInputEvents() -} -raylib.PollInputEvents = PollInputEvents - -/** - * Wait for some time (halt program execution) - * - * @param {number} seconds - * - * @return {undefined} - */ -function WaitTime (seconds) { - return r.BindWaitTime( - seconds - ) -} -raylib.WaitTime = WaitTime - /** * Shows cursor * * @return {undefined} */ -function ShowCursor () { +function ShowCursor() { return r.BindShowCursor() } raylib.ShowCursor = ShowCursor @@ -606,7 +618,7 @@ raylib.ShowCursor = ShowCursor * * @return {undefined} */ -function HideCursor () { +function HideCursor() { return r.BindHideCursor() } raylib.HideCursor = HideCursor @@ -616,7 +628,7 @@ raylib.HideCursor = HideCursor * * @return {boolean} The resulting bool. */ -function IsCursorHidden () { +function IsCursorHidden() { return r.BindIsCursorHidden() } raylib.IsCursorHidden = IsCursorHidden @@ -626,7 +638,7 @@ raylib.IsCursorHidden = IsCursorHidden * * @return {undefined} */ -function EnableCursor () { +function EnableCursor() { return r.BindEnableCursor() } raylib.EnableCursor = EnableCursor @@ -636,7 +648,7 @@ raylib.EnableCursor = EnableCursor * * @return {undefined} */ -function DisableCursor () { +function DisableCursor() { return r.BindDisableCursor() } raylib.DisableCursor = DisableCursor @@ -646,7 +658,7 @@ raylib.DisableCursor = DisableCursor * * @return {boolean} The resulting bool. */ -function IsCursorOnScreen () { +function IsCursorOnScreen() { return r.BindIsCursorOnScreen() } raylib.IsCursorOnScreen = IsCursorOnScreen @@ -658,7 +670,7 @@ raylib.IsCursorOnScreen = IsCursorOnScreen * * @return {undefined} */ -function ClearBackground (color) { +function ClearBackground(color) { return r.BindClearBackground( color.r, color.g, @@ -673,7 +685,7 @@ raylib.ClearBackground = ClearBackground * * @return {undefined} */ -function BeginDrawing () { +function BeginDrawing() { return r.BindBeginDrawing() } raylib.BeginDrawing = BeginDrawing @@ -683,7 +695,7 @@ raylib.BeginDrawing = BeginDrawing * * @return {undefined} */ -function EndDrawing () { +function EndDrawing() { return r.BindEndDrawing() } raylib.EndDrawing = EndDrawing @@ -695,7 +707,7 @@ raylib.EndDrawing = EndDrawing * * @return {undefined} */ -function BeginMode2D (camera) { +function BeginMode2D(camera) { return r.BindBeginMode2D( camera.offset.x, camera.offset.y, @@ -712,7 +724,7 @@ raylib.BeginMode2D = BeginMode2D * * @return {undefined} */ -function EndMode2D () { +function EndMode2D() { return r.BindEndMode2D() } raylib.EndMode2D = EndMode2D @@ -724,7 +736,7 @@ raylib.EndMode2D = EndMode2D * * @return {undefined} */ -function BeginMode3D (camera) { +function BeginMode3D(camera) { return r.BindBeginMode3D( camera.position.x, camera.position.y, @@ -746,7 +758,7 @@ raylib.BeginMode3D = BeginMode3D * * @return {undefined} */ -function EndMode3D () { +function EndMode3D() { return r.BindEndMode3D() } raylib.EndMode3D = EndMode3D @@ -758,7 +770,7 @@ raylib.EndMode3D = EndMode3D * * @return {undefined} */ -function BeginTextureMode (target) { +function BeginTextureMode(target) { return r.BindBeginTextureMode( target.id, target.texture.id, @@ -780,7 +792,7 @@ raylib.BeginTextureMode = BeginTextureMode * * @return {undefined} */ -function EndTextureMode () { +function EndTextureMode() { return r.BindEndTextureMode() } raylib.EndTextureMode = EndTextureMode @@ -792,7 +804,7 @@ raylib.EndTextureMode = EndTextureMode * * @return {undefined} */ -function BeginShaderMode (shader) { +function BeginShaderMode(shader) { return r.BindBeginShaderMode( shader.id, shader.locs @@ -805,7 +817,7 @@ raylib.BeginShaderMode = BeginShaderMode * * @return {undefined} */ -function EndShaderMode () { +function EndShaderMode() { return r.BindEndShaderMode() } raylib.EndShaderMode = EndShaderMode @@ -817,7 +829,7 @@ raylib.EndShaderMode = EndShaderMode * * @return {undefined} */ -function BeginBlendMode (mode) { +function BeginBlendMode(mode) { return r.BindBeginBlendMode( mode ) @@ -829,7 +841,7 @@ raylib.BeginBlendMode = BeginBlendMode * * @return {undefined} */ -function EndBlendMode () { +function EndBlendMode() { return r.BindEndBlendMode() } raylib.EndBlendMode = EndBlendMode @@ -844,7 +856,7 @@ raylib.EndBlendMode = EndBlendMode * * @return {undefined} */ -function BeginScissorMode (x, y, width, height) { +function BeginScissorMode(x, y, width, height) { return r.BindBeginScissorMode( x, y, @@ -859,7 +871,7 @@ raylib.BeginScissorMode = BeginScissorMode * * @return {undefined} */ -function EndScissorMode () { +function EndScissorMode() { return r.BindEndScissorMode() } raylib.EndScissorMode = EndScissorMode @@ -869,7 +881,7 @@ raylib.EndScissorMode = EndScissorMode * * @return {undefined} */ -function EndVrStereoMode () { +function EndVrStereoMode() { return r.BindEndVrStereoMode() } raylib.EndVrStereoMode = EndVrStereoMode @@ -882,7 +894,7 @@ raylib.EndVrStereoMode = EndVrStereoMode * * @return {Shader} The resulting Shader. */ -function LoadShader (vsFileName, fsFileName) { +function LoadShader(vsFileName, fsFileName) { return r.BindLoadShader( vsFileName, fsFileName @@ -898,7 +910,7 @@ raylib.LoadShader = LoadShader * * @return {Shader} The resulting Shader. */ -function LoadShaderFromMemory (vsCode, fsCode) { +function LoadShaderFromMemory(vsCode, fsCode) { return r.BindLoadShaderFromMemory( vsCode, fsCode @@ -907,19 +919,19 @@ function LoadShaderFromMemory (vsCode, fsCode) { raylib.LoadShaderFromMemory = LoadShaderFromMemory /** - * Check if a shader is ready + * Check if a shader is valid (loaded on GPU) * * @param {Shader} shader * * @return {boolean} The resulting bool. */ -function IsShaderReady (shader) { - return r.BindIsShaderReady( +function IsShaderValid(shader) { + return r.BindIsShaderValid( shader.id, shader.locs ) } -raylib.IsShaderReady = IsShaderReady +raylib.IsShaderValid = IsShaderValid /** * Get shader uniform location @@ -929,7 +941,7 @@ raylib.IsShaderReady = IsShaderReady * * @return {number} The resulting int. */ -function GetShaderLocation (shader, uniformName) { +function GetShaderLocation(shader, uniformName) { return r.BindGetShaderLocation( shader.id, shader.locs, @@ -946,7 +958,7 @@ raylib.GetShaderLocation = GetShaderLocation * * @return {number} The resulting int. */ -function GetShaderLocationAttrib (shader, attribName) { +function GetShaderLocationAttrib(shader, attribName) { return r.BindGetShaderLocationAttrib( shader.id, shader.locs, @@ -964,7 +976,7 @@ raylib.GetShaderLocationAttrib = GetShaderLocationAttrib * * @return {undefined} */ -function SetShaderValueMatrix (shader, locIndex, mat) { +function SetShaderValueMatrix(shader, locIndex, mat) { return r.BindSetShaderValueMatrix( shader.id, shader.locs, @@ -998,7 +1010,7 @@ raylib.SetShaderValueMatrix = SetShaderValueMatrix * * @return {undefined} */ -function SetShaderValueTexture (shader, locIndex, texture) { +function SetShaderValueTexture(shader, locIndex, texture) { return r.BindSetShaderValueTexture( shader.id, shader.locs, @@ -1019,7 +1031,7 @@ raylib.SetShaderValueTexture = SetShaderValueTexture * * @return {undefined} */ -function UnloadShader (shader) { +function UnloadShader(shader) { return r.BindUnloadShader( shader.id, shader.locs @@ -1028,17 +1040,17 @@ function UnloadShader (shader) { raylib.UnloadShader = UnloadShader /** - * Get a ray trace from mouse position + * Get a ray trace from screen position (i.e mouse) * - * @param {Vector2} mousePosition + * @param {Vector2} position * @param {Camera} camera * * @return {Ray} The resulting Ray. */ -function GetMouseRay (mousePosition, camera) { - return r.BindGetMouseRay( - mousePosition.x, - mousePosition.y, +function GetScreenToWorldRay(position, camera) { + return r.BindGetScreenToWorldRay( + position.x, + position.y, camera.position.x, camera.position.y, camera.position.z, @@ -1052,17 +1064,22 @@ function GetMouseRay (mousePosition, camera) { camera.projection ) } -raylib.GetMouseRay = GetMouseRay +raylib.GetScreenToWorldRay = GetScreenToWorldRay /** - * Get camera transform matrix (view matrix) + * Get a ray trace from screen position (i.e mouse) in a viewport * + * @param {Vector2} position * @param {Camera} camera + * @param {number} width + * @param {number} height * - * @return {Matrix} The resulting Matrix. + * @return {Ray} The resulting Ray. */ -function GetCameraMatrix (camera) { - return r.BindGetCameraMatrix( +function GetScreenToWorldRayEx(position, camera, width, height) { + return r.BindGetScreenToWorldRayEx( + position.x, + position.y, camera.position.x, camera.position.y, camera.position.z, @@ -1073,40 +1090,53 @@ function GetCameraMatrix (camera) { camera.up.y, camera.up.z, camera.fovy, - camera.projection + camera.projection, + width, + height ) } -raylib.GetCameraMatrix = GetCameraMatrix +raylib.GetScreenToWorldRayEx = GetScreenToWorldRayEx /** - * Get camera 2d transform matrix + * Get the screen space position for a 3d world space position * - * @param {Camera2D} camera + * @param {Vector3} position + * @param {Camera} camera * - * @return {Matrix} The resulting Matrix. + * @return {Vector2} The resulting Vector2. */ -function GetCameraMatrix2D (camera) { - return r.BindGetCameraMatrix2D( - camera.offset.x, - camera.offset.y, +function GetWorldToScreen(position, camera) { + return r.BindGetWorldToScreen( + position.x, + position.y, + position.z, + camera.position.x, + camera.position.y, + camera.position.z, camera.target.x, camera.target.y, - camera.rotation, - camera.zoom + camera.target.z, + camera.up.x, + camera.up.y, + camera.up.z, + camera.fovy, + camera.projection ) } -raylib.GetCameraMatrix2D = GetCameraMatrix2D +raylib.GetWorldToScreen = GetWorldToScreen /** - * Get the screen space position for a 3d world space position + * Get size position for a 3d world space position * * @param {Vector3} position * @param {Camera} camera + * @param {number} width + * @param {number} height * * @return {Vector2} The resulting Vector2. */ -function GetWorldToScreen (position, camera) { - return r.BindGetWorldToScreen( +function GetWorldToScreenEx(position, camera, width, height) { + return r.BindGetWorldToScreenEx( position.x, position.y, position.z, @@ -1120,10 +1150,34 @@ function GetWorldToScreen (position, camera) { camera.up.y, camera.up.z, camera.fovy, - camera.projection + camera.projection, + width, + height ) } -raylib.GetWorldToScreen = GetWorldToScreen +raylib.GetWorldToScreenEx = GetWorldToScreenEx + +/** + * Get the screen space position for a 2d camera world space position + * + * @param {Vector2} position + * @param {Camera2D} camera + * + * @return {Vector2} The resulting Vector2. + */ +function GetWorldToScreen2D(position, camera) { + return r.BindGetWorldToScreen2D( + position.x, + position.y, + camera.offset.x, + camera.offset.y, + camera.target.x, + camera.target.y, + camera.rotation, + camera.zoom + ) +} +raylib.GetWorldToScreen2D = GetWorldToScreen2D /** * Get the world space position for a 2d camera screen space position @@ -1133,7 +1187,7 @@ raylib.GetWorldToScreen = GetWorldToScreen * * @return {Vector2} The resulting Vector2. */ -function GetScreenToWorld2D (position, camera) { +function GetScreenToWorld2D(position, camera) { return r.BindGetScreenToWorld2D( position.x, position.y, @@ -1148,20 +1202,14 @@ function GetScreenToWorld2D (position, camera) { raylib.GetScreenToWorld2D = GetScreenToWorld2D /** - * Get size position for a 3d world space position + * Get camera transform matrix (view matrix) * - * @param {Vector3} position * @param {Camera} camera - * @param {number} width - * @param {number} height * - * @return {Vector2} The resulting Vector2. + * @return {Matrix} The resulting Matrix. */ -function GetWorldToScreenEx (position, camera, width, height) { - return r.BindGetWorldToScreenEx( - position.x, - position.y, - position.z, +function GetCameraMatrix(camera) { + return r.BindGetCameraMatrix( camera.position.x, camera.position.y, camera.position.z, @@ -1172,25 +1220,20 @@ function GetWorldToScreenEx (position, camera, width, height) { camera.up.y, camera.up.z, camera.fovy, - camera.projection, - width, - height + camera.projection ) } -raylib.GetWorldToScreenEx = GetWorldToScreenEx +raylib.GetCameraMatrix = GetCameraMatrix /** - * Get the screen space position for a 2d camera world space position + * Get camera 2d transform matrix * - * @param {Vector2} position * @param {Camera2D} camera * - * @return {Vector2} The resulting Vector2. + * @return {Matrix} The resulting Matrix. */ -function GetWorldToScreen2D (position, camera) { - return r.BindGetWorldToScreen2D( - position.x, - position.y, +function GetCameraMatrix2D(camera) { + return r.BindGetCameraMatrix2D( camera.offset.x, camera.offset.y, camera.target.x, @@ -1199,7 +1242,7 @@ function GetWorldToScreen2D (position, camera) { camera.zoom ) } -raylib.GetWorldToScreen2D = GetWorldToScreen2D +raylib.GetCameraMatrix2D = GetCameraMatrix2D /** * Set target FPS (maximum) @@ -1208,29 +1251,19 @@ raylib.GetWorldToScreen2D = GetWorldToScreen2D * * @return {undefined} */ -function SetTargetFPS (fps) { +function SetTargetFPS(fps) { return r.BindSetTargetFPS( fps ) } raylib.SetTargetFPS = SetTargetFPS -/** - * Get current FPS - * - * @return {number} The resulting int. - */ -function GetFPS () { - return r.BindGetFPS() -} -raylib.GetFPS = GetFPS - /** * Get time in seconds for last frame drawn (delta time) * * @return {number} The resulting float. */ -function GetFrameTime () { +function GetFrameTime() { return r.BindGetFrameTime() } raylib.GetFrameTime = GetFrameTime @@ -1240,126 +1273,144 @@ raylib.GetFrameTime = GetFrameTime * * @return {number} The resulting double. */ -function GetTime () { +function GetTime() { return r.BindGetTime() } raylib.GetTime = GetTime /** - * Get a random value between min and max (both included) - * - * @param {number} min - * @param {number} max + * Get current FPS * * @return {number} The resulting int. */ -function GetRandomValue (min, max) { - return r.BindGetRandomValue( - min, - max - ) +function GetFPS() { + return r.BindGetFPS() } -raylib.GetRandomValue = GetRandomValue +raylib.GetFPS = GetFPS /** - * Set the seed for the random number generator - * - * @param {number} seed + * Swap back buffer with front buffer (screen drawing) * * @return {undefined} */ -function SetRandomSeed (seed) { - return r.BindSetRandomSeed( - seed - ) +function SwapScreenBuffer() { + return r.BindSwapScreenBuffer() } -raylib.SetRandomSeed = SetRandomSeed +raylib.SwapScreenBuffer = SwapScreenBuffer /** - * Takes a screenshot of current screen (filename extension defines format) - * - * @param {string} fileName + * Register all input events * * @return {undefined} */ -function TakeScreenshot (fileName) { - return r.BindTakeScreenshot( - fileName - ) +function PollInputEvents() { + return r.BindPollInputEvents() } -raylib.TakeScreenshot = TakeScreenshot +raylib.PollInputEvents = PollInputEvents /** - * Setup init configuration flags (view FLAGS) + * Wait for some time (halt program execution) * - * @param {number} flags + * @param {number} seconds * * @return {undefined} */ -function SetConfigFlags (flags) { - return r.BindSetConfigFlags( - flags +function WaitTime(seconds) { + return r.BindWaitTime( + seconds ) } -raylib.SetConfigFlags = SetConfigFlags +raylib.WaitTime = WaitTime /** - * Set the current threshold (minimum) log level + * Set the seed for the random number generator * - * @param {number} logLevel + * @param {number} seed * * @return {undefined} */ -function SetTraceLogLevel (logLevel) { - return r.BindSetTraceLogLevel( - logLevel +function SetRandomSeed(seed) { + return r.BindSetRandomSeed( + seed ) } -raylib.SetTraceLogLevel = SetTraceLogLevel +raylib.SetRandomSeed = SetRandomSeed /** - * Internal memory allocator + * Get a random value between min and max (both included) * - * @param {number} size + * @param {number} min + * @param {number} max * - * @return {number} The resulting void *. + * @return {number} The resulting int. */ -function MemAlloc (size) { - return r.BindMemAlloc( - size +function GetRandomValue(min, max) { + return r.BindGetRandomValue( + min, + max ) } -raylib.MemAlloc = MemAlloc +raylib.GetRandomValue = GetRandomValue /** - * Internal memory reallocator + * Load random values sequence, no values repeated * - * @param {number} ptr - * @param {number} size + * @param {number} count + * @param {number} min + * @param {number} max * - * @return {number} The resulting void *. + * @return {number} The resulting int *. */ -function MemRealloc (ptr, size) { - return r.BindMemRealloc( - ptr, - size +function LoadRandomSequence(count, min, max) { + return r.BindLoadRandomSequence( + count, + min, + max ) } -raylib.MemRealloc = MemRealloc +raylib.LoadRandomSequence = LoadRandomSequence /** - * Internal memory free + * Unload random values sequence * - * @param {number} ptr + * @param {number} sequence * * @return {undefined} */ -function MemFree (ptr) { - return r.BindMemFree( - ptr +function UnloadRandomSequence(sequence) { + return r.BindUnloadRandomSequence( + sequence ) } -raylib.MemFree = MemFree +raylib.UnloadRandomSequence = UnloadRandomSequence + +/** + * Takes a screenshot of current screen (filename extension defines format) + * + * @param {string} fileName + * + * @return {undefined} + */ +function TakeScreenshot(fileName) { + return r.BindTakeScreenshot( + fileName + ) +} +raylib.TakeScreenshot = TakeScreenshot + +/** + * Setup init configuration flags (view FLAGS) + * + * @param {number} flags + * + * @return {undefined} + */ +function SetConfigFlags(flags) { + return r.BindSetConfigFlags( + flags + ) +} +raylib.SetConfigFlags = SetConfigFlags /** * Open URL with default system browser (if available) @@ -1368,25 +1419,83 @@ raylib.MemFree = MemFree * * @return {undefined} */ -function OpenURL (url) { +function OpenURL(url) { return r.BindOpenURL( url ) } raylib.OpenURL = OpenURL +/** + * Set the current threshold (minimum) log level + * + * @param {number} logLevel + * + * @return {undefined} + */ +function SetTraceLogLevel(logLevel) { + return r.BindSetTraceLogLevel( + logLevel + ) +} +raylib.SetTraceLogLevel = SetTraceLogLevel + +/** + * Internal memory allocator + * + * @param {number} size + * + * @return {number} The resulting void *. + */ +function MemAlloc(size) { + return r.BindMemAlloc( + size + ) +} +raylib.MemAlloc = MemAlloc + +/** + * Internal memory reallocator + * + * @param {number} ptr + * @param {number} size + * + * @return {number} The resulting void *. + */ +function MemRealloc(ptr, size) { + return r.BindMemRealloc( + ptr, + size + ) +} +raylib.MemRealloc = MemRealloc + +/** + * Internal memory free + * + * @param {number} ptr + * + * @return {undefined} + */ +function MemFree(ptr) { + return r.BindMemFree( + ptr + ) +} +raylib.MemFree = MemFree + /** * Load file data as byte array (read) * * @param {string} fileName - * @param {number} bytesRead + * @param {number} dataSize * * @return {Buffer} The resulting unsigned char *. */ -function LoadFileData (fileName, bytesRead) { +function LoadFileData(fileName, dataSize) { return r.BindLoadFileData( fileName, - bytesRead + dataSize ) } raylib.LoadFileData = LoadFileData @@ -1398,7 +1507,7 @@ raylib.LoadFileData = LoadFileData * * @return {undefined} */ -function UnloadFileData (data) { +function UnloadFileData(data) { return r.BindUnloadFileData( data ) @@ -1410,15 +1519,15 @@ raylib.UnloadFileData = UnloadFileData * * @param {string} fileName * @param {number} data - * @param {number} bytesToWrite + * @param {number} dataSize * * @return {boolean} The resulting bool. */ -function SaveFileData (fileName, data, bytesToWrite) { +function SaveFileData(fileName, data, dataSize) { return r.BindSaveFileData( fileName, data, - bytesToWrite + dataSize ) } raylib.SaveFileData = SaveFileData @@ -1427,15 +1536,15 @@ raylib.SaveFileData = SaveFileData * Export data to code (.h), returns true on success * * @param {Buffer} data - * @param {number} size + * @param {number} dataSize * @param {string} fileName * * @return {boolean} The resulting bool. */ -function ExportDataAsCode (data, size, fileName) { +function ExportDataAsCode(data, dataSize, fileName) { return r.BindExportDataAsCode( data, - size, + dataSize, fileName ) } @@ -1448,7 +1557,7 @@ raylib.ExportDataAsCode = ExportDataAsCode * * @return {string} The resulting char *. */ -function LoadFileText (fileName) { +function LoadFileText(fileName) { return r.BindLoadFileText( fileName ) @@ -1462,7 +1571,7 @@ raylib.LoadFileText = LoadFileText * * @return {undefined} */ -function UnloadFileText (text) { +function UnloadFileText(text) { return r.BindUnloadFileText( text ) @@ -1477,7 +1586,7 @@ raylib.UnloadFileText = UnloadFileText * * @return {boolean} The resulting bool. */ -function SaveFileText (fileName, text) { +function SaveFileText(fileName, text) { return r.BindSaveFileText( fileName, text @@ -1492,7 +1601,7 @@ raylib.SaveFileText = SaveFileText * * @return {boolean} The resulting bool. */ -function FileExists (fileName) { +function FileExists(fileName) { return r.BindFileExists( fileName ) @@ -1506,7 +1615,7 @@ raylib.FileExists = FileExists * * @return {boolean} The resulting bool. */ -function DirectoryExists (dirPath) { +function DirectoryExists(dirPath) { return r.BindDirectoryExists( dirPath ) @@ -1521,7 +1630,7 @@ raylib.DirectoryExists = DirectoryExists * * @return {boolean} The resulting bool. */ -function IsFileExtension (fileName, ext) { +function IsFileExtension(fileName, ext) { return r.BindIsFileExtension( fileName, ext @@ -1536,7 +1645,7 @@ raylib.IsFileExtension = IsFileExtension * * @return {number} The resulting int. */ -function GetFileLength (fileName) { +function GetFileLength(fileName) { return r.BindGetFileLength( fileName ) @@ -1550,7 +1659,7 @@ raylib.GetFileLength = GetFileLength * * @return {string} The resulting const char *. */ -function GetFileExtension (fileName) { +function GetFileExtension(fileName) { return r.BindGetFileExtension( fileName ) @@ -1564,7 +1673,7 @@ raylib.GetFileExtension = GetFileExtension * * @return {string} The resulting const char *. */ -function GetFileName (filePath) { +function GetFileName(filePath) { return r.BindGetFileName( filePath ) @@ -1578,7 +1687,7 @@ raylib.GetFileName = GetFileName * * @return {string} The resulting const char *. */ -function GetFileNameWithoutExt (filePath) { +function GetFileNameWithoutExt(filePath) { return r.BindGetFileNameWithoutExt( filePath ) @@ -1592,7 +1701,7 @@ raylib.GetFileNameWithoutExt = GetFileNameWithoutExt * * @return {string} The resulting const char *. */ -function GetDirectoryPath (filePath) { +function GetDirectoryPath(filePath) { return r.BindGetDirectoryPath( filePath ) @@ -1606,7 +1715,7 @@ raylib.GetDirectoryPath = GetDirectoryPath * * @return {string} The resulting const char *. */ -function GetPrevDirectoryPath (dirPath) { +function GetPrevDirectoryPath(dirPath) { return r.BindGetPrevDirectoryPath( dirPath ) @@ -1618,21 +1727,35 @@ raylib.GetPrevDirectoryPath = GetPrevDirectoryPath * * @return {string} The resulting const char *. */ -function GetWorkingDirectory () { +function GetWorkingDirectory() { return r.BindGetWorkingDirectory() } raylib.GetWorkingDirectory = GetWorkingDirectory /** - * Get the directory if the running application (uses static string) + * Get the directory of the running application (uses static string) * * @return {string} The resulting const char *. */ -function GetApplicationDirectory () { +function GetApplicationDirectory() { return r.BindGetApplicationDirectory() } raylib.GetApplicationDirectory = GetApplicationDirectory +/** + * Create directories (including full path requested), returns 0 on success + * + * @param {string} dirPath + * + * @return {number} The resulting int. + */ +function MakeDirectory(dirPath) { + return r.BindMakeDirectory( + dirPath + ) +} +raylib.MakeDirectory = MakeDirectory + /** * Change working directory, return true on success * @@ -1640,7 +1763,7 @@ raylib.GetApplicationDirectory = GetApplicationDirectory * * @return {boolean} The resulting bool. */ -function ChangeDirectory (dir) { +function ChangeDirectory(dir) { return r.BindChangeDirectory( dir ) @@ -1654,13 +1777,27 @@ raylib.ChangeDirectory = ChangeDirectory * * @return {boolean} The resulting bool. */ -function IsPathFile (path) { +function IsPathFile(path) { return r.BindIsPathFile( path ) } raylib.IsPathFile = IsPathFile +/** + * Check if fileName is valid for the platform/OS + * + * @param {string} fileName + * + * @return {boolean} The resulting bool. + */ +function IsFileNameValid(fileName) { + return r.BindIsFileNameValid( + fileName + ) +} +raylib.IsFileNameValid = IsFileNameValid + /** * Load directory filepaths * @@ -1668,7 +1805,7 @@ raylib.IsPathFile = IsPathFile * * @return {FilePathList} The resulting FilePathList. */ -function LoadDirectoryFiles (dirPath) { +function LoadDirectoryFiles(dirPath) { return r.BindLoadDirectoryFiles( dirPath ) @@ -1676,7 +1813,7 @@ function LoadDirectoryFiles (dirPath) { raylib.LoadDirectoryFiles = LoadDirectoryFiles /** - * Load directory filepaths with extension filtering and recursive directory scan + * Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result * * @param {string} basePath * @param {string} filter @@ -1684,7 +1821,7 @@ raylib.LoadDirectoryFiles = LoadDirectoryFiles * * @return {FilePathList} The resulting FilePathList. */ -function LoadDirectoryFilesEx (basePath, filter, scanSubdirs) { +function LoadDirectoryFilesEx(basePath, filter, scanSubdirs) { return r.BindLoadDirectoryFilesEx( basePath, filter, @@ -1700,7 +1837,7 @@ raylib.LoadDirectoryFilesEx = LoadDirectoryFilesEx * * @return {undefined} */ -function UnloadDirectoryFiles (files) { +function UnloadDirectoryFiles(files) { return r.BindUnloadDirectoryFiles( files.capacity, files.count, @@ -1714,7 +1851,7 @@ raylib.UnloadDirectoryFiles = UnloadDirectoryFiles * * @return {boolean} The resulting bool. */ -function IsFileDropped () { +function IsFileDropped() { return r.BindIsFileDropped() } raylib.IsFileDropped = IsFileDropped @@ -1724,7 +1861,7 @@ raylib.IsFileDropped = IsFileDropped * * @return {FilePathList} The resulting FilePathList. */ -function LoadDroppedFiles () { +function LoadDroppedFiles() { return r.BindLoadDroppedFiles() } raylib.LoadDroppedFiles = LoadDroppedFiles @@ -1736,7 +1873,7 @@ raylib.LoadDroppedFiles = LoadDroppedFiles * * @return {undefined} */ -function UnloadDroppedFiles (files) { +function UnloadDroppedFiles(files) { return r.BindUnloadDroppedFiles( files.capacity, files.count, @@ -1752,7 +1889,7 @@ raylib.UnloadDroppedFiles = UnloadDroppedFiles * * @return {number} The resulting long. */ -function GetFileModTime (fileName) { +function GetFileModTime(fileName) { return r.BindGetFileModTime( fileName ) @@ -1768,7 +1905,7 @@ raylib.GetFileModTime = GetFileModTime * * @return {Buffer} The resulting unsigned char *. */ -function CompressData (data, dataSize, compDataSize) { +function CompressData(data, dataSize, compDataSize) { return r.BindCompressData( data, dataSize, @@ -1786,7 +1923,7 @@ raylib.CompressData = CompressData * * @return {Buffer} The resulting unsigned char *. */ -function DecompressData (compData, compDataSize, dataSize) { +function DecompressData(compData, compDataSize, dataSize) { return r.BindDecompressData( compData, compDataSize, @@ -1804,7 +1941,7 @@ raylib.DecompressData = DecompressData * * @return {string} The resulting char *. */ -function EncodeDataBase64 (data, dataSize, outputSize) { +function EncodeDataBase64(data, dataSize, outputSize) { return r.BindEncodeDataBase64( data, dataSize, @@ -1821,7 +1958,7 @@ raylib.EncodeDataBase64 = EncodeDataBase64 * * @return {Buffer} The resulting unsigned char *. */ -function DecodeDataBase64 (data, outputSize) { +function DecodeDataBase64(data, outputSize) { return r.BindDecodeDataBase64( data, outputSize @@ -1830,193 +1967,367 @@ function DecodeDataBase64 (data, outputSize) { raylib.DecodeDataBase64 = DecodeDataBase64 /** - * Check if a key has been pressed once + * Compute CRC32 hash code * - * @param {number} key + * @param {Buffer} data + * @param {number} dataSize * - * @return {boolean} The resulting bool. + * @return {number} The resulting unsigned int. */ -function IsKeyPressed (key) { - return r.BindIsKeyPressed( - key +function ComputeCRC32(data, dataSize) { + return r.BindComputeCRC32( + data, + dataSize ) } -raylib.IsKeyPressed = IsKeyPressed +raylib.ComputeCRC32 = ComputeCRC32 /** - * Check if a key is being pressed + * Compute MD5 hash code, returns static int[4] (16 bytes) * - * @param {number} key + * @param {Buffer} data + * @param {number} dataSize * - * @return {boolean} The resulting bool. + * @return {number} The resulting unsigned int *. */ -function IsKeyDown (key) { - return r.BindIsKeyDown( - key +function ComputeMD5(data, dataSize) { + return r.BindComputeMD5( + data, + dataSize ) } -raylib.IsKeyDown = IsKeyDown +raylib.ComputeMD5 = ComputeMD5 /** - * Check if a key has been released once + * Compute SHA1 hash code, returns static int[5] (20 bytes) * - * @param {number} key + * @param {Buffer} data + * @param {number} dataSize * - * @return {boolean} The resulting bool. + * @return {number} The resulting unsigned int *. */ -function IsKeyReleased (key) { - return r.BindIsKeyReleased( - key +function ComputeSHA1(data, dataSize) { + return r.BindComputeSHA1( + data, + dataSize ) } -raylib.IsKeyReleased = IsKeyReleased +raylib.ComputeSHA1 = ComputeSHA1 /** - * Check if a key is NOT being pressed + * Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS * - * @param {number} key + * @param {string} fileName * - * @return {boolean} The resulting bool. + * @return {AutomationEventList} The resulting AutomationEventList. */ -function IsKeyUp (key) { - return r.BindIsKeyUp( - key +function LoadAutomationEventList(fileName) { + return r.BindLoadAutomationEventList( + fileName ) } -raylib.IsKeyUp = IsKeyUp +raylib.LoadAutomationEventList = LoadAutomationEventList /** - * Set a custom key to exit program (default is ESC) + * Unload automation events list from file * - * @param {number} key + * @param {AutomationEventList} list * * @return {undefined} */ -function SetExitKey (key) { - return r.BindSetExitKey( - key +function UnloadAutomationEventList(list) { + return r.BindUnloadAutomationEventList( + list.capacity, + list.count, + list.events ) } -raylib.SetExitKey = SetExitKey +raylib.UnloadAutomationEventList = UnloadAutomationEventList /** - * Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty + * Export automation events list as text file * - * @return {number} The resulting int. + * @param {AutomationEventList} list + * @param {string} fileName + * + * @return {boolean} The resulting bool. */ -function GetKeyPressed () { - return r.BindGetKeyPressed() +function ExportAutomationEventList(list, fileName) { + return r.BindExportAutomationEventList( + list.capacity, + list.count, + list.events, + fileName + ) } -raylib.GetKeyPressed = GetKeyPressed +raylib.ExportAutomationEventList = ExportAutomationEventList /** - * Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty + * Set automation event list to record to * - * @return {number} The resulting int. + * @param {number} list + * + * @return {undefined} */ -function GetCharPressed () { - return r.BindGetCharPressed() +function SetAutomationEventList(list) { + return r.BindSetAutomationEventList( + list + ) } -raylib.GetCharPressed = GetCharPressed +raylib.SetAutomationEventList = SetAutomationEventList /** - * Check if a gamepad is available + * Set automation event internal base frame to start recording * - * @param {number} gamepad + * @param {number} frame * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function IsGamepadAvailable (gamepad) { - return r.BindIsGamepadAvailable( - gamepad +function SetAutomationEventBaseFrame(frame) { + return r.BindSetAutomationEventBaseFrame( + frame ) } -raylib.IsGamepadAvailable = IsGamepadAvailable +raylib.SetAutomationEventBaseFrame = SetAutomationEventBaseFrame /** - * Get gamepad internal name id + * Start recording automation events (AutomationEventList must be set) * - * @param {number} gamepad + * @return {undefined} + */ +function StartAutomationEventRecording() { + return r.BindStartAutomationEventRecording() +} +raylib.StartAutomationEventRecording = StartAutomationEventRecording + +/** + * Stop recording automation events * - * @return {string} The resulting const char *. + * @return {undefined} */ -function GetGamepadName (gamepad) { - return r.BindGetGamepadName( - gamepad - ) +function StopAutomationEventRecording() { + return r.BindStopAutomationEventRecording() } -raylib.GetGamepadName = GetGamepadName +raylib.StopAutomationEventRecording = StopAutomationEventRecording /** - * Check if a gamepad button has been pressed once + * Play a recorded automation event * - * @param {number} gamepad - * @param {number} button + * @param {AutomationEvent} event * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function IsGamepadButtonPressed (gamepad, button) { - return r.BindIsGamepadButtonPressed( - gamepad, - button +function PlayAutomationEvent(event) { + return r.BindPlayAutomationEvent( + event.frame, + event.type, + event.params ) } -raylib.IsGamepadButtonPressed = IsGamepadButtonPressed +raylib.PlayAutomationEvent = PlayAutomationEvent /** - * Check if a gamepad button is being pressed + * Check if a key has been pressed once * - * @param {number} gamepad - * @param {number} button + * @param {number} key * * @return {boolean} The resulting bool. */ -function IsGamepadButtonDown (gamepad, button) { - return r.BindIsGamepadButtonDown( - gamepad, - button +function IsKeyPressed(key) { + return r.BindIsKeyPressed( + key ) } -raylib.IsGamepadButtonDown = IsGamepadButtonDown +raylib.IsKeyPressed = IsKeyPressed /** - * Check if a gamepad button has been released once + * Check if a key has been pressed again * - * @param {number} gamepad - * @param {number} button + * @param {number} key * * @return {boolean} The resulting bool. */ -function IsGamepadButtonReleased (gamepad, button) { - return r.BindIsGamepadButtonReleased( - gamepad, - button +function IsKeyPressedRepeat(key) { + return r.BindIsKeyPressedRepeat( + key ) } -raylib.IsGamepadButtonReleased = IsGamepadButtonReleased +raylib.IsKeyPressedRepeat = IsKeyPressedRepeat /** - * Check if a gamepad button is NOT being pressed + * Check if a key is being pressed * - * @param {number} gamepad - * @param {number} button + * @param {number} key * * @return {boolean} The resulting bool. */ -function IsGamepadButtonUp (gamepad, button) { - return r.BindIsGamepadButtonUp( - gamepad, - button +function IsKeyDown(key) { + return r.BindIsKeyDown( + key ) } -raylib.IsGamepadButtonUp = IsGamepadButtonUp +raylib.IsKeyDown = IsKeyDown /** - * Get the last gamepad button pressed + * Check if a key has been released once + * + * @param {number} key + * + * @return {boolean} The resulting bool. + */ +function IsKeyReleased(key) { + return r.BindIsKeyReleased( + key + ) +} +raylib.IsKeyReleased = IsKeyReleased + +/** + * Check if a key is NOT being pressed + * + * @param {number} key + * + * @return {boolean} The resulting bool. + */ +function IsKeyUp(key) { + return r.BindIsKeyUp( + key + ) +} +raylib.IsKeyUp = IsKeyUp + +/** + * Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty + * + * @return {number} The resulting int. + */ +function GetKeyPressed() { + return r.BindGetKeyPressed() +} +raylib.GetKeyPressed = GetKeyPressed + +/** + * Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty + * + * @return {number} The resulting int. + */ +function GetCharPressed() { + return r.BindGetCharPressed() +} +raylib.GetCharPressed = GetCharPressed + +/** + * Set a custom key to exit program (default is ESC) + * + * @param {number} key + * + * @return {undefined} + */ +function SetExitKey(key) { + return r.BindSetExitKey( + key + ) +} +raylib.SetExitKey = SetExitKey + +/** + * Check if a gamepad is available + * + * @param {number} gamepad + * + * @return {boolean} The resulting bool. + */ +function IsGamepadAvailable(gamepad) { + return r.BindIsGamepadAvailable( + gamepad + ) +} +raylib.IsGamepadAvailable = IsGamepadAvailable + +/** + * Get gamepad internal name id + * + * @param {number} gamepad + * + * @return {string} The resulting const char *. + */ +function GetGamepadName(gamepad) { + return r.BindGetGamepadName( + gamepad + ) +} +raylib.GetGamepadName = GetGamepadName + +/** + * Check if a gamepad button has been pressed once + * + * @param {number} gamepad + * @param {number} button + * + * @return {boolean} The resulting bool. + */ +function IsGamepadButtonPressed(gamepad, button) { + return r.BindIsGamepadButtonPressed( + gamepad, + button + ) +} +raylib.IsGamepadButtonPressed = IsGamepadButtonPressed + +/** + * Check if a gamepad button is being pressed + * + * @param {number} gamepad + * @param {number} button + * + * @return {boolean} The resulting bool. + */ +function IsGamepadButtonDown(gamepad, button) { + return r.BindIsGamepadButtonDown( + gamepad, + button + ) +} +raylib.IsGamepadButtonDown = IsGamepadButtonDown + +/** + * Check if a gamepad button has been released once + * + * @param {number} gamepad + * @param {number} button + * + * @return {boolean} The resulting bool. + */ +function IsGamepadButtonReleased(gamepad, button) { + return r.BindIsGamepadButtonReleased( + gamepad, + button + ) +} +raylib.IsGamepadButtonReleased = IsGamepadButtonReleased + +/** + * Check if a gamepad button is NOT being pressed + * + * @param {number} gamepad + * @param {number} button + * + * @return {boolean} The resulting bool. + */ +function IsGamepadButtonUp(gamepad, button) { + return r.BindIsGamepadButtonUp( + gamepad, + button + ) +} +raylib.IsGamepadButtonUp = IsGamepadButtonUp + +/** + * Get the last gamepad button pressed * * @return {number} The resulting int. */ -function GetGamepadButtonPressed () { +function GetGamepadButtonPressed() { return r.BindGetGamepadButtonPressed() } raylib.GetGamepadButtonPressed = GetGamepadButtonPressed @@ -2028,7 +2339,7 @@ raylib.GetGamepadButtonPressed = GetGamepadButtonPressed * * @return {number} The resulting int. */ -function GetGamepadAxisCount (gamepad) { +function GetGamepadAxisCount(gamepad) { return r.BindGetGamepadAxisCount( gamepad ) @@ -2043,7 +2354,7 @@ raylib.GetGamepadAxisCount = GetGamepadAxisCount * * @return {number} The resulting float. */ -function GetGamepadAxisMovement (gamepad, axis) { +function GetGamepadAxisMovement(gamepad, axis) { return r.BindGetGamepadAxisMovement( gamepad, axis @@ -2058,13 +2369,33 @@ raylib.GetGamepadAxisMovement = GetGamepadAxisMovement * * @return {number} The resulting int. */ -function SetGamepadMappings (mappings) { +function SetGamepadMappings(mappings) { return r.BindSetGamepadMappings( mappings ) } raylib.SetGamepadMappings = SetGamepadMappings +/** + * Set gamepad vibration for both motors (duration in seconds) + * + * @param {number} gamepad + * @param {number} leftMotor + * @param {number} rightMotor + * @param {number} duration + * + * @return {undefined} + */ +function SetGamepadVibration(gamepad, leftMotor, rightMotor, duration) { + return r.BindSetGamepadVibration( + gamepad, + leftMotor, + rightMotor, + duration + ) +} +raylib.SetGamepadVibration = SetGamepadVibration + /** * Check if a mouse button has been pressed once * @@ -2072,7 +2403,7 @@ raylib.SetGamepadMappings = SetGamepadMappings * * @return {boolean} The resulting bool. */ -function IsMouseButtonPressed (button) { +function IsMouseButtonPressed(button) { return r.BindIsMouseButtonPressed( button ) @@ -2086,7 +2417,7 @@ raylib.IsMouseButtonPressed = IsMouseButtonPressed * * @return {boolean} The resulting bool. */ -function IsMouseButtonDown (button) { +function IsMouseButtonDown(button) { return r.BindIsMouseButtonDown( button ) @@ -2100,7 +2431,7 @@ raylib.IsMouseButtonDown = IsMouseButtonDown * * @return {boolean} The resulting bool. */ -function IsMouseButtonReleased (button) { +function IsMouseButtonReleased(button) { return r.BindIsMouseButtonReleased( button ) @@ -2114,7 +2445,7 @@ raylib.IsMouseButtonReleased = IsMouseButtonReleased * * @return {boolean} The resulting bool. */ -function IsMouseButtonUp (button) { +function IsMouseButtonUp(button) { return r.BindIsMouseButtonUp( button ) @@ -2126,7 +2457,7 @@ raylib.IsMouseButtonUp = IsMouseButtonUp * * @return {number} The resulting int. */ -function GetMouseX () { +function GetMouseX() { return r.BindGetMouseX() } raylib.GetMouseX = GetMouseX @@ -2136,7 +2467,7 @@ raylib.GetMouseX = GetMouseX * * @return {number} The resulting int. */ -function GetMouseY () { +function GetMouseY() { return r.BindGetMouseY() } raylib.GetMouseY = GetMouseY @@ -2146,7 +2477,7 @@ raylib.GetMouseY = GetMouseY * * @return {Vector2} The resulting Vector2. */ -function GetMousePosition () { +function GetMousePosition() { return r.BindGetMousePosition() } raylib.GetMousePosition = GetMousePosition @@ -2156,7 +2487,7 @@ raylib.GetMousePosition = GetMousePosition * * @return {Vector2} The resulting Vector2. */ -function GetMouseDelta () { +function GetMouseDelta() { return r.BindGetMouseDelta() } raylib.GetMouseDelta = GetMouseDelta @@ -2169,7 +2500,7 @@ raylib.GetMouseDelta = GetMouseDelta * * @return {undefined} */ -function SetMousePosition (x, y) { +function SetMousePosition(x, y) { return r.BindSetMousePosition( x, y @@ -2185,7 +2516,7 @@ raylib.SetMousePosition = SetMousePosition * * @return {undefined} */ -function SetMouseOffset (offsetX, offsetY) { +function SetMouseOffset(offsetX, offsetY) { return r.BindSetMouseOffset( offsetX, offsetY @@ -2201,7 +2532,7 @@ raylib.SetMouseOffset = SetMouseOffset * * @return {undefined} */ -function SetMouseScale (scaleX, scaleY) { +function SetMouseScale(scaleX, scaleY) { return r.BindSetMouseScale( scaleX, scaleY @@ -2214,7 +2545,7 @@ raylib.SetMouseScale = SetMouseScale * * @return {number} The resulting float. */ -function GetMouseWheelMove () { +function GetMouseWheelMove() { return r.BindGetMouseWheelMove() } raylib.GetMouseWheelMove = GetMouseWheelMove @@ -2224,7 +2555,7 @@ raylib.GetMouseWheelMove = GetMouseWheelMove * * @return {Vector2} The resulting Vector2. */ -function GetMouseWheelMoveV () { +function GetMouseWheelMoveV() { return r.BindGetMouseWheelMoveV() } raylib.GetMouseWheelMoveV = GetMouseWheelMoveV @@ -2236,7 +2567,7 @@ raylib.GetMouseWheelMoveV = GetMouseWheelMoveV * * @return {undefined} */ -function SetMouseCursor (cursor) { +function SetMouseCursor(cursor) { return r.BindSetMouseCursor( cursor ) @@ -2248,7 +2579,7 @@ raylib.SetMouseCursor = SetMouseCursor * * @return {number} The resulting int. */ -function GetTouchX () { +function GetTouchX() { return r.BindGetTouchX() } raylib.GetTouchX = GetTouchX @@ -2258,7 +2589,7 @@ raylib.GetTouchX = GetTouchX * * @return {number} The resulting int. */ -function GetTouchY () { +function GetTouchY() { return r.BindGetTouchY() } raylib.GetTouchY = GetTouchY @@ -2270,7 +2601,7 @@ raylib.GetTouchY = GetTouchY * * @return {Vector2} The resulting Vector2. */ -function GetTouchPosition (index) { +function GetTouchPosition(index) { return r.BindGetTouchPosition( index ) @@ -2284,7 +2615,7 @@ raylib.GetTouchPosition = GetTouchPosition * * @return {number} The resulting int. */ -function GetTouchPointId (index) { +function GetTouchPointId(index) { return r.BindGetTouchPointId( index ) @@ -2296,7 +2627,7 @@ raylib.GetTouchPointId = GetTouchPointId * * @return {number} The resulting int. */ -function GetTouchPointCount () { +function GetTouchPointCount() { return r.BindGetTouchPointCount() } raylib.GetTouchPointCount = GetTouchPointCount @@ -2308,7 +2639,7 @@ raylib.GetTouchPointCount = GetTouchPointCount * * @return {undefined} */ -function SetGesturesEnabled (flags) { +function SetGesturesEnabled(flags) { return r.BindSetGesturesEnabled( flags ) @@ -2322,7 +2653,7 @@ raylib.SetGesturesEnabled = SetGesturesEnabled * * @return {boolean} The resulting bool. */ -function IsGestureDetected (gesture) { +function IsGestureDetected(gesture) { return r.BindIsGestureDetected( gesture ) @@ -2334,17 +2665,17 @@ raylib.IsGestureDetected = IsGestureDetected * * @return {number} The resulting int. */ -function GetGestureDetected () { +function GetGestureDetected() { return r.BindGetGestureDetected() } raylib.GetGestureDetected = GetGestureDetected /** - * Get gesture hold time in milliseconds + * Get gesture hold time in seconds * * @return {number} The resulting float. */ -function GetGestureHoldDuration () { +function GetGestureHoldDuration() { return r.BindGetGestureHoldDuration() } raylib.GetGestureHoldDuration = GetGestureHoldDuration @@ -2354,7 +2685,7 @@ raylib.GetGestureHoldDuration = GetGestureHoldDuration * * @return {Vector2} The resulting Vector2. */ -function GetGestureDragVector () { +function GetGestureDragVector() { return r.BindGetGestureDragVector() } raylib.GetGestureDragVector = GetGestureDragVector @@ -2364,7 +2695,7 @@ raylib.GetGestureDragVector = GetGestureDragVector * * @return {number} The resulting float. */ -function GetGestureDragAngle () { +function GetGestureDragAngle() { return r.BindGetGestureDragAngle() } raylib.GetGestureDragAngle = GetGestureDragAngle @@ -2374,7 +2705,7 @@ raylib.GetGestureDragAngle = GetGestureDragAngle * * @return {Vector2} The resulting Vector2. */ -function GetGesturePinchVector () { +function GetGesturePinchVector() { return r.BindGetGesturePinchVector() } raylib.GetGesturePinchVector = GetGesturePinchVector @@ -2384,7 +2715,7 @@ raylib.GetGesturePinchVector = GetGesturePinchVector * * @return {number} The resulting float. */ -function GetGesturePinchAngle () { +function GetGesturePinchAngle() { return r.BindGetGesturePinchAngle() } raylib.GetGesturePinchAngle = GetGesturePinchAngle @@ -2399,7 +2730,7 @@ raylib.GetGesturePinchAngle = GetGesturePinchAngle * * @return {undefined} */ -function UpdateCameraPro (camera, movement, rotation, zoom) { +function UpdateCameraPro(camera, movement, rotation, zoom) { return r.BindUpdateCameraPro( camera, movement.x, @@ -2421,7 +2752,7 @@ raylib.UpdateCameraPro = UpdateCameraPro * * @return {undefined} */ -function SetShapesTexture (texture, source) { +function SetShapesTexture(texture, source) { return r.BindSetShapesTexture( texture.id, texture.width, @@ -2437,7 +2768,27 @@ function SetShapesTexture (texture, source) { raylib.SetShapesTexture = SetShapesTexture /** - * Draw a pixel + * Get texture that is used for shapes drawing + * + * @return {Texture2D} The resulting Texture2D. + */ +function GetShapesTexture() { + return r.BindGetShapesTexture() +} +raylib.GetShapesTexture = GetShapesTexture + +/** + * Get texture source rectangle that is used for shapes drawing + * + * @return {Rectangle} The resulting Rectangle. + */ +function GetShapesTextureRectangle() { + return r.BindGetShapesTextureRectangle() +} +raylib.GetShapesTextureRectangle = GetShapesTextureRectangle + +/** + * Draw a pixel using geometry [Can be slow, use with care] * * @param {number} posX * @param {number} posY @@ -2445,7 +2796,7 @@ raylib.SetShapesTexture = SetShapesTexture * * @return {undefined} */ -function DrawPixel (posX, posY, color) { +function DrawPixel(posX, posY, color) { return r.BindDrawPixel( posX, posY, @@ -2458,14 +2809,14 @@ function DrawPixel (posX, posY, color) { raylib.DrawPixel = DrawPixel /** - * Draw a pixel (Vector version) + * Draw a pixel using geometry (Vector version) [Can be slow, use with care] * * @param {Vector2} position * @param {Color} color * * @return {undefined} */ -function DrawPixelV (position, color) { +function DrawPixelV(position, color) { return r.BindDrawPixelV( position.x, position.y, @@ -2488,7 +2839,7 @@ raylib.DrawPixelV = DrawPixelV * * @return {undefined} */ -function DrawLine (startPosX, startPosY, endPosX, endPosY, color) { +function DrawLine(startPosX, startPosY, endPosX, endPosY, color) { return r.BindDrawLine( startPosX, startPosY, @@ -2503,7 +2854,7 @@ function DrawLine (startPosX, startPosY, endPosX, endPosY, color) { raylib.DrawLine = DrawLine /** - * Draw a line (Vector version) + * Draw a line (using gl lines) * * @param {Vector2} startPos * @param {Vector2} endPos @@ -2511,7 +2862,7 @@ raylib.DrawLine = DrawLine * * @return {undefined} */ -function DrawLineV (startPos, endPos, color) { +function DrawLineV(startPos, endPos, color) { return r.BindDrawLineV( startPos.x, startPos.y, @@ -2526,7 +2877,7 @@ function DrawLineV (startPos, endPos, color) { raylib.DrawLineV = DrawLineV /** - * Draw a line defining thickness + * Draw a line (using triangles/quads) * * @param {Vector2} startPos * @param {Vector2} endPos @@ -2535,7 +2886,7 @@ raylib.DrawLineV = DrawLineV * * @return {undefined} */ -function DrawLineEx (startPos, endPos, thick, color) { +function DrawLineEx(startPos, endPos, thick, color) { return r.BindDrawLineEx( startPos.x, startPos.y, @@ -2551,80 +2902,42 @@ function DrawLineEx (startPos, endPos, thick, color) { raylib.DrawLineEx = DrawLineEx /** - * Draw a line using cubic-bezier curves in-out - * - * @param {Vector2} startPos - * @param {Vector2} endPos - * @param {number} thick - * @param {Color} color - * - * @return {undefined} - */ -function DrawLineBezier (startPos, endPos, thick, color) { - return r.BindDrawLineBezier( - startPos.x, - startPos.y, - endPos.x, - endPos.y, - thick, - color.r, - color.g, - color.b, - color.a - ) -} -raylib.DrawLineBezier = DrawLineBezier - -/** - * Draw line using quadratic bezier curves with a control point + * Draw lines sequence (using gl lines) * - * @param {Vector2} startPos - * @param {Vector2} endPos - * @param {Vector2} controlPos - * @param {number} thick + * @param {number} points + * @param {number} pointCount * @param {Color} color * * @return {undefined} */ -function DrawLineBezierQuad (startPos, endPos, controlPos, thick, color) { - return r.BindDrawLineBezierQuad( - startPos.x, - startPos.y, - endPos.x, - endPos.y, - controlPos.x, - controlPos.y, - thick, +function DrawLineStrip(points, pointCount, color) { + return r.BindDrawLineStrip( + points, + pointCount, color.r, color.g, color.b, color.a ) } -raylib.DrawLineBezierQuad = DrawLineBezierQuad +raylib.DrawLineStrip = DrawLineStrip /** - * Draw line using cubic bezier curves with 2 control points + * Draw line segment cubic-bezier in-out interpolation * * @param {Vector2} startPos * @param {Vector2} endPos - * @param {Vector2} startControlPos - * @param {Vector2} endControlPos * @param {number} thick * @param {Color} color * * @return {undefined} */ -function DrawLineBezierCubic (startPos, endPos, startControlPos, endControlPos, thick, color) { - return r.BindDrawLineBezierCubic( +function DrawLineBezier(startPos, endPos, thick, color) { + return r.BindDrawLineBezier( startPos.x, startPos.y, endPos.x, endPos.y, - startControlPos.x, - startControlPos.y, - endControlPos.x, - endControlPos.y, thick, color.r, color.g, @@ -2632,28 +2945,7 @@ function DrawLineBezierCubic (startPos, endPos, startControlPos, endControlPos, color.a ) } -raylib.DrawLineBezierCubic = DrawLineBezierCubic - -/** - * Draw lines sequence - * - * @param {number} points - * @param {number} pointCount - * @param {Color} color - * - * @return {undefined} - */ -function DrawLineStrip (points, pointCount, color) { - return r.BindDrawLineStrip( - points, - pointCount, - color.r, - color.g, - color.b, - color.a - ) -} -raylib.DrawLineStrip = DrawLineStrip +raylib.DrawLineBezier = DrawLineBezier /** * Draw a color-filled circle @@ -2665,7 +2957,7 @@ raylib.DrawLineStrip = DrawLineStrip * * @return {undefined} */ -function DrawCircle (centerX, centerY, radius, color) { +function DrawCircle(centerX, centerY, radius, color) { return r.BindDrawCircle( centerX, centerY, @@ -2690,7 +2982,7 @@ raylib.DrawCircle = DrawCircle * * @return {undefined} */ -function DrawCircleSector (center, radius, startAngle, endAngle, segments, color) { +function DrawCircleSector(center, radius, startAngle, endAngle, segments, color) { return r.BindDrawCircleSector( center.x, center.y, @@ -2718,7 +3010,7 @@ raylib.DrawCircleSector = DrawCircleSector * * @return {undefined} */ -function DrawCircleSectorLines (center, radius, startAngle, endAngle, segments, color) { +function DrawCircleSectorLines(center, radius, startAngle, endAngle, segments, color) { return r.BindDrawCircleSectorLines( center.x, center.y, @@ -2740,24 +3032,24 @@ raylib.DrawCircleSectorLines = DrawCircleSectorLines * @param {number} centerX * @param {number} centerY * @param {number} radius - * @param {Color} color1 - * @param {Color} color2 + * @param {Color} inner + * @param {Color} outer * * @return {undefined} */ -function DrawCircleGradient (centerX, centerY, radius, color1, color2) { +function DrawCircleGradient(centerX, centerY, radius, inner, outer) { return r.BindDrawCircleGradient( centerX, centerY, radius, - color1.r, - color1.g, - color1.b, - color1.a, - color2.r, - color2.g, - color2.b, - color2.a + inner.r, + inner.g, + inner.b, + inner.a, + outer.r, + outer.g, + outer.b, + outer.a ) } raylib.DrawCircleGradient = DrawCircleGradient @@ -2771,7 +3063,7 @@ raylib.DrawCircleGradient = DrawCircleGradient * * @return {undefined} */ -function DrawCircleV (center, radius, color) { +function DrawCircleV(center, radius, color) { return r.BindDrawCircleV( center.x, center.y, @@ -2794,7 +3086,7 @@ raylib.DrawCircleV = DrawCircleV * * @return {undefined} */ -function DrawCircleLines (centerX, centerY, radius, color) { +function DrawCircleLines(centerX, centerY, radius, color) { return r.BindDrawCircleLines( centerX, centerY, @@ -2808,24 +3100,46 @@ function DrawCircleLines (centerX, centerY, radius, color) { raylib.DrawCircleLines = DrawCircleLines /** - * Draw ellipse + * Draw circle outline (Vector version) * - * @param {number} centerX - * @param {number} centerY - * @param {number} radiusH - * @param {number} radiusV + * @param {Vector2} center + * @param {number} radius * @param {Color} color * * @return {undefined} */ -function DrawEllipse (centerX, centerY, radiusH, radiusV, color) { - return r.BindDrawEllipse( - centerX, - centerY, - radiusH, - radiusV, - color.r, - color.g, +function DrawCircleLinesV(center, radius, color) { + return r.BindDrawCircleLinesV( + center.x, + center.y, + radius, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCircleLinesV = DrawCircleLinesV + +/** + * Draw ellipse + * + * @param {number} centerX + * @param {number} centerY + * @param {number} radiusH + * @param {number} radiusV + * @param {Color} color + * + * @return {undefined} + */ +function DrawEllipse(centerX, centerY, radiusH, radiusV, color) { + return r.BindDrawEllipse( + centerX, + centerY, + radiusH, + radiusV, + color.r, + color.g, color.b, color.a ) @@ -2843,7 +3157,7 @@ raylib.DrawEllipse = DrawEllipse * * @return {undefined} */ -function DrawEllipseLines (centerX, centerY, radiusH, radiusV, color) { +function DrawEllipseLines(centerX, centerY, radiusH, radiusV, color) { return r.BindDrawEllipseLines( centerX, centerY, @@ -2870,7 +3184,7 @@ raylib.DrawEllipseLines = DrawEllipseLines * * @return {undefined} */ -function DrawRing (center, innerRadius, outerRadius, startAngle, endAngle, segments, color) { +function DrawRing(center, innerRadius, outerRadius, startAngle, endAngle, segments, color) { return r.BindDrawRing( center.x, center.y, @@ -2900,7 +3214,7 @@ raylib.DrawRing = DrawRing * * @return {undefined} */ -function DrawRingLines (center, innerRadius, outerRadius, startAngle, endAngle, segments, color) { +function DrawRingLines(center, innerRadius, outerRadius, startAngle, endAngle, segments, color) { return r.BindDrawRingLines( center.x, center.y, @@ -2928,7 +3242,7 @@ raylib.DrawRingLines = DrawRingLines * * @return {undefined} */ -function DrawRectangle (posX, posY, width, height, color) { +function DrawRectangle(posX, posY, width, height, color) { return r.BindDrawRectangle( posX, posY, @@ -2951,7 +3265,7 @@ raylib.DrawRectangle = DrawRectangle * * @return {undefined} */ -function DrawRectangleV (position, size, color) { +function DrawRectangleV(position, size, color) { return r.BindDrawRectangleV( position.x, position.y, @@ -2973,7 +3287,7 @@ raylib.DrawRectangleV = DrawRectangleV * * @return {undefined} */ -function DrawRectangleRec (rec, color) { +function DrawRectangleRec(rec, color) { return r.BindDrawRectangleRec( rec.x, rec.y, @@ -2997,7 +3311,7 @@ raylib.DrawRectangleRec = DrawRectangleRec * * @return {undefined} */ -function DrawRectanglePro (rec, origin, rotation, color) { +function DrawRectanglePro(rec, origin, rotation, color) { return r.BindDrawRectanglePro( rec.x, rec.y, @@ -3021,25 +3335,25 @@ raylib.DrawRectanglePro = DrawRectanglePro * @param {number} posY * @param {number} width * @param {number} height - * @param {Color} color1 - * @param {Color} color2 + * @param {Color} top + * @param {Color} bottom * * @return {undefined} */ -function DrawRectangleGradientV (posX, posY, width, height, color1, color2) { +function DrawRectangleGradientV(posX, posY, width, height, top, bottom) { return r.BindDrawRectangleGradientV( posX, posY, width, height, - color1.r, - color1.g, - color1.b, - color1.a, - color2.r, - color2.g, - color2.b, - color2.a + top.r, + top.g, + top.b, + top.a, + bottom.r, + bottom.g, + bottom.b, + bottom.a ) } raylib.DrawRectangleGradientV = DrawRectangleGradientV @@ -3051,25 +3365,25 @@ raylib.DrawRectangleGradientV = DrawRectangleGradientV * @param {number} posY * @param {number} width * @param {number} height - * @param {Color} color1 - * @param {Color} color2 + * @param {Color} left + * @param {Color} right * * @return {undefined} */ -function DrawRectangleGradientH (posX, posY, width, height, color1, color2) { +function DrawRectangleGradientH(posX, posY, width, height, left, right) { return r.BindDrawRectangleGradientH( posX, posY, width, height, - color1.r, - color1.g, - color1.b, - color1.a, - color2.r, - color2.g, - color2.b, - color2.a + left.r, + left.g, + left.b, + left.a, + right.r, + right.g, + right.b, + right.a ) } raylib.DrawRectangleGradientH = DrawRectangleGradientH @@ -3078,35 +3392,35 @@ raylib.DrawRectangleGradientH = DrawRectangleGradientH * Draw a gradient-filled rectangle with custom vertex colors * * @param {Rectangle} rec - * @param {Color} col1 - * @param {Color} col2 - * @param {Color} col3 - * @param {Color} col4 + * @param {Color} topLeft + * @param {Color} bottomLeft + * @param {Color} topRight + * @param {Color} bottomRight * * @return {undefined} */ -function DrawRectangleGradientEx (rec, col1, col2, col3, col4) { +function DrawRectangleGradientEx(rec, topLeft, bottomLeft, topRight, bottomRight) { return r.BindDrawRectangleGradientEx( rec.x, rec.y, rec.width, rec.height, - col1.r, - col1.g, - col1.b, - col1.a, - col2.r, - col2.g, - col2.b, - col2.a, - col3.r, - col3.g, - col3.b, - col3.a, - col4.r, - col4.g, - col4.b, - col4.a + topLeft.r, + topLeft.g, + topLeft.b, + topLeft.a, + bottomLeft.r, + bottomLeft.g, + bottomLeft.b, + bottomLeft.a, + topRight.r, + topRight.g, + topRight.b, + topRight.a, + bottomRight.r, + bottomRight.g, + bottomRight.b, + bottomRight.a ) } raylib.DrawRectangleGradientEx = DrawRectangleGradientEx @@ -3122,7 +3436,7 @@ raylib.DrawRectangleGradientEx = DrawRectangleGradientEx * * @return {undefined} */ -function DrawRectangleLines (posX, posY, width, height, color) { +function DrawRectangleLines(posX, posY, width, height, color) { return r.BindDrawRectangleLines( posX, posY, @@ -3145,7 +3459,7 @@ raylib.DrawRectangleLines = DrawRectangleLines * * @return {undefined} */ -function DrawRectangleLinesEx (rec, lineThick, color) { +function DrawRectangleLinesEx(rec, lineThick, color) { return r.BindDrawRectangleLinesEx( rec.x, rec.y, @@ -3170,7 +3484,7 @@ raylib.DrawRectangleLinesEx = DrawRectangleLinesEx * * @return {undefined} */ -function DrawRectangleRounded (rec, roundness, segments, color) { +function DrawRectangleRounded(rec, roundness, segments, color) { return r.BindDrawRectangleRounded( rec.x, rec.y, @@ -3186,6 +3500,32 @@ function DrawRectangleRounded (rec, roundness, segments, color) { } raylib.DrawRectangleRounded = DrawRectangleRounded +/** + * Draw rectangle lines with rounded edges + * + * @param {Rectangle} rec + * @param {number} roundness + * @param {number} segments + * @param {Color} color + * + * @return {undefined} + */ +function DrawRectangleRoundedLines(rec, roundness, segments, color) { + return r.BindDrawRectangleRoundedLines( + rec.x, + rec.y, + rec.width, + rec.height, + roundness, + segments, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawRectangleRoundedLines = DrawRectangleRoundedLines + /** * Draw rectangle with rounded edges outline * @@ -3197,8 +3537,8 @@ raylib.DrawRectangleRounded = DrawRectangleRounded * * @return {undefined} */ -function DrawRectangleRoundedLines (rec, roundness, segments, lineThick, color) { - return r.BindDrawRectangleRoundedLines( +function DrawRectangleRoundedLinesEx(rec, roundness, segments, lineThick, color) { + return r.BindDrawRectangleRoundedLinesEx( rec.x, rec.y, rec.width, @@ -3212,7 +3552,7 @@ function DrawRectangleRoundedLines (rec, roundness, segments, lineThick, color) color.a ) } -raylib.DrawRectangleRoundedLines = DrawRectangleRoundedLines +raylib.DrawRectangleRoundedLinesEx = DrawRectangleRoundedLinesEx /** * Draw a color-filled triangle (vertex in counter-clockwise order!) @@ -3224,7 +3564,7 @@ raylib.DrawRectangleRoundedLines = DrawRectangleRoundedLines * * @return {undefined} */ -function DrawTriangle (v1, v2, v3, color) { +function DrawTriangle(v1, v2, v3, color) { return r.BindDrawTriangle( v1.x, v1.y, @@ -3250,7 +3590,7 @@ raylib.DrawTriangle = DrawTriangle * * @return {undefined} */ -function DrawTriangleLines (v1, v2, v3, color) { +function DrawTriangleLines(v1, v2, v3, color) { return r.BindDrawTriangleLines( v1.x, v1.y, @@ -3275,7 +3615,7 @@ raylib.DrawTriangleLines = DrawTriangleLines * * @return {undefined} */ -function DrawTriangleFan (points, pointCount, color) { +function DrawTriangleFan(points, pointCount, color) { return r.BindDrawTriangleFan( points, pointCount, @@ -3296,7 +3636,7 @@ raylib.DrawTriangleFan = DrawTriangleFan * * @return {undefined} */ -function DrawTriangleStrip (points, pointCount, color) { +function DrawTriangleStrip(points, pointCount, color) { return r.BindDrawTriangleStrip( points, pointCount, @@ -3319,7 +3659,7 @@ raylib.DrawTriangleStrip = DrawTriangleStrip * * @return {undefined} */ -function DrawPoly (center, sides, radius, rotation, color) { +function DrawPoly(center, sides, radius, rotation, color) { return r.BindDrawPoly( center.x, center.y, @@ -3345,7 +3685,7 @@ raylib.DrawPoly = DrawPoly * * @return {undefined} */ -function DrawPolyLines (center, sides, radius, rotation, color) { +function DrawPolyLines(center, sides, radius, rotation, color) { return r.BindDrawPolyLines( center.x, center.y, @@ -3372,7 +3712,7 @@ raylib.DrawPolyLines = DrawPolyLines * * @return {undefined} */ -function DrawPolyLinesEx (center, sides, radius, rotation, lineThick, color) { +function DrawPolyLinesEx(center, sides, radius, rotation, lineThick, color) { return r.BindDrawPolyLinesEx( center.x, center.y, @@ -3389,727 +3729,757 @@ function DrawPolyLinesEx (center, sides, radius, rotation, lineThick, color) { raylib.DrawPolyLinesEx = DrawPolyLinesEx /** - * Check collision between two rectangles + * Draw spline: Linear, minimum 2 points * - * @param {Rectangle} rec1 - * @param {Rectangle} rec2 + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionRecs (rec1, rec2) { - return r.BindCheckCollisionRecs( - rec1.x, - rec1.y, - rec1.width, - rec1.height, - rec2.x, - rec2.y, - rec2.width, - rec2.height +function DrawSplineLinear(points, pointCount, thick, color) { + return r.BindDrawSplineLinear( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionRecs = CheckCollisionRecs +raylib.DrawSplineLinear = DrawSplineLinear /** - * Check collision between two circles + * Draw spline: B-Spline, minimum 4 points * - * @param {Vector2} center1 - * @param {number} radius1 - * @param {Vector2} center2 - * @param {number} radius2 + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionCircles (center1, radius1, center2, radius2) { - return r.BindCheckCollisionCircles( - center1.x, - center1.y, - radius1, - center2.x, - center2.y, - radius2 +function DrawSplineBasis(points, pointCount, thick, color) { + return r.BindDrawSplineBasis( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionCircles = CheckCollisionCircles +raylib.DrawSplineBasis = DrawSplineBasis /** - * Check collision between circle and rectangle + * Draw spline: Catmull-Rom, minimum 4 points * - * @param {Vector2} center - * @param {number} radius - * @param {Rectangle} rec + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionCircleRec (center, radius, rec) { - return r.BindCheckCollisionCircleRec( - center.x, - center.y, - radius, - rec.x, - rec.y, - rec.width, - rec.height +function DrawSplineCatmullRom(points, pointCount, thick, color) { + return r.BindDrawSplineCatmullRom( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionCircleRec = CheckCollisionCircleRec +raylib.DrawSplineCatmullRom = DrawSplineCatmullRom /** - * Check if point is inside rectangle + * Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] * - * @param {Vector2} point - * @param {Rectangle} rec + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointRec (point, rec) { - return r.BindCheckCollisionPointRec( - point.x, - point.y, - rec.x, - rec.y, - rec.width, - rec.height +function DrawSplineBezierQuadratic(points, pointCount, thick, color) { + return r.BindDrawSplineBezierQuadratic( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionPointRec = CheckCollisionPointRec +raylib.DrawSplineBezierQuadratic = DrawSplineBezierQuadratic /** - * Check if point is inside circle + * Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] * - * @param {Vector2} point - * @param {Vector2} center - * @param {number} radius + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointCircle (point, center, radius) { - return r.BindCheckCollisionPointCircle( - point.x, - point.y, - center.x, - center.y, - radius +function DrawSplineBezierCubic(points, pointCount, thick, color) { + return r.BindDrawSplineBezierCubic( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionPointCircle = CheckCollisionPointCircle +raylib.DrawSplineBezierCubic = DrawSplineBezierCubic /** - * Check if point is inside a triangle + * Draw spline segment: Linear, 2 points * - * @param {Vector2} point * @param {Vector2} p1 * @param {Vector2} p2 - * @param {Vector2} p3 + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointTriangle (point, p1, p2, p3) { - return r.BindCheckCollisionPointTriangle( - point.x, - point.y, +function DrawSplineSegmentLinear(p1, p2, thick, color) { + return r.BindDrawSplineSegmentLinear( p1.x, p1.y, p2.x, p2.y, - p3.x, - p3.y + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionPointTriangle = CheckCollisionPointTriangle +raylib.DrawSplineSegmentLinear = DrawSplineSegmentLinear /** - * Check if point is within a polygon described by array of vertices + * Draw spline segment: B-Spline, 4 points * - * @param {Vector2} point - * @param {number} points - * @param {number} pointCount + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {Vector2} p3 + * @param {Vector2} p4 + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointPoly (point, points, pointCount) { - return r.BindCheckCollisionPointPoly( - point.x, - point.y, - points, - pointCount - ) -} -raylib.CheckCollisionPointPoly = CheckCollisionPointPoly - -/** - * Check the collision between two lines defined by two points each, returns collision point by reference - * - * @param {Vector2} startPos1 - * @param {Vector2} endPos1 - * @param {Vector2} startPos2 - * @param {Vector2} endPos2 - * @param {number} collisionPoint - * - * @return {boolean} The resulting bool. - */ -function CheckCollisionLines (startPos1, endPos1, startPos2, endPos2, collisionPoint) { - return r.BindCheckCollisionLines( - startPos1.x, - startPos1.y, - endPos1.x, - endPos1.y, - startPos2.x, - startPos2.y, - endPos2.x, - endPos2.y, - collisionPoint +function DrawSplineSegmentBasis(p1, p2, p3, p4, thick, color) { + return r.BindDrawSplineSegmentBasis( + p1.x, + p1.y, + p2.x, + p2.y, + p3.x, + p3.y, + p4.x, + p4.y, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionLines = CheckCollisionLines +raylib.DrawSplineSegmentBasis = DrawSplineSegmentBasis /** - * Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] + * Draw spline segment: Catmull-Rom, 4 points * - * @param {Vector2} point * @param {Vector2} p1 * @param {Vector2} p2 - * @param {number} threshold + * @param {Vector2} p3 + * @param {Vector2} p4 + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointLine (point, p1, p2, threshold) { - return r.BindCheckCollisionPointLine( - point.x, - point.y, +function DrawSplineSegmentCatmullRom(p1, p2, p3, p4, thick, color) { + return r.BindDrawSplineSegmentCatmullRom( p1.x, p1.y, p2.x, p2.y, - threshold + p3.x, + p3.y, + p4.x, + p4.y, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionPointLine = CheckCollisionPointLine +raylib.DrawSplineSegmentCatmullRom = DrawSplineSegmentCatmullRom /** - * Get collision rectangle for two rectangles collision + * Draw spline segment: Quadratic Bezier, 2 points, 1 control point * - * @param {Rectangle} rec1 - * @param {Rectangle} rec2 + * @param {Vector2} p1 + * @param {Vector2} c2 + * @param {Vector2} p3 + * @param {number} thick + * @param {Color} color * - * @return {Rectangle} The resulting Rectangle. + * @return {undefined} */ -function GetCollisionRec (rec1, rec2) { - return r.BindGetCollisionRec( - rec1.x, - rec1.y, - rec1.width, - rec1.height, - rec2.x, - rec2.y, - rec2.width, - rec2.height +function DrawSplineSegmentBezierQuadratic(p1, c2, p3, thick, color) { + return r.BindDrawSplineSegmentBezierQuadratic( + p1.x, + p1.y, + c2.x, + c2.y, + p3.x, + p3.y, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.GetCollisionRec = GetCollisionRec +raylib.DrawSplineSegmentBezierQuadratic = DrawSplineSegmentBezierQuadratic /** - * Load image from file into CPU memory (RAM) + * Draw spline segment: Cubic Bezier, 2 points, 2 control points * - * @param {string} fileName + * @param {Vector2} p1 + * @param {Vector2} c2 + * @param {Vector2} c3 + * @param {Vector2} p4 + * @param {number} thick + * @param {Color} color * - * @return {Image} The resulting Image. + * @return {undefined} */ -function LoadImage (fileName) { - return r.BindLoadImage( - fileName +function DrawSplineSegmentBezierCubic(p1, c2, c3, p4, thick, color) { + return r.BindDrawSplineSegmentBezierCubic( + p1.x, + p1.y, + c2.x, + c2.y, + c3.x, + c3.y, + p4.x, + p4.y, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.LoadImage = LoadImage +raylib.DrawSplineSegmentBezierCubic = DrawSplineSegmentBezierCubic /** - * Load image from RAW file data + * Get (evaluate) spline point: Linear * - * @param {string} fileName - * @param {number} width - * @param {number} height - * @param {number} format - * @param {number} headerSize + * @param {Vector2} startPos + * @param {Vector2} endPos + * @param {number} t * - * @return {Image} The resulting Image. + * @return {Vector2} The resulting Vector2. */ -function LoadImageRaw (fileName, width, height, format, headerSize) { - return r.BindLoadImageRaw( - fileName, - width, - height, - format, - headerSize +function GetSplinePointLinear(startPos, endPos, t) { + return r.BindGetSplinePointLinear( + startPos.x, + startPos.y, + endPos.x, + endPos.y, + t ) } -raylib.LoadImageRaw = LoadImageRaw +raylib.GetSplinePointLinear = GetSplinePointLinear /** - * Load image sequence from file (frames appended to image.data) + * Get (evaluate) spline point: B-Spline * - * @param {string} fileName - * @param {number} frames + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {Vector2} p3 + * @param {Vector2} p4 + * @param {number} t * - * @return {Image} The resulting Image. + * @return {Vector2} The resulting Vector2. */ -function LoadImageAnim (fileName, frames) { - return r.BindLoadImageAnim( - fileName, - frames +function GetSplinePointBasis(p1, p2, p3, p4, t) { + return r.BindGetSplinePointBasis( + p1.x, + p1.y, + p2.x, + p2.y, + p3.x, + p3.y, + p4.x, + p4.y, + t ) } -raylib.LoadImageAnim = LoadImageAnim +raylib.GetSplinePointBasis = GetSplinePointBasis /** - * Load image from memory buffer, fileType refers to extension: i.e. '.png' + * Get (evaluate) spline point: Catmull-Rom * - * @param {string} fileType - * @param {Buffer} fileData - * @param {number} dataSize + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {Vector2} p3 + * @param {Vector2} p4 + * @param {number} t * - * @return {Image} The resulting Image. + * @return {Vector2} The resulting Vector2. */ -function LoadImageFromMemory (fileType, fileData, dataSize) { - return r.BindLoadImageFromMemory( - fileType, - fileData, - dataSize +function GetSplinePointCatmullRom(p1, p2, p3, p4, t) { + return r.BindGetSplinePointCatmullRom( + p1.x, + p1.y, + p2.x, + p2.y, + p3.x, + p3.y, + p4.x, + p4.y, + t ) } -raylib.LoadImageFromMemory = LoadImageFromMemory +raylib.GetSplinePointCatmullRom = GetSplinePointCatmullRom /** - * Load image from GPU texture data + * Get (evaluate) spline point: Quadratic Bezier * - * @param {Texture2D} texture + * @param {Vector2} p1 + * @param {Vector2} c2 + * @param {Vector2} p3 + * @param {number} t * - * @return {Image} The resulting Image. + * @return {Vector2} The resulting Vector2. */ -function LoadImageFromTexture (texture) { - return r.BindLoadImageFromTexture( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format +function GetSplinePointBezierQuad(p1, c2, p3, t) { + return r.BindGetSplinePointBezierQuad( + p1.x, + p1.y, + c2.x, + c2.y, + p3.x, + p3.y, + t ) } -raylib.LoadImageFromTexture = LoadImageFromTexture +raylib.GetSplinePointBezierQuad = GetSplinePointBezierQuad /** - * Load image from screen buffer and (screenshot) + * Get (evaluate) spline point: Cubic Bezier * - * @return {Image} The resulting Image. + * @param {Vector2} p1 + * @param {Vector2} c2 + * @param {Vector2} c3 + * @param {Vector2} p4 + * @param {number} t + * + * @return {Vector2} The resulting Vector2. */ -function LoadImageFromScreen () { - return r.BindLoadImageFromScreen() +function GetSplinePointBezierCubic(p1, c2, c3, p4, t) { + return r.BindGetSplinePointBezierCubic( + p1.x, + p1.y, + c2.x, + c2.y, + c3.x, + c3.y, + p4.x, + p4.y, + t + ) } -raylib.LoadImageFromScreen = LoadImageFromScreen +raylib.GetSplinePointBezierCubic = GetSplinePointBezierCubic /** - * Check if an image is ready + * Check collision between two rectangles * - * @param {Image} image + * @param {Rectangle} rec1 + * @param {Rectangle} rec2 * * @return {boolean} The resulting bool. */ -function IsImageReady (image) { - return r.BindIsImageReady( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function CheckCollisionRecs(rec1, rec2) { + return r.BindCheckCollisionRecs( + rec1.x, + rec1.y, + rec1.width, + rec1.height, + rec2.x, + rec2.y, + rec2.width, + rec2.height ) } -raylib.IsImageReady = IsImageReady +raylib.CheckCollisionRecs = CheckCollisionRecs /** - * Unload image from CPU memory (RAM) + * Check collision between two circles * - * @param {Image} image + * @param {Vector2} center1 + * @param {number} radius1 + * @param {Vector2} center2 + * @param {number} radius2 * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function UnloadImage (image) { - return r.BindUnloadImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function CheckCollisionCircles(center1, radius1, center2, radius2) { + return r.BindCheckCollisionCircles( + center1.x, + center1.y, + radius1, + center2.x, + center2.y, + radius2 ) } -raylib.UnloadImage = UnloadImage +raylib.CheckCollisionCircles = CheckCollisionCircles /** - * Export image data to file, returns true on success + * Check collision between circle and rectangle * - * @param {Image} image - * @param {string} fileName + * @param {Vector2} center + * @param {number} radius + * @param {Rectangle} rec * * @return {boolean} The resulting bool. */ -function ExportImage (image, fileName) { - return r.BindExportImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - fileName +function CheckCollisionCircleRec(center, radius, rec) { + return r.BindCheckCollisionCircleRec( + center.x, + center.y, + radius, + rec.x, + rec.y, + rec.width, + rec.height ) } -raylib.ExportImage = ExportImage +raylib.CheckCollisionCircleRec = CheckCollisionCircleRec /** - * Export image as code file defining an array of bytes, returns true on success + * Check if circle collides with a line created betweeen two points [p1] and [p2] * - * @param {Image} image - * @param {string} fileName + * @param {Vector2} center + * @param {number} radius + * @param {Vector2} p1 + * @param {Vector2} p2 * * @return {boolean} The resulting bool. */ -function ExportImageAsCode (image, fileName) { - return r.BindExportImageAsCode( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - fileName +function CheckCollisionCircleLine(center, radius, p1, p2) { + return r.BindCheckCollisionCircleLine( + center.x, + center.y, + radius, + p1.x, + p1.y, + p2.x, + p2.y ) } -raylib.ExportImageAsCode = ExportImageAsCode +raylib.CheckCollisionCircleLine = CheckCollisionCircleLine /** - * Generate image: plain color + * Check if point is inside rectangle * - * @param {number} width - * @param {number} height - * @param {Color} color + * @param {Vector2} point + * @param {Rectangle} rec * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageColor (width, height, color) { - return r.BindGenImageColor( - width, - height, - color.r, - color.g, - color.b, - color.a +function CheckCollisionPointRec(point, rec) { + return r.BindCheckCollisionPointRec( + point.x, + point.y, + rec.x, + rec.y, + rec.width, + rec.height ) } -raylib.GenImageColor = GenImageColor +raylib.CheckCollisionPointRec = CheckCollisionPointRec /** - * Generate image: vertical gradient + * Check if point is inside circle * - * @param {number} width - * @param {number} height - * @param {Color} top - * @param {Color} bottom + * @param {Vector2} point + * @param {Vector2} center + * @param {number} radius * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageGradientV (width, height, top, bottom) { - return r.BindGenImageGradientV( - width, - height, - top.r, - top.g, - top.b, - top.a, - bottom.r, - bottom.g, - bottom.b, - bottom.a +function CheckCollisionPointCircle(point, center, radius) { + return r.BindCheckCollisionPointCircle( + point.x, + point.y, + center.x, + center.y, + radius ) } -raylib.GenImageGradientV = GenImageGradientV +raylib.CheckCollisionPointCircle = CheckCollisionPointCircle /** - * Generate image: horizontal gradient + * Check if point is inside a triangle * - * @param {number} width - * @param {number} height - * @param {Color} left - * @param {Color} right + * @param {Vector2} point + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {Vector2} p3 * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageGradientH (width, height, left, right) { - return r.BindGenImageGradientH( - width, - height, - left.r, - left.g, - left.b, - left.a, - right.r, - right.g, - right.b, - right.a +function CheckCollisionPointTriangle(point, p1, p2, p3) { + return r.BindCheckCollisionPointTriangle( + point.x, + point.y, + p1.x, + p1.y, + p2.x, + p2.y, + p3.x, + p3.y ) } -raylib.GenImageGradientH = GenImageGradientH +raylib.CheckCollisionPointTriangle = CheckCollisionPointTriangle /** - * Generate image: radial gradient + * Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] * - * @param {number} width - * @param {number} height - * @param {number} density - * @param {Color} inner - * @param {Color} outer + * @param {Vector2} point + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {number} threshold * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageGradientRadial (width, height, density, inner, outer) { - return r.BindGenImageGradientRadial( - width, - height, - density, - inner.r, - inner.g, - inner.b, - inner.a, - outer.r, - outer.g, - outer.b, - outer.a +function CheckCollisionPointLine(point, p1, p2, threshold) { + return r.BindCheckCollisionPointLine( + point.x, + point.y, + p1.x, + p1.y, + p2.x, + p2.y, + threshold ) } -raylib.GenImageGradientRadial = GenImageGradientRadial +raylib.CheckCollisionPointLine = CheckCollisionPointLine /** - * Generate image: checked + * Check if point is within a polygon described by array of vertices * - * @param {number} width - * @param {number} height - * @param {number} checksX - * @param {number} checksY - * @param {Color} col1 - * @param {Color} col2 + * @param {Vector2} point + * @param {number} points + * @param {number} pointCount * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageChecked (width, height, checksX, checksY, col1, col2) { - return r.BindGenImageChecked( - width, - height, - checksX, - checksY, - col1.r, - col1.g, - col1.b, - col1.a, - col2.r, - col2.g, - col2.b, - col2.a +function CheckCollisionPointPoly(point, points, pointCount) { + return r.BindCheckCollisionPointPoly( + point.x, + point.y, + points, + pointCount ) } -raylib.GenImageChecked = GenImageChecked +raylib.CheckCollisionPointPoly = CheckCollisionPointPoly /** - * Generate image: white noise + * Check the collision between two lines defined by two points each, returns collision point by reference * - * @param {number} width - * @param {number} height - * @param {number} factor + * @param {Vector2} startPos1 + * @param {Vector2} endPos1 + * @param {Vector2} startPos2 + * @param {Vector2} endPos2 + * @param {number} collisionPoint * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageWhiteNoise (width, height, factor) { - return r.BindGenImageWhiteNoise( - width, - height, - factor +function CheckCollisionLines(startPos1, endPos1, startPos2, endPos2, collisionPoint) { + return r.BindCheckCollisionLines( + startPos1.x, + startPos1.y, + endPos1.x, + endPos1.y, + startPos2.x, + startPos2.y, + endPos2.x, + endPos2.y, + collisionPoint ) } -raylib.GenImageWhiteNoise = GenImageWhiteNoise +raylib.CheckCollisionLines = CheckCollisionLines /** - * Generate image: perlin noise + * Get collision rectangle for two rectangles collision * - * @param {number} width - * @param {number} height - * @param {number} offsetX - * @param {number} offsetY - * @param {number} scale + * @param {Rectangle} rec1 + * @param {Rectangle} rec2 * - * @return {Image} The resulting Image. + * @return {Rectangle} The resulting Rectangle. */ -function GenImagePerlinNoise (width, height, offsetX, offsetY, scale) { - return r.BindGenImagePerlinNoise( - width, - height, - offsetX, - offsetY, - scale +function GetCollisionRec(rec1, rec2) { + return r.BindGetCollisionRec( + rec1.x, + rec1.y, + rec1.width, + rec1.height, + rec2.x, + rec2.y, + rec2.width, + rec2.height ) } -raylib.GenImagePerlinNoise = GenImagePerlinNoise +raylib.GetCollisionRec = GetCollisionRec /** - * Generate image: cellular algorithm, bigger tileSize means bigger cells + * Load image from file into CPU memory (RAM) * - * @param {number} width - * @param {number} height - * @param {number} tileSize + * @param {string} fileName * * @return {Image} The resulting Image. */ -function GenImageCellular (width, height, tileSize) { - return r.BindGenImageCellular( - width, - height, - tileSize +function LoadImage(fileName) { + return r.BindLoadImage( + fileName ) } -raylib.GenImageCellular = GenImageCellular +raylib.LoadImage = LoadImage /** - * Generate image: grayscale image from text data + * Load image from RAW file data * + * @param {string} fileName * @param {number} width * @param {number} height - * @param {string} text + * @param {number} format + * @param {number} headerSize * * @return {Image} The resulting Image. */ -function GenImageText (width, height, text) { - return r.BindGenImageText( +function LoadImageRaw(fileName, width, height, format, headerSize) { + return r.BindLoadImageRaw( + fileName, width, height, - text + format, + headerSize ) } -raylib.GenImageText = GenImageText +raylib.LoadImageRaw = LoadImageRaw /** - * Create an image duplicate (useful for transformations) + * Load image sequence from file (frames appended to image.data) * - * @param {Image} image + * @param {string} fileName + * @param {number} frames * * @return {Image} The resulting Image. */ -function ImageCopy (image) { - return r.BindImageCopy( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function LoadImageAnim(fileName, frames) { + return r.BindLoadImageAnim( + fileName, + frames ) } -raylib.ImageCopy = ImageCopy +raylib.LoadImageAnim = LoadImageAnim /** - * Create an image from another image piece + * Load image sequence from memory buffer * - * @param {Image} image - * @param {Rectangle} rec + * @param {string} fileType + * @param {Buffer} fileData + * @param {number} dataSize + * @param {number} frames * * @return {Image} The resulting Image. */ -function ImageFromImage (image, rec) { - return r.BindImageFromImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - rec.x, - rec.y, - rec.width, - rec.height +function LoadImageAnimFromMemory(fileType, fileData, dataSize, frames) { + return r.BindLoadImageAnimFromMemory( + fileType, + fileData, + dataSize, + frames ) } -raylib.ImageFromImage = ImageFromImage +raylib.LoadImageAnimFromMemory = LoadImageAnimFromMemory /** - * Create an image from text (default font) + * Load image from memory buffer, fileType refers to extension: i.e. '.png' * - * @param {string} text - * @param {number} fontSize - * @param {Color} color + * @param {string} fileType + * @param {Buffer} fileData + * @param {number} dataSize * * @return {Image} The resulting Image. */ -function ImageText (text, fontSize, color) { - return r.BindImageText( - text, - fontSize, - color.r, - color.g, - color.b, - color.a +function LoadImageFromMemory(fileType, fileData, dataSize) { + return r.BindLoadImageFromMemory( + fileType, + fileData, + dataSize ) } -raylib.ImageText = ImageText +raylib.LoadImageFromMemory = LoadImageFromMemory /** - * Create an image from text (custom sprite font) + * Load image from GPU texture data * - * @param {Font} font - * @param {string} text - * @param {number} fontSize - * @param {number} spacing - * @param {Color} tint + * @param {Texture2D} texture * * @return {Image} The resulting Image. */ -function ImageTextEx (font, text, fontSize, spacing, tint) { - return r.BindImageTextEx( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - text, - fontSize, - spacing, - tint.r, - tint.g, - tint.b, - tint.a +function LoadImageFromTexture(texture) { + return r.BindLoadImageFromTexture( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format ) } -raylib.ImageTextEx = ImageTextEx +raylib.LoadImageFromTexture = LoadImageFromTexture /** - * Apply Gaussian blur using a box blur approximation - * - * @param {number} image - * @param {number} blurSize + * Load image from screen buffer and (screenshot) * - * @return {undefined} + * @return {Image} The resulting Image. */ -function ImageBlurGaussian (image, blurSize) { - return r.BindImageBlurGaussian( - image, - blurSize - ) +function LoadImageFromScreen() { + return r.BindLoadImageFromScreen() } -raylib.ImageBlurGaussian = ImageBlurGaussian +raylib.LoadImageFromScreen = LoadImageFromScreen /** - * Load color data from image as a Color array (RGBA - 32bit) + * Check if an image is valid (data and parameters) * * @param {Image} image * - * @return {number} The resulting Color *. + * @return {boolean} The resulting bool. */ -function LoadImageColors (image) { - return r.BindLoadImageColors( +function IsImageValid(image) { + return r.BindIsImageValid( image.data, image.width, image.height, @@ -4117,2446 +4487,3192 @@ function LoadImageColors (image) { image.format ) } -raylib.LoadImageColors = LoadImageColors +raylib.IsImageValid = IsImageValid /** - * Load colors palette from image as a Color array (RGBA - 32bit) + * Unload image from CPU memory (RAM) * * @param {Image} image - * @param {number} maxPaletteSize - * @param {number} colorCount * - * @return {number} The resulting Color *. + * @return {undefined} */ -function LoadImagePalette (image, maxPaletteSize, colorCount) { - return r.BindLoadImagePalette( +function UnloadImage(image) { + return r.BindUnloadImage( image.data, image.width, image.height, image.mipmaps, - image.format, - maxPaletteSize, - colorCount - ) -} -raylib.LoadImagePalette = LoadImagePalette - -/** - * Unload color data loaded with LoadImageColors() - * - * @param {number} colors - * - * @return {undefined} - */ -function UnloadImageColors (colors) { - return r.BindUnloadImageColors( - colors + image.format ) } -raylib.UnloadImageColors = UnloadImageColors +raylib.UnloadImage = UnloadImage /** - * Unload colors palette loaded with LoadImagePalette() + * Export image data to file, returns true on success * - * @param {number} colors + * @param {Image} image + * @param {string} fileName * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function UnloadImagePalette (colors) { - return r.BindUnloadImagePalette( - colors +function ExportImage(image, fileName) { + return r.BindExportImage( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + fileName ) } -raylib.UnloadImagePalette = UnloadImagePalette +raylib.ExportImage = ExportImage /** - * Get image alpha border rectangle + * Export image to memory buffer * * @param {Image} image - * @param {number} threshold + * @param {string} fileType + * @param {number} fileSize * - * @return {Rectangle} The resulting Rectangle. + * @return {Buffer} The resulting unsigned char *. */ -function GetImageAlphaBorder (image, threshold) { - return r.BindGetImageAlphaBorder( +function ExportImageToMemory(image, fileType, fileSize) { + return r.BindExportImageToMemory( image.data, image.width, image.height, image.mipmaps, image.format, - threshold + fileType, + fileSize ) } -raylib.GetImageAlphaBorder = GetImageAlphaBorder +raylib.ExportImageToMemory = ExportImageToMemory /** - * Get image pixel color at (x, y) position + * Export image as code file defining an array of bytes, returns true on success * * @param {Image} image - * @param {number} x - * @param {number} y + * @param {string} fileName * - * @return {Color} The resulting Color. + * @return {boolean} The resulting bool. */ -function GetImageColor (image, x, y) { - return r.BindGetImageColor( +function ExportImageAsCode(image, fileName) { + return r.BindExportImageAsCode( image.data, image.width, image.height, image.mipmaps, image.format, - x, - y + fileName ) } -raylib.GetImageColor = GetImageColor +raylib.ExportImageAsCode = ExportImageAsCode /** - * Draw circle outline within an image + * Generate image: plain color * - * @param {number} dst - * @param {number} centerX - * @param {number} centerY - * @param {number} radius + * @param {number} width + * @param {number} height * @param {Color} color * - * @return {undefined} + * @return {Image} The resulting Image. */ -function ImageDrawCircleLines (dst, centerX, centerY, radius, color) { - return r.BindImageDrawCircleLines( - dst, - centerX, - centerY, - radius, +function GenImageColor(width, height, color) { + return r.BindGenImageColor( + width, + height, color.r, color.g, color.b, color.a ) } -raylib.ImageDrawCircleLines = ImageDrawCircleLines +raylib.GenImageColor = GenImageColor /** - * Draw circle outline within an image (Vector version) + * Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient * - * @param {number} dst - * @param {Vector2} center - * @param {number} radius - * @param {Color} color + * @param {number} width + * @param {number} height + * @param {number} direction + * @param {Color} start + * @param {Color} end * - * @return {undefined} + * @return {Image} The resulting Image. */ -function ImageDrawCircleLinesV (dst, center, radius, color) { - return r.BindImageDrawCircleLinesV( - dst, - center.x, - center.y, - radius, - color.r, - color.g, - color.b, - color.a +function GenImageGradientLinear(width, height, direction, start, end) { + return r.BindGenImageGradientLinear( + width, + height, + direction, + start.r, + start.g, + start.b, + start.a, + end.r, + end.g, + end.b, + end.a ) } -raylib.ImageDrawCircleLinesV = ImageDrawCircleLinesV +raylib.GenImageGradientLinear = GenImageGradientLinear /** - * Load texture from file into GPU memory (VRAM) + * Generate image: radial gradient * - * @param {string} fileName + * @param {number} width + * @param {number} height + * @param {number} density + * @param {Color} inner + * @param {Color} outer * - * @return {Texture2D} The resulting Texture2D. + * @return {Image} The resulting Image. */ -function LoadTexture (fileName) { - return r.BindLoadTexture( - fileName - ) -} -raylib.LoadTexture = LoadTexture - -/** - * Load texture from image data - * - * @param {Image} image - * - * @return {Texture2D} The resulting Texture2D. - */ -function LoadTextureFromImage (image) { - return r.BindLoadTextureFromImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function GenImageGradientRadial(width, height, density, inner, outer) { + return r.BindGenImageGradientRadial( + width, + height, + density, + inner.r, + inner.g, + inner.b, + inner.a, + outer.r, + outer.g, + outer.b, + outer.a ) } -raylib.LoadTextureFromImage = LoadTextureFromImage +raylib.GenImageGradientRadial = GenImageGradientRadial /** - * Load cubemap from image, multiple image cubemap layouts supported + * Generate image: square gradient * - * @param {Image} image - * @param {number} layout + * @param {number} width + * @param {number} height + * @param {number} density + * @param {Color} inner + * @param {Color} outer * - * @return {TextureCubemap} The resulting TextureCubemap. + * @return {Image} The resulting Image. */ -function LoadTextureCubemap (image, layout) { - return r.BindLoadTextureCubemap( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - layout +function GenImageGradientSquare(width, height, density, inner, outer) { + return r.BindGenImageGradientSquare( + width, + height, + density, + inner.r, + inner.g, + inner.b, + inner.a, + outer.r, + outer.g, + outer.b, + outer.a ) } -raylib.LoadTextureCubemap = LoadTextureCubemap +raylib.GenImageGradientSquare = GenImageGradientSquare /** - * Load texture for rendering (framebuffer) + * Generate image: checked * * @param {number} width * @param {number} height + * @param {number} checksX + * @param {number} checksY + * @param {Color} col1 + * @param {Color} col2 * - * @return {RenderTexture2D} The resulting RenderTexture2D. + * @return {Image} The resulting Image. */ -function LoadRenderTexture (width, height) { - return r.BindLoadRenderTexture( +function GenImageChecked(width, height, checksX, checksY, col1, col2) { + return r.BindGenImageChecked( width, - height + height, + checksX, + checksY, + col1.r, + col1.g, + col1.b, + col1.a, + col2.r, + col2.g, + col2.b, + col2.a ) } -raylib.LoadRenderTexture = LoadRenderTexture +raylib.GenImageChecked = GenImageChecked /** - * Check if a texture is ready + * Generate image: white noise * - * @param {Texture2D} texture + * @param {number} width + * @param {number} height + * @param {number} factor * - * @return {boolean} The resulting bool. + * @return {Image} The resulting Image. */ -function IsTextureReady (texture) { - return r.BindIsTextureReady( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format +function GenImageWhiteNoise(width, height, factor) { + return r.BindGenImageWhiteNoise( + width, + height, + factor ) } -raylib.IsTextureReady = IsTextureReady +raylib.GenImageWhiteNoise = GenImageWhiteNoise /** - * Unload texture from GPU memory (VRAM) + * Generate image: perlin noise * - * @param {Texture2D} texture + * @param {number} width + * @param {number} height + * @param {number} offsetX + * @param {number} offsetY + * @param {number} scale * - * @return {undefined} + * @return {Image} The resulting Image. */ -function UnloadTexture (texture) { - return r.BindUnloadTexture( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format +function GenImagePerlinNoise(width, height, offsetX, offsetY, scale) { + return r.BindGenImagePerlinNoise( + width, + height, + offsetX, + offsetY, + scale ) } -raylib.UnloadTexture = UnloadTexture +raylib.GenImagePerlinNoise = GenImagePerlinNoise /** - * Check if a render texture is ready + * Generate image: cellular algorithm, bigger tileSize means bigger cells * - * @param {RenderTexture2D} target + * @param {number} width + * @param {number} height + * @param {number} tileSize * - * @return {boolean} The resulting bool. + * @return {Image} The resulting Image. */ -function IsRenderTextureReady (target) { - return r.BindIsRenderTextureReady( - target.id, - target.texture.id, - target.texture.width, - target.texture.height, - target.texture.mipmaps, - target.texture.format, - target.depth.id, - target.depth.width, - target.depth.height, - target.depth.mipmaps, - target.depth.format +function GenImageCellular(width, height, tileSize) { + return r.BindGenImageCellular( + width, + height, + tileSize ) } -raylib.IsRenderTextureReady = IsRenderTextureReady +raylib.GenImageCellular = GenImageCellular /** - * Unload render texture from GPU memory (VRAM) + * Generate image: grayscale image from text data * - * @param {RenderTexture2D} target + * @param {number} width + * @param {number} height + * @param {string} text * - * @return {undefined} + * @return {Image} The resulting Image. */ -function UnloadRenderTexture (target) { - return r.BindUnloadRenderTexture( - target.id, - target.texture.id, - target.texture.width, - target.texture.height, - target.texture.mipmaps, - target.texture.format, - target.depth.id, - target.depth.width, - target.depth.height, - target.depth.mipmaps, - target.depth.format +function GenImageText(width, height, text) { + return r.BindGenImageText( + width, + height, + text ) } -raylib.UnloadRenderTexture = UnloadRenderTexture +raylib.GenImageText = GenImageText /** - * Update GPU texture with new data + * Create an image duplicate (useful for transformations) * - * @param {Texture2D} texture - * @param {number} pixels + * @param {Image} image * - * @return {undefined} + * @return {Image} The resulting Image. */ -function UpdateTexture (texture, pixels) { - return r.BindUpdateTexture( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - pixels +function ImageCopy(image) { + return r.BindImageCopy( + image.data, + image.width, + image.height, + image.mipmaps, + image.format ) } -raylib.UpdateTexture = UpdateTexture +raylib.ImageCopy = ImageCopy /** - * Update GPU texture rectangle with new data + * Create an image from another image piece * - * @param {Texture2D} texture + * @param {Image} image * @param {Rectangle} rec - * @param {number} pixels * - * @return {undefined} + * @return {Image} The resulting Image. */ -function UpdateTextureRec (texture, rec, pixels) { - return r.BindUpdateTextureRec( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, +function ImageFromImage(image, rec) { + return r.BindImageFromImage( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, rec.x, rec.y, rec.width, - rec.height, - pixels + rec.height ) } -raylib.UpdateTextureRec = UpdateTextureRec +raylib.ImageFromImage = ImageFromImage /** - * Set texture scaling filter mode + * Create an image from a selected channel of another image (GRAYSCALE) * - * @param {Texture2D} texture - * @param {number} filter + * @param {Image} image + * @param {number} selectedChannel * - * @return {undefined} + * @return {Image} The resulting Image. */ -function SetTextureFilter (texture, filter) { - return r.BindSetTextureFilter( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - filter +function ImageFromChannel(image, selectedChannel) { + return r.BindImageFromChannel( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + selectedChannel ) } -raylib.SetTextureFilter = SetTextureFilter +raylib.ImageFromChannel = ImageFromChannel /** - * Set texture wrapping mode + * Create an image from text (default font) * - * @param {Texture2D} texture - * @param {number} wrap + * @param {string} text + * @param {number} fontSize + * @param {Color} color * - * @return {undefined} + * @return {Image} The resulting Image. */ -function SetTextureWrap (texture, wrap) { - return r.BindSetTextureWrap( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - wrap - ) -} -raylib.SetTextureWrap = SetTextureWrap - -/** - * Draw a Texture2D - * - * @param {Texture2D} texture - * @param {number} posX - * @param {number} posY - * @param {Color} tint - * - * @return {undefined} - */ -function DrawTexture (texture, posX, posY, tint) { - return r.BindDrawTexture( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - posX, - posY, - tint.r, - tint.g, - tint.b, - tint.a +function ImageText(text, fontSize, color) { + return r.BindImageText( + text, + fontSize, + color.r, + color.g, + color.b, + color.a ) } -raylib.DrawTexture = DrawTexture +raylib.ImageText = ImageText /** - * Draw a Texture2D with position defined as Vector2 + * Create an image from text (custom sprite font) * - * @param {Texture2D} texture - * @param {Vector2} position + * @param {Font} font + * @param {string} text + * @param {number} fontSize + * @param {number} spacing * @param {Color} tint * - * @return {undefined} + * @return {Image} The resulting Image. */ -function DrawTextureV (texture, position, tint) { - return r.BindDrawTextureV( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - position.x, - position.y, +function ImageTextEx(font, text, fontSize, spacing, tint) { + return r.BindImageTextEx( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + text, + fontSize, + spacing, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextureV = DrawTextureV +raylib.ImageTextEx = ImageTextEx /** - * Draw a Texture2D with extended parameters + * Apply Gaussian blur using a box blur approximation * - * @param {Texture2D} texture - * @param {Vector2} position - * @param {number} rotation - * @param {number} scale - * @param {Color} tint + * @param {number} image + * @param {number} blurSize * * @return {undefined} */ -function DrawTextureEx (texture, position, rotation, scale, tint) { - return r.BindDrawTextureEx( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - position.x, - position.y, - rotation, - scale, - tint.r, - tint.g, - tint.b, - tint.a +function ImageBlurGaussian(image, blurSize) { + return r.BindImageBlurGaussian( + image, + blurSize ) } -raylib.DrawTextureEx = DrawTextureEx +raylib.ImageBlurGaussian = ImageBlurGaussian /** - * Draw a part of a texture defined by a rectangle + * Apply custom square convolution kernel to image * - * @param {Texture2D} texture - * @param {Rectangle} source - * @param {Vector2} position - * @param {Color} tint + * @param {number} image + * @param {number} kernel + * @param {number} kernelSize * * @return {undefined} */ -function DrawTextureRec (texture, source, position, tint) { - return r.BindDrawTextureRec( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - source.x, - source.y, - source.width, - source.height, - position.x, - position.y, - tint.r, - tint.g, - tint.b, - tint.a +function ImageKernelConvolution(image, kernel, kernelSize) { + return r.BindImageKernelConvolution( + image, + kernel, + kernelSize ) } -raylib.DrawTextureRec = DrawTextureRec +raylib.ImageKernelConvolution = ImageKernelConvolution /** - * Draw a part of a texture defined by a rectangle with 'pro' parameters + * Rotate image by input angle in degrees (-359 to 359) * - * @param {Texture2D} texture - * @param {Rectangle} source - * @param {Rectangle} dest - * @param {Vector2} origin - * @param {number} rotation - * @param {Color} tint + * @param {number} image + * @param {number} degrees * * @return {undefined} */ -function DrawTexturePro (texture, source, dest, origin, rotation, tint) { - return r.BindDrawTexturePro( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - source.x, - source.y, - source.width, - source.height, - dest.x, - dest.y, - dest.width, - dest.height, - origin.x, - origin.y, - rotation, - tint.r, - tint.g, - tint.b, - tint.a +function ImageRotate(image, degrees) { + return r.BindImageRotate( + image, + degrees ) } -raylib.DrawTexturePro = DrawTexturePro +raylib.ImageRotate = ImageRotate /** - * Draws a texture (or part of it) that stretches or shrinks nicely + * Load color data from image as a Color array (RGBA - 32bit) * - * @param {Texture2D} texture - * @param {NPatchInfo} nPatchInfo - * @param {Rectangle} dest - * @param {Vector2} origin - * @param {number} rotation - * @param {Color} tint + * @param {Image} image * - * @return {undefined} + * @return {number} The resulting Color *. */ -function DrawTextureNPatch (texture, nPatchInfo, dest, origin, rotation, tint) { - return r.BindDrawTextureNPatch( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - nPatchInfo.source.x, - nPatchInfo.source.y, - nPatchInfo.source.width, - nPatchInfo.source.height, - nPatchInfo.left, - nPatchInfo.top, - nPatchInfo.right, - nPatchInfo.bottom, - nPatchInfo.layout, - dest.x, - dest.y, - dest.width, - dest.height, - origin.x, - origin.y, - rotation, - tint.r, - tint.g, - tint.b, - tint.a +function LoadImageColors(image) { + return r.BindLoadImageColors( + image.data, + image.width, + image.height, + image.mipmaps, + image.format ) } -raylib.DrawTextureNPatch = DrawTextureNPatch +raylib.LoadImageColors = LoadImageColors /** - * Get color with alpha applied, alpha goes from 0.0f to 1.0f + * Load colors palette from image as a Color array (RGBA - 32bit) * - * @param {Color} color - * @param {number} alpha + * @param {Image} image + * @param {number} maxPaletteSize + * @param {number} colorCount * - * @return {Color} The resulting Color. + * @return {number} The resulting Color *. */ -function Fade (color, alpha) { - return r.BindFade( - color.r, - color.g, - color.b, - color.a, - alpha +function LoadImagePalette(image, maxPaletteSize, colorCount) { + return r.BindLoadImagePalette( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + maxPaletteSize, + colorCount ) } -raylib.Fade = Fade +raylib.LoadImagePalette = LoadImagePalette /** - * Get hexadecimal value for a Color + * Unload color data loaded with LoadImageColors() * - * @param {Color} color + * @param {number} colors * - * @return {number} The resulting int. + * @return {undefined} */ -function ColorToInt (color) { - return r.BindColorToInt( - color.r, - color.g, - color.b, - color.a +function UnloadImageColors(colors) { + return r.BindUnloadImageColors( + colors ) } -raylib.ColorToInt = ColorToInt +raylib.UnloadImageColors = UnloadImageColors /** - * Get Color normalized as float [0..1] + * Unload colors palette loaded with LoadImagePalette() * - * @param {Color} color + * @param {number} colors * - * @return {Vector4} The resulting Vector4. + * @return {undefined} */ -function ColorNormalize (color) { - return r.BindColorNormalize( - color.r, - color.g, - color.b, - color.a +function UnloadImagePalette(colors) { + return r.BindUnloadImagePalette( + colors ) } -raylib.ColorNormalize = ColorNormalize +raylib.UnloadImagePalette = UnloadImagePalette /** - * Get Color from normalized values [0..1] + * Get image alpha border rectangle * - * @param {Vector4} normalized + * @param {Image} image + * @param {number} threshold * - * @return {Color} The resulting Color. + * @return {Rectangle} The resulting Rectangle. */ -function ColorFromNormalized (normalized) { - return r.BindColorFromNormalized( - normalized.x, - normalized.y, - normalized.z, - normalized.w - ) -} -raylib.ColorFromNormalized = ColorFromNormalized - -/** - * Get HSV values for a Color, hue [0..360], saturation/value [0..1] - * - * @param {Color} color - * - * @return {Vector3} The resulting Vector3. - */ -function ColorToHSV (color) { - return r.BindColorToHSV( - color.r, - color.g, - color.b, - color.a +function GetImageAlphaBorder(image, threshold) { + return r.BindGetImageAlphaBorder( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + threshold ) } -raylib.ColorToHSV = ColorToHSV +raylib.GetImageAlphaBorder = GetImageAlphaBorder /** - * Get a Color from HSV values, hue [0..360], saturation/value [0..1] + * Get image pixel color at (x, y) position * - * @param {number} hue - * @param {number} saturation - * @param {number} value + * @param {Image} image + * @param {number} x + * @param {number} y * * @return {Color} The resulting Color. */ -function ColorFromHSV (hue, saturation, value) { - return r.BindColorFromHSV( - hue, - saturation, - value +function GetImageColor(image, x, y) { + return r.BindGetImageColor( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + x, + y ) } -raylib.ColorFromHSV = ColorFromHSV +raylib.GetImageColor = GetImageColor /** - * Get color multiplied with another color + * Draw a line defining thickness within an image * + * @param {number} dst + * @param {Vector2} start + * @param {Vector2} end + * @param {number} thick * @param {Color} color - * @param {Color} tint * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorTint (color, tint) { - return r.BindColorTint( +function ImageDrawLineEx(dst, start, end, thick, color) { + return r.BindImageDrawLineEx( + dst, + start.x, + start.y, + end.x, + end.y, + thick, color.r, color.g, color.b, - color.a, - tint.r, - tint.g, - tint.b, - tint.a + color.a ) } -raylib.ColorTint = ColorTint +raylib.ImageDrawLineEx = ImageDrawLineEx /** - * Get color with brightness correction, brightness factor goes from -1.0f to 1.0f + * Draw circle outline within an image * + * @param {number} dst + * @param {number} centerX + * @param {number} centerY + * @param {number} radius * @param {Color} color - * @param {number} factor * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorBrightness (color, factor) { - return r.BindColorBrightness( +function ImageDrawCircleLines(dst, centerX, centerY, radius, color) { + return r.BindImageDrawCircleLines( + dst, + centerX, + centerY, + radius, color.r, color.g, color.b, - color.a, - factor + color.a ) } -raylib.ColorBrightness = ColorBrightness +raylib.ImageDrawCircleLines = ImageDrawCircleLines /** - * Get color with contrast correction, contrast values between -1.0f and 1.0f + * Draw circle outline within an image (Vector version) * + * @param {number} dst + * @param {Vector2} center + * @param {number} radius * @param {Color} color - * @param {number} contrast * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorContrast (color, contrast) { - return r.BindColorContrast( +function ImageDrawCircleLinesV(dst, center, radius, color) { + return r.BindImageDrawCircleLinesV( + dst, + center.x, + center.y, + radius, color.r, color.g, color.b, - color.a, - contrast + color.a ) } -raylib.ColorContrast = ColorContrast +raylib.ImageDrawCircleLinesV = ImageDrawCircleLinesV /** - * Get color with alpha applied, alpha goes from 0.0f to 1.0f + * Draw triangle within an image * + * @param {number} dst + * @param {Vector2} v1 + * @param {Vector2} v2 + * @param {Vector2} v3 * @param {Color} color - * @param {number} alpha * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorAlpha (color, alpha) { - return r.BindColorAlpha( +function ImageDrawTriangle(dst, v1, v2, v3, color) { + return r.BindImageDrawTriangle( + dst, + v1.x, + v1.y, + v2.x, + v2.y, + v3.x, + v3.y, color.r, color.g, color.b, - color.a, - alpha + color.a ) } -raylib.ColorAlpha = ColorAlpha +raylib.ImageDrawTriangle = ImageDrawTriangle /** - * Get src alpha-blended into dst color with tint + * Draw triangle with interpolated colors within an image * - * @param {Color} dst - * @param {Color} src - * @param {Color} tint + * @param {number} dst + * @param {Vector2} v1 + * @param {Vector2} v2 + * @param {Vector2} v3 + * @param {Color} c1 + * @param {Color} c2 + * @param {Color} c3 * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorAlphaBlend (dst, src, tint) { - return r.BindColorAlphaBlend( - dst.r, - dst.g, - dst.b, - dst.a, - src.r, - src.g, - src.b, - src.a, - tint.r, - tint.g, - tint.b, - tint.a +function ImageDrawTriangleEx(dst, v1, v2, v3, c1, c2, c3) { + return r.BindImageDrawTriangleEx( + dst, + v1.x, + v1.y, + v2.x, + v2.y, + v3.x, + v3.y, + c1.r, + c1.g, + c1.b, + c1.a, + c2.r, + c2.g, + c2.b, + c2.a, + c3.r, + c3.g, + c3.b, + c3.a ) } -raylib.ColorAlphaBlend = ColorAlphaBlend +raylib.ImageDrawTriangleEx = ImageDrawTriangleEx /** - * Get Color structure from hexadecimal value + * Draw triangle outline within an image * - * @param {number} hexValue + * @param {number} dst + * @param {Vector2} v1 + * @param {Vector2} v2 + * @param {Vector2} v3 + * @param {Color} color * - * @return {Color} The resulting Color. + * @return {undefined} */ -function GetColor (hexValue) { - return r.BindGetColor( - hexValue +function ImageDrawTriangleLines(dst, v1, v2, v3, color) { + return r.BindImageDrawTriangleLines( + dst, + v1.x, + v1.y, + v2.x, + v2.y, + v3.x, + v3.y, + color.r, + color.g, + color.b, + color.a ) } -raylib.GetColor = GetColor +raylib.ImageDrawTriangleLines = ImageDrawTriangleLines /** - * Get Color from a source pixel pointer of certain format + * Draw a triangle fan defined by points within an image (first vertex is the center) * - * @param {number} srcPtr - * @param {number} format + * @param {number} dst + * @param {number} points + * @param {number} pointCount + * @param {Color} color * - * @return {Color} The resulting Color. + * @return {undefined} */ -function GetPixelColor (srcPtr, format) { - return r.BindGetPixelColor( - srcPtr, - format +function ImageDrawTriangleFan(dst, points, pointCount, color) { + return r.BindImageDrawTriangleFan( + dst, + points, + pointCount, + color.r, + color.g, + color.b, + color.a ) } -raylib.GetPixelColor = GetPixelColor +raylib.ImageDrawTriangleFan = ImageDrawTriangleFan /** - * Set color formatted into destination pixel pointer + * Draw a triangle strip defined by points within an image * - * @param {number} dstPtr + * @param {number} dst + * @param {number} points + * @param {number} pointCount * @param {Color} color - * @param {number} format * * @return {undefined} */ -function SetPixelColor (dstPtr, color, format) { - return r.BindSetPixelColor( - dstPtr, +function ImageDrawTriangleStrip(dst, points, pointCount, color) { + return r.BindImageDrawTriangleStrip( + dst, + points, + pointCount, color.r, color.g, color.b, - color.a, - format + color.a ) } -raylib.SetPixelColor = SetPixelColor +raylib.ImageDrawTriangleStrip = ImageDrawTriangleStrip /** - * Get pixel data size in bytes for certain format + * Load texture from file into GPU memory (VRAM) * - * @param {number} width - * @param {number} height - * @param {number} format + * @param {string} fileName * - * @return {number} The resulting int. + * @return {Texture2D} The resulting Texture2D. */ -function GetPixelDataSize (width, height, format) { - return r.BindGetPixelDataSize( - width, - height, - format +function LoadTexture(fileName) { + return r.BindLoadTexture( + fileName ) } -raylib.GetPixelDataSize = GetPixelDataSize +raylib.LoadTexture = LoadTexture /** - * Get the default Font + * Load texture from image data * - * @return {Font} The resulting Font. + * @param {Image} image + * + * @return {Texture2D} The resulting Texture2D. */ -function GetFontDefault () { - return r.BindGetFontDefault() +function LoadTextureFromImage(image) { + return r.BindLoadTextureFromImage( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) } -raylib.GetFontDefault = GetFontDefault +raylib.LoadTextureFromImage = LoadTextureFromImage /** - * Load font from file into GPU memory (VRAM) + * Load cubemap from image, multiple image cubemap layouts supported * - * @param {string} fileName + * @param {Image} image + * @param {number} layout * - * @return {Font} The resulting Font. + * @return {TextureCubemap} The resulting TextureCubemap. */ -function LoadFont (fileName) { - return r.BindLoadFont( - fileName +function LoadTextureCubemap(image, layout) { + return r.BindLoadTextureCubemap( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + layout ) } -raylib.LoadFont = LoadFont +raylib.LoadTextureCubemap = LoadTextureCubemap /** - * Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set + * Load texture for rendering (framebuffer) * - * @param {string} fileName - * @param {number} fontSize - * @param {number} fontChars - * @param {number} glyphCount + * @param {number} width + * @param {number} height * - * @return {Font} The resulting Font. + * @return {RenderTexture2D} The resulting RenderTexture2D. */ -function LoadFontEx (fileName, fontSize, fontChars, glyphCount) { - return r.BindLoadFontEx( - fileName, - fontSize, - fontChars, - glyphCount +function LoadRenderTexture(width, height) { + return r.BindLoadRenderTexture( + width, + height ) } -raylib.LoadFontEx = LoadFontEx +raylib.LoadRenderTexture = LoadRenderTexture /** - * Load font from Image (XNA style) + * Check if a texture is valid (loaded in GPU) * - * @param {Image} image - * @param {Color} key - * @param {number} firstChar + * @param {Texture2D} texture * - * @return {Font} The resulting Font. + * @return {boolean} The resulting bool. */ -function LoadFontFromImage (image, key, firstChar) { - return r.BindLoadFontFromImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - key.r, - key.g, - key.b, - key.a, - firstChar +function IsTextureValid(texture) { + return r.BindIsTextureValid( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format ) } -raylib.LoadFontFromImage = LoadFontFromImage +raylib.IsTextureValid = IsTextureValid /** - * Load font from memory buffer, fileType refers to extension: i.e. '.ttf' + * Unload texture from GPU memory (VRAM) * - * @param {string} fileType - * @param {Buffer} fileData - * @param {number} dataSize - * @param {number} fontSize - * @param {number} fontChars - * @param {number} glyphCount + * @param {Texture2D} texture * - * @return {Font} The resulting Font. + * @return {undefined} */ -function LoadFontFromMemory (fileType, fileData, dataSize, fontSize, fontChars, glyphCount) { - return r.BindLoadFontFromMemory( - fileType, - fileData, - dataSize, - fontSize, - fontChars, - glyphCount +function UnloadTexture(texture) { + return r.BindUnloadTexture( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format ) } -raylib.LoadFontFromMemory = LoadFontFromMemory +raylib.UnloadTexture = UnloadTexture /** - * Check if a font is ready + * Check if a render texture is valid (loaded in GPU) * - * @param {Font} font + * @param {RenderTexture2D} target * * @return {boolean} The resulting bool. */ -function IsFontReady (font) { - return r.BindIsFontReady( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs +function IsRenderTextureValid(target) { + return r.BindIsRenderTextureValid( + target.id, + target.texture.id, + target.texture.width, + target.texture.height, + target.texture.mipmaps, + target.texture.format, + target.depth.id, + target.depth.width, + target.depth.height, + target.depth.mipmaps, + target.depth.format ) } -raylib.IsFontReady = IsFontReady +raylib.IsRenderTextureValid = IsRenderTextureValid /** - * Load font data for further use + * Unload render texture from GPU memory (VRAM) * - * @param {Buffer} fileData - * @param {number} dataSize - * @param {number} fontSize - * @param {number} fontChars - * @param {number} glyphCount - * @param {number} type + * @param {RenderTexture2D} target * - * @return {number} The resulting GlyphInfo *. + * @return {undefined} */ -function LoadFontData (fileData, dataSize, fontSize, fontChars, glyphCount, type) { - return r.BindLoadFontData( - fileData, - dataSize, - fontSize, - fontChars, - glyphCount, - type +function UnloadRenderTexture(target) { + return r.BindUnloadRenderTexture( + target.id, + target.texture.id, + target.texture.width, + target.texture.height, + target.texture.mipmaps, + target.texture.format, + target.depth.id, + target.depth.width, + target.depth.height, + target.depth.mipmaps, + target.depth.format ) } -raylib.LoadFontData = LoadFontData +raylib.UnloadRenderTexture = UnloadRenderTexture /** - * Generate image font atlas using chars info + * Update GPU texture with new data * - * @param {number} chars - * @param {number} recs - * @param {number} glyphCount - * @param {number} fontSize - * @param {number} padding - * @param {number} packMethod + * @param {Texture2D} texture + * @param {number} pixels * - * @return {Image} The resulting Image. + * @return {undefined} */ -function GenImageFontAtlas (chars, recs, glyphCount, fontSize, padding, packMethod) { - return r.BindGenImageFontAtlas( - chars, - recs, - glyphCount, - fontSize, - padding, - packMethod +function UpdateTexture(texture, pixels) { + return r.BindUpdateTexture( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + pixels ) } -raylib.GenImageFontAtlas = GenImageFontAtlas +raylib.UpdateTexture = UpdateTexture /** - * Unload font chars info data (RAM) + * Update GPU texture rectangle with new data * - * @param {number} chars - * @param {number} glyphCount + * @param {Texture2D} texture + * @param {Rectangle} rec + * @param {number} pixels * * @return {undefined} */ -function UnloadFontData (chars, glyphCount) { - return r.BindUnloadFontData( - chars, - glyphCount +function UpdateTextureRec(texture, rec, pixels) { + return r.BindUpdateTextureRec( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + rec.x, + rec.y, + rec.width, + rec.height, + pixels ) } -raylib.UnloadFontData = UnloadFontData +raylib.UpdateTextureRec = UpdateTextureRec /** - * Unload font from GPU memory (VRAM) + * Set texture scaling filter mode * - * @param {Font} font + * @param {Texture2D} texture + * @param {number} filter * * @return {undefined} */ -function UnloadFont (font) { - return r.BindUnloadFont( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs +function SetTextureFilter(texture, filter) { + return r.BindSetTextureFilter( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + filter ) } -raylib.UnloadFont = UnloadFont +raylib.SetTextureFilter = SetTextureFilter /** - * Export font as code file, returns true on success + * Set texture wrapping mode * - * @param {Font} font - * @param {string} fileName + * @param {Texture2D} texture + * @param {number} wrap * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function ExportFontAsCode (font, fileName) { - return r.BindExportFontAsCode( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - fileName +function SetTextureWrap(texture, wrap) { + return r.BindSetTextureWrap( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + wrap ) } -raylib.ExportFontAsCode = ExportFontAsCode +raylib.SetTextureWrap = SetTextureWrap /** - * Draw current FPS + * Draw a Texture2D * + * @param {Texture2D} texture * @param {number} posX * @param {number} posY + * @param {Color} tint * * @return {undefined} */ -function DrawFPS (posX, posY) { - return r.BindDrawFPS( +function DrawTexture(texture, posX, posY, tint) { + return r.BindDrawTexture( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, posX, - posY + posY, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawFPS = DrawFPS +raylib.DrawTexture = DrawTexture /** - * Draw text (using default font) + * Draw a Texture2D with position defined as Vector2 * - * @param {string} text - * @param {number} posX - * @param {number} posY - * @param {number} fontSize - * @param {Color} color + * @param {Texture2D} texture + * @param {Vector2} position + * @param {Color} tint * * @return {undefined} */ -function DrawText (text, posX, posY, fontSize, color) { - return r.BindDrawText( - text, - posX, - posY, - fontSize, - color.r, - color.g, - color.b, - color.a +function DrawTextureV(texture, position, tint) { + return r.BindDrawTextureV( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + position.x, + position.y, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawText = DrawText +raylib.DrawTextureV = DrawTextureV /** - * Draw text using font and additional parameters + * Draw a Texture2D with extended parameters * - * @param {Font} font - * @param {string} text + * @param {Texture2D} texture * @param {Vector2} position - * @param {number} fontSize - * @param {number} spacing + * @param {number} rotation + * @param {number} scale * @param {Color} tint * * @return {undefined} */ -function DrawTextEx (font, text, position, fontSize, spacing, tint) { - return r.BindDrawTextEx( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - text, +function DrawTextureEx(texture, position, rotation, scale, tint) { + return r.BindDrawTextureEx( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, position.x, position.y, - fontSize, - spacing, + rotation, + scale, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextEx = DrawTextEx +raylib.DrawTextureEx = DrawTextureEx /** - * Draw text using Font and pro parameters (rotation) + * Draw a part of a texture defined by a rectangle * - * @param {Font} font - * @param {string} text + * @param {Texture2D} texture + * @param {Rectangle} source * @param {Vector2} position - * @param {Vector2} origin - * @param {number} rotation - * @param {number} fontSize - * @param {number} spacing * @param {Color} tint * * @return {undefined} */ -function DrawTextPro (font, text, position, origin, rotation, fontSize, spacing, tint) { - return r.BindDrawTextPro( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - text, +function DrawTextureRec(texture, source, position, tint) { + return r.BindDrawTextureRec( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + source.x, + source.y, + source.width, + source.height, position.x, position.y, - origin.x, - origin.y, - rotation, - fontSize, - spacing, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextPro = DrawTextPro +raylib.DrawTextureRec = DrawTextureRec /** - * Draw one character (codepoint) + * Draw a part of a texture defined by a rectangle with 'pro' parameters * - * @param {Font} font - * @param {number} codepoint - * @param {Vector2} position - * @param {number} fontSize + * @param {Texture2D} texture + * @param {Rectangle} source + * @param {Rectangle} dest + * @param {Vector2} origin + * @param {number} rotation * @param {Color} tint * * @return {undefined} */ -function DrawTextCodepoint (font, codepoint, position, fontSize, tint) { - return r.BindDrawTextCodepoint( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoint, - position.x, - position.y, - fontSize, +function DrawTexturePro(texture, source, dest, origin, rotation, tint) { + return r.BindDrawTexturePro( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + source.x, + source.y, + source.width, + source.height, + dest.x, + dest.y, + dest.width, + dest.height, + origin.x, + origin.y, + rotation, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextCodepoint = DrawTextCodepoint +raylib.DrawTexturePro = DrawTexturePro /** - * Draw multiple character (codepoint) + * Draws a texture (or part of it) that stretches or shrinks nicely * - * @param {Font} font - * @param {number} codepoints - * @param {number} count - * @param {Vector2} position - * @param {number} fontSize - * @param {number} spacing + * @param {Texture2D} texture + * @param {NPatchInfo} nPatchInfo + * @param {Rectangle} dest + * @param {Vector2} origin + * @param {number} rotation * @param {Color} tint * * @return {undefined} */ -function DrawTextCodepoints (font, codepoints, count, position, fontSize, spacing, tint) { - return r.BindDrawTextCodepoints( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoints, - count, - position.x, - position.y, - fontSize, - spacing, +function DrawTextureNPatch(texture, nPatchInfo, dest, origin, rotation, tint) { + return r.BindDrawTextureNPatch( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + nPatchInfo.source.x, + nPatchInfo.source.y, + nPatchInfo.source.width, + nPatchInfo.source.height, + nPatchInfo.left, + nPatchInfo.top, + nPatchInfo.right, + nPatchInfo.bottom, + nPatchInfo.layout, + dest.x, + dest.y, + dest.width, + dest.height, + origin.x, + origin.y, + rotation, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextCodepoints = DrawTextCodepoints +raylib.DrawTextureNPatch = DrawTextureNPatch /** - * Measure string width for default font + * Check if two colors are equal * - * @param {string} text - * @param {number} fontSize + * @param {Color} col1 + * @param {Color} col2 * - * @return {number} The resulting int. + * @return {boolean} The resulting bool. */ -function MeasureText (text, fontSize) { - return r.BindMeasureText( - text, - fontSize +function ColorIsEqual(col1, col2) { + return r.BindColorIsEqual( + col1.r, + col1.g, + col1.b, + col1.a, + col2.r, + col2.g, + col2.b, + col2.a ) } -raylib.MeasureText = MeasureText +raylib.ColorIsEqual = ColorIsEqual /** - * Measure string size for Font + * Get color with alpha applied, alpha goes from 0.0f to 1.0f * - * @param {Font} font - * @param {string} text - * @param {number} fontSize - * @param {number} spacing + * @param {Color} color + * @param {number} alpha * - * @return {Vector2} The resulting Vector2. + * @return {Color} The resulting Color. */ -function MeasureTextEx (font, text, fontSize, spacing) { - return r.BindMeasureTextEx( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - text, - fontSize, - spacing +function Fade(color, alpha) { + return r.BindFade( + color.r, + color.g, + color.b, + color.a, + alpha ) } -raylib.MeasureTextEx = MeasureTextEx +raylib.Fade = Fade /** - * Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found + * Get hexadecimal value for a Color (0xRRGGBBAA) * - * @param {Font} font - * @param {number} codepoint + * @param {Color} color * * @return {number} The resulting int. */ -function GetGlyphIndex (font, codepoint) { - return r.BindGetGlyphIndex( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoint +function ColorToInt(color) { + return r.BindColorToInt( + color.r, + color.g, + color.b, + color.a ) } -raylib.GetGlyphIndex = GetGlyphIndex +raylib.ColorToInt = ColorToInt /** - * Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found + * Get Color normalized as float [0..1] * - * @param {Font} font - * @param {number} codepoint + * @param {Color} color * - * @return {GlyphInfo} The resulting GlyphInfo. + * @return {Vector4} The resulting Vector4. */ -function GetGlyphInfo (font, codepoint) { - return r.BindGetGlyphInfo( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoint +function ColorNormalize(color) { + return r.BindColorNormalize( + color.r, + color.g, + color.b, + color.a ) } -raylib.GetGlyphInfo = GetGlyphInfo +raylib.ColorNormalize = ColorNormalize /** - * Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found + * Get Color from normalized values [0..1] * - * @param {Font} font - * @param {number} codepoint + * @param {Vector4} normalized * - * @return {Rectangle} The resulting Rectangle. + * @return {Color} The resulting Color. */ -function GetGlyphAtlasRec (font, codepoint) { - return r.BindGetGlyphAtlasRec( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoint +function ColorFromNormalized(normalized) { + return r.BindColorFromNormalized( + normalized.x, + normalized.y, + normalized.z, + normalized.w ) } -raylib.GetGlyphAtlasRec = GetGlyphAtlasRec +raylib.ColorFromNormalized = ColorFromNormalized /** - * Load UTF-8 text encoded from codepoints array + * Get HSV values for a Color, hue [0..360], saturation/value [0..1] * - * @param {number} codepoints - * @param {number} length + * @param {Color} color * - * @return {string} The resulting char *. + * @return {Vector3} The resulting Vector3. */ -function LoadUTF8 (codepoints, length) { - return r.BindLoadUTF8( - codepoints, - length +function ColorToHSV(color) { + return r.BindColorToHSV( + color.r, + color.g, + color.b, + color.a ) } -raylib.LoadUTF8 = LoadUTF8 +raylib.ColorToHSV = ColorToHSV /** - * Unload UTF-8 text encoded from codepoints array + * Get a Color from HSV values, hue [0..360], saturation/value [0..1] * - * @param {string} text + * @param {number} hue + * @param {number} saturation + * @param {number} value * - * @return {undefined} + * @return {Color} The resulting Color. */ -function UnloadUTF8 (text) { - return r.BindUnloadUTF8( - text +function ColorFromHSV(hue, saturation, value) { + return r.BindColorFromHSV( + hue, + saturation, + value ) } -raylib.UnloadUTF8 = UnloadUTF8 +raylib.ColorFromHSV = ColorFromHSV /** - * Load all codepoints from a UTF-8 text string, codepoints count returned by parameter + * Get color multiplied with another color * - * @param {string} text - * @param {number} count + * @param {Color} color + * @param {Color} tint * - * @return {number} The resulting int *. + * @return {Color} The resulting Color. */ -function LoadCodepoints (text, count) { - return r.BindLoadCodepoints( - text, - count +function ColorTint(color, tint) { + return r.BindColorTint( + color.r, + color.g, + color.b, + color.a, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.LoadCodepoints = LoadCodepoints +raylib.ColorTint = ColorTint /** - * Unload codepoints data from memory + * Get color with brightness correction, brightness factor goes from -1.0f to 1.0f * - * @param {number} codepoints + * @param {Color} color + * @param {number} factor * - * @return {undefined} + * @return {Color} The resulting Color. */ -function UnloadCodepoints (codepoints) { - return r.BindUnloadCodepoints( - codepoints +function ColorBrightness(color, factor) { + return r.BindColorBrightness( + color.r, + color.g, + color.b, + color.a, + factor ) } -raylib.UnloadCodepoints = UnloadCodepoints +raylib.ColorBrightness = ColorBrightness /** - * Get total number of codepoints in a UTF-8 encoded string + * Get color with contrast correction, contrast values between -1.0f and 1.0f * - * @param {string} text + * @param {Color} color + * @param {number} contrast * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function GetCodepointCount (text) { - return r.BindGetCodepointCount( - text +function ColorContrast(color, contrast) { + return r.BindColorContrast( + color.r, + color.g, + color.b, + color.a, + contrast ) } -raylib.GetCodepointCount = GetCodepointCount +raylib.ColorContrast = ColorContrast /** - * Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + * Get color with alpha applied, alpha goes from 0.0f to 1.0f * - * @param {string} text - * @param {number} codepointSize + * @param {Color} color + * @param {number} alpha * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function GetCodepoint (text, codepointSize) { - return r.BindGetCodepoint( - text, - codepointSize +function ColorAlpha(color, alpha) { + return r.BindColorAlpha( + color.r, + color.g, + color.b, + color.a, + alpha ) } -raylib.GetCodepoint = GetCodepoint +raylib.ColorAlpha = ColorAlpha /** - * Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + * Get src alpha-blended into dst color with tint * - * @param {string} text - * @param {number} codepointSize + * @param {Color} dst + * @param {Color} src + * @param {Color} tint * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function GetCodepointNext (text, codepointSize) { - return r.BindGetCodepointNext( - text, - codepointSize +function ColorAlphaBlend(dst, src, tint) { + return r.BindColorAlphaBlend( + dst.r, + dst.g, + dst.b, + dst.a, + src.r, + src.g, + src.b, + src.a, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.GetCodepointNext = GetCodepointNext +raylib.ColorAlphaBlend = ColorAlphaBlend /** - * Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + * Get color lerp interpolation between two colors, factor [0.0f..1.0f] * - * @param {string} text - * @param {number} codepointSize + * @param {Color} color1 + * @param {Color} color2 + * @param {number} factor * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function GetCodepointPrevious (text, codepointSize) { - return r.BindGetCodepointPrevious( - text, - codepointSize +function ColorLerp(color1, color2, factor) { + return r.BindColorLerp( + color1.r, + color1.g, + color1.b, + color1.a, + color2.r, + color2.g, + color2.b, + color2.a, + factor ) } -raylib.GetCodepointPrevious = GetCodepointPrevious +raylib.ColorLerp = ColorLerp /** - * Encode one codepoint into UTF-8 byte array (array length returned as parameter) + * Get Color structure from hexadecimal value * - * @param {number} codepoint - * @param {number} utf8Size + * @param {number} hexValue * - * @return {string} The resulting const char *. + * @return {Color} The resulting Color. */ -function CodepointToUTF8 (codepoint, utf8Size) { - return r.BindCodepointToUTF8( - codepoint, - utf8Size +function GetColor(hexValue) { + return r.BindGetColor( + hexValue ) } -raylib.CodepointToUTF8 = CodepointToUTF8 +raylib.GetColor = GetColor /** - * Copy one string to another, returns bytes copied + * Get Color from a source pixel pointer of certain format * - * @param {string} dst - * @param {string} src + * @param {number} srcPtr + * @param {number} format * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function TextCopy (dst, src) { - return r.BindTextCopy( - dst, - src +function GetPixelColor(srcPtr, format) { + return r.BindGetPixelColor( + srcPtr, + format ) } -raylib.TextCopy = TextCopy +raylib.GetPixelColor = GetPixelColor /** - * Check if two text string are equal + * Set color formatted into destination pixel pointer * - * @param {string} text1 - * @param {string} text2 + * @param {number} dstPtr + * @param {Color} color + * @param {number} format * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function TextIsEqual (text1, text2) { - return r.BindTextIsEqual( - text1, - text2 +function SetPixelColor(dstPtr, color, format) { + return r.BindSetPixelColor( + dstPtr, + color.r, + color.g, + color.b, + color.a, + format ) } -raylib.TextIsEqual = TextIsEqual +raylib.SetPixelColor = SetPixelColor /** - * Get text length, checks for '\0' ending + * Get pixel data size in bytes for certain format * - * @param {string} text + * @param {number} width + * @param {number} height + * @param {number} format * - * @return {number} The resulting unsigned int. + * @return {number} The resulting int. */ -function TextLength (text) { - return r.BindTextLength( - text +function GetPixelDataSize(width, height, format) { + return r.BindGetPixelDataSize( + width, + height, + format ) } -raylib.TextLength = TextLength +raylib.GetPixelDataSize = GetPixelDataSize /** - * Get a piece of a text string - * - * @param {string} text - * @param {number} position - * @param {number} length + * Get the default Font * - * @return {string} The resulting const char *. + * @return {Font} The resulting Font. */ -function TextSubtext (text, position, length) { - return r.BindTextSubtext( - text, - position, - length - ) +function GetFontDefault() { + return r.BindGetFontDefault() } -raylib.TextSubtext = TextSubtext +raylib.GetFontDefault = GetFontDefault /** - * Replace text string (WARNING: memory must be freed!) + * Load font from file into GPU memory (VRAM) * - * @param {string} text - * @param {string} replace - * @param {string} by + * @param {string} fileName * - * @return {string} The resulting char *. + * @return {Font} The resulting Font. */ -function TextReplace (text, replace, by) { - return r.BindTextReplace( - text, - replace, - by +function LoadFont(fileName) { + return r.BindLoadFont( + fileName ) } -raylib.TextReplace = TextReplace +raylib.LoadFont = LoadFont /** - * Insert text in a position (WARNING: memory must be freed!) + * Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height * - * @param {string} text - * @param {string} insert - * @param {number} position + * @param {string} fileName + * @param {number} fontSize + * @param {number} codepoints + * @param {number} codepointCount * - * @return {string} The resulting char *. + * @return {Font} The resulting Font. */ -function TextInsert (text, insert, position) { - return r.BindTextInsert( - text, - insert, - position +function LoadFontEx(fileName, fontSize, codepoints, codepointCount) { + return r.BindLoadFontEx( + fileName, + fontSize, + codepoints, + codepointCount ) } -raylib.TextInsert = TextInsert +raylib.LoadFontEx = LoadFontEx /** - * Join text strings with delimiter + * Load font from Image (XNA style) * - * @param {number} textList - * @param {number} count - * @param {string} delimiter + * @param {Image} image + * @param {Color} key + * @param {number} firstChar * - * @return {string} The resulting const char *. + * @return {Font} The resulting Font. */ -function TextJoin (textList, count, delimiter) { - return r.BindTextJoin( - textList, - count, - delimiter +function LoadFontFromImage(image, key, firstChar) { + return r.BindLoadFontFromImage( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + key.r, + key.g, + key.b, + key.a, + firstChar ) } -raylib.TextJoin = TextJoin +raylib.LoadFontFromImage = LoadFontFromImage /** - * Split text into multiple strings + * Load font from memory buffer, fileType refers to extension: i.e. '.ttf' * - * @param {string} text - * @param {string} delimiter - * @param {number} count + * @param {string} fileType + * @param {Buffer} fileData + * @param {number} dataSize + * @param {number} fontSize + * @param {number} codepoints + * @param {number} codepointCount * - * @return {number} The resulting const char **. + * @return {Font} The resulting Font. */ -function TextSplit (text, delimiter, count) { - return r.BindTextSplit( - text, - delimiter, - count +function LoadFontFromMemory(fileType, fileData, dataSize, fontSize, codepoints, codepointCount) { + return r.BindLoadFontFromMemory( + fileType, + fileData, + dataSize, + fontSize, + codepoints, + codepointCount ) } -raylib.TextSplit = TextSplit +raylib.LoadFontFromMemory = LoadFontFromMemory /** - * Append text at specific position and move cursor! + * Check if a font is valid (font data loaded, WARNING: GPU texture not checked) * - * @param {string} text - * @param {string} append - * @param {number} position + * @param {Font} font * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function TextAppend (text, append, position) { - return r.BindTextAppend( - text, - append, - position +function IsFontValid(font) { + return r.BindIsFontValid( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs ) } -raylib.TextAppend = TextAppend +raylib.IsFontValid = IsFontValid /** - * Find first text occurrence within a string + * Load font data for further use * - * @param {string} text - * @param {string} find + * @param {Buffer} fileData + * @param {number} dataSize + * @param {number} fontSize + * @param {number} codepoints + * @param {number} codepointCount + * @param {number} type * - * @return {number} The resulting int. + * @return {number} The resulting GlyphInfo *. */ -function TextFindIndex (text, find) { - return r.BindTextFindIndex( - text, - find +function LoadFontData(fileData, dataSize, fontSize, codepoints, codepointCount, type) { + return r.BindLoadFontData( + fileData, + dataSize, + fontSize, + codepoints, + codepointCount, + type ) } -raylib.TextFindIndex = TextFindIndex +raylib.LoadFontData = LoadFontData /** - * Get upper case version of provided string + * Generate image font atlas using chars info * - * @param {string} text + * @param {number} glyphs + * @param {number} glyphRecs + * @param {number} glyphCount + * @param {number} fontSize + * @param {number} padding + * @param {number} packMethod * - * @return {string} The resulting const char *. + * @return {Image} The resulting Image. */ -function TextToUpper (text) { - return r.BindTextToUpper( - text +function GenImageFontAtlas(glyphs, glyphRecs, glyphCount, fontSize, padding, packMethod) { + return r.BindGenImageFontAtlas( + glyphs, + glyphRecs, + glyphCount, + fontSize, + padding, + packMethod ) } -raylib.TextToUpper = TextToUpper +raylib.GenImageFontAtlas = GenImageFontAtlas /** - * Get lower case version of provided string + * Unload font chars info data (RAM) * - * @param {string} text + * @param {number} glyphs + * @param {number} glyphCount * - * @return {string} The resulting const char *. + * @return {undefined} */ -function TextToLower (text) { - return r.BindTextToLower( - text +function UnloadFontData(glyphs, glyphCount) { + return r.BindUnloadFontData( + glyphs, + glyphCount ) } -raylib.TextToLower = TextToLower +raylib.UnloadFontData = UnloadFontData /** - * Get Pascal case notation version of provided string + * Unload font from GPU memory (VRAM) * - * @param {string} text + * @param {Font} font * - * @return {string} The resulting const char *. + * @return {undefined} */ -function TextToPascal (text) { - return r.BindTextToPascal( - text +function UnloadFont(font) { + return r.BindUnloadFont( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs ) } -raylib.TextToPascal = TextToPascal +raylib.UnloadFont = UnloadFont /** - * Get integer value from text (negative values not supported) + * Export font as code file, returns true on success * - * @param {string} text + * @param {Font} font + * @param {string} fileName * - * @return {number} The resulting int. + * @return {boolean} The resulting bool. */ -function TextToInteger (text) { - return r.BindTextToInteger( - text +function ExportFontAsCode(font, fileName) { + return r.BindExportFontAsCode( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + fileName ) } -raylib.TextToInteger = TextToInteger +raylib.ExportFontAsCode = ExportFontAsCode /** - * Draw a line in 3D world space + * Draw current FPS * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {Color} color + * @param {number} posX + * @param {number} posY * * @return {undefined} */ -function DrawLine3D (startPos, endPos, color) { - return r.BindDrawLine3D( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - color.r, - color.g, - color.b, - color.a +function DrawFPS(posX, posY) { + return r.BindDrawFPS( + posX, + posY ) } -raylib.DrawLine3D = DrawLine3D +raylib.DrawFPS = DrawFPS /** - * Draw a point in 3D space, actually a small line + * Draw text (using default font) * - * @param {Vector3} position + * @param {string} text + * @param {number} posX + * @param {number} posY + * @param {number} fontSize * @param {Color} color * * @return {undefined} */ -function DrawPoint3D (position, color) { - return r.BindDrawPoint3D( - position.x, - position.y, - position.z, +function DrawText(text, posX, posY, fontSize, color) { + return r.BindDrawText( + text, + posX, + posY, + fontSize, color.r, color.g, color.b, color.a ) } -raylib.DrawPoint3D = DrawPoint3D +raylib.DrawText = DrawText /** - * Draw a circle in 3D world space + * Draw text using font and additional parameters * - * @param {Vector3} center - * @param {number} radius - * @param {Vector3} rotationAxis - * @param {number} rotationAngle - * @param {Color} color + * @param {Font} font + * @param {string} text + * @param {Vector2} position + * @param {number} fontSize + * @param {number} spacing + * @param {Color} tint * * @return {undefined} */ -function DrawCircle3D (center, radius, rotationAxis, rotationAngle, color) { - return r.BindDrawCircle3D( - center.x, - center.y, - center.z, - radius, - rotationAxis.x, - rotationAxis.y, - rotationAxis.z, - rotationAngle, - color.r, - color.g, - color.b, - color.a +function DrawTextEx(font, text, position, fontSize, spacing, tint) { + return r.BindDrawTextEx( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + text, + position.x, + position.y, + fontSize, + spacing, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawCircle3D = DrawCircle3D +raylib.DrawTextEx = DrawTextEx /** - * Draw a color-filled triangle (vertex in counter-clockwise order!) + * Draw text using Font and pro parameters (rotation) * - * @param {Vector3} v1 - * @param {Vector3} v2 - * @param {Vector3} v3 - * @param {Color} color + * @param {Font} font + * @param {string} text + * @param {Vector2} position + * @param {Vector2} origin + * @param {number} rotation + * @param {number} fontSize + * @param {number} spacing + * @param {Color} tint * * @return {undefined} */ -function DrawTriangle3D (v1, v2, v3, color) { - return r.BindDrawTriangle3D( - v1.x, - v1.y, - v1.z, - v2.x, - v2.y, - v2.z, - v3.x, - v3.y, - v3.z, - color.r, - color.g, - color.b, - color.a +function DrawTextPro(font, text, position, origin, rotation, fontSize, spacing, tint) { + return r.BindDrawTextPro( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + text, + position.x, + position.y, + origin.x, + origin.y, + rotation, + fontSize, + spacing, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawTriangle3D = DrawTriangle3D +raylib.DrawTextPro = DrawTextPro /** - * Draw a triangle strip defined by points + * Draw one character (codepoint) * - * @param {number} points - * @param {number} pointCount - * @param {Color} color + * @param {Font} font + * @param {number} codepoint + * @param {Vector2} position + * @param {number} fontSize + * @param {Color} tint * * @return {undefined} */ -function DrawTriangleStrip3D (points, pointCount, color) { - return r.BindDrawTriangleStrip3D( - points, - pointCount, - color.r, - color.g, - color.b, - color.a +function DrawTextCodepoint(font, codepoint, position, fontSize, tint) { + return r.BindDrawTextCodepoint( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoint, + position.x, + position.y, + fontSize, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawTriangleStrip3D = DrawTriangleStrip3D +raylib.DrawTextCodepoint = DrawTextCodepoint /** - * Draw cube + * Draw multiple character (codepoint) * - * @param {Vector3} position - * @param {number} width - * @param {number} height - * @param {number} length - * @param {Color} color + * @param {Font} font + * @param {number} codepoints + * @param {number} codepointCount + * @param {Vector2} position + * @param {number} fontSize + * @param {number} spacing + * @param {Color} tint * * @return {undefined} */ -function DrawCube (position, width, height, length, color) { - return r.BindDrawCube( +function DrawTextCodepoints(font, codepoints, codepointCount, position, fontSize, spacing, tint) { + return r.BindDrawTextCodepoints( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoints, + codepointCount, position.x, position.y, - position.z, - width, - height, - length, - color.r, - color.g, - color.b, - color.a + fontSize, + spacing, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawCube = DrawCube +raylib.DrawTextCodepoints = DrawTextCodepoints /** - * Draw cube (Vector version) + * Set vertical line spacing when drawing with line-breaks * - * @param {Vector3} position - * @param {Vector3} size - * @param {Color} color + * @param {number} spacing * * @return {undefined} */ -function DrawCubeV (position, size, color) { - return r.BindDrawCubeV( - position.x, - position.y, - position.z, - size.x, - size.y, - size.z, - color.r, - color.g, - color.b, - color.a +function SetTextLineSpacing(spacing) { + return r.BindSetTextLineSpacing( + spacing ) } -raylib.DrawCubeV = DrawCubeV +raylib.SetTextLineSpacing = SetTextLineSpacing /** - * Draw cube wires + * Measure string width for default font * - * @param {Vector3} position - * @param {number} width - * @param {number} height - * @param {number} length - * @param {Color} color + * @param {string} text + * @param {number} fontSize * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawCubeWires (position, width, height, length, color) { - return r.BindDrawCubeWires( - position.x, - position.y, - position.z, - width, - height, - length, - color.r, - color.g, - color.b, - color.a +function MeasureText(text, fontSize) { + return r.BindMeasureText( + text, + fontSize ) } -raylib.DrawCubeWires = DrawCubeWires +raylib.MeasureText = MeasureText /** - * Draw cube wires (Vector version) + * Measure string size for Font * - * @param {Vector3} position - * @param {Vector3} size - * @param {Color} color + * @param {Font} font + * @param {string} text + * @param {number} fontSize + * @param {number} spacing * - * @return {undefined} + * @return {Vector2} The resulting Vector2. */ -function DrawCubeWiresV (position, size, color) { - return r.BindDrawCubeWiresV( - position.x, - position.y, - position.z, - size.x, - size.y, - size.z, - color.r, - color.g, - color.b, - color.a +function MeasureTextEx(font, text, fontSize, spacing) { + return r.BindMeasureTextEx( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + text, + fontSize, + spacing ) } -raylib.DrawCubeWiresV = DrawCubeWiresV +raylib.MeasureTextEx = MeasureTextEx /** - * Draw sphere + * Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found * - * @param {Vector3} centerPos - * @param {number} radius - * @param {Color} color + * @param {Font} font + * @param {number} codepoint * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawSphere (centerPos, radius, color) { - return r.BindDrawSphere( - centerPos.x, - centerPos.y, - centerPos.z, - radius, - color.r, - color.g, - color.b, - color.a +function GetGlyphIndex(font, codepoint) { + return r.BindGetGlyphIndex( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoint ) } -raylib.DrawSphere = DrawSphere +raylib.GetGlyphIndex = GetGlyphIndex /** - * Draw sphere with extended parameters + * Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found * - * @param {Vector3} centerPos - * @param {number} radius - * @param {number} rings - * @param {number} slices - * @param {Color} color + * @param {Font} font + * @param {number} codepoint * - * @return {undefined} + * @return {GlyphInfo} The resulting GlyphInfo. */ -function DrawSphereEx (centerPos, radius, rings, slices, color) { - return r.BindDrawSphereEx( - centerPos.x, - centerPos.y, - centerPos.z, - radius, - rings, - slices, - color.r, - color.g, - color.b, - color.a +function GetGlyphInfo(font, codepoint) { + return r.BindGetGlyphInfo( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoint ) } -raylib.DrawSphereEx = DrawSphereEx +raylib.GetGlyphInfo = GetGlyphInfo /** - * Draw sphere wires + * Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found * - * @param {Vector3} centerPos - * @param {number} radius - * @param {number} rings - * @param {number} slices - * @param {Color} color + * @param {Font} font + * @param {number} codepoint * - * @return {undefined} + * @return {Rectangle} The resulting Rectangle. */ -function DrawSphereWires (centerPos, radius, rings, slices, color) { - return r.BindDrawSphereWires( - centerPos.x, - centerPos.y, - centerPos.z, - radius, - rings, - slices, - color.r, - color.g, - color.b, - color.a +function GetGlyphAtlasRec(font, codepoint) { + return r.BindGetGlyphAtlasRec( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoint ) } -raylib.DrawSphereWires = DrawSphereWires +raylib.GetGlyphAtlasRec = GetGlyphAtlasRec /** - * Draw a cylinder/cone + * Load UTF-8 text encoded from codepoints array * - * @param {Vector3} position - * @param {number} radiusTop - * @param {number} radiusBottom - * @param {number} height - * @param {number} slices - * @param {Color} color + * @param {number} codepoints + * @param {number} length * - * @return {undefined} + * @return {string} The resulting char *. */ -function DrawCylinder (position, radiusTop, radiusBottom, height, slices, color) { - return r.BindDrawCylinder( - position.x, - position.y, - position.z, - radiusTop, - radiusBottom, - height, - slices, - color.r, - color.g, - color.b, - color.a +function LoadUTF8(codepoints, length) { + return r.BindLoadUTF8( + codepoints, + length ) } -raylib.DrawCylinder = DrawCylinder +raylib.LoadUTF8 = LoadUTF8 /** - * Draw a cylinder with base at startPos and top at endPos + * Unload UTF-8 text encoded from codepoints array * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {number} startRadius - * @param {number} endRadius - * @param {number} sides - * @param {Color} color + * @param {string} text * * @return {undefined} */ -function DrawCylinderEx (startPos, endPos, startRadius, endRadius, sides, color) { - return r.BindDrawCylinderEx( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - startRadius, - endRadius, - sides, - color.r, - color.g, - color.b, - color.a +function UnloadUTF8(text) { + return r.BindUnloadUTF8( + text ) } -raylib.DrawCylinderEx = DrawCylinderEx +raylib.UnloadUTF8 = UnloadUTF8 /** - * Draw a cylinder/cone wires + * Load all codepoints from a UTF-8 text string, codepoints count returned by parameter * - * @param {Vector3} position - * @param {number} radiusTop - * @param {number} radiusBottom - * @param {number} height - * @param {number} slices - * @param {Color} color + * @param {string} text + * @param {number} count * - * @return {undefined} + * @return {number} The resulting int *. */ -function DrawCylinderWires (position, radiusTop, radiusBottom, height, slices, color) { - return r.BindDrawCylinderWires( - position.x, - position.y, - position.z, - radiusTop, - radiusBottom, - height, - slices, - color.r, - color.g, - color.b, - color.a +function LoadCodepoints(text, count) { + return r.BindLoadCodepoints( + text, + count ) } -raylib.DrawCylinderWires = DrawCylinderWires +raylib.LoadCodepoints = LoadCodepoints /** - * Draw a cylinder wires with base at startPos and top at endPos + * Unload codepoints data from memory * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {number} startRadius - * @param {number} endRadius - * @param {number} sides - * @param {Color} color + * @param {number} codepoints * * @return {undefined} */ -function DrawCylinderWiresEx (startPos, endPos, startRadius, endRadius, sides, color) { - return r.BindDrawCylinderWiresEx( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - startRadius, - endRadius, - sides, - color.r, - color.g, - color.b, - color.a +function UnloadCodepoints(codepoints) { + return r.BindUnloadCodepoints( + codepoints ) } -raylib.DrawCylinderWiresEx = DrawCylinderWiresEx +raylib.UnloadCodepoints = UnloadCodepoints /** - * Draw a capsule with the center of its sphere caps at startPos and endPos + * Get total number of codepoints in a UTF-8 encoded string * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {number} radius - * @param {number} slices - * @param {number} rings - * @param {Color} color + * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawCapsule (startPos, endPos, radius, slices, rings, color) { - return r.BindDrawCapsule( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - radius, - slices, - rings, - color.r, - color.g, - color.b, - color.a +function GetCodepointCount(text) { + return r.BindGetCodepointCount( + text ) } -raylib.DrawCapsule = DrawCapsule +raylib.GetCodepointCount = GetCodepointCount /** - * Draw capsule wireframe with the center of its sphere caps at startPos and endPos + * Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {number} radius - * @param {number} slices - * @param {number} rings - * @param {Color} color + * @param {string} text + * @param {number} codepointSize * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawCapsuleWires (startPos, endPos, radius, slices, rings, color) { - return r.BindDrawCapsuleWires( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - radius, - slices, - rings, - color.r, - color.g, - color.b, - color.a +function GetCodepoint(text, codepointSize) { + return r.BindGetCodepoint( + text, + codepointSize ) } -raylib.DrawCapsuleWires = DrawCapsuleWires +raylib.GetCodepoint = GetCodepoint /** - * Draw a plane XZ + * Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure * - * @param {Vector3} centerPos - * @param {Vector2} size - * @param {Color} color + * @param {string} text + * @param {number} codepointSize * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawPlane (centerPos, size, color) { - return r.BindDrawPlane( - centerPos.x, - centerPos.y, - centerPos.z, - size.x, - size.y, - color.r, - color.g, - color.b, - color.a +function GetCodepointNext(text, codepointSize) { + return r.BindGetCodepointNext( + text, + codepointSize ) } -raylib.DrawPlane = DrawPlane +raylib.GetCodepointNext = GetCodepointNext /** - * Draw a ray line + * Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure * - * @param {Ray} ray - * @param {Color} color + * @param {string} text + * @param {number} codepointSize * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawRay (ray, color) { - return r.BindDrawRay( - ray.position.x, - ray.position.y, - ray.position.z, - ray.direction.x, - ray.direction.y, - ray.direction.z, - color.r, - color.g, - color.b, - color.a +function GetCodepointPrevious(text, codepointSize) { + return r.BindGetCodepointPrevious( + text, + codepointSize ) } -raylib.DrawRay = DrawRay +raylib.GetCodepointPrevious = GetCodepointPrevious /** - * Draw a grid (centered at (0, 0, 0)) + * Encode one codepoint into UTF-8 byte array (array length returned as parameter) * - * @param {number} slices - * @param {number} spacing + * @param {number} codepoint + * @param {number} utf8Size * - * @return {undefined} + * @return {string} The resulting const char *. */ -function DrawGrid (slices, spacing) { - return r.BindDrawGrid( - slices, - spacing +function CodepointToUTF8(codepoint, utf8Size) { + return r.BindCodepointToUTF8( + codepoint, + utf8Size ) } -raylib.DrawGrid = DrawGrid +raylib.CodepointToUTF8 = CodepointToUTF8 /** - * Load model from files (meshes and materials) + * Copy one string to another, returns bytes copied * - * @param {string} fileName + * @param {string} dst + * @param {string} src * - * @return {Model} The resulting Model. + * @return {number} The resulting int. */ -function LoadModel (fileName) { - return r.BindLoadModel( - fileName +function TextCopy(dst, src) { + return r.BindTextCopy( + dst, + src ) } -raylib.LoadModel = LoadModel +raylib.TextCopy = TextCopy /** - * Load model from generated mesh (default material) + * Check if two text string are equal * - * @param {Mesh} mesh + * @param {string} text1 + * @param {string} text2 * - * @return {Model} The resulting Model. + * @return {boolean} The resulting bool. */ -function LoadModelFromMesh (mesh) { - return r.BindLoadModelFromMesh( - mesh.vertexCount, - mesh.triangleCount, - mesh.vertices, - mesh.texcoords, - mesh.texcoords2, - mesh.normals, - mesh.tangents, - mesh.colors, - mesh.indices, - mesh.animVertices, - mesh.animNormals, - mesh.boneIds, - mesh.boneWeights, - mesh.vaoId, - mesh.vboId +function TextIsEqual(text1, text2) { + return r.BindTextIsEqual( + text1, + text2 ) } -raylib.LoadModelFromMesh = LoadModelFromMesh +raylib.TextIsEqual = TextIsEqual /** - * Check if a model is ready + * Get text length, checks for '\0' ending * - * @param {Model} model + * @param {string} text * - * @return {boolean} The resulting bool. + * @return {number} The resulting unsigned int. */ -function IsModelReady (model) { - return r.BindIsModelReady( - model.transform.m0, - model.transform.m4, - model.transform.m8, - model.transform.m12, - model.transform.m1, - model.transform.m5, - model.transform.m9, - model.transform.m13, - model.transform.m2, - model.transform.m6, - model.transform.m10, - model.transform.m14, - model.transform.m3, - model.transform.m7, - model.transform.m11, - model.transform.m15, - model.meshCount, - model.materialCount, - model.meshes, - model.materials, - model.meshMaterial, - model.boneCount, - model.bones, - model.bindPose +function TextLength(text) { + return r.BindTextLength( + text ) } -raylib.IsModelReady = IsModelReady +raylib.TextLength = TextLength /** - * Unload model (including meshes) from memory (RAM and/or VRAM) + * Get a piece of a text string * - * @param {Model} model + * @param {string} text + * @param {number} position + * @param {number} length * - * @return {undefined} + * @return {string} The resulting const char *. */ -function UnloadModel (model) { - return r.BindUnloadModel( - model.transform.m0, - model.transform.m4, - model.transform.m8, - model.transform.m12, - model.transform.m1, - model.transform.m5, - model.transform.m9, - model.transform.m13, - model.transform.m2, - model.transform.m6, - model.transform.m10, - model.transform.m14, - model.transform.m3, - model.transform.m7, - model.transform.m11, - model.transform.m15, - model.meshCount, - model.materialCount, - model.meshes, - model.materials, - model.meshMaterial, - model.boneCount, - model.bones, - model.bindPose +function TextSubtext(text, position, length) { + return r.BindTextSubtext( + text, + position, + length ) } -raylib.UnloadModel = UnloadModel +raylib.TextSubtext = TextSubtext /** - * Compute model bounding box limits (considers all meshes) + * Replace text string (WARNING: memory must be freed!) * - * @param {Model} model + * @param {string} text + * @param {string} replace + * @param {string} by * - * @return {BoundingBox} The resulting BoundingBox. + * @return {string} The resulting char *. */ -function GetModelBoundingBox (model) { - return r.BindGetModelBoundingBox( - model.transform.m0, - model.transform.m4, +function TextReplace(text, replace, by) { + return r.BindTextReplace( + text, + replace, + by + ) +} +raylib.TextReplace = TextReplace + +/** + * Insert text in a position (WARNING: memory must be freed!) + * + * @param {string} text + * @param {string} insert + * @param {number} position + * + * @return {string} The resulting char *. + */ +function TextInsert(text, insert, position) { + return r.BindTextInsert( + text, + insert, + position + ) +} +raylib.TextInsert = TextInsert + +/** + * Join text strings with delimiter + * + * @param {number} textList + * @param {number} count + * @param {string} delimiter + * + * @return {string} The resulting const char *. + */ +function TextJoin(textList, count, delimiter) { + return r.BindTextJoin( + textList, + count, + delimiter + ) +} +raylib.TextJoin = TextJoin + +/** + * Split text into multiple strings + * + * @param {string} text + * @param {string} delimiter + * @param {number} count + * + * @return {number} The resulting const char **. + */ +function TextSplit(text, delimiter, count) { + return r.BindTextSplit( + text, + delimiter, + count + ) +} +raylib.TextSplit = TextSplit + +/** + * Append text at specific position and move cursor! + * + * @param {string} text + * @param {string} append + * @param {number} position + * + * @return {undefined} + */ +function TextAppend(text, append, position) { + return r.BindTextAppend( + text, + append, + position + ) +} +raylib.TextAppend = TextAppend + +/** + * Find first text occurrence within a string + * + * @param {string} text + * @param {string} find + * + * @return {number} The resulting int. + */ +function TextFindIndex(text, find) { + return r.BindTextFindIndex( + text, + find + ) +} +raylib.TextFindIndex = TextFindIndex + +/** + * Get upper case version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToUpper(text) { + return r.BindTextToUpper( + text + ) +} +raylib.TextToUpper = TextToUpper + +/** + * Get lower case version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToLower(text) { + return r.BindTextToLower( + text + ) +} +raylib.TextToLower = TextToLower + +/** + * Get Pascal case notation version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToPascal(text) { + return r.BindTextToPascal( + text + ) +} +raylib.TextToPascal = TextToPascal + +/** + * Get Snake case notation version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToSnake(text) { + return r.BindTextToSnake( + text + ) +} +raylib.TextToSnake = TextToSnake + +/** + * Get Camel case notation version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToCamel(text) { + return r.BindTextToCamel( + text + ) +} +raylib.TextToCamel = TextToCamel + +/** + * Get integer value from text (negative values not supported) + * + * @param {string} text + * + * @return {number} The resulting int. + */ +function TextToInteger(text) { + return r.BindTextToInteger( + text + ) +} +raylib.TextToInteger = TextToInteger + +/** + * Get float value from text (negative values not supported) + * + * @param {string} text + * + * @return {number} The resulting float. + */ +function TextToFloat(text) { + return r.BindTextToFloat( + text + ) +} +raylib.TextToFloat = TextToFloat + +/** + * Draw a line in 3D world space + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {Color} color + * + * @return {undefined} + */ +function DrawLine3D(startPos, endPos, color) { + return r.BindDrawLine3D( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawLine3D = DrawLine3D + +/** + * Draw a point in 3D space, actually a small line + * + * @param {Vector3} position + * @param {Color} color + * + * @return {undefined} + */ +function DrawPoint3D(position, color) { + return r.BindDrawPoint3D( + position.x, + position.y, + position.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawPoint3D = DrawPoint3D + +/** + * Draw a circle in 3D world space + * + * @param {Vector3} center + * @param {number} radius + * @param {Vector3} rotationAxis + * @param {number} rotationAngle + * @param {Color} color + * + * @return {undefined} + */ +function DrawCircle3D(center, radius, rotationAxis, rotationAngle, color) { + return r.BindDrawCircle3D( + center.x, + center.y, + center.z, + radius, + rotationAxis.x, + rotationAxis.y, + rotationAxis.z, + rotationAngle, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCircle3D = DrawCircle3D + +/** + * Draw a color-filled triangle (vertex in counter-clockwise order!) + * + * @param {Vector3} v1 + * @param {Vector3} v2 + * @param {Vector3} v3 + * @param {Color} color + * + * @return {undefined} + */ +function DrawTriangle3D(v1, v2, v3, color) { + return r.BindDrawTriangle3D( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z, + v3.x, + v3.y, + v3.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawTriangle3D = DrawTriangle3D + +/** + * Draw a triangle strip defined by points + * + * @param {number} points + * @param {number} pointCount + * @param {Color} color + * + * @return {undefined} + */ +function DrawTriangleStrip3D(points, pointCount, color) { + return r.BindDrawTriangleStrip3D( + points, + pointCount, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawTriangleStrip3D = DrawTriangleStrip3D + +/** + * Draw cube + * + * @param {Vector3} position + * @param {number} width + * @param {number} height + * @param {number} length + * @param {Color} color + * + * @return {undefined} + */ +function DrawCube(position, width, height, length, color) { + return r.BindDrawCube( + position.x, + position.y, + position.z, + width, + height, + length, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCube = DrawCube + +/** + * Draw cube (Vector version) + * + * @param {Vector3} position + * @param {Vector3} size + * @param {Color} color + * + * @return {undefined} + */ +function DrawCubeV(position, size, color) { + return r.BindDrawCubeV( + position.x, + position.y, + position.z, + size.x, + size.y, + size.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCubeV = DrawCubeV + +/** + * Draw cube wires + * + * @param {Vector3} position + * @param {number} width + * @param {number} height + * @param {number} length + * @param {Color} color + * + * @return {undefined} + */ +function DrawCubeWires(position, width, height, length, color) { + return r.BindDrawCubeWires( + position.x, + position.y, + position.z, + width, + height, + length, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCubeWires = DrawCubeWires + +/** + * Draw cube wires (Vector version) + * + * @param {Vector3} position + * @param {Vector3} size + * @param {Color} color + * + * @return {undefined} + */ +function DrawCubeWiresV(position, size, color) { + return r.BindDrawCubeWiresV( + position.x, + position.y, + position.z, + size.x, + size.y, + size.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCubeWiresV = DrawCubeWiresV + +/** + * Draw sphere + * + * @param {Vector3} centerPos + * @param {number} radius + * @param {Color} color + * + * @return {undefined} + */ +function DrawSphere(centerPos, radius, color) { + return r.BindDrawSphere( + centerPos.x, + centerPos.y, + centerPos.z, + radius, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawSphere = DrawSphere + +/** + * Draw sphere with extended parameters + * + * @param {Vector3} centerPos + * @param {number} radius + * @param {number} rings + * @param {number} slices + * @param {Color} color + * + * @return {undefined} + */ +function DrawSphereEx(centerPos, radius, rings, slices, color) { + return r.BindDrawSphereEx( + centerPos.x, + centerPos.y, + centerPos.z, + radius, + rings, + slices, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawSphereEx = DrawSphereEx + +/** + * Draw sphere wires + * + * @param {Vector3} centerPos + * @param {number} radius + * @param {number} rings + * @param {number} slices + * @param {Color} color + * + * @return {undefined} + */ +function DrawSphereWires(centerPos, radius, rings, slices, color) { + return r.BindDrawSphereWires( + centerPos.x, + centerPos.y, + centerPos.z, + radius, + rings, + slices, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawSphereWires = DrawSphereWires + +/** + * Draw a cylinder/cone + * + * @param {Vector3} position + * @param {number} radiusTop + * @param {number} radiusBottom + * @param {number} height + * @param {number} slices + * @param {Color} color + * + * @return {undefined} + */ +function DrawCylinder(position, radiusTop, radiusBottom, height, slices, color) { + return r.BindDrawCylinder( + position.x, + position.y, + position.z, + radiusTop, + radiusBottom, + height, + slices, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCylinder = DrawCylinder + +/** + * Draw a cylinder with base at startPos and top at endPos + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {number} startRadius + * @param {number} endRadius + * @param {number} sides + * @param {Color} color + * + * @return {undefined} + */ +function DrawCylinderEx(startPos, endPos, startRadius, endRadius, sides, color) { + return r.BindDrawCylinderEx( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + startRadius, + endRadius, + sides, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCylinderEx = DrawCylinderEx + +/** + * Draw a cylinder/cone wires + * + * @param {Vector3} position + * @param {number} radiusTop + * @param {number} radiusBottom + * @param {number} height + * @param {number} slices + * @param {Color} color + * + * @return {undefined} + */ +function DrawCylinderWires(position, radiusTop, radiusBottom, height, slices, color) { + return r.BindDrawCylinderWires( + position.x, + position.y, + position.z, + radiusTop, + radiusBottom, + height, + slices, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCylinderWires = DrawCylinderWires + +/** + * Draw a cylinder wires with base at startPos and top at endPos + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {number} startRadius + * @param {number} endRadius + * @param {number} sides + * @param {Color} color + * + * @return {undefined} + */ +function DrawCylinderWiresEx(startPos, endPos, startRadius, endRadius, sides, color) { + return r.BindDrawCylinderWiresEx( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + startRadius, + endRadius, + sides, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCylinderWiresEx = DrawCylinderWiresEx + +/** + * Draw a capsule with the center of its sphere caps at startPos and endPos + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {number} radius + * @param {number} slices + * @param {number} rings + * @param {Color} color + * + * @return {undefined} + */ +function DrawCapsule(startPos, endPos, radius, slices, rings, color) { + return r.BindDrawCapsule( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + radius, + slices, + rings, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCapsule = DrawCapsule + +/** + * Draw capsule wireframe with the center of its sphere caps at startPos and endPos + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {number} radius + * @param {number} slices + * @param {number} rings + * @param {Color} color + * + * @return {undefined} + */ +function DrawCapsuleWires(startPos, endPos, radius, slices, rings, color) { + return r.BindDrawCapsuleWires( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + radius, + slices, + rings, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCapsuleWires = DrawCapsuleWires + +/** + * Draw a plane XZ + * + * @param {Vector3} centerPos + * @param {Vector2} size + * @param {Color} color + * + * @return {undefined} + */ +function DrawPlane(centerPos, size, color) { + return r.BindDrawPlane( + centerPos.x, + centerPos.y, + centerPos.z, + size.x, + size.y, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawPlane = DrawPlane + +/** + * Draw a ray line + * + * @param {Ray} ray + * @param {Color} color + * + * @return {undefined} + */ +function DrawRay(ray, color) { + return r.BindDrawRay( + ray.position.x, + ray.position.y, + ray.position.z, + ray.direction.x, + ray.direction.y, + ray.direction.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawRay = DrawRay + +/** + * Draw a grid (centered at (0, 0, 0)) + * + * @param {number} slices + * @param {number} spacing + * + * @return {undefined} + */ +function DrawGrid(slices, spacing) { + return r.BindDrawGrid( + slices, + spacing + ) +} +raylib.DrawGrid = DrawGrid + +/** + * Load model from files (meshes and materials) + * + * @param {string} fileName + * + * @return {Model} The resulting Model. + */ +function LoadModel(fileName) { + return r.BindLoadModel( + fileName + ) +} +raylib.LoadModel = LoadModel + +/** + * Load model from generated mesh (default material) + * + * @param {Mesh} mesh + * + * @return {Model} The resulting Model. + */ +function LoadModelFromMesh(mesh) { + return r.BindLoadModelFromMesh( + mesh.vertexCount, + mesh.triangleCount, + mesh.vertices, + mesh.texcoords, + mesh.texcoords2, + mesh.normals, + mesh.tangents, + mesh.colors, + mesh.indices, + mesh.animVertices, + mesh.animNormals, + mesh.boneIds, + mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, + mesh.vaoId, + mesh.vboId + ) +} +raylib.LoadModelFromMesh = LoadModelFromMesh + +/** + * Check if a model is valid (loaded in GPU, VAO/VBOs) + * + * @param {Model} model + * + * @return {boolean} The resulting bool. + */ +function IsModelValid(model) { + return r.BindIsModelValid( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose + ) +} +raylib.IsModelValid = IsModelValid + +/** + * Unload model (including meshes) from memory (RAM and/or VRAM) + * + * @param {Model} model + * + * @return {undefined} + */ +function UnloadModel(model) { + return r.BindUnloadModel( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose + ) +} +raylib.UnloadModel = UnloadModel + +/** + * Compute model bounding box limits (considers all meshes) + * + * @param {Model} model + * + * @return {BoundingBox} The resulting BoundingBox. + */ +function GetModelBoundingBox(model) { + return r.BindGetModelBoundingBox( + model.transform.m0, + model.transform.m4, model.transform.m8, model.transform.m12, model.transform.m1, @@ -6593,7 +7709,7 @@ raylib.GetModelBoundingBox = GetModelBoundingBox * * @return {undefined} */ -function DrawModel (model, position, scale, tint) { +function DrawModel(model, position, scale, tint) { return r.BindDrawModel( model.transform.m0, model.transform.m4, @@ -6643,7 +7759,7 @@ raylib.DrawModel = DrawModel * * @return {undefined} */ -function DrawModelEx (model, position, rotationAxis, rotationAngle, scale, tint) { +function DrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint) { return r.BindDrawModelEx( model.transform.m0, model.transform.m4, @@ -6697,7 +7813,7 @@ raylib.DrawModelEx = DrawModelEx * * @return {undefined} */ -function DrawModelWires (model, position, scale, tint) { +function DrawModelWires(model, position, scale, tint) { return r.BindDrawModelWires( model.transform.m0, model.transform.m4, @@ -6747,7 +7863,7 @@ raylib.DrawModelWires = DrawModelWires * * @return {undefined} */ -function DrawModelWiresEx (model, position, rotationAxis, rotationAngle, scale, tint) { +function DrawModelWiresEx(model, position, rotationAxis, rotationAngle, scale, tint) { return r.BindDrawModelWiresEx( model.transform.m0, model.transform.m4, @@ -6791,6 +7907,110 @@ function DrawModelWiresEx (model, position, rotationAxis, rotationAngle, scale, } raylib.DrawModelWiresEx = DrawModelWiresEx +/** + * Draw a model as points + * + * @param {Model} model + * @param {Vector3} position + * @param {number} scale + * @param {Color} tint + * + * @return {undefined} + */ +function DrawModelPoints(model, position, scale, tint) { + return r.BindDrawModelPoints( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose, + position.x, + position.y, + position.z, + scale, + tint.r, + tint.g, + tint.b, + tint.a + ) +} +raylib.DrawModelPoints = DrawModelPoints + +/** + * Draw a model as points with extended parameters + * + * @param {Model} model + * @param {Vector3} position + * @param {Vector3} rotationAxis + * @param {number} rotationAngle + * @param {Vector3} scale + * @param {Color} tint + * + * @return {undefined} + */ +function DrawModelPointsEx(model, position, rotationAxis, rotationAngle, scale, tint) { + return r.BindDrawModelPointsEx( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose, + position.x, + position.y, + position.z, + rotationAxis.x, + rotationAxis.y, + rotationAxis.z, + rotationAngle, + scale.x, + scale.y, + scale.z, + tint.r, + tint.g, + tint.b, + tint.a + ) +} +raylib.DrawModelPointsEx = DrawModelPointsEx + /** * Draw bounding box (wires) * @@ -6799,7 +8019,7 @@ raylib.DrawModelWiresEx = DrawModelWiresEx * * @return {undefined} */ -function DrawBoundingBox (box, color) { +function DrawBoundingBox(box, color) { return r.BindDrawBoundingBox( box.min.x, box.min.y, @@ -6821,12 +8041,12 @@ raylib.DrawBoundingBox = DrawBoundingBox * @param {Camera} camera * @param {Texture2D} texture * @param {Vector3} position - * @param {number} size + * @param {number} scale * @param {Color} tint * * @return {undefined} */ -function DrawBillboard (camera, texture, position, size, tint) { +function DrawBillboard(camera, texture, position, scale, tint) { return r.BindDrawBillboard( camera.position.x, camera.position.y, @@ -6847,7 +8067,7 @@ function DrawBillboard (camera, texture, position, size, tint) { position.x, position.y, position.z, - size, + scale, tint.r, tint.g, tint.b, @@ -6868,7 +8088,7 @@ raylib.DrawBillboard = DrawBillboard * * @return {undefined} */ -function DrawBillboardRec (camera, texture, source, position, size, tint) { +function DrawBillboardRec(camera, texture, source, position, size, tint) { return r.BindDrawBillboardRec( camera.position.x, camera.position.y, @@ -6918,7 +8138,7 @@ raylib.DrawBillboardRec = DrawBillboardRec * * @return {undefined} */ -function DrawBillboardPro (camera, texture, source, position, up, size, origin, rotation, tint) { +function DrawBillboardPro(camera, texture, source, position, up, size, origin, rotation, tint) { return r.BindDrawBillboardPro( camera.position.x, camera.position.y, @@ -6970,7 +8190,7 @@ raylib.DrawBillboardPro = DrawBillboardPro * * @return {undefined} */ -function UpdateMeshBuffer (mesh, index, data, dataSize, offset) { +function UpdateMeshBuffer(mesh, index, data, dataSize, offset) { return r.BindUpdateMeshBuffer( mesh.vertexCount, mesh.triangleCount, @@ -6985,6 +8205,8 @@ function UpdateMeshBuffer (mesh, index, data, dataSize, offset) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId, index, @@ -7002,7 +8224,7 @@ raylib.UpdateMeshBuffer = UpdateMeshBuffer * * @return {undefined} */ -function UnloadMesh (mesh) { +function UnloadMesh(mesh) { return r.BindUnloadMesh( mesh.vertexCount, mesh.triangleCount, @@ -7017,12 +8239,44 @@ function UnloadMesh (mesh) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId ) } raylib.UnloadMesh = UnloadMesh +/** + * Compute mesh bounding box limits + * + * @param {Mesh} mesh + * + * @return {BoundingBox} The resulting BoundingBox. + */ +function GetMeshBoundingBox(mesh) { + return r.BindGetMeshBoundingBox( + mesh.vertexCount, + mesh.triangleCount, + mesh.vertices, + mesh.texcoords, + mesh.texcoords2, + mesh.normals, + mesh.tangents, + mesh.colors, + mesh.indices, + mesh.animVertices, + mesh.animNormals, + mesh.boneIds, + mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, + mesh.vaoId, + mesh.vboId + ) +} +raylib.GetMeshBoundingBox = GetMeshBoundingBox + /** * Export mesh data to file, returns true on success * @@ -7031,7 +8285,7 @@ raylib.UnloadMesh = UnloadMesh * * @return {boolean} The resulting bool. */ -function ExportMesh (mesh, fileName) { +function ExportMesh(mesh, fileName) { return r.BindExportMesh( mesh.vertexCount, mesh.triangleCount, @@ -7046,6 +8300,8 @@ function ExportMesh (mesh, fileName) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId, fileName @@ -7054,14 +8310,15 @@ function ExportMesh (mesh, fileName) { raylib.ExportMesh = ExportMesh /** - * Compute mesh bounding box limits + * Export mesh as code file (.h) defining multiple arrays of vertex attributes * * @param {Mesh} mesh + * @param {string} fileName * - * @return {BoundingBox} The resulting BoundingBox. + * @return {boolean} The resulting bool. */ -function GetMeshBoundingBox (mesh) { - return r.BindGetMeshBoundingBox( +function ExportMeshAsCode(mesh, fileName) { + return r.BindExportMeshAsCode( mesh.vertexCount, mesh.triangleCount, mesh.vertices, @@ -7075,11 +8332,14 @@ function GetMeshBoundingBox (mesh) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, - mesh.vboId + mesh.vboId, + fileName ) } -raylib.GetMeshBoundingBox = GetMeshBoundingBox +raylib.ExportMeshAsCode = ExportMeshAsCode /** * Generate polygonal mesh @@ -7089,7 +8349,7 @@ raylib.GetMeshBoundingBox = GetMeshBoundingBox * * @return {Mesh} The resulting Mesh. */ -function GenMeshPoly (sides, radius) { +function GenMeshPoly(sides, radius) { return r.BindGenMeshPoly( sides, radius @@ -7107,7 +8367,7 @@ raylib.GenMeshPoly = GenMeshPoly * * @return {Mesh} The resulting Mesh. */ -function GenMeshPlane (width, length, resX, resZ) { +function GenMeshPlane(width, length, resX, resZ) { return r.BindGenMeshPlane( width, length, @@ -7126,7 +8386,7 @@ raylib.GenMeshPlane = GenMeshPlane * * @return {Mesh} The resulting Mesh. */ -function GenMeshCube (width, height, length) { +function GenMeshCube(width, height, length) { return r.BindGenMeshCube( width, height, @@ -7144,7 +8404,7 @@ raylib.GenMeshCube = GenMeshCube * * @return {Mesh} The resulting Mesh. */ -function GenMeshSphere (radius, rings, slices) { +function GenMeshSphere(radius, rings, slices) { return r.BindGenMeshSphere( radius, rings, @@ -7162,7 +8422,7 @@ raylib.GenMeshSphere = GenMeshSphere * * @return {Mesh} The resulting Mesh. */ -function GenMeshHemiSphere (radius, rings, slices) { +function GenMeshHemiSphere(radius, rings, slices) { return r.BindGenMeshHemiSphere( radius, rings, @@ -7180,7 +8440,7 @@ raylib.GenMeshHemiSphere = GenMeshHemiSphere * * @return {Mesh} The resulting Mesh. */ -function GenMeshCylinder (radius, height, slices) { +function GenMeshCylinder(radius, height, slices) { return r.BindGenMeshCylinder( radius, height, @@ -7198,7 +8458,7 @@ raylib.GenMeshCylinder = GenMeshCylinder * * @return {Mesh} The resulting Mesh. */ -function GenMeshCone (radius, height, slices) { +function GenMeshCone(radius, height, slices) { return r.BindGenMeshCone( radius, height, @@ -7217,7 +8477,7 @@ raylib.GenMeshCone = GenMeshCone * * @return {Mesh} The resulting Mesh. */ -function GenMeshTorus (radius, size, radSeg, sides) { +function GenMeshTorus(radius, size, radSeg, sides) { return r.BindGenMeshTorus( radius, size, @@ -7237,7 +8497,7 @@ raylib.GenMeshTorus = GenMeshTorus * * @return {Mesh} The resulting Mesh. */ -function GenMeshKnot (radius, size, radSeg, sides) { +function GenMeshKnot(radius, size, radSeg, sides) { return r.BindGenMeshKnot( radius, size, @@ -7255,7 +8515,7 @@ raylib.GenMeshKnot = GenMeshKnot * * @return {Mesh} The resulting Mesh. */ -function GenMeshHeightmap (heightmap, size) { +function GenMeshHeightmap(heightmap, size) { return r.BindGenMeshHeightmap( heightmap.data, heightmap.width, @@ -7277,7 +8537,7 @@ raylib.GenMeshHeightmap = GenMeshHeightmap * * @return {Mesh} The resulting Mesh. */ -function GenMeshCubicmap (cubicmap, cubeSize) { +function GenMeshCubicmap(cubicmap, cubeSize) { return r.BindGenMeshCubicmap( cubicmap.data, cubicmap.width, @@ -7299,7 +8559,7 @@ raylib.GenMeshCubicmap = GenMeshCubicmap * * @return {number} The resulting ModelAnimation *. */ -function LoadModelAnimations (fileName, animCount) { +function LoadModelAnimations(fileName, animCount) { return r.BindLoadModelAnimations( fileName, animCount @@ -7308,7 +8568,7 @@ function LoadModelAnimations (fileName, animCount) { raylib.LoadModelAnimations = LoadModelAnimations /** - * Update model animation pose + * Update model animation pose (CPU) * * @param {Model} model * @param {ModelAnimation} anim @@ -7316,7 +8576,7 @@ raylib.LoadModelAnimations = LoadModelAnimations * * @return {undefined} */ -function UpdateModelAnimation (model, anim, frame) { +function UpdateModelAnimation(model, anim, frame) { return r.BindUpdateModelAnimation( model.transform.m0, model.transform.m4, @@ -7346,11 +8606,57 @@ function UpdateModelAnimation (model, anim, frame) { anim.frameCount, anim.bones, anim.framePoses, + anim.name, frame ) } raylib.UpdateModelAnimation = UpdateModelAnimation +/** + * Update model animation mesh bone matrices (GPU skinning) + * + * @param {Model} model + * @param {ModelAnimation} anim + * @param {number} frame + * + * @return {undefined} + */ +function UpdateModelAnimationBones(model, anim, frame) { + return r.BindUpdateModelAnimationBones( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose, + anim.boneCount, + anim.frameCount, + anim.bones, + anim.framePoses, + anim.name, + frame + ) +} +raylib.UpdateModelAnimationBones = UpdateModelAnimationBones + /** * Unload animation data * @@ -7358,12 +8664,13 @@ raylib.UpdateModelAnimation = UpdateModelAnimation * * @return {undefined} */ -function UnloadModelAnimation (anim) { +function UnloadModelAnimation(anim) { return r.BindUnloadModelAnimation( anim.boneCount, anim.frameCount, anim.bones, - anim.framePoses + anim.framePoses, + anim.name ) } raylib.UnloadModelAnimation = UnloadModelAnimation @@ -7372,14 +8679,14 @@ raylib.UnloadModelAnimation = UnloadModelAnimation * Unload animation array data * * @param {number} animations - * @param {number} count + * @param {number} animCount * * @return {undefined} */ -function UnloadModelAnimations (animations, count) { +function UnloadModelAnimations(animations, animCount) { return r.BindUnloadModelAnimations( animations, - count + animCount ) } raylib.UnloadModelAnimations = UnloadModelAnimations @@ -7392,7 +8699,7 @@ raylib.UnloadModelAnimations = UnloadModelAnimations * * @return {boolean} The resulting bool. */ -function IsModelAnimationValid (model, anim) { +function IsModelAnimationValid(model, anim) { return r.BindIsModelAnimationValid( model.transform.m0, model.transform.m4, @@ -7421,7 +8728,8 @@ function IsModelAnimationValid (model, anim) { anim.boneCount, anim.frameCount, anim.bones, - anim.framePoses + anim.framePoses, + anim.name ) } raylib.IsModelAnimationValid = IsModelAnimationValid @@ -7436,7 +8744,7 @@ raylib.IsModelAnimationValid = IsModelAnimationValid * * @return {boolean} The resulting bool. */ -function CheckCollisionSpheres (center1, radius1, center2, radius2) { +function CheckCollisionSpheres(center1, radius1, center2, radius2) { return r.BindCheckCollisionSpheres( center1.x, center1.y, @@ -7458,7 +8766,7 @@ raylib.CheckCollisionSpheres = CheckCollisionSpheres * * @return {boolean} The resulting bool. */ -function CheckCollisionBoxes (box1, box2) { +function CheckCollisionBoxes(box1, box2) { return r.BindCheckCollisionBoxes( box1.min.x, box1.min.y, @@ -7485,7 +8793,7 @@ raylib.CheckCollisionBoxes = CheckCollisionBoxes * * @return {boolean} The resulting bool. */ -function CheckCollisionBoxSphere (box, center, radius) { +function CheckCollisionBoxSphere(box, center, radius) { return r.BindCheckCollisionBoxSphere( box.min.x, box.min.y, @@ -7510,7 +8818,7 @@ raylib.CheckCollisionBoxSphere = CheckCollisionBoxSphere * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionSphere (ray, center, radius) { +function GetRayCollisionSphere(ray, center, radius) { return r.BindGetRayCollisionSphere( ray.position.x, ray.position.y, @@ -7534,7 +8842,7 @@ raylib.GetRayCollisionSphere = GetRayCollisionSphere * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionBox (ray, box) { +function GetRayCollisionBox(ray, box) { return r.BindGetRayCollisionBox( ray.position.x, ray.position.y, @@ -7561,7 +8869,7 @@ raylib.GetRayCollisionBox = GetRayCollisionBox * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionMesh (ray, mesh, transform) { +function GetRayCollisionMesh(ray, mesh, transform) { return r.BindGetRayCollisionMesh( ray.position.x, ray.position.y, @@ -7582,6 +8890,8 @@ function GetRayCollisionMesh (ray, mesh, transform) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId, transform.m0, @@ -7614,7 +8924,7 @@ raylib.GetRayCollisionMesh = GetRayCollisionMesh * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionTriangle (ray, p1, p2, p3) { +function GetRayCollisionTriangle(ray, p1, p2, p3) { return r.BindGetRayCollisionTriangle( ray.position.x, ray.position.y, @@ -7646,7 +8956,7 @@ raylib.GetRayCollisionTriangle = GetRayCollisionTriangle * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionQuad (ray, p1, p2, p3, p4) { +function GetRayCollisionQuad(ray, p1, p2, p3, p4) { return r.BindGetRayCollisionQuad( ray.position.x, ray.position.y, @@ -7675,7 +8985,7 @@ raylib.GetRayCollisionQuad = GetRayCollisionQuad * * @return {undefined} */ -function InitAudioDevice () { +function InitAudioDevice() { return r.BindInitAudioDevice() } raylib.InitAudioDevice = InitAudioDevice @@ -7685,7 +8995,7 @@ raylib.InitAudioDevice = InitAudioDevice * * @return {undefined} */ -function CloseAudioDevice () { +function CloseAudioDevice() { return r.BindCloseAudioDevice() } raylib.CloseAudioDevice = CloseAudioDevice @@ -7695,7 +9005,7 @@ raylib.CloseAudioDevice = CloseAudioDevice * * @return {boolean} The resulting bool. */ -function IsAudioDeviceReady () { +function IsAudioDeviceReady() { return r.BindIsAudioDeviceReady() } raylib.IsAudioDeviceReady = IsAudioDeviceReady @@ -7707,13 +9017,23 @@ raylib.IsAudioDeviceReady = IsAudioDeviceReady * * @return {undefined} */ -function SetMasterVolume (volume) { +function SetMasterVolume(volume) { return r.BindSetMasterVolume( volume ) } raylib.SetMasterVolume = SetMasterVolume +/** + * Get master volume (listener) + * + * @return {number} The resulting float. + */ +function GetMasterVolume() { + return r.BindGetMasterVolume() +} +raylib.GetMasterVolume = GetMasterVolume + /** * Load wave data from file * @@ -7721,7 +9041,7 @@ raylib.SetMasterVolume = SetMasterVolume * * @return {Wave} The resulting Wave. */ -function LoadWave (fileName) { +function LoadWave(fileName) { return r.BindLoadWave( fileName ) @@ -7737,7 +9057,7 @@ raylib.LoadWave = LoadWave * * @return {Wave} The resulting Wave. */ -function LoadWaveFromMemory (fileType, fileData, dataSize) { +function LoadWaveFromMemory(fileType, fileData, dataSize) { return r.BindLoadWaveFromMemory( fileType, fileData, @@ -7747,14 +9067,14 @@ function LoadWaveFromMemory (fileType, fileData, dataSize) { raylib.LoadWaveFromMemory = LoadWaveFromMemory /** - * Checks if wave data is ready + * Checks if wave data is valid (data loaded and parameters) * * @param {Wave} wave * * @return {boolean} The resulting bool. */ -function IsWaveReady (wave) { - return r.BindIsWaveReady( +function IsWaveValid(wave) { + return r.BindIsWaveValid( wave.frameCount, wave.sampleRate, wave.sampleSize, @@ -7762,7 +9082,7 @@ function IsWaveReady (wave) { wave.data ) } -raylib.IsWaveReady = IsWaveReady +raylib.IsWaveValid = IsWaveValid /** * Load sound from file @@ -7771,7 +9091,7 @@ raylib.IsWaveReady = IsWaveReady * * @return {Sound} The resulting Sound. */ -function LoadSound (fileName) { +function LoadSound(fileName) { return r.BindLoadSound( fileName ) @@ -7785,7 +9105,7 @@ raylib.LoadSound = LoadSound * * @return {Sound} The resulting Sound. */ -function LoadSoundFromWave (wave) { +function LoadSoundFromWave(wave) { return r.BindLoadSoundFromWave( wave.frameCount, wave.sampleRate, @@ -7797,14 +9117,33 @@ function LoadSoundFromWave (wave) { raylib.LoadSoundFromWave = LoadSoundFromWave /** - * Checks if a sound is ready + * Create a new sound that shares the same sample data as the source sound, does not own the sound data + * + * @param {Sound} source + * + * @return {Sound} The resulting Sound. + */ +function LoadSoundAlias(source) { + return r.BindLoadSoundAlias( + source.stream.buffer, + source.stream.processor, + source.stream.sampleRate, + source.stream.sampleSize, + source.stream.channels, + source.frameCount + ) +} +raylib.LoadSoundAlias = LoadSoundAlias + +/** + * Checks if a sound is valid (data loaded and buffers initialized) * * @param {Sound} sound * * @return {boolean} The resulting bool. */ -function IsSoundReady (sound) { - return r.BindIsSoundReady( +function IsSoundValid(sound) { + return r.BindIsSoundValid( sound.stream.buffer, sound.stream.processor, sound.stream.sampleRate, @@ -7813,7 +9152,7 @@ function IsSoundReady (sound) { sound.frameCount ) } -raylib.IsSoundReady = IsSoundReady +raylib.IsSoundValid = IsSoundValid /** * Update sound buffer with new data @@ -7824,7 +9163,7 @@ raylib.IsSoundReady = IsSoundReady * * @return {undefined} */ -function UpdateSound (sound, data, sampleCount) { +function UpdateSound(sound, data, sampleCount) { return r.BindUpdateSound( sound.stream.buffer, sound.stream.processor, @@ -7845,7 +9184,7 @@ raylib.UpdateSound = UpdateSound * * @return {undefined} */ -function UnloadWave (wave) { +function UnloadWave(wave) { return r.BindUnloadWave( wave.frameCount, wave.sampleRate, @@ -7863,7 +9202,7 @@ raylib.UnloadWave = UnloadWave * * @return {undefined} */ -function UnloadSound (sound) { +function UnloadSound(sound) { return r.BindUnloadSound( sound.stream.buffer, sound.stream.processor, @@ -7875,6 +9214,25 @@ function UnloadSound (sound) { } raylib.UnloadSound = UnloadSound +/** + * Unload a sound alias (does not deallocate sample data) + * + * @param {Sound} alias + * + * @return {undefined} + */ +function UnloadSoundAlias(alias) { + return r.BindUnloadSoundAlias( + alias.stream.buffer, + alias.stream.processor, + alias.stream.sampleRate, + alias.stream.sampleSize, + alias.stream.channels, + alias.frameCount + ) +} +raylib.UnloadSoundAlias = UnloadSoundAlias + /** * Export wave data to file, returns true on success * @@ -7883,7 +9241,7 @@ raylib.UnloadSound = UnloadSound * * @return {boolean} The resulting bool. */ -function ExportWave (wave, fileName) { +function ExportWave(wave, fileName) { return r.BindExportWave( wave.frameCount, wave.sampleRate, @@ -7903,7 +9261,7 @@ raylib.ExportWave = ExportWave * * @return {boolean} The resulting bool. */ -function ExportWaveAsCode (wave, fileName) { +function ExportWaveAsCode(wave, fileName) { return r.BindExportWaveAsCode( wave.frameCount, wave.sampleRate, @@ -7922,7 +9280,7 @@ raylib.ExportWaveAsCode = ExportWaveAsCode * * @return {undefined} */ -function PlaySound (sound) { +function PlaySound(sound) { return r.BindPlaySound( sound.stream.buffer, sound.stream.processor, @@ -7941,7 +9299,7 @@ raylib.PlaySound = PlaySound * * @return {undefined} */ -function StopSound (sound) { +function StopSound(sound) { return r.BindStopSound( sound.stream.buffer, sound.stream.processor, @@ -7960,7 +9318,7 @@ raylib.StopSound = StopSound * * @return {undefined} */ -function PauseSound (sound) { +function PauseSound(sound) { return r.BindPauseSound( sound.stream.buffer, sound.stream.processor, @@ -7979,7 +9337,7 @@ raylib.PauseSound = PauseSound * * @return {undefined} */ -function ResumeSound (sound) { +function ResumeSound(sound) { return r.BindResumeSound( sound.stream.buffer, sound.stream.processor, @@ -7998,7 +9356,7 @@ raylib.ResumeSound = ResumeSound * * @return {boolean} The resulting bool. */ -function IsSoundPlaying (sound) { +function IsSoundPlaying(sound) { return r.BindIsSoundPlaying( sound.stream.buffer, sound.stream.processor, @@ -8018,7 +9376,7 @@ raylib.IsSoundPlaying = IsSoundPlaying * * @return {undefined} */ -function SetSoundVolume (sound, volume) { +function SetSoundVolume(sound, volume) { return r.BindSetSoundVolume( sound.stream.buffer, sound.stream.processor, @@ -8039,7 +9397,7 @@ raylib.SetSoundVolume = SetSoundVolume * * @return {undefined} */ -function SetSoundPitch (sound, pitch) { +function SetSoundPitch(sound, pitch) { return r.BindSetSoundPitch( sound.stream.buffer, sound.stream.processor, @@ -8060,7 +9418,7 @@ raylib.SetSoundPitch = SetSoundPitch * * @return {undefined} */ -function SetSoundPan (sound, pan) { +function SetSoundPan(sound, pan) { return r.BindSetSoundPan( sound.stream.buffer, sound.stream.processor, @@ -8080,7 +9438,7 @@ raylib.SetSoundPan = SetSoundPan * * @return {Wave} The resulting Wave. */ -function WaveCopy (wave) { +function WaveCopy(wave) { return r.BindWaveCopy( wave.frameCount, wave.sampleRate, @@ -8098,7 +9456,7 @@ raylib.WaveCopy = WaveCopy * * @return {number} The resulting float *. */ -function LoadWaveSamples (wave) { +function LoadWaveSamples(wave) { return r.BindLoadWaveSamples( wave.frameCount, wave.sampleRate, @@ -8116,7 +9474,7 @@ raylib.LoadWaveSamples = LoadWaveSamples * * @return {undefined} */ -function UnloadWaveSamples (samples) { +function UnloadWaveSamples(samples) { return r.BindUnloadWaveSamples( samples ) @@ -8130,7 +9488,7 @@ raylib.UnloadWaveSamples = UnloadWaveSamples * * @return {Music} The resulting Music. */ -function LoadMusicStream (fileName) { +function LoadMusicStream(fileName) { return r.BindLoadMusicStream( fileName ) @@ -8146,7 +9504,7 @@ raylib.LoadMusicStream = LoadMusicStream * * @return {Music} The resulting Music. */ -function LoadMusicStreamFromMemory (fileType, data, dataSize) { +function LoadMusicStreamFromMemory(fileType, data, dataSize) { return r.BindLoadMusicStreamFromMemory( fileType, data, @@ -8156,14 +9514,14 @@ function LoadMusicStreamFromMemory (fileType, data, dataSize) { raylib.LoadMusicStreamFromMemory = LoadMusicStreamFromMemory /** - * Checks if a music stream is ready + * Checks if a music stream is valid (context and buffers initialized) * * @param {Music} music * * @return {boolean} The resulting bool. */ -function IsMusicReady (music) { - return r.BindIsMusicReady( +function IsMusicValid(music) { + return r.BindIsMusicValid( music.stream.buffer, music.stream.processor, music.stream.sampleRate, @@ -8175,7 +9533,7 @@ function IsMusicReady (music) { music.ctxData ) } -raylib.IsMusicReady = IsMusicReady +raylib.IsMusicValid = IsMusicValid /** * Unload music stream @@ -8184,7 +9542,7 @@ raylib.IsMusicReady = IsMusicReady * * @return {undefined} */ -function UnloadMusicStream (music) { +function UnloadMusicStream(music) { return r.BindUnloadMusicStream( music.stream.buffer, music.stream.processor, @@ -8206,7 +9564,7 @@ raylib.UnloadMusicStream = UnloadMusicStream * * @return {undefined} */ -function PlayMusicStream (music) { +function PlayMusicStream(music) { return r.BindPlayMusicStream( music.stream.buffer, music.stream.processor, @@ -8228,7 +9586,7 @@ raylib.PlayMusicStream = PlayMusicStream * * @return {boolean} The resulting bool. */ -function IsMusicStreamPlaying (music) { +function IsMusicStreamPlaying(music) { return r.BindIsMusicStreamPlaying( music.stream.buffer, music.stream.processor, @@ -8250,7 +9608,7 @@ raylib.IsMusicStreamPlaying = IsMusicStreamPlaying * * @return {undefined} */ -function UpdateMusicStream (music) { +function UpdateMusicStream(music) { return r.BindUpdateMusicStream( music.stream.buffer, music.stream.processor, @@ -8272,7 +9630,7 @@ raylib.UpdateMusicStream = UpdateMusicStream * * @return {undefined} */ -function StopMusicStream (music) { +function StopMusicStream(music) { return r.BindStopMusicStream( music.stream.buffer, music.stream.processor, @@ -8294,7 +9652,7 @@ raylib.StopMusicStream = StopMusicStream * * @return {undefined} */ -function PauseMusicStream (music) { +function PauseMusicStream(music) { return r.BindPauseMusicStream( music.stream.buffer, music.stream.processor, @@ -8316,7 +9674,7 @@ raylib.PauseMusicStream = PauseMusicStream * * @return {undefined} */ -function ResumeMusicStream (music) { +function ResumeMusicStream(music) { return r.BindResumeMusicStream( music.stream.buffer, music.stream.processor, @@ -8339,7 +9697,7 @@ raylib.ResumeMusicStream = ResumeMusicStream * * @return {undefined} */ -function SeekMusicStream (music, position) { +function SeekMusicStream(music, position) { return r.BindSeekMusicStream( music.stream.buffer, music.stream.processor, @@ -8363,7 +9721,7 @@ raylib.SeekMusicStream = SeekMusicStream * * @return {undefined} */ -function SetMusicVolume (music, volume) { +function SetMusicVolume(music, volume) { return r.BindSetMusicVolume( music.stream.buffer, music.stream.processor, @@ -8387,7 +9745,7 @@ raylib.SetMusicVolume = SetMusicVolume * * @return {undefined} */ -function SetMusicPitch (music, pitch) { +function SetMusicPitch(music, pitch) { return r.BindSetMusicPitch( music.stream.buffer, music.stream.processor, @@ -8411,7 +9769,7 @@ raylib.SetMusicPitch = SetMusicPitch * * @return {undefined} */ -function SetMusicPan (music, pan) { +function SetMusicPan(music, pan) { return r.BindSetMusicPan( music.stream.buffer, music.stream.processor, @@ -8434,7 +9792,7 @@ raylib.SetMusicPan = SetMusicPan * * @return {number} The resulting float. */ -function GetMusicTimeLength (music) { +function GetMusicTimeLength(music) { return r.BindGetMusicTimeLength( music.stream.buffer, music.stream.processor, @@ -8456,7 +9814,7 @@ raylib.GetMusicTimeLength = GetMusicTimeLength * * @return {number} The resulting float. */ -function GetMusicTimePlayed (music) { +function GetMusicTimePlayed(music) { return r.BindGetMusicTimePlayed( music.stream.buffer, music.stream.processor, @@ -8480,7 +9838,7 @@ raylib.GetMusicTimePlayed = GetMusicTimePlayed * * @return {AudioStream} The resulting AudioStream. */ -function LoadAudioStream (sampleRate, sampleSize, channels) { +function LoadAudioStream(sampleRate, sampleSize, channels) { return r.BindLoadAudioStream( sampleRate, sampleSize, @@ -8490,14 +9848,14 @@ function LoadAudioStream (sampleRate, sampleSize, channels) { raylib.LoadAudioStream = LoadAudioStream /** - * Checks if an audio stream is ready + * Checks if an audio stream is valid (buffers initialized) * * @param {AudioStream} stream * * @return {boolean} The resulting bool. */ -function IsAudioStreamReady (stream) { - return r.BindIsAudioStreamReady( +function IsAudioStreamValid(stream) { + return r.BindIsAudioStreamValid( stream.buffer, stream.processor, stream.sampleRate, @@ -8505,7 +9863,7 @@ function IsAudioStreamReady (stream) { stream.channels ) } -raylib.IsAudioStreamReady = IsAudioStreamReady +raylib.IsAudioStreamValid = IsAudioStreamValid /** * Unload audio stream and free memory @@ -8514,7 +9872,7 @@ raylib.IsAudioStreamReady = IsAudioStreamReady * * @return {undefined} */ -function UnloadAudioStream (stream) { +function UnloadAudioStream(stream) { return r.BindUnloadAudioStream( stream.buffer, stream.processor, @@ -8534,7 +9892,7 @@ raylib.UnloadAudioStream = UnloadAudioStream * * @return {undefined} */ -function UpdateAudioStream (stream, data, frameCount) { +function UpdateAudioStream(stream, data, frameCount) { return r.BindUpdateAudioStream( stream.buffer, stream.processor, @@ -8554,7 +9912,7 @@ raylib.UpdateAudioStream = UpdateAudioStream * * @return {boolean} The resulting bool. */ -function IsAudioStreamProcessed (stream) { +function IsAudioStreamProcessed(stream) { return r.BindIsAudioStreamProcessed( stream.buffer, stream.processor, @@ -8572,7 +9930,7 @@ raylib.IsAudioStreamProcessed = IsAudioStreamProcessed * * @return {undefined} */ -function PlayAudioStream (stream) { +function PlayAudioStream(stream) { return r.BindPlayAudioStream( stream.buffer, stream.processor, @@ -8590,7 +9948,7 @@ raylib.PlayAudioStream = PlayAudioStream * * @return {undefined} */ -function PauseAudioStream (stream) { +function PauseAudioStream(stream) { return r.BindPauseAudioStream( stream.buffer, stream.processor, @@ -8608,7 +9966,7 @@ raylib.PauseAudioStream = PauseAudioStream * * @return {undefined} */ -function ResumeAudioStream (stream) { +function ResumeAudioStream(stream) { return r.BindResumeAudioStream( stream.buffer, stream.processor, @@ -8626,7 +9984,7 @@ raylib.ResumeAudioStream = ResumeAudioStream * * @return {boolean} The resulting bool. */ -function IsAudioStreamPlaying (stream) { +function IsAudioStreamPlaying(stream) { return r.BindIsAudioStreamPlaying( stream.buffer, stream.processor, @@ -8644,7 +10002,7 @@ raylib.IsAudioStreamPlaying = IsAudioStreamPlaying * * @return {undefined} */ -function StopAudioStream (stream) { +function StopAudioStream(stream) { return r.BindStopAudioStream( stream.buffer, stream.processor, @@ -8663,7 +10021,7 @@ raylib.StopAudioStream = StopAudioStream * * @return {undefined} */ -function SetAudioStreamVolume (stream, volume) { +function SetAudioStreamVolume(stream, volume) { return r.BindSetAudioStreamVolume( stream.buffer, stream.processor, @@ -8683,7 +10041,7 @@ raylib.SetAudioStreamVolume = SetAudioStreamVolume * * @return {undefined} */ -function SetAudioStreamPitch (stream, pitch) { +function SetAudioStreamPitch(stream, pitch) { return r.BindSetAudioStreamPitch( stream.buffer, stream.processor, @@ -8703,7 +10061,7 @@ raylib.SetAudioStreamPitch = SetAudioStreamPitch * * @return {undefined} */ -function SetAudioStreamPan (stream, pan) { +function SetAudioStreamPan(stream, pan) { return r.BindSetAudioStreamPan( stream.buffer, stream.processor, @@ -8722,7 +10080,7 @@ raylib.SetAudioStreamPan = SetAudioStreamPan * * @return {undefined} */ -function SetAudioStreamBufferSizeDefault (size) { +function SetAudioStreamBufferSizeDefault(size) { return r.BindSetAudioStreamBufferSizeDefault( size ) @@ -8739,7 +10097,7 @@ raylib.SetAudioStreamBufferSizeDefault = SetAudioStreamBufferSizeDefault * * @return {number} The resulting float. */ -function EaseLinearNone (t, b, c, d) { +function EaseLinearNone(t, b, c, d) { return r.BindEaseLinearNone( t, b, @@ -8759,7 +10117,7 @@ raylib.EaseLinearNone = EaseLinearNone * * @return {number} The resulting float. */ -function EaseLinearIn (t, b, c, d) { +function EaseLinearIn(t, b, c, d) { return r.BindEaseLinearIn( t, b, @@ -8779,7 +10137,7 @@ raylib.EaseLinearIn = EaseLinearIn * * @return {number} The resulting float. */ -function EaseLinearOut (t, b, c, d) { +function EaseLinearOut(t, b, c, d) { return r.BindEaseLinearOut( t, b, @@ -8799,7 +10157,7 @@ raylib.EaseLinearOut = EaseLinearOut * * @return {number} The resulting float. */ -function EaseLinearInOut (t, b, c, d) { +function EaseLinearInOut(t, b, c, d) { return r.BindEaseLinearInOut( t, b, @@ -8819,7 +10177,7 @@ raylib.EaseLinearInOut = EaseLinearInOut * * @return {number} The resulting float. */ -function EaseSineIn (t, b, c, d) { +function EaseSineIn(t, b, c, d) { return r.BindEaseSineIn( t, b, @@ -8827,10 +10185,170 @@ function EaseSineIn (t, b, c, d) { d ) } -raylib.EaseSineIn = EaseSineIn +raylib.EaseSineIn = EaseSineIn + +/** + * Ease: Sine Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseSineOut(t, b, c, d) { + return r.BindEaseSineOut( + t, + b, + c, + d + ) +} +raylib.EaseSineOut = EaseSineOut + +/** + * Ease: Sine Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseSineInOut(t, b, c, d) { + return r.BindEaseSineInOut( + t, + b, + c, + d + ) +} +raylib.EaseSineInOut = EaseSineInOut + +/** + * Ease: Circular In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCircIn(t, b, c, d) { + return r.BindEaseCircIn( + t, + b, + c, + d + ) +} +raylib.EaseCircIn = EaseCircIn + +/** + * Ease: Circular Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCircOut(t, b, c, d) { + return r.BindEaseCircOut( + t, + b, + c, + d + ) +} +raylib.EaseCircOut = EaseCircOut + +/** + * Ease: Circular In Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCircInOut(t, b, c, d) { + return r.BindEaseCircInOut( + t, + b, + c, + d + ) +} +raylib.EaseCircInOut = EaseCircInOut + +/** + * Ease: Cubic In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCubicIn(t, b, c, d) { + return r.BindEaseCubicIn( + t, + b, + c, + d + ) +} +raylib.EaseCubicIn = EaseCubicIn + +/** + * Ease: Cubic Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCubicOut(t, b, c, d) { + return r.BindEaseCubicOut( + t, + b, + c, + d + ) +} +raylib.EaseCubicOut = EaseCubicOut + +/** + * Ease: Cubic In Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCubicInOut(t, b, c, d) { + return r.BindEaseCubicInOut( + t, + b, + c, + d + ) +} +raylib.EaseCubicInOut = EaseCubicInOut /** - * Ease: Sine Out + * Ease: Quadratic In * * @param {number} t * @param {number} b @@ -8839,18 +10357,18 @@ raylib.EaseSineIn = EaseSineIn * * @return {number} The resulting float. */ -function EaseSineOut (t, b, c, d) { - return r.BindEaseSineOut( +function EaseQuadIn(t, b, c, d) { + return r.BindEaseQuadIn( t, b, c, d ) } -raylib.EaseSineOut = EaseSineOut +raylib.EaseQuadIn = EaseQuadIn /** - * Ease: Sine Out + * Ease: Quadratic Out * * @param {number} t * @param {number} b @@ -8859,18 +10377,18 @@ raylib.EaseSineOut = EaseSineOut * * @return {number} The resulting float. */ -function EaseSineInOut (t, b, c, d) { - return r.BindEaseSineInOut( +function EaseQuadOut(t, b, c, d) { + return r.BindEaseQuadOut( t, b, c, d ) } -raylib.EaseSineInOut = EaseSineInOut +raylib.EaseQuadOut = EaseQuadOut /** - * Ease: Circular In + * Ease: Quadratic In Out * * @param {number} t * @param {number} b @@ -8879,18 +10397,18 @@ raylib.EaseSineInOut = EaseSineInOut * * @return {number} The resulting float. */ -function EaseCircIn (t, b, c, d) { - return r.BindEaseCircIn( +function EaseQuadInOut(t, b, c, d) { + return r.BindEaseQuadInOut( t, b, c, d ) } -raylib.EaseCircIn = EaseCircIn +raylib.EaseQuadInOut = EaseQuadInOut /** - * Ease: Circular Out + * Ease: Exponential In * * @param {number} t * @param {number} b @@ -8899,18 +10417,18 @@ raylib.EaseCircIn = EaseCircIn * * @return {number} The resulting float. */ -function EaseCircOut (t, b, c, d) { - return r.BindEaseCircOut( +function EaseExpoIn(t, b, c, d) { + return r.BindEaseExpoIn( t, b, c, d ) } -raylib.EaseCircOut = EaseCircOut +raylib.EaseExpoIn = EaseExpoIn /** - * Ease: Circular In Out + * Ease: Exponential Out * * @param {number} t * @param {number} b @@ -8919,18 +10437,18 @@ raylib.EaseCircOut = EaseCircOut * * @return {number} The resulting float. */ -function EaseCircInOut (t, b, c, d) { - return r.BindEaseCircInOut( +function EaseExpoOut(t, b, c, d) { + return r.BindEaseExpoOut( t, b, c, d ) } -raylib.EaseCircInOut = EaseCircInOut +raylib.EaseExpoOut = EaseExpoOut /** - * Ease: Cubic In + * Ease: Exponential In Out * * @param {number} t * @param {number} b @@ -8939,18 +10457,18 @@ raylib.EaseCircInOut = EaseCircInOut * * @return {number} The resulting float. */ -function EaseCubicIn (t, b, c, d) { - return r.BindEaseCubicIn( +function EaseExpoInOut(t, b, c, d) { + return r.BindEaseExpoInOut( t, b, c, d ) } -raylib.EaseCubicIn = EaseCubicIn +raylib.EaseExpoInOut = EaseExpoInOut /** - * Ease: Cubic Out + * Ease: Back In * * @param {number} t * @param {number} b @@ -8959,18 +10477,18 @@ raylib.EaseCubicIn = EaseCubicIn * * @return {number} The resulting float. */ -function EaseCubicOut (t, b, c, d) { - return r.BindEaseCubicOut( +function EaseBackIn(t, b, c, d) { + return r.BindEaseBackIn( t, b, c, d ) } -raylib.EaseCubicOut = EaseCubicOut +raylib.EaseBackIn = EaseBackIn /** - * Ease: Cubic In Out + * Ease: Back Out * * @param {number} t * @param {number} b @@ -8979,18 +10497,18 @@ raylib.EaseCubicOut = EaseCubicOut * * @return {number} The resulting float. */ -function EaseCubicInOut (t, b, c, d) { - return r.BindEaseCubicInOut( +function EaseBackOut(t, b, c, d) { + return r.BindEaseBackOut( t, b, c, d ) } -raylib.EaseCubicInOut = EaseCubicInOut +raylib.EaseBackOut = EaseBackOut /** - * Ease: Quadratic In + * Ease: Back In Out * * @param {number} t * @param {number} b @@ -8999,18 +10517,18 @@ raylib.EaseCubicInOut = EaseCubicInOut * * @return {number} The resulting float. */ -function EaseQuadIn (t, b, c, d) { - return r.BindEaseQuadIn( +function EaseBackInOut(t, b, c, d) { + return r.BindEaseBackInOut( t, b, c, d ) } -raylib.EaseQuadIn = EaseQuadIn +raylib.EaseBackInOut = EaseBackInOut /** - * Ease: Quadratic Out + * Ease: Bounce Out * * @param {number} t * @param {number} b @@ -9019,18 +10537,18 @@ raylib.EaseQuadIn = EaseQuadIn * * @return {number} The resulting float. */ -function EaseQuadOut (t, b, c, d) { - return r.BindEaseQuadOut( +function EaseBounceOut(t, b, c, d) { + return r.BindEaseBounceOut( t, b, c, d ) } -raylib.EaseQuadOut = EaseQuadOut +raylib.EaseBounceOut = EaseBounceOut /** - * Ease: Quadratic In Out + * Ease: Bounce In * * @param {number} t * @param {number} b @@ -9039,18 +10557,18 @@ raylib.EaseQuadOut = EaseQuadOut * * @return {number} The resulting float. */ -function EaseQuadInOut (t, b, c, d) { - return r.BindEaseQuadInOut( +function EaseBounceIn(t, b, c, d) { + return r.BindEaseBounceIn( t, b, c, d ) } -raylib.EaseQuadInOut = EaseQuadInOut +raylib.EaseBounceIn = EaseBounceIn /** - * Ease: Exponential In + * Ease: Bounce In Out * * @param {number} t * @param {number} b @@ -9059,18 +10577,18 @@ raylib.EaseQuadInOut = EaseQuadInOut * * @return {number} The resulting float. */ -function EaseExpoIn (t, b, c, d) { - return r.BindEaseExpoIn( +function EaseBounceInOut(t, b, c, d) { + return r.BindEaseBounceInOut( t, b, c, d ) } -raylib.EaseExpoIn = EaseExpoIn +raylib.EaseBounceInOut = EaseBounceInOut /** - * Ease: Exponential Out + * Ease: Elastic In * * @param {number} t * @param {number} b @@ -9079,18 +10597,18 @@ raylib.EaseExpoIn = EaseExpoIn * * @return {number} The resulting float. */ -function EaseExpoOut (t, b, c, d) { - return r.BindEaseExpoOut( +function EaseElasticIn(t, b, c, d) { + return r.BindEaseElasticIn( t, b, c, d ) } -raylib.EaseExpoOut = EaseExpoOut +raylib.EaseElasticIn = EaseElasticIn /** - * Ease: Exponential In Out + * Ease: Elastic Out * * @param {number} t * @param {number} b @@ -9099,18 +10617,18 @@ raylib.EaseExpoOut = EaseExpoOut * * @return {number} The resulting float. */ -function EaseExpoInOut (t, b, c, d) { - return r.BindEaseExpoInOut( +function EaseElasticOut(t, b, c, d) { + return r.BindEaseElasticOut( t, b, c, d ) } -raylib.EaseExpoInOut = EaseExpoInOut +raylib.EaseElasticOut = EaseElasticOut /** - * Ease: Back In + * Ease: Elastic In Out * * @param {number} t * @param {number} b @@ -9119,394 +10637,592 @@ raylib.EaseExpoInOut = EaseExpoInOut * * @return {number} The resulting float. */ -function EaseBackIn (t, b, c, d) { - return r.BindEaseBackIn( +function EaseElasticInOut(t, b, c, d) { + return r.BindEaseElasticInOut( t, b, c, d ) } -raylib.EaseBackIn = EaseBackIn +raylib.EaseElasticInOut = EaseElasticInOut + +function Clamp(value, min, max) { + return r.BindClamp( + value, + min, + max + ) +} +raylib.Clamp = Clamp + +function Lerp(start, end, amount) { + return r.BindLerp( + start, + end, + amount + ) +} +raylib.Lerp = Lerp + +function Normalize(value, start, end) { + return r.BindNormalize( + value, + start, + end + ) +} +raylib.Normalize = Normalize + +function Remap(value, inputStart, inputEnd, outputStart, outputEnd) { + return r.BindRemap( + value, + inputStart, + inputEnd, + outputStart, + outputEnd + ) +} +raylib.Remap = Remap + +function Wrap(value, min, max) { + return r.BindWrap( + value, + min, + max + ) +} +raylib.Wrap = Wrap + +function FloatEquals(x, y) { + return r.BindFloatEquals( + x, + y + ) +} +raylib.FloatEquals = FloatEquals + +function Vector2Zero() { + return r.BindVector2Zero() +} +raylib.Vector2Zero = Vector2Zero + +function Vector2One() { + return r.BindVector2One() +} +raylib.Vector2One = Vector2One + +function Vector2Add(v1, v2) { + return r.BindVector2Add( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Add = Vector2Add + +function Vector2AddValue(v, add) { + return r.BindVector2AddValue( + v.x, + v.y, + add + ) +} +raylib.Vector2AddValue = Vector2AddValue + +function Vector2Subtract(v1, v2) { + return r.BindVector2Subtract( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Subtract = Vector2Subtract + +function Vector2SubtractValue(v, sub) { + return r.BindVector2SubtractValue( + v.x, + v.y, + sub + ) +} +raylib.Vector2SubtractValue = Vector2SubtractValue + +function Vector2Length(v) { + return r.BindVector2Length( + v.x, + v.y + ) +} +raylib.Vector2Length = Vector2Length + +function Vector2LengthSqr(v) { + return r.BindVector2LengthSqr( + v.x, + v.y + ) +} +raylib.Vector2LengthSqr = Vector2LengthSqr + +function Vector2DotProduct(v1, v2) { + return r.BindVector2DotProduct( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2DotProduct = Vector2DotProduct + +function Vector2Distance(v1, v2) { + return r.BindVector2Distance( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Distance = Vector2Distance + +function Vector2DistanceSqr(v1, v2) { + return r.BindVector2DistanceSqr( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2DistanceSqr = Vector2DistanceSqr + +function Vector2Angle(v1, v2) { + return r.BindVector2Angle( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Angle = Vector2Angle + +function Vector2LineAngle(start, end) { + return r.BindVector2LineAngle( + start.x, + start.y, + end.x, + end.y + ) +} +raylib.Vector2LineAngle = Vector2LineAngle + +function Vector2Scale(v, scale) { + return r.BindVector2Scale( + v.x, + v.y, + scale + ) +} +raylib.Vector2Scale = Vector2Scale + +function Vector2Multiply(v1, v2) { + return r.BindVector2Multiply( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Multiply = Vector2Multiply -/** - * Ease: Back Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBackOut (t, b, c, d) { - return r.BindEaseBackOut( - t, - b, - c, - d +function Vector2Negate(v) { + return r.BindVector2Negate( + v.x, + v.y ) } -raylib.EaseBackOut = EaseBackOut +raylib.Vector2Negate = Vector2Negate -/** - * Ease: Back In Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBackInOut (t, b, c, d) { - return r.BindEaseBackInOut( - t, - b, - c, - d +function Vector2Divide(v1, v2) { + return r.BindVector2Divide( + v1.x, + v1.y, + v2.x, + v2.y ) } -raylib.EaseBackInOut = EaseBackInOut +raylib.Vector2Divide = Vector2Divide -/** - * Ease: Bounce Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBounceOut (t, b, c, d) { - return r.BindEaseBounceOut( - t, - b, - c, - d +function Vector2Normalize(v) { + return r.BindVector2Normalize( + v.x, + v.y ) } -raylib.EaseBounceOut = EaseBounceOut +raylib.Vector2Normalize = Vector2Normalize -/** - * Ease: Bounce In - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBounceIn (t, b, c, d) { - return r.BindEaseBounceIn( - t, - b, - c, - d +function Vector2Transform(v, mat) { + return r.BindVector2Transform( + v.x, + v.y, + mat.m0, + mat.m4, + mat.m8, + mat.m12, + mat.m1, + mat.m5, + mat.m9, + mat.m13, + mat.m2, + mat.m6, + mat.m10, + mat.m14, + mat.m3, + mat.m7, + mat.m11, + mat.m15 ) } -raylib.EaseBounceIn = EaseBounceIn +raylib.Vector2Transform = Vector2Transform -/** - * Ease: Bounce In Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBounceInOut (t, b, c, d) { - return r.BindEaseBounceInOut( - t, - b, - c, - d +function Vector2Lerp(v1, v2, amount) { + return r.BindVector2Lerp( + v1.x, + v1.y, + v2.x, + v2.y, + amount ) } -raylib.EaseBounceInOut = EaseBounceInOut +raylib.Vector2Lerp = Vector2Lerp -/** - * Ease: Elastic In - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseElasticIn (t, b, c, d) { - return r.BindEaseElasticIn( - t, - b, - c, - d +function Vector2Reflect(v, normal) { + return r.BindVector2Reflect( + v.x, + v.y, + normal.x, + normal.y ) } -raylib.EaseElasticIn = EaseElasticIn +raylib.Vector2Reflect = Vector2Reflect -/** - * Ease: Elastic Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseElasticOut (t, b, c, d) { - return r.BindEaseElasticOut( - t, - b, - c, - d +function Vector2Min(v1, v2) { + return r.BindVector2Min( + v1.x, + v1.y, + v2.x, + v2.y ) } -raylib.EaseElasticOut = EaseElasticOut +raylib.Vector2Min = Vector2Min -/** - * Ease: Elastic In Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseElasticInOut (t, b, c, d) { - return r.BindEaseElasticInOut( - t, - b, - c, - d +function Vector2Max(v1, v2) { + return r.BindVector2Max( + v1.x, + v1.y, + v2.x, + v2.y ) } -raylib.EaseElasticInOut = EaseElasticInOut +raylib.Vector2Max = Vector2Max -function Clamp (value, min, max) { - return r.BindClamp( - value, - min, - max +function Vector2Rotate(v, angle) { + return r.BindVector2Rotate( + v.x, + v.y, + angle ) } -raylib.Clamp = Clamp +raylib.Vector2Rotate = Vector2Rotate -function Lerp (start, end, amount) { - return r.BindLerp( - start, - end, - amount +function Vector2MoveTowards(v, target, maxDistance) { + return r.BindVector2MoveTowards( + v.x, + v.y, + target.x, + target.y, + maxDistance ) } -raylib.Lerp = Lerp +raylib.Vector2MoveTowards = Vector2MoveTowards -function Normalize (value, start, end) { - return r.BindNormalize( - value, - start, - end +function Vector2Invert(v) { + return r.BindVector2Invert( + v.x, + v.y ) } -raylib.Normalize = Normalize +raylib.Vector2Invert = Vector2Invert -function Remap (value, inputStart, inputEnd, outputStart, outputEnd) { - return r.BindRemap( - value, - inputStart, - inputEnd, - outputStart, - outputEnd +function Vector2Clamp(v, min, max) { + return r.BindVector2Clamp( + v.x, + v.y, + min.x, + min.y, + max.x, + max.y ) } -raylib.Remap = Remap +raylib.Vector2Clamp = Vector2Clamp -function Wrap (value, min, max) { - return r.BindWrap( - value, +function Vector2ClampValue(v, min, max) { + return r.BindVector2ClampValue( + v.x, + v.y, min, max ) } -raylib.Wrap = Wrap +raylib.Vector2ClampValue = Vector2ClampValue -function FloatEquals (x, y) { - return r.BindFloatEquals( - x, - y +function Vector2Equals(p, q) { + return r.BindVector2Equals( + p.x, + p.y, + q.x, + q.y + ) +} +raylib.Vector2Equals = Vector2Equals + +function Vector2Refract(v, n, r) { + return r.BindVector2Refract( + v.x, + v.y, + n.x, + n.y, + r ) } -raylib.FloatEquals = FloatEquals +raylib.Vector2Refract = Vector2Refract -function Vector2Zero () { - return r.BindVector2Zero() +function Vector3Zero() { + return r.BindVector3Zero() } -raylib.Vector2Zero = Vector2Zero +raylib.Vector3Zero = Vector3Zero -function Vector2One () { - return r.BindVector2One() +function Vector3One() { + return r.BindVector3One() } -raylib.Vector2One = Vector2One +raylib.Vector3One = Vector3One -function Vector2Add (v1, v2) { - return r.BindVector2Add( +function Vector3Add(v1, v2) { + return r.BindVector3Add( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Add = Vector2Add +raylib.Vector3Add = Vector3Add -function Vector2AddValue (v, add) { - return r.BindVector2AddValue( +function Vector3AddValue(v, add) { + return r.BindVector3AddValue( v.x, v.y, + v.z, add ) } -raylib.Vector2AddValue = Vector2AddValue +raylib.Vector3AddValue = Vector3AddValue -function Vector2Subtract (v1, v2) { - return r.BindVector2Subtract( +function Vector3Subtract(v1, v2) { + return r.BindVector3Subtract( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Subtract = Vector2Subtract +raylib.Vector3Subtract = Vector3Subtract -function Vector2SubtractValue (v, sub) { - return r.BindVector2SubtractValue( +function Vector3SubtractValue(v, sub) { + return r.BindVector3SubtractValue( v.x, v.y, + v.z, sub ) } -raylib.Vector2SubtractValue = Vector2SubtractValue +raylib.Vector3SubtractValue = Vector3SubtractValue -function Vector2Length (v) { - return r.BindVector2Length( +function Vector3Scale(v, scalar) { + return r.BindVector3Scale( v.x, - v.y + v.y, + v.z, + scalar ) } -raylib.Vector2Length = Vector2Length +raylib.Vector3Scale = Vector3Scale -function Vector2LengthSqr (v) { - return r.BindVector2LengthSqr( - v.x, - v.y +function Vector3Multiply(v1, v2) { + return r.BindVector3Multiply( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z ) } -raylib.Vector2LengthSqr = Vector2LengthSqr +raylib.Vector3Multiply = Vector3Multiply -function Vector2DotProduct (v1, v2) { - return r.BindVector2DotProduct( +function Vector3CrossProduct(v1, v2) { + return r.BindVector3CrossProduct( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2DotProduct = Vector2DotProduct +raylib.Vector3CrossProduct = Vector3CrossProduct -function Vector2Distance (v1, v2) { - return r.BindVector2Distance( +function Vector3Perpendicular(v) { + return r.BindVector3Perpendicular( + v.x, + v.y, + v.z + ) +} +raylib.Vector3Perpendicular = Vector3Perpendicular + +function Vector3Length(v) { + return r.BindVector3Length( + v + ) +} +raylib.Vector3Length = Vector3Length + +function Vector3LengthSqr(v) { + return r.BindVector3LengthSqr( + v + ) +} +raylib.Vector3LengthSqr = Vector3LengthSqr + +function Vector3DotProduct(v1, v2) { + return r.BindVector3DotProduct( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Distance = Vector2Distance +raylib.Vector3DotProduct = Vector3DotProduct -function Vector2DistanceSqr (v1, v2) { - return r.BindVector2DistanceSqr( +function Vector3Distance(v1, v2) { + return r.BindVector3Distance( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2DistanceSqr = Vector2DistanceSqr +raylib.Vector3Distance = Vector3Distance -function Vector2Angle (v1, v2) { - return r.BindVector2Angle( +function Vector3DistanceSqr(v1, v2) { + return r.BindVector3DistanceSqr( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Angle = Vector2Angle +raylib.Vector3DistanceSqr = Vector3DistanceSqr -function Vector2LineAngle (start, end) { - return r.BindVector2LineAngle( - start.x, - start.y, - end.x, - end.y +function Vector3Angle(v1, v2) { + return r.BindVector3Angle( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z ) } -raylib.Vector2LineAngle = Vector2LineAngle +raylib.Vector3Angle = Vector3Angle -function Vector2Scale (v, scale) { - return r.BindVector2Scale( +function Vector3Negate(v) { + return r.BindVector3Negate( v.x, v.y, - scale + v.z ) } -raylib.Vector2Scale = Vector2Scale +raylib.Vector3Negate = Vector3Negate -function Vector2Multiply (v1, v2) { - return r.BindVector2Multiply( +function Vector3Divide(v1, v2) { + return r.BindVector3Divide( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Multiply = Vector2Multiply +raylib.Vector3Divide = Vector3Divide -function Vector2Negate (v) { - return r.BindVector2Negate( +function Vector3Normalize(v) { + return r.BindVector3Normalize( v.x, - v.y + v.y, + v.z ) } -raylib.Vector2Negate = Vector2Negate +raylib.Vector3Normalize = Vector3Normalize -function Vector2Divide (v1, v2) { - return r.BindVector2Divide( +function Vector3Project(v1, v2) { + return r.BindVector3Project( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Divide = Vector2Divide +raylib.Vector3Project = Vector3Project -function Vector2Normalize (v) { - return r.BindVector2Normalize( - v.x, - v.y +function Vector3Reject(v1, v2) { + return r.BindVector3Reject( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z ) } -raylib.Vector2Normalize = Vector2Normalize +raylib.Vector3Reject = Vector3Reject -function Vector2Transform (v, mat) { - return r.BindVector2Transform( +function Vector3OrthoNormalize(v1, v2) { + return r.BindVector3OrthoNormalize( + v1, + v2 + ) +} +raylib.Vector3OrthoNormalize = Vector3OrthoNormalize + +function Vector3Transform(v, mat) { + return r.BindVector3Transform( v.x, v.y, + v.z, mat.m0, mat.m4, mat.m8, @@ -9525,503 +11241,495 @@ function Vector2Transform (v, mat) { mat.m15 ) } -raylib.Vector2Transform = Vector2Transform +raylib.Vector3Transform = Vector3Transform -function Vector2Lerp (v1, v2, amount) { - return r.BindVector2Lerp( +function Vector3RotateByQuaternion(v, q) { + return r.BindVector3RotateByQuaternion( + v.x, + v.y, + v.z, + q + ) +} +raylib.Vector3RotateByQuaternion = Vector3RotateByQuaternion + +function Vector3RotateByAxisAngle(v, axis, angle) { + return r.BindVector3RotateByAxisAngle( + v.x, + v.y, + v.z, + axis.x, + axis.y, + axis.z, + angle + ) +} +raylib.Vector3RotateByAxisAngle = Vector3RotateByAxisAngle + +function Vector3MoveTowards(v, target, maxDistance) { + return r.BindVector3MoveTowards( + v.x, + v.y, + v.z, + target.x, + target.y, + target.z, + maxDistance + ) +} +raylib.Vector3MoveTowards = Vector3MoveTowards + +function Vector3Lerp(v1, v2, amount) { + return r.BindVector3Lerp( v1.x, v1.y, + v1.z, v2.x, v2.y, + v2.z, amount ) } -raylib.Vector2Lerp = Vector2Lerp +raylib.Vector3Lerp = Vector3Lerp -function Vector2Reflect (v, normal) { - return r.BindVector2Reflect( +function Vector3CubicHermite(v1, tangent1, v2, tangent2, amount) { + return r.BindVector3CubicHermite( + v1.x, + v1.y, + v1.z, + tangent1.x, + tangent1.y, + tangent1.z, + v2.x, + v2.y, + v2.z, + tangent2.x, + tangent2.y, + tangent2.z, + amount + ) +} +raylib.Vector3CubicHermite = Vector3CubicHermite + +function Vector3Reflect(v, normal) { + return r.BindVector3Reflect( v.x, v.y, + v.z, normal.x, - normal.y + normal.y, + normal.z + ) +} +raylib.Vector3Reflect = Vector3Reflect + +function Vector3Min(v1, v2) { + return r.BindVector3Min( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z + ) +} +raylib.Vector3Min = Vector3Min + +function Vector3Max(v1, v2) { + return r.BindVector3Max( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z + ) +} +raylib.Vector3Max = Vector3Max + +function Vector3Barycenter(p, a, b, c) { + return r.BindVector3Barycenter( + p.x, + p.y, + p.z, + a.x, + a.y, + a.z, + b.x, + b.y, + b.z, + c.x, + c.y, + c.z ) } -raylib.Vector2Reflect = Vector2Reflect +raylib.Vector3Barycenter = Vector3Barycenter -function Vector2Rotate (v, angle) { - return r.BindVector2Rotate( - v.x, - v.y, - angle +function Vector3Unproject(source, projection, view) { + return r.BindVector3Unproject( + source.x, + source.y, + source.z, + projection.m0, + projection.m4, + projection.m8, + projection.m12, + projection.m1, + projection.m5, + projection.m9, + projection.m13, + projection.m2, + projection.m6, + projection.m10, + projection.m14, + projection.m3, + projection.m7, + projection.m11, + projection.m15, + view.m0, + view.m4, + view.m8, + view.m12, + view.m1, + view.m5, + view.m9, + view.m13, + view.m2, + view.m6, + view.m10, + view.m14, + view.m3, + view.m7, + view.m11, + view.m15 ) } -raylib.Vector2Rotate = Vector2Rotate +raylib.Vector3Unproject = Vector3Unproject -function Vector2MoveTowards (v, target, maxDistance) { - return r.BindVector2MoveTowards( +function Vector3Invert(v) { + return r.BindVector3Invert( v.x, v.y, - target.x, - target.y, - maxDistance - ) -} -raylib.Vector2MoveTowards = Vector2MoveTowards - -function Vector2Invert (v) { - return r.BindVector2Invert( - v.x, - v.y + v.z ) } -raylib.Vector2Invert = Vector2Invert +raylib.Vector3Invert = Vector3Invert -function Vector2Clamp (v, min, max) { - return r.BindVector2Clamp( +function Vector3Clamp(v, min, max) { + return r.BindVector3Clamp( v.x, v.y, + v.z, min.x, min.y, + min.z, max.x, - max.y + max.y, + max.z ) } -raylib.Vector2Clamp = Vector2Clamp +raylib.Vector3Clamp = Vector3Clamp -function Vector2ClampValue (v, min, max) { - return r.BindVector2ClampValue( +function Vector3ClampValue(v, min, max) { + return r.BindVector3ClampValue( v.x, v.y, + v.z, min, max ) } -raylib.Vector2ClampValue = Vector2ClampValue +raylib.Vector3ClampValue = Vector3ClampValue -function Vector2Equals (p, q) { - return r.BindVector2Equals( +function Vector3Equals(p, q) { + return r.BindVector3Equals( p.x, p.y, + p.z, q.x, - q.y + q.y, + q.z ) } -raylib.Vector2Equals = Vector2Equals +raylib.Vector3Equals = Vector3Equals -function Vector3Zero () { - return r.BindVector3Zero() +function Vector3Refract(v, n, r) { + return r.BindVector3Refract( + v.x, + v.y, + v.z, + n.x, + n.y, + n.z, + r + ) } -raylib.Vector3Zero = Vector3Zero +raylib.Vector3Refract = Vector3Refract -function Vector3One () { - return r.BindVector3One() +function Vector4Zero() { + return r.BindVector4Zero() } -raylib.Vector3One = Vector3One +raylib.Vector4Zero = Vector4Zero -function Vector3Add (v1, v2) { - return r.BindVector3Add( +function Vector4One() { + return r.BindVector4One() +} +raylib.Vector4One = Vector4One + +function Vector4Add(v1, v2) { + return r.BindVector4Add( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Add = Vector3Add +raylib.Vector4Add = Vector4Add -function Vector3AddValue (v, add) { - return r.BindVector3AddValue( +function Vector4AddValue(v, add) { + return r.BindVector4AddValue( v.x, v.y, v.z, + v.w, add ) } -raylib.Vector3AddValue = Vector3AddValue +raylib.Vector4AddValue = Vector4AddValue -function Vector3Subtract (v1, v2) { - return r.BindVector3Subtract( +function Vector4Subtract(v1, v2) { + return r.BindVector4Subtract( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Subtract = Vector3Subtract +raylib.Vector4Subtract = Vector4Subtract -function Vector3SubtractValue (v, sub) { - return r.BindVector3SubtractValue( +function Vector4SubtractValue(v, add) { + return r.BindVector4SubtractValue( v.x, v.y, v.z, - sub + v.w, + add ) } -raylib.Vector3SubtractValue = Vector3SubtractValue +raylib.Vector4SubtractValue = Vector4SubtractValue -function Vector3Scale (v, scalar) { - return r.BindVector3Scale( +function Vector4Length(v) { + return r.BindVector4Length( v.x, v.y, v.z, - scalar - ) -} -raylib.Vector3Scale = Vector3Scale - -function Vector3Multiply (v1, v2) { - return r.BindVector3Multiply( - v1.x, - v1.y, - v1.z, - v2.x, - v2.y, - v2.z - ) -} -raylib.Vector3Multiply = Vector3Multiply - -function Vector3CrossProduct (v1, v2) { - return r.BindVector3CrossProduct( - v1.x, - v1.y, - v1.z, - v2.x, - v2.y, - v2.z + v.w ) } -raylib.Vector3CrossProduct = Vector3CrossProduct +raylib.Vector4Length = Vector4Length -function Vector3Perpendicular (v) { - return r.BindVector3Perpendicular( +function Vector4LengthSqr(v) { + return r.BindVector4LengthSqr( v.x, v.y, - v.z - ) -} -raylib.Vector3Perpendicular = Vector3Perpendicular - -function Vector3Length (v) { - return r.BindVector3Length( - v - ) -} -raylib.Vector3Length = Vector3Length - -function Vector3LengthSqr (v) { - return r.BindVector3LengthSqr( - v - ) -} -raylib.Vector3LengthSqr = Vector3LengthSqr - -function Vector3DotProduct (v1, v2) { - return r.BindVector3DotProduct( - v1.x, - v1.y, - v1.z, - v2.x, - v2.y, - v2.z + v.z, + v.w ) } -raylib.Vector3DotProduct = Vector3DotProduct +raylib.Vector4LengthSqr = Vector4LengthSqr -function Vector3Distance (v1, v2) { - return r.BindVector3Distance( +function Vector4DotProduct(v1, v2) { + return r.BindVector4DotProduct( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Distance = Vector3Distance +raylib.Vector4DotProduct = Vector4DotProduct -function Vector3DistanceSqr (v1, v2) { - return r.BindVector3DistanceSqr( +function Vector4Distance(v1, v2) { + return r.BindVector4Distance( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3DistanceSqr = Vector3DistanceSqr +raylib.Vector4Distance = Vector4Distance -function Vector3Angle (v1, v2) { - return r.BindVector3Angle( +function Vector4DistanceSqr(v1, v2) { + return r.BindVector4DistanceSqr( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Angle = Vector3Angle +raylib.Vector4DistanceSqr = Vector4DistanceSqr -function Vector3Negate (v) { - return r.BindVector3Negate( +function Vector4Scale(v, scale) { + return r.BindVector4Scale( v.x, v.y, - v.z + v.z, + v.w, + scale ) } -raylib.Vector3Negate = Vector3Negate +raylib.Vector4Scale = Vector4Scale -function Vector3Divide (v1, v2) { - return r.BindVector3Divide( +function Vector4Multiply(v1, v2) { + return r.BindVector4Multiply( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z - ) -} -raylib.Vector3Divide = Vector3Divide - -function Vector3Normalize (v) { - return r.BindVector3Normalize( - v.x, - v.y, - v.z - ) -} -raylib.Vector3Normalize = Vector3Normalize - -function Vector3OrthoNormalize (v1, v2) { - return r.BindVector3OrthoNormalize( - v1, - v2 + v2.z, + v2.w ) } -raylib.Vector3OrthoNormalize = Vector3OrthoNormalize +raylib.Vector4Multiply = Vector4Multiply -function Vector3Transform (v, mat) { - return r.BindVector3Transform( +function Vector4Negate(v) { + return r.BindVector4Negate( v.x, v.y, v.z, - mat.m0, - mat.m4, - mat.m8, - mat.m12, - mat.m1, - mat.m5, - mat.m9, - mat.m13, - mat.m2, - mat.m6, - mat.m10, - mat.m14, - mat.m3, - mat.m7, - mat.m11, - mat.m15 + v.w ) } -raylib.Vector3Transform = Vector3Transform +raylib.Vector4Negate = Vector4Negate -function Vector3RotateByQuaternion (v, q) { - return r.BindVector3RotateByQuaternion( - v.x, - v.y, - v.z, - q +function Vector4Divide(v1, v2) { + return r.BindVector4Divide( + v1.x, + v1.y, + v1.z, + v1.w, + v2.x, + v2.y, + v2.z, + v2.w ) } -raylib.Vector3RotateByQuaternion = Vector3RotateByQuaternion +raylib.Vector4Divide = Vector4Divide -function Vector3RotateByAxisAngle (v, axis, angle) { - return r.BindVector3RotateByAxisAngle( +function Vector4Normalize(v) { + return r.BindVector4Normalize( v.x, v.y, v.z, - axis.x, - axis.y, - axis.z, - angle + v.w ) } -raylib.Vector3RotateByAxisAngle = Vector3RotateByAxisAngle +raylib.Vector4Normalize = Vector4Normalize -function Vector3Lerp (v1, v2, amount) { - return r.BindVector3Lerp( +function Vector4Min(v1, v2) { + return r.BindVector4Min( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, v2.z, - amount - ) -} -raylib.Vector3Lerp = Vector3Lerp - -function Vector3Reflect (v, normal) { - return r.BindVector3Reflect( - v.x, - v.y, - v.z, - normal.x, - normal.y, - normal.z + v2.w ) } -raylib.Vector3Reflect = Vector3Reflect +raylib.Vector4Min = Vector4Min -function Vector3Min (v1, v2) { - return r.BindVector3Min( +function Vector4Max(v1, v2) { + return r.BindVector4Max( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Min = Vector3Min +raylib.Vector4Max = Vector4Max -function Vector3Max (v1, v2) { - return r.BindVector3Max( +function Vector4Lerp(v1, v2, amount) { + return r.BindVector4Lerp( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z - ) -} -raylib.Vector3Max = Vector3Max - -function Vector3Barycenter (p, a, b, c) { - return r.BindVector3Barycenter( - p.x, - p.y, - p.z, - a.x, - a.y, - a.z, - b.x, - b.y, - b.z, - c.x, - c.y, - c.z - ) -} -raylib.Vector3Barycenter = Vector3Barycenter - -function Vector3Unproject (source, projection, view) { - return r.BindVector3Unproject( - source.x, - source.y, - source.z, - projection.m0, - projection.m4, - projection.m8, - projection.m12, - projection.m1, - projection.m5, - projection.m9, - projection.m13, - projection.m2, - projection.m6, - projection.m10, - projection.m14, - projection.m3, - projection.m7, - projection.m11, - projection.m15, - view.m0, - view.m4, - view.m8, - view.m12, - view.m1, - view.m5, - view.m9, - view.m13, - view.m2, - view.m6, - view.m10, - view.m14, - view.m3, - view.m7, - view.m11, - view.m15 - ) -} -raylib.Vector3Unproject = Vector3Unproject - -function Vector3Invert (v) { - return r.BindVector3Invert( - v.x, - v.y, - v.z + v2.z, + v2.w, + amount ) } -raylib.Vector3Invert = Vector3Invert +raylib.Vector4Lerp = Vector4Lerp -function Vector3Clamp (v, min, max) { - return r.BindVector3Clamp( +function Vector4MoveTowards(v, target, maxDistance) { + return r.BindVector4MoveTowards( v.x, v.y, v.z, - min.x, - min.y, - min.z, - max.x, - max.y, - max.z + v.w, + target.x, + target.y, + target.z, + target.w, + maxDistance ) } -raylib.Vector3Clamp = Vector3Clamp +raylib.Vector4MoveTowards = Vector4MoveTowards -function Vector3ClampValue (v, min, max) { - return r.BindVector3ClampValue( +function Vector4Invert(v) { + return r.BindVector4Invert( v.x, v.y, v.z, - min, - max + v.w ) } -raylib.Vector3ClampValue = Vector3ClampValue +raylib.Vector4Invert = Vector4Invert -function Vector3Equals (p, q) { - return r.BindVector3Equals( +function Vector4Equals(p, q) { + return r.BindVector4Equals( p.x, p.y, p.z, + p.w, q.x, q.y, - q.z - ) -} -raylib.Vector3Equals = Vector3Equals - -function Vector3Refract (v, n, r) { - return r.BindVector3Refract( - v.x, - v.y, - v.z, - n.x, - n.y, - n.z, - r + q.z, + q.w ) } -raylib.Vector3Refract = Vector3Refract +raylib.Vector4Equals = Vector4Equals -function MatrixDeterminant (mat) { +function MatrixDeterminant(mat) { return r.BindMatrixDeterminant( mat.m0, mat.m4, @@ -10043,7 +11751,7 @@ function MatrixDeterminant (mat) { } raylib.MatrixDeterminant = MatrixDeterminant -function MatrixTrace (mat) { +function MatrixTrace(mat) { return r.BindMatrixTrace( mat.m0, mat.m4, @@ -10065,7 +11773,7 @@ function MatrixTrace (mat) { } raylib.MatrixTrace = MatrixTrace -function MatrixTranspose (mat) { +function MatrixTranspose(mat) { return r.BindMatrixTranspose( mat.m0, mat.m4, @@ -10087,7 +11795,7 @@ function MatrixTranspose (mat) { } raylib.MatrixTranspose = MatrixTranspose -function MatrixInvert (mat) { +function MatrixInvert(mat) { return r.BindMatrixInvert( mat.m0, mat.m4, @@ -10109,12 +11817,12 @@ function MatrixInvert (mat) { } raylib.MatrixInvert = MatrixInvert -function MatrixIdentity () { +function MatrixIdentity() { return r.BindMatrixIdentity() } raylib.MatrixIdentity = MatrixIdentity -function MatrixAdd (left, right) { +function MatrixAdd(left, right) { return r.BindMatrixAdd( left.m0, left.m4, @@ -10152,7 +11860,7 @@ function MatrixAdd (left, right) { } raylib.MatrixAdd = MatrixAdd -function MatrixSubtract (left, right) { +function MatrixSubtract(left, right) { return r.BindMatrixSubtract( left.m0, left.m4, @@ -10190,7 +11898,7 @@ function MatrixSubtract (left, right) { } raylib.MatrixSubtract = MatrixSubtract -function MatrixMultiply (left, right) { +function MatrixMultiply(left, right) { return r.BindMatrixMultiply( left.m0, left.m4, @@ -10228,7 +11936,7 @@ function MatrixMultiply (left, right) { } raylib.MatrixMultiply = MatrixMultiply -function MatrixTranslate (x, y, z) { +function MatrixTranslate(x, y, z) { return r.BindMatrixTranslate( x, y, @@ -10237,7 +11945,7 @@ function MatrixTranslate (x, y, z) { } raylib.MatrixTranslate = MatrixTranslate -function MatrixRotate (axis, angle) { +function MatrixRotate(axis, angle) { return r.BindMatrixRotate( axis.x, axis.y, @@ -10247,28 +11955,28 @@ function MatrixRotate (axis, angle) { } raylib.MatrixRotate = MatrixRotate -function MatrixRotateX (angle) { +function MatrixRotateX(angle) { return r.BindMatrixRotateX( angle ) } raylib.MatrixRotateX = MatrixRotateX -function MatrixRotateY (angle) { +function MatrixRotateY(angle) { return r.BindMatrixRotateY( angle ) } raylib.MatrixRotateY = MatrixRotateY -function MatrixRotateZ (angle) { +function MatrixRotateZ(angle) { return r.BindMatrixRotateZ( angle ) } raylib.MatrixRotateZ = MatrixRotateZ -function MatrixRotateXYZ (angle) { +function MatrixRotateXYZ(angle) { return r.BindMatrixRotateXYZ( angle.x, angle.y, @@ -10277,7 +11985,7 @@ function MatrixRotateXYZ (angle) { } raylib.MatrixRotateXYZ = MatrixRotateXYZ -function MatrixRotateZYX (angle) { +function MatrixRotateZYX(angle) { return r.BindMatrixRotateZYX( angle.x, angle.y, @@ -10286,7 +11994,7 @@ function MatrixRotateZYX (angle) { } raylib.MatrixRotateZYX = MatrixRotateZYX -function MatrixScale (x, y, z) { +function MatrixScale(x, y, z) { return r.BindMatrixScale( x, y, @@ -10295,41 +12003,41 @@ function MatrixScale (x, y, z) { } raylib.MatrixScale = MatrixScale -function MatrixFrustum (left, right, bottom, top, near, far) { +function MatrixFrustum(left, right, bottom, top, nearPlane, farPlane) { return r.BindMatrixFrustum( left, right, bottom, top, - near, - far + nearPlane, + farPlane ) } raylib.MatrixFrustum = MatrixFrustum -function MatrixPerspective (fovy, aspect, near, far) { +function MatrixPerspective(fovY, aspect, nearPlane, farPlane) { return r.BindMatrixPerspective( - fovy, + fovY, aspect, - near, - far + nearPlane, + farPlane ) } raylib.MatrixPerspective = MatrixPerspective -function MatrixOrtho (left, right, bottom, top, near, far) { +function MatrixOrtho(left, right, bottom, top, nearPlane, farPlane) { return r.BindMatrixOrtho( left, right, bottom, top, - near, - far + nearPlane, + farPlane ) } raylib.MatrixOrtho = MatrixOrtho -function MatrixLookAt (eye, target, up) { +function MatrixLookAt(eye, target, up) { return r.BindMatrixLookAt( eye.x, eye.y, @@ -10344,7 +12052,7 @@ function MatrixLookAt (eye, target, up) { } raylib.MatrixLookAt = MatrixLookAt -function QuaternionAdd (q1, q2) { +function QuaternionAdd(q1, q2) { return r.BindQuaternionAdd( q1, q2 @@ -10352,7 +12060,7 @@ function QuaternionAdd (q1, q2) { } raylib.QuaternionAdd = QuaternionAdd -function QuaternionAddValue (q, add) { +function QuaternionAddValue(q, add) { return r.BindQuaternionAddValue( q, add @@ -10360,7 +12068,7 @@ function QuaternionAddValue (q, add) { } raylib.QuaternionAddValue = QuaternionAddValue -function QuaternionSubtract (q1, q2) { +function QuaternionSubtract(q1, q2) { return r.BindQuaternionSubtract( q1, q2 @@ -10368,7 +12076,7 @@ function QuaternionSubtract (q1, q2) { } raylib.QuaternionSubtract = QuaternionSubtract -function QuaternionSubtractValue (q, sub) { +function QuaternionSubtractValue(q, sub) { return r.BindQuaternionSubtractValue( q, sub @@ -10376,33 +12084,33 @@ function QuaternionSubtractValue (q, sub) { } raylib.QuaternionSubtractValue = QuaternionSubtractValue -function QuaternionIdentity () { +function QuaternionIdentity() { return r.BindQuaternionIdentity() } raylib.QuaternionIdentity = QuaternionIdentity -function QuaternionLength (q) { +function QuaternionLength(q) { return r.BindQuaternionLength( q ) } raylib.QuaternionLength = QuaternionLength -function QuaternionNormalize (q) { +function QuaternionNormalize(q) { return r.BindQuaternionNormalize( q ) } raylib.QuaternionNormalize = QuaternionNormalize -function QuaternionInvert (q) { +function QuaternionInvert(q) { return r.BindQuaternionInvert( q ) } raylib.QuaternionInvert = QuaternionInvert -function QuaternionMultiply (q1, q2) { +function QuaternionMultiply(q1, q2) { return r.BindQuaternionMultiply( q1, q2 @@ -10410,7 +12118,7 @@ function QuaternionMultiply (q1, q2) { } raylib.QuaternionMultiply = QuaternionMultiply -function QuaternionScale (q, mul) { +function QuaternionScale(q, mul) { return r.BindQuaternionScale( q, mul @@ -10418,7 +12126,7 @@ function QuaternionScale (q, mul) { } raylib.QuaternionScale = QuaternionScale -function QuaternionDivide (q1, q2) { +function QuaternionDivide(q1, q2) { return r.BindQuaternionDivide( q1, q2 @@ -10426,7 +12134,7 @@ function QuaternionDivide (q1, q2) { } raylib.QuaternionDivide = QuaternionDivide -function QuaternionLerp (q1, q2, amount) { +function QuaternionLerp(q1, q2, amount) { return r.BindQuaternionLerp( q1, q2, @@ -10435,7 +12143,7 @@ function QuaternionLerp (q1, q2, amount) { } raylib.QuaternionLerp = QuaternionLerp -function QuaternionNlerp (q1, q2, amount) { +function QuaternionNlerp(q1, q2, amount) { return r.BindQuaternionNlerp( q1, q2, @@ -10444,7 +12152,7 @@ function QuaternionNlerp (q1, q2, amount) { } raylib.QuaternionNlerp = QuaternionNlerp -function QuaternionSlerp (q1, q2, amount) { +function QuaternionSlerp(q1, q2, amount) { return r.BindQuaternionSlerp( q1, q2, @@ -10453,7 +12161,18 @@ function QuaternionSlerp (q1, q2, amount) { } raylib.QuaternionSlerp = QuaternionSlerp -function QuaternionFromVector3ToVector3 (from, to) { +function QuaternionCubicHermiteSpline(q1, outTangent1, q2, inTangent2, t) { + return r.BindQuaternionCubicHermiteSpline( + q1, + outTangent1, + q2, + inTangent2, + t + ) +} +raylib.QuaternionCubicHermiteSpline = QuaternionCubicHermiteSpline + +function QuaternionFromVector3ToVector3(from, to) { return r.BindQuaternionFromVector3ToVector3( from.x, from.y, @@ -10465,7 +12184,7 @@ function QuaternionFromVector3ToVector3 (from, to) { } raylib.QuaternionFromVector3ToVector3 = QuaternionFromVector3ToVector3 -function QuaternionFromMatrix (mat) { +function QuaternionFromMatrix(mat) { return r.BindQuaternionFromMatrix( mat.m0, mat.m4, @@ -10487,14 +12206,14 @@ function QuaternionFromMatrix (mat) { } raylib.QuaternionFromMatrix = QuaternionFromMatrix -function QuaternionToMatrix (q) { +function QuaternionToMatrix(q) { return r.BindQuaternionToMatrix( q ) } raylib.QuaternionToMatrix = QuaternionToMatrix -function QuaternionFromAxisAngle (axis, angle) { +function QuaternionFromAxisAngle(axis, angle) { return r.BindQuaternionFromAxisAngle( axis.x, axis.y, @@ -10504,7 +12223,7 @@ function QuaternionFromAxisAngle (axis, angle) { } raylib.QuaternionFromAxisAngle = QuaternionFromAxisAngle -function QuaternionToAxisAngle (q, outAxis, outAngle) { +function QuaternionToAxisAngle(q, outAxis, outAngle) { return r.BindQuaternionToAxisAngle( q, outAxis, @@ -10513,7 +12232,7 @@ function QuaternionToAxisAngle (q, outAxis, outAngle) { } raylib.QuaternionToAxisAngle = QuaternionToAxisAngle -function QuaternionFromEuler (pitch, yaw, roll) { +function QuaternionFromEuler(pitch, yaw, roll) { return r.BindQuaternionFromEuler( pitch, yaw, @@ -10522,14 +12241,14 @@ function QuaternionFromEuler (pitch, yaw, roll) { } raylib.QuaternionFromEuler = QuaternionFromEuler -function QuaternionToEuler (q) { +function QuaternionToEuler(q) { return r.BindQuaternionToEuler( q ) } raylib.QuaternionToEuler = QuaternionToEuler -function QuaternionTransform (q, mat) { +function QuaternionTransform(q, mat) { return r.BindQuaternionTransform( q, mat.m0, @@ -10552,7 +12271,7 @@ function QuaternionTransform (q, mat) { } raylib.QuaternionTransform = QuaternionTransform -function QuaternionEquals (p, q) { +function QuaternionEquals(p, q) { return r.BindQuaternionEquals( p, q @@ -10560,12 +12279,37 @@ function QuaternionEquals (p, q) { } raylib.QuaternionEquals = QuaternionEquals +function MatrixDecompose(mat, translation, rotation, scale) { + return r.BindMatrixDecompose( + mat.m0, + mat.m4, + mat.m8, + mat.m12, + mat.m1, + mat.m5, + mat.m9, + mat.m13, + mat.m2, + mat.m6, + mat.m10, + mat.m14, + mat.m3, + mat.m7, + mat.m11, + mat.m15, + translation, + rotation, + scale + ) +} +raylib.MatrixDecompose = MatrixDecompose + /** * Enable gui controls (global state) * * @return {undefined} */ -function GuiEnable () { +function GuiEnable() { return r.BindGuiEnable() } raylib.GuiEnable = GuiEnable @@ -10575,7 +12319,7 @@ raylib.GuiEnable = GuiEnable * * @return {undefined} */ -function GuiDisable () { +function GuiDisable() { return r.BindGuiDisable() } raylib.GuiDisable = GuiDisable @@ -10585,7 +12329,7 @@ raylib.GuiDisable = GuiDisable * * @return {undefined} */ -function GuiLock () { +function GuiLock() { return r.BindGuiLock() } raylib.GuiLock = GuiLock @@ -10595,7 +12339,7 @@ raylib.GuiLock = GuiLock * * @return {undefined} */ -function GuiUnlock () { +function GuiUnlock() { return r.BindGuiUnlock() } raylib.GuiUnlock = GuiUnlock @@ -10605,7 +12349,7 @@ raylib.GuiUnlock = GuiUnlock * * @return {boolean} The resulting bool. */ -function GuiIsLocked () { +function GuiIsLocked() { return r.BindGuiIsLocked() } raylib.GuiIsLocked = GuiIsLocked @@ -10617,12 +12361,12 @@ raylib.GuiIsLocked = GuiIsLocked * * @return {undefined} */ -function GuiFade (alpha) { - return r.BindGuiFade( +function GuiSetAlpha(alpha) { + return r.BindGuiSetAlpha( alpha ) } -raylib.GuiFade = GuiFade +raylib.GuiSetAlpha = GuiSetAlpha /** * Set gui state (global state) @@ -10631,7 +12375,7 @@ raylib.GuiFade = GuiFade * * @return {undefined} */ -function GuiSetState (state) { +function GuiSetState(state) { return r.BindGuiSetState( state ) @@ -10643,77 +12387,216 @@ raylib.GuiSetState = GuiSetState * * @return {number} The resulting int. */ -function GuiGetState () { - return r.BindGuiGetState() +function GuiGetState() { + return r.BindGuiGetState() +} +raylib.GuiGetState = GuiGetState + +/** + * Set gui custom font (global state) + * + * @param {Font} font + * + * @return {undefined} + */ +function GuiSetFont(font) { + return r.BindGuiSetFont( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs + ) +} +raylib.GuiSetFont = GuiSetFont + +/** + * Get gui custom font (global state) + * + * @return {Font} The resulting Font. + */ +function GuiGetFont() { + return r.BindGuiGetFont() +} +raylib.GuiGetFont = GuiGetFont + +/** + * Set one style property + * + * @param {number} control + * @param {number} property + * @param {number} value + * + * @return {undefined} + */ +function GuiSetStyle(control, property, value) { + return r.BindGuiSetStyle( + control, + property, + value + ) +} +raylib.GuiSetStyle = GuiSetStyle + +/** + * Get one style property + * + * @param {number} control + * @param {number} property + * + * @return {number} The resulting int. + */ +function GuiGetStyle(control, property) { + return r.BindGuiGetStyle( + control, + property + ) +} +raylib.GuiGetStyle = GuiGetStyle + +/** + * Load style file over global style variable (.rgs) + * + * @param {string} fileName + * + * @return {undefined} + */ +function GuiLoadStyle(fileName) { + return r.BindGuiLoadStyle( + fileName + ) +} +raylib.GuiLoadStyle = GuiLoadStyle + +/** + * Load style default over global style + * + * @return {undefined} + */ +function GuiLoadStyleDefault() { + return r.BindGuiLoadStyleDefault() +} +raylib.GuiLoadStyleDefault = GuiLoadStyleDefault + +/** + * Enable gui tooltips (global state) + * + * @return {undefined} + */ +function GuiEnableTooltip() { + return r.BindGuiEnableTooltip() +} +raylib.GuiEnableTooltip = GuiEnableTooltip + +/** + * Disable gui tooltips (global state) + * + * @return {undefined} + */ +function GuiDisableTooltip() { + return r.BindGuiDisableTooltip() +} +raylib.GuiDisableTooltip = GuiDisableTooltip + +/** + * Set tooltip string + * + * @param {string} tooltip + * + * @return {undefined} + */ +function GuiSetTooltip(tooltip) { + return r.BindGuiSetTooltip( + tooltip + ) +} +raylib.GuiSetTooltip = GuiSetTooltip + +/** + * Get text with icon id prepended (if supported) + * + * @param {number} iconId + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function GuiIconText(iconId, text) { + return r.BindGuiIconText( + iconId, + text + ) } -raylib.GuiGetState = GuiGetState +raylib.GuiIconText = GuiIconText /** - * Set gui custom font (global state) + * Set default icon drawing size * - * @param {Font} font + * @param {number} scale * * @return {undefined} */ -function GuiSetFont (font) { - return r.BindGuiSetFont( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs +function GuiSetIconScale(scale) { + return r.BindGuiSetIconScale( + scale ) } -raylib.GuiSetFont = GuiSetFont +raylib.GuiSetIconScale = GuiSetIconScale /** - * Get gui custom font (global state) + * Get raygui icons data pointer * - * @return {Font} The resulting Font. + * @return {number} The resulting unsigned int *. */ -function GuiGetFont () { - return r.BindGuiGetFont() +function GuiGetIcons() { + return r.BindGuiGetIcons() } -raylib.GuiGetFont = GuiGetFont +raylib.GuiGetIcons = GuiGetIcons /** - * Set one style property + * Load raygui icons file (.rgi) into internal icons data * - * @param {number} control - * @param {number} property - * @param {number} value + * @param {string} fileName + * @param {boolean} loadIconsName * - * @return {undefined} + * @return {number} The resulting char **. */ -function GuiSetStyle (control, property, value) { - return r.BindGuiSetStyle( - control, - property, - value +function GuiLoadIcons(fileName, loadIconsName) { + return r.BindGuiLoadIcons( + fileName, + loadIconsName ) } -raylib.GuiSetStyle = GuiSetStyle +raylib.GuiLoadIcons = GuiLoadIcons /** - * Get one style property + * Draw icon using pixel size at specified position * - * @param {number} control - * @param {number} property + * @param {number} iconId + * @param {number} posX + * @param {number} posY + * @param {number} pixelSize + * @param {Color} color * - * @return {number} The resulting int. + * @return {undefined} */ -function GuiGetStyle (control, property) { - return r.BindGuiGetStyle( - control, - property +function GuiDrawIcon(iconId, posX, posY, pixelSize, color) { + return r.BindGuiDrawIcon( + iconId, + posX, + posY, + pixelSize, + color.r, + color.g, + color.b, + color.a ) } -raylib.GuiGetStyle = GuiGetStyle +raylib.GuiDrawIcon = GuiDrawIcon /** * Window Box control, shows a window that can be closed @@ -10721,9 +12604,9 @@ raylib.GuiGetStyle = GuiGetStyle * @param {Rectangle} bounds * @param {string} title * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiWindowBox (bounds, title) { +function GuiWindowBox(bounds, title) { return r.BindGuiWindowBox( bounds.x, bounds.y, @@ -10740,9 +12623,9 @@ raylib.GuiWindowBox = GuiWindowBox * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiGroupBox (bounds, text) { +function GuiGroupBox(bounds, text) { return r.BindGuiGroupBox( bounds.x, bounds.y, @@ -10759,9 +12642,9 @@ raylib.GuiGroupBox = GuiGroupBox * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiLine (bounds, text) { +function GuiLine(bounds, text) { return r.BindGuiLine( bounds.x, bounds.y, @@ -10778,9 +12661,9 @@ raylib.GuiLine = GuiLine * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiPanel (bounds, text) { +function GuiPanel(bounds, text) { return r.BindGuiPanel( bounds.x, bounds.y, @@ -10801,7 +12684,7 @@ raylib.GuiPanel = GuiPanel * * @return {number} The resulting int. */ -function GuiTabBar (bounds, text, count, active) { +function GuiTabBar(bounds, text, count, active) { return r.BindGuiTabBar( bounds.x, bounds.y, @@ -10821,10 +12704,11 @@ raylib.GuiTabBar = GuiTabBar * @param {string} text * @param {Rectangle} content * @param {number} scroll + * @param {number} view * - * @return {Rectangle} The resulting Rectangle. + * @return {number} The resulting int. */ -function GuiScrollPanel (bounds, text, content, scroll) { +function GuiScrollPanel(bounds, text, content, scroll, view) { return r.BindGuiScrollPanel( bounds.x, bounds.y, @@ -10835,20 +12719,21 @@ function GuiScrollPanel (bounds, text, content, scroll) { content.y, content.width, content.height, - scroll + scroll, + view ) } raylib.GuiScrollPanel = GuiScrollPanel /** - * Label control, shows text + * Label control * * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiLabel (bounds, text) { +function GuiLabel(bounds, text) { return r.BindGuiLabel( bounds.x, bounds.y, @@ -10865,9 +12750,9 @@ raylib.GuiLabel = GuiLabel * @param {Rectangle} bounds * @param {string} text * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiButton (bounds, text) { +function GuiButton(bounds, text) { return r.BindGuiButton( bounds.x, bounds.y, @@ -10879,14 +12764,14 @@ function GuiButton (bounds, text) { raylib.GuiButton = GuiButton /** - * Label button control, show true when clicked + * Label button control, returns true when clicked * * @param {Rectangle} bounds * @param {string} text * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiLabelButton (bounds, text) { +function GuiLabelButton(bounds, text) { return r.BindGuiLabelButton( bounds.x, bounds.y, @@ -10898,15 +12783,15 @@ function GuiLabelButton (bounds, text) { raylib.GuiLabelButton = GuiLabelButton /** - * Toggle Button control, returns true when active + * Toggle Button control * * @param {Rectangle} bounds * @param {string} text - * @param {boolean} active + * @param {number} active * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiToggle (bounds, text, active) { +function GuiToggle(bounds, text, active) { return r.BindGuiToggle( bounds.x, bounds.y, @@ -10919,7 +12804,7 @@ function GuiToggle (bounds, text, active) { raylib.GuiToggle = GuiToggle /** - * Toggle Group control, returns active toggle index + * Toggle Group control * * @param {Rectangle} bounds * @param {string} text @@ -10927,7 +12812,7 @@ raylib.GuiToggle = GuiToggle * * @return {number} The resulting int. */ -function GuiToggleGroup (bounds, text, active) { +function GuiToggleGroup(bounds, text, active) { return r.BindGuiToggleGroup( bounds.x, bounds.y, @@ -10939,16 +12824,37 @@ function GuiToggleGroup (bounds, text, active) { } raylib.GuiToggleGroup = GuiToggleGroup +/** + * Toggle Slider control + * + * @param {Rectangle} bounds + * @param {string} text + * @param {number} active + * + * @return {number} The resulting int. + */ +function GuiToggleSlider(bounds, text, active) { + return r.BindGuiToggleSlider( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + active + ) +} +raylib.GuiToggleSlider = GuiToggleSlider + /** * Check Box control, returns true when active * * @param {Rectangle} bounds * @param {string} text - * @param {boolean} checked + * @param {number} checked * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiCheckBox (bounds, text, checked) { +function GuiCheckBox(bounds, text, checked) { return r.BindGuiCheckBox( bounds.x, bounds.y, @@ -10961,7 +12867,7 @@ function GuiCheckBox (bounds, text, checked) { raylib.GuiCheckBox = GuiCheckBox /** - * Combo Box control, returns selected item index + * Combo Box control * * @param {Rectangle} bounds * @param {string} text @@ -10969,7 +12875,7 @@ raylib.GuiCheckBox = GuiCheckBox * * @return {number} The resulting int. */ -function GuiComboBox (bounds, text, active) { +function GuiComboBox(bounds, text, active) { return r.BindGuiComboBox( bounds.x, bounds.y, @@ -10982,16 +12888,16 @@ function GuiComboBox (bounds, text, active) { raylib.GuiComboBox = GuiComboBox /** - * Dropdown Box control, returns selected item + * Dropdown Box control * * @param {Rectangle} bounds * @param {string} text * @param {number} active * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiDropdownBox (bounds, text, active, editMode) { +function GuiDropdownBox(bounds, text, active, editMode) { return r.BindGuiDropdownBox( bounds.x, bounds.y, @@ -11005,7 +12911,7 @@ function GuiDropdownBox (bounds, text, active, editMode) { raylib.GuiDropdownBox = GuiDropdownBox /** - * Spinner control, returns selected value + * Spinner control * * @param {Rectangle} bounds * @param {string} text @@ -11014,9 +12920,9 @@ raylib.GuiDropdownBox = GuiDropdownBox * @param {number} maxValue * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiSpinner (bounds, text, value, minValue, maxValue, editMode) { +function GuiSpinner(bounds, text, value, minValue, maxValue, editMode) { return r.BindGuiSpinner( bounds.x, bounds.y, @@ -11041,9 +12947,9 @@ raylib.GuiSpinner = GuiSpinner * @param {number} maxValue * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiValueBox (bounds, text, value, minValue, maxValue, editMode) { +function GuiValueBox(bounds, text, value, minValue, maxValue, editMode) { return r.BindGuiValueBox( bounds.x, bounds.y, @@ -11059,40 +12965,42 @@ function GuiValueBox (bounds, text, value, minValue, maxValue, editMode) { raylib.GuiValueBox = GuiValueBox /** - * Text Box control, updates input text + * Value box control for float values * * @param {Rectangle} bounds * @param {string} text - * @param {number} textSize + * @param {string} textValue + * @param {number} value * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiTextBox (bounds, text, textSize, editMode) { - return r.BindGuiTextBox( +function GuiValueBoxFloat(bounds, text, textValue, value, editMode) { + return r.BindGuiValueBoxFloat( bounds.x, bounds.y, bounds.width, bounds.height, text, - textSize, + textValue, + value, editMode ) } -raylib.GuiTextBox = GuiTextBox +raylib.GuiValueBoxFloat = GuiValueBoxFloat /** - * Text Box control with multiple lines + * Text Box control, updates input text * * @param {Rectangle} bounds * @param {string} text * @param {number} textSize * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiTextBoxMulti (bounds, text, textSize, editMode) { - return r.BindGuiTextBoxMulti( +function GuiTextBox(bounds, text, textSize, editMode) { + return r.BindGuiTextBox( bounds.x, bounds.y, bounds.width, @@ -11102,10 +13010,10 @@ function GuiTextBoxMulti (bounds, text, textSize, editMode) { editMode ) } -raylib.GuiTextBoxMulti = GuiTextBoxMulti +raylib.GuiTextBox = GuiTextBox /** - * Slider control, returns selected value + * Slider control * * @param {Rectangle} bounds * @param {string} textLeft @@ -11114,9 +13022,9 @@ raylib.GuiTextBoxMulti = GuiTextBoxMulti * @param {number} minValue * @param {number} maxValue * - * @return {number} The resulting float. + * @return {number} The resulting int. */ -function GuiSlider (bounds, textLeft, textRight, value, minValue, maxValue) { +function GuiSlider(bounds, textLeft, textRight, value, minValue, maxValue) { return r.BindGuiSlider( bounds.x, bounds.y, @@ -11132,7 +13040,7 @@ function GuiSlider (bounds, textLeft, textRight, value, minValue, maxValue) { raylib.GuiSlider = GuiSlider /** - * Slider Bar control, returns selected value + * Slider Bar control * * @param {Rectangle} bounds * @param {string} textLeft @@ -11141,9 +13049,9 @@ raylib.GuiSlider = GuiSlider * @param {number} minValue * @param {number} maxValue * - * @return {number} The resulting float. + * @return {number} The resulting int. */ -function GuiSliderBar (bounds, textLeft, textRight, value, minValue, maxValue) { +function GuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue) { return r.BindGuiSliderBar( bounds.x, bounds.y, @@ -11159,7 +13067,7 @@ function GuiSliderBar (bounds, textLeft, textRight, value, minValue, maxValue) { raylib.GuiSliderBar = GuiSliderBar /** - * Progress Bar control, shows current progress value + * Progress Bar control * * @param {Rectangle} bounds * @param {string} textLeft @@ -11168,9 +13076,9 @@ raylib.GuiSliderBar = GuiSliderBar * @param {number} minValue * @param {number} maxValue * - * @return {number} The resulting float. + * @return {number} The resulting int. */ -function GuiProgressBar (bounds, textLeft, textRight, value, minValue, maxValue) { +function GuiProgressBar(bounds, textLeft, textRight, value, minValue, maxValue) { return r.BindGuiProgressBar( bounds.x, bounds.y, @@ -11191,9 +13099,9 @@ raylib.GuiProgressBar = GuiProgressBar * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiStatusBar (bounds, text) { +function GuiStatusBar(bounds, text) { return r.BindGuiStatusBar( bounds.x, bounds.y, @@ -11210,9 +13118,9 @@ raylib.GuiStatusBar = GuiStatusBar * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiDummyRec (bounds, text) { +function GuiDummyRec(bounds, text) { return r.BindGuiDummyRec( bounds.x, bounds.y, @@ -11224,16 +13132,17 @@ function GuiDummyRec (bounds, text) { raylib.GuiDummyRec = GuiDummyRec /** - * Grid control, returns mouse cell position + * Grid control * * @param {Rectangle} bounds * @param {string} text * @param {number} spacing * @param {number} subdivs + * @param {number} mouseCell * - * @return {Vector2} The resulting Vector2. + * @return {number} The resulting int. */ -function GuiGrid (bounds, text, spacing, subdivs) { +function GuiGrid(bounds, text, spacing, subdivs, mouseCell) { return r.BindGuiGrid( bounds.x, bounds.y, @@ -11241,13 +13150,14 @@ function GuiGrid (bounds, text, spacing, subdivs) { bounds.height, text, spacing, - subdivs + subdivs, + mouseCell ) } raylib.GuiGrid = GuiGrid /** - * List View control, returns selected list item index + * List View control * * @param {Rectangle} bounds * @param {string} text @@ -11256,7 +13166,7 @@ raylib.GuiGrid = GuiGrid * * @return {number} The resulting int. */ -function GuiListView (bounds, text, scrollIndex, active) { +function GuiListView(bounds, text, scrollIndex, active) { return r.BindGuiListView( bounds.x, bounds.y, @@ -11275,13 +13185,13 @@ raylib.GuiListView = GuiListView * @param {Rectangle} bounds * @param {number} text * @param {number} count - * @param {number} focus * @param {number} scrollIndex * @param {number} active + * @param {number} focus * * @return {number} The resulting int. */ -function GuiListViewEx (bounds, text, count, focus, scrollIndex, active) { +function GuiListViewEx(bounds, text, count, scrollIndex, active, focus) { return r.BindGuiListViewEx( bounds.x, bounds.y, @@ -11289,9 +13199,9 @@ function GuiListViewEx (bounds, text, count, focus, scrollIndex, active) { bounds.height, text, count, - focus, scrollIndex, - active + active, + focus ) } raylib.GuiListViewEx = GuiListViewEx @@ -11306,7 +13216,7 @@ raylib.GuiListViewEx = GuiListViewEx * * @return {number} The resulting int. */ -function GuiMessageBox (bounds, title, message, buttons) { +function GuiMessageBox(bounds, title, message, buttons) { return r.BindGuiMessageBox( bounds.x, bounds.y, @@ -11332,7 +13242,7 @@ raylib.GuiMessageBox = GuiMessageBox * * @return {number} The resulting int. */ -function GuiTextInputBox (bounds, title, message, buttons, text, textMaxSize, secretViewActive) { +function GuiTextInputBox(bounds, title, message, buttons, text, textMaxSize, secretViewActive) { return r.BindGuiTextInputBox( bounds.x, bounds.y, @@ -11353,21 +13263,18 @@ raylib.GuiTextInputBox = GuiTextInputBox * * @param {Rectangle} bounds * @param {string} text - * @param {Color} color + * @param {number} color * - * @return {Color} The resulting Color. + * @return {number} The resulting int. */ -function GuiColorPicker (bounds, text, color) { +function GuiColorPicker(bounds, text, color) { return r.BindGuiColorPicker( bounds.x, bounds.y, bounds.width, bounds.height, text, - color.r, - color.g, - color.b, - color.a + color ) } raylib.GuiColorPicker = GuiColorPicker @@ -11377,21 +13284,18 @@ raylib.GuiColorPicker = GuiColorPicker * * @param {Rectangle} bounds * @param {string} text - * @param {Color} color + * @param {number} color * - * @return {Color} The resulting Color. + * @return {number} The resulting int. */ -function GuiColorPanel (bounds, text, color) { +function GuiColorPanel(bounds, text, color) { return r.BindGuiColorPanel( bounds.x, bounds.y, bounds.width, bounds.height, text, - color.r, - color.g, - color.b, - color.a + color ) } raylib.GuiColorPanel = GuiColorPanel @@ -11399,172 +13303,86 @@ raylib.GuiColorPanel = GuiColorPanel /** * Color Bar Alpha control * - * @param {Rectangle} bounds - * @param {string} text - * @param {number} alpha - * - * @return {number} The resulting float. - */ -function GuiColorBarAlpha (bounds, text, alpha) { - return r.BindGuiColorBarAlpha( - bounds.x, - bounds.y, - bounds.width, - bounds.height, - text, - alpha - ) -} -raylib.GuiColorBarAlpha = GuiColorBarAlpha - -/** - * Color Bar Hue control - * - * @param {Rectangle} bounds - * @param {string} text - * @param {number} value - * - * @return {number} The resulting float. - */ -function GuiColorBarHue (bounds, text, value) { - return r.BindGuiColorBarHue( - bounds.x, - bounds.y, - bounds.width, - bounds.height, - text, - value - ) -} -raylib.GuiColorBarHue = GuiColorBarHue - -/** - * Load style file over global style variable (.rgs) - * - * @param {string} fileName - * - * @return {undefined} - */ -function GuiLoadStyle (fileName) { - return r.BindGuiLoadStyle( - fileName - ) -} -raylib.GuiLoadStyle = GuiLoadStyle - -/** - * Load style default over global style - * - * @return {undefined} - */ -function GuiLoadStyleDefault () { - return r.BindGuiLoadStyleDefault() -} -raylib.GuiLoadStyleDefault = GuiLoadStyleDefault - -/** - * Enable gui tooltips (global state) - * - * @return {undefined} - */ -function GuiEnableTooltip () { - return r.BindGuiEnableTooltip() -} -raylib.GuiEnableTooltip = GuiEnableTooltip - -/** - * Disable gui tooltips (global state) - * - * @return {undefined} - */ -function GuiDisableTooltip () { - return r.BindGuiDisableTooltip() -} -raylib.GuiDisableTooltip = GuiDisableTooltip - -/** - * Set tooltip string - * - * @param {string} tooltip - * - * @return {undefined} - */ -function GuiSetTooltip (tooltip) { - return r.BindGuiSetTooltip( - tooltip - ) -} -raylib.GuiSetTooltip = GuiSetTooltip - -/** - * Get text with icon id prepended (if supported) - * - * @param {number} iconId + * @param {Rectangle} bounds * @param {string} text + * @param {number} alpha * - * @return {string} The resulting const char *. + * @return {number} The resulting int. */ -function GuiIconText (iconId, text) { - return r.BindGuiIconText( - iconId, - text +function GuiColorBarAlpha(bounds, text, alpha) { + return r.BindGuiColorBarAlpha( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + alpha ) } -raylib.GuiIconText = GuiIconText +raylib.GuiColorBarAlpha = GuiColorBarAlpha /** - * Get raygui icons data pointer + * Color Bar Hue control * - * @return {number} The resulting unsigned int *. + * @param {Rectangle} bounds + * @param {string} text + * @param {number} value + * + * @return {number} The resulting int. */ -function GuiGetIcons () { - return r.BindGuiGetIcons() +function GuiColorBarHue(bounds, text, value) { + return r.BindGuiColorBarHue( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + value + ) } -raylib.GuiGetIcons = GuiGetIcons +raylib.GuiColorBarHue = GuiColorBarHue /** - * Load raygui icons file (.rgi) into internal icons data + * Color Picker control that avoids conversion to RGB on each call (multiple color controls) * - * @param {string} fileName - * @param {boolean} loadIconsName + * @param {Rectangle} bounds + * @param {string} text + * @param {number} colorHsv * - * @return {number} The resulting char **. + * @return {number} The resulting int. */ -function GuiLoadIcons (fileName, loadIconsName) { - return r.BindGuiLoadIcons( - fileName, - loadIconsName - ) -} -raylib.GuiLoadIcons = GuiLoadIcons - -function GuiDrawIcon (iconId, posX, posY, pixelSize, color) { - return r.BindGuiDrawIcon( - iconId, - posX, - posY, - pixelSize, - color.r, - color.g, - color.b, - color.a +function GuiColorPickerHSV(bounds, text, colorHsv) { + return r.BindGuiColorPickerHSV( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + colorHsv ) } -raylib.GuiDrawIcon = GuiDrawIcon +raylib.GuiColorPickerHSV = GuiColorPickerHSV /** - * Set icon drawing size + * Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV() * - * @param {number} scale + * @param {Rectangle} bounds + * @param {string} text + * @param {number} colorHsv * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiSetIconScale (scale) { - return r.BindGuiSetIconScale( - scale +function GuiColorPanelHSV(bounds, text, colorHsv) { + return r.BindGuiColorPanelHSV( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + colorHsv ) } -raylib.GuiSetIconScale = GuiSetIconScale +raylib.GuiColorPanelHSV = GuiColorPanelHSV /** * Choose the current matrix to be transformed @@ -11573,7 +13391,7 @@ raylib.GuiSetIconScale = GuiSetIconScale * * @return {undefined} */ -function rlMatrixMode (mode) { +function rlMatrixMode(mode) { return r.BindrlMatrixMode( mode ) @@ -11585,7 +13403,7 @@ raylib.rlMatrixMode = rlMatrixMode * * @return {undefined} */ -function rlPushMatrix () { +function rlPushMatrix() { return r.BindrlPushMatrix() } raylib.rlPushMatrix = rlPushMatrix @@ -11595,7 +13413,7 @@ raylib.rlPushMatrix = rlPushMatrix * * @return {undefined} */ -function rlPopMatrix () { +function rlPopMatrix() { return r.BindrlPopMatrix() } raylib.rlPopMatrix = rlPopMatrix @@ -11605,7 +13423,7 @@ raylib.rlPopMatrix = rlPopMatrix * * @return {undefined} */ -function rlLoadIdentity () { +function rlLoadIdentity() { return r.BindrlLoadIdentity() } raylib.rlLoadIdentity = rlLoadIdentity @@ -11619,7 +13437,7 @@ raylib.rlLoadIdentity = rlLoadIdentity * * @return {undefined} */ -function rlTranslatef (x, y, z) { +function rlTranslatef(x, y, z) { return r.BindrlTranslatef( x, y, @@ -11638,7 +13456,7 @@ raylib.rlTranslatef = rlTranslatef * * @return {undefined} */ -function rlRotatef (angle, x, y, z) { +function rlRotatef(angle, x, y, z) { return r.BindrlRotatef( angle, x, @@ -11657,7 +13475,7 @@ raylib.rlRotatef = rlRotatef * * @return {undefined} */ -function rlScalef (x, y, z) { +function rlScalef(x, y, z) { return r.BindrlScalef( x, y, @@ -11673,14 +13491,14 @@ raylib.rlScalef = rlScalef * * @return {undefined} */ -function rlMultMatrixf (matf) { +function rlMultMatrixf(matf) { return r.BindrlMultMatrixf( matf ) } raylib.rlMultMatrixf = rlMultMatrixf -function rlFrustum (left, right, bottom, top, znear, zfar) { +function rlFrustum(left, right, bottom, top, znear, zfar) { return r.BindrlFrustum( left, right, @@ -11692,7 +13510,7 @@ function rlFrustum (left, right, bottom, top, znear, zfar) { } raylib.rlFrustum = rlFrustum -function rlOrtho (left, right, bottom, top, znear, zfar) { +function rlOrtho(left, right, bottom, top, znear, zfar) { return r.BindrlOrtho( left, right, @@ -11714,7 +13532,7 @@ raylib.rlOrtho = rlOrtho * * @return {undefined} */ -function rlViewport (x, y, width, height) { +function rlViewport(x, y, width, height) { return r.BindrlViewport( x, y, @@ -11724,6 +13542,42 @@ function rlViewport (x, y, width, height) { } raylib.rlViewport = rlViewport +/** + * Set clip planes distances + * + * @param {number} nearPlane + * @param {number} farPlane + * + * @return {undefined} + */ +function rlSetClipPlanes(nearPlane, farPlane) { + return r.BindrlSetClipPlanes( + nearPlane, + farPlane + ) +} +raylib.rlSetClipPlanes = rlSetClipPlanes + +/** + * Get cull plane distance near + * + * @return {number} The resulting double. + */ +function rlGetCullDistanceNear() { + return r.BindrlGetCullDistanceNear() +} +raylib.rlGetCullDistanceNear = rlGetCullDistanceNear + +/** + * Get cull plane distance far + * + * @return {number} The resulting double. + */ +function rlGetCullDistanceFar() { + return r.BindrlGetCullDistanceFar() +} +raylib.rlGetCullDistanceFar = rlGetCullDistanceFar + /** * Initialize drawing mode (how to organize vertex) * @@ -11731,7 +13585,7 @@ raylib.rlViewport = rlViewport * * @return {undefined} */ -function rlBegin (mode) { +function rlBegin(mode) { return r.BindrlBegin( mode ) @@ -11743,7 +13597,7 @@ raylib.rlBegin = rlBegin * * @return {undefined} */ -function rlEnd () { +function rlEnd() { return r.BindrlEnd() } raylib.rlEnd = rlEnd @@ -11756,7 +13610,7 @@ raylib.rlEnd = rlEnd * * @return {undefined} */ -function rlVertex2i (x, y) { +function rlVertex2i(x, y) { return r.BindrlVertex2i( x, y @@ -11772,7 +13626,7 @@ raylib.rlVertex2i = rlVertex2i * * @return {undefined} */ -function rlVertex2f (x, y) { +function rlVertex2f(x, y) { return r.BindrlVertex2f( x, y @@ -11789,7 +13643,7 @@ raylib.rlVertex2f = rlVertex2f * * @return {undefined} */ -function rlVertex3f (x, y, z) { +function rlVertex3f(x, y, z) { return r.BindrlVertex3f( x, y, @@ -11806,7 +13660,7 @@ raylib.rlVertex3f = rlVertex3f * * @return {undefined} */ -function rlTexCoord2f (x, y) { +function rlTexCoord2f(x, y) { return r.BindrlTexCoord2f( x, y @@ -11823,7 +13677,7 @@ raylib.rlTexCoord2f = rlTexCoord2f * * @return {undefined} */ -function rlNormal3f (x, y, z) { +function rlNormal3f(x, y, z) { return r.BindrlNormal3f( x, y, @@ -11842,7 +13696,7 @@ raylib.rlNormal3f = rlNormal3f * * @return {undefined} */ -function rlColor4ub (r, g, b, a) { +function rlColor4ub(r, g, b, a) { return r.BindrlColor4ub( r, g, @@ -11861,7 +13715,7 @@ raylib.rlColor4ub = rlColor4ub * * @return {undefined} */ -function rlColor3f (x, y, z) { +function rlColor3f(x, y, z) { return r.BindrlColor3f( x, y, @@ -11880,7 +13734,7 @@ raylib.rlColor3f = rlColor3f * * @return {undefined} */ -function rlColor4f (x, y, z, w) { +function rlColor4f(x, y, z, w) { return r.BindrlColor4f( x, y, @@ -11897,7 +13751,7 @@ raylib.rlColor4f = rlColor4f * * @return {boolean} The resulting bool. */ -function rlEnableVertexArray (vaoId) { +function rlEnableVertexArray(vaoId) { return r.BindrlEnableVertexArray( vaoId ) @@ -11909,7 +13763,7 @@ raylib.rlEnableVertexArray = rlEnableVertexArray * * @return {undefined} */ -function rlDisableVertexArray () { +function rlDisableVertexArray() { return r.BindrlDisableVertexArray() } raylib.rlDisableVertexArray = rlDisableVertexArray @@ -11921,7 +13775,7 @@ raylib.rlDisableVertexArray = rlDisableVertexArray * * @return {undefined} */ -function rlEnableVertexBuffer (id) { +function rlEnableVertexBuffer(id) { return r.BindrlEnableVertexBuffer( id ) @@ -11933,7 +13787,7 @@ raylib.rlEnableVertexBuffer = rlEnableVertexBuffer * * @return {undefined} */ -function rlDisableVertexBuffer () { +function rlDisableVertexBuffer() { return r.BindrlDisableVertexBuffer() } raylib.rlDisableVertexBuffer = rlDisableVertexBuffer @@ -11945,7 +13799,7 @@ raylib.rlDisableVertexBuffer = rlDisableVertexBuffer * * @return {undefined} */ -function rlEnableVertexBufferElement (id) { +function rlEnableVertexBufferElement(id) { return r.BindrlEnableVertexBufferElement( id ) @@ -11957,7 +13811,7 @@ raylib.rlEnableVertexBufferElement = rlEnableVertexBufferElement * * @return {undefined} */ -function rlDisableVertexBufferElement () { +function rlDisableVertexBufferElement() { return r.BindrlDisableVertexBufferElement() } raylib.rlDisableVertexBufferElement = rlDisableVertexBufferElement @@ -11969,7 +13823,7 @@ raylib.rlDisableVertexBufferElement = rlDisableVertexBufferElement * * @return {undefined} */ -function rlEnableVertexAttribute (index) { +function rlEnableVertexAttribute(index) { return r.BindrlEnableVertexAttribute( index ) @@ -11983,7 +13837,7 @@ raylib.rlEnableVertexAttribute = rlEnableVertexAttribute * * @return {undefined} */ -function rlDisableVertexAttribute (index) { +function rlDisableVertexAttribute(index) { return r.BindrlDisableVertexAttribute( index ) @@ -11997,7 +13851,7 @@ raylib.rlDisableVertexAttribute = rlDisableVertexAttribute * * @return {undefined} */ -function rlActiveTextureSlot (slot) { +function rlActiveTextureSlot(slot) { return r.BindrlActiveTextureSlot( slot ) @@ -12011,7 +13865,7 @@ raylib.rlActiveTextureSlot = rlActiveTextureSlot * * @return {undefined} */ -function rlEnableTexture (id) { +function rlEnableTexture(id) { return r.BindrlEnableTexture( id ) @@ -12023,7 +13877,7 @@ raylib.rlEnableTexture = rlEnableTexture * * @return {undefined} */ -function rlDisableTexture () { +function rlDisableTexture() { return r.BindrlDisableTexture() } raylib.rlDisableTexture = rlDisableTexture @@ -12035,7 +13889,7 @@ raylib.rlDisableTexture = rlDisableTexture * * @return {undefined} */ -function rlEnableTextureCubemap (id) { +function rlEnableTextureCubemap(id) { return r.BindrlEnableTextureCubemap( id ) @@ -12047,7 +13901,7 @@ raylib.rlEnableTextureCubemap = rlEnableTextureCubemap * * @return {undefined} */ -function rlDisableTextureCubemap () { +function rlDisableTextureCubemap() { return r.BindrlDisableTextureCubemap() } raylib.rlDisableTextureCubemap = rlDisableTextureCubemap @@ -12061,7 +13915,7 @@ raylib.rlDisableTextureCubemap = rlDisableTextureCubemap * * @return {undefined} */ -function rlTextureParameters (id, param, value) { +function rlTextureParameters(id, param, value) { return r.BindrlTextureParameters( id, param, @@ -12079,7 +13933,7 @@ raylib.rlTextureParameters = rlTextureParameters * * @return {undefined} */ -function rlCubemapParameters (id, param, value) { +function rlCubemapParameters(id, param, value) { return r.BindrlCubemapParameters( id, param, @@ -12095,7 +13949,7 @@ raylib.rlCubemapParameters = rlCubemapParameters * * @return {undefined} */ -function rlEnableShader (id) { +function rlEnableShader(id) { return r.BindrlEnableShader( id ) @@ -12107,7 +13961,7 @@ raylib.rlEnableShader = rlEnableShader * * @return {undefined} */ -function rlDisableShader () { +function rlDisableShader() { return r.BindrlDisableShader() } raylib.rlDisableShader = rlDisableShader @@ -12119,7 +13973,7 @@ raylib.rlDisableShader = rlDisableShader * * @return {undefined} */ -function rlEnableFramebuffer (id) { +function rlEnableFramebuffer(id) { return r.BindrlEnableFramebuffer( id ) @@ -12131,11 +13985,21 @@ raylib.rlEnableFramebuffer = rlEnableFramebuffer * * @return {undefined} */ -function rlDisableFramebuffer () { +function rlDisableFramebuffer() { return r.BindrlDisableFramebuffer() } raylib.rlDisableFramebuffer = rlDisableFramebuffer +/** + * Get the currently active render texture (fbo), 0 for default framebuffer + * + * @return {number} The resulting unsigned int. + */ +function rlGetActiveFramebuffer() { + return r.BindrlGetActiveFramebuffer() +} +raylib.rlGetActiveFramebuffer = rlGetActiveFramebuffer + /** * Activate multiple draw color buffers * @@ -12143,19 +14007,65 @@ raylib.rlDisableFramebuffer = rlDisableFramebuffer * * @return {undefined} */ -function rlActiveDrawBuffers (count) { +function rlActiveDrawBuffers(count) { return r.BindrlActiveDrawBuffers( count ) } raylib.rlActiveDrawBuffers = rlActiveDrawBuffers +/** + * Blit active framebuffer to main framebuffer + * + * @param {number} srcX + * @param {number} srcY + * @param {number} srcWidth + * @param {number} srcHeight + * @param {number} dstX + * @param {number} dstY + * @param {number} dstWidth + * @param {number} dstHeight + * @param {number} bufferMask + * + * @return {undefined} + */ +function rlBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask) { + return r.BindrlBlitFramebuffer( + srcX, + srcY, + srcWidth, + srcHeight, + dstX, + dstY, + dstWidth, + dstHeight, + bufferMask + ) +} +raylib.rlBlitFramebuffer = rlBlitFramebuffer + +/** + * Bind framebuffer (FBO) + * + * @param {number} target + * @param {number} framebuffer + * + * @return {undefined} + */ +function rlBindFramebuffer(target, framebuffer) { + return r.BindrlBindFramebuffer( + target, + framebuffer + ) +} +raylib.rlBindFramebuffer = rlBindFramebuffer + /** * Enable color blending * * @return {undefined} */ -function rlEnableColorBlend () { +function rlEnableColorBlend() { return r.BindrlEnableColorBlend() } raylib.rlEnableColorBlend = rlEnableColorBlend @@ -12165,7 +14075,7 @@ raylib.rlEnableColorBlend = rlEnableColorBlend * * @return {undefined} */ -function rlDisableColorBlend () { +function rlDisableColorBlend() { return r.BindrlDisableColorBlend() } raylib.rlDisableColorBlend = rlDisableColorBlend @@ -12175,7 +14085,7 @@ raylib.rlDisableColorBlend = rlDisableColorBlend * * @return {undefined} */ -function rlEnableDepthTest () { +function rlEnableDepthTest() { return r.BindrlEnableDepthTest() } raylib.rlEnableDepthTest = rlEnableDepthTest @@ -12185,7 +14095,7 @@ raylib.rlEnableDepthTest = rlEnableDepthTest * * @return {undefined} */ -function rlDisableDepthTest () { +function rlDisableDepthTest() { return r.BindrlDisableDepthTest() } raylib.rlDisableDepthTest = rlDisableDepthTest @@ -12195,7 +14105,7 @@ raylib.rlDisableDepthTest = rlDisableDepthTest * * @return {undefined} */ -function rlEnableDepthMask () { +function rlEnableDepthMask() { return r.BindrlEnableDepthMask() } raylib.rlEnableDepthMask = rlEnableDepthMask @@ -12205,7 +14115,7 @@ raylib.rlEnableDepthMask = rlEnableDepthMask * * @return {undefined} */ -function rlDisableDepthMask () { +function rlDisableDepthMask() { return r.BindrlDisableDepthMask() } raylib.rlDisableDepthMask = rlDisableDepthMask @@ -12215,7 +14125,7 @@ raylib.rlDisableDepthMask = rlDisableDepthMask * * @return {undefined} */ -function rlEnableBackfaceCulling () { +function rlEnableBackfaceCulling() { return r.BindrlEnableBackfaceCulling() } raylib.rlEnableBackfaceCulling = rlEnableBackfaceCulling @@ -12225,11 +14135,31 @@ raylib.rlEnableBackfaceCulling = rlEnableBackfaceCulling * * @return {undefined} */ -function rlDisableBackfaceCulling () { +function rlDisableBackfaceCulling() { return r.BindrlDisableBackfaceCulling() } raylib.rlDisableBackfaceCulling = rlDisableBackfaceCulling +/** + * Color mask control + * + * @param {boolean} r + * @param {boolean} g + * @param {boolean} b + * @param {boolean} a + * + * @return {undefined} + */ +function rlColorMask(r, g, b, a) { + return r.BindrlColorMask( + r, + g, + b, + a + ) +} +raylib.rlColorMask = rlColorMask + /** * Set face culling mode * @@ -12237,7 +14167,7 @@ raylib.rlDisableBackfaceCulling = rlDisableBackfaceCulling * * @return {undefined} */ -function rlSetCullFace (mode) { +function rlSetCullFace(mode) { return r.BindrlSetCullFace( mode ) @@ -12249,7 +14179,7 @@ raylib.rlSetCullFace = rlSetCullFace * * @return {undefined} */ -function rlEnableScissorTest () { +function rlEnableScissorTest() { return r.BindrlEnableScissorTest() } raylib.rlEnableScissorTest = rlEnableScissorTest @@ -12259,7 +14189,7 @@ raylib.rlEnableScissorTest = rlEnableScissorTest * * @return {undefined} */ -function rlDisableScissorTest () { +function rlDisableScissorTest() { return r.BindrlDisableScissorTest() } raylib.rlDisableScissorTest = rlDisableScissorTest @@ -12274,7 +14204,7 @@ raylib.rlDisableScissorTest = rlDisableScissorTest * * @return {undefined} */ -function rlScissor (x, y, width, height) { +function rlScissor(x, y, width, height) { return r.BindrlScissor( x, y, @@ -12289,17 +14219,27 @@ raylib.rlScissor = rlScissor * * @return {undefined} */ -function rlEnableWireMode () { +function rlEnableWireMode() { return r.BindrlEnableWireMode() } raylib.rlEnableWireMode = rlEnableWireMode /** - * Disable wire mode + * Enable point mode + * + * @return {undefined} + */ +function rlEnablePointMode() { + return r.BindrlEnablePointMode() +} +raylib.rlEnablePointMode = rlEnablePointMode + +/** + * Disable wire (and point) mode * * @return {undefined} */ -function rlDisableWireMode () { +function rlDisableWireMode() { return r.BindrlDisableWireMode() } raylib.rlDisableWireMode = rlDisableWireMode @@ -12311,7 +14251,7 @@ raylib.rlDisableWireMode = rlDisableWireMode * * @return {undefined} */ -function rlSetLineWidth (width) { +function rlSetLineWidth(width) { return r.BindrlSetLineWidth( width ) @@ -12323,7 +14263,7 @@ raylib.rlSetLineWidth = rlSetLineWidth * * @return {number} The resulting float. */ -function rlGetLineWidth () { +function rlGetLineWidth() { return r.BindrlGetLineWidth() } raylib.rlGetLineWidth = rlGetLineWidth @@ -12333,7 +14273,7 @@ raylib.rlGetLineWidth = rlGetLineWidth * * @return {undefined} */ -function rlEnableSmoothLines () { +function rlEnableSmoothLines() { return r.BindrlEnableSmoothLines() } raylib.rlEnableSmoothLines = rlEnableSmoothLines @@ -12343,7 +14283,7 @@ raylib.rlEnableSmoothLines = rlEnableSmoothLines * * @return {undefined} */ -function rlDisableSmoothLines () { +function rlDisableSmoothLines() { return r.BindrlDisableSmoothLines() } raylib.rlDisableSmoothLines = rlDisableSmoothLines @@ -12353,7 +14293,7 @@ raylib.rlDisableSmoothLines = rlDisableSmoothLines * * @return {undefined} */ -function rlEnableStereoRender () { +function rlEnableStereoRender() { return r.BindrlEnableStereoRender() } raylib.rlEnableStereoRender = rlEnableStereoRender @@ -12363,7 +14303,7 @@ raylib.rlEnableStereoRender = rlEnableStereoRender * * @return {undefined} */ -function rlDisableStereoRender () { +function rlDisableStereoRender() { return r.BindrlDisableStereoRender() } raylib.rlDisableStereoRender = rlDisableStereoRender @@ -12373,7 +14313,7 @@ raylib.rlDisableStereoRender = rlDisableStereoRender * * @return {boolean} The resulting bool. */ -function rlIsStereoRenderEnabled () { +function rlIsStereoRenderEnabled() { return r.BindrlIsStereoRenderEnabled() } raylib.rlIsStereoRenderEnabled = rlIsStereoRenderEnabled @@ -12388,7 +14328,7 @@ raylib.rlIsStereoRenderEnabled = rlIsStereoRenderEnabled * * @return {undefined} */ -function rlClearColor (r, g, b, a) { +function rlClearColor(r, g, b, a) { return r.BindrlClearColor( r, g, @@ -12403,7 +14343,7 @@ raylib.rlClearColor = rlClearColor * * @return {undefined} */ -function rlClearScreenBuffers () { +function rlClearScreenBuffers() { return r.BindrlClearScreenBuffers() } raylib.rlClearScreenBuffers = rlClearScreenBuffers @@ -12413,7 +14353,7 @@ raylib.rlClearScreenBuffers = rlClearScreenBuffers * * @return {undefined} */ -function rlCheckErrors () { +function rlCheckErrors() { return r.BindrlCheckErrors() } raylib.rlCheckErrors = rlCheckErrors @@ -12425,7 +14365,7 @@ raylib.rlCheckErrors = rlCheckErrors * * @return {undefined} */ -function rlSetBlendMode (mode) { +function rlSetBlendMode(mode) { return r.BindrlSetBlendMode( mode ) @@ -12441,7 +14381,7 @@ raylib.rlSetBlendMode = rlSetBlendMode * * @return {undefined} */ -function rlSetBlendFactors (glSrcFactor, glDstFactor, glEquation) { +function rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation) { return r.BindrlSetBlendFactors( glSrcFactor, glDstFactor, @@ -12462,7 +14402,7 @@ raylib.rlSetBlendFactors = rlSetBlendFactors * * @return {undefined} */ -function rlSetBlendFactorsSeparate (glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha) { +function rlSetBlendFactorsSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha) { return r.BindrlSetBlendFactorsSeparate( glSrcRGB, glDstRGB, @@ -12482,7 +14422,7 @@ raylib.rlSetBlendFactorsSeparate = rlSetBlendFactorsSeparate * * @return {undefined} */ -function rlglInit (width, height) { +function rlglInit(width, height) { return r.BindrlglInit( width, height @@ -12495,7 +14435,7 @@ raylib.rlglInit = rlglInit * * @return {undefined} */ -function rlglClose () { +function rlglClose() { return r.BindrlglClose() } raylib.rlglClose = rlglClose @@ -12507,7 +14447,7 @@ raylib.rlglClose = rlglClose * * @return {undefined} */ -function rlLoadExtensions (loader) { +function rlLoadExtensions(loader) { return r.BindrlLoadExtensions( loader ) @@ -12519,7 +14459,7 @@ raylib.rlLoadExtensions = rlLoadExtensions * * @return {number} The resulting int. */ -function rlGetVersion () { +function rlGetVersion() { return r.BindrlGetVersion() } raylib.rlGetVersion = rlGetVersion @@ -12531,7 +14471,7 @@ raylib.rlGetVersion = rlGetVersion * * @return {undefined} */ -function rlSetFramebufferWidth (width) { +function rlSetFramebufferWidth(width) { return r.BindrlSetFramebufferWidth( width ) @@ -12543,7 +14483,7 @@ raylib.rlSetFramebufferWidth = rlSetFramebufferWidth * * @return {number} The resulting int. */ -function rlGetFramebufferWidth () { +function rlGetFramebufferWidth() { return r.BindrlGetFramebufferWidth() } raylib.rlGetFramebufferWidth = rlGetFramebufferWidth @@ -12555,7 +14495,7 @@ raylib.rlGetFramebufferWidth = rlGetFramebufferWidth * * @return {undefined} */ -function rlSetFramebufferHeight (height) { +function rlSetFramebufferHeight(height) { return r.BindrlSetFramebufferHeight( height ) @@ -12567,7 +14507,7 @@ raylib.rlSetFramebufferHeight = rlSetFramebufferHeight * * @return {number} The resulting int. */ -function rlGetFramebufferHeight () { +function rlGetFramebufferHeight() { return r.BindrlGetFramebufferHeight() } raylib.rlGetFramebufferHeight = rlGetFramebufferHeight @@ -12577,7 +14517,7 @@ raylib.rlGetFramebufferHeight = rlGetFramebufferHeight * * @return {number} The resulting unsigned int. */ -function rlGetTextureIdDefault () { +function rlGetTextureIdDefault() { return r.BindrlGetTextureIdDefault() } raylib.rlGetTextureIdDefault = rlGetTextureIdDefault @@ -12587,7 +14527,7 @@ raylib.rlGetTextureIdDefault = rlGetTextureIdDefault * * @return {number} The resulting unsigned int. */ -function rlGetShaderIdDefault () { +function rlGetShaderIdDefault() { return r.BindrlGetShaderIdDefault() } raylib.rlGetShaderIdDefault = rlGetShaderIdDefault @@ -12597,7 +14537,7 @@ raylib.rlGetShaderIdDefault = rlGetShaderIdDefault * * @return {number} The resulting int *. */ -function rlGetShaderLocsDefault () { +function rlGetShaderLocsDefault() { return r.BindrlGetShaderLocsDefault() } raylib.rlGetShaderLocsDefault = rlGetShaderLocsDefault @@ -12610,7 +14550,7 @@ raylib.rlGetShaderLocsDefault = rlGetShaderLocsDefault * * @return {rlRenderBatch} The resulting rlRenderBatch. */ -function rlLoadRenderBatch (numBuffers, bufferElements) { +function rlLoadRenderBatch(numBuffers, bufferElements) { return r.BindrlLoadRenderBatch( numBuffers, bufferElements @@ -12625,7 +14565,7 @@ raylib.rlLoadRenderBatch = rlLoadRenderBatch * * @return {undefined} */ -function rlUnloadRenderBatch (batch) { +function rlUnloadRenderBatch(batch) { return r.BindrlUnloadRenderBatch( batch.bufferCount, batch.currentBuffer, @@ -12644,7 +14584,7 @@ raylib.rlUnloadRenderBatch = rlUnloadRenderBatch * * @return {undefined} */ -function rlDrawRenderBatch (batch) { +function rlDrawRenderBatch(batch) { return r.BindrlDrawRenderBatch( batch ) @@ -12658,7 +14598,7 @@ raylib.rlDrawRenderBatch = rlDrawRenderBatch * * @return {undefined} */ -function rlSetRenderBatchActive (batch) { +function rlSetRenderBatchActive(batch) { return r.BindrlSetRenderBatchActive( batch ) @@ -12670,7 +14610,7 @@ raylib.rlSetRenderBatchActive = rlSetRenderBatchActive * * @return {undefined} */ -function rlDrawRenderBatchActive () { +function rlDrawRenderBatchActive() { return r.BindrlDrawRenderBatchActive() } raylib.rlDrawRenderBatchActive = rlDrawRenderBatchActive @@ -12682,7 +14622,7 @@ raylib.rlDrawRenderBatchActive = rlDrawRenderBatchActive * * @return {boolean} The resulting bool. */ -function rlCheckRenderBatchLimit (vCount) { +function rlCheckRenderBatchLimit(vCount) { return r.BindrlCheckRenderBatchLimit( vCount ) @@ -12696,7 +14636,7 @@ raylib.rlCheckRenderBatchLimit = rlCheckRenderBatchLimit * * @return {undefined} */ -function rlSetTexture (id) { +function rlSetTexture(id) { return r.BindrlSetTexture( id ) @@ -12708,13 +14648,13 @@ raylib.rlSetTexture = rlSetTexture * * @return {number} The resulting unsigned int. */ -function rlLoadVertexArray () { +function rlLoadVertexArray() { return r.BindrlLoadVertexArray() } raylib.rlLoadVertexArray = rlLoadVertexArray /** - * Load a vertex buffer attribute + * Load a vertex buffer object * * @param {number} buffer * @param {number} size @@ -12722,7 +14662,7 @@ raylib.rlLoadVertexArray = rlLoadVertexArray * * @return {number} The resulting unsigned int. */ -function rlLoadVertexBuffer (buffer, size, dynamic) { +function rlLoadVertexBuffer(buffer, size, dynamic) { return r.BindrlLoadVertexBuffer( buffer, size, @@ -12732,7 +14672,7 @@ function rlLoadVertexBuffer (buffer, size, dynamic) { raylib.rlLoadVertexBuffer = rlLoadVertexBuffer /** - * Load a new attributes element buffer + * Load vertex buffer elements object * * @param {number} buffer * @param {number} size @@ -12740,7 +14680,7 @@ raylib.rlLoadVertexBuffer = rlLoadVertexBuffer * * @return {number} The resulting unsigned int. */ -function rlLoadVertexBufferElement (buffer, size, dynamic) { +function rlLoadVertexBufferElement(buffer, size, dynamic) { return r.BindrlLoadVertexBufferElement( buffer, size, @@ -12750,7 +14690,7 @@ function rlLoadVertexBufferElement (buffer, size, dynamic) { raylib.rlLoadVertexBufferElement = rlLoadVertexBufferElement /** - * Update GPU buffer with new data + * Update vertex buffer object data on GPU buffer * * @param {number} bufferId * @param {number} data @@ -12759,7 +14699,7 @@ raylib.rlLoadVertexBufferElement = rlLoadVertexBufferElement * * @return {undefined} */ -function rlUpdateVertexBuffer (bufferId, data, dataSize, offset) { +function rlUpdateVertexBuffer(bufferId, data, dataSize, offset) { return r.BindrlUpdateVertexBuffer( bufferId, data, @@ -12770,7 +14710,7 @@ function rlUpdateVertexBuffer (bufferId, data, dataSize, offset) { raylib.rlUpdateVertexBuffer = rlUpdateVertexBuffer /** - * Update vertex buffer elements with new data + * Update vertex buffer elements data on GPU buffer * * @param {number} id * @param {number} data @@ -12779,7 +14719,7 @@ raylib.rlUpdateVertexBuffer = rlUpdateVertexBuffer * * @return {undefined} */ -function rlUpdateVertexBufferElements (id, data, dataSize, offset) { +function rlUpdateVertexBufferElements(id, data, dataSize, offset) { return r.BindrlUpdateVertexBufferElements( id, data, @@ -12789,33 +14729,67 @@ function rlUpdateVertexBufferElements (id, data, dataSize, offset) { } raylib.rlUpdateVertexBufferElements = rlUpdateVertexBufferElements -function rlUnloadVertexArray (vaoId) { +/** + * Unload vertex array (vao) + * + * @param {number} vaoId + * + * @return {undefined} + */ +function rlUnloadVertexArray(vaoId) { return r.BindrlUnloadVertexArray( vaoId ) } raylib.rlUnloadVertexArray = rlUnloadVertexArray -function rlUnloadVertexBuffer (vboId) { +/** + * Unload vertex buffer object + * + * @param {number} vboId + * + * @return {undefined} + */ +function rlUnloadVertexBuffer(vboId) { return r.BindrlUnloadVertexBuffer( vboId ) } raylib.rlUnloadVertexBuffer = rlUnloadVertexBuffer -function rlSetVertexAttribute (index, compSize, type, normalized, stride, pointer) { +/** + * Set vertex attribute data configuration + * + * @param {number} index + * @param {number} compSize + * @param {number} type + * @param {boolean} normalized + * @param {number} stride + * @param {number} offset + * + * @return {undefined} + */ +function rlSetVertexAttribute(index, compSize, type, normalized, stride, offset) { return r.BindrlSetVertexAttribute( index, compSize, type, normalized, stride, - pointer + offset ) } raylib.rlSetVertexAttribute = rlSetVertexAttribute -function rlSetVertexAttributeDivisor (index, divisor) { +/** + * Set vertex attribute data divisor + * + * @param {number} index + * @param {number} divisor + * + * @return {undefined} + */ +function rlSetVertexAttributeDivisor(index, divisor) { return r.BindrlSetVertexAttributeDivisor( index, divisor @@ -12824,7 +14798,7 @@ function rlSetVertexAttributeDivisor (index, divisor) { raylib.rlSetVertexAttributeDivisor = rlSetVertexAttributeDivisor /** - * Set vertex attribute default value + * Set vertex attribute default value, when attribute to provided * * @param {number} locIndex * @param {number} value @@ -12833,7 +14807,7 @@ raylib.rlSetVertexAttributeDivisor = rlSetVertexAttributeDivisor * * @return {undefined} */ -function rlSetVertexAttributeDefault (locIndex, value, attribType, count) { +function rlSetVertexAttributeDefault(locIndex, value, attribType, count) { return r.BindrlSetVertexAttributeDefault( locIndex, value, @@ -12843,7 +14817,15 @@ function rlSetVertexAttributeDefault (locIndex, value, attribType, count) { } raylib.rlSetVertexAttributeDefault = rlSetVertexAttributeDefault -function rlDrawVertexArray (offset, count) { +/** + * Draw vertex array (currently active vao) + * + * @param {number} offset + * @param {number} count + * + * @return {undefined} + */ +function rlDrawVertexArray(offset, count) { return r.BindrlDrawVertexArray( offset, count @@ -12851,7 +14833,16 @@ function rlDrawVertexArray (offset, count) { } raylib.rlDrawVertexArray = rlDrawVertexArray -function rlDrawVertexArrayElements (offset, count, buffer) { +/** + * Draw vertex array elements + * + * @param {number} offset + * @param {number} count + * @param {number} buffer + * + * @return {undefined} + */ +function rlDrawVertexArrayElements(offset, count, buffer) { return r.BindrlDrawVertexArrayElements( offset, count, @@ -12860,7 +14851,16 @@ function rlDrawVertexArrayElements (offset, count, buffer) { } raylib.rlDrawVertexArrayElements = rlDrawVertexArrayElements -function rlDrawVertexArrayInstanced (offset, count, instances) { +/** + * Draw vertex array (currently active vao) with instancing + * + * @param {number} offset + * @param {number} count + * @param {number} instances + * + * @return {undefined} + */ +function rlDrawVertexArrayInstanced(offset, count, instances) { return r.BindrlDrawVertexArrayInstanced( offset, count, @@ -12869,7 +14869,17 @@ function rlDrawVertexArrayInstanced (offset, count, instances) { } raylib.rlDrawVertexArrayInstanced = rlDrawVertexArrayInstanced -function rlDrawVertexArrayElementsInstanced (offset, count, buffer, instances) { +/** + * Draw vertex array elements with instancing + * + * @param {number} offset + * @param {number} count + * @param {number} buffer + * @param {number} instances + * + * @return {undefined} + */ +function rlDrawVertexArrayElementsInstanced(offset, count, buffer, instances) { return r.BindrlDrawVertexArrayElementsInstanced( offset, count, @@ -12880,7 +14890,7 @@ function rlDrawVertexArrayElementsInstanced (offset, count, buffer, instances) { raylib.rlDrawVertexArrayElementsInstanced = rlDrawVertexArrayElementsInstanced /** - * Load texture in GPU + * Load texture data * * @param {number} data * @param {number} width @@ -12890,7 +14900,7 @@ raylib.rlDrawVertexArrayElementsInstanced = rlDrawVertexArrayElementsInstanced * * @return {number} The resulting unsigned int. */ -function rlLoadTexture (data, width, height, format, mipmapCount) { +function rlLoadTexture(data, width, height, format, mipmapCount) { return r.BindrlLoadTexture( data, width, @@ -12910,7 +14920,7 @@ raylib.rlLoadTexture = rlLoadTexture * * @return {number} The resulting unsigned int. */ -function rlLoadTextureDepth (width, height, useRenderBuffer) { +function rlLoadTextureDepth(width, height, useRenderBuffer) { return r.BindrlLoadTextureDepth( width, height, @@ -12920,25 +14930,27 @@ function rlLoadTextureDepth (width, height, useRenderBuffer) { raylib.rlLoadTextureDepth = rlLoadTextureDepth /** - * Load texture cubemap + * Load texture cubemap data * * @param {number} data * @param {number} size * @param {number} format + * @param {number} mipmapCount * * @return {number} The resulting unsigned int. */ -function rlLoadTextureCubemap (data, size, format) { +function rlLoadTextureCubemap(data, size, format, mipmapCount) { return r.BindrlLoadTextureCubemap( data, size, - format + format, + mipmapCount ) } raylib.rlLoadTextureCubemap = rlLoadTextureCubemap /** - * Update GPU texture with new data + * Update texture with new data on GPU * * @param {number} id * @param {number} offsetX @@ -12950,7 +14962,7 @@ raylib.rlLoadTextureCubemap = rlLoadTextureCubemap * * @return {undefined} */ -function rlUpdateTexture (id, offsetX, offsetY, width, height, format, data) { +function rlUpdateTexture(id, offsetX, offsetY, width, height, format, data) { return r.BindrlUpdateTexture( id, offsetX, @@ -12973,7 +14985,7 @@ raylib.rlUpdateTexture = rlUpdateTexture * * @return {undefined} */ -function rlGetGlTextureFormats (format, glInternalFormat, glFormat, glType) { +function rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType) { return r.BindrlGetGlTextureFormats( format, glInternalFormat, @@ -12990,7 +15002,7 @@ raylib.rlGetGlTextureFormats = rlGetGlTextureFormats * * @return {string} The resulting const char *. */ -function rlGetPixelFormatName (format) { +function rlGetPixelFormatName(format) { return r.BindrlGetPixelFormatName( format ) @@ -13004,7 +15016,7 @@ raylib.rlGetPixelFormatName = rlGetPixelFormatName * * @return {undefined} */ -function rlUnloadTexture (id) { +function rlUnloadTexture(id) { return r.BindrlUnloadTexture( id ) @@ -13022,7 +15034,7 @@ raylib.rlUnloadTexture = rlUnloadTexture * * @return {undefined} */ -function rlGenTextureMipmaps (id, width, height, format, mipmaps) { +function rlGenTextureMipmaps(id, width, height, format, mipmaps) { return r.BindrlGenTextureMipmaps( id, width, @@ -13043,7 +15055,7 @@ raylib.rlGenTextureMipmaps = rlGenTextureMipmaps * * @return {number} The resulting void *. */ -function rlReadTexturePixels (id, width, height, format) { +function rlReadTexturePixels(id, width, height, format) { return r.BindrlReadTexturePixels( id, width, @@ -13061,7 +15073,7 @@ raylib.rlReadTexturePixels = rlReadTexturePixels * * @return {Buffer} The resulting unsigned char *. */ -function rlReadScreenPixels (width, height) { +function rlReadScreenPixels(width, height) { return r.BindrlReadScreenPixels( width, height @@ -13072,16 +15084,10 @@ raylib.rlReadScreenPixels = rlReadScreenPixels /** * Load an empty framebuffer * - * @param {number} width - * @param {number} height - * * @return {number} The resulting unsigned int. */ -function rlLoadFramebuffer (width, height) { - return r.BindrlLoadFramebuffer( - width, - height - ) +function rlLoadFramebuffer() { + return r.BindrlLoadFramebuffer() } raylib.rlLoadFramebuffer = rlLoadFramebuffer @@ -13096,7 +15102,7 @@ raylib.rlLoadFramebuffer = rlLoadFramebuffer * * @return {undefined} */ -function rlFramebufferAttach (fboId, texId, attachType, texType, mipLevel) { +function rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel) { return r.BindrlFramebufferAttach( fboId, texId, @@ -13114,7 +15120,7 @@ raylib.rlFramebufferAttach = rlFramebufferAttach * * @return {boolean} The resulting bool. */ -function rlFramebufferComplete (id) { +function rlFramebufferComplete(id) { return r.BindrlFramebufferComplete( id ) @@ -13128,7 +15134,7 @@ raylib.rlFramebufferComplete = rlFramebufferComplete * * @return {undefined} */ -function rlUnloadFramebuffer (id) { +function rlUnloadFramebuffer(id) { return r.BindrlUnloadFramebuffer( id ) @@ -13143,7 +15149,7 @@ raylib.rlUnloadFramebuffer = rlUnloadFramebuffer * * @return {number} The resulting unsigned int. */ -function rlLoadShaderCode (vsCode, fsCode) { +function rlLoadShaderCode(vsCode, fsCode) { return r.BindrlLoadShaderCode( vsCode, fsCode @@ -13159,7 +15165,7 @@ raylib.rlLoadShaderCode = rlLoadShaderCode * * @return {number} The resulting unsigned int. */ -function rlCompileShader (shaderCode, type) { +function rlCompileShader(shaderCode, type) { return r.BindrlCompileShader( shaderCode, type @@ -13175,7 +15181,7 @@ raylib.rlCompileShader = rlCompileShader * * @return {number} The resulting unsigned int. */ -function rlLoadShaderProgram (vShaderId, fShaderId) { +function rlLoadShaderProgram(vShaderId, fShaderId) { return r.BindrlLoadShaderProgram( vShaderId, fShaderId @@ -13190,7 +15196,7 @@ raylib.rlLoadShaderProgram = rlLoadShaderProgram * * @return {undefined} */ -function rlUnloadShaderProgram (id) { +function rlUnloadShaderProgram(id) { return r.BindrlUnloadShaderProgram( id ) @@ -13205,7 +15211,7 @@ raylib.rlUnloadShaderProgram = rlUnloadShaderProgram * * @return {number} The resulting int. */ -function rlGetLocationUniform (shaderId, uniformName) { +function rlGetLocationUniform(shaderId, uniformName) { return r.BindrlGetLocationUniform( shaderId, uniformName @@ -13221,7 +15227,7 @@ raylib.rlGetLocationUniform = rlGetLocationUniform * * @return {number} The resulting int. */ -function rlGetLocationAttrib (shaderId, attribName) { +function rlGetLocationAttrib(shaderId, attribName) { return r.BindrlGetLocationAttrib( shaderId, attribName @@ -13239,7 +15245,7 @@ raylib.rlGetLocationAttrib = rlGetLocationAttrib * * @return {undefined} */ -function rlSetUniform (locIndex, value, uniformType, count) { +function rlSetUniform(locIndex, value, uniformType, count) { return r.BindrlSetUniform( locIndex, value, @@ -13257,7 +15263,7 @@ raylib.rlSetUniform = rlSetUniform * * @return {undefined} */ -function rlSetUniformMatrix (locIndex, mat) { +function rlSetUniformMatrix(locIndex, mat) { return r.BindrlSetUniformMatrix( locIndex, mat.m0, @@ -13280,6 +15286,24 @@ function rlSetUniformMatrix (locIndex, mat) { } raylib.rlSetUniformMatrix = rlSetUniformMatrix +/** + * Set shader value matrices + * + * @param {number} locIndex + * @param {number} mat + * @param {number} count + * + * @return {undefined} + */ +function rlSetUniformMatrices(locIndex, mat, count) { + return r.BindrlSetUniformMatrices( + locIndex, + mat, + count + ) +} +raylib.rlSetUniformMatrices = rlSetUniformMatrices + /** * Set shader value sampler * @@ -13288,7 +15312,7 @@ raylib.rlSetUniformMatrix = rlSetUniformMatrix * * @return {undefined} */ -function rlSetUniformSampler (locIndex, textureId) { +function rlSetUniformSampler(locIndex, textureId) { return r.BindrlSetUniformSampler( locIndex, textureId @@ -13304,7 +15328,7 @@ raylib.rlSetUniformSampler = rlSetUniformSampler * * @return {undefined} */ -function rlSetShader (id, locs) { +function rlSetShader(id, locs) { return r.BindrlSetShader( id, locs @@ -13319,7 +15343,7 @@ raylib.rlSetShader = rlSetShader * * @return {number} The resulting unsigned int. */ -function rlLoadComputeShaderProgram (shaderId) { +function rlLoadComputeShaderProgram(shaderId) { return r.BindrlLoadComputeShaderProgram( shaderId ) @@ -13335,7 +15359,7 @@ raylib.rlLoadComputeShaderProgram = rlLoadComputeShaderProgram * * @return {undefined} */ -function rlComputeShaderDispatch (groupX, groupY, groupZ) { +function rlComputeShaderDispatch(groupX, groupY, groupZ) { return r.BindrlComputeShaderDispatch( groupX, groupY, @@ -13353,7 +15377,7 @@ raylib.rlComputeShaderDispatch = rlComputeShaderDispatch * * @return {number} The resulting unsigned int. */ -function rlLoadShaderBuffer (size, data, usageHint) { +function rlLoadShaderBuffer(size, data, usageHint) { return r.BindrlLoadShaderBuffer( size, data, @@ -13369,7 +15393,7 @@ raylib.rlLoadShaderBuffer = rlLoadShaderBuffer * * @return {undefined} */ -function rlUnloadShaderBuffer (ssboId) { +function rlUnloadShaderBuffer(ssboId) { return r.BindrlUnloadShaderBuffer( ssboId ) @@ -13386,7 +15410,7 @@ raylib.rlUnloadShaderBuffer = rlUnloadShaderBuffer * * @return {undefined} */ -function rlUpdateShaderBuffer (id, data, dataSize, offset) { +function rlUpdateShaderBuffer(id, data, dataSize, offset) { return r.BindrlUpdateShaderBuffer( id, data, @@ -13404,7 +15428,7 @@ raylib.rlUpdateShaderBuffer = rlUpdateShaderBuffer * * @return {undefined} */ -function rlBindShaderBuffer (id, index) { +function rlBindShaderBuffer(id, index) { return r.BindrlBindShaderBuffer( id, index @@ -13422,7 +15446,7 @@ raylib.rlBindShaderBuffer = rlBindShaderBuffer * * @return {undefined} */ -function rlReadShaderBuffer (id, dest, count, offset) { +function rlReadShaderBuffer(id, dest, count, offset) { return r.BindrlReadShaderBuffer( id, dest, @@ -13443,7 +15467,7 @@ raylib.rlReadShaderBuffer = rlReadShaderBuffer * * @return {undefined} */ -function rlCopyShaderBuffer (destId, srcId, destOffset, srcOffset, count) { +function rlCopyShaderBuffer(destId, srcId, destOffset, srcOffset, count) { return r.BindrlCopyShaderBuffer( destId, srcId, @@ -13461,7 +15485,7 @@ raylib.rlCopyShaderBuffer = rlCopyShaderBuffer * * @return {number} The resulting unsigned int. */ -function rlGetShaderBufferSize (id) { +function rlGetShaderBufferSize(id) { return r.BindrlGetShaderBufferSize( id ) @@ -13478,7 +15502,7 @@ raylib.rlGetShaderBufferSize = rlGetShaderBufferSize * * @return {undefined} */ -function rlBindImageTexture (id, index, format, readonly) { +function rlBindImageTexture(id, index, format, readonly) { return r.BindrlBindImageTexture( id, index, @@ -13493,7 +15517,7 @@ raylib.rlBindImageTexture = rlBindImageTexture * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixModelview () { +function rlGetMatrixModelview() { return r.BindrlGetMatrixModelview() } raylib.rlGetMatrixModelview = rlGetMatrixModelview @@ -13503,7 +15527,7 @@ raylib.rlGetMatrixModelview = rlGetMatrixModelview * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixProjection () { +function rlGetMatrixProjection() { return r.BindrlGetMatrixProjection() } raylib.rlGetMatrixProjection = rlGetMatrixProjection @@ -13513,7 +15537,7 @@ raylib.rlGetMatrixProjection = rlGetMatrixProjection * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixTransform () { +function rlGetMatrixTransform() { return r.BindrlGetMatrixTransform() } raylib.rlGetMatrixTransform = rlGetMatrixTransform @@ -13525,7 +15549,7 @@ raylib.rlGetMatrixTransform = rlGetMatrixTransform * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixProjectionStereo (eye) { +function rlGetMatrixProjectionStereo(eye) { return r.BindrlGetMatrixProjectionStereo( eye ) @@ -13539,7 +15563,7 @@ raylib.rlGetMatrixProjectionStereo = rlGetMatrixProjectionStereo * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixViewOffsetStereo (eye) { +function rlGetMatrixViewOffsetStereo(eye) { return r.BindrlGetMatrixViewOffsetStereo( eye ) @@ -13553,7 +15577,7 @@ raylib.rlGetMatrixViewOffsetStereo = rlGetMatrixViewOffsetStereo * * @return {undefined} */ -function rlSetMatrixProjection (proj) { +function rlSetMatrixProjection(proj) { return r.BindrlSetMatrixProjection( proj.m0, proj.m4, @@ -13582,7 +15606,7 @@ raylib.rlSetMatrixProjection = rlSetMatrixProjection * * @return {undefined} */ -function rlSetMatrixModelview (view) { +function rlSetMatrixModelview(view) { return r.BindrlSetMatrixModelview( view.m0, view.m4, @@ -13612,7 +15636,7 @@ raylib.rlSetMatrixModelview = rlSetMatrixModelview * * @return {undefined} */ -function rlSetMatrixProjectionStereo (right, left) { +function rlSetMatrixProjectionStereo(right, left) { return r.BindrlSetMatrixProjectionStereo( right.m0, right.m4, @@ -13658,7 +15682,7 @@ raylib.rlSetMatrixProjectionStereo = rlSetMatrixProjectionStereo * * @return {undefined} */ -function rlSetMatrixViewOffsetStereo (right, left) { +function rlSetMatrixViewOffsetStereo(right, left) { return r.BindrlSetMatrixViewOffsetStereo( right.m0, right.m4, @@ -13701,7 +15725,7 @@ raylib.rlSetMatrixViewOffsetStereo = rlSetMatrixViewOffsetStereo * * @return {undefined} */ -function rlLoadDrawCube () { +function rlLoadDrawCube() { return r.BindrlLoadDrawCube() } raylib.rlLoadDrawCube = rlLoadDrawCube @@ -13711,7 +15735,7 @@ raylib.rlLoadDrawCube = rlLoadDrawCube * * @return {undefined} */ -function rlLoadDrawQuad () { +function rlLoadDrawQuad() { return r.BindrlLoadDrawQuad() } raylib.rlLoadDrawQuad = rlLoadDrawQuad @@ -13724,7 +15748,7 @@ raylib.rlLoadDrawQuad = rlLoadDrawQuad * * @return {undefined} */ -function UpdateCamera (camera, mode) { +function UpdateCamera(camera, mode) { const obj = r.BindUpdateCamera( camera.position.x, camera.position.y, @@ -13755,7 +15779,7 @@ raylib.UpdateCamera = UpdateCamera * * @return {undefined} */ -function ImageFormat (image, newFormat) { +function ImageFormat(image, newFormat) { const obj = r.BindImageFormat( image.data, image.width, @@ -13780,7 +15804,7 @@ raylib.ImageFormat = ImageFormat * * @return {undefined} */ -function ImageToPOT (image, fill) { +function ImageToPOT(image, fill) { const obj = r.BindImageToPOT( image.data, image.width, @@ -13808,7 +15832,7 @@ raylib.ImageToPOT = ImageToPOT * * @return {undefined} */ -function ImageCrop (image, crop) { +function ImageCrop(image, crop) { const obj = r.BindImageCrop( image.data, image.width, @@ -13836,7 +15860,7 @@ raylib.ImageCrop = ImageCrop * * @return {undefined} */ -function ImageAlphaCrop (image, threshold) { +function ImageAlphaCrop(image, threshold) { const obj = r.BindImageAlphaCrop( image.data, image.width, @@ -13862,7 +15886,7 @@ raylib.ImageAlphaCrop = ImageAlphaCrop * * @return {undefined} */ -function ImageAlphaClear (image, color, threshold) { +function ImageAlphaClear(image, color, threshold) { const obj = r.BindImageAlphaClear( image.data, image.width, @@ -13891,7 +15915,7 @@ raylib.ImageAlphaClear = ImageAlphaClear * * @return {undefined} */ -function ImageAlphaMask (image, alphaMask) { +function ImageAlphaMask(image, alphaMask) { const obj = r.BindImageAlphaMask( image.data, image.width, @@ -13919,7 +15943,7 @@ raylib.ImageAlphaMask = ImageAlphaMask * * @return {undefined} */ -function ImageAlphaPremultiply (image) { +function ImageAlphaPremultiply(image) { const obj = r.BindImageAlphaPremultiply( image.data, image.width, @@ -13944,7 +15968,7 @@ raylib.ImageAlphaPremultiply = ImageAlphaPremultiply * * @return {undefined} */ -function ImageResize (image, newWidth, newHeight) { +function ImageResize(image, newWidth, newHeight) { const obj = r.BindImageResize( image.data, image.width, @@ -13971,7 +15995,7 @@ raylib.ImageResize = ImageResize * * @return {undefined} */ -function ImageResizeNN (image, newWidth, newHeight) { +function ImageResizeNN(image, newWidth, newHeight) { const obj = r.BindImageResizeNN( image.data, image.width, @@ -14001,7 +16025,7 @@ raylib.ImageResizeNN = ImageResizeNN * * @return {undefined} */ -function ImageResizeCanvas (image, newWidth, newHeight, offsetX, offsetY, fill) { +function ImageResizeCanvas(image, newWidth, newHeight, offsetX, offsetY, fill) { const obj = r.BindImageResizeCanvas( image.data, image.width, @@ -14032,7 +16056,7 @@ raylib.ImageResizeCanvas = ImageResizeCanvas * * @return {undefined} */ -function ImageMipmaps (image) { +function ImageMipmaps(image) { const obj = r.BindImageMipmaps( image.data, image.width, @@ -14059,7 +16083,7 @@ raylib.ImageMipmaps = ImageMipmaps * * @return {undefined} */ -function ImageDither (image, rBpp, gBpp, bBpp, aBpp) { +function ImageDither(image, rBpp, gBpp, bBpp, aBpp) { const obj = r.BindImageDither( image.data, image.width, @@ -14086,7 +16110,7 @@ raylib.ImageDither = ImageDither * * @return {undefined} */ -function ImageFlipVertical (image) { +function ImageFlipVertical(image) { const obj = r.BindImageFlipVertical( image.data, image.width, @@ -14109,7 +16133,7 @@ raylib.ImageFlipVertical = ImageFlipVertical * * @return {undefined} */ -function ImageFlipHorizontal (image) { +function ImageFlipHorizontal(image) { const obj = r.BindImageFlipHorizontal( image.data, image.width, @@ -14132,7 +16156,7 @@ raylib.ImageFlipHorizontal = ImageFlipHorizontal * * @return {undefined} */ -function ImageRotateCW (image) { +function ImageRotateCW(image) { const obj = r.BindImageRotateCW( image.data, image.width, @@ -14155,7 +16179,7 @@ raylib.ImageRotateCW = ImageRotateCW * * @return {undefined} */ -function ImageRotateCCW (image) { +function ImageRotateCCW(image) { const obj = r.BindImageRotateCCW( image.data, image.width, @@ -14179,7 +16203,7 @@ raylib.ImageRotateCCW = ImageRotateCCW * * @return {undefined} */ -function ImageColorTint (image, color) { +function ImageColorTint(image, color) { const obj = r.BindImageColorTint( image.data, image.width, @@ -14206,7 +16230,7 @@ raylib.ImageColorTint = ImageColorTint * * @return {undefined} */ -function ImageColorInvert (image) { +function ImageColorInvert(image) { const obj = r.BindImageColorInvert( image.data, image.width, @@ -14229,7 +16253,7 @@ raylib.ImageColorInvert = ImageColorInvert * * @return {undefined} */ -function ImageColorGrayscale (image) { +function ImageColorGrayscale(image) { const obj = r.BindImageColorGrayscale( image.data, image.width, @@ -14253,7 +16277,7 @@ raylib.ImageColorGrayscale = ImageColorGrayscale * * @return {undefined} */ -function ImageColorContrast (image, contrast) { +function ImageColorContrast(image, contrast) { const obj = r.BindImageColorContrast( image.data, image.width, @@ -14278,7 +16302,7 @@ raylib.ImageColorContrast = ImageColorContrast * * @return {undefined} */ -function ImageColorBrightness (image, brightness) { +function ImageColorBrightness(image, brightness) { const obj = r.BindImageColorBrightness( image.data, image.width, @@ -14304,7 +16328,7 @@ raylib.ImageColorBrightness = ImageColorBrightness * * @return {undefined} */ -function ImageColorReplace (image, color, replace) { +function ImageColorReplace(image, color, replace) { const obj = r.BindImageColorReplace( image.data, image.width, @@ -14336,7 +16360,7 @@ raylib.ImageColorReplace = ImageColorReplace * * @return {undefined} */ -function ImageClearBackground (dst, color) { +function ImageClearBackground(dst, color) { const obj = r.BindImageClearBackground( dst.data, dst.width, @@ -14366,7 +16390,7 @@ raylib.ImageClearBackground = ImageClearBackground * * @return {undefined} */ -function ImageDrawPixel (dst, posX, posY, color) { +function ImageDrawPixel(dst, posX, posY, color) { const obj = r.BindImageDrawPixel( dst.data, dst.width, @@ -14397,7 +16421,7 @@ raylib.ImageDrawPixel = ImageDrawPixel * * @return {undefined} */ -function ImageDrawPixelV (dst, position, color) { +function ImageDrawPixelV(dst, position, color) { const obj = r.BindImageDrawPixelV( dst.data, dst.width, @@ -14431,7 +16455,7 @@ raylib.ImageDrawPixelV = ImageDrawPixelV * * @return {undefined} */ -function ImageDrawLine (dst, startPosX, startPosY, endPosX, endPosY, color) { +function ImageDrawLine(dst, startPosX, startPosY, endPosX, endPosY, color) { const obj = r.BindImageDrawLine( dst.data, dst.width, @@ -14465,7 +16489,7 @@ raylib.ImageDrawLine = ImageDrawLine * * @return {undefined} */ -function ImageDrawLineV (dst, start, end, color) { +function ImageDrawLineV(dst, start, end, color) { const obj = r.BindImageDrawLineV( dst.data, dst.width, @@ -14500,7 +16524,7 @@ raylib.ImageDrawLineV = ImageDrawLineV * * @return {undefined} */ -function ImageDrawCircle (dst, centerX, centerY, radius, color) { +function ImageDrawCircle(dst, centerX, centerY, radius, color) { const obj = r.BindImageDrawCircle( dst.data, dst.width, @@ -14533,7 +16557,7 @@ raylib.ImageDrawCircle = ImageDrawCircle * * @return {undefined} */ -function ImageDrawCircleV (dst, center, radius, color) { +function ImageDrawCircleV(dst, center, radius, color) { const obj = r.BindImageDrawCircleV( dst.data, dst.width, @@ -14568,7 +16592,7 @@ raylib.ImageDrawCircleV = ImageDrawCircleV * * @return {undefined} */ -function ImageDrawRectangle (dst, posX, posY, width, height, color) { +function ImageDrawRectangle(dst, posX, posY, width, height, color) { const obj = r.BindImageDrawRectangle( dst.data, dst.width, @@ -14602,7 +16626,7 @@ raylib.ImageDrawRectangle = ImageDrawRectangle * * @return {undefined} */ -function ImageDrawRectangleV (dst, position, size, color) { +function ImageDrawRectangleV(dst, position, size, color) { const obj = r.BindImageDrawRectangleV( dst.data, dst.width, @@ -14635,7 +16659,7 @@ raylib.ImageDrawRectangleV = ImageDrawRectangleV * * @return {undefined} */ -function ImageDrawRectangleRec (dst, rec, color) { +function ImageDrawRectangleRec(dst, rec, color) { const obj = r.BindImageDrawRectangleRec( dst.data, dst.width, @@ -14669,7 +16693,7 @@ raylib.ImageDrawRectangleRec = ImageDrawRectangleRec * * @return {undefined} */ -function ImageDrawRectangleLines (dst, rec, thick, color) { +function ImageDrawRectangleLines(dst, rec, thick, color) { const obj = r.BindImageDrawRectangleLines( dst.data, dst.width, @@ -14705,7 +16729,7 @@ raylib.ImageDrawRectangleLines = ImageDrawRectangleLines * * @return {undefined} */ -function ImageDraw (dst, src, srcRec, dstRec, tint) { +function ImageDraw(dst, src, srcRec, dstRec, tint) { const obj = r.BindImageDraw( dst.data, dst.width, @@ -14750,7 +16774,7 @@ raylib.ImageDraw = ImageDraw * * @return {undefined} */ -function ImageDrawText (dst, text, posX, posY, fontSize, color) { +function ImageDrawText(dst, text, posX, posY, fontSize, color) { const obj = r.BindImageDrawText( dst.data, dst.width, @@ -14787,7 +16811,7 @@ raylib.ImageDrawText = ImageDrawText * * @return {undefined} */ -function ImageDrawTextEx (dst, font, text, position, fontSize, spacing, tint) { +function ImageDrawTextEx(dst, font, text, position, fontSize, spacing, tint) { const obj = r.BindImageDrawTextEx( dst.data, dst.width, @@ -14829,7 +16853,7 @@ raylib.ImageDrawTextEx = ImageDrawTextEx * * @return {undefined} */ -function GenTextureMipmaps (texture) { +function GenTextureMipmaps(texture) { const obj = r.BindGenTextureMipmaps( texture.id, texture.width, @@ -14853,7 +16877,7 @@ raylib.GenTextureMipmaps = GenTextureMipmaps * * @return {undefined} */ -function UploadMesh (mesh, dynamic) { +function UploadMesh(mesh, dynamic) { const obj = r.BindUploadMesh( mesh.vertexCount, mesh.triangleCount, @@ -14868,6 +16892,8 @@ function UploadMesh (mesh, dynamic) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId, dynamic @@ -14887,7 +16913,7 @@ raylib.UploadMesh = UploadMesh * * @return {undefined} */ -function GenMeshTangents (mesh) { +function GenMeshTangents(mesh) { const obj = r.BindGenMeshTangents( mesh.vertexCount, mesh.triangleCount, @@ -14902,6 +16928,8 @@ function GenMeshTangents (mesh) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId ) @@ -14922,7 +16950,7 @@ raylib.GenMeshTangents = GenMeshTangents * * @return {undefined} */ -function SetModelMeshMaterial (model, meshId, materialId) { +function SetModelMeshMaterial(model, meshId, materialId) { const obj = r.BindSetModelMeshMaterial( model.transform.m0, model.transform.m4, @@ -14960,23 +16988,23 @@ function SetModelMeshMaterial (model, meshId, materialId) { raylib.SetModelMeshMaterial = SetModelMeshMaterial /** - * Crop a wave to defined samples range + * Crop a wave to defined frames range * * @param {Wave} wave - * @param {number} initSample - * @param {number} finalSample + * @param {number} initFrame + * @param {number} finalFrame * * @return {undefined} */ -function WaveCrop (wave, initSample, finalSample) { +function WaveCrop(wave, initFrame, finalFrame) { const obj = r.BindWaveCrop( wave.frameCount, wave.sampleRate, wave.sampleSize, wave.channels, wave.data, - initSample, - finalSample + initFrame, + finalFrame ) if (typeof obj !== 'undefined') { for (const key in obj) { @@ -14996,7 +17024,7 @@ raylib.WaveCrop = WaveCrop * * @return {undefined} */ -function WaveFormat (wave, sampleRate, sampleSize, channels) { +function WaveFormat(wave, sampleRate, sampleSize, channels) { const obj = r.BindWaveFormat( wave.frameCount, wave.sampleRate, @@ -15025,8 +17053,8 @@ raylib.WaveFormat = WaveFormat * * @return {Color} The new Color. */ -function Color (r, g, b, a) { - return { r, g, b, a } +function Color(r,g,b,a) { + return {r,g,b,a} } raylib.Color = Color @@ -15038,8 +17066,8 @@ raylib.Color = Color * * @return {Vector2} The new Vector2. */ -function Vector2 (x, y) { - return { x, y } +function Vector2(x,y) { + return {x,y} } raylib.Vector2 = Vector2 @@ -15052,8 +17080,8 @@ raylib.Vector2 = Vector2 * * @return {Vector3} The new Vector3. */ -function Vector3 (x, y, z) { - return { x, y, z } +function Vector3(x,y,z) { + return {x,y,z} } raylib.Vector3 = Vector3 @@ -15067,8 +17095,8 @@ raylib.Vector3 = Vector3 * * @return {Vector4} The new Vector4. */ -function Vector4 (x, y, z, w) { - return { x, y, z, w } +function Vector4(x,y,z,w) { + return {x,y,z,w} } raylib.Vector4 = Vector4 @@ -15082,8 +17110,8 @@ raylib.Vector4 = Vector4 * * @return {Rectangle} The new Rectangle. */ -function Rectangle (x, y, width, height) { - return { x, y, width, height } +function Rectangle(x,y,width,height) { + return {x,y,width,height} } raylib.Rectangle = Rectangle @@ -15097,8 +17125,8 @@ raylib.Rectangle = Rectangle * * @return {Camera2D} The new Camera2D. */ -function Camera2D (offset, target, rotation, zoom) { - return { offset, target, rotation, zoom } +function Camera2D(offset,target,rotation,zoom) { + return {offset,target,rotation,zoom} } raylib.Camera2D = Camera2D @@ -15113,8 +17141,8 @@ raylib.Camera2D = Camera2D * * @return {Camera3D} The new Camera3D. */ -function Camera3D (position, target, up, fovy, projection) { - return { position, target, up, fovy, projection } +function Camera3D(position,target,up,fovy,projection) { + return {position,target,up,fovy,projection} } raylib.Camera3D = Camera3D raylib.Camera = raylib.Camera3D @@ -15123,14 +17151,14 @@ raylib.Camera = raylib.Camera3D /** * Set shader uniform value float - * + * * @param {Shader} shader * @param {number} locIndex * @param {number} value - * + * * @returns {undefined} */ -function SetShaderFloat (shader, locIndex, value) { +function SetShaderFloat(shader, locIndex, value) { return r.BindSetShaderFloat( shader.id, shader.locs, @@ -15142,14 +17170,14 @@ raylib.SetShaderFloat = SetShaderFloat /** * Set shader uniform value float - * + * * @param {Shader} shader * @param {number} locIndex * @param {number} value - * + * * @returns {undefined} */ -function SetShaderInt (shader, locIndex, value) { +function SetShaderInt(shader, locIndex, value) { return r.BindSetShaderInt( shader.id, shader.locs, @@ -15161,14 +17189,14 @@ raylib.SetShaderInt = SetShaderInt /** * Set shader uniform value vector2 - * + * * @param {Shader} shader * @param {number} locIndex * @param {Vector2} value - * + * * @returns {undefined} */ -function SetShaderVec2 (shader, locIndex, value) { +function SetShaderVec2(shader, locIndex, value) { return r.BindSetShaderVec2( shader.id, shader.locs, @@ -15181,14 +17209,14 @@ raylib.SetShaderVec2 = SetShaderVec2 /** * Set shader uniform value vector3 - * + * * @param {Shader} shader * @param {number} locIndex * @param {Vector3} value - * + * * @returns {undefined} */ -function SetShaderVec3 (shader, locIndex, value) { +function SetShaderVec3(shader, locIndex, value) { return r.BindSetShaderVec3( shader.id, shader.locs, @@ -15202,14 +17230,14 @@ raylib.SetShaderVec3 = SetShaderVec3 /** * Set shader uniform value vector4 - * + * * @param {Shader} shader * @param {number} locIndex * @param {Vector4} value - * + * * @returns {undefined} */ -function SetShaderVec4 (shader, locIndex, value) { +function SetShaderVec4(shader, locIndex, value) { return r.BindSetShaderVec4( shader.id, shader.locs, @@ -15326,6 +17354,14 @@ raylib.FLAG_WINDOW_HIGHDPI = 8192 */ raylib.FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384 +/** + * Set to run program in borderless windowed mode + * + * @type {number} + * @constant + */ +raylib.FLAG_BORDERLESS_WINDOWED_MODE = 32768 + /** * Set to try enabling MSAA 4X * @@ -16268,7 +18304,7 @@ raylib.KEY_BACK = 4 * @type {number} * @constant */ -raylib.KEY_MENU = 82 +raylib.KEY_MENU = 5 /** * Key: Android volume up button @@ -16479,7 +18515,7 @@ raylib.GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4 raylib.GAMEPAD_BUTTON_RIGHT_FACE_UP = 5 /** - * Gamepad right button right (i.e. PS3: Square, Xbox: X) + * Gamepad right button right (i.e. PS3: Circle, Xbox: B) * * @type {number} * @constant @@ -16495,7 +18531,7 @@ raylib.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6 raylib.GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7 /** - * Gamepad right button left (i.e. PS3: Circle, Xbox: B) + * Gamepad right button left (i.e. PS3: Square, Xbox: X) * * @type {number} * @constant @@ -16519,7 +18555,7 @@ raylib.GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9 raylib.GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10 /** - * Gamepad top/back trigger right (one), it could be a trailing button + * Gamepad top/back trigger right (first), it could be a trailing button * * @type {number} * @constant @@ -16895,28 +18931,52 @@ raylib.SHADER_LOC_MAP_HEIGHT = 21 raylib.SHADER_LOC_MAP_CUBEMAP = 22 /** - * Shader location: samplerCube texture: irradiance + * Shader location: samplerCube texture: irradiance + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_IRRADIANCE = 23 + +/** + * Shader location: samplerCube texture: prefilter + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_PREFILTER = 24 + +/** + * Shader location: sampler2d texture: brdf + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_BRDF = 25 + +/** + * Shader location: vertex attribute: boneIds * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_IRRADIANCE = 23 +raylib.SHADER_LOC_VERTEX_BONEIDS = 26 /** - * Shader location: samplerCube texture: prefilter + * Shader location: vertex attribute: boneWeights * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_PREFILTER = 24 +raylib.SHADER_LOC_VERTEX_BONEWEIGHTS = 27 /** - * Shader location: sampler2d texture: brdf + * Shader location: array of matrices uniform: boneMatrices * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_BRDF = 25 +raylib.SHADER_LOC_BONE_MATRICES = 28 /** * Shader uniform type: float @@ -17102,13 +19162,37 @@ raylib.PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 */ raylib.PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 +/** + * 16 bpp (1 channel - half float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R16 = 11 + +/** + * 16*3 bpp (3 channels - half float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12 + +/** + * 16*4 bpp (4 channels - half float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13 + /** * 4 bpp (no alpha) * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 +raylib.PIXELFORMAT_COMPRESSED_DXT1_RGB = 14 /** * 4 bpp (1 bit alpha) @@ -17116,7 +19200,7 @@ raylib.PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 +raylib.PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15 /** * 8 bpp @@ -17124,7 +19208,7 @@ raylib.PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 +raylib.PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16 /** * 8 bpp @@ -17132,7 +19216,7 @@ raylib.PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 +raylib.PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17 /** * 4 bpp @@ -17140,7 +19224,7 @@ raylib.PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 +raylib.PIXELFORMAT_COMPRESSED_ETC1_RGB = 18 /** * 4 bpp @@ -17148,7 +19232,7 @@ raylib.PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 +raylib.PIXELFORMAT_COMPRESSED_ETC2_RGB = 19 /** * 8 bpp @@ -17156,7 +19240,7 @@ raylib.PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 +raylib.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20 /** * 4 bpp @@ -17164,7 +19248,7 @@ raylib.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 +raylib.PIXELFORMAT_COMPRESSED_PVRT_RGB = 21 /** * 4 bpp @@ -17172,7 +19256,7 @@ raylib.PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 +raylib.PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22 /** * 8 bpp @@ -17180,7 +19264,7 @@ raylib.PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 +raylib.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23 /** * 2 bpp @@ -17188,7 +19272,7 @@ raylib.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 +raylib.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24 /** * No filter, just pixel approximation @@ -17310,14 +19394,6 @@ raylib.CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 */ raylib.CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 -/** - * Layout is defined by a panorama image (equirrectangular map) - * - * @type {number} - * @constant - */ -raylib.CUBEMAP_LAYOUT_PANORAMA = 5 - /** * Default font generation, anti-aliased * @@ -17495,7 +19571,7 @@ raylib.GESTURE_PINCH_IN = 256 raylib.GESTURE_PINCH_OUT = 512 /** - * Custom camera + * Camera custom, controlled by user (UpdateCamera() does nothing) * * @type {number} * @constant @@ -17503,7 +19579,7 @@ raylib.GESTURE_PINCH_OUT = 512 raylib.CAMERA_CUSTOM = 0 /** - * Free camera + * Camera free mode * * @type {number} * @constant @@ -17511,7 +19587,7 @@ raylib.CAMERA_CUSTOM = 0 raylib.CAMERA_FREE = 1 /** - * Orbital camera + * Camera orbital, around target, zoom supported * * @type {number} * @constant @@ -17519,7 +19595,7 @@ raylib.CAMERA_FREE = 1 raylib.CAMERA_ORBITAL = 2 /** - * First person camera + * Camera first person * * @type {number} * @constant @@ -17527,7 +19603,7 @@ raylib.CAMERA_ORBITAL = 2 raylib.CAMERA_FIRST_PERSON = 3 /** - * Third person camera + * Camera third person * * @type {number} * @constant @@ -17575,7 +19651,7 @@ raylib.NPATCH_THREE_PATCH_VERTICAL = 1 raylib.NPATCH_THREE_PATCH_HORIZONTAL = 2 /** - * + * * * @type {number} * @constant @@ -17583,7 +19659,7 @@ raylib.NPATCH_THREE_PATCH_HORIZONTAL = 2 raylib.STATE_NORMAL = 0 /** - * + * * * @type {number} * @constant @@ -17591,7 +19667,7 @@ raylib.STATE_NORMAL = 0 raylib.STATE_FOCUSED = 1 /** - * + * * * @type {number} * @constant @@ -17599,7 +19675,7 @@ raylib.STATE_FOCUSED = 1 raylib.STATE_PRESSED = 2 /** - * + * * * @type {number} * @constant @@ -17607,7 +19683,7 @@ raylib.STATE_PRESSED = 2 raylib.STATE_DISABLED = 3 /** - * + * * * @type {number} * @constant @@ -17615,7 +19691,7 @@ raylib.STATE_DISABLED = 3 raylib.TEXT_ALIGN_LEFT = 0 /** - * + * * * @type {number} * @constant @@ -17623,7 +19699,7 @@ raylib.TEXT_ALIGN_LEFT = 0 raylib.TEXT_ALIGN_CENTER = 1 /** - * + * * * @type {number} * @constant @@ -17631,7 +19707,55 @@ raylib.TEXT_ALIGN_CENTER = 1 raylib.TEXT_ALIGN_RIGHT = 2 /** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_TOP = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_MIDDLE = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_BOTTOM = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_WRAP_NONE = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_WRAP_CHAR = 1 + +/** + * * + * @type {number} + * @constant + */ +raylib.TEXT_WRAP_WORD = 2 + +/** + * * * @type {number} * @constant @@ -17647,7 +19771,7 @@ raylib.DEFAULT = 0 raylib.LABEL = 1 /** - * + * * * @type {number} * @constant @@ -17663,7 +19787,7 @@ raylib.BUTTON = 2 raylib.TOGGLE = 3 /** - * Used also for: SLIDERBAR + * Used also for: SLIDERBAR, TOGGLESLIDER * * @type {number} * @constant @@ -17671,7 +19795,7 @@ raylib.TOGGLE = 3 raylib.SLIDER = 4 /** - * + * * * @type {number} * @constant @@ -17679,7 +19803,7 @@ raylib.SLIDER = 4 raylib.PROGRESSBAR = 5 /** - * + * * * @type {number} * @constant @@ -17687,7 +19811,7 @@ raylib.PROGRESSBAR = 5 raylib.CHECKBOX = 6 /** - * + * * * @type {number} * @constant @@ -17695,7 +19819,7 @@ raylib.CHECKBOX = 6 raylib.COMBOBOX = 7 /** - * + * * * @type {number} * @constant @@ -17711,7 +19835,7 @@ raylib.DROPDOWNBOX = 8 raylib.TEXTBOX = 9 /** - * + * * * @type {number} * @constant @@ -17727,7 +19851,7 @@ raylib.VALUEBOX = 10 raylib.SPINNER = 11 /** - * + * * * @type {number} * @constant @@ -17735,7 +19859,7 @@ raylib.SPINNER = 11 raylib.LISTVIEW = 12 /** - * + * * * @type {number} * @constant @@ -17743,7 +19867,7 @@ raylib.LISTVIEW = 12 raylib.COLORPICKER = 13 /** - * + * * * @type {number} * @constant @@ -17751,7 +19875,7 @@ raylib.COLORPICKER = 13 raylib.SCROLLBAR = 14 /** - * + * * * @type {number} * @constant @@ -17759,7 +19883,7 @@ raylib.SCROLLBAR = 14 raylib.STATUSBAR = 15 /** - * + * Control border color in STATE_NORMAL * * @type {number} * @constant @@ -17767,7 +19891,7 @@ raylib.STATUSBAR = 15 raylib.BORDER_COLOR_NORMAL = 0 /** - * + * Control base color in STATE_NORMAL * * @type {number} * @constant @@ -17775,7 +19899,7 @@ raylib.BORDER_COLOR_NORMAL = 0 raylib.BASE_COLOR_NORMAL = 1 /** - * + * Control text color in STATE_NORMAL * * @type {number} * @constant @@ -17783,7 +19907,7 @@ raylib.BASE_COLOR_NORMAL = 1 raylib.TEXT_COLOR_NORMAL = 2 /** - * + * Control border color in STATE_FOCUSED * * @type {number} * @constant @@ -17791,7 +19915,7 @@ raylib.TEXT_COLOR_NORMAL = 2 raylib.BORDER_COLOR_FOCUSED = 3 /** - * + * Control base color in STATE_FOCUSED * * @type {number} * @constant @@ -17799,7 +19923,7 @@ raylib.BORDER_COLOR_FOCUSED = 3 raylib.BASE_COLOR_FOCUSED = 4 /** - * + * Control text color in STATE_FOCUSED * * @type {number} * @constant @@ -17807,7 +19931,7 @@ raylib.BASE_COLOR_FOCUSED = 4 raylib.TEXT_COLOR_FOCUSED = 5 /** - * + * Control border color in STATE_PRESSED * * @type {number} * @constant @@ -17815,7 +19939,7 @@ raylib.TEXT_COLOR_FOCUSED = 5 raylib.BORDER_COLOR_PRESSED = 6 /** - * + * Control base color in STATE_PRESSED * * @type {number} * @constant @@ -17823,7 +19947,7 @@ raylib.BORDER_COLOR_PRESSED = 6 raylib.BASE_COLOR_PRESSED = 7 /** - * + * Control text color in STATE_PRESSED * * @type {number} * @constant @@ -17831,7 +19955,7 @@ raylib.BASE_COLOR_PRESSED = 7 raylib.TEXT_COLOR_PRESSED = 8 /** - * + * Control border color in STATE_DISABLED * * @type {number} * @constant @@ -17839,7 +19963,7 @@ raylib.TEXT_COLOR_PRESSED = 8 raylib.BORDER_COLOR_DISABLED = 9 /** - * + * Control base color in STATE_DISABLED * * @type {number} * @constant @@ -17847,7 +19971,7 @@ raylib.BORDER_COLOR_DISABLED = 9 raylib.BASE_COLOR_DISABLED = 10 /** - * + * Control text color in STATE_DISABLED * * @type {number} * @constant @@ -17855,7 +19979,7 @@ raylib.BASE_COLOR_DISABLED = 10 raylib.TEXT_COLOR_DISABLED = 11 /** - * + * Control border size, 0 for no border * * @type {number} * @constant @@ -17863,7 +19987,7 @@ raylib.TEXT_COLOR_DISABLED = 11 raylib.BORDER_WIDTH = 12 /** - * + * Control text padding, not considering border * * @type {number} * @constant @@ -17871,21 +19995,13 @@ raylib.BORDER_WIDTH = 12 raylib.TEXT_PADDING = 13 /** - * + * Control text horizontal alignment inside control text bound (after border and padding) * * @type {number} * @constant */ raylib.TEXT_ALIGNMENT = 14 -/** - * - * - * @type {number} - * @constant - */ -raylib.RESERVED = 15 - /** * Text size (glyphs max height) * @@ -17918,6 +20034,30 @@ raylib.LINE_COLOR = 18 */ raylib.BACKGROUND_COLOR = 19 +/** + * Text spacing between lines + * + * @type {number} + * @constant + */ +raylib.TEXT_LINE_SPACING = 20 + +/** + * Text vertical alignment inside text bounds (after border and padding) + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGNMENT_VERTICAL = 21 + +/** + * Text wrap-mode inside text bounds + * + * @type {number} + * @constant + */ +raylib.TEXT_WRAP_MODE = 22 + /** * ToggleGroup separation between toggles * @@ -17951,7 +20091,7 @@ raylib.SLIDER_PADDING = 17 raylib.PROGRESS_PADDING = 16 /** - * + * ScrollBar arrows size * * @type {number} * @constant @@ -17959,7 +20099,7 @@ raylib.PROGRESS_PADDING = 16 raylib.ARROWS_SIZE = 16 /** - * + * ScrollBar arrows visible * * @type {number} * @constant @@ -17967,7 +20107,7 @@ raylib.ARROWS_SIZE = 16 raylib.ARROWS_VISIBLE = 17 /** - * (SLIDERBAR, SLIDER_PADDING) + * ScrollBar slider internal padding * * @type {number} * @constant @@ -17975,7 +20115,7 @@ raylib.ARROWS_VISIBLE = 17 raylib.SCROLL_SLIDER_PADDING = 18 /** - * + * ScrollBar slider size * * @type {number} * @constant @@ -17983,7 +20123,7 @@ raylib.SCROLL_SLIDER_PADDING = 18 raylib.SCROLL_SLIDER_SIZE = 19 /** - * + * ScrollBar scroll padding from arrows * * @type {number} * @constant @@ -17991,7 +20131,7 @@ raylib.SCROLL_SLIDER_SIZE = 19 raylib.SCROLL_PADDING = 20 /** - * + * ScrollBar scrolling speed * * @type {number} * @constant @@ -18039,20 +20179,28 @@ raylib.ARROW_PADDING = 16 raylib.DROPDOWN_ITEMS_SPACING = 17 /** - * TextBox/TextBoxMulti/ValueBox/Spinner inner text padding + * DropdownBox arrow hidden * * @type {number} * @constant */ -raylib.TEXT_INNER_PADDING = 16 +raylib.DROPDOWN_ARROW_HIDDEN = 18 /** - * TextBoxMulti lines separation + * DropdownBox roll up flag (default rolls down) * * @type {number} * @constant */ -raylib.TEXT_LINES_SPACING = 17 +raylib.DROPDOWN_ROLL_UP = 19 + +/** + * TextBox in read-only mode: 0-text editable, 1-text no-editable + * + * @type {number} + * @constant + */ +raylib.TEXT_READONLY = 16 /** * Spinner left/right buttons width @@ -18095,7 +20243,7 @@ raylib.LIST_ITEMS_SPACING = 17 raylib.SCROLLBAR_WIDTH = 18 /** - * ListView scrollbar side (0-left, 1-right) + * ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) * * @type {number} * @constant @@ -18103,7 +20251,15 @@ raylib.SCROLLBAR_WIDTH = 18 raylib.SCROLLBAR_SIDE = 19 /** + * ListView items border width * + * @type {number} + * @constant + */ +raylib.LIST_ITEMS_BORDER_WIDTH = 20 + +/** + * * * @type {number} * @constant @@ -18143,7 +20299,7 @@ raylib.HUEBAR_SELECTOR_HEIGHT = 19 raylib.HUEBAR_SELECTOR_OVERFLOW = 20 /** - * + * * * @type {number} * @constant @@ -18151,7 +20307,7 @@ raylib.HUEBAR_SELECTOR_OVERFLOW = 20 raylib.ICON_NONE = 0 /** - * + * * * @type {number} * @constant @@ -18159,7 +20315,7 @@ raylib.ICON_NONE = 0 raylib.ICON_FOLDER_FILE_OPEN = 1 /** - * + * * * @type {number} * @constant @@ -18167,7 +20323,7 @@ raylib.ICON_FOLDER_FILE_OPEN = 1 raylib.ICON_FILE_SAVE_CLASSIC = 2 /** - * + * * * @type {number} * @constant @@ -18175,7 +20331,7 @@ raylib.ICON_FILE_SAVE_CLASSIC = 2 raylib.ICON_FOLDER_OPEN = 3 /** - * + * * * @type {number} * @constant @@ -18183,7 +20339,7 @@ raylib.ICON_FOLDER_OPEN = 3 raylib.ICON_FOLDER_SAVE = 4 /** - * + * * * @type {number} * @constant @@ -18191,7 +20347,7 @@ raylib.ICON_FOLDER_SAVE = 4 raylib.ICON_FILE_OPEN = 5 /** - * + * * * @type {number} * @constant @@ -18199,7 +20355,7 @@ raylib.ICON_FILE_OPEN = 5 raylib.ICON_FILE_SAVE = 6 /** - * + * * * @type {number} * @constant @@ -18207,7 +20363,7 @@ raylib.ICON_FILE_SAVE = 6 raylib.ICON_FILE_EXPORT = 7 /** - * + * * * @type {number} * @constant @@ -18215,7 +20371,7 @@ raylib.ICON_FILE_EXPORT = 7 raylib.ICON_FILE_ADD = 8 /** - * + * * * @type {number} * @constant @@ -18223,7 +20379,7 @@ raylib.ICON_FILE_ADD = 8 raylib.ICON_FILE_DELETE = 9 /** - * + * * * @type {number} * @constant @@ -18231,7 +20387,7 @@ raylib.ICON_FILE_DELETE = 9 raylib.ICON_FILETYPE_TEXT = 10 /** - * + * * * @type {number} * @constant @@ -18239,7 +20395,7 @@ raylib.ICON_FILETYPE_TEXT = 10 raylib.ICON_FILETYPE_AUDIO = 11 /** - * + * * * @type {number} * @constant @@ -18247,7 +20403,7 @@ raylib.ICON_FILETYPE_AUDIO = 11 raylib.ICON_FILETYPE_IMAGE = 12 /** - * + * * * @type {number} * @constant @@ -18255,7 +20411,7 @@ raylib.ICON_FILETYPE_IMAGE = 12 raylib.ICON_FILETYPE_PLAY = 13 /** - * + * * * @type {number} * @constant @@ -18263,7 +20419,7 @@ raylib.ICON_FILETYPE_PLAY = 13 raylib.ICON_FILETYPE_VIDEO = 14 /** - * + * * * @type {number} * @constant @@ -18271,7 +20427,7 @@ raylib.ICON_FILETYPE_VIDEO = 14 raylib.ICON_FILETYPE_INFO = 15 /** - * + * * * @type {number} * @constant @@ -18279,7 +20435,7 @@ raylib.ICON_FILETYPE_INFO = 15 raylib.ICON_FILE_COPY = 16 /** - * + * * * @type {number} * @constant @@ -18287,7 +20443,7 @@ raylib.ICON_FILE_COPY = 16 raylib.ICON_FILE_CUT = 17 /** - * + * * * @type {number} * @constant @@ -18295,7 +20451,7 @@ raylib.ICON_FILE_CUT = 17 raylib.ICON_FILE_PASTE = 18 /** - * + * * * @type {number} * @constant @@ -18303,7 +20459,7 @@ raylib.ICON_FILE_PASTE = 18 raylib.ICON_CURSOR_HAND = 19 /** - * + * * * @type {number} * @constant @@ -18311,7 +20467,7 @@ raylib.ICON_CURSOR_HAND = 19 raylib.ICON_CURSOR_POINTER = 20 /** - * + * * * @type {number} * @constant @@ -18319,7 +20475,7 @@ raylib.ICON_CURSOR_POINTER = 20 raylib.ICON_CURSOR_CLASSIC = 21 /** - * + * * * @type {number} * @constant @@ -18327,7 +20483,7 @@ raylib.ICON_CURSOR_CLASSIC = 21 raylib.ICON_PENCIL = 22 /** - * + * * * @type {number} * @constant @@ -18335,7 +20491,7 @@ raylib.ICON_PENCIL = 22 raylib.ICON_PENCIL_BIG = 23 /** - * + * * * @type {number} * @constant @@ -18343,7 +20499,7 @@ raylib.ICON_PENCIL_BIG = 23 raylib.ICON_BRUSH_CLASSIC = 24 /** - * + * * * @type {number} * @constant @@ -18351,7 +20507,7 @@ raylib.ICON_BRUSH_CLASSIC = 24 raylib.ICON_BRUSH_PAINTER = 25 /** - * + * * * @type {number} * @constant @@ -18359,7 +20515,7 @@ raylib.ICON_BRUSH_PAINTER = 25 raylib.ICON_WATER_DROP = 26 /** - * + * * * @type {number} * @constant @@ -18367,7 +20523,7 @@ raylib.ICON_WATER_DROP = 26 raylib.ICON_COLOR_PICKER = 27 /** - * + * * * @type {number} * @constant @@ -18375,7 +20531,7 @@ raylib.ICON_COLOR_PICKER = 27 raylib.ICON_RUBBER = 28 /** - * + * * * @type {number} * @constant @@ -18383,7 +20539,7 @@ raylib.ICON_RUBBER = 28 raylib.ICON_COLOR_BUCKET = 29 /** - * + * * * @type {number} * @constant @@ -18391,7 +20547,7 @@ raylib.ICON_COLOR_BUCKET = 29 raylib.ICON_TEXT_T = 30 /** - * + * * * @type {number} * @constant @@ -18399,7 +20555,7 @@ raylib.ICON_TEXT_T = 30 raylib.ICON_TEXT_A = 31 /** - * + * * * @type {number} * @constant @@ -18407,7 +20563,7 @@ raylib.ICON_TEXT_A = 31 raylib.ICON_SCALE = 32 /** - * + * * * @type {number} * @constant @@ -18415,7 +20571,7 @@ raylib.ICON_SCALE = 32 raylib.ICON_RESIZE = 33 /** - * + * * * @type {number} * @constant @@ -18423,7 +20579,7 @@ raylib.ICON_RESIZE = 33 raylib.ICON_FILTER_POINT = 34 /** - * + * * * @type {number} * @constant @@ -18431,7 +20587,7 @@ raylib.ICON_FILTER_POINT = 34 raylib.ICON_FILTER_BILINEAR = 35 /** - * + * * * @type {number} * @constant @@ -18439,7 +20595,7 @@ raylib.ICON_FILTER_BILINEAR = 35 raylib.ICON_CROP = 36 /** - * + * * * @type {number} * @constant @@ -18447,7 +20603,7 @@ raylib.ICON_CROP = 36 raylib.ICON_CROP_ALPHA = 37 /** - * + * * * @type {number} * @constant @@ -18455,7 +20611,7 @@ raylib.ICON_CROP_ALPHA = 37 raylib.ICON_SQUARE_TOGGLE = 38 /** - * + * * * @type {number} * @constant @@ -18463,7 +20619,7 @@ raylib.ICON_SQUARE_TOGGLE = 38 raylib.ICON_SYMMETRY = 39 /** - * + * * * @type {number} * @constant @@ -18471,7 +20627,7 @@ raylib.ICON_SYMMETRY = 39 raylib.ICON_SYMMETRY_HORIZONTAL = 40 /** - * + * * * @type {number} * @constant @@ -18479,7 +20635,7 @@ raylib.ICON_SYMMETRY_HORIZONTAL = 40 raylib.ICON_SYMMETRY_VERTICAL = 41 /** - * + * * * @type {number} * @constant @@ -18487,7 +20643,7 @@ raylib.ICON_SYMMETRY_VERTICAL = 41 raylib.ICON_LENS = 42 /** - * + * * * @type {number} * @constant @@ -18495,7 +20651,7 @@ raylib.ICON_LENS = 42 raylib.ICON_LENS_BIG = 43 /** - * + * * * @type {number} * @constant @@ -18503,7 +20659,7 @@ raylib.ICON_LENS_BIG = 43 raylib.ICON_EYE_ON = 44 /** - * + * * * @type {number} * @constant @@ -18511,7 +20667,7 @@ raylib.ICON_EYE_ON = 44 raylib.ICON_EYE_OFF = 45 /** - * + * * * @type {number} * @constant @@ -18519,7 +20675,7 @@ raylib.ICON_EYE_OFF = 45 raylib.ICON_FILTER_TOP = 46 /** - * + * * * @type {number} * @constant @@ -18527,7 +20683,7 @@ raylib.ICON_FILTER_TOP = 46 raylib.ICON_FILTER = 47 /** - * + * * * @type {number} * @constant @@ -18535,7 +20691,7 @@ raylib.ICON_FILTER = 47 raylib.ICON_TARGET_POINT = 48 /** - * + * * * @type {number} * @constant @@ -18543,7 +20699,7 @@ raylib.ICON_TARGET_POINT = 48 raylib.ICON_TARGET_SMALL = 49 /** - * + * * * @type {number} * @constant @@ -18551,7 +20707,7 @@ raylib.ICON_TARGET_SMALL = 49 raylib.ICON_TARGET_BIG = 50 /** - * + * * * @type {number} * @constant @@ -18559,7 +20715,7 @@ raylib.ICON_TARGET_BIG = 50 raylib.ICON_TARGET_MOVE = 51 /** - * + * * * @type {number} * @constant @@ -18567,7 +20723,7 @@ raylib.ICON_TARGET_MOVE = 51 raylib.ICON_CURSOR_MOVE = 52 /** - * + * * * @type {number} * @constant @@ -18575,7 +20731,7 @@ raylib.ICON_CURSOR_MOVE = 52 raylib.ICON_CURSOR_SCALE = 53 /** - * + * * * @type {number} * @constant @@ -18583,7 +20739,7 @@ raylib.ICON_CURSOR_SCALE = 53 raylib.ICON_CURSOR_SCALE_RIGHT = 54 /** - * + * * * @type {number} * @constant @@ -18591,7 +20747,7 @@ raylib.ICON_CURSOR_SCALE_RIGHT = 54 raylib.ICON_CURSOR_SCALE_LEFT = 55 /** - * + * * * @type {number} * @constant @@ -18599,7 +20755,7 @@ raylib.ICON_CURSOR_SCALE_LEFT = 55 raylib.ICON_UNDO = 56 /** - * + * * * @type {number} * @constant @@ -18607,7 +20763,7 @@ raylib.ICON_UNDO = 56 raylib.ICON_REDO = 57 /** - * + * * * @type {number} * @constant @@ -18615,7 +20771,7 @@ raylib.ICON_REDO = 57 raylib.ICON_REREDO = 58 /** - * + * * * @type {number} * @constant @@ -18623,7 +20779,7 @@ raylib.ICON_REREDO = 58 raylib.ICON_MUTATE = 59 /** - * + * * * @type {number} * @constant @@ -18631,7 +20787,7 @@ raylib.ICON_MUTATE = 59 raylib.ICON_ROTATE = 60 /** - * + * * * @type {number} * @constant @@ -18639,7 +20795,7 @@ raylib.ICON_ROTATE = 60 raylib.ICON_REPEAT = 61 /** - * + * * * @type {number} * @constant @@ -18647,7 +20803,7 @@ raylib.ICON_REPEAT = 61 raylib.ICON_SHUFFLE = 62 /** - * + * * * @type {number} * @constant @@ -18655,7 +20811,7 @@ raylib.ICON_SHUFFLE = 62 raylib.ICON_EMPTYBOX = 63 /** - * + * * * @type {number} * @constant @@ -18663,7 +20819,7 @@ raylib.ICON_EMPTYBOX = 63 raylib.ICON_TARGET = 64 /** - * + * * * @type {number} * @constant @@ -18671,7 +20827,7 @@ raylib.ICON_TARGET = 64 raylib.ICON_TARGET_SMALL_FILL = 65 /** - * + * * * @type {number} * @constant @@ -18679,7 +20835,7 @@ raylib.ICON_TARGET_SMALL_FILL = 65 raylib.ICON_TARGET_BIG_FILL = 66 /** - * + * * * @type {number} * @constant @@ -18687,7 +20843,7 @@ raylib.ICON_TARGET_BIG_FILL = 66 raylib.ICON_TARGET_MOVE_FILL = 67 /** - * + * * * @type {number} * @constant @@ -18695,7 +20851,7 @@ raylib.ICON_TARGET_MOVE_FILL = 67 raylib.ICON_CURSOR_MOVE_FILL = 68 /** - * + * * * @type {number} * @constant @@ -18703,7 +20859,7 @@ raylib.ICON_CURSOR_MOVE_FILL = 68 raylib.ICON_CURSOR_SCALE_FILL = 69 /** - * + * * * @type {number} * @constant @@ -18711,7 +20867,7 @@ raylib.ICON_CURSOR_SCALE_FILL = 69 raylib.ICON_CURSOR_SCALE_RIGHT_FILL = 70 /** - * + * * * @type {number} * @constant @@ -18719,7 +20875,7 @@ raylib.ICON_CURSOR_SCALE_RIGHT_FILL = 70 raylib.ICON_CURSOR_SCALE_LEFT_FILL = 71 /** - * + * * * @type {number} * @constant @@ -18727,7 +20883,7 @@ raylib.ICON_CURSOR_SCALE_LEFT_FILL = 71 raylib.ICON_UNDO_FILL = 72 /** - * + * * * @type {number} * @constant @@ -18735,7 +20891,7 @@ raylib.ICON_UNDO_FILL = 72 raylib.ICON_REDO_FILL = 73 /** - * + * * * @type {number} * @constant @@ -18743,7 +20899,7 @@ raylib.ICON_REDO_FILL = 73 raylib.ICON_REREDO_FILL = 74 /** - * + * * * @type {number} * @constant @@ -18751,7 +20907,7 @@ raylib.ICON_REREDO_FILL = 74 raylib.ICON_MUTATE_FILL = 75 /** - * + * * * @type {number} * @constant @@ -18759,7 +20915,7 @@ raylib.ICON_MUTATE_FILL = 75 raylib.ICON_ROTATE_FILL = 76 /** - * + * * * @type {number} * @constant @@ -18767,7 +20923,7 @@ raylib.ICON_ROTATE_FILL = 76 raylib.ICON_REPEAT_FILL = 77 /** - * + * * * @type {number} * @constant @@ -18775,7 +20931,7 @@ raylib.ICON_REPEAT_FILL = 77 raylib.ICON_SHUFFLE_FILL = 78 /** - * + * * * @type {number} * @constant @@ -18783,7 +20939,7 @@ raylib.ICON_SHUFFLE_FILL = 78 raylib.ICON_EMPTYBOX_SMALL = 79 /** - * + * * * @type {number} * @constant @@ -18791,7 +20947,7 @@ raylib.ICON_EMPTYBOX_SMALL = 79 raylib.ICON_BOX = 80 /** - * + * * * @type {number} * @constant @@ -18799,7 +20955,7 @@ raylib.ICON_BOX = 80 raylib.ICON_BOX_TOP = 81 /** - * + * * * @type {number} * @constant @@ -18807,7 +20963,7 @@ raylib.ICON_BOX_TOP = 81 raylib.ICON_BOX_TOP_RIGHT = 82 /** - * + * * * @type {number} * @constant @@ -18815,7 +20971,7 @@ raylib.ICON_BOX_TOP_RIGHT = 82 raylib.ICON_BOX_RIGHT = 83 /** - * + * * * @type {number} * @constant @@ -18823,7 +20979,7 @@ raylib.ICON_BOX_RIGHT = 83 raylib.ICON_BOX_BOTTOM_RIGHT = 84 /** - * + * * * @type {number} * @constant @@ -18831,7 +20987,7 @@ raylib.ICON_BOX_BOTTOM_RIGHT = 84 raylib.ICON_BOX_BOTTOM = 85 /** - * + * * * @type {number} * @constant @@ -18839,7 +20995,7 @@ raylib.ICON_BOX_BOTTOM = 85 raylib.ICON_BOX_BOTTOM_LEFT = 86 /** - * + * * * @type {number} * @constant @@ -18847,7 +21003,7 @@ raylib.ICON_BOX_BOTTOM_LEFT = 86 raylib.ICON_BOX_LEFT = 87 /** - * + * * * @type {number} * @constant @@ -18855,7 +21011,7 @@ raylib.ICON_BOX_LEFT = 87 raylib.ICON_BOX_TOP_LEFT = 88 /** - * + * * * @type {number} * @constant @@ -18863,7 +21019,7 @@ raylib.ICON_BOX_TOP_LEFT = 88 raylib.ICON_BOX_CENTER = 89 /** - * + * * * @type {number} * @constant @@ -18871,7 +21027,7 @@ raylib.ICON_BOX_CENTER = 89 raylib.ICON_BOX_CIRCLE_MASK = 90 /** - * + * * * @type {number} * @constant @@ -18879,7 +21035,7 @@ raylib.ICON_BOX_CIRCLE_MASK = 90 raylib.ICON_POT = 91 /** - * + * * * @type {number} * @constant @@ -18887,7 +21043,7 @@ raylib.ICON_POT = 91 raylib.ICON_ALPHA_MULTIPLY = 92 /** - * + * * * @type {number} * @constant @@ -18895,7 +21051,7 @@ raylib.ICON_ALPHA_MULTIPLY = 92 raylib.ICON_ALPHA_CLEAR = 93 /** - * + * * * @type {number} * @constant @@ -18903,7 +21059,7 @@ raylib.ICON_ALPHA_CLEAR = 93 raylib.ICON_DITHERING = 94 /** - * + * * * @type {number} * @constant @@ -18911,7 +21067,7 @@ raylib.ICON_DITHERING = 94 raylib.ICON_MIPMAPS = 95 /** - * + * * * @type {number} * @constant @@ -18919,7 +21075,7 @@ raylib.ICON_MIPMAPS = 95 raylib.ICON_BOX_GRID = 96 /** - * + * * * @type {number} * @constant @@ -18927,7 +21083,7 @@ raylib.ICON_BOX_GRID = 96 raylib.ICON_GRID = 97 /** - * + * * * @type {number} * @constant @@ -18935,7 +21091,7 @@ raylib.ICON_GRID = 97 raylib.ICON_BOX_CORNERS_SMALL = 98 /** - * + * * * @type {number} * @constant @@ -18943,7 +21099,7 @@ raylib.ICON_BOX_CORNERS_SMALL = 98 raylib.ICON_BOX_CORNERS_BIG = 99 /** - * + * * * @type {number} * @constant @@ -18951,7 +21107,7 @@ raylib.ICON_BOX_CORNERS_BIG = 99 raylib.ICON_FOUR_BOXES = 100 /** - * + * * * @type {number} * @constant @@ -18959,7 +21115,7 @@ raylib.ICON_FOUR_BOXES = 100 raylib.ICON_GRID_FILL = 101 /** - * + * * * @type {number} * @constant @@ -18967,7 +21123,7 @@ raylib.ICON_GRID_FILL = 101 raylib.ICON_BOX_MULTISIZE = 102 /** - * + * * * @type {number} * @constant @@ -18975,7 +21131,7 @@ raylib.ICON_BOX_MULTISIZE = 102 raylib.ICON_ZOOM_SMALL = 103 /** - * + * * * @type {number} * @constant @@ -18983,7 +21139,7 @@ raylib.ICON_ZOOM_SMALL = 103 raylib.ICON_ZOOM_MEDIUM = 104 /** - * + * * * @type {number} * @constant @@ -18991,7 +21147,7 @@ raylib.ICON_ZOOM_MEDIUM = 104 raylib.ICON_ZOOM_BIG = 105 /** - * + * * * @type {number} * @constant @@ -18999,7 +21155,7 @@ raylib.ICON_ZOOM_BIG = 105 raylib.ICON_ZOOM_ALL = 106 /** - * + * * * @type {number} * @constant @@ -19007,7 +21163,7 @@ raylib.ICON_ZOOM_ALL = 106 raylib.ICON_ZOOM_CENTER = 107 /** - * + * * * @type {number} * @constant @@ -19015,7 +21171,7 @@ raylib.ICON_ZOOM_CENTER = 107 raylib.ICON_BOX_DOTS_SMALL = 108 /** - * + * * * @type {number} * @constant @@ -19023,7 +21179,7 @@ raylib.ICON_BOX_DOTS_SMALL = 108 raylib.ICON_BOX_DOTS_BIG = 109 /** - * + * * * @type {number} * @constant @@ -19031,7 +21187,7 @@ raylib.ICON_BOX_DOTS_BIG = 109 raylib.ICON_BOX_CONCENTRIC = 110 /** - * + * * * @type {number} * @constant @@ -19039,7 +21195,7 @@ raylib.ICON_BOX_CONCENTRIC = 110 raylib.ICON_BOX_GRID_BIG = 111 /** - * + * * * @type {number} * @constant @@ -19047,7 +21203,7 @@ raylib.ICON_BOX_GRID_BIG = 111 raylib.ICON_OK_TICK = 112 /** - * + * * * @type {number} * @constant @@ -19055,7 +21211,7 @@ raylib.ICON_OK_TICK = 112 raylib.ICON_CROSS = 113 /** - * + * * * @type {number} * @constant @@ -19063,7 +21219,7 @@ raylib.ICON_CROSS = 113 raylib.ICON_ARROW_LEFT = 114 /** - * + * * * @type {number} * @constant @@ -19071,7 +21227,7 @@ raylib.ICON_ARROW_LEFT = 114 raylib.ICON_ARROW_RIGHT = 115 /** - * + * * * @type {number} * @constant @@ -19079,7 +21235,7 @@ raylib.ICON_ARROW_RIGHT = 115 raylib.ICON_ARROW_DOWN = 116 /** - * + * * * @type {number} * @constant @@ -19087,7 +21243,7 @@ raylib.ICON_ARROW_DOWN = 116 raylib.ICON_ARROW_UP = 117 /** - * + * * * @type {number} * @constant @@ -19095,7 +21251,7 @@ raylib.ICON_ARROW_UP = 117 raylib.ICON_ARROW_LEFT_FILL = 118 /** - * + * * * @type {number} * @constant @@ -19103,7 +21259,7 @@ raylib.ICON_ARROW_LEFT_FILL = 118 raylib.ICON_ARROW_RIGHT_FILL = 119 /** - * + * * * @type {number} * @constant @@ -19111,7 +21267,7 @@ raylib.ICON_ARROW_RIGHT_FILL = 119 raylib.ICON_ARROW_DOWN_FILL = 120 /** - * + * * * @type {number} * @constant @@ -19119,7 +21275,7 @@ raylib.ICON_ARROW_DOWN_FILL = 120 raylib.ICON_ARROW_UP_FILL = 121 /** - * + * * * @type {number} * @constant @@ -19127,7 +21283,7 @@ raylib.ICON_ARROW_UP_FILL = 121 raylib.ICON_AUDIO = 122 /** - * + * * * @type {number} * @constant @@ -19135,7 +21291,7 @@ raylib.ICON_AUDIO = 122 raylib.ICON_FX = 123 /** - * + * * * @type {number} * @constant @@ -19143,7 +21299,7 @@ raylib.ICON_FX = 123 raylib.ICON_WAVE = 124 /** - * + * * * @type {number} * @constant @@ -19151,7 +21307,7 @@ raylib.ICON_WAVE = 124 raylib.ICON_WAVE_SINUS = 125 /** - * + * * * @type {number} * @constant @@ -19159,7 +21315,7 @@ raylib.ICON_WAVE_SINUS = 125 raylib.ICON_WAVE_SQUARE = 126 /** - * + * * * @type {number} * @constant @@ -19167,7 +21323,7 @@ raylib.ICON_WAVE_SQUARE = 126 raylib.ICON_WAVE_TRIANGULAR = 127 /** - * + * * * @type {number} * @constant @@ -19175,7 +21331,7 @@ raylib.ICON_WAVE_TRIANGULAR = 127 raylib.ICON_CROSS_SMALL = 128 /** - * + * * * @type {number} * @constant @@ -19183,7 +21339,7 @@ raylib.ICON_CROSS_SMALL = 128 raylib.ICON_PLAYER_PREVIOUS = 129 /** - * + * * * @type {number} * @constant @@ -19191,7 +21347,7 @@ raylib.ICON_PLAYER_PREVIOUS = 129 raylib.ICON_PLAYER_PLAY_BACK = 130 /** - * + * * * @type {number} * @constant @@ -19199,7 +21355,7 @@ raylib.ICON_PLAYER_PLAY_BACK = 130 raylib.ICON_PLAYER_PLAY = 131 /** - * + * * * @type {number} * @constant @@ -19207,7 +21363,7 @@ raylib.ICON_PLAYER_PLAY = 131 raylib.ICON_PLAYER_PAUSE = 132 /** - * + * * * @type {number} * @constant @@ -19215,7 +21371,7 @@ raylib.ICON_PLAYER_PAUSE = 132 raylib.ICON_PLAYER_STOP = 133 /** - * + * * * @type {number} * @constant @@ -19223,7 +21379,7 @@ raylib.ICON_PLAYER_STOP = 133 raylib.ICON_PLAYER_NEXT = 134 /** - * + * * * @type {number} * @constant @@ -19231,7 +21387,7 @@ raylib.ICON_PLAYER_NEXT = 134 raylib.ICON_PLAYER_RECORD = 135 /** - * + * * * @type {number} * @constant @@ -19239,7 +21395,7 @@ raylib.ICON_PLAYER_RECORD = 135 raylib.ICON_MAGNET = 136 /** - * + * * * @type {number} * @constant @@ -19247,7 +21403,7 @@ raylib.ICON_MAGNET = 136 raylib.ICON_LOCK_CLOSE = 137 /** - * + * * * @type {number} * @constant @@ -19255,7 +21411,7 @@ raylib.ICON_LOCK_CLOSE = 137 raylib.ICON_LOCK_OPEN = 138 /** - * + * * * @type {number} * @constant @@ -19263,7 +21419,7 @@ raylib.ICON_LOCK_OPEN = 138 raylib.ICON_CLOCK = 139 /** - * + * * * @type {number} * @constant @@ -19271,7 +21427,7 @@ raylib.ICON_CLOCK = 139 raylib.ICON_TOOLS = 140 /** - * + * * * @type {number} * @constant @@ -19279,7 +21435,7 @@ raylib.ICON_TOOLS = 140 raylib.ICON_GEAR = 141 /** - * + * * * @type {number} * @constant @@ -19287,7 +21443,7 @@ raylib.ICON_GEAR = 141 raylib.ICON_GEAR_BIG = 142 /** - * + * * * @type {number} * @constant @@ -19295,7 +21451,7 @@ raylib.ICON_GEAR_BIG = 142 raylib.ICON_BIN = 143 /** - * + * * * @type {number} * @constant @@ -19303,7 +21459,7 @@ raylib.ICON_BIN = 143 raylib.ICON_HAND_POINTER = 144 /** - * + * * * @type {number} * @constant @@ -19311,7 +21467,7 @@ raylib.ICON_HAND_POINTER = 144 raylib.ICON_LASER = 145 /** - * + * * * @type {number} * @constant @@ -19319,7 +21475,7 @@ raylib.ICON_LASER = 145 raylib.ICON_COIN = 146 /** - * + * * * @type {number} * @constant @@ -19327,7 +21483,7 @@ raylib.ICON_COIN = 146 raylib.ICON_EXPLOSION = 147 /** - * + * * * @type {number} * @constant @@ -19335,7 +21491,7 @@ raylib.ICON_EXPLOSION = 147 raylib.ICON_1UP = 148 /** - * + * * * @type {number} * @constant @@ -19343,7 +21499,7 @@ raylib.ICON_1UP = 148 raylib.ICON_PLAYER = 149 /** - * + * * * @type {number} * @constant @@ -19351,7 +21507,7 @@ raylib.ICON_PLAYER = 149 raylib.ICON_PLAYER_JUMP = 150 /** - * + * * * @type {number} * @constant @@ -19359,7 +21515,7 @@ raylib.ICON_PLAYER_JUMP = 150 raylib.ICON_KEY = 151 /** - * + * * * @type {number} * @constant @@ -19367,7 +21523,7 @@ raylib.ICON_KEY = 151 raylib.ICON_DEMON = 152 /** - * + * * * @type {number} * @constant @@ -19375,7 +21531,7 @@ raylib.ICON_DEMON = 152 raylib.ICON_TEXT_POPUP = 153 /** - * + * * * @type {number} * @constant @@ -19383,7 +21539,7 @@ raylib.ICON_TEXT_POPUP = 153 raylib.ICON_GEAR_EX = 154 /** - * + * * * @type {number} * @constant @@ -19391,7 +21547,7 @@ raylib.ICON_GEAR_EX = 154 raylib.ICON_CRACK = 155 /** - * + * * * @type {number} * @constant @@ -19399,7 +21555,7 @@ raylib.ICON_CRACK = 155 raylib.ICON_CRACK_POINTS = 156 /** - * + * * * @type {number} * @constant @@ -19407,7 +21563,7 @@ raylib.ICON_CRACK_POINTS = 156 raylib.ICON_STAR = 157 /** - * + * * * @type {number} * @constant @@ -19415,7 +21571,7 @@ raylib.ICON_STAR = 157 raylib.ICON_DOOR = 158 /** - * + * * * @type {number} * @constant @@ -19423,7 +21579,7 @@ raylib.ICON_DOOR = 158 raylib.ICON_EXIT = 159 /** - * + * * * @type {number} * @constant @@ -19431,7 +21587,7 @@ raylib.ICON_EXIT = 159 raylib.ICON_MODE_2D = 160 /** - * + * * * @type {number} * @constant @@ -19439,7 +21595,7 @@ raylib.ICON_MODE_2D = 160 raylib.ICON_MODE_3D = 161 /** - * + * * * @type {number} * @constant @@ -19447,7 +21603,7 @@ raylib.ICON_MODE_3D = 161 raylib.ICON_CUBE = 162 /** - * + * * * @type {number} * @constant @@ -19455,7 +21611,7 @@ raylib.ICON_CUBE = 162 raylib.ICON_CUBE_FACE_TOP = 163 /** - * + * * * @type {number} * @constant @@ -19463,7 +21619,7 @@ raylib.ICON_CUBE_FACE_TOP = 163 raylib.ICON_CUBE_FACE_LEFT = 164 /** - * + * * * @type {number} * @constant @@ -19471,7 +21627,7 @@ raylib.ICON_CUBE_FACE_LEFT = 164 raylib.ICON_CUBE_FACE_FRONT = 165 /** - * + * * * @type {number} * @constant @@ -19479,7 +21635,7 @@ raylib.ICON_CUBE_FACE_FRONT = 165 raylib.ICON_CUBE_FACE_BOTTOM = 166 /** - * + * * * @type {number} * @constant @@ -19487,7 +21643,7 @@ raylib.ICON_CUBE_FACE_BOTTOM = 166 raylib.ICON_CUBE_FACE_RIGHT = 167 /** - * + * * * @type {number} * @constant @@ -19495,7 +21651,7 @@ raylib.ICON_CUBE_FACE_RIGHT = 167 raylib.ICON_CUBE_FACE_BACK = 168 /** - * + * * * @type {number} * @constant @@ -19503,7 +21659,7 @@ raylib.ICON_CUBE_FACE_BACK = 168 raylib.ICON_CAMERA = 169 /** - * + * * * @type {number} * @constant @@ -19511,7 +21667,7 @@ raylib.ICON_CAMERA = 169 raylib.ICON_SPECIAL = 170 /** - * + * * * @type {number} * @constant @@ -19519,7 +21675,7 @@ raylib.ICON_SPECIAL = 170 raylib.ICON_LINK_NET = 171 /** - * + * * * @type {number} * @constant @@ -19527,7 +21683,7 @@ raylib.ICON_LINK_NET = 171 raylib.ICON_LINK_BOXES = 172 /** - * + * * * @type {number} * @constant @@ -19535,7 +21691,7 @@ raylib.ICON_LINK_BOXES = 172 raylib.ICON_LINK_MULTI = 173 /** - * + * * * @type {number} * @constant @@ -19543,7 +21699,7 @@ raylib.ICON_LINK_MULTI = 173 raylib.ICON_LINK = 174 /** - * + * * * @type {number} * @constant @@ -19551,7 +21707,7 @@ raylib.ICON_LINK = 174 raylib.ICON_LINK_BROKE = 175 /** - * + * * * @type {number} * @constant @@ -19559,7 +21715,7 @@ raylib.ICON_LINK_BROKE = 175 raylib.ICON_TEXT_NOTES = 176 /** - * + * * * @type {number} * @constant @@ -19567,7 +21723,7 @@ raylib.ICON_TEXT_NOTES = 176 raylib.ICON_NOTEBOOK = 177 /** - * + * * * @type {number} * @constant @@ -19575,7 +21731,7 @@ raylib.ICON_NOTEBOOK = 177 raylib.ICON_SUITCASE = 178 /** - * + * * * @type {number} * @constant @@ -19583,7 +21739,7 @@ raylib.ICON_SUITCASE = 178 raylib.ICON_SUITCASE_ZIP = 179 /** - * + * * * @type {number} * @constant @@ -19591,7 +21747,7 @@ raylib.ICON_SUITCASE_ZIP = 179 raylib.ICON_MAILBOX = 180 /** - * + * * * @type {number} * @constant @@ -19599,7 +21755,7 @@ raylib.ICON_MAILBOX = 180 raylib.ICON_MONITOR = 181 /** - * + * * * @type {number} * @constant @@ -19607,7 +21763,7 @@ raylib.ICON_MONITOR = 181 raylib.ICON_PRINTER = 182 /** - * + * * * @type {number} * @constant @@ -19615,7 +21771,7 @@ raylib.ICON_PRINTER = 182 raylib.ICON_PHOTO_CAMERA = 183 /** - * + * * * @type {number} * @constant @@ -19623,7 +21779,7 @@ raylib.ICON_PHOTO_CAMERA = 183 raylib.ICON_PHOTO_CAMERA_FLASH = 184 /** - * + * * * @type {number} * @constant @@ -19631,7 +21787,7 @@ raylib.ICON_PHOTO_CAMERA_FLASH = 184 raylib.ICON_HOUSE = 185 /** - * + * * * @type {number} * @constant @@ -19639,7 +21795,7 @@ raylib.ICON_HOUSE = 185 raylib.ICON_HEART = 186 /** - * + * * * @type {number} * @constant @@ -19647,7 +21803,7 @@ raylib.ICON_HEART = 186 raylib.ICON_CORNER = 187 /** - * + * * * @type {number} * @constant @@ -19655,7 +21811,7 @@ raylib.ICON_CORNER = 187 raylib.ICON_VERTICAL_BARS = 188 /** - * + * * * @type {number} * @constant @@ -19663,7 +21819,7 @@ raylib.ICON_VERTICAL_BARS = 188 raylib.ICON_VERTICAL_BARS_FILL = 189 /** - * + * * * @type {number} * @constant @@ -19671,7 +21827,7 @@ raylib.ICON_VERTICAL_BARS_FILL = 189 raylib.ICON_LIFE_BARS = 190 /** - * + * * * @type {number} * @constant @@ -19679,7 +21835,7 @@ raylib.ICON_LIFE_BARS = 190 raylib.ICON_INFO = 191 /** - * + * * * @type {number} * @constant @@ -19687,7 +21843,7 @@ raylib.ICON_INFO = 191 raylib.ICON_CROSSLINE = 192 /** - * + * * * @type {number} * @constant @@ -19695,7 +21851,7 @@ raylib.ICON_CROSSLINE = 192 raylib.ICON_HELP = 193 /** - * + * * * @type {number} * @constant @@ -19703,7 +21859,7 @@ raylib.ICON_HELP = 193 raylib.ICON_FILETYPE_ALPHA = 194 /** - * + * * * @type {number} * @constant @@ -19711,7 +21867,7 @@ raylib.ICON_FILETYPE_ALPHA = 194 raylib.ICON_FILETYPE_HOME = 195 /** - * + * * * @type {number} * @constant @@ -19719,7 +21875,7 @@ raylib.ICON_FILETYPE_HOME = 195 raylib.ICON_LAYERS_VISIBLE = 196 /** - * + * * * @type {number} * @constant @@ -19727,7 +21883,7 @@ raylib.ICON_LAYERS_VISIBLE = 196 raylib.ICON_LAYERS = 197 /** - * + * * * @type {number} * @constant @@ -19735,7 +21891,7 @@ raylib.ICON_LAYERS = 197 raylib.ICON_WINDOW = 198 /** - * + * * * @type {number} * @constant @@ -19743,7 +21899,7 @@ raylib.ICON_WINDOW = 198 raylib.ICON_HIDPI = 199 /** - * + * * * @type {number} * @constant @@ -19751,7 +21907,7 @@ raylib.ICON_HIDPI = 199 raylib.ICON_FILETYPE_BINARY = 200 /** - * + * * * @type {number} * @constant @@ -19759,7 +21915,7 @@ raylib.ICON_FILETYPE_BINARY = 200 raylib.ICON_HEX = 201 /** - * + * * * @type {number} * @constant @@ -19767,7 +21923,7 @@ raylib.ICON_HEX = 201 raylib.ICON_SHIELD = 202 /** - * + * * * @type {number} * @constant @@ -19775,7 +21931,7 @@ raylib.ICON_SHIELD = 202 raylib.ICON_FILE_NEW = 203 /** - * + * * * @type {number} * @constant @@ -19783,7 +21939,7 @@ raylib.ICON_FILE_NEW = 203 raylib.ICON_FOLDER_ADD = 204 /** - * + * * * @type {number} * @constant @@ -19791,7 +21947,7 @@ raylib.ICON_FOLDER_ADD = 204 raylib.ICON_ALARM = 205 /** - * + * * * @type {number} * @constant @@ -19799,7 +21955,7 @@ raylib.ICON_ALARM = 205 raylib.ICON_CPU = 206 /** - * + * * * @type {number} * @constant @@ -19807,7 +21963,7 @@ raylib.ICON_CPU = 206 raylib.ICON_ROM = 207 /** - * + * * * @type {number} * @constant @@ -19815,7 +21971,7 @@ raylib.ICON_ROM = 207 raylib.ICON_STEP_OVER = 208 /** - * + * * * @type {number} * @constant @@ -19823,7 +21979,7 @@ raylib.ICON_STEP_OVER = 208 raylib.ICON_STEP_INTO = 209 /** - * + * * * @type {number} * @constant @@ -19831,7 +21987,7 @@ raylib.ICON_STEP_INTO = 209 raylib.ICON_STEP_OUT = 210 /** - * + * * * @type {number} * @constant @@ -19839,7 +21995,7 @@ raylib.ICON_STEP_OUT = 210 raylib.ICON_RESTART = 211 /** - * + * * * @type {number} * @constant @@ -19847,7 +22003,7 @@ raylib.ICON_RESTART = 211 raylib.ICON_BREAKPOINT_ON = 212 /** - * + * * * @type {number} * @constant @@ -19855,7 +22011,7 @@ raylib.ICON_BREAKPOINT_ON = 212 raylib.ICON_BREAKPOINT_OFF = 213 /** - * + * * * @type {number} * @constant @@ -19863,7 +22019,7 @@ raylib.ICON_BREAKPOINT_OFF = 213 raylib.ICON_BURGER_MENU = 214 /** - * + * * * @type {number} * @constant @@ -19871,7 +22027,7 @@ raylib.ICON_BURGER_MENU = 214 raylib.ICON_CASE_SENSITIVE = 215 /** - * + * * * @type {number} * @constant @@ -19879,7 +22035,7 @@ raylib.ICON_CASE_SENSITIVE = 215 raylib.ICON_REG_EXP = 216 /** - * + * * * @type {number} * @constant @@ -19887,7 +22043,7 @@ raylib.ICON_REG_EXP = 216 raylib.ICON_FOLDER = 217 /** - * + * * * @type {number} * @constant @@ -19895,87 +22051,87 @@ raylib.ICON_FOLDER = 217 raylib.ICON_FILE = 218 /** - * + * * * @type {number} * @constant */ -raylib.ICON_219 = 219 +raylib.ICON_SAND_TIMER = 219 /** - * + * * * @type {number} * @constant */ -raylib.ICON_220 = 220 +raylib.ICON_WARNING = 220 /** - * + * * * @type {number} * @constant */ -raylib.ICON_221 = 221 +raylib.ICON_HELP_BOX = 221 /** - * + * * * @type {number} * @constant */ -raylib.ICON_222 = 222 +raylib.ICON_INFO_BOX = 222 /** - * + * * * @type {number} * @constant */ -raylib.ICON_223 = 223 +raylib.ICON_PRIORITY = 223 /** - * + * * * @type {number} * @constant */ -raylib.ICON_224 = 224 +raylib.ICON_LAYERS_ISO = 224 /** - * + * * * @type {number} * @constant */ -raylib.ICON_225 = 225 +raylib.ICON_LAYERS2 = 225 /** - * + * * * @type {number} * @constant */ -raylib.ICON_226 = 226 +raylib.ICON_MLAYERS = 226 /** - * + * * * @type {number} * @constant */ -raylib.ICON_227 = 227 +raylib.ICON_MAPS = 227 /** - * + * * * @type {number} * @constant */ -raylib.ICON_228 = 228 +raylib.ICON_HOT = 228 /** - * + * * * @type {number} * @constant @@ -19983,7 +22139,7 @@ raylib.ICON_228 = 228 raylib.ICON_229 = 229 /** - * + * * * @type {number} * @constant @@ -19991,7 +22147,7 @@ raylib.ICON_229 = 229 raylib.ICON_230 = 230 /** - * + * * * @type {number} * @constant @@ -19999,7 +22155,7 @@ raylib.ICON_230 = 230 raylib.ICON_231 = 231 /** - * + * * * @type {number} * @constant @@ -20007,7 +22163,7 @@ raylib.ICON_231 = 231 raylib.ICON_232 = 232 /** - * + * * * @type {number} * @constant @@ -20015,7 +22171,7 @@ raylib.ICON_232 = 232 raylib.ICON_233 = 233 /** - * + * * * @type {number} * @constant @@ -20023,7 +22179,7 @@ raylib.ICON_233 = 233 raylib.ICON_234 = 234 /** - * + * * * @type {number} * @constant @@ -20031,7 +22187,7 @@ raylib.ICON_234 = 234 raylib.ICON_235 = 235 /** - * + * * * @type {number} * @constant @@ -20039,7 +22195,7 @@ raylib.ICON_235 = 235 raylib.ICON_236 = 236 /** - * + * * * @type {number} * @constant @@ -20047,7 +22203,7 @@ raylib.ICON_236 = 236 raylib.ICON_237 = 237 /** - * + * * * @type {number} * @constant @@ -20055,7 +22211,7 @@ raylib.ICON_237 = 237 raylib.ICON_238 = 238 /** - * + * * * @type {number} * @constant @@ -20063,7 +22219,7 @@ raylib.ICON_238 = 238 raylib.ICON_239 = 239 /** - * + * * * @type {number} * @constant @@ -20071,7 +22227,7 @@ raylib.ICON_239 = 239 raylib.ICON_240 = 240 /** - * + * * * @type {number} * @constant @@ -20079,7 +22235,7 @@ raylib.ICON_240 = 240 raylib.ICON_241 = 241 /** - * + * * * @type {number} * @constant @@ -20087,7 +22243,7 @@ raylib.ICON_241 = 241 raylib.ICON_242 = 242 /** - * + * * * @type {number} * @constant @@ -20095,7 +22251,7 @@ raylib.ICON_242 = 242 raylib.ICON_243 = 243 /** - * + * * * @type {number} * @constant @@ -20103,7 +22259,7 @@ raylib.ICON_243 = 243 raylib.ICON_244 = 244 /** - * + * * * @type {number} * @constant @@ -20111,7 +22267,7 @@ raylib.ICON_244 = 244 raylib.ICON_245 = 245 /** - * + * * * @type {number} * @constant @@ -20119,7 +22275,7 @@ raylib.ICON_245 = 245 raylib.ICON_246 = 246 /** - * + * * * @type {number} * @constant @@ -20127,7 +22283,7 @@ raylib.ICON_246 = 246 raylib.ICON_247 = 247 /** - * + * * * @type {number} * @constant @@ -20135,7 +22291,7 @@ raylib.ICON_247 = 247 raylib.ICON_248 = 248 /** - * + * * * @type {number} * @constant @@ -20143,7 +22299,7 @@ raylib.ICON_248 = 248 raylib.ICON_249 = 249 /** - * + * * * @type {number} * @constant @@ -20151,7 +22307,7 @@ raylib.ICON_249 = 249 raylib.ICON_250 = 250 /** - * + * * * @type {number} * @constant @@ -20159,7 +22315,7 @@ raylib.ICON_250 = 250 raylib.ICON_251 = 251 /** - * + * * * @type {number} * @constant @@ -20167,7 +22323,7 @@ raylib.ICON_251 = 251 raylib.ICON_252 = 252 /** - * + * * * @type {number} * @constant @@ -20175,7 +22331,7 @@ raylib.ICON_252 = 252 raylib.ICON_253 = 253 /** - * + * * * @type {number} * @constant @@ -20183,7 +22339,7 @@ raylib.ICON_253 = 253 raylib.ICON_254 = 254 /** - * + * * * @type {number} * @constant @@ -20230,6 +22386,14 @@ raylib.RL_OPENGL_43 = 4 */ raylib.RL_OPENGL_ES_20 = 5 +/** + * OpenGL ES 3.0 (GLSL 300 es) + * + * @type {number} + * @constant + */ +raylib.RL_OPENGL_ES_30 = 6 + /** * Display all logs * @@ -20374,13 +22538,37 @@ raylib.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 */ raylib.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 +/** + * 16 bpp (1 channel - half float) + * + * @type {number} + * @constant + */ +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R16 = 11 + +/** + * 16*3 bpp (3 channels - half float) + * + * @type {number} + * @constant + */ +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12 + +/** + * 16*4 bpp (4 channels - half float) + * + * @type {number} + * @constant + */ +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13 + /** * 4 bpp (no alpha) * * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 14 /** * 4 bpp (1 bit alpha) @@ -20388,7 +22576,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15 /** * 8 bpp @@ -20396,7 +22584,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16 /** * 8 bpp @@ -20404,7 +22592,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17 /** * 4 bpp @@ -20412,7 +22600,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 18 /** * 4 bpp @@ -20420,7 +22608,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 19 /** * 8 bpp @@ -20428,7 +22616,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20 /** * 4 bpp @@ -20436,7 +22624,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 +raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 21 /** * 4 bpp @@ -20444,7 +22632,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 +raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22 /** * 8 bpp @@ -20452,7 +22640,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 +raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23 /** * 2 bpp @@ -20460,7 +22648,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 +raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24 /** * No filter, just pixel approximation @@ -20846,13 +23034,45 @@ raylib.RL_SHADER_UNIFORM_IVEC3 = 6 */ raylib.RL_SHADER_UNIFORM_IVEC4 = 7 +/** + * Shader uniform type: unsigned int + * + * @type {number} + * @constant + */ +raylib.RL_SHADER_UNIFORM_UINT = 8 + +/** + * Shader uniform type: uivec2 (2 unsigned int) + * + * @type {number} + * @constant + */ +raylib.RL_SHADER_UNIFORM_UIVEC2 = 9 + +/** + * Shader uniform type: uivec3 (3 unsigned int) + * + * @type {number} + * @constant + */ +raylib.RL_SHADER_UNIFORM_UIVEC3 = 10 + +/** + * Shader uniform type: uivec4 (4 unsigned int) + * + * @type {number} + * @constant + */ +raylib.RL_SHADER_UNIFORM_UIVEC4 = 11 + /** * Shader uniform type: sampler2d * * @type {number} * @constant */ -raylib.RL_SHADER_UNIFORM_SAMPLER2D = 8 +raylib.RL_SHADER_UNIFORM_SAMPLER2D = 12 /** * Shader attribute type: float @@ -21031,7 +23251,7 @@ raylib.RL_ATTACHMENT_TEXTURE2D = 100 raylib.RL_ATTACHMENT_RENDERBUFFER = 200 /** - * + * * * @type {number} * @constant @@ -21039,7 +23259,7 @@ raylib.RL_ATTACHMENT_RENDERBUFFER = 200 raylib.RL_CULL_FACE_FRONT = 0 /** - * + * * * @type {number} * @constant @@ -21047,7 +23267,7 @@ raylib.RL_CULL_FACE_FRONT = 0 raylib.RL_CULL_FACE_BACK = 1 /** - * + * * * @type {number} * @constant @@ -21606,6 +23826,94 @@ raylib.RL_BLEND_SRC_ALPHA = 32971 */ raylib.RL_BLEND_COLOR = 32773 +/** + * GL_READ_FRAMEBUFFER + * + * @type {number} + * @constant + */ +raylib.RL_READ_FRAMEBUFFER = 36008 + +/** + * GL_DRAW_FRAMEBUFFER + * + * @type {number} + * @constant + */ +raylib.RL_DRAW_FRAMEBUFFER = 36009 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR = 3 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT = 4 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 = 5 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES = 6 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS = 7 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS = 8 + raylib.LIGHTGRAY = { r: 200, g: 200, b: 200, a: 255 } raylib.GRAY = { r: 130, g: 130, b: 130, a: 255 } raylib.DARKGRAY = { r: 80, g: 80, b: 80, a: 255 } diff --git a/src/generated/node-raylib.cc b/src/generated/node-raylib.cc index b0ea9d3..4866eb4 100644 --- a/src/generated/node-raylib.cc +++ b/src/generated/node-raylib.cc @@ -90,14 +90,14 @@ inline rlVertexBuffer rlVertexBufferFromValue(const Napi::CallbackInfo& info, in intFromValue(info, index + 0), (float *) pointerFromValue(info, index + 1), (float *) pointerFromValue(info, index + 2), - (unsigned char *) pointerFromValue(info, index + 3), + (float *) pointerFromValue(info, index + 3), #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) - (unsigned int *) pointerFromValue(info, index + 4), // Vertex indices (in case vertex data comes indexed) (6 indices per quad) + (unsigned char*) pointerFromValue(info, index + 4), // Vertex indices (in case vertex data comes indexed) (6 indices per quad) #endif #if defined(GRAPHICS_API_OPENGL_ES2) (unsigned short *) pointerFromValue(info, index + 4), // Vertex indices (in case vertex data comes indexed) (6 indices per quad) - #endif - unsignedintFromValue(info, index + 5), + #endif + (unsigned int*) pointerFromValue(info, index + 5), (unsigned int) pointerFromValue(info, index + 6) }; } @@ -261,8 +261,10 @@ inline Mesh MeshFromValue(const Napi::CallbackInfo& info, int index) { (float *) pointerFromValue(info, index + 10), (unsigned char *) pointerFromValue(info, index + 11), (float *) pointerFromValue(info, index + 12), - unsignedintFromValue(info, index + 13), - (unsigned int *) pointerFromValue(info, index + 14) + (Matrix *) pointerFromValue(info, index + 13), + intFromValue(info, index + 14), + unsignedintFromValue(info, index + 15), + (unsigned int *) pointerFromValue(info, index + 16) }; } @@ -310,15 +312,6 @@ inline Model ModelFromValue(const Napi::CallbackInfo& info, int index) { }; } -inline ModelAnimation ModelAnimationFromValue(const Napi::CallbackInfo& info, int index) { - return { - intFromValue(info, index + 0), - intFromValue(info, index + 1), - (BoneInfo *) pointerFromValue(info, index + 2), - (Transform **) pointerFromValue(info, index + 3) - }; -} - inline Ray RayFromValue(const Napi::CallbackInfo& info, int index) { return { Vector3FromValue(info, index + 0), @@ -387,6 +380,14 @@ inline FilePathList FilePathListFromValue(const Napi::CallbackInfo& info, int in }; } +inline AutomationEventList AutomationEventListFromValue(const Napi::CallbackInfo& info, int index) { + return { + unsignedintFromValue(info, index + 0), + unsignedintFromValue(info, index + 1), + (AutomationEvent *) pointerFromValue(info, index + 2) + }; +} + inline rlDrawCall rlDrawCallFromValue(const Napi::CallbackInfo& info, int index) { return { intFromValue(info, index + 0), @@ -565,6 +566,8 @@ inline Napi::Value ToValue(Napi::Env env, Mesh obj) { out.Set("animNormals", ToValue(env, obj.animNormals)); out.Set("boneIds", ToValue(env, obj.boneIds)); out.Set("boneWeights", ToValue(env, obj.boneWeights)); + out.Set("boneMatrices", ToValue(env, obj.boneMatrices)); + out.Set("boneCount", ToValue(env, obj.boneCount)); out.Set("vaoId", ToValue(env, obj.vaoId)); out.Set("vboId", ToValue(env, obj.vboId)); return out; @@ -620,6 +623,7 @@ inline Napi::Value ToValue(Napi::Env env, ModelAnimation obj) { out.Set("frameCount", ToValue(env, obj.frameCount)); out.Set("bones", ToValue(env, obj.bones)); out.Set("framePoses", ToValue(env, obj.framePoses)); + out.Set("name", ToValue(env, obj.name)); return out; } @@ -691,14 +695,31 @@ inline Napi::Value ToValue(Napi::Env env, FilePathList obj) { return out; } +inline Napi::Value ToValue(Napi::Env env, AutomationEvent obj) { + Napi::Object out = Napi::Object::New(env); + out.Set("frame", ToValue(env, obj.frame)); + out.Set("type", ToValue(env, obj.type)); + out.Set("params", ToValue(env, obj.params)); + return out; +} + +inline Napi::Value ToValue(Napi::Env env, AutomationEventList obj) { + Napi::Object out = Napi::Object::New(env); + out.Set("capacity", ToValue(env, obj.capacity)); + out.Set("count", ToValue(env, obj.count)); + out.Set("events", ToValue(env, obj.events)); + return out; +} + inline Napi::Value ToValue(Napi::Env env, rlVertexBuffer obj) { Napi::Object out = Napi::Object::New(env); out.Set("elementCount", ToValue(env, obj.elementCount)); out.Set("vertices", ToValue(env, obj.vertices)); out.Set("texcoords", ToValue(env, obj.texcoords)); - out.Set("colors", ToValue(env, obj.colors)); + out.Set("normals", ToValue(env, obj.normals)); out.Set("indices", ToValue(env, obj.indices)); out.Set("vaoId", ToValue(env, obj.vaoId)); + out.Set("vaoId", ToValue(env, obj.vaoId)); out.Set("vboId", ToValue(env, obj.vboId)); return out; } @@ -733,6 +754,25 @@ inline Camera CameraFromValue(const Napi::CallbackInfo& info, int index) { return Camera3DFromValue(info, index); } +inline AutomationEvent AutomationEventFromValue(const Napi::CallbackInfo &info, int index) +{ + return { + unsignedintFromValue(info, index + 0), + unsignedintFromValue(info, index + 1), + {intFromValue(info, index + 2), intFromValue(info, index + 3), intFromValue(info, index + 4), intFromValue(info, index + 5)}, + }; +} + +inline ModelAnimation ModelAnimationFromValue(const Napi::CallbackInfo& info, int index) { + return { + intFromValue(info, index + 0), + intFromValue(info, index + 1), + (BoneInfo *) pointerFromValue(info, index + 2), + (Transform **) pointerFromValue(info, index + 3), + charFromValue(info ,index+4) + }; +} + // Raylib API function bindings Napi::Value BindWindowShouldClose(const Napi::CallbackInfo& info) { @@ -943,6 +983,14 @@ Napi::Value BindGetClipboardText(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGetClipboardImage(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetClipboardImage( + + ) + ); +} + Napi::Value BindIsCursorHidden(const Napi::CallbackInfo& info) { return ToValue(info.Env(), IsCursorHidden( @@ -977,9 +1025,9 @@ Napi::Value BindLoadShaderFromMemory(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsShaderReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsShaderValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsShaderReady( + IsShaderValid( ShaderFromValue(info, 0) ) ); @@ -1003,27 +1051,22 @@ Napi::Value BindGetShaderLocationAttrib(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGetMouseRay(const Napi::CallbackInfo& info) { +Napi::Value BindGetScreenToWorldRay(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GetMouseRay( + GetScreenToWorldRay( Vector2FromValue(info, 0), Camera3DFromValue(info, 2) ) ); } -Napi::Value BindGetCameraMatrix(const Napi::CallbackInfo& info) { - return ToValue(info.Env(), - GetCameraMatrix( - Camera3DFromValue(info, 0) - ) - ); -} - -Napi::Value BindGetCameraMatrix2D(const Napi::CallbackInfo& info) { +Napi::Value BindGetScreenToWorldRayEx(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GetCameraMatrix2D( - Camera2DFromValue(info, 0) + GetScreenToWorldRayEx( + Vector2FromValue(info, 0), + Camera3DFromValue(info, 2), + intFromValue(info, 13), + intFromValue(info, 14) ) ); } @@ -1037,15 +1080,6 @@ Napi::Value BindGetWorldToScreen(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGetScreenToWorld2D(const Napi::CallbackInfo& info) { - return ToValue(info.Env(), - GetScreenToWorld2D( - Vector2FromValue(info, 0), - Camera2DFromValue(info, 2) - ) - ); -} - Napi::Value BindGetWorldToScreenEx(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetWorldToScreenEx( @@ -1066,10 +1100,27 @@ Napi::Value BindGetWorldToScreen2D(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGetFPS(const Napi::CallbackInfo& info) { +Napi::Value BindGetScreenToWorld2D(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GetFPS( - + GetScreenToWorld2D( + Vector2FromValue(info, 0), + Camera2DFromValue(info, 2) + ) + ); +} + +Napi::Value BindGetCameraMatrix(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetCameraMatrix( + Camera3DFromValue(info, 0) + ) + ); +} + +Napi::Value BindGetCameraMatrix2D(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetCameraMatrix2D( + Camera2DFromValue(info, 0) ) ); } @@ -1090,6 +1141,14 @@ Napi::Value BindGetTime(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGetFPS(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetFPS( + + ) + ); +} + Napi::Value BindGetRandomValue(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetRandomValue( @@ -1099,6 +1158,16 @@ Napi::Value BindGetRandomValue(const Napi::CallbackInfo& info) { ); } +Napi::Value BindLoadRandomSequence(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + LoadRandomSequence( + unsignedintFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2) + ) + ); +} + Napi::Value BindMemAlloc(const Napi::CallbackInfo& info) { return ToValue(info.Env(), MemAlloc( @@ -1120,7 +1189,7 @@ Napi::Value BindLoadFileData(const Napi::CallbackInfo& info) { return ToValue(info.Env(), LoadFileData( (const char *) stringFromValue(info, 0), - (unsigned int *) pointerFromValue(info, 1) + (int *) pointerFromValue(info, 1) ) ); } @@ -1130,7 +1199,7 @@ Napi::Value BindSaveFileData(const Napi::CallbackInfo& info) { SaveFileData( (const char *) stringFromValue(info, 0), (void *) pointerFromValue(info, 1), - unsignedintFromValue(info, 2) + intFromValue(info, 2) ) ); } @@ -1139,7 +1208,7 @@ Napi::Value BindExportDataAsCode(const Napi::CallbackInfo& info) { return ToValue(info.Env(), ExportDataAsCode( (const unsigned char *) pointerFromValue(info, 0), - unsignedintFromValue(info, 1), + intFromValue(info, 1), (const char *) stringFromValue(info, 2) ) ); @@ -1251,6 +1320,14 @@ Napi::Value BindGetApplicationDirectory(const Napi::CallbackInfo& info) { ); } +Napi::Value BindMakeDirectory(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MakeDirectory( + (const char *) stringFromValue(info, 0) + ) + ); +} + Napi::Value BindChangeDirectory(const Napi::CallbackInfo& info) { return ToValue(info.Env(), ChangeDirectory( @@ -1267,6 +1344,14 @@ Napi::Value BindIsPathFile(const Napi::CallbackInfo& info) { ); } +Napi::Value BindIsFileNameValid(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + IsFileNameValid( + (const char *) stringFromValue(info, 0) + ) + ); +} + Napi::Value BindLoadDirectoryFiles(const Napi::CallbackInfo& info) { return ToValue(info.Env(), LoadDirectoryFiles( @@ -1348,6 +1433,50 @@ Napi::Value BindDecodeDataBase64(const Napi::CallbackInfo& info) { ); } +Napi::Value BindComputeCRC32(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ComputeCRC32( + (unsigned char *) pointerFromValue(info, 0), + intFromValue(info, 1) + ) + ); +} + +Napi::Value BindComputeMD5(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ComputeMD5( + (unsigned char *) pointerFromValue(info, 0), + intFromValue(info, 1) + ) + ); +} + +Napi::Value BindComputeSHA1(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ComputeSHA1( + (unsigned char *) pointerFromValue(info, 0), + intFromValue(info, 1) + ) + ); +} + +Napi::Value BindLoadAutomationEventList(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + LoadAutomationEventList( + (const char *) stringFromValue(info, 0) + ) + ); +} + +Napi::Value BindExportAutomationEventList(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ExportAutomationEventList( + AutomationEventListFromValue(info, 0), + (const char *) stringFromValue(info, 3) + ) + ); +} + Napi::Value BindIsKeyPressed(const Napi::CallbackInfo& info) { return ToValue(info.Env(), IsKeyPressed( @@ -1356,6 +1485,14 @@ Napi::Value BindIsKeyPressed(const Napi::CallbackInfo& info) { ); } +Napi::Value BindIsKeyPressedRepeat(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + IsKeyPressedRepeat( + intFromValue(info, 0) + ) + ); +} + Napi::Value BindIsKeyDown(const Napi::CallbackInfo& info) { return ToValue(info.Env(), IsKeyDown( @@ -1604,7 +1741,7 @@ Napi::Value BindGetTouchPointCount(const Napi::CallbackInfo& info) { Napi::Value BindIsGestureDetected(const Napi::CallbackInfo& info) { return ToValue(info.Env(), IsGestureDetected( - intFromValue(info, 0) + unsignedintFromValue(info, 0) ) ); } @@ -1657,6 +1794,79 @@ Napi::Value BindGetGesturePinchAngle(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGetShapesTexture(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetShapesTexture( + + ) + ); +} + +Napi::Value BindGetShapesTextureRectangle(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetShapesTextureRectangle( + + ) + ); +} + +Napi::Value BindGetSplinePointLinear(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetSplinePointLinear( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + floatFromValue(info, 4) + ) + ); +} + +Napi::Value BindGetSplinePointBasis(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetSplinePointBasis( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + Vector2FromValue(info, 6), + floatFromValue(info, 8) + ) + ); +} + +Napi::Value BindGetSplinePointCatmullRom(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetSplinePointCatmullRom( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + Vector2FromValue(info, 6), + floatFromValue(info, 8) + ) + ); +} + +Napi::Value BindGetSplinePointBezierQuad(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetSplinePointBezierQuad( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + floatFromValue(info, 6) + ) + ); +} + +Napi::Value BindGetSplinePointBezierCubic(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetSplinePointBezierCubic( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + Vector2FromValue(info, 6), + floatFromValue(info, 8) + ) + ); +} + Napi::Value BindCheckCollisionRecs(const Napi::CallbackInfo& info) { return ToValue(info.Env(), CheckCollisionRecs( @@ -1687,6 +1897,17 @@ Napi::Value BindCheckCollisionCircleRec(const Napi::CallbackInfo& info) { ); } +Napi::Value BindCheckCollisionCircleLine(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + CheckCollisionCircleLine( + Vector2FromValue(info, 0), + floatFromValue(info, 2), + Vector2FromValue(info, 3), + Vector2FromValue(info, 5) + ) + ); +} + Napi::Value BindCheckCollisionPointRec(const Napi::CallbackInfo& info) { return ToValue(info.Env(), CheckCollisionPointRec( @@ -1717,11 +1938,22 @@ Napi::Value BindCheckCollisionPointTriangle(const Napi::CallbackInfo& info) { ); } +Napi::Value BindCheckCollisionPointLine(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + CheckCollisionPointLine( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + intFromValue(info, 6) + ) + ); +} + Napi::Value BindCheckCollisionPointPoly(const Napi::CallbackInfo& info) { return ToValue(info.Env(), CheckCollisionPointPoly( Vector2FromValue(info, 0), - (Vector2 *) pointerFromValue(info, 2), + (const Vector2 *) pointerFromValue(info, 2), intFromValue(info, 3) ) ); @@ -1739,17 +1971,6 @@ Napi::Value BindCheckCollisionLines(const Napi::CallbackInfo& info) { ); } -Napi::Value BindCheckCollisionPointLine(const Napi::CallbackInfo& info) { - return ToValue(info.Env(), - CheckCollisionPointLine( - Vector2FromValue(info, 0), - Vector2FromValue(info, 2), - Vector2FromValue(info, 4), - intFromValue(info, 6) - ) - ); -} - Napi::Value BindGetCollisionRec(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetCollisionRec( @@ -1788,12 +2009,23 @@ Napi::Value BindLoadImageAnim(const Napi::CallbackInfo& info) { ); } -Napi::Value BindLoadImageFromMemory(const Napi::CallbackInfo& info) { +Napi::Value BindLoadImageAnimFromMemory(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - LoadImageFromMemory( + LoadImageAnimFromMemory( (const char *) stringFromValue(info, 0), (const unsigned char *) pointerFromValue(info, 1), - intFromValue(info, 2) + intFromValue(info, 2), + (int *) pointerFromValue(info, 3) + ) + ); +} + +Napi::Value BindLoadImageFromMemory(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + LoadImageFromMemory( + (const char *) stringFromValue(info, 0), + (const unsigned char *) pointerFromValue(info, 1), + intFromValue(info, 2) ) ); } @@ -1814,9 +2046,9 @@ Napi::Value BindLoadImageFromScreen(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsImageReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsImageValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsImageReady( + IsImageValid( ImageFromValue(info, 0) ) ); @@ -1831,6 +2063,16 @@ Napi::Value BindExportImage(const Napi::CallbackInfo& info) { ); } +Napi::Value BindExportImageToMemory(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ExportImageToMemory( + ImageFromValue(info, 0), + (const char *) stringFromValue(info, 5), + (int *) pointerFromValue(info, 6) + ) + ); +} + Napi::Value BindExportImageAsCode(const Napi::CallbackInfo& info) { return ToValue(info.Env(), ExportImageAsCode( @@ -1850,31 +2092,33 @@ Napi::Value BindGenImageColor(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGenImageGradientV(const Napi::CallbackInfo& info) { +Napi::Value BindGenImageGradientLinear(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GenImageGradientV( + GenImageGradientLinear( intFromValue(info, 0), intFromValue(info, 1), - ColorFromValue(info, 2), - ColorFromValue(info, 6) + intFromValue(info, 2), + ColorFromValue(info, 3), + ColorFromValue(info, 7) ) ); } -Napi::Value BindGenImageGradientH(const Napi::CallbackInfo& info) { +Napi::Value BindGenImageGradientRadial(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GenImageGradientH( + GenImageGradientRadial( intFromValue(info, 0), intFromValue(info, 1), - ColorFromValue(info, 2), - ColorFromValue(info, 6) + floatFromValue(info, 2), + ColorFromValue(info, 3), + ColorFromValue(info, 7) ) ); } -Napi::Value BindGenImageGradientRadial(const Napi::CallbackInfo& info) { +Napi::Value BindGenImageGradientSquare(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GenImageGradientRadial( + GenImageGradientSquare( intFromValue(info, 0), intFromValue(info, 1), floatFromValue(info, 2), @@ -1956,6 +2200,15 @@ Napi::Value BindImageFromImage(const Napi::CallbackInfo& info) { ); } +Napi::Value BindImageFromChannel(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ImageFromChannel( + ImageFromValue(info, 0), + intFromValue(info, 5) + ) + ); +} + Napi::Value BindImageText(const Napi::CallbackInfo& info) { return ToValue(info.Env(), ImageText( @@ -2049,22 +2302,31 @@ Napi::Value BindLoadRenderTexture(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsTextureReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsTextureValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsTextureReady( + IsTextureValid( TextureFromValue(info, 0) ) ); } -Napi::Value BindIsRenderTextureReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsRenderTextureValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsRenderTextureReady( + IsRenderTextureValid( RenderTextureFromValue(info, 0) ) ); } +Napi::Value BindColorIsEqual(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ColorIsEqual( + ColorFromValue(info, 0), + ColorFromValue(info, 4) + ) + ); +} + Napi::Value BindFade(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Fade( @@ -2162,6 +2424,16 @@ Napi::Value BindColorAlphaBlend(const Napi::CallbackInfo& info) { ); } +Napi::Value BindColorLerp(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ColorLerp( + ColorFromValue(info, 0), + ColorFromValue(info, 4), + floatFromValue(info, 8) + ) + ); +} + Napi::Value BindGetColor(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetColor( @@ -2239,9 +2511,9 @@ Napi::Value BindLoadFontFromMemory(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsFontReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsFontValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsFontReady( + IsFontValid( FontFromValue(info, 0) ) ); @@ -2430,7 +2702,7 @@ Napi::Value BindTextSubtext(const Napi::CallbackInfo& info) { Napi::Value BindTextReplace(const Napi::CallbackInfo& info) { return ToValue(info.Env(), TextReplace( - (char *) pointerFromValue(info, 0), + (const char *) stringFromValue(info, 0), (const char *) stringFromValue(info, 1), (const char *) stringFromValue(info, 2) ) @@ -2500,6 +2772,22 @@ Napi::Value BindTextToPascal(const Napi::CallbackInfo& info) { ); } +Napi::Value BindTextToSnake(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + TextToSnake( + (const char *) stringFromValue(info, 0) + ) + ); +} + +Napi::Value BindTextToCamel(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + TextToCamel( + (const char *) stringFromValue(info, 0) + ) + ); +} + Napi::Value BindTextToInteger(const Napi::CallbackInfo& info) { return ToValue(info.Env(), TextToInteger( @@ -2508,6 +2796,14 @@ Napi::Value BindTextToInteger(const Napi::CallbackInfo& info) { ); } +Napi::Value BindTextToFloat(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + TextToFloat( + (const char *) stringFromValue(info, 0) + ) + ); +} + Napi::Value BindLoadModel(const Napi::CallbackInfo& info) { return ToValue(info.Env(), LoadModel( @@ -2524,9 +2820,9 @@ Napi::Value BindLoadModelFromMesh(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsModelReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsModelValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsModelReady( + IsModelValid( ModelFromValue(info, 0) ) ); @@ -2540,19 +2836,28 @@ Napi::Value BindGetModelBoundingBox(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGetMeshBoundingBox(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetMeshBoundingBox( + MeshFromValue(info, 0) + ) + ); +} + Napi::Value BindExportMesh(const Napi::CallbackInfo& info) { return ToValue(info.Env(), ExportMesh( MeshFromValue(info, 0), - (const char *) stringFromValue(info, 15) + (const char *) stringFromValue(info, 17) ) ); } -Napi::Value BindGetMeshBoundingBox(const Napi::CallbackInfo& info) { +Napi::Value BindExportMeshAsCode(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GetMeshBoundingBox( - MeshFromValue(info, 0) + ExportMeshAsCode( + MeshFromValue(info, 0), + (const char *) stringFromValue(info, 17) ) ); } @@ -2671,7 +2976,7 @@ Napi::Value BindLoadModelAnimations(const Napi::CallbackInfo& info) { return ToValue(info.Env(), LoadModelAnimations( (const char *) stringFromValue(info, 0), - (unsigned int *) pointerFromValue(info, 1) + (int *) pointerFromValue(info, 1) ) ); } @@ -2739,7 +3044,7 @@ Napi::Value BindGetRayCollisionMesh(const Napi::CallbackInfo& info) { GetRayCollisionMesh( RayFromValue(info, 0), MeshFromValue(info, 6), - MatrixFromValue(info, 21) + MatrixFromValue(info, 23) ) ); } @@ -2775,6 +3080,14 @@ Napi::Value BindIsAudioDeviceReady(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGetMasterVolume(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetMasterVolume( + + ) + ); +} + Napi::Value BindLoadWave(const Napi::CallbackInfo& info) { return ToValue(info.Env(), LoadWave( @@ -2793,9 +3106,9 @@ Napi::Value BindLoadWaveFromMemory(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsWaveReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsWaveValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsWaveReady( + IsWaveValid( WaveFromValue(info, 0) ) ); @@ -2817,9 +3130,17 @@ Napi::Value BindLoadSoundFromWave(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsSoundReady(const Napi::CallbackInfo& info) { +Napi::Value BindLoadSoundAlias(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + LoadSoundAlias( + SoundFromValue(info, 0) + ) + ); +} + +Napi::Value BindIsSoundValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsSoundReady( + IsSoundValid( SoundFromValue(info, 0) ) ); @@ -2885,9 +3206,9 @@ Napi::Value BindLoadMusicStreamFromMemory(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsMusicReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsMusicValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsMusicReady( + IsMusicValid( MusicFromValue(info, 0) ) ); @@ -2927,9 +3248,9 @@ Napi::Value BindLoadAudioStream(const Napi::CallbackInfo& info) { ); } -Napi::Value BindIsAudioStreamReady(const Napi::CallbackInfo& info) { +Napi::Value BindIsAudioStreamValid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - IsAudioStreamReady( + IsAudioStreamValid( AudioStreamFromValue(info, 0) ) ); @@ -3504,6 +3825,24 @@ Napi::Value BindVector2Reflect(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector2Min(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2Min( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2) + ) + ); +} + +Napi::Value BindVector2Max(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2Max( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2) + ) + ); +} + Napi::Value BindVector2Rotate(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector2Rotate( @@ -3560,6 +3899,16 @@ Napi::Value BindVector2Equals(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector2Refract(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2Refract( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + floatFromValue(info, 4) + ) + ); +} + Napi::Value BindVector3Zero(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector3Zero( @@ -3724,6 +4073,24 @@ Napi::Value BindVector3Normalize(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector3Project(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector3Project( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3) + ) + ); +} + +Napi::Value BindVector3Reject(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector3Reject( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3) + ) + ); +} + Napi::Value BindVector3Transform(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector3Transform( @@ -3752,6 +4119,16 @@ Napi::Value BindVector3RotateByAxisAngle(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector3MoveTowards(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector3MoveTowards( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3), + floatFromValue(info, 6) + ) + ); +} + Napi::Value BindVector3Lerp(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector3Lerp( @@ -3762,6 +4139,18 @@ Napi::Value BindVector3Lerp(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector3CubicHermite(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector3CubicHermite( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3), + Vector3FromValue(info, 6), + Vector3FromValue(info, 9), + floatFromValue(info, 12) + ) + ); +} + Napi::Value BindVector3Reflect(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector3Reflect( @@ -3857,183 +4246,376 @@ Napi::Value BindVector3Refract(const Napi::CallbackInfo& info) { ); } -Napi::Value BindMatrixDeterminant(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Zero(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixDeterminant( - MatrixFromValue(info, 0) + Vector4Zero( + ) ); } -Napi::Value BindMatrixTrace(const Napi::CallbackInfo& info) { +Napi::Value BindVector4One(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixTrace( - MatrixFromValue(info, 0) + Vector4One( + ) ); } -Napi::Value BindMatrixTranspose(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Add(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixTranspose( - MatrixFromValue(info, 0) + Vector4Add( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixInvert(const Napi::CallbackInfo& info) { +Napi::Value BindVector4AddValue(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixInvert( - MatrixFromValue(info, 0) + Vector4AddValue( + Vector4FromValue(info, 0), + floatFromValue(info, 4) ) ); } -Napi::Value BindMatrixIdentity(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Subtract(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixIdentity( - + Vector4Subtract( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixAdd(const Napi::CallbackInfo& info) { +Napi::Value BindVector4SubtractValue(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixAdd( - MatrixFromValue(info, 0), - MatrixFromValue(info, 16) + Vector4SubtractValue( + Vector4FromValue(info, 0), + floatFromValue(info, 4) ) ); } -Napi::Value BindMatrixSubtract(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Length(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixSubtract( - MatrixFromValue(info, 0), - MatrixFromValue(info, 16) + Vector4Length( + Vector4FromValue(info, 0) ) ); } -Napi::Value BindMatrixMultiply(const Napi::CallbackInfo& info) { +Napi::Value BindVector4LengthSqr(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixMultiply( - MatrixFromValue(info, 0), - MatrixFromValue(info, 16) + Vector4LengthSqr( + Vector4FromValue(info, 0) ) ); } -Napi::Value BindMatrixTranslate(const Napi::CallbackInfo& info) { +Napi::Value BindVector4DotProduct(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixTranslate( - floatFromValue(info, 0), - floatFromValue(info, 1), - floatFromValue(info, 2) + Vector4DotProduct( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixRotate(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Distance(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixRotate( - Vector3FromValue(info, 0), - floatFromValue(info, 3) + Vector4Distance( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixRotateX(const Napi::CallbackInfo& info) { +Napi::Value BindVector4DistanceSqr(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixRotateX( - floatFromValue(info, 0) + Vector4DistanceSqr( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixRotateY(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Scale(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixRotateY( - floatFromValue(info, 0) + Vector4Scale( + Vector4FromValue(info, 0), + floatFromValue(info, 4) ) ); } -Napi::Value BindMatrixRotateZ(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Multiply(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixRotateZ( - floatFromValue(info, 0) + Vector4Multiply( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixRotateXYZ(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Negate(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixRotateXYZ( - Vector3FromValue(info, 0) + Vector4Negate( + Vector4FromValue(info, 0) ) ); } -Napi::Value BindMatrixRotateZYX(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Divide(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixRotateZYX( - Vector3FromValue(info, 0) + Vector4Divide( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixScale(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Normalize(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixScale( - floatFromValue(info, 0), - floatFromValue(info, 1), - floatFromValue(info, 2) + Vector4Normalize( + Vector4FromValue(info, 0) ) ); } -Napi::Value BindMatrixFrustum(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Min(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixFrustum( - doubleFromValue(info, 0), - doubleFromValue(info, 1), - doubleFromValue(info, 2), - doubleFromValue(info, 3), - doubleFromValue(info, 4), - doubleFromValue(info, 5) + Vector4Min( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixPerspective(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Max(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixPerspective( - doubleFromValue(info, 0), - doubleFromValue(info, 1), - doubleFromValue(info, 2), - doubleFromValue(info, 3) + Vector4Max( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) ) ); } -Napi::Value BindMatrixOrtho(const Napi::CallbackInfo& info) { +Napi::Value BindVector4Lerp(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixOrtho( - doubleFromValue(info, 0), - doubleFromValue(info, 1), - doubleFromValue(info, 2), - doubleFromValue(info, 3), - doubleFromValue(info, 4), - doubleFromValue(info, 5) + Vector4Lerp( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4), + floatFromValue(info, 8) ) ); } -Napi::Value BindMatrixLookAt(const Napi::CallbackInfo& info) { +Napi::Value BindVector4MoveTowards(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixLookAt( - Vector3FromValue(info, 0), + Vector4MoveTowards( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4), + floatFromValue(info, 8) + ) + ); +} + +Napi::Value BindVector4Invert(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector4Invert( + Vector4FromValue(info, 0) + ) + ); +} + +Napi::Value BindVector4Equals(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector4Equals( + Vector4FromValue(info, 0), + Vector4FromValue(info, 4) + ) + ); +} + +Napi::Value BindMatrixDeterminant(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixDeterminant( + MatrixFromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixTrace(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixTrace( + MatrixFromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixTranspose(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixTranspose( + MatrixFromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixInvert(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixInvert( + MatrixFromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixIdentity(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixIdentity( + + ) + ); +} + +Napi::Value BindMatrixAdd(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixAdd( + MatrixFromValue(info, 0), + MatrixFromValue(info, 16) + ) + ); +} + +Napi::Value BindMatrixSubtract(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixSubtract( + MatrixFromValue(info, 0), + MatrixFromValue(info, 16) + ) + ); +} + +Napi::Value BindMatrixMultiply(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixMultiply( + MatrixFromValue(info, 0), + MatrixFromValue(info, 16) + ) + ); +} + +Napi::Value BindMatrixTranslate(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixTranslate( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2) + ) + ); +} + +Napi::Value BindMatrixRotate(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixRotate( + Vector3FromValue(info, 0), + floatFromValue(info, 3) + ) + ); +} + +Napi::Value BindMatrixRotateX(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixRotateX( + floatFromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixRotateY(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixRotateY( + floatFromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixRotateZ(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixRotateZ( + floatFromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixRotateXYZ(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixRotateXYZ( + Vector3FromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixRotateZYX(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixRotateZYX( + Vector3FromValue(info, 0) + ) + ); +} + +Napi::Value BindMatrixScale(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixScale( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2) + ) + ); +} + +Napi::Value BindMatrixFrustum(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixFrustum( + doubleFromValue(info, 0), + doubleFromValue(info, 1), + doubleFromValue(info, 2), + doubleFromValue(info, 3), + doubleFromValue(info, 4), + doubleFromValue(info, 5) + ) + ); +} + +Napi::Value BindMatrixPerspective(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixPerspective( + doubleFromValue(info, 0), + doubleFromValue(info, 1), + doubleFromValue(info, 2), + doubleFromValue(info, 3) + ) + ); +} + +Napi::Value BindMatrixOrtho(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixOrtho( + doubleFromValue(info, 0), + doubleFromValue(info, 1), + doubleFromValue(info, 2), + doubleFromValue(info, 3), + doubleFromValue(info, 4), + doubleFromValue(info, 5) + ) + ); +} + +Napi::Value BindMatrixLookAt(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + MatrixLookAt( + Vector3FromValue(info, 0), Vector3FromValue(info, 3), Vector3FromValue(info, 6) ) @@ -4165,6 +4747,18 @@ Napi::Value BindQuaternionSlerp(const Napi::CallbackInfo& info) { ); } +Napi::Value BindQuaternionCubicHermiteSpline(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + QuaternionCubicHermiteSpline( + Vector4FromValue(info, 0), + Vector4FromValue(info, 1), + Vector4FromValue(info, 2), + Vector4FromValue(info, 3), + floatFromValue(info, 4) + ) + ); +} + Napi::Value BindQuaternionFromVector3ToVector3(const Napi::CallbackInfo& info) { return ToValue(info.Env(), QuaternionFromVector3ToVector3( @@ -4268,6 +4862,32 @@ Napi::Value BindGuiGetStyle(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGuiIconText(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiIconText( + intFromValue(info, 0), + (const char *) stringFromValue(info, 1) + ) + ); +} + +Napi::Value BindGuiGetIcons(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiGetIcons( + + ) + ); +} + +Napi::Value BindGuiLoadIcons(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiLoadIcons( + (const char *) stringFromValue(info, 0), + boolFromValue(info, 1) + ) + ); +} + Napi::Value BindGuiWindowBox(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiWindowBox( @@ -4277,6 +4897,33 @@ Napi::Value BindGuiWindowBox(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGuiGroupBox(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiGroupBox( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4) + ) + ); +} + +Napi::Value BindGuiLine(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiLine( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4) + ) + ); +} + +Napi::Value BindGuiPanel(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiPanel( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4) + ) + ); +} + Napi::Value BindGuiTabBar(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiTabBar( @@ -4294,7 +4941,17 @@ Napi::Value BindGuiScrollPanel(const Napi::CallbackInfo& info) { RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), RectangleFromValue(info, 5), - (Vector2 *) pointerFromValue(info, 9) + (Vector2 *) pointerFromValue(info, 9), + (Rectangle *) pointerFromValue(info, 10) + ) + ); +} + +Napi::Value BindGuiLabel(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiLabel( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4) ) ); } @@ -4322,7 +4979,7 @@ Napi::Value BindGuiToggle(const Napi::CallbackInfo& info) { GuiToggle( RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), - boolFromValue(info, 5) + (bool *) pointerFromValue(info, 5) ) ); } @@ -4332,7 +4989,17 @@ Napi::Value BindGuiToggleGroup(const Napi::CallbackInfo& info) { GuiToggleGroup( RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), - intFromValue(info, 5) + (int *) pointerFromValue(info, 5) + ) + ); +} + +Napi::Value BindGuiToggleSlider(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiToggleSlider( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4), + (int *) pointerFromValue(info, 5) ) ); } @@ -4342,7 +5009,7 @@ Napi::Value BindGuiCheckBox(const Napi::CallbackInfo& info) { GuiCheckBox( RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), - boolFromValue(info, 5) + (bool *) pointerFromValue(info, 5) ) ); } @@ -4352,7 +5019,7 @@ Napi::Value BindGuiComboBox(const Napi::CallbackInfo& info) { GuiComboBox( RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), - intFromValue(info, 5) + (int *) pointerFromValue(info, 5) ) ); } @@ -4394,20 +5061,21 @@ Napi::Value BindGuiValueBox(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGuiTextBox(const Napi::CallbackInfo& info) { +Napi::Value BindGuiValueBoxFloat(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GuiTextBox( + GuiValueBoxFloat( RectangleFromValue(info, 0), - (char *) pointerFromValue(info, 4), - intFromValue(info, 5), - boolFromValue(info, 6) + (const char *) stringFromValue(info, 4), + (char *) pointerFromValue(info, 5), + (float *) pointerFromValue(info, 6), + boolFromValue(info, 7) ) ); } -Napi::Value BindGuiTextBoxMulti(const Napi::CallbackInfo& info) { +Napi::Value BindGuiTextBox(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GuiTextBoxMulti( + GuiTextBox( RectangleFromValue(info, 0), (char *) pointerFromValue(info, 4), intFromValue(info, 5), @@ -4422,7 +5090,7 @@ Napi::Value BindGuiSlider(const Napi::CallbackInfo& info) { RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), (const char *) stringFromValue(info, 5), - floatFromValue(info, 6), + (float *) pointerFromValue(info, 6), floatFromValue(info, 7), floatFromValue(info, 8) ) @@ -4435,22 +5103,40 @@ Napi::Value BindGuiSliderBar(const Napi::CallbackInfo& info) { RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), (const char *) stringFromValue(info, 5), - floatFromValue(info, 6), + (float *) pointerFromValue(info, 6), + floatFromValue(info, 7), + floatFromValue(info, 8) + ) + ); +} + +Napi::Value BindGuiProgressBar(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiProgressBar( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4), + (const char *) stringFromValue(info, 5), + (float *) pointerFromValue(info, 6), floatFromValue(info, 7), floatFromValue(info, 8) ) ); } -Napi::Value BindGuiProgressBar(const Napi::CallbackInfo& info) { +Napi::Value BindGuiStatusBar(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GuiStatusBar( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4) + ) + ); +} + +Napi::Value BindGuiDummyRec(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GuiProgressBar( + GuiDummyRec( RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4), - (const char *) stringFromValue(info, 5), - floatFromValue(info, 6), - floatFromValue(info, 7), - floatFromValue(info, 8) + (const char *) stringFromValue(info, 4) ) ); } @@ -4461,7 +5147,8 @@ Napi::Value BindGuiGrid(const Napi::CallbackInfo& info) { RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), floatFromValue(info, 5), - intFromValue(info, 6) + intFromValue(info, 6), + (Vector2 *) pointerFromValue(info, 7) ) ); } @@ -4472,7 +5159,7 @@ Napi::Value BindGuiListView(const Napi::CallbackInfo& info) { RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), (int *) pointerFromValue(info, 5), - intFromValue(info, 6) + (int *) pointerFromValue(info, 6) ) ); } @@ -4485,7 +5172,7 @@ Napi::Value BindGuiListViewEx(const Napi::CallbackInfo& info) { intFromValue(info, 5), (int *) pointerFromValue(info, 6), (int *) pointerFromValue(info, 7), - intFromValue(info, 8) + (int *) pointerFromValue(info, 8) ) ); } @@ -4510,7 +5197,7 @@ Napi::Value BindGuiTextInputBox(const Napi::CallbackInfo& info) { (const char *) stringFromValue(info, 6), (char *) pointerFromValue(info, 7), intFromValue(info, 8), - (int *) pointerFromValue(info, 9) + (bool *) pointerFromValue(info, 9) ) ); } @@ -4520,7 +5207,7 @@ Napi::Value BindGuiColorPicker(const Napi::CallbackInfo& info) { GuiColorPicker( RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), - ColorFromValue(info, 5) + (Color *) pointerFromValue(info, 5) ) ); } @@ -4530,7 +5217,7 @@ Napi::Value BindGuiColorPanel(const Napi::CallbackInfo& info) { GuiColorPanel( RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), - ColorFromValue(info, 5) + (Color *) pointerFromValue(info, 5) ) ); } @@ -4540,7 +5227,7 @@ Napi::Value BindGuiColorBarAlpha(const Napi::CallbackInfo& info) { GuiColorBarAlpha( RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), - floatFromValue(info, 5) + (float *) pointerFromValue(info, 5) ) ); } @@ -4550,33 +5237,43 @@ Napi::Value BindGuiColorBarHue(const Napi::CallbackInfo& info) { GuiColorBarHue( RectangleFromValue(info, 0), (const char *) stringFromValue(info, 4), - floatFromValue(info, 5) + (float *) pointerFromValue(info, 5) ) ); } -Napi::Value BindGuiIconText(const Napi::CallbackInfo& info) { +Napi::Value BindGuiColorPickerHSV(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GuiIconText( - intFromValue(info, 0), - (const char *) stringFromValue(info, 1) + GuiColorPickerHSV( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4), + (Vector3 *) pointerFromValue(info, 5) ) ); } -Napi::Value BindGuiGetIcons(const Napi::CallbackInfo& info) { +Napi::Value BindGuiColorPanelHSV(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GuiGetIcons( + GuiColorPanelHSV( + RectangleFromValue(info, 0), + (const char *) stringFromValue(info, 4), + (Vector3 *) pointerFromValue(info, 5) + ) + ); +} + +Napi::Value BindrlGetCullDistanceNear(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetCullDistanceNear( ) ); } -Napi::Value BindGuiLoadIcons(const Napi::CallbackInfo& info) { +Napi::Value BindrlGetCullDistanceFar(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GuiLoadIcons( - (const char *) stringFromValue(info, 0), - boolFromValue(info, 1) + rlGetCullDistanceFar( + ) ); } @@ -4589,6 +5286,14 @@ Napi::Value BindrlEnableVertexArray(const Napi::CallbackInfo& info) { ); } +Napi::Value BindrlGetActiveFramebuffer(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetActiveFramebuffer( + + ) + ); +} + Napi::Value BindrlGetLineWidth(const Napi::CallbackInfo& info) { return ToValue(info.Env(), rlGetLineWidth( @@ -4725,7 +5430,8 @@ Napi::Value BindrlLoadTextureCubemap(const Napi::CallbackInfo& info) { rlLoadTextureCubemap( (const void *) pointerFromValue(info, 0), intFromValue(info, 1), - intFromValue(info, 2) + intFromValue(info, 2), + intFromValue(info, 3) ) ); } @@ -4761,8 +5467,7 @@ Napi::Value BindrlReadScreenPixels(const Napi::CallbackInfo& info) { Napi::Value BindrlLoadFramebuffer(const Napi::CallbackInfo& info) { return ToValue(info.Env(), rlLoadFramebuffer( - intFromValue(info, 0), - intFromValue(info, 1) + ) ); } @@ -4918,6 +5623,12 @@ void BindToggleFullscreen(const Napi::CallbackInfo& info) { ); } +void BindToggleBorderlessWindowed(const Napi::CallbackInfo& info) { + ToggleBorderlessWindowed( + + ); +} + void BindMaximizeWindow(const Napi::CallbackInfo& info) { MaximizeWindow( @@ -4975,6 +5686,13 @@ void BindSetWindowMinSize(const Napi::CallbackInfo& info) { ); } +void BindSetWindowMaxSize(const Napi::CallbackInfo& info) { + SetWindowMaxSize( + intFromValue(info, 0), + intFromValue(info, 1) + ); +} + void BindSetWindowSize(const Napi::CallbackInfo& info) { SetWindowSize( intFromValue(info, 0), @@ -4988,6 +5706,12 @@ void BindSetWindowOpacity(const Napi::CallbackInfo& info) { ); } +void BindSetWindowFocused(const Napi::CallbackInfo& info) { + SetWindowFocused( + + ); +} + void BindSetClipboardText(const Napi::CallbackInfo& info) { SetClipboardText( (const char *) stringFromValue(info, 0) @@ -5006,24 +5730,6 @@ void BindDisableEventWaiting(const Napi::CallbackInfo& info) { ); } -void BindSwapScreenBuffer(const Napi::CallbackInfo& info) { - SwapScreenBuffer( - - ); -} - -void BindPollInputEvents(const Napi::CallbackInfo& info) { - PollInputEvents( - - ); -} - -void BindWaitTime(const Napi::CallbackInfo& info) { - WaitTime( - doubleFromValue(info, 0) - ); -} - void BindShowCursor(const Napi::CallbackInfo& info) { ShowCursor( @@ -5175,12 +5881,36 @@ void BindSetTargetFPS(const Napi::CallbackInfo& info) { ); } +void BindSwapScreenBuffer(const Napi::CallbackInfo& info) { + SwapScreenBuffer( + + ); +} + +void BindPollInputEvents(const Napi::CallbackInfo& info) { + PollInputEvents( + + ); +} + +void BindWaitTime(const Napi::CallbackInfo& info) { + WaitTime( + doubleFromValue(info, 0) + ); +} + void BindSetRandomSeed(const Napi::CallbackInfo& info) { SetRandomSeed( unsignedintFromValue(info, 0) ); } +void BindUnloadRandomSequence(const Napi::CallbackInfo& info) { + UnloadRandomSequence( + (int *) pointerFromValue(info, 0) + ); +} + void BindTakeScreenshot(const Napi::CallbackInfo& info) { TakeScreenshot( (const char *) stringFromValue(info, 0) @@ -5193,6 +5923,12 @@ void BindSetConfigFlags(const Napi::CallbackInfo& info) { ); } +void BindOpenURL(const Napi::CallbackInfo& info) { + OpenURL( + (const char *) stringFromValue(info, 0) + ); +} + void BindSetTraceLogLevel(const Napi::CallbackInfo& info) { SetTraceLogLevel( intFromValue(info, 0) @@ -5205,12 +5941,6 @@ void BindMemFree(const Napi::CallbackInfo& info) { ); } -void BindOpenURL(const Napi::CallbackInfo& info) { - OpenURL( - (const char *) stringFromValue(info, 0) - ); -} - void BindUnloadFileData(const Napi::CallbackInfo& info) { UnloadFileData( (unsigned char *) pointerFromValue(info, 0) @@ -5235,12 +5965,57 @@ void BindUnloadDroppedFiles(const Napi::CallbackInfo& info) { ); } +void BindUnloadAutomationEventList(const Napi::CallbackInfo& info) { + UnloadAutomationEventList( + AutomationEventListFromValue(info, 0) + ); +} + +void BindSetAutomationEventList(const Napi::CallbackInfo& info) { + SetAutomationEventList( + (AutomationEventList *) pointerFromValue(info, 0) + ); +} + +void BindSetAutomationEventBaseFrame(const Napi::CallbackInfo& info) { + SetAutomationEventBaseFrame( + intFromValue(info, 0) + ); +} + +void BindStartAutomationEventRecording(const Napi::CallbackInfo& info) { + StartAutomationEventRecording( + + ); +} + +void BindStopAutomationEventRecording(const Napi::CallbackInfo& info) { + StopAutomationEventRecording( + + ); +} + +void BindPlayAutomationEvent(const Napi::CallbackInfo& info) { + PlayAutomationEvent( + AutomationEventFromValue(info, 0) + ); +} + void BindSetExitKey(const Napi::CallbackInfo& info) { SetExitKey( intFromValue(info, 0) ); } +void BindSetGamepadVibration(const Napi::CallbackInfo& info) { + SetGamepadVibration( + intFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2), + floatFromValue(info, 3) + ); +} + void BindSetMousePosition(const Napi::CallbackInfo& info) { SetMousePosition( intFromValue(info, 0), @@ -5332,6 +6107,14 @@ void BindDrawLineEx(const Napi::CallbackInfo& info) { ); } +void BindDrawLineStrip(const Napi::CallbackInfo& info) { + DrawLineStrip( + (const Vector2 *) pointerFromValue(info, 0), + intFromValue(info, 1), + ColorFromValue(info, 2) + ); +} + void BindDrawLineBezier(const Napi::CallbackInfo& info) { DrawLineBezier( Vector2FromValue(info, 0), @@ -5341,35 +6124,6 @@ void BindDrawLineBezier(const Napi::CallbackInfo& info) { ); } -void BindDrawLineBezierQuad(const Napi::CallbackInfo& info) { - DrawLineBezierQuad( - Vector2FromValue(info, 0), - Vector2FromValue(info, 2), - Vector2FromValue(info, 4), - floatFromValue(info, 6), - ColorFromValue(info, 7) - ); -} - -void BindDrawLineBezierCubic(const Napi::CallbackInfo& info) { - DrawLineBezierCubic( - Vector2FromValue(info, 0), - Vector2FromValue(info, 2), - Vector2FromValue(info, 4), - Vector2FromValue(info, 6), - floatFromValue(info, 8), - ColorFromValue(info, 9) - ); -} - -void BindDrawLineStrip(const Napi::CallbackInfo& info) { - DrawLineStrip( - (Vector2 *) pointerFromValue(info, 0), - intFromValue(info, 1), - ColorFromValue(info, 2) - ); -} - void BindDrawCircle(const Napi::CallbackInfo& info) { DrawCircle( intFromValue(info, 0), @@ -5428,6 +6182,14 @@ void BindDrawCircleLines(const Napi::CallbackInfo& info) { ); } +void BindDrawCircleLinesV(const Napi::CallbackInfo& info) { + DrawCircleLinesV( + Vector2FromValue(info, 0), + floatFromValue(info, 2), + ColorFromValue(info, 3) + ); +} + void BindDrawEllipse(const Napi::CallbackInfo& info) { DrawEllipse( intFromValue(info, 0), @@ -5567,6 +6329,15 @@ void BindDrawRectangleRounded(const Napi::CallbackInfo& info) { void BindDrawRectangleRoundedLines(const Napi::CallbackInfo& info) { DrawRectangleRoundedLines( + RectangleFromValue(info, 0), + floatFromValue(info, 4), + intFromValue(info, 5), + ColorFromValue(info, 6) + ); +} + +void BindDrawRectangleRoundedLinesEx(const Napi::CallbackInfo& info) { + DrawRectangleRoundedLinesEx( RectangleFromValue(info, 0), floatFromValue(info, 4), intFromValue(info, 5), @@ -5595,7 +6366,7 @@ void BindDrawTriangleLines(const Napi::CallbackInfo& info) { void BindDrawTriangleFan(const Napi::CallbackInfo& info) { DrawTriangleFan( - (Vector2 *) pointerFromValue(info, 0), + (const Vector2 *) pointerFromValue(info, 0), intFromValue(info, 1), ColorFromValue(info, 2) ); @@ -5603,40 +6374,137 @@ void BindDrawTriangleFan(const Napi::CallbackInfo& info) { void BindDrawTriangleStrip(const Napi::CallbackInfo& info) { DrawTriangleStrip( - (Vector2 *) pointerFromValue(info, 0), + (const Vector2 *) pointerFromValue(info, 0), intFromValue(info, 1), ColorFromValue(info, 2) ); } -void BindDrawPoly(const Napi::CallbackInfo& info) { - DrawPoly( +void BindDrawPoly(const Napi::CallbackInfo& info) { + DrawPoly( + Vector2FromValue(info, 0), + intFromValue(info, 2), + floatFromValue(info, 3), + floatFromValue(info, 4), + ColorFromValue(info, 5) + ); +} + +void BindDrawPolyLines(const Napi::CallbackInfo& info) { + DrawPolyLines( + Vector2FromValue(info, 0), + intFromValue(info, 2), + floatFromValue(info, 3), + floatFromValue(info, 4), + ColorFromValue(info, 5) + ); +} + +void BindDrawPolyLinesEx(const Napi::CallbackInfo& info) { + DrawPolyLinesEx( + Vector2FromValue(info, 0), + intFromValue(info, 2), + floatFromValue(info, 3), + floatFromValue(info, 4), + floatFromValue(info, 5), + ColorFromValue(info, 6) + ); +} + +void BindDrawSplineLinear(const Napi::CallbackInfo& info) { + DrawSplineLinear( + (const Vector2 *) pointerFromValue(info, 0), + intFromValue(info, 1), + floatFromValue(info, 2), + ColorFromValue(info, 3) + ); +} + +void BindDrawSplineBasis(const Napi::CallbackInfo& info) { + DrawSplineBasis( + (const Vector2 *) pointerFromValue(info, 0), + intFromValue(info, 1), + floatFromValue(info, 2), + ColorFromValue(info, 3) + ); +} + +void BindDrawSplineCatmullRom(const Napi::CallbackInfo& info) { + DrawSplineCatmullRom( + (const Vector2 *) pointerFromValue(info, 0), + intFromValue(info, 1), + floatFromValue(info, 2), + ColorFromValue(info, 3) + ); +} + +void BindDrawSplineBezierQuadratic(const Napi::CallbackInfo& info) { + DrawSplineBezierQuadratic( + (const Vector2 *) pointerFromValue(info, 0), + intFromValue(info, 1), + floatFromValue(info, 2), + ColorFromValue(info, 3) + ); +} + +void BindDrawSplineBezierCubic(const Napi::CallbackInfo& info) { + DrawSplineBezierCubic( + (const Vector2 *) pointerFromValue(info, 0), + intFromValue(info, 1), + floatFromValue(info, 2), + ColorFromValue(info, 3) + ); +} + +void BindDrawSplineSegmentLinear(const Napi::CallbackInfo& info) { + DrawSplineSegmentLinear( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + floatFromValue(info, 4), + ColorFromValue(info, 5) + ); +} + +void BindDrawSplineSegmentBasis(const Napi::CallbackInfo& info) { + DrawSplineSegmentBasis( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + Vector2FromValue(info, 6), + floatFromValue(info, 8), + ColorFromValue(info, 9) + ); +} + +void BindDrawSplineSegmentCatmullRom(const Napi::CallbackInfo& info) { + DrawSplineSegmentCatmullRom( Vector2FromValue(info, 0), - intFromValue(info, 2), - floatFromValue(info, 3), - floatFromValue(info, 4), - ColorFromValue(info, 5) + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + Vector2FromValue(info, 6), + floatFromValue(info, 8), + ColorFromValue(info, 9) ); } -void BindDrawPolyLines(const Napi::CallbackInfo& info) { - DrawPolyLines( +void BindDrawSplineSegmentBezierQuadratic(const Napi::CallbackInfo& info) { + DrawSplineSegmentBezierQuadratic( Vector2FromValue(info, 0), - intFromValue(info, 2), - floatFromValue(info, 3), - floatFromValue(info, 4), - ColorFromValue(info, 5) + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + floatFromValue(info, 6), + ColorFromValue(info, 7) ); } -void BindDrawPolyLinesEx(const Napi::CallbackInfo& info) { - DrawPolyLinesEx( +void BindDrawSplineSegmentBezierCubic(const Napi::CallbackInfo& info) { + DrawSplineSegmentBezierCubic( Vector2FromValue(info, 0), - intFromValue(info, 2), - floatFromValue(info, 3), - floatFromValue(info, 4), - floatFromValue(info, 5), - ColorFromValue(info, 6) + Vector2FromValue(info, 2), + Vector2FromValue(info, 4), + Vector2FromValue(info, 6), + floatFromValue(info, 8), + ColorFromValue(info, 9) ); } @@ -5653,6 +6521,21 @@ void BindImageBlurGaussian(const Napi::CallbackInfo& info) { ); } +void BindImageKernelConvolution(const Napi::CallbackInfo& info) { + ImageKernelConvolution( + (Image *) pointerFromValue(info, 0), + (const float *) pointerFromValue(info, 1), + intFromValue(info, 2) + ); +} + +void BindImageRotate(const Napi::CallbackInfo& info) { + ImageRotate( + (Image *) pointerFromValue(info, 0), + intFromValue(info, 1) + ); +} + void BindUnloadImageColors(const Napi::CallbackInfo& info) { UnloadImageColors( (Color *) pointerFromValue(info, 0) @@ -5665,6 +6548,16 @@ void BindUnloadImagePalette(const Napi::CallbackInfo& info) { ); } +void BindImageDrawLineEx(const Napi::CallbackInfo& info) { + ImageDrawLineEx( + (Image *) pointerFromValue(info, 0), + Vector2FromValue(info, 1), + Vector2FromValue(info, 3), + intFromValue(info, 5), + ColorFromValue(info, 6) + ); +} + void BindImageDrawCircleLines(const Napi::CallbackInfo& info) { ImageDrawCircleLines( (Image *) pointerFromValue(info, 0), @@ -5684,6 +6577,56 @@ void BindImageDrawCircleLinesV(const Napi::CallbackInfo& info) { ); } +void BindImageDrawTriangle(const Napi::CallbackInfo& info) { + ImageDrawTriangle( + (Image *) pointerFromValue(info, 0), + Vector2FromValue(info, 1), + Vector2FromValue(info, 3), + Vector2FromValue(info, 5), + ColorFromValue(info, 7) + ); +} + +void BindImageDrawTriangleEx(const Napi::CallbackInfo& info) { + ImageDrawTriangleEx( + (Image *) pointerFromValue(info, 0), + Vector2FromValue(info, 1), + Vector2FromValue(info, 3), + Vector2FromValue(info, 5), + ColorFromValue(info, 7), + ColorFromValue(info, 11), + ColorFromValue(info, 15) + ); +} + +void BindImageDrawTriangleLines(const Napi::CallbackInfo& info) { + ImageDrawTriangleLines( + (Image *) pointerFromValue(info, 0), + Vector2FromValue(info, 1), + Vector2FromValue(info, 3), + Vector2FromValue(info, 5), + ColorFromValue(info, 7) + ); +} + +void BindImageDrawTriangleFan(const Napi::CallbackInfo& info) { + ImageDrawTriangleFan( + (Image *) pointerFromValue(info, 0), + (Vector2 *) pointerFromValue(info, 1), + intFromValue(info, 2), + ColorFromValue(info, 3) + ); +} + +void BindImageDrawTriangleStrip(const Napi::CallbackInfo& info) { + ImageDrawTriangleStrip( + (Image *) pointerFromValue(info, 0), + (Vector2 *) pointerFromValue(info, 1), + intFromValue(info, 2), + ColorFromValue(info, 3) + ); +} + void BindUnloadTexture(const Napi::CallbackInfo& info) { UnloadTexture( TextureFromValue(info, 0) @@ -5867,6 +6810,12 @@ void BindDrawTextCodepoints(const Napi::CallbackInfo& info) { ); } +void BindSetTextLineSpacing(const Napi::CallbackInfo& info) { + SetTextLineSpacing( + intFromValue(info, 0) + ); +} + void BindUnloadUTF8(const Napi::CallbackInfo& info) { UnloadUTF8( (char *) pointerFromValue(info, 0) @@ -5923,7 +6872,7 @@ void BindDrawTriangle3D(const Napi::CallbackInfo& info) { void BindDrawTriangleStrip3D(const Napi::CallbackInfo& info) { DrawTriangleStrip3D( - (Vector3 *) pointerFromValue(info, 0), + (const Vector3 *) pointerFromValue(info, 0), intFromValue(info, 1), ColorFromValue(info, 2) ); @@ -6127,6 +7076,26 @@ void BindDrawModelWiresEx(const Napi::CallbackInfo& info) { ); } +void BindDrawModelPoints(const Napi::CallbackInfo& info) { + DrawModelPoints( + ModelFromValue(info, 0), + Vector3FromValue(info, 24), + floatFromValue(info, 27), + ColorFromValue(info, 28) + ); +} + +void BindDrawModelPointsEx(const Napi::CallbackInfo& info) { + DrawModelPointsEx( + ModelFromValue(info, 0), + Vector3FromValue(info, 24), + Vector3FromValue(info, 27), + floatFromValue(info, 30), + Vector3FromValue(info, 31), + ColorFromValue(info, 34) + ); +} + void BindDrawBoundingBox(const Napi::CallbackInfo& info) { DrawBoundingBox( BoundingBoxFromValue(info, 0), @@ -6172,10 +7141,10 @@ void BindDrawBillboardPro(const Napi::CallbackInfo& info) { void BindUpdateMeshBuffer(const Napi::CallbackInfo& info) { UpdateMeshBuffer( MeshFromValue(info, 0), - intFromValue(info, 15), - (const void *) pointerFromValue(info, 16), intFromValue(info, 17), - intFromValue(info, 18) + (const void *) pointerFromValue(info, 18), + intFromValue(info, 19), + intFromValue(info, 20) ); } @@ -6189,7 +7158,15 @@ void BindUpdateModelAnimation(const Napi::CallbackInfo& info) { UpdateModelAnimation( ModelFromValue(info, 0), ModelAnimationFromValue(info, 24), - intFromValue(info, 28) + intFromValue(info, 29) + ); +} + +void BindUpdateModelAnimationBones(const Napi::CallbackInfo& info) { + UpdateModelAnimationBones( + ModelFromValue(info, 0), + ModelAnimationFromValue(info, 24), + intFromValue(info, 29) ); } @@ -6202,7 +7179,7 @@ void BindUnloadModelAnimation(const Napi::CallbackInfo& info) { void BindUnloadModelAnimations(const Napi::CallbackInfo& info) { UnloadModelAnimations( (ModelAnimation *) pointerFromValue(info, 0), - unsignedintFromValue(info, 1) + intFromValue(info, 1) ); } @@ -6244,6 +7221,12 @@ void BindUnloadSound(const Napi::CallbackInfo& info) { ); } +void BindUnloadSoundAlias(const Napi::CallbackInfo& info) { + UnloadSoundAlias( + SoundFromValue(info, 0) + ); +} + void BindPlaySound(const Napi::CallbackInfo& info) { PlaySound( SoundFromValue(info, 0) @@ -6439,6 +7422,15 @@ void BindQuaternionToAxisAngle(const Napi::CallbackInfo& info) { ); } +void BindMatrixDecompose(const Napi::CallbackInfo& info) { + MatrixDecompose( + MatrixFromValue(info, 0), + (Vector3 *) pointerFromValue(info, 16), + (Quaternion *) pointerFromValue(info, 17), + (Vector3 *) pointerFromValue(info, 18) + ); +} + void BindGuiEnable(const Napi::CallbackInfo& info) { GuiEnable( @@ -6463,8 +7455,8 @@ void BindGuiUnlock(const Napi::CallbackInfo& info) { ); } -void BindGuiFade(const Napi::CallbackInfo& info) { - GuiFade( +void BindGuiSetAlpha(const Napi::CallbackInfo& info) { + GuiSetAlpha( floatFromValue(info, 0) ); } @@ -6489,48 +7481,6 @@ void BindGuiSetStyle(const Napi::CallbackInfo& info) { ); } -void BindGuiGroupBox(const Napi::CallbackInfo& info) { - GuiGroupBox( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) - ); -} - -void BindGuiLine(const Napi::CallbackInfo& info) { - GuiLine( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) - ); -} - -void BindGuiPanel(const Napi::CallbackInfo& info) { - GuiPanel( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) - ); -} - -void BindGuiLabel(const Napi::CallbackInfo& info) { - GuiLabel( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) - ); -} - -void BindGuiStatusBar(const Napi::CallbackInfo& info) { - GuiStatusBar( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) - ); -} - -void BindGuiDummyRec(const Napi::CallbackInfo& info) { - GuiDummyRec( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) - ); -} - void BindGuiLoadStyle(const Napi::CallbackInfo& info) { GuiLoadStyle( (const char *) stringFromValue(info, 0) @@ -6561,6 +7511,12 @@ void BindGuiSetTooltip(const Napi::CallbackInfo& info) { ); } +void BindGuiSetIconScale(const Napi::CallbackInfo& info) { + GuiSetIconScale( + intFromValue(info, 0) + ); +} + void BindGuiDrawIcon(const Napi::CallbackInfo& info) { GuiDrawIcon( intFromValue(info, 0), @@ -6571,12 +7527,6 @@ void BindGuiDrawIcon(const Napi::CallbackInfo& info) { ); } -void BindGuiSetIconScale(const Napi::CallbackInfo& info) { - GuiSetIconScale( - intFromValue(info, 0) - ); -} - void BindrlMatrixMode(const Napi::CallbackInfo& info) { rlMatrixMode( intFromValue(info, 0) @@ -6663,6 +7613,13 @@ void BindrlViewport(const Napi::CallbackInfo& info) { ); } +void BindrlSetClipPlanes(const Napi::CallbackInfo& info) { + rlSetClipPlanes( + doubleFromValue(info, 0), + doubleFromValue(info, 1) + ); +} + void BindrlBegin(const Napi::CallbackInfo& info) { rlBegin( intFromValue(info, 0) @@ -6856,6 +7813,27 @@ void BindrlActiveDrawBuffers(const Napi::CallbackInfo& info) { ); } +void BindrlBlitFramebuffer(const Napi::CallbackInfo& info) { + rlBlitFramebuffer( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3), + intFromValue(info, 4), + intFromValue(info, 5), + intFromValue(info, 6), + intFromValue(info, 7), + intFromValue(info, 8) + ); +} + +void BindrlBindFramebuffer(const Napi::CallbackInfo& info) { + rlBindFramebuffer( + unsignedintFromValue(info, 0), + unsignedintFromValue(info, 1) + ); +} + void BindrlEnableColorBlend(const Napi::CallbackInfo& info) { rlEnableColorBlend( @@ -6904,6 +7882,15 @@ void BindrlDisableBackfaceCulling(const Napi::CallbackInfo& info) { ); } +void BindrlColorMask(const Napi::CallbackInfo& info) { + rlColorMask( + boolFromValue(info, 0), + boolFromValue(info, 1), + boolFromValue(info, 2), + boolFromValue(info, 3) + ); +} + void BindrlSetCullFace(const Napi::CallbackInfo& info) { rlSetCullFace( intFromValue(info, 0) @@ -6937,6 +7924,12 @@ void BindrlEnableWireMode(const Napi::CallbackInfo& info) { ); } +void BindrlEnablePointMode(const Napi::CallbackInfo& info) { + rlEnablePointMode( + + ); +} + void BindrlDisableWireMode(const Napi::CallbackInfo& info) { rlDisableWireMode( @@ -7117,7 +8110,7 @@ void BindrlSetVertexAttribute(const Napi::CallbackInfo& info) { intFromValue(info, 2), boolFromValue(info, 3), intFromValue(info, 4), - (const void *) pointerFromValue(info, 5) + intFromValue(info, 5) ); } @@ -7244,6 +8237,14 @@ void BindrlSetUniformMatrix(const Napi::CallbackInfo& info) { ); } +void BindrlSetUniformMatrices(const Napi::CallbackInfo& info) { + rlSetUniformMatrices( + intFromValue(info, 0), + (const Matrix *) pointerFromValue(info, 1), + intFromValue(info, 2) + ); +} + void BindrlSetUniformSampler(const Napi::CallbackInfo& info) { rlSetUniformSampler( intFromValue(info, 0), @@ -7717,7 +8718,7 @@ Napi::Value BindGenTextureMipmaps(const Napi::CallbackInfo& info) { Napi::Value BindUploadMesh(const Napi::CallbackInfo& info) { Mesh obj = MeshFromValue(info, 0); UploadMesh( - &obj, boolFromValue(info, 15) + &obj, boolFromValue(info, 17) ); return ToValue(info.Env(), obj); } @@ -7819,8 +8820,8 @@ void BindSetShaderVec4(const Napi::CallbackInfo& info) { Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindInitWindow", Napi::Function::New(env, BindInitWindow)); - exports.Set("BindWindowShouldClose", Napi::Function::New(env, BindWindowShouldClose)); exports.Set("BindCloseWindow", Napi::Function::New(env, BindCloseWindow)); + exports.Set("BindWindowShouldClose", Napi::Function::New(env, BindWindowShouldClose)); exports.Set("BindIsWindowReady", Napi::Function::New(env, BindIsWindowReady)); exports.Set("BindIsWindowFullscreen", Napi::Function::New(env, BindIsWindowFullscreen)); exports.Set("BindIsWindowHidden", Napi::Function::New(env, BindIsWindowHidden)); @@ -7832,6 +8833,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindSetWindowState", Napi::Function::New(env, BindSetWindowState)); exports.Set("BindClearWindowState", Napi::Function::New(env, BindClearWindowState)); exports.Set("BindToggleFullscreen", Napi::Function::New(env, BindToggleFullscreen)); + exports.Set("BindToggleBorderlessWindowed", Napi::Function::New(env, BindToggleBorderlessWindowed)); exports.Set("BindMaximizeWindow", Napi::Function::New(env, BindMaximizeWindow)); exports.Set("BindMinimizeWindow", Napi::Function::New(env, BindMinimizeWindow)); exports.Set("BindRestoreWindow", Napi::Function::New(env, BindRestoreWindow)); @@ -7841,8 +8843,10 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindSetWindowPosition", Napi::Function::New(env, BindSetWindowPosition)); exports.Set("BindSetWindowMonitor", Napi::Function::New(env, BindSetWindowMonitor)); exports.Set("BindSetWindowMinSize", Napi::Function::New(env, BindSetWindowMinSize)); + exports.Set("BindSetWindowMaxSize", Napi::Function::New(env, BindSetWindowMaxSize)); exports.Set("BindSetWindowSize", Napi::Function::New(env, BindSetWindowSize)); exports.Set("BindSetWindowOpacity", Napi::Function::New(env, BindSetWindowOpacity)); + exports.Set("BindSetWindowFocused", Napi::Function::New(env, BindSetWindowFocused)); exports.Set("BindGetWindowHandle", Napi::Function::New(env, BindGetWindowHandle)); exports.Set("BindGetScreenWidth", Napi::Function::New(env, BindGetScreenWidth)); exports.Set("BindGetScreenHeight", Napi::Function::New(env, BindGetScreenHeight)); @@ -7861,11 +8865,9 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGetMonitorName", Napi::Function::New(env, BindGetMonitorName)); exports.Set("BindSetClipboardText", Napi::Function::New(env, BindSetClipboardText)); exports.Set("BindGetClipboardText", Napi::Function::New(env, BindGetClipboardText)); + exports.Set("BindGetClipboardImage", Napi::Function::New(env, BindGetClipboardImage)); exports.Set("BindEnableEventWaiting", Napi::Function::New(env, BindEnableEventWaiting)); exports.Set("BindDisableEventWaiting", Napi::Function::New(env, BindDisableEventWaiting)); - exports.Set("BindSwapScreenBuffer", Napi::Function::New(env, BindSwapScreenBuffer)); - exports.Set("BindPollInputEvents", Napi::Function::New(env, BindPollInputEvents)); - exports.Set("BindWaitTime", Napi::Function::New(env, BindWaitTime)); exports.Set("BindShowCursor", Napi::Function::New(env, BindShowCursor)); exports.Set("BindHideCursor", Napi::Function::New(env, BindHideCursor)); exports.Set("BindIsCursorHidden", Napi::Function::New(env, BindIsCursorHidden)); @@ -7890,32 +8892,38 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindEndVrStereoMode", Napi::Function::New(env, BindEndVrStereoMode)); exports.Set("BindLoadShader", Napi::Function::New(env, BindLoadShader)); exports.Set("BindLoadShaderFromMemory", Napi::Function::New(env, BindLoadShaderFromMemory)); - exports.Set("BindIsShaderReady", Napi::Function::New(env, BindIsShaderReady)); + exports.Set("BindIsShaderValid", Napi::Function::New(env, BindIsShaderValid)); exports.Set("BindGetShaderLocation", Napi::Function::New(env, BindGetShaderLocation)); exports.Set("BindGetShaderLocationAttrib", Napi::Function::New(env, BindGetShaderLocationAttrib)); exports.Set("BindSetShaderValueMatrix", Napi::Function::New(env, BindSetShaderValueMatrix)); exports.Set("BindSetShaderValueTexture", Napi::Function::New(env, BindSetShaderValueTexture)); exports.Set("BindUnloadShader", Napi::Function::New(env, BindUnloadShader)); - exports.Set("BindGetMouseRay", Napi::Function::New(env, BindGetMouseRay)); - exports.Set("BindGetCameraMatrix", Napi::Function::New(env, BindGetCameraMatrix)); - exports.Set("BindGetCameraMatrix2D", Napi::Function::New(env, BindGetCameraMatrix2D)); + exports.Set("BindGetScreenToWorldRay", Napi::Function::New(env, BindGetScreenToWorldRay)); + exports.Set("BindGetScreenToWorldRayEx", Napi::Function::New(env, BindGetScreenToWorldRayEx)); exports.Set("BindGetWorldToScreen", Napi::Function::New(env, BindGetWorldToScreen)); - exports.Set("BindGetScreenToWorld2D", Napi::Function::New(env, BindGetScreenToWorld2D)); exports.Set("BindGetWorldToScreenEx", Napi::Function::New(env, BindGetWorldToScreenEx)); exports.Set("BindGetWorldToScreen2D", Napi::Function::New(env, BindGetWorldToScreen2D)); + exports.Set("BindGetScreenToWorld2D", Napi::Function::New(env, BindGetScreenToWorld2D)); + exports.Set("BindGetCameraMatrix", Napi::Function::New(env, BindGetCameraMatrix)); + exports.Set("BindGetCameraMatrix2D", Napi::Function::New(env, BindGetCameraMatrix2D)); exports.Set("BindSetTargetFPS", Napi::Function::New(env, BindSetTargetFPS)); - exports.Set("BindGetFPS", Napi::Function::New(env, BindGetFPS)); exports.Set("BindGetFrameTime", Napi::Function::New(env, BindGetFrameTime)); exports.Set("BindGetTime", Napi::Function::New(env, BindGetTime)); - exports.Set("BindGetRandomValue", Napi::Function::New(env, BindGetRandomValue)); + exports.Set("BindGetFPS", Napi::Function::New(env, BindGetFPS)); + exports.Set("BindSwapScreenBuffer", Napi::Function::New(env, BindSwapScreenBuffer)); + exports.Set("BindPollInputEvents", Napi::Function::New(env, BindPollInputEvents)); + exports.Set("BindWaitTime", Napi::Function::New(env, BindWaitTime)); exports.Set("BindSetRandomSeed", Napi::Function::New(env, BindSetRandomSeed)); + exports.Set("BindGetRandomValue", Napi::Function::New(env, BindGetRandomValue)); + exports.Set("BindLoadRandomSequence", Napi::Function::New(env, BindLoadRandomSequence)); + exports.Set("BindUnloadRandomSequence", Napi::Function::New(env, BindUnloadRandomSequence)); exports.Set("BindTakeScreenshot", Napi::Function::New(env, BindTakeScreenshot)); exports.Set("BindSetConfigFlags", Napi::Function::New(env, BindSetConfigFlags)); + exports.Set("BindOpenURL", Napi::Function::New(env, BindOpenURL)); exports.Set("BindSetTraceLogLevel", Napi::Function::New(env, BindSetTraceLogLevel)); exports.Set("BindMemAlloc", Napi::Function::New(env, BindMemAlloc)); exports.Set("BindMemRealloc", Napi::Function::New(env, BindMemRealloc)); exports.Set("BindMemFree", Napi::Function::New(env, BindMemFree)); - exports.Set("BindOpenURL", Napi::Function::New(env, BindOpenURL)); exports.Set("BindLoadFileData", Napi::Function::New(env, BindLoadFileData)); exports.Set("BindUnloadFileData", Napi::Function::New(env, BindUnloadFileData)); exports.Set("BindSaveFileData", Napi::Function::New(env, BindSaveFileData)); @@ -7934,8 +8942,10 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGetPrevDirectoryPath", Napi::Function::New(env, BindGetPrevDirectoryPath)); exports.Set("BindGetWorkingDirectory", Napi::Function::New(env, BindGetWorkingDirectory)); exports.Set("BindGetApplicationDirectory", Napi::Function::New(env, BindGetApplicationDirectory)); + exports.Set("BindMakeDirectory", Napi::Function::New(env, BindMakeDirectory)); exports.Set("BindChangeDirectory", Napi::Function::New(env, BindChangeDirectory)); exports.Set("BindIsPathFile", Napi::Function::New(env, BindIsPathFile)); + exports.Set("BindIsFileNameValid", Napi::Function::New(env, BindIsFileNameValid)); exports.Set("BindLoadDirectoryFiles", Napi::Function::New(env, BindLoadDirectoryFiles)); exports.Set("BindLoadDirectoryFilesEx", Napi::Function::New(env, BindLoadDirectoryFilesEx)); exports.Set("BindUnloadDirectoryFiles", Napi::Function::New(env, BindUnloadDirectoryFiles)); @@ -7947,13 +8957,25 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindDecompressData", Napi::Function::New(env, BindDecompressData)); exports.Set("BindEncodeDataBase64", Napi::Function::New(env, BindEncodeDataBase64)); exports.Set("BindDecodeDataBase64", Napi::Function::New(env, BindDecodeDataBase64)); + exports.Set("BindComputeCRC32", Napi::Function::New(env, BindComputeCRC32)); + exports.Set("BindComputeMD5", Napi::Function::New(env, BindComputeMD5)); + exports.Set("BindComputeSHA1", Napi::Function::New(env, BindComputeSHA1)); + exports.Set("BindLoadAutomationEventList", Napi::Function::New(env, BindLoadAutomationEventList)); + exports.Set("BindUnloadAutomationEventList", Napi::Function::New(env, BindUnloadAutomationEventList)); + exports.Set("BindExportAutomationEventList", Napi::Function::New(env, BindExportAutomationEventList)); + exports.Set("BindSetAutomationEventList", Napi::Function::New(env, BindSetAutomationEventList)); + exports.Set("BindSetAutomationEventBaseFrame", Napi::Function::New(env, BindSetAutomationEventBaseFrame)); + exports.Set("BindStartAutomationEventRecording", Napi::Function::New(env, BindStartAutomationEventRecording)); + exports.Set("BindStopAutomationEventRecording", Napi::Function::New(env, BindStopAutomationEventRecording)); + exports.Set("BindPlayAutomationEvent", Napi::Function::New(env, BindPlayAutomationEvent)); exports.Set("BindIsKeyPressed", Napi::Function::New(env, BindIsKeyPressed)); + exports.Set("BindIsKeyPressedRepeat", Napi::Function::New(env, BindIsKeyPressedRepeat)); exports.Set("BindIsKeyDown", Napi::Function::New(env, BindIsKeyDown)); exports.Set("BindIsKeyReleased", Napi::Function::New(env, BindIsKeyReleased)); exports.Set("BindIsKeyUp", Napi::Function::New(env, BindIsKeyUp)); - exports.Set("BindSetExitKey", Napi::Function::New(env, BindSetExitKey)); exports.Set("BindGetKeyPressed", Napi::Function::New(env, BindGetKeyPressed)); exports.Set("BindGetCharPressed", Napi::Function::New(env, BindGetCharPressed)); + exports.Set("BindSetExitKey", Napi::Function::New(env, BindSetExitKey)); exports.Set("BindIsGamepadAvailable", Napi::Function::New(env, BindIsGamepadAvailable)); exports.Set("BindGetGamepadName", Napi::Function::New(env, BindGetGamepadName)); exports.Set("BindIsGamepadButtonPressed", Napi::Function::New(env, BindIsGamepadButtonPressed)); @@ -7964,6 +8986,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGetGamepadAxisCount", Napi::Function::New(env, BindGetGamepadAxisCount)); exports.Set("BindGetGamepadAxisMovement", Napi::Function::New(env, BindGetGamepadAxisMovement)); exports.Set("BindSetGamepadMappings", Napi::Function::New(env, BindSetGamepadMappings)); + exports.Set("BindSetGamepadVibration", Napi::Function::New(env, BindSetGamepadVibration)); exports.Set("BindIsMouseButtonPressed", Napi::Function::New(env, BindIsMouseButtonPressed)); exports.Set("BindIsMouseButtonDown", Napi::Function::New(env, BindIsMouseButtonDown)); exports.Set("BindIsMouseButtonReleased", Napi::Function::New(env, BindIsMouseButtonReleased)); @@ -7994,21 +9017,22 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindUpdateCamera", Napi::Function::New(env, BindUpdateCamera)); exports.Set("BindUpdateCameraPro", Napi::Function::New(env, BindUpdateCameraPro)); exports.Set("BindSetShapesTexture", Napi::Function::New(env, BindSetShapesTexture)); + exports.Set("BindGetShapesTexture", Napi::Function::New(env, BindGetShapesTexture)); + exports.Set("BindGetShapesTextureRectangle", Napi::Function::New(env, BindGetShapesTextureRectangle)); exports.Set("BindDrawPixel", Napi::Function::New(env, BindDrawPixel)); exports.Set("BindDrawPixelV", Napi::Function::New(env, BindDrawPixelV)); exports.Set("BindDrawLine", Napi::Function::New(env, BindDrawLine)); exports.Set("BindDrawLineV", Napi::Function::New(env, BindDrawLineV)); exports.Set("BindDrawLineEx", Napi::Function::New(env, BindDrawLineEx)); - exports.Set("BindDrawLineBezier", Napi::Function::New(env, BindDrawLineBezier)); - exports.Set("BindDrawLineBezierQuad", Napi::Function::New(env, BindDrawLineBezierQuad)); - exports.Set("BindDrawLineBezierCubic", Napi::Function::New(env, BindDrawLineBezierCubic)); exports.Set("BindDrawLineStrip", Napi::Function::New(env, BindDrawLineStrip)); + exports.Set("BindDrawLineBezier", Napi::Function::New(env, BindDrawLineBezier)); exports.Set("BindDrawCircle", Napi::Function::New(env, BindDrawCircle)); exports.Set("BindDrawCircleSector", Napi::Function::New(env, BindDrawCircleSector)); exports.Set("BindDrawCircleSectorLines", Napi::Function::New(env, BindDrawCircleSectorLines)); exports.Set("BindDrawCircleGradient", Napi::Function::New(env, BindDrawCircleGradient)); exports.Set("BindDrawCircleV", Napi::Function::New(env, BindDrawCircleV)); exports.Set("BindDrawCircleLines", Napi::Function::New(env, BindDrawCircleLines)); + exports.Set("BindDrawCircleLinesV", Napi::Function::New(env, BindDrawCircleLinesV)); exports.Set("BindDrawEllipse", Napi::Function::New(env, BindDrawEllipse)); exports.Set("BindDrawEllipseLines", Napi::Function::New(env, BindDrawEllipseLines)); exports.Set("BindDrawRing", Napi::Function::New(env, BindDrawRing)); @@ -8024,6 +9048,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindDrawRectangleLinesEx", Napi::Function::New(env, BindDrawRectangleLinesEx)); exports.Set("BindDrawRectangleRounded", Napi::Function::New(env, BindDrawRectangleRounded)); exports.Set("BindDrawRectangleRoundedLines", Napi::Function::New(env, BindDrawRectangleRoundedLines)); + exports.Set("BindDrawRectangleRoundedLinesEx", Napi::Function::New(env, BindDrawRectangleRoundedLinesEx)); exports.Set("BindDrawTriangle", Napi::Function::New(env, BindDrawTriangle)); exports.Set("BindDrawTriangleLines", Napi::Function::New(env, BindDrawTriangleLines)); exports.Set("BindDrawTriangleFan", Napi::Function::New(env, BindDrawTriangleFan)); @@ -8031,30 +9056,48 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindDrawPoly", Napi::Function::New(env, BindDrawPoly)); exports.Set("BindDrawPolyLines", Napi::Function::New(env, BindDrawPolyLines)); exports.Set("BindDrawPolyLinesEx", Napi::Function::New(env, BindDrawPolyLinesEx)); + exports.Set("BindDrawSplineLinear", Napi::Function::New(env, BindDrawSplineLinear)); + exports.Set("BindDrawSplineBasis", Napi::Function::New(env, BindDrawSplineBasis)); + exports.Set("BindDrawSplineCatmullRom", Napi::Function::New(env, BindDrawSplineCatmullRom)); + exports.Set("BindDrawSplineBezierQuadratic", Napi::Function::New(env, BindDrawSplineBezierQuadratic)); + exports.Set("BindDrawSplineBezierCubic", Napi::Function::New(env, BindDrawSplineBezierCubic)); + exports.Set("BindDrawSplineSegmentLinear", Napi::Function::New(env, BindDrawSplineSegmentLinear)); + exports.Set("BindDrawSplineSegmentBasis", Napi::Function::New(env, BindDrawSplineSegmentBasis)); + exports.Set("BindDrawSplineSegmentCatmullRom", Napi::Function::New(env, BindDrawSplineSegmentCatmullRom)); + exports.Set("BindDrawSplineSegmentBezierQuadratic", Napi::Function::New(env, BindDrawSplineSegmentBezierQuadratic)); + exports.Set("BindDrawSplineSegmentBezierCubic", Napi::Function::New(env, BindDrawSplineSegmentBezierCubic)); + exports.Set("BindGetSplinePointLinear", Napi::Function::New(env, BindGetSplinePointLinear)); + exports.Set("BindGetSplinePointBasis", Napi::Function::New(env, BindGetSplinePointBasis)); + exports.Set("BindGetSplinePointCatmullRom", Napi::Function::New(env, BindGetSplinePointCatmullRom)); + exports.Set("BindGetSplinePointBezierQuad", Napi::Function::New(env, BindGetSplinePointBezierQuad)); + exports.Set("BindGetSplinePointBezierCubic", Napi::Function::New(env, BindGetSplinePointBezierCubic)); exports.Set("BindCheckCollisionRecs", Napi::Function::New(env, BindCheckCollisionRecs)); exports.Set("BindCheckCollisionCircles", Napi::Function::New(env, BindCheckCollisionCircles)); exports.Set("BindCheckCollisionCircleRec", Napi::Function::New(env, BindCheckCollisionCircleRec)); + exports.Set("BindCheckCollisionCircleLine", Napi::Function::New(env, BindCheckCollisionCircleLine)); exports.Set("BindCheckCollisionPointRec", Napi::Function::New(env, BindCheckCollisionPointRec)); exports.Set("BindCheckCollisionPointCircle", Napi::Function::New(env, BindCheckCollisionPointCircle)); exports.Set("BindCheckCollisionPointTriangle", Napi::Function::New(env, BindCheckCollisionPointTriangle)); + exports.Set("BindCheckCollisionPointLine", Napi::Function::New(env, BindCheckCollisionPointLine)); exports.Set("BindCheckCollisionPointPoly", Napi::Function::New(env, BindCheckCollisionPointPoly)); exports.Set("BindCheckCollisionLines", Napi::Function::New(env, BindCheckCollisionLines)); - exports.Set("BindCheckCollisionPointLine", Napi::Function::New(env, BindCheckCollisionPointLine)); exports.Set("BindGetCollisionRec", Napi::Function::New(env, BindGetCollisionRec)); exports.Set("BindLoadImage", Napi::Function::New(env, BindLoadImage)); exports.Set("BindLoadImageRaw", Napi::Function::New(env, BindLoadImageRaw)); exports.Set("BindLoadImageAnim", Napi::Function::New(env, BindLoadImageAnim)); + exports.Set("BindLoadImageAnimFromMemory", Napi::Function::New(env, BindLoadImageAnimFromMemory)); exports.Set("BindLoadImageFromMemory", Napi::Function::New(env, BindLoadImageFromMemory)); exports.Set("BindLoadImageFromTexture", Napi::Function::New(env, BindLoadImageFromTexture)); exports.Set("BindLoadImageFromScreen", Napi::Function::New(env, BindLoadImageFromScreen)); - exports.Set("BindIsImageReady", Napi::Function::New(env, BindIsImageReady)); + exports.Set("BindIsImageValid", Napi::Function::New(env, BindIsImageValid)); exports.Set("BindUnloadImage", Napi::Function::New(env, BindUnloadImage)); exports.Set("BindExportImage", Napi::Function::New(env, BindExportImage)); + exports.Set("BindExportImageToMemory", Napi::Function::New(env, BindExportImageToMemory)); exports.Set("BindExportImageAsCode", Napi::Function::New(env, BindExportImageAsCode)); exports.Set("BindGenImageColor", Napi::Function::New(env, BindGenImageColor)); - exports.Set("BindGenImageGradientV", Napi::Function::New(env, BindGenImageGradientV)); - exports.Set("BindGenImageGradientH", Napi::Function::New(env, BindGenImageGradientH)); + exports.Set("BindGenImageGradientLinear", Napi::Function::New(env, BindGenImageGradientLinear)); exports.Set("BindGenImageGradientRadial", Napi::Function::New(env, BindGenImageGradientRadial)); + exports.Set("BindGenImageGradientSquare", Napi::Function::New(env, BindGenImageGradientSquare)); exports.Set("BindGenImageChecked", Napi::Function::New(env, BindGenImageChecked)); exports.Set("BindGenImageWhiteNoise", Napi::Function::New(env, BindGenImageWhiteNoise)); exports.Set("BindGenImagePerlinNoise", Napi::Function::New(env, BindGenImagePerlinNoise)); @@ -8062,6 +9105,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGenImageText", Napi::Function::New(env, BindGenImageText)); exports.Set("BindImageCopy", Napi::Function::New(env, BindImageCopy)); exports.Set("BindImageFromImage", Napi::Function::New(env, BindImageFromImage)); + exports.Set("BindImageFromChannel", Napi::Function::New(env, BindImageFromChannel)); exports.Set("BindImageText", Napi::Function::New(env, BindImageText)); exports.Set("BindImageTextEx", Napi::Function::New(env, BindImageTextEx)); exports.Set("BindImageFormat", Napi::Function::New(env, BindImageFormat)); @@ -8072,6 +9116,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindImageAlphaMask", Napi::Function::New(env, BindImageAlphaMask)); exports.Set("BindImageAlphaPremultiply", Napi::Function::New(env, BindImageAlphaPremultiply)); exports.Set("BindImageBlurGaussian", Napi::Function::New(env, BindImageBlurGaussian)); + exports.Set("BindImageKernelConvolution", Napi::Function::New(env, BindImageKernelConvolution)); exports.Set("BindImageResize", Napi::Function::New(env, BindImageResize)); exports.Set("BindImageResizeNN", Napi::Function::New(env, BindImageResizeNN)); exports.Set("BindImageResizeCanvas", Napi::Function::New(env, BindImageResizeCanvas)); @@ -8079,6 +9124,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindImageDither", Napi::Function::New(env, BindImageDither)); exports.Set("BindImageFlipVertical", Napi::Function::New(env, BindImageFlipVertical)); exports.Set("BindImageFlipHorizontal", Napi::Function::New(env, BindImageFlipHorizontal)); + exports.Set("BindImageRotate", Napi::Function::New(env, BindImageRotate)); exports.Set("BindImageRotateCW", Napi::Function::New(env, BindImageRotateCW)); exports.Set("BindImageRotateCCW", Napi::Function::New(env, BindImageRotateCCW)); exports.Set("BindImageColorTint", Napi::Function::New(env, BindImageColorTint)); @@ -8098,6 +9144,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindImageDrawPixelV", Napi::Function::New(env, BindImageDrawPixelV)); exports.Set("BindImageDrawLine", Napi::Function::New(env, BindImageDrawLine)); exports.Set("BindImageDrawLineV", Napi::Function::New(env, BindImageDrawLineV)); + exports.Set("BindImageDrawLineEx", Napi::Function::New(env, BindImageDrawLineEx)); exports.Set("BindImageDrawCircle", Napi::Function::New(env, BindImageDrawCircle)); exports.Set("BindImageDrawCircleV", Napi::Function::New(env, BindImageDrawCircleV)); exports.Set("BindImageDrawCircleLines", Napi::Function::New(env, BindImageDrawCircleLines)); @@ -8106,6 +9153,11 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindImageDrawRectangleV", Napi::Function::New(env, BindImageDrawRectangleV)); exports.Set("BindImageDrawRectangleRec", Napi::Function::New(env, BindImageDrawRectangleRec)); exports.Set("BindImageDrawRectangleLines", Napi::Function::New(env, BindImageDrawRectangleLines)); + exports.Set("BindImageDrawTriangle", Napi::Function::New(env, BindImageDrawTriangle)); + exports.Set("BindImageDrawTriangleEx", Napi::Function::New(env, BindImageDrawTriangleEx)); + exports.Set("BindImageDrawTriangleLines", Napi::Function::New(env, BindImageDrawTriangleLines)); + exports.Set("BindImageDrawTriangleFan", Napi::Function::New(env, BindImageDrawTriangleFan)); + exports.Set("BindImageDrawTriangleStrip", Napi::Function::New(env, BindImageDrawTriangleStrip)); exports.Set("BindImageDraw", Napi::Function::New(env, BindImageDraw)); exports.Set("BindImageDrawText", Napi::Function::New(env, BindImageDrawText)); exports.Set("BindImageDrawTextEx", Napi::Function::New(env, BindImageDrawTextEx)); @@ -8113,9 +9165,9 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindLoadTextureFromImage", Napi::Function::New(env, BindLoadTextureFromImage)); exports.Set("BindLoadTextureCubemap", Napi::Function::New(env, BindLoadTextureCubemap)); exports.Set("BindLoadRenderTexture", Napi::Function::New(env, BindLoadRenderTexture)); - exports.Set("BindIsTextureReady", Napi::Function::New(env, BindIsTextureReady)); + exports.Set("BindIsTextureValid", Napi::Function::New(env, BindIsTextureValid)); exports.Set("BindUnloadTexture", Napi::Function::New(env, BindUnloadTexture)); - exports.Set("BindIsRenderTextureReady", Napi::Function::New(env, BindIsRenderTextureReady)); + exports.Set("BindIsRenderTextureValid", Napi::Function::New(env, BindIsRenderTextureValid)); exports.Set("BindUnloadRenderTexture", Napi::Function::New(env, BindUnloadRenderTexture)); exports.Set("BindUpdateTexture", Napi::Function::New(env, BindUpdateTexture)); exports.Set("BindUpdateTextureRec", Napi::Function::New(env, BindUpdateTextureRec)); @@ -8128,6 +9180,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindDrawTextureRec", Napi::Function::New(env, BindDrawTextureRec)); exports.Set("BindDrawTexturePro", Napi::Function::New(env, BindDrawTexturePro)); exports.Set("BindDrawTextureNPatch", Napi::Function::New(env, BindDrawTextureNPatch)); + exports.Set("BindColorIsEqual", Napi::Function::New(env, BindColorIsEqual)); exports.Set("BindFade", Napi::Function::New(env, BindFade)); exports.Set("BindColorToInt", Napi::Function::New(env, BindColorToInt)); exports.Set("BindColorNormalize", Napi::Function::New(env, BindColorNormalize)); @@ -8139,6 +9192,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindColorContrast", Napi::Function::New(env, BindColorContrast)); exports.Set("BindColorAlpha", Napi::Function::New(env, BindColorAlpha)); exports.Set("BindColorAlphaBlend", Napi::Function::New(env, BindColorAlphaBlend)); + exports.Set("BindColorLerp", Napi::Function::New(env, BindColorLerp)); exports.Set("BindGetColor", Napi::Function::New(env, BindGetColor)); exports.Set("BindGetPixelColor", Napi::Function::New(env, BindGetPixelColor)); exports.Set("BindSetPixelColor", Napi::Function::New(env, BindSetPixelColor)); @@ -8148,7 +9202,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindLoadFontEx", Napi::Function::New(env, BindLoadFontEx)); exports.Set("BindLoadFontFromImage", Napi::Function::New(env, BindLoadFontFromImage)); exports.Set("BindLoadFontFromMemory", Napi::Function::New(env, BindLoadFontFromMemory)); - exports.Set("BindIsFontReady", Napi::Function::New(env, BindIsFontReady)); + exports.Set("BindIsFontValid", Napi::Function::New(env, BindIsFontValid)); exports.Set("BindLoadFontData", Napi::Function::New(env, BindLoadFontData)); exports.Set("BindGenImageFontAtlas", Napi::Function::New(env, BindGenImageFontAtlas)); exports.Set("BindUnloadFontData", Napi::Function::New(env, BindUnloadFontData)); @@ -8160,6 +9214,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindDrawTextPro", Napi::Function::New(env, BindDrawTextPro)); exports.Set("BindDrawTextCodepoint", Napi::Function::New(env, BindDrawTextCodepoint)); exports.Set("BindDrawTextCodepoints", Napi::Function::New(env, BindDrawTextCodepoints)); + exports.Set("BindSetTextLineSpacing", Napi::Function::New(env, BindSetTextLineSpacing)); exports.Set("BindMeasureText", Napi::Function::New(env, BindMeasureText)); exports.Set("BindMeasureTextEx", Napi::Function::New(env, BindMeasureTextEx)); exports.Set("BindGetGlyphIndex", Napi::Function::New(env, BindGetGlyphIndex)); @@ -8187,7 +9242,10 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindTextToUpper", Napi::Function::New(env, BindTextToUpper)); exports.Set("BindTextToLower", Napi::Function::New(env, BindTextToLower)); exports.Set("BindTextToPascal", Napi::Function::New(env, BindTextToPascal)); + exports.Set("BindTextToSnake", Napi::Function::New(env, BindTextToSnake)); + exports.Set("BindTextToCamel", Napi::Function::New(env, BindTextToCamel)); exports.Set("BindTextToInteger", Napi::Function::New(env, BindTextToInteger)); + exports.Set("BindTextToFloat", Napi::Function::New(env, BindTextToFloat)); exports.Set("BindDrawLine3D", Napi::Function::New(env, BindDrawLine3D)); exports.Set("BindDrawPoint3D", Napi::Function::New(env, BindDrawPoint3D)); exports.Set("BindDrawCircle3D", Napi::Function::New(env, BindDrawCircle3D)); @@ -8211,13 +9269,15 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindDrawGrid", Napi::Function::New(env, BindDrawGrid)); exports.Set("BindLoadModel", Napi::Function::New(env, BindLoadModel)); exports.Set("BindLoadModelFromMesh", Napi::Function::New(env, BindLoadModelFromMesh)); - exports.Set("BindIsModelReady", Napi::Function::New(env, BindIsModelReady)); + exports.Set("BindIsModelValid", Napi::Function::New(env, BindIsModelValid)); exports.Set("BindUnloadModel", Napi::Function::New(env, BindUnloadModel)); exports.Set("BindGetModelBoundingBox", Napi::Function::New(env, BindGetModelBoundingBox)); exports.Set("BindDrawModel", Napi::Function::New(env, BindDrawModel)); exports.Set("BindDrawModelEx", Napi::Function::New(env, BindDrawModelEx)); exports.Set("BindDrawModelWires", Napi::Function::New(env, BindDrawModelWires)); exports.Set("BindDrawModelWiresEx", Napi::Function::New(env, BindDrawModelWiresEx)); + exports.Set("BindDrawModelPoints", Napi::Function::New(env, BindDrawModelPoints)); + exports.Set("BindDrawModelPointsEx", Napi::Function::New(env, BindDrawModelPointsEx)); exports.Set("BindDrawBoundingBox", Napi::Function::New(env, BindDrawBoundingBox)); exports.Set("BindDrawBillboard", Napi::Function::New(env, BindDrawBillboard)); exports.Set("BindDrawBillboardRec", Napi::Function::New(env, BindDrawBillboardRec)); @@ -8225,9 +9285,10 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindUploadMesh", Napi::Function::New(env, BindUploadMesh)); exports.Set("BindUpdateMeshBuffer", Napi::Function::New(env, BindUpdateMeshBuffer)); exports.Set("BindUnloadMesh", Napi::Function::New(env, BindUnloadMesh)); - exports.Set("BindExportMesh", Napi::Function::New(env, BindExportMesh)); exports.Set("BindGetMeshBoundingBox", Napi::Function::New(env, BindGetMeshBoundingBox)); exports.Set("BindGenMeshTangents", Napi::Function::New(env, BindGenMeshTangents)); + exports.Set("BindExportMesh", Napi::Function::New(env, BindExportMesh)); + exports.Set("BindExportMeshAsCode", Napi::Function::New(env, BindExportMeshAsCode)); exports.Set("BindGenMeshPoly", Napi::Function::New(env, BindGenMeshPoly)); exports.Set("BindGenMeshPlane", Napi::Function::New(env, BindGenMeshPlane)); exports.Set("BindGenMeshCube", Napi::Function::New(env, BindGenMeshCube)); @@ -8242,6 +9303,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindSetModelMeshMaterial", Napi::Function::New(env, BindSetModelMeshMaterial)); exports.Set("BindLoadModelAnimations", Napi::Function::New(env, BindLoadModelAnimations)); exports.Set("BindUpdateModelAnimation", Napi::Function::New(env, BindUpdateModelAnimation)); + exports.Set("BindUpdateModelAnimationBones", Napi::Function::New(env, BindUpdateModelAnimationBones)); exports.Set("BindUnloadModelAnimation", Napi::Function::New(env, BindUnloadModelAnimation)); exports.Set("BindUnloadModelAnimations", Napi::Function::New(env, BindUnloadModelAnimations)); exports.Set("BindIsModelAnimationValid", Napi::Function::New(env, BindIsModelAnimationValid)); @@ -8257,15 +9319,18 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindCloseAudioDevice", Napi::Function::New(env, BindCloseAudioDevice)); exports.Set("BindIsAudioDeviceReady", Napi::Function::New(env, BindIsAudioDeviceReady)); exports.Set("BindSetMasterVolume", Napi::Function::New(env, BindSetMasterVolume)); + exports.Set("BindGetMasterVolume", Napi::Function::New(env, BindGetMasterVolume)); exports.Set("BindLoadWave", Napi::Function::New(env, BindLoadWave)); exports.Set("BindLoadWaveFromMemory", Napi::Function::New(env, BindLoadWaveFromMemory)); - exports.Set("BindIsWaveReady", Napi::Function::New(env, BindIsWaveReady)); + exports.Set("BindIsWaveValid", Napi::Function::New(env, BindIsWaveValid)); exports.Set("BindLoadSound", Napi::Function::New(env, BindLoadSound)); exports.Set("BindLoadSoundFromWave", Napi::Function::New(env, BindLoadSoundFromWave)); - exports.Set("BindIsSoundReady", Napi::Function::New(env, BindIsSoundReady)); + exports.Set("BindLoadSoundAlias", Napi::Function::New(env, BindLoadSoundAlias)); + exports.Set("BindIsSoundValid", Napi::Function::New(env, BindIsSoundValid)); exports.Set("BindUpdateSound", Napi::Function::New(env, BindUpdateSound)); exports.Set("BindUnloadWave", Napi::Function::New(env, BindUnloadWave)); exports.Set("BindUnloadSound", Napi::Function::New(env, BindUnloadSound)); + exports.Set("BindUnloadSoundAlias", Napi::Function::New(env, BindUnloadSoundAlias)); exports.Set("BindExportWave", Napi::Function::New(env, BindExportWave)); exports.Set("BindExportWaveAsCode", Napi::Function::New(env, BindExportWaveAsCode)); exports.Set("BindPlaySound", Napi::Function::New(env, BindPlaySound)); @@ -8283,7 +9348,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindUnloadWaveSamples", Napi::Function::New(env, BindUnloadWaveSamples)); exports.Set("BindLoadMusicStream", Napi::Function::New(env, BindLoadMusicStream)); exports.Set("BindLoadMusicStreamFromMemory", Napi::Function::New(env, BindLoadMusicStreamFromMemory)); - exports.Set("BindIsMusicReady", Napi::Function::New(env, BindIsMusicReady)); + exports.Set("BindIsMusicValid", Napi::Function::New(env, BindIsMusicValid)); exports.Set("BindUnloadMusicStream", Napi::Function::New(env, BindUnloadMusicStream)); exports.Set("BindPlayMusicStream", Napi::Function::New(env, BindPlayMusicStream)); exports.Set("BindIsMusicStreamPlaying", Napi::Function::New(env, BindIsMusicStreamPlaying)); @@ -8298,7 +9363,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGetMusicTimeLength", Napi::Function::New(env, BindGetMusicTimeLength)); exports.Set("BindGetMusicTimePlayed", Napi::Function::New(env, BindGetMusicTimePlayed)); exports.Set("BindLoadAudioStream", Napi::Function::New(env, BindLoadAudioStream)); - exports.Set("BindIsAudioStreamReady", Napi::Function::New(env, BindIsAudioStreamReady)); + exports.Set("BindIsAudioStreamValid", Napi::Function::New(env, BindIsAudioStreamValid)); exports.Set("BindUnloadAudioStream", Napi::Function::New(env, BindUnloadAudioStream)); exports.Set("BindUpdateAudioStream", Napi::Function::New(env, BindUpdateAudioStream)); exports.Set("BindIsAudioStreamProcessed", Napi::Function::New(env, BindIsAudioStreamProcessed)); @@ -8366,12 +9431,15 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindVector2Transform", Napi::Function::New(env, BindVector2Transform)); exports.Set("BindVector2Lerp", Napi::Function::New(env, BindVector2Lerp)); exports.Set("BindVector2Reflect", Napi::Function::New(env, BindVector2Reflect)); + exports.Set("BindVector2Min", Napi::Function::New(env, BindVector2Min)); + exports.Set("BindVector2Max", Napi::Function::New(env, BindVector2Max)); exports.Set("BindVector2Rotate", Napi::Function::New(env, BindVector2Rotate)); exports.Set("BindVector2MoveTowards", Napi::Function::New(env, BindVector2MoveTowards)); exports.Set("BindVector2Invert", Napi::Function::New(env, BindVector2Invert)); exports.Set("BindVector2Clamp", Napi::Function::New(env, BindVector2Clamp)); exports.Set("BindVector2ClampValue", Napi::Function::New(env, BindVector2ClampValue)); exports.Set("BindVector2Equals", Napi::Function::New(env, BindVector2Equals)); + exports.Set("BindVector2Refract", Napi::Function::New(env, BindVector2Refract)); exports.Set("BindVector3Zero", Napi::Function::New(env, BindVector3Zero)); exports.Set("BindVector3One", Napi::Function::New(env, BindVector3One)); exports.Set("BindVector3Add", Napi::Function::New(env, BindVector3Add)); @@ -8391,11 +9459,15 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindVector3Negate", Napi::Function::New(env, BindVector3Negate)); exports.Set("BindVector3Divide", Napi::Function::New(env, BindVector3Divide)); exports.Set("BindVector3Normalize", Napi::Function::New(env, BindVector3Normalize)); + exports.Set("BindVector3Project", Napi::Function::New(env, BindVector3Project)); + exports.Set("BindVector3Reject", Napi::Function::New(env, BindVector3Reject)); exports.Set("BindVector3OrthoNormalize", Napi::Function::New(env, BindVector3OrthoNormalize)); exports.Set("BindVector3Transform", Napi::Function::New(env, BindVector3Transform)); exports.Set("BindVector3RotateByQuaternion", Napi::Function::New(env, BindVector3RotateByQuaternion)); exports.Set("BindVector3RotateByAxisAngle", Napi::Function::New(env, BindVector3RotateByAxisAngle)); + exports.Set("BindVector3MoveTowards", Napi::Function::New(env, BindVector3MoveTowards)); exports.Set("BindVector3Lerp", Napi::Function::New(env, BindVector3Lerp)); + exports.Set("BindVector3CubicHermite", Napi::Function::New(env, BindVector3CubicHermite)); exports.Set("BindVector3Reflect", Napi::Function::New(env, BindVector3Reflect)); exports.Set("BindVector3Min", Napi::Function::New(env, BindVector3Min)); exports.Set("BindVector3Max", Napi::Function::New(env, BindVector3Max)); @@ -8406,6 +9478,28 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindVector3ClampValue", Napi::Function::New(env, BindVector3ClampValue)); exports.Set("BindVector3Equals", Napi::Function::New(env, BindVector3Equals)); exports.Set("BindVector3Refract", Napi::Function::New(env, BindVector3Refract)); + exports.Set("BindVector4Zero", Napi::Function::New(env, BindVector4Zero)); + exports.Set("BindVector4One", Napi::Function::New(env, BindVector4One)); + exports.Set("BindVector4Add", Napi::Function::New(env, BindVector4Add)); + exports.Set("BindVector4AddValue", Napi::Function::New(env, BindVector4AddValue)); + exports.Set("BindVector4Subtract", Napi::Function::New(env, BindVector4Subtract)); + exports.Set("BindVector4SubtractValue", Napi::Function::New(env, BindVector4SubtractValue)); + exports.Set("BindVector4Length", Napi::Function::New(env, BindVector4Length)); + exports.Set("BindVector4LengthSqr", Napi::Function::New(env, BindVector4LengthSqr)); + exports.Set("BindVector4DotProduct", Napi::Function::New(env, BindVector4DotProduct)); + exports.Set("BindVector4Distance", Napi::Function::New(env, BindVector4Distance)); + exports.Set("BindVector4DistanceSqr", Napi::Function::New(env, BindVector4DistanceSqr)); + exports.Set("BindVector4Scale", Napi::Function::New(env, BindVector4Scale)); + exports.Set("BindVector4Multiply", Napi::Function::New(env, BindVector4Multiply)); + exports.Set("BindVector4Negate", Napi::Function::New(env, BindVector4Negate)); + exports.Set("BindVector4Divide", Napi::Function::New(env, BindVector4Divide)); + exports.Set("BindVector4Normalize", Napi::Function::New(env, BindVector4Normalize)); + exports.Set("BindVector4Min", Napi::Function::New(env, BindVector4Min)); + exports.Set("BindVector4Max", Napi::Function::New(env, BindVector4Max)); + exports.Set("BindVector4Lerp", Napi::Function::New(env, BindVector4Lerp)); + exports.Set("BindVector4MoveTowards", Napi::Function::New(env, BindVector4MoveTowards)); + exports.Set("BindVector4Invert", Napi::Function::New(env, BindVector4Invert)); + exports.Set("BindVector4Equals", Napi::Function::New(env, BindVector4Equals)); exports.Set("BindMatrixDeterminant", Napi::Function::New(env, BindMatrixDeterminant)); exports.Set("BindMatrixTrace", Napi::Function::New(env, BindMatrixTrace)); exports.Set("BindMatrixTranspose", Napi::Function::New(env, BindMatrixTranspose)); @@ -8440,6 +9534,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindQuaternionLerp", Napi::Function::New(env, BindQuaternionLerp)); exports.Set("BindQuaternionNlerp", Napi::Function::New(env, BindQuaternionNlerp)); exports.Set("BindQuaternionSlerp", Napi::Function::New(env, BindQuaternionSlerp)); + exports.Set("BindQuaternionCubicHermiteSpline", Napi::Function::New(env, BindQuaternionCubicHermiteSpline)); exports.Set("BindQuaternionFromVector3ToVector3", Napi::Function::New(env, BindQuaternionFromVector3ToVector3)); exports.Set("BindQuaternionFromMatrix", Napi::Function::New(env, BindQuaternionFromMatrix)); exports.Set("BindQuaternionToMatrix", Napi::Function::New(env, BindQuaternionToMatrix)); @@ -8449,18 +9544,29 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindQuaternionToEuler", Napi::Function::New(env, BindQuaternionToEuler)); exports.Set("BindQuaternionTransform", Napi::Function::New(env, BindQuaternionTransform)); exports.Set("BindQuaternionEquals", Napi::Function::New(env, BindQuaternionEquals)); + exports.Set("BindMatrixDecompose", Napi::Function::New(env, BindMatrixDecompose)); exports.Set("BindGuiEnable", Napi::Function::New(env, BindGuiEnable)); exports.Set("BindGuiDisable", Napi::Function::New(env, BindGuiDisable)); exports.Set("BindGuiLock", Napi::Function::New(env, BindGuiLock)); exports.Set("BindGuiUnlock", Napi::Function::New(env, BindGuiUnlock)); exports.Set("BindGuiIsLocked", Napi::Function::New(env, BindGuiIsLocked)); - exports.Set("BindGuiFade", Napi::Function::New(env, BindGuiFade)); + exports.Set("BindGuiSetAlpha", Napi::Function::New(env, BindGuiSetAlpha)); exports.Set("BindGuiSetState", Napi::Function::New(env, BindGuiSetState)); exports.Set("BindGuiGetState", Napi::Function::New(env, BindGuiGetState)); exports.Set("BindGuiSetFont", Napi::Function::New(env, BindGuiSetFont)); exports.Set("BindGuiGetFont", Napi::Function::New(env, BindGuiGetFont)); exports.Set("BindGuiSetStyle", Napi::Function::New(env, BindGuiSetStyle)); exports.Set("BindGuiGetStyle", Napi::Function::New(env, BindGuiGetStyle)); + exports.Set("BindGuiLoadStyle", Napi::Function::New(env, BindGuiLoadStyle)); + exports.Set("BindGuiLoadStyleDefault", Napi::Function::New(env, BindGuiLoadStyleDefault)); + exports.Set("BindGuiEnableTooltip", Napi::Function::New(env, BindGuiEnableTooltip)); + exports.Set("BindGuiDisableTooltip", Napi::Function::New(env, BindGuiDisableTooltip)); + exports.Set("BindGuiSetTooltip", Napi::Function::New(env, BindGuiSetTooltip)); + exports.Set("BindGuiIconText", Napi::Function::New(env, BindGuiIconText)); + exports.Set("BindGuiSetIconScale", Napi::Function::New(env, BindGuiSetIconScale)); + exports.Set("BindGuiGetIcons", Napi::Function::New(env, BindGuiGetIcons)); + exports.Set("BindGuiLoadIcons", Napi::Function::New(env, BindGuiLoadIcons)); + exports.Set("BindGuiDrawIcon", Napi::Function::New(env, BindGuiDrawIcon)); exports.Set("BindGuiWindowBox", Napi::Function::New(env, BindGuiWindowBox)); exports.Set("BindGuiGroupBox", Napi::Function::New(env, BindGuiGroupBox)); exports.Set("BindGuiLine", Napi::Function::New(env, BindGuiLine)); @@ -8472,13 +9578,14 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGuiLabelButton", Napi::Function::New(env, BindGuiLabelButton)); exports.Set("BindGuiToggle", Napi::Function::New(env, BindGuiToggle)); exports.Set("BindGuiToggleGroup", Napi::Function::New(env, BindGuiToggleGroup)); + exports.Set("BindGuiToggleSlider", Napi::Function::New(env, BindGuiToggleSlider)); exports.Set("BindGuiCheckBox", Napi::Function::New(env, BindGuiCheckBox)); exports.Set("BindGuiComboBox", Napi::Function::New(env, BindGuiComboBox)); exports.Set("BindGuiDropdownBox", Napi::Function::New(env, BindGuiDropdownBox)); exports.Set("BindGuiSpinner", Napi::Function::New(env, BindGuiSpinner)); exports.Set("BindGuiValueBox", Napi::Function::New(env, BindGuiValueBox)); + exports.Set("BindGuiValueBoxFloat", Napi::Function::New(env, BindGuiValueBoxFloat)); exports.Set("BindGuiTextBox", Napi::Function::New(env, BindGuiTextBox)); - exports.Set("BindGuiTextBoxMulti", Napi::Function::New(env, BindGuiTextBoxMulti)); exports.Set("BindGuiSlider", Napi::Function::New(env, BindGuiSlider)); exports.Set("BindGuiSliderBar", Napi::Function::New(env, BindGuiSliderBar)); exports.Set("BindGuiProgressBar", Napi::Function::New(env, BindGuiProgressBar)); @@ -8493,16 +9600,8 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGuiColorPanel", Napi::Function::New(env, BindGuiColorPanel)); exports.Set("BindGuiColorBarAlpha", Napi::Function::New(env, BindGuiColorBarAlpha)); exports.Set("BindGuiColorBarHue", Napi::Function::New(env, BindGuiColorBarHue)); - exports.Set("BindGuiLoadStyle", Napi::Function::New(env, BindGuiLoadStyle)); - exports.Set("BindGuiLoadStyleDefault", Napi::Function::New(env, BindGuiLoadStyleDefault)); - exports.Set("BindGuiEnableTooltip", Napi::Function::New(env, BindGuiEnableTooltip)); - exports.Set("BindGuiDisableTooltip", Napi::Function::New(env, BindGuiDisableTooltip)); - exports.Set("BindGuiSetTooltip", Napi::Function::New(env, BindGuiSetTooltip)); - exports.Set("BindGuiIconText", Napi::Function::New(env, BindGuiIconText)); - exports.Set("BindGuiGetIcons", Napi::Function::New(env, BindGuiGetIcons)); - exports.Set("BindGuiLoadIcons", Napi::Function::New(env, BindGuiLoadIcons)); - exports.Set("BindGuiDrawIcon", Napi::Function::New(env, BindGuiDrawIcon)); - exports.Set("BindGuiSetIconScale", Napi::Function::New(env, BindGuiSetIconScale)); + exports.Set("BindGuiColorPickerHSV", Napi::Function::New(env, BindGuiColorPickerHSV)); + exports.Set("BindGuiColorPanelHSV", Napi::Function::New(env, BindGuiColorPanelHSV)); exports.Set("BindrlMatrixMode", Napi::Function::New(env, BindrlMatrixMode)); exports.Set("BindrlPushMatrix", Napi::Function::New(env, BindrlPushMatrix)); exports.Set("BindrlPopMatrix", Napi::Function::New(env, BindrlPopMatrix)); @@ -8514,6 +9613,9 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindrlFrustum", Napi::Function::New(env, BindrlFrustum)); exports.Set("BindrlOrtho", Napi::Function::New(env, BindrlOrtho)); exports.Set("BindrlViewport", Napi::Function::New(env, BindrlViewport)); + exports.Set("BindrlSetClipPlanes", Napi::Function::New(env, BindrlSetClipPlanes)); + exports.Set("BindrlGetCullDistanceNear", Napi::Function::New(env, BindrlGetCullDistanceNear)); + exports.Set("BindrlGetCullDistanceFar", Napi::Function::New(env, BindrlGetCullDistanceFar)); exports.Set("BindrlBegin", Napi::Function::New(env, BindrlBegin)); exports.Set("BindrlEnd", Napi::Function::New(env, BindrlEnd)); exports.Set("BindrlVertex2i", Napi::Function::New(env, BindrlVertex2i)); @@ -8543,7 +9645,10 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindrlDisableShader", Napi::Function::New(env, BindrlDisableShader)); exports.Set("BindrlEnableFramebuffer", Napi::Function::New(env, BindrlEnableFramebuffer)); exports.Set("BindrlDisableFramebuffer", Napi::Function::New(env, BindrlDisableFramebuffer)); + exports.Set("BindrlGetActiveFramebuffer", Napi::Function::New(env, BindrlGetActiveFramebuffer)); exports.Set("BindrlActiveDrawBuffers", Napi::Function::New(env, BindrlActiveDrawBuffers)); + exports.Set("BindrlBlitFramebuffer", Napi::Function::New(env, BindrlBlitFramebuffer)); + exports.Set("BindrlBindFramebuffer", Napi::Function::New(env, BindrlBindFramebuffer)); exports.Set("BindrlEnableColorBlend", Napi::Function::New(env, BindrlEnableColorBlend)); exports.Set("BindrlDisableColorBlend", Napi::Function::New(env, BindrlDisableColorBlend)); exports.Set("BindrlEnableDepthTest", Napi::Function::New(env, BindrlEnableDepthTest)); @@ -8552,11 +9657,13 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindrlDisableDepthMask", Napi::Function::New(env, BindrlDisableDepthMask)); exports.Set("BindrlEnableBackfaceCulling", Napi::Function::New(env, BindrlEnableBackfaceCulling)); exports.Set("BindrlDisableBackfaceCulling", Napi::Function::New(env, BindrlDisableBackfaceCulling)); + exports.Set("BindrlColorMask", Napi::Function::New(env, BindrlColorMask)); exports.Set("BindrlSetCullFace", Napi::Function::New(env, BindrlSetCullFace)); exports.Set("BindrlEnableScissorTest", Napi::Function::New(env, BindrlEnableScissorTest)); exports.Set("BindrlDisableScissorTest", Napi::Function::New(env, BindrlDisableScissorTest)); exports.Set("BindrlScissor", Napi::Function::New(env, BindrlScissor)); exports.Set("BindrlEnableWireMode", Napi::Function::New(env, BindrlEnableWireMode)); + exports.Set("BindrlEnablePointMode", Napi::Function::New(env, BindrlEnablePointMode)); exports.Set("BindrlDisableWireMode", Napi::Function::New(env, BindrlDisableWireMode)); exports.Set("BindrlSetLineWidth", Napi::Function::New(env, BindrlSetLineWidth)); exports.Set("BindrlGetLineWidth", Napi::Function::New(env, BindrlGetLineWidth)); @@ -8625,6 +9732,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindrlGetLocationAttrib", Napi::Function::New(env, BindrlGetLocationAttrib)); exports.Set("BindrlSetUniform", Napi::Function::New(env, BindrlSetUniform)); exports.Set("BindrlSetUniformMatrix", Napi::Function::New(env, BindrlSetUniformMatrix)); + exports.Set("BindrlSetUniformMatrices", Napi::Function::New(env, BindrlSetUniformMatrices)); exports.Set("BindrlSetUniformSampler", Napi::Function::New(env, BindrlSetUniformSampler)); exports.Set("BindrlSetShader", Napi::Function::New(env, BindrlSetShader)); exports.Set("BindrlLoadComputeShaderProgram", Napi::Function::New(env, BindrlLoadComputeShaderProgram)); diff --git a/src/generated/node-raylib.d.ts b/src/generated/node-raylib.d.ts index f2ff791..a0a7dc1 100644 --- a/src/generated/node-raylib.d.ts +++ b/src/generated/node-raylib.d.ts @@ -210,10 +210,14 @@ declare module "raylib" { animVertices: number /** Animated normals (after bones transformations). (float *) */ animNormals: number - /** Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning). (unsigned char *) */ + /** Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) (shader-location = 6). (unsigned char *) */ boneIds: Buffer - /** Vertex bone weight, up to 4 bones influence by vertex (skinning). (float *) */ + /** Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7). (float *) */ boneWeights: number + /** Bones animated transformation matrices. (Matrix *) */ + boneMatrices: number + /** Number of bones. (int) */ + boneCount: number /** OpenGL Vertex Array Object id. (unsigned int) */ vaoId: number /** OpenGL Vertex Buffer Objects id (default vertex data). (unsigned int *) */ @@ -291,12 +295,14 @@ declare module "raylib" { bones: number /** Poses array by frame. (Transform **) */ framePoses: number + /** Animation name. (char[32]) */ + name: string } /** Ray, ray for raycasting */ export interface Ray { /** Ray position (origin). (Vector3) */ position: Vector3 - /** Ray direction. (Vector3) */ + /** Ray direction (normalized). (Vector3) */ direction: Vector3 } /** RayCollision, ray hit information */ @@ -373,8 +379,6 @@ declare module "raylib" { hScreenSize: number /** Vertical size in meters. (float) */ vScreenSize: number - /** Screen center in meters. (float) */ - vScreenCenter: number /** Distance between eye and display in meters. (float) */ eyeToScreenDistance: number /** Lens separation distance in meters. (float) */ @@ -414,6 +418,24 @@ declare module "raylib" { /** Filepaths entries. (char **) */ paths: number } + /** Automation event */ + export interface AutomationEvent { + /** Event frame. (unsigned int) */ + frame: number + /** Event type (AutomationEventType). (unsigned int) */ + type: number + /** Event parameters (if required). (int[4]) */ + params: number + } + /** Automation event list */ + export interface AutomationEventList { + /** Events max entries (MAX_AUTOMATION_EVENTS). (unsigned int) */ + capacity: number + /** Events entries count. (unsigned int) */ + count: number + /** Events entries. (AutomationEvent *) */ + events: number + } /** Dynamic vertex buffers (position + texcoords + colors + indices arrays) */ export interface rlVertexBuffer { /** Number of elements in the buffer (QUADS). (int) */ @@ -422,13 +444,13 @@ declare module "raylib" { vertices: number /** Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1). (float *) */ texcoords: number - /** Vertex colors (RGBA - 4 components per vertex) (shader-location = 3). (unsigned char *) */ - colors: Buffer + /** Vertex normal (XYZ - 3 components per vertex) (shader-location = 2). (float *) */ + normals: number /** Vertex indices (in case vertex data comes indexed) (6 indices per quad). (unsigned int *) */ indices: number /** OpenGL Vertex Array Object id. (unsigned int) */ vaoId: number - /** OpenGL Vertex Buffer Objects id (4 types of vertex data). (unsigned int[4]) */ + /** OpenGL Vertex Buffer Objects id (5 types of vertex data). (unsigned int[5]) */ vboId: number } /** of those state-change happens (this is done in core module) */ @@ -475,28 +497,28 @@ declare module "raylib" { /** Initialize window and OpenGL context */ export function InitWindow(width: number, height: number, title: string): void - /** Check if KEY_ESCAPE pressed or Close icon pressed */ - export function WindowShouldClose(): boolean - /** Close window and unload OpenGL context */ export function CloseWindow(): void + /** Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) */ + export function WindowShouldClose(): boolean + /** Check if window has been initialized successfully */ export function IsWindowReady(): boolean /** Check if window is currently fullscreen */ export function IsWindowFullscreen(): boolean - /** Check if window is currently hidden (only PLATFORM_DESKTOP) */ + /** Check if window is currently hidden */ export function IsWindowHidden(): boolean - /** Check if window is currently minimized (only PLATFORM_DESKTOP) */ + /** Check if window is currently minimized */ export function IsWindowMinimized(): boolean - /** Check if window is currently maximized (only PLATFORM_DESKTOP) */ + /** Check if window is currently maximized */ export function IsWindowMaximized(): boolean - /** Check if window is currently focused (only PLATFORM_DESKTOP) */ + /** Check if window is currently focused */ export function IsWindowFocused(): boolean /** Check if window has been resized last frame */ @@ -505,48 +527,57 @@ declare module "raylib" { /** Check if one specific window flag is enabled */ export function IsWindowState(flag: number): boolean - /** Set window configuration state using flags (only PLATFORM_DESKTOP) */ + /** Set window configuration state using flags */ export function SetWindowState(flags: number): void /** Clear window configuration state flags */ export function ClearWindowState(flags: number): void - /** Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) */ + /** Toggle window state: fullscreen/windowed, resizes monitor to match window resolution */ export function ToggleFullscreen(): void - /** Set window state: maximized, if resizable (only PLATFORM_DESKTOP) */ + /** Toggle window state: borderless windowed, resizes window to match monitor resolution */ + export function ToggleBorderlessWindowed(): void + + /** Set window state: maximized, if resizable */ export function MaximizeWindow(): void - /** Set window state: minimized, if resizable (only PLATFORM_DESKTOP) */ + /** Set window state: minimized, if resizable */ export function MinimizeWindow(): void - /** Set window state: not minimized/maximized (only PLATFORM_DESKTOP) */ + /** Set window state: not minimized/maximized */ export function RestoreWindow(): void - /** Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) */ + /** Set icon for window (single image, RGBA 32bit) */ export function SetWindowIcon(image: Image): void - /** Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) */ + /** Set icon for window (multiple images, RGBA 32bit) */ export function SetWindowIcons(images: number, count: number): void - /** Set title for window (only PLATFORM_DESKTOP) */ + /** Set title for window */ export function SetWindowTitle(title: string): void - /** Set window position on screen (only PLATFORM_DESKTOP) */ + /** Set window position on screen */ export function SetWindowPosition(x: number, y: number): void - /** Set monitor for the current window (fullscreen mode) */ + /** Set monitor for the current window */ export function SetWindowMonitor(monitor: number): void /** Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE) */ export function SetWindowMinSize(width: number, height: number): void + /** Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) */ + export function SetWindowMaxSize(width: number, height: number): void + /** Set window dimensions */ export function SetWindowSize(width: number, height: number): void - /** Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) */ + /** Set window opacity [0.0f..1.0f] */ export function SetWindowOpacity(opacity: number): void + /** Set window focused */ + export function SetWindowFocused(): void + /** Get native window handle */ export function GetWindowHandle(): number @@ -565,7 +596,7 @@ declare module "raylib" { /** Get number of connected monitors */ export function GetMonitorCount(): number - /** Get current connected monitor */ + /** Get current monitor where window is placed */ export function GetCurrentMonitor(): number /** Get specified monitor position */ @@ -592,7 +623,7 @@ declare module "raylib" { /** Get window scale DPI factor */ export function GetWindowScaleDPI(): Vector2 - /** Get the human-readable, UTF-8 encoded name of the primary monitor */ + /** Get the human-readable, UTF-8 encoded name of the specified monitor */ export function GetMonitorName(monitor: number): string /** Set clipboard text content */ @@ -601,21 +632,15 @@ declare module "raylib" { /** Get clipboard text content */ export function GetClipboardText(): string + /** Get clipboard image content */ + export function GetClipboardImage(): Image + /** Enable waiting for events on EndDrawing(), no automatic event polling */ export function EnableEventWaiting(): void /** Disable waiting for events on EndDrawing(), automatic events polling */ export function DisableEventWaiting(): void - /** Swap back buffer with front buffer (screen drawing) */ - export function SwapScreenBuffer(): void - - /** Register all input events */ - export function PollInputEvents(): void - - /** Wait for some time (halt program execution) */ - export function WaitTime(seconds: number): void - /** Shows cursor */ export function ShowCursor(): void @@ -688,8 +713,8 @@ declare module "raylib" { /** Load shader from code strings and bind default locations */ export function LoadShaderFromMemory(vsCode: string, fsCode: string): Shader - /** Check if a shader is ready */ - export function IsShaderReady(shader: Shader): boolean + /** Check if a shader is valid (loaded on GPU) */ + export function IsShaderValid(shader: Shader): boolean /** Get shader uniform location */ export function GetShaderLocation(shader: Shader, uniformName: string): number @@ -706,51 +731,72 @@ declare module "raylib" { /** Unload shader from GPU memory (VRAM) */ export function UnloadShader(shader: Shader): void - /** Get a ray trace from mouse position */ - export function GetMouseRay(mousePosition: Vector2, camera: Camera3D): Ray + /** Get a ray trace from screen position (i.e mouse) */ + export function GetScreenToWorldRay(position: Vector2, camera: Camera3D): Ray - /** Get camera transform matrix (view matrix) */ - export function GetCameraMatrix(camera: Camera3D): Matrix - - /** Get camera 2d transform matrix */ - export function GetCameraMatrix2D(camera: Camera2D): Matrix + /** Get a ray trace from screen position (i.e mouse) in a viewport */ + export function GetScreenToWorldRayEx(position: Vector2, camera: Camera3D, width: number, height: number): Ray /** Get the screen space position for a 3d world space position */ export function GetWorldToScreen(position: Vector3, camera: Camera3D): Vector2 - /** Get the world space position for a 2d camera screen space position */ - export function GetScreenToWorld2D(position: Vector2, camera: Camera2D): Vector2 - /** Get size position for a 3d world space position */ export function GetWorldToScreenEx(position: Vector3, camera: Camera3D, width: number, height: number): Vector2 /** Get the screen space position for a 2d camera world space position */ export function GetWorldToScreen2D(position: Vector2, camera: Camera2D): Vector2 + /** Get the world space position for a 2d camera screen space position */ + export function GetScreenToWorld2D(position: Vector2, camera: Camera2D): Vector2 + + /** Get camera transform matrix (view matrix) */ + export function GetCameraMatrix(camera: Camera3D): Matrix + + /** Get camera 2d transform matrix */ + export function GetCameraMatrix2D(camera: Camera2D): Matrix + /** Set target FPS (maximum) */ export function SetTargetFPS(fps: number): void - /** Get current FPS */ - export function GetFPS(): number - /** Get time in seconds for last frame drawn (delta time) */ export function GetFrameTime(): number /** Get elapsed time in seconds since InitWindow() */ export function GetTime(): number - /** Get a random value between min and max (both included) */ - export function GetRandomValue(min: number, max: number): number + /** Get current FPS */ + export function GetFPS(): number + + /** Swap back buffer with front buffer (screen drawing) */ + export function SwapScreenBuffer(): void + + /** Register all input events */ + export function PollInputEvents(): void + + /** Wait for some time (halt program execution) */ + export function WaitTime(seconds: number): void /** Set the seed for the random number generator */ export function SetRandomSeed(seed: number): void + /** Get a random value between min and max (both included) */ + export function GetRandomValue(min: number, max: number): number + + /** Load random values sequence, no values repeated */ + export function LoadRandomSequence(count: number, min: number, max: number): number + + /** Unload random values sequence */ + export function UnloadRandomSequence(sequence: number): void + /** Takes a screenshot of current screen (filename extension defines format) */ export function TakeScreenshot(fileName: string): void /** Setup init configuration flags (view FLAGS) */ export function SetConfigFlags(flags: number): void + /** Open URL with default system browser (if available) */ + export function OpenURL(url: string): void + /** Set the current threshold (minimum) log level */ export function SetTraceLogLevel(logLevel: number): void @@ -763,20 +809,17 @@ declare module "raylib" { /** Internal memory free */ export function MemFree(ptr: number): void - /** Open URL with default system browser (if available) */ - export function OpenURL(url: string): void - /** Load file data as byte array (read) */ - export function LoadFileData(fileName: string, bytesRead: number): Buffer + export function LoadFileData(fileName: string, dataSize: number): Buffer /** Unload file data allocated by LoadFileData() */ export function UnloadFileData(data: Buffer): void /** Save data to file from byte array (write), returns true on success */ - export function SaveFileData(fileName: string, data: number, bytesToWrite: number): boolean + export function SaveFileData(fileName: string, data: number, dataSize: number): boolean /** Export data to code (.h), returns true on success */ - export function ExportDataAsCode(data: Buffer, size: number, fileName: string): boolean + export function ExportDataAsCode(data: Buffer, dataSize: number, fileName: string): boolean /** Load text data from file (read), returns a '\0' terminated string */ export function LoadFileText(fileName: string): string @@ -817,19 +860,25 @@ declare module "raylib" { /** Get current working directory (uses static string) */ export function GetWorkingDirectory(): string - /** Get the directory if the running application (uses static string) */ + /** Get the directory of the running application (uses static string) */ export function GetApplicationDirectory(): string + /** Create directories (including full path requested), returns 0 on success */ + export function MakeDirectory(dirPath: string): number + /** Change working directory, return true on success */ export function ChangeDirectory(dir: string): boolean /** Check if a given path is a file or a directory */ export function IsPathFile(path: string): boolean + /** Check if fileName is valid for the platform/OS */ + export function IsFileNameValid(fileName: string): boolean + /** Load directory filepaths */ export function LoadDirectoryFiles(dirPath: string): FilePathList - /** Load directory filepaths with extension filtering and recursive directory scan */ + /** Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result */ export function LoadDirectoryFilesEx(basePath: string, filter: string, scanSubdirs: boolean): FilePathList /** Unload filepaths */ @@ -859,9 +908,45 @@ declare module "raylib" { /** Decode Base64 string data, memory must be MemFree() */ export function DecodeDataBase64(data: Buffer, outputSize: number): Buffer + /** Compute CRC32 hash code */ + export function ComputeCRC32(data: Buffer, dataSize: number): number + + /** Compute MD5 hash code, returns static int[4] (16 bytes) */ + export function ComputeMD5(data: Buffer, dataSize: number): number + + /** Compute SHA1 hash code, returns static int[5] (20 bytes) */ + export function ComputeSHA1(data: Buffer, dataSize: number): number + + /** Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS */ + export function LoadAutomationEventList(fileName: string): AutomationEventList + + /** Unload automation events list from file */ + export function UnloadAutomationEventList(list: AutomationEventList): void + + /** Export automation events list as text file */ + export function ExportAutomationEventList(list: AutomationEventList, fileName: string): boolean + + /** Set automation event list to record to */ + export function SetAutomationEventList(list: number): void + + /** Set automation event internal base frame to start recording */ + export function SetAutomationEventBaseFrame(frame: number): void + + /** Start recording automation events (AutomationEventList must be set) */ + export function StartAutomationEventRecording(): void + + /** Stop recording automation events */ + export function StopAutomationEventRecording(): void + + /** Play a recorded automation event */ + export function PlayAutomationEvent(event: AutomationEvent): void + /** Check if a key has been pressed once */ export function IsKeyPressed(key: number): boolean + /** Check if a key has been pressed again */ + export function IsKeyPressedRepeat(key: number): boolean + /** Check if a key is being pressed */ export function IsKeyDown(key: number): boolean @@ -871,15 +956,15 @@ declare module "raylib" { /** Check if a key is NOT being pressed */ export function IsKeyUp(key: number): boolean - /** Set a custom key to exit program (default is ESC) */ - export function SetExitKey(key: number): void - /** Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty */ export function GetKeyPressed(): number /** Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty */ export function GetCharPressed(): number + /** Set a custom key to exit program (default is ESC) */ + export function SetExitKey(key: number): void + /** Check if a gamepad is available */ export function IsGamepadAvailable(gamepad: number): boolean @@ -910,6 +995,9 @@ declare module "raylib" { /** Set internal gamepad mappings (SDL_GameControllerDB) */ export function SetGamepadMappings(mappings: string): number + /** Set gamepad vibration for both motors (duration in seconds) */ + export function SetGamepadVibration(gamepad: number, leftMotor: number, rightMotor: number, duration: number): void + /** Check if a mouse button has been pressed once */ export function IsMouseButtonPressed(button: number): boolean @@ -976,7 +1064,7 @@ declare module "raylib" { /** Get latest detected gesture */ export function GetGestureDetected(): number - /** Get gesture hold time in milliseconds */ + /** Get gesture hold time in seconds */ export function GetGestureHoldDuration(): number /** Get gesture drag vector */ @@ -1000,33 +1088,33 @@ declare module "raylib" { /** Set texture and rectangle to be used on shapes drawing */ export function SetShapesTexture(texture: Texture, source: Rectangle): void - /** Draw a pixel */ + /** Get texture that is used for shapes drawing */ + export function GetShapesTexture(): Texture2D + + /** Get texture source rectangle that is used for shapes drawing */ + export function GetShapesTextureRectangle(): Rectangle + + /** Draw a pixel using geometry [Can be slow, use with care] */ export function DrawPixel(posX: number, posY: number, color: Color): void - /** Draw a pixel (Vector version) */ + /** Draw a pixel using geometry (Vector version) [Can be slow, use with care] */ export function DrawPixelV(position: Vector2, color: Color): void /** Draw a line */ export function DrawLine(startPosX: number, startPosY: number, endPosX: number, endPosY: number, color: Color): void - /** Draw a line (Vector version) */ + /** Draw a line (using gl lines) */ export function DrawLineV(startPos: Vector2, endPos: Vector2, color: Color): void - /** Draw a line defining thickness */ + /** Draw a line (using triangles/quads) */ export function DrawLineEx(startPos: Vector2, endPos: Vector2, thick: number, color: Color): void - /** Draw a line using cubic-bezier curves in-out */ - export function DrawLineBezier(startPos: Vector2, endPos: Vector2, thick: number, color: Color): void - - /** Draw line using quadratic bezier curves with a control point */ - export function DrawLineBezierQuad(startPos: Vector2, endPos: Vector2, controlPos: Vector2, thick: number, color: Color): void - - /** Draw line using cubic bezier curves with 2 control points */ - export function DrawLineBezierCubic(startPos: Vector2, endPos: Vector2, startControlPos: Vector2, endControlPos: Vector2, thick: number, color: Color): void - - /** Draw lines sequence */ + /** Draw lines sequence (using gl lines) */ export function DrawLineStrip(points: number, pointCount: number, color: Color): void + /** Draw line segment cubic-bezier in-out interpolation */ + export function DrawLineBezier(startPos: Vector2, endPos: Vector2, thick: number, color: Color): void + /** Draw a color-filled circle */ export function DrawCircle(centerX: number, centerY: number, radius: number, color: Color): void @@ -1037,7 +1125,7 @@ declare module "raylib" { export function DrawCircleSectorLines(center: Vector2, radius: number, startAngle: number, endAngle: number, segments: number, color: Color): void /** Draw a gradient-filled circle */ - export function DrawCircleGradient(centerX: number, centerY: number, radius: number, color1: Color, color2: Color): void + export function DrawCircleGradient(centerX: number, centerY: number, radius: number, inner: Color, outer: Color): void /** Draw a color-filled circle (Vector version) */ export function DrawCircleV(center: Vector2, radius: number, color: Color): void @@ -1045,6 +1133,9 @@ declare module "raylib" { /** Draw circle outline */ export function DrawCircleLines(centerX: number, centerY: number, radius: number, color: Color): void + /** Draw circle outline (Vector version) */ + export function DrawCircleLinesV(center: Vector2, radius: number, color: Color): void + /** Draw ellipse */ export function DrawEllipse(centerX: number, centerY: number, radiusH: number, radiusV: number, color: Color): void @@ -1070,13 +1161,13 @@ declare module "raylib" { export function DrawRectanglePro(rec: Rectangle, origin: Vector2, rotation: number, color: Color): void /** Draw a vertical-gradient-filled rectangle */ - export function DrawRectangleGradientV(posX: number, posY: number, width: number, height: number, color1: Color, color2: Color): void + export function DrawRectangleGradientV(posX: number, posY: number, width: number, height: number, top: Color, bottom: Color): void /** Draw a horizontal-gradient-filled rectangle */ - export function DrawRectangleGradientH(posX: number, posY: number, width: number, height: number, color1: Color, color2: Color): void + export function DrawRectangleGradientH(posX: number, posY: number, width: number, height: number, left: Color, right: Color): void /** Draw a gradient-filled rectangle with custom vertex colors */ - export function DrawRectangleGradientEx(rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color): void + export function DrawRectangleGradientEx(rec: Rectangle, topLeft: Color, bottomLeft: Color, topRight: Color, bottomRight: Color): void /** Draw rectangle outline */ export function DrawRectangleLines(posX: number, posY: number, width: number, height: number, color: Color): void @@ -1087,8 +1178,11 @@ declare module "raylib" { /** Draw rectangle with rounded edges */ export function DrawRectangleRounded(rec: Rectangle, roundness: number, segments: number, color: Color): void + /** Draw rectangle lines with rounded edges */ + export function DrawRectangleRoundedLines(rec: Rectangle, roundness: number, segments: number, color: Color): void + /** Draw rectangle with rounded edges outline */ - export function DrawRectangleRoundedLines(rec: Rectangle, roundness: number, segments: number, lineThick: number, color: Color): void + export function DrawRectangleRoundedLinesEx(rec: Rectangle, roundness: number, segments: number, lineThick: number, color: Color): void /** Draw a color-filled triangle (vertex in counter-clockwise order!) */ export function DrawTriangle(v1: Vector2, v2: Vector2, v3: Vector2, color: Color): void @@ -1111,6 +1205,51 @@ declare module "raylib" { /** Draw a polygon outline of n sides with extended parameters */ export function DrawPolyLinesEx(center: Vector2, sides: number, radius: number, rotation: number, lineThick: number, color: Color): void + /** Draw spline: Linear, minimum 2 points */ + export function DrawSplineLinear(points: number, pointCount: number, thick: number, color: Color): void + + /** Draw spline: B-Spline, minimum 4 points */ + export function DrawSplineBasis(points: number, pointCount: number, thick: number, color: Color): void + + /** Draw spline: Catmull-Rom, minimum 4 points */ + export function DrawSplineCatmullRom(points: number, pointCount: number, thick: number, color: Color): void + + /** Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] */ + export function DrawSplineBezierQuadratic(points: number, pointCount: number, thick: number, color: Color): void + + /** Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] */ + export function DrawSplineBezierCubic(points: number, pointCount: number, thick: number, color: Color): void + + /** Draw spline segment: Linear, 2 points */ + export function DrawSplineSegmentLinear(p1: Vector2, p2: Vector2, thick: number, color: Color): void + + /** Draw spline segment: B-Spline, 4 points */ + export function DrawSplineSegmentBasis(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, thick: number, color: Color): void + + /** Draw spline segment: Catmull-Rom, 4 points */ + export function DrawSplineSegmentCatmullRom(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, thick: number, color: Color): void + + /** Draw spline segment: Quadratic Bezier, 2 points, 1 control point */ + export function DrawSplineSegmentBezierQuadratic(p1: Vector2, c2: Vector2, p3: Vector2, thick: number, color: Color): void + + /** Draw spline segment: Cubic Bezier, 2 points, 2 control points */ + export function DrawSplineSegmentBezierCubic(p1: Vector2, c2: Vector2, c3: Vector2, p4: Vector2, thick: number, color: Color): void + + /** Get (evaluate) spline point: Linear */ + export function GetSplinePointLinear(startPos: Vector2, endPos: Vector2, t: number): Vector2 + + /** Get (evaluate) spline point: B-Spline */ + export function GetSplinePointBasis(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, t: number): Vector2 + + /** Get (evaluate) spline point: Catmull-Rom */ + export function GetSplinePointCatmullRom(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, t: number): Vector2 + + /** Get (evaluate) spline point: Quadratic Bezier */ + export function GetSplinePointBezierQuad(p1: Vector2, c2: Vector2, p3: Vector2, t: number): Vector2 + + /** Get (evaluate) spline point: Cubic Bezier */ + export function GetSplinePointBezierCubic(p1: Vector2, c2: Vector2, c3: Vector2, p4: Vector2, t: number): Vector2 + /** Check collision between two rectangles */ export function CheckCollisionRecs(rec1: Rectangle, rec2: Rectangle): boolean @@ -1120,6 +1259,9 @@ declare module "raylib" { /** Check collision between circle and rectangle */ export function CheckCollisionCircleRec(center: Vector2, radius: number, rec: Rectangle): boolean + /** Check if circle collides with a line created betweeen two points [p1] and [p2] */ + export function CheckCollisionCircleLine(center: Vector2, radius: number, p1: Vector2, p2: Vector2): boolean + /** Check if point is inside rectangle */ export function CheckCollisionPointRec(point: Vector2, rec: Rectangle): boolean @@ -1129,15 +1271,15 @@ declare module "raylib" { /** Check if point is inside a triangle */ export function CheckCollisionPointTriangle(point: Vector2, p1: Vector2, p2: Vector2, p3: Vector2): boolean + /** Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] */ + export function CheckCollisionPointLine(point: Vector2, p1: Vector2, p2: Vector2, threshold: number): boolean + /** Check if point is within a polygon described by array of vertices */ export function CheckCollisionPointPoly(point: Vector2, points: number, pointCount: number): boolean /** Check the collision between two lines defined by two points each, returns collision point by reference */ export function CheckCollisionLines(startPos1: Vector2, endPos1: Vector2, startPos2: Vector2, endPos2: Vector2, collisionPoint: number): boolean - /** Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] */ - export function CheckCollisionPointLine(point: Vector2, p1: Vector2, p2: Vector2, threshold: number): boolean - /** Get collision rectangle for two rectangles collision */ export function GetCollisionRec(rec1: Rectangle, rec2: Rectangle): Rectangle @@ -1150,6 +1292,9 @@ declare module "raylib" { /** Load image sequence from file (frames appended to image.data) */ export function LoadImageAnim(fileName: string, frames: number): Image + /** Load image sequence from memory buffer */ + export function LoadImageAnimFromMemory(fileType: string, fileData: Buffer, dataSize: number, frames: number): Image + /** Load image from memory buffer, fileType refers to extension: i.e. '.png' */ export function LoadImageFromMemory(fileType: string, fileData: Buffer, dataSize: number): Image @@ -1159,8 +1304,8 @@ declare module "raylib" { /** Load image from screen buffer and (screenshot) */ export function LoadImageFromScreen(): Image - /** Check if an image is ready */ - export function IsImageReady(image: Image): boolean + /** Check if an image is valid (data and parameters) */ + export function IsImageValid(image: Image): boolean /** Unload image from CPU memory (RAM) */ export function UnloadImage(image: Image): void @@ -1168,21 +1313,24 @@ declare module "raylib" { /** Export image data to file, returns true on success */ export function ExportImage(image: Image, fileName: string): boolean + /** Export image to memory buffer */ + export function ExportImageToMemory(image: Image, fileType: string, fileSize: number): Buffer + /** Export image as code file defining an array of bytes, returns true on success */ export function ExportImageAsCode(image: Image, fileName: string): boolean /** Generate image: plain color */ export function GenImageColor(width: number, height: number, color: Color): Image - /** Generate image: vertical gradient */ - export function GenImageGradientV(width: number, height: number, top: Color, bottom: Color): Image - - /** Generate image: horizontal gradient */ - export function GenImageGradientH(width: number, height: number, left: Color, right: Color): Image + /** Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient */ + export function GenImageGradientLinear(width: number, height: number, direction: number, start: Color, end: Color): Image /** Generate image: radial gradient */ export function GenImageGradientRadial(width: number, height: number, density: number, inner: Color, outer: Color): Image + /** Generate image: square gradient */ + export function GenImageGradientSquare(width: number, height: number, density: number, inner: Color, outer: Color): Image + /** Generate image: checked */ export function GenImageChecked(width: number, height: number, checksX: number, checksY: number, col1: Color, col2: Color): Image @@ -1204,6 +1352,9 @@ declare module "raylib" { /** Create an image from another image piece */ export function ImageFromImage(image: Image, rec: Rectangle): Image + /** Create an image from a selected channel of another image (GRAYSCALE) */ + export function ImageFromChannel(image: Image, selectedChannel: number): Image + /** Create an image from text (default font) */ export function ImageText(text: string, fontSize: number, color: Color): Image @@ -1234,6 +1385,9 @@ declare module "raylib" { /** Apply Gaussian blur using a box blur approximation */ export function ImageBlurGaussian(image: number, blurSize: number): void + /** Apply custom square convolution kernel to image */ + export function ImageKernelConvolution(image: number, kernel: number, kernelSize: number): void + /** Resize image (Bicubic scaling algorithm) */ export function ImageResize(image: Image, newWidth: number, newHeight: number): void @@ -1255,6 +1409,9 @@ declare module "raylib" { /** Flip image horizontally */ export function ImageFlipHorizontal(image: Image): void + /** Rotate image by input angle in degrees (-359 to 359) */ + export function ImageRotate(image: number, degrees: number): void + /** Rotate image clockwise 90deg */ export function ImageRotateCW(image: Image): void @@ -1312,6 +1469,9 @@ declare module "raylib" { /** Draw line within an image (Vector version) */ export function ImageDrawLineV(dst: Image, start: Vector2, end: Vector2, color: Color): void + /** Draw a line defining thickness within an image */ + export function ImageDrawLineEx(dst: number, start: Vector2, end: Vector2, thick: number, color: Color): void + /** Draw a filled circle within an image */ export function ImageDrawCircle(dst: Image, centerX: number, centerY: number, radius: number, color: Color): void @@ -1336,6 +1496,21 @@ declare module "raylib" { /** Draw rectangle lines within an image */ export function ImageDrawRectangleLines(dst: Image, rec: Rectangle, thick: number, color: Color): void + /** Draw triangle within an image */ + export function ImageDrawTriangle(dst: number, v1: Vector2, v2: Vector2, v3: Vector2, color: Color): void + + /** Draw triangle with interpolated colors within an image */ + export function ImageDrawTriangleEx(dst: number, v1: Vector2, v2: Vector2, v3: Vector2, c1: Color, c2: Color, c3: Color): void + + /** Draw triangle outline within an image */ + export function ImageDrawTriangleLines(dst: number, v1: Vector2, v2: Vector2, v3: Vector2, color: Color): void + + /** Draw a triangle fan defined by points within an image (first vertex is the center) */ + export function ImageDrawTriangleFan(dst: number, points: number, pointCount: number, color: Color): void + + /** Draw a triangle strip defined by points within an image */ + export function ImageDrawTriangleStrip(dst: number, points: number, pointCount: number, color: Color): void + /** Draw a source image within a destination image (tint applied to source) */ export function ImageDraw(dst: Image, src: Image, srcRec: Rectangle, dstRec: Rectangle, tint: Color): void @@ -1357,14 +1532,14 @@ declare module "raylib" { /** Load texture for rendering (framebuffer) */ export function LoadRenderTexture(width: number, height: number): RenderTexture2D - /** Check if a texture is ready */ - export function IsTextureReady(texture: Texture): boolean + /** Check if a texture is valid (loaded in GPU) */ + export function IsTextureValid(texture: Texture): boolean /** Unload texture from GPU memory (VRAM) */ export function UnloadTexture(texture: Texture): void - /** Check if a render texture is ready */ - export function IsRenderTextureReady(target: RenderTexture): boolean + /** Check if a render texture is valid (loaded in GPU) */ + export function IsRenderTextureValid(target: RenderTexture): boolean /** Unload render texture from GPU memory (VRAM) */ export function UnloadRenderTexture(target: RenderTexture): void @@ -1402,10 +1577,13 @@ declare module "raylib" { /** Draws a texture (or part of it) that stretches or shrinks nicely */ export function DrawTextureNPatch(texture: Texture, nPatchInfo: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: number, tint: Color): void + /** Check if two colors are equal */ + export function ColorIsEqual(col1: Color, col2: Color): boolean + /** Get color with alpha applied, alpha goes from 0.0f to 1.0f */ export function Fade(color: Color, alpha: number): Color - /** Get hexadecimal value for a Color */ + /** Get hexadecimal value for a Color (0xRRGGBBAA) */ export function ColorToInt(color: Color): number /** Get Color normalized as float [0..1] */ @@ -1435,6 +1613,9 @@ declare module "raylib" { /** Get src alpha-blended into dst color with tint */ export function ColorAlphaBlend(dst: Color, src: Color, tint: Color): Color + /** Get color lerp interpolation between two colors, factor [0.0f..1.0f] */ + export function ColorLerp(color1: Color, color2: Color, factor: number): Color + /** Get Color structure from hexadecimal value */ export function GetColor(hexValue: number): Color @@ -1453,26 +1634,26 @@ declare module "raylib" { /** Load font from file into GPU memory (VRAM) */ export function LoadFont(fileName: string): Font - /** Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set */ - export function LoadFontEx(fileName: string, fontSize: number, fontChars: number, glyphCount: number): Font + /** Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height */ + export function LoadFontEx(fileName: string, fontSize: number, codepoints: number, codepointCount: number): Font /** Load font from Image (XNA style) */ export function LoadFontFromImage(image: Image, key: Color, firstChar: number): Font /** Load font from memory buffer, fileType refers to extension: i.e. '.ttf' */ - export function LoadFontFromMemory(fileType: string, fileData: Buffer, dataSize: number, fontSize: number, fontChars: number, glyphCount: number): Font + export function LoadFontFromMemory(fileType: string, fileData: Buffer, dataSize: number, fontSize: number, codepoints: number, codepointCount: number): Font - /** Check if a font is ready */ - export function IsFontReady(font: Font): boolean + /** Check if a font is valid (font data loaded, WARNING: GPU texture not checked) */ + export function IsFontValid(font: Font): boolean /** Load font data for further use */ - export function LoadFontData(fileData: Buffer, dataSize: number, fontSize: number, fontChars: number, glyphCount: number, type: number): number + export function LoadFontData(fileData: Buffer, dataSize: number, fontSize: number, codepoints: number, codepointCount: number, type: number): number /** Generate image font atlas using chars info */ - export function GenImageFontAtlas(chars: number, recs: number, glyphCount: number, fontSize: number, padding: number, packMethod: number): Image + export function GenImageFontAtlas(glyphs: number, glyphRecs: number, glyphCount: number, fontSize: number, padding: number, packMethod: number): Image /** Unload font chars info data (RAM) */ - export function UnloadFontData(chars: number, glyphCount: number): void + export function UnloadFontData(glyphs: number, glyphCount: number): void /** Unload font from GPU memory (VRAM) */ export function UnloadFont(font: Font): void @@ -1496,7 +1677,10 @@ declare module "raylib" { export function DrawTextCodepoint(font: Font, codepoint: number, position: Vector2, fontSize: number, tint: Color): void /** Draw multiple character (codepoint) */ - export function DrawTextCodepoints(font: Font, codepoints: number, count: number, position: Vector2, fontSize: number, spacing: number, tint: Color): void + export function DrawTextCodepoints(font: Font, codepoints: number, codepointCount: number, position: Vector2, fontSize: number, spacing: number, tint: Color): void + + /** Set vertical line spacing when drawing with line-breaks */ + export function SetTextLineSpacing(spacing: number): void /** Measure string width for default font */ export function MeasureText(text: string, fontSize: number): number @@ -1579,9 +1763,18 @@ declare module "raylib" { /** Get Pascal case notation version of provided string */ export function TextToPascal(text: string): string + /** Get Snake case notation version of provided string */ + export function TextToSnake(text: string): string + + /** Get Camel case notation version of provided string */ + export function TextToCamel(text: string): string + /** Get integer value from text (negative values not supported) */ export function TextToInteger(text: string): number + /** Get float value from text (negative values not supported) */ + export function TextToFloat(text: string): number + /** Draw a line in 3D world space */ export function DrawLine3D(startPos: Vector3, endPos: Vector3, color: Color): void @@ -1651,8 +1844,8 @@ declare module "raylib" { /** Load model from generated mesh (default material) */ export function LoadModelFromMesh(mesh: Mesh): Model - /** Check if a model is ready */ - export function IsModelReady(model: Model): boolean + /** Check if a model is valid (loaded in GPU, VAO/VBOs) */ + export function IsModelValid(model: Model): boolean /** Unload model (including meshes) from memory (RAM and/or VRAM) */ export function UnloadModel(model: Model): void @@ -1672,11 +1865,17 @@ declare module "raylib" { /** Draw a model wires (with texture if set) with extended parameters */ export function DrawModelWiresEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: number, scale: Vector3, tint: Color): void + /** Draw a model as points */ + export function DrawModelPoints(model: Model, position: Vector3, scale: number, tint: Color): void + + /** Draw a model as points with extended parameters */ + export function DrawModelPointsEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: number, scale: Vector3, tint: Color): void + /** Draw bounding box (wires) */ export function DrawBoundingBox(box: BoundingBox, color: Color): void /** Draw a billboard texture */ - export function DrawBillboard(camera: Camera3D, texture: Texture, position: Vector3, size: number, tint: Color): void + export function DrawBillboard(camera: Camera3D, texture: Texture, position: Vector3, scale: number, tint: Color): void /** Draw a billboard texture defined by source */ export function DrawBillboardRec(camera: Camera3D, texture: Texture, source: Rectangle, position: Vector3, size: Vector2, tint: Color): void @@ -1693,15 +1892,18 @@ declare module "raylib" { /** Unload mesh data from CPU and GPU */ export function UnloadMesh(mesh: Mesh): void - /** Export mesh data to file, returns true on success */ - export function ExportMesh(mesh: Mesh, fileName: string): boolean - /** Compute mesh bounding box limits */ export function GetMeshBoundingBox(mesh: Mesh): BoundingBox /** Compute mesh tangents */ export function GenMeshTangents(mesh: Mesh): void + /** Export mesh data to file, returns true on success */ + export function ExportMesh(mesh: Mesh, fileName: string): boolean + + /** Export mesh as code file (.h) defining multiple arrays of vertex attributes */ + export function ExportMeshAsCode(mesh: Mesh, fileName: string): boolean + /** Generate polygonal mesh */ export function GenMeshPoly(sides: number, radius: number): Mesh @@ -1741,14 +1943,17 @@ declare module "raylib" { /** Load model animations from file */ export function LoadModelAnimations(fileName: string, animCount: number): number - /** Update model animation pose */ + /** Update model animation pose (CPU) */ export function UpdateModelAnimation(model: Model, anim: ModelAnimation, frame: number): void + /** Update model animation mesh bone matrices (GPU skinning) */ + export function UpdateModelAnimationBones(model: Model, anim: ModelAnimation, frame: number): void + /** Unload animation data */ export function UnloadModelAnimation(anim: ModelAnimation): void /** Unload animation array data */ - export function UnloadModelAnimations(animations: number, count: number): void + export function UnloadModelAnimations(animations: number, animCount: number): void /** Check model animation skeleton match */ export function IsModelAnimationValid(model: Model, anim: ModelAnimation): boolean @@ -1789,14 +1994,17 @@ declare module "raylib" { /** Set master volume (listener) */ export function SetMasterVolume(volume: number): void + /** Get master volume (listener) */ + export function GetMasterVolume(): number + /** Load wave data from file */ export function LoadWave(fileName: string): Wave /** Load wave from memory buffer, fileType refers to extension: i.e. '.wav' */ export function LoadWaveFromMemory(fileType: string, fileData: Buffer, dataSize: number): Wave - /** Checks if wave data is ready */ - export function IsWaveReady(wave: Wave): boolean + /** Checks if wave data is valid (data loaded and parameters) */ + export function IsWaveValid(wave: Wave): boolean /** Load sound from file */ export function LoadSound(fileName: string): Sound @@ -1804,8 +2012,11 @@ declare module "raylib" { /** Load sound from wave data */ export function LoadSoundFromWave(wave: Wave): Sound - /** Checks if a sound is ready */ - export function IsSoundReady(sound: Sound): boolean + /** Create a new sound that shares the same sample data as the source sound, does not own the sound data */ + export function LoadSoundAlias(source: Sound): Sound + + /** Checks if a sound is valid (data loaded and buffers initialized) */ + export function IsSoundValid(sound: Sound): boolean /** Update sound buffer with new data */ export function UpdateSound(sound: Sound, data: number, sampleCount: number): void @@ -1816,6 +2027,9 @@ declare module "raylib" { /** Unload sound */ export function UnloadSound(sound: Sound): void + /** Unload a sound alias (does not deallocate sample data) */ + export function UnloadSoundAlias(alias: Sound): void + /** Export wave data to file, returns true on success */ export function ExportWave(wave: Wave, fileName: string): boolean @@ -1849,8 +2063,8 @@ declare module "raylib" { /** Copy a wave to a new wave */ export function WaveCopy(wave: Wave): Wave - /** Crop a wave to defined samples range */ - export function WaveCrop(wave: Wave, initSample: number, finalSample: number): void + /** Crop a wave to defined frames range */ + export function WaveCrop(wave: Wave, initFrame: number, finalFrame: number): void /** Convert wave data to desired format */ export function WaveFormat(wave: Wave, sampleRate: number, sampleSize: number, channels: number): void @@ -1867,8 +2081,8 @@ declare module "raylib" { /** Load music stream from data */ export function LoadMusicStreamFromMemory(fileType: string, data: Buffer, dataSize: number): Music - /** Checks if a music stream is ready */ - export function IsMusicReady(music: Music): boolean + /** Checks if a music stream is valid (context and buffers initialized) */ + export function IsMusicValid(music: Music): boolean /** Unload music stream */ export function UnloadMusicStream(music: Music): void @@ -1912,8 +2126,8 @@ declare module "raylib" { /** Load audio stream (to stream raw audio pcm data) */ export function LoadAudioStream(sampleRate: number, sampleSize: number, channels: number): AudioStream - /** Checks if an audio stream is ready */ - export function IsAudioStreamReady(stream: AudioStream): boolean + /** Checks if an audio stream is valid (buffers initialized) */ + export function IsAudioStreamValid(stream: AudioStream): boolean /** Unload audio stream and free memory */ export function UnloadAudioStream(stream: AudioStream): void @@ -2116,6 +2330,12 @@ declare module "raylib" { /** */ export function Vector2Reflect(v: Vector2, normal: Vector2): Vector2 + /** */ + export function Vector2Min(v1: Vector2, v2: Vector2): Vector2 + + /** */ + export function Vector2Max(v1: Vector2, v2: Vector2): Vector2 + /** */ export function Vector2Rotate(v: Vector2, angle: number): Vector2 @@ -2134,6 +2354,9 @@ declare module "raylib" { /** */ export function Vector2Equals(p: Vector2, q: Vector2): number + /** */ + export function Vector2Refract(v: Vector2, n: Vector2, r: number): Vector2 + /** */ export function Vector3Zero(): Vector3 @@ -2191,6 +2414,12 @@ declare module "raylib" { /** */ export function Vector3Normalize(v: Vector3): Vector3 + /** */ + export function Vector3Project(v1: Vector3, v2: Vector3): Vector3 + + /** */ + export function Vector3Reject(v1: Vector3, v2: Vector3): Vector3 + /** */ export function Vector3OrthoNormalize(v1: number, v2: number): void @@ -2203,9 +2432,15 @@ declare module "raylib" { /** */ export function Vector3RotateByAxisAngle(v: Vector3, axis: Vector3, angle: number): Vector3 + /** */ + export function Vector3MoveTowards(v: Vector3, target: Vector3, maxDistance: number): Vector3 + /** */ export function Vector3Lerp(v1: Vector3, v2: Vector3, amount: number): Vector3 + /** */ + export function Vector3CubicHermite(v1: Vector3, tangent1: Vector3, v2: Vector3, tangent2: Vector3, amount: number): Vector3 + /** */ export function Vector3Reflect(v: Vector3, normal: Vector3): Vector3 @@ -2236,6 +2471,72 @@ declare module "raylib" { /** */ export function Vector3Refract(v: Vector3, n: Vector3, r: number): Vector3 + /** */ + export function Vector4Zero(): Vector4 + + /** */ + export function Vector4One(): Vector4 + + /** */ + export function Vector4Add(v1: Vector4, v2: Vector4): Vector4 + + /** */ + export function Vector4AddValue(v: Vector4, add: number): Vector4 + + /** */ + export function Vector4Subtract(v1: Vector4, v2: Vector4): Vector4 + + /** */ + export function Vector4SubtractValue(v: Vector4, add: number): Vector4 + + /** */ + export function Vector4Length(v: Vector4): number + + /** */ + export function Vector4LengthSqr(v: Vector4): number + + /** */ + export function Vector4DotProduct(v1: Vector4, v2: Vector4): number + + /** */ + export function Vector4Distance(v1: Vector4, v2: Vector4): number + + /** */ + export function Vector4DistanceSqr(v1: Vector4, v2: Vector4): number + + /** */ + export function Vector4Scale(v: Vector4, scale: number): Vector4 + + /** */ + export function Vector4Multiply(v1: Vector4, v2: Vector4): Vector4 + + /** */ + export function Vector4Negate(v: Vector4): Vector4 + + /** */ + export function Vector4Divide(v1: Vector4, v2: Vector4): Vector4 + + /** */ + export function Vector4Normalize(v: Vector4): Vector4 + + /** */ + export function Vector4Min(v1: Vector4, v2: Vector4): Vector4 + + /** */ + export function Vector4Max(v1: Vector4, v2: Vector4): Vector4 + + /** */ + export function Vector4Lerp(v1: Vector4, v2: Vector4, amount: number): Vector4 + + /** */ + export function Vector4MoveTowards(v: Vector4, target: Vector4, maxDistance: number): Vector4 + + /** */ + export function Vector4Invert(v: Vector4): Vector4 + + /** */ + export function Vector4Equals(p: Vector4, q: Vector4): number + /** */ export function MatrixDeterminant(mat: Matrix): number @@ -2285,13 +2586,13 @@ declare module "raylib" { export function MatrixScale(x: number, y: number, z: number): Matrix /** */ - export function MatrixFrustum(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix + export function MatrixFrustum(left: number, right: number, bottom: number, top: number, nearPlane: number, farPlane: number): Matrix /** */ - export function MatrixPerspective(fovy: number, aspect: number, near: number, far: number): Matrix + export function MatrixPerspective(fovY: number, aspect: number, nearPlane: number, farPlane: number): Matrix /** */ - export function MatrixOrtho(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix + export function MatrixOrtho(left: number, right: number, bottom: number, top: number, nearPlane: number, farPlane: number): Matrix /** */ export function MatrixLookAt(eye: Vector3, target: Vector3, up: Vector3): Matrix @@ -2338,6 +2639,9 @@ declare module "raylib" { /** */ export function QuaternionSlerp(q1: Quaternion, q2: Quaternion, amount: number): Quaternion + /** */ + export function QuaternionCubicHermiteSpline(q1: Quaternion, outTangent1: Quaternion, q2: Quaternion, inTangent2: Quaternion, t: number): Quaternion + /** */ export function QuaternionFromVector3ToVector3(from: Vector3, to: Vector3): Quaternion @@ -2365,6 +2669,9 @@ declare module "raylib" { /** */ export function QuaternionEquals(p: Quaternion, q: Quaternion): number + /** */ + export function MatrixDecompose(mat: Matrix, translation: number, rotation: number, scale: number): void + /** Enable gui controls (global state) */ export function GuiEnable(): void @@ -2381,7 +2688,7 @@ declare module "raylib" { export function GuiIsLocked(): boolean /** Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f */ - export function GuiFade(alpha: number): void + export function GuiSetAlpha(alpha: number): void /** Set gui state (global state) */ export function GuiSetState(state: number): void @@ -2401,83 +2708,116 @@ declare module "raylib" { /** Get one style property */ export function GuiGetStyle(control: number, property: number): number + /** Load style file over global style variable (.rgs) */ + export function GuiLoadStyle(fileName: string): void + + /** Load style default over global style */ + export function GuiLoadStyleDefault(): void + + /** Enable gui tooltips (global state) */ + export function GuiEnableTooltip(): void + + /** Disable gui tooltips (global state) */ + export function GuiDisableTooltip(): void + + /** Set tooltip string */ + export function GuiSetTooltip(tooltip: string): void + + /** Get text with icon id prepended (if supported) */ + export function GuiIconText(iconId: number, text: string): string + + /** Set default icon drawing size */ + export function GuiSetIconScale(scale: number): void + + /** Get raygui icons data pointer */ + export function GuiGetIcons(): number + + /** Load raygui icons file (.rgi) into internal icons data */ + export function GuiLoadIcons(fileName: string, loadIconsName: boolean): number + + /** Draw icon using pixel size at specified position */ + export function GuiDrawIcon(iconId: number, posX: number, posY: number, pixelSize: number, color: Color): void + /** Window Box control, shows a window that can be closed */ - export function GuiWindowBox(bounds: Rectangle, title: string): boolean + export function GuiWindowBox(bounds: Rectangle, title: string): number /** Group Box control with text name */ - export function GuiGroupBox(bounds: Rectangle, text: string): void + export function GuiGroupBox(bounds: Rectangle, text: string): number /** Line separator control, could contain text */ - export function GuiLine(bounds: Rectangle, text: string): void + export function GuiLine(bounds: Rectangle, text: string): number /** Panel control, useful to group controls */ - export function GuiPanel(bounds: Rectangle, text: string): void + export function GuiPanel(bounds: Rectangle, text: string): number /** Tab Bar control, returns TAB to be closed or -1 */ export function GuiTabBar(bounds: Rectangle, text: number, count: number, active: number): number /** Scroll Panel control */ - export function GuiScrollPanel(bounds: Rectangle, text: string, content: Rectangle, scroll: number): Rectangle + export function GuiScrollPanel(bounds: Rectangle, text: string, content: Rectangle, scroll: number, view: number): number - /** Label control, shows text */ - export function GuiLabel(bounds: Rectangle, text: string): void + /** Label control */ + export function GuiLabel(bounds: Rectangle, text: string): number /** Button control, returns true when clicked */ - export function GuiButton(bounds: Rectangle, text: string): boolean + export function GuiButton(bounds: Rectangle, text: string): number - /** Label button control, show true when clicked */ - export function GuiLabelButton(bounds: Rectangle, text: string): boolean + /** Label button control, returns true when clicked */ + export function GuiLabelButton(bounds: Rectangle, text: string): number - /** Toggle Button control, returns true when active */ - export function GuiToggle(bounds: Rectangle, text: string, active: boolean): boolean + /** Toggle Button control */ + export function GuiToggle(bounds: Rectangle, text: string, active: number): number - /** Toggle Group control, returns active toggle index */ + /** Toggle Group control */ export function GuiToggleGroup(bounds: Rectangle, text: string, active: number): number + /** Toggle Slider control */ + export function GuiToggleSlider(bounds: Rectangle, text: string, active: number): number + /** Check Box control, returns true when active */ - export function GuiCheckBox(bounds: Rectangle, text: string, checked: boolean): boolean + export function GuiCheckBox(bounds: Rectangle, text: string, checked: number): number - /** Combo Box control, returns selected item index */ + /** Combo Box control */ export function GuiComboBox(bounds: Rectangle, text: string, active: number): number - /** Dropdown Box control, returns selected item */ - export function GuiDropdownBox(bounds: Rectangle, text: string, active: number, editMode: boolean): boolean + /** Dropdown Box control */ + export function GuiDropdownBox(bounds: Rectangle, text: string, active: number, editMode: boolean): number - /** Spinner control, returns selected value */ - export function GuiSpinner(bounds: Rectangle, text: string, value: number, minValue: number, maxValue: number, editMode: boolean): boolean + /** Spinner control */ + export function GuiSpinner(bounds: Rectangle, text: string, value: number, minValue: number, maxValue: number, editMode: boolean): number /** Value Box control, updates input text with numbers */ - export function GuiValueBox(bounds: Rectangle, text: string, value: number, minValue: number, maxValue: number, editMode: boolean): boolean + export function GuiValueBox(bounds: Rectangle, text: string, value: number, minValue: number, maxValue: number, editMode: boolean): number - /** Text Box control, updates input text */ - export function GuiTextBox(bounds: Rectangle, text: string, textSize: number, editMode: boolean): boolean + /** Value box control for float values */ + export function GuiValueBoxFloat(bounds: Rectangle, text: string, textValue: string, value: number, editMode: boolean): number - /** Text Box control with multiple lines */ - export function GuiTextBoxMulti(bounds: Rectangle, text: string, textSize: number, editMode: boolean): boolean + /** Text Box control, updates input text */ + export function GuiTextBox(bounds: Rectangle, text: string, textSize: number, editMode: boolean): number - /** Slider control, returns selected value */ + /** Slider control */ export function GuiSlider(bounds: Rectangle, textLeft: string, textRight: string, value: number, minValue: number, maxValue: number): number - /** Slider Bar control, returns selected value */ + /** Slider Bar control */ export function GuiSliderBar(bounds: Rectangle, textLeft: string, textRight: string, value: number, minValue: number, maxValue: number): number - /** Progress Bar control, shows current progress value */ + /** Progress Bar control */ export function GuiProgressBar(bounds: Rectangle, textLeft: string, textRight: string, value: number, minValue: number, maxValue: number): number /** Status Bar control, shows info text */ - export function GuiStatusBar(bounds: Rectangle, text: string): void + export function GuiStatusBar(bounds: Rectangle, text: string): number /** Dummy control for placeholders */ - export function GuiDummyRec(bounds: Rectangle, text: string): void + export function GuiDummyRec(bounds: Rectangle, text: string): number - /** Grid control, returns mouse cell position */ - export function GuiGrid(bounds: Rectangle, text: string, spacing: number, subdivs: number): Vector2 + /** Grid control */ + export function GuiGrid(bounds: Rectangle, text: string, spacing: number, subdivs: number, mouseCell: number): number - /** List View control, returns selected list item index */ + /** List View control */ export function GuiListView(bounds: Rectangle, text: string, scrollIndex: number, active: number): number /** List View with extended parameters */ - export function GuiListViewEx(bounds: Rectangle, text: number, count: number, focus: number, scrollIndex: number, active: number): number + export function GuiListViewEx(bounds: Rectangle, text: number, count: number, scrollIndex: number, active: number, focus: number): number /** Message Box control, displays a message */ export function GuiMessageBox(bounds: Rectangle, title: string, message: string, buttons: string): number @@ -2486,10 +2826,10 @@ declare module "raylib" { export function GuiTextInputBox(bounds: Rectangle, title: string, message: string, buttons: string, text: string, textMaxSize: number, secretViewActive: number): number /** Color Picker control (multiple color controls) */ - export function GuiColorPicker(bounds: Rectangle, text: string, color: Color): Color + export function GuiColorPicker(bounds: Rectangle, text: string, color: number): number /** Color Panel control */ - export function GuiColorPanel(bounds: Rectangle, text: string, color: Color): Color + export function GuiColorPanel(bounds: Rectangle, text: string, color: number): number /** Color Bar Alpha control */ export function GuiColorBarAlpha(bounds: Rectangle, text: string, alpha: number): number @@ -2497,35 +2837,11 @@ declare module "raylib" { /** Color Bar Hue control */ export function GuiColorBarHue(bounds: Rectangle, text: string, value: number): number - /** Load style file over global style variable (.rgs) */ - export function GuiLoadStyle(fileName: string): void - - /** Load style default over global style */ - export function GuiLoadStyleDefault(): void - - /** Enable gui tooltips (global state) */ - export function GuiEnableTooltip(): void - - /** Disable gui tooltips (global state) */ - export function GuiDisableTooltip(): void - - /** Set tooltip string */ - export function GuiSetTooltip(tooltip: string): void - - /** Get text with icon id prepended (if supported) */ - export function GuiIconText(iconId: number, text: string): string + /** Color Picker control that avoids conversion to RGB on each call (multiple color controls) */ + export function GuiColorPickerHSV(bounds: Rectangle, text: string, colorHsv: number): number - /** Get raygui icons data pointer */ - export function GuiGetIcons(): number - - /** Load raygui icons file (.rgi) into internal icons data */ - export function GuiLoadIcons(fileName: string, loadIconsName: boolean): number - - /** */ - export function GuiDrawIcon(iconId: number, posX: number, posY: number, pixelSize: number, color: Color): void - - /** Set icon drawing size */ - export function GuiSetIconScale(scale: number): void + /** Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV() */ + export function GuiColorPanelHSV(bounds: Rectangle, text: string, colorHsv: number): number /** Choose the current matrix to be transformed */ export function rlMatrixMode(mode: number): void @@ -2560,6 +2876,15 @@ declare module "raylib" { /** Set the viewport area */ export function rlViewport(x: number, y: number, width: number, height: number): void + /** Set clip planes distances */ + export function rlSetClipPlanes(nearPlane: number, farPlane: number): void + + /** Get cull plane distance near */ + export function rlGetCullDistanceNear(): number + + /** Get cull plane distance far */ + export function rlGetCullDistanceFar(): number + /** Initialize drawing mode (how to organize vertex) */ export function rlBegin(mode: number): void @@ -2647,9 +2972,18 @@ declare module "raylib" { /** Disable render texture (fbo), return to default framebuffer */ export function rlDisableFramebuffer(): void + /** Get the currently active render texture (fbo), 0 for default framebuffer */ + export function rlGetActiveFramebuffer(): number + /** Activate multiple draw color buffers */ export function rlActiveDrawBuffers(count: number): void + /** Blit active framebuffer to main framebuffer */ + export function rlBlitFramebuffer(srcX: number, srcY: number, srcWidth: number, srcHeight: number, dstX: number, dstY: number, dstWidth: number, dstHeight: number, bufferMask: number): void + + /** Bind framebuffer (FBO) */ + export function rlBindFramebuffer(target: number, framebuffer: number): void + /** Enable color blending */ export function rlEnableColorBlend(): void @@ -2674,6 +3008,9 @@ declare module "raylib" { /** Disable backface culling */ export function rlDisableBackfaceCulling(): void + /** Color mask control */ + export function rlColorMask(r: boolean, g: boolean, b: boolean, a: boolean): void + /** Set face culling mode */ export function rlSetCullFace(mode: number): void @@ -2689,7 +3026,10 @@ declare module "raylib" { /** Enable wire mode */ export function rlEnableWireMode(): void - /** Disable wire mode */ + /** Enable point mode */ + export function rlEnablePointMode(): void + + /** Disable wire (and point) mode */ export function rlDisableWireMode(): void /** Set the line drawing width */ @@ -2788,55 +3128,55 @@ declare module "raylib" { /** Load vertex array (vao) if supported */ export function rlLoadVertexArray(): number - /** Load a vertex buffer attribute */ + /** Load a vertex buffer object */ export function rlLoadVertexBuffer(buffer: number, size: number, dynamic: boolean): number - /** Load a new attributes element buffer */ + /** Load vertex buffer elements object */ export function rlLoadVertexBufferElement(buffer: number, size: number, dynamic: boolean): number - /** Update GPU buffer with new data */ + /** Update vertex buffer object data on GPU buffer */ export function rlUpdateVertexBuffer(bufferId: number, data: number, dataSize: number, offset: number): void - /** Update vertex buffer elements with new data */ + /** Update vertex buffer elements data on GPU buffer */ export function rlUpdateVertexBufferElements(id: number, data: number, dataSize: number, offset: number): void - /** */ + /** Unload vertex array (vao) */ export function rlUnloadVertexArray(vaoId: number): void - /** */ + /** Unload vertex buffer object */ export function rlUnloadVertexBuffer(vboId: number): void - /** */ - export function rlSetVertexAttribute(index: number, compSize: number, type: number, normalized: boolean, stride: number, pointer: number): void + /** Set vertex attribute data configuration */ + export function rlSetVertexAttribute(index: number, compSize: number, type: number, normalized: boolean, stride: number, offset: number): void - /** */ + /** Set vertex attribute data divisor */ export function rlSetVertexAttributeDivisor(index: number, divisor: number): void - /** Set vertex attribute default value */ + /** Set vertex attribute default value, when attribute to provided */ export function rlSetVertexAttributeDefault(locIndex: number, value: number, attribType: number, count: number): void - /** */ + /** Draw vertex array (currently active vao) */ export function rlDrawVertexArray(offset: number, count: number): void - /** */ + /** Draw vertex array elements */ export function rlDrawVertexArrayElements(offset: number, count: number, buffer: number): void - /** */ + /** Draw vertex array (currently active vao) with instancing */ export function rlDrawVertexArrayInstanced(offset: number, count: number, instances: number): void - /** */ + /** Draw vertex array elements with instancing */ export function rlDrawVertexArrayElementsInstanced(offset: number, count: number, buffer: number, instances: number): void - /** Load texture in GPU */ + /** Load texture data */ export function rlLoadTexture(data: number, width: number, height: number, format: number, mipmapCount: number): number /** Load depth texture/renderbuffer (to be attached to fbo) */ export function rlLoadTextureDepth(width: number, height: number, useRenderBuffer: boolean): number - /** Load texture cubemap */ - export function rlLoadTextureCubemap(data: number, size: number, format: number): number + /** Load texture cubemap data */ + export function rlLoadTextureCubemap(data: number, size: number, format: number, mipmapCount: number): number - /** Update GPU texture with new data */ + /** Update texture with new data on GPU */ export function rlUpdateTexture(id: number, offsetX: number, offsetY: number, width: number, height: number, format: number, data: number): void /** Get OpenGL internal formats */ @@ -2858,7 +3198,7 @@ declare module "raylib" { export function rlReadScreenPixels(width: number, height: number): Buffer /** Load an empty framebuffer */ - export function rlLoadFramebuffer(width: number, height: number): number + export function rlLoadFramebuffer(): number /** Attach texture/renderbuffer to a framebuffer */ export function rlFramebufferAttach(fboId: number, texId: number, attachType: number, texType: number, mipLevel: number): void @@ -2893,6 +3233,9 @@ declare module "raylib" { /** Set shader value matrix */ export function rlSetUniformMatrix(locIndex: number, mat: Matrix): void + /** Set shader value matrices */ + export function rlSetUniformMatrices(locIndex: number, mat: number, count: number): void + /** Set shader value sampler */ export function rlSetUniformSampler(locIndex: number, textureId: number): void @@ -2974,6 +3317,35 @@ declare module "raylib" { /** Set shader uniform Vec4 */ export function SetShaderVec4(shader: Shader, locIndex: number, value: Vector4): void + export function Camera3D( + /** Camera position. (Vector3) */ + position: Vector3, + /** Camera target it looks-at. (Vector3) */ + target: Vector3, + /** Camera up vector (rotation over its axis). (Vector3) */ + up: Vector3, + /** Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic. (float) */ + fovy: number, + /** Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC. (int) */ + projection: number, + ): Camera3D + + export function Vector3( + /** Vector x component. (float) */ + x: number, + /** Vector y component. (float) */ + y: number, + /** Vector z component. (float) */ + z: number, + ): Vector3 + + export function Vector2( + /** Vector x component. (float) */ + x: number, + /** Vector y component. (float) */ + y: number, + ): Vector2 + /** Set to try enabling V-Sync on GPU */ export const FLAG_VSYNC_HINT = 64 /** Set to run program in fullscreen */ @@ -3000,6 +3372,8 @@ declare module "raylib" { export const FLAG_WINDOW_HIGHDPI = 8192 /** Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED */ export const FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384 + /** Set to run program in borderless windowed mode */ + export const FLAG_BORDERLESS_WINDOWED_MODE = 32768 /** Set to try enabling MSAA 4X */ export const FLAG_MSAA_4X_HINT = 32 /** Set to try enabling interlaced video format (for V3D) */ @@ -3235,7 +3609,7 @@ declare module "raylib" { /** Key: Android back button */ export const KEY_BACK = 4 /** Key: Android menu button */ - export const KEY_MENU = 82 + export const KEY_MENU = 5 /** Key: Android volume up button */ export const KEY_VOLUME_UP = 24 /** Key: Android volume down button */ @@ -3288,17 +3662,17 @@ declare module "raylib" { export const GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4 /** Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) */ export const GAMEPAD_BUTTON_RIGHT_FACE_UP = 5 - /** Gamepad right button right (i.e. PS3: Square, Xbox: X) */ + /** Gamepad right button right (i.e. PS3: Circle, Xbox: B) */ export const GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6 /** Gamepad right button down (i.e. PS3: Cross, Xbox: A) */ export const GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7 - /** Gamepad right button left (i.e. PS3: Circle, Xbox: B) */ + /** Gamepad right button left (i.e. PS3: Square, Xbox: X) */ export const GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8 /** Gamepad top/back trigger left (first), it could be a trailing button */ export const GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9 /** Gamepad top/back trigger left (second), it could be a trailing button */ export const GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10 - /** Gamepad top/back trigger right (one), it could be a trailing button */ + /** Gamepad top/back trigger right (first), it could be a trailing button */ export const GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11 /** Gamepad top/back trigger right (second), it could be a trailing button */ export const GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12 @@ -3398,6 +3772,12 @@ declare module "raylib" { export const SHADER_LOC_MAP_PREFILTER = 24 /** Shader location: sampler2d texture: brdf */ export const SHADER_LOC_MAP_BRDF = 25 + /** Shader location: vertex attribute: boneIds */ + export const SHADER_LOC_VERTEX_BONEIDS = 26 + /** Shader location: vertex attribute: boneWeights */ + export const SHADER_LOC_VERTEX_BONEWEIGHTS = 27 + /** Shader location: array of matrices uniform: boneMatrices */ + export const SHADER_LOC_BONE_MATRICES = 28 /** Shader uniform type: float */ export const SHADER_UNIFORM_FLOAT = 0 /** Shader uniform type: vec2 (2 float) */ @@ -3444,28 +3824,34 @@ declare module "raylib" { export const PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 /** 32*4 bpp (4 channels - float) */ export const PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 + /** 16 bpp (1 channel - half float) */ + export const PIXELFORMAT_UNCOMPRESSED_R16 = 11 + /** 16*3 bpp (3 channels - half float) */ + export const PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12 + /** 16*4 bpp (4 channels - half float) */ + export const PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13 /** 4 bpp (no alpha) */ - export const PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 + export const PIXELFORMAT_COMPRESSED_DXT1_RGB = 14 /** 4 bpp (1 bit alpha) */ - export const PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 + export const PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15 /** 8 bpp */ - export const PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 + export const PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16 /** 8 bpp */ - export const PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 + export const PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17 /** 4 bpp */ - export const PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 + export const PIXELFORMAT_COMPRESSED_ETC1_RGB = 18 /** 4 bpp */ - export const PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 + export const PIXELFORMAT_COMPRESSED_ETC2_RGB = 19 /** 8 bpp */ - export const PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 + export const PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20 /** 4 bpp */ - export const PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 + export const PIXELFORMAT_COMPRESSED_PVRT_RGB = 21 /** 4 bpp */ - export const PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 + export const PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22 /** 8 bpp */ - export const PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 + export const PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23 /** 2 bpp */ - export const PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 + export const PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24 /** No filter, just pixel approximation */ export const TEXTURE_FILTER_POINT = 0 /** Linear filtering */ @@ -3496,8 +3882,6 @@ declare module "raylib" { export const CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 /** Layout is defined by a 4x3 cross with cubemap faces */ export const CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 - /** Layout is defined by a panorama image (equirrectangular map) */ - export const CUBEMAP_LAYOUT_PANORAMA = 5 /** Default font generation, anti-aliased */ export const FONT_DEFAULT = 0 /** Bitmap font generation, no anti-aliasing */ @@ -3542,15 +3926,15 @@ declare module "raylib" { export const GESTURE_PINCH_IN = 256 /** Pinch out gesture */ export const GESTURE_PINCH_OUT = 512 - /** Custom camera */ + /** Camera custom, controlled by user (UpdateCamera() does nothing) */ export const CAMERA_CUSTOM = 0 - /** Free camera */ + /** Camera free mode */ export const CAMERA_FREE = 1 - /** Orbital camera */ + /** Camera orbital, around target, zoom supported */ export const CAMERA_ORBITAL = 2 - /** First person camera */ + /** Camera first person */ export const CAMERA_FIRST_PERSON = 3 - /** Third person camera */ + /** Camera third person */ export const CAMERA_THIRD_PERSON = 4 /** Perspective projection */ export const CAMERA_PERSPECTIVE = 0 @@ -3577,6 +3961,18 @@ declare module "raylib" { /** */ export const TEXT_ALIGN_RIGHT = 2 /** */ + export const TEXT_ALIGN_TOP = 0 + /** */ + export const TEXT_ALIGN_MIDDLE = 1 + /** */ + export const TEXT_ALIGN_BOTTOM = 2 + /** */ + export const TEXT_WRAP_NONE = 0 + /** */ + export const TEXT_WRAP_CHAR = 1 + /** */ + export const TEXT_WRAP_WORD = 2 + /** */ export const DEFAULT = 0 /** Used also for: LABELBUTTON */ export const LABEL = 1 @@ -3584,7 +3980,7 @@ declare module "raylib" { export const BUTTON = 2 /** Used also for: TOGGLEGROUP */ export const TOGGLE = 3 - /** Used also for: SLIDERBAR */ + /** Used also for: SLIDERBAR, TOGGLESLIDER */ export const SLIDER = 4 /** */ export const PROGRESSBAR = 5 @@ -3608,38 +4004,36 @@ declare module "raylib" { export const SCROLLBAR = 14 /** */ export const STATUSBAR = 15 - /** */ + /** Control border color in STATE_NORMAL */ export const BORDER_COLOR_NORMAL = 0 - /** */ + /** Control base color in STATE_NORMAL */ export const BASE_COLOR_NORMAL = 1 - /** */ + /** Control text color in STATE_NORMAL */ export const TEXT_COLOR_NORMAL = 2 - /** */ + /** Control border color in STATE_FOCUSED */ export const BORDER_COLOR_FOCUSED = 3 - /** */ + /** Control base color in STATE_FOCUSED */ export const BASE_COLOR_FOCUSED = 4 - /** */ + /** Control text color in STATE_FOCUSED */ export const TEXT_COLOR_FOCUSED = 5 - /** */ + /** Control border color in STATE_PRESSED */ export const BORDER_COLOR_PRESSED = 6 - /** */ + /** Control base color in STATE_PRESSED */ export const BASE_COLOR_PRESSED = 7 - /** */ + /** Control text color in STATE_PRESSED */ export const TEXT_COLOR_PRESSED = 8 - /** */ + /** Control border color in STATE_DISABLED */ export const BORDER_COLOR_DISABLED = 9 - /** */ + /** Control base color in STATE_DISABLED */ export const BASE_COLOR_DISABLED = 10 - /** */ + /** Control text color in STATE_DISABLED */ export const TEXT_COLOR_DISABLED = 11 - /** */ + /** Control border size, 0 for no border */ export const BORDER_WIDTH = 12 - /** */ + /** Control text padding, not considering border */ export const TEXT_PADDING = 13 - /** */ + /** Control text horizontal alignment inside control text bound (after border and padding) */ export const TEXT_ALIGNMENT = 14 - /** */ - export const RESERVED = 15 /** Text size (glyphs max height) */ export const TEXT_SIZE = 16 /** Text spacing between glyphs */ @@ -3648,6 +4042,12 @@ declare module "raylib" { export const LINE_COLOR = 18 /** Background color */ export const BACKGROUND_COLOR = 19 + /** Text spacing between lines */ + export const TEXT_LINE_SPACING = 20 + /** Text vertical alignment inside text bounds (after border and padding) */ + export const TEXT_ALIGNMENT_VERTICAL = 21 + /** Text wrap-mode inside text bounds */ + export const TEXT_WRAP_MODE = 22 /** ToggleGroup separation between toggles */ export const GROUP_PADDING = 16 /** Slider size of internal bar */ @@ -3656,17 +4056,17 @@ declare module "raylib" { export const SLIDER_PADDING = 17 /** ProgressBar internal padding */ export const PROGRESS_PADDING = 16 - /** */ + /** ScrollBar arrows size */ export const ARROWS_SIZE = 16 - /** */ + /** ScrollBar arrows visible */ export const ARROWS_VISIBLE = 17 - /** (SLIDERBAR, SLIDER_PADDING) */ + /** ScrollBar slider internal padding */ export const SCROLL_SLIDER_PADDING = 18 - /** */ + /** ScrollBar slider size */ export const SCROLL_SLIDER_SIZE = 19 - /** */ + /** ScrollBar scroll padding from arrows */ export const SCROLL_PADDING = 20 - /** */ + /** ScrollBar scrolling speed */ export const SCROLL_SPEED = 21 /** CheckBox internal check padding */ export const CHECK_PADDING = 16 @@ -3678,10 +4078,12 @@ declare module "raylib" { export const ARROW_PADDING = 16 /** DropdownBox items separation */ export const DROPDOWN_ITEMS_SPACING = 17 - /** TextBox/TextBoxMulti/ValueBox/Spinner inner text padding */ - export const TEXT_INNER_PADDING = 16 - /** TextBoxMulti lines separation */ - export const TEXT_LINES_SPACING = 17 + /** DropdownBox arrow hidden */ + export const DROPDOWN_ARROW_HIDDEN = 18 + /** DropdownBox roll up flag (default rolls down) */ + export const DROPDOWN_ROLL_UP = 19 + /** TextBox in read-only mode: 0-text editable, 1-text no-editable */ + export const TEXT_READONLY = 16 /** Spinner left/right buttons width */ export const SPIN_BUTTON_WIDTH = 16 /** Spinner buttons separation */ @@ -3692,8 +4094,10 @@ declare module "raylib" { export const LIST_ITEMS_SPACING = 17 /** ListView scrollbar size (usually width) */ export const SCROLLBAR_WIDTH = 18 - /** ListView scrollbar side (0-left, 1-right) */ + /** ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) */ export const SCROLLBAR_SIDE = 19 + /** ListView items border width */ + export const LIST_ITEMS_BORDER_WIDTH = 20 /** */ export const COLOR_SELECTOR_SIZE = 16 /** ColorPicker right hue bar width */ @@ -4143,25 +4547,25 @@ declare module "raylib" { /** */ export const ICON_FILE = 218 /** */ - export const ICON_219 = 219 + export const ICON_SAND_TIMER = 219 /** */ - export const ICON_220 = 220 + export const ICON_WARNING = 220 /** */ - export const ICON_221 = 221 + export const ICON_HELP_BOX = 221 /** */ - export const ICON_222 = 222 + export const ICON_INFO_BOX = 222 /** */ - export const ICON_223 = 223 + export const ICON_PRIORITY = 223 /** */ - export const ICON_224 = 224 + export const ICON_LAYERS_ISO = 224 /** */ - export const ICON_225 = 225 + export const ICON_LAYERS2 = 225 /** */ - export const ICON_226 = 226 + export const ICON_MLAYERS = 226 /** */ - export const ICON_227 = 227 + export const ICON_MAPS = 227 /** */ - export const ICON_228 = 228 + export const ICON_HOT = 228 /** */ export const ICON_229 = 229 /** */ @@ -4226,6 +4630,8 @@ declare module "raylib" { export const RL_OPENGL_43 = 4 /** OpenGL ES 2.0 (GLSL 100) */ export const RL_OPENGL_ES_20 = 5 + /** OpenGL ES 3.0 (GLSL 300 es) */ + export const RL_OPENGL_ES_30 = 6 /** Display all logs */ export const RL_LOG_ALL = 0 /** Trace logging, intended for internal use only */ @@ -4262,28 +4668,34 @@ declare module "raylib" { export const RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 /** 32*4 bpp (4 channels - float) */ export const RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 + /** 16 bpp (1 channel - half float) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R16 = 11 + /** 16*3 bpp (3 channels - half float) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12 + /** 16*4 bpp (4 channels - half float) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13 /** 4 bpp (no alpha) */ - export const RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 + export const RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 14 /** 4 bpp (1 bit alpha) */ - export const RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 + export const RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15 /** 8 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 + export const RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16 /** 8 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 + export const RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17 /** 4 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 + export const RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 18 /** 4 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 + export const RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 19 /** 8 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 + export const RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20 /** 4 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 + export const RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 21 /** 4 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 + export const RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22 /** 8 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 + export const RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23 /** 2 bpp */ - export const RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 + export const RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24 /** No filter, just pixel approximation */ export const RL_TEXTURE_FILTER_POINT = 0 /** Linear filtering */ @@ -4380,8 +4792,16 @@ declare module "raylib" { export const RL_SHADER_UNIFORM_IVEC3 = 6 /** Shader uniform type: ivec4 (4 int) */ export const RL_SHADER_UNIFORM_IVEC4 = 7 + /** Shader uniform type: unsigned int */ + export const RL_SHADER_UNIFORM_UINT = 8 + /** Shader uniform type: uivec2 (2 unsigned int) */ + export const RL_SHADER_UNIFORM_UIVEC2 = 9 + /** Shader uniform type: uivec3 (3 unsigned int) */ + export const RL_SHADER_UNIFORM_UIVEC3 = 10 + /** Shader uniform type: uivec4 (4 unsigned int) */ + export const RL_SHADER_UNIFORM_UIVEC4 = 11 /** Shader uniform type: sampler2d */ - export const RL_SHADER_UNIFORM_SAMPLER2D = 8 + export const RL_SHADER_UNIFORM_SAMPLER2D = 12 /** Shader attribute type: float */ export const RL_SHADER_ATTRIB_FLOAT = 0 /** Shader attribute type: vec2 (2 float) */ @@ -4570,6 +4990,28 @@ declare module "raylib" { export const RL_BLEND_SRC_ALPHA = 32971 /** GL_BLEND_COLOR */ export const RL_BLEND_COLOR = 32773 + /** GL_READ_FRAMEBUFFER */ + export const RL_READ_FRAMEBUFFER = 36008 + /** GL_DRAW_FRAMEBUFFER */ + export const RL_DRAW_FRAMEBUFFER = 36009 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION = 0 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD = 1 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL = 2 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR = 3 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT = 4 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 = 5 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES = 6 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS = 7 + /** */ + export const RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS = 8 export const LIGHTGRAY: { r: 200, g: 200, b: 200, a: 255 } export const GRAY: { r: 130, g: 130, b: 130, a: 255 } @@ -4597,4 +5039,6 @@ declare module "raylib" { export const BLANK: { r: 0, g: 0, b: 0, a: 0 } export const MAGENTA: { r: 255, g: 0, b: 255, a: 255 } export const RAYWHITE: { r: 245, g: 245, b: 245, a: 255 } + + } diff --git a/src/generated/node-raylib.js b/src/generated/node-raylib.js index 7b793ae..af52038 100644 --- a/src/generated/node-raylib.js +++ b/src/generated/node-raylib.js @@ -20,7 +20,7 @@ const raylib = {} * * @return {undefined} */ -function InitWindow (width, height, title) { +function InitWindow(width, height, title) { return r.BindInitWindow( width, height, @@ -30,31 +30,31 @@ function InitWindow (width, height, title) { raylib.InitWindow = InitWindow /** - * Check if KEY_ESCAPE pressed or Close icon pressed + * Close window and unload OpenGL context * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function WindowShouldClose () { - return r.BindWindowShouldClose() +function CloseWindow() { + return r.BindCloseWindow() } -raylib.WindowShouldClose = WindowShouldClose +raylib.CloseWindow = CloseWindow /** - * Close window and unload OpenGL context + * Check if application should close (KEY_ESCAPE pressed or windows close icon clicked) * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function CloseWindow () { - return r.BindCloseWindow() +function WindowShouldClose() { + return r.BindWindowShouldClose() } -raylib.CloseWindow = CloseWindow +raylib.WindowShouldClose = WindowShouldClose /** * Check if window has been initialized successfully * * @return {boolean} The resulting bool. */ -function IsWindowReady () { +function IsWindowReady() { return r.BindIsWindowReady() } raylib.IsWindowReady = IsWindowReady @@ -64,47 +64,47 @@ raylib.IsWindowReady = IsWindowReady * * @return {boolean} The resulting bool. */ -function IsWindowFullscreen () { +function IsWindowFullscreen() { return r.BindIsWindowFullscreen() } raylib.IsWindowFullscreen = IsWindowFullscreen /** - * Check if window is currently hidden (only PLATFORM_DESKTOP) + * Check if window is currently hidden * * @return {boolean} The resulting bool. */ -function IsWindowHidden () { +function IsWindowHidden() { return r.BindIsWindowHidden() } raylib.IsWindowHidden = IsWindowHidden /** - * Check if window is currently minimized (only PLATFORM_DESKTOP) + * Check if window is currently minimized * * @return {boolean} The resulting bool. */ -function IsWindowMinimized () { +function IsWindowMinimized() { return r.BindIsWindowMinimized() } raylib.IsWindowMinimized = IsWindowMinimized /** - * Check if window is currently maximized (only PLATFORM_DESKTOP) + * Check if window is currently maximized * * @return {boolean} The resulting bool. */ -function IsWindowMaximized () { +function IsWindowMaximized() { return r.BindIsWindowMaximized() } raylib.IsWindowMaximized = IsWindowMaximized /** - * Check if window is currently focused (only PLATFORM_DESKTOP) + * Check if window is currently focused * * @return {boolean} The resulting bool. */ -function IsWindowFocused () { +function IsWindowFocused() { return r.BindIsWindowFocused() } raylib.IsWindowFocused = IsWindowFocused @@ -114,7 +114,7 @@ raylib.IsWindowFocused = IsWindowFocused * * @return {boolean} The resulting bool. */ -function IsWindowResized () { +function IsWindowResized() { return r.BindIsWindowResized() } raylib.IsWindowResized = IsWindowResized @@ -126,7 +126,7 @@ raylib.IsWindowResized = IsWindowResized * * @return {boolean} The resulting bool. */ -function IsWindowState (flag) { +function IsWindowState(flag) { return r.BindIsWindowState( flag ) @@ -134,13 +134,13 @@ function IsWindowState (flag) { raylib.IsWindowState = IsWindowState /** - * Set window configuration state using flags (only PLATFORM_DESKTOP) + * Set window configuration state using flags * * @param {number} flags * * @return {undefined} */ -function SetWindowState (flags) { +function SetWindowState(flags) { return r.BindSetWindowState( flags ) @@ -154,7 +154,7 @@ raylib.SetWindowState = SetWindowState * * @return {undefined} */ -function ClearWindowState (flags) { +function ClearWindowState(flags) { return r.BindClearWindowState( flags ) @@ -162,53 +162,63 @@ function ClearWindowState (flags) { raylib.ClearWindowState = ClearWindowState /** - * Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP) + * Toggle window state: fullscreen/windowed, resizes monitor to match window resolution * * @return {undefined} */ -function ToggleFullscreen () { +function ToggleFullscreen() { return r.BindToggleFullscreen() } raylib.ToggleFullscreen = ToggleFullscreen /** - * Set window state: maximized, if resizable (only PLATFORM_DESKTOP) + * Toggle window state: borderless windowed, resizes window to match monitor resolution + * + * @return {undefined} + */ +function ToggleBorderlessWindowed() { + return r.BindToggleBorderlessWindowed() +} +raylib.ToggleBorderlessWindowed = ToggleBorderlessWindowed + +/** + * Set window state: maximized, if resizable * * @return {undefined} */ -function MaximizeWindow () { +function MaximizeWindow() { return r.BindMaximizeWindow() } raylib.MaximizeWindow = MaximizeWindow /** - * Set window state: minimized, if resizable (only PLATFORM_DESKTOP) + * Set window state: minimized, if resizable * * @return {undefined} */ -function MinimizeWindow () { +function MinimizeWindow() { return r.BindMinimizeWindow() } raylib.MinimizeWindow = MinimizeWindow /** - * Set window state: not minimized/maximized (only PLATFORM_DESKTOP) + * Set window state: not minimized/maximized * * @return {undefined} */ -function RestoreWindow () { +function RestoreWindow() { return r.BindRestoreWindow() } raylib.RestoreWindow = RestoreWindow /** - * Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP) + * Set icon for window (single image, RGBA 32bit) * * @param {Image} image * * @return {undefined} */ -function SetWindowIcon (image) { +function SetWindowIcon(image) { return r.BindSetWindowIcon( image.data, image.width, @@ -220,14 +230,14 @@ function SetWindowIcon (image) { raylib.SetWindowIcon = SetWindowIcon /** - * Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP) + * Set icon for window (multiple images, RGBA 32bit) * * @param {number} images * @param {number} count * * @return {undefined} */ -function SetWindowIcons (images, count) { +function SetWindowIcons(images, count) { return r.BindSetWindowIcons( images, count @@ -236,13 +246,13 @@ function SetWindowIcons (images, count) { raylib.SetWindowIcons = SetWindowIcons /** - * Set title for window (only PLATFORM_DESKTOP) + * Set title for window * * @param {string} title * * @return {undefined} */ -function SetWindowTitle (title) { +function SetWindowTitle(title) { return r.BindSetWindowTitle( title ) @@ -250,14 +260,14 @@ function SetWindowTitle (title) { raylib.SetWindowTitle = SetWindowTitle /** - * Set window position on screen (only PLATFORM_DESKTOP) + * Set window position on screen * * @param {number} x * @param {number} y * * @return {undefined} */ -function SetWindowPosition (x, y) { +function SetWindowPosition(x, y) { return r.BindSetWindowPosition( x, y @@ -266,13 +276,13 @@ function SetWindowPosition (x, y) { raylib.SetWindowPosition = SetWindowPosition /** - * Set monitor for the current window (fullscreen mode) + * Set monitor for the current window * * @param {number} monitor * * @return {undefined} */ -function SetWindowMonitor (monitor) { +function SetWindowMonitor(monitor) { return r.BindSetWindowMonitor( monitor ) @@ -287,7 +297,7 @@ raylib.SetWindowMonitor = SetWindowMonitor * * @return {undefined} */ -function SetWindowMinSize (width, height) { +function SetWindowMinSize(width, height) { return r.BindSetWindowMinSize( width, height @@ -295,6 +305,22 @@ function SetWindowMinSize (width, height) { } raylib.SetWindowMinSize = SetWindowMinSize +/** + * Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE) + * + * @param {number} width + * @param {number} height + * + * @return {undefined} + */ +function SetWindowMaxSize(width, height) { + return r.BindSetWindowMaxSize( + width, + height + ) +} +raylib.SetWindowMaxSize = SetWindowMaxSize + /** * Set window dimensions * @@ -303,7 +329,7 @@ raylib.SetWindowMinSize = SetWindowMinSize * * @return {undefined} */ -function SetWindowSize (width, height) { +function SetWindowSize(width, height) { return r.BindSetWindowSize( width, height @@ -312,25 +338,35 @@ function SetWindowSize (width, height) { raylib.SetWindowSize = SetWindowSize /** - * Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) + * Set window opacity [0.0f..1.0f] * * @param {number} opacity * * @return {undefined} */ -function SetWindowOpacity (opacity) { +function SetWindowOpacity(opacity) { return r.BindSetWindowOpacity( opacity ) } raylib.SetWindowOpacity = SetWindowOpacity +/** + * Set window focused + * + * @return {undefined} + */ +function SetWindowFocused() { + return r.BindSetWindowFocused() +} +raylib.SetWindowFocused = SetWindowFocused + /** * Get native window handle * * @return {number} The resulting void *. */ -function GetWindowHandle () { +function GetWindowHandle() { return r.BindGetWindowHandle() } raylib.GetWindowHandle = GetWindowHandle @@ -340,7 +376,7 @@ raylib.GetWindowHandle = GetWindowHandle * * @return {number} The resulting int. */ -function GetScreenWidth () { +function GetScreenWidth() { return r.BindGetScreenWidth() } raylib.GetScreenWidth = GetScreenWidth @@ -350,7 +386,7 @@ raylib.GetScreenWidth = GetScreenWidth * * @return {number} The resulting int. */ -function GetScreenHeight () { +function GetScreenHeight() { return r.BindGetScreenHeight() } raylib.GetScreenHeight = GetScreenHeight @@ -360,7 +396,7 @@ raylib.GetScreenHeight = GetScreenHeight * * @return {number} The resulting int. */ -function GetRenderWidth () { +function GetRenderWidth() { return r.BindGetRenderWidth() } raylib.GetRenderWidth = GetRenderWidth @@ -370,7 +406,7 @@ raylib.GetRenderWidth = GetRenderWidth * * @return {number} The resulting int. */ -function GetRenderHeight () { +function GetRenderHeight() { return r.BindGetRenderHeight() } raylib.GetRenderHeight = GetRenderHeight @@ -380,17 +416,17 @@ raylib.GetRenderHeight = GetRenderHeight * * @return {number} The resulting int. */ -function GetMonitorCount () { +function GetMonitorCount() { return r.BindGetMonitorCount() } raylib.GetMonitorCount = GetMonitorCount /** - * Get current connected monitor + * Get current monitor where window is placed * * @return {number} The resulting int. */ -function GetCurrentMonitor () { +function GetCurrentMonitor() { return r.BindGetCurrentMonitor() } raylib.GetCurrentMonitor = GetCurrentMonitor @@ -402,7 +438,7 @@ raylib.GetCurrentMonitor = GetCurrentMonitor * * @return {Vector2} The resulting Vector2. */ -function GetMonitorPosition (monitor) { +function GetMonitorPosition(monitor) { return r.BindGetMonitorPosition( monitor ) @@ -416,7 +452,7 @@ raylib.GetMonitorPosition = GetMonitorPosition * * @return {number} The resulting int. */ -function GetMonitorWidth (monitor) { +function GetMonitorWidth(monitor) { return r.BindGetMonitorWidth( monitor ) @@ -430,7 +466,7 @@ raylib.GetMonitorWidth = GetMonitorWidth * * @return {number} The resulting int. */ -function GetMonitorHeight (monitor) { +function GetMonitorHeight(monitor) { return r.BindGetMonitorHeight( monitor ) @@ -444,7 +480,7 @@ raylib.GetMonitorHeight = GetMonitorHeight * * @return {number} The resulting int. */ -function GetMonitorPhysicalWidth (monitor) { +function GetMonitorPhysicalWidth(monitor) { return r.BindGetMonitorPhysicalWidth( monitor ) @@ -458,7 +494,7 @@ raylib.GetMonitorPhysicalWidth = GetMonitorPhysicalWidth * * @return {number} The resulting int. */ -function GetMonitorPhysicalHeight (monitor) { +function GetMonitorPhysicalHeight(monitor) { return r.BindGetMonitorPhysicalHeight( monitor ) @@ -472,7 +508,7 @@ raylib.GetMonitorPhysicalHeight = GetMonitorPhysicalHeight * * @return {number} The resulting int. */ -function GetMonitorRefreshRate (monitor) { +function GetMonitorRefreshRate(monitor) { return r.BindGetMonitorRefreshRate( monitor ) @@ -484,7 +520,7 @@ raylib.GetMonitorRefreshRate = GetMonitorRefreshRate * * @return {Vector2} The resulting Vector2. */ -function GetWindowPosition () { +function GetWindowPosition() { return r.BindGetWindowPosition() } raylib.GetWindowPosition = GetWindowPosition @@ -494,19 +530,19 @@ raylib.GetWindowPosition = GetWindowPosition * * @return {Vector2} The resulting Vector2. */ -function GetWindowScaleDPI () { +function GetWindowScaleDPI() { return r.BindGetWindowScaleDPI() } raylib.GetWindowScaleDPI = GetWindowScaleDPI /** - * Get the human-readable, UTF-8 encoded name of the primary monitor + * Get the human-readable, UTF-8 encoded name of the specified monitor * * @param {number} monitor * * @return {string} The resulting const char *. */ -function GetMonitorName (monitor) { +function GetMonitorName(monitor) { return r.BindGetMonitorName( monitor ) @@ -520,7 +556,7 @@ raylib.GetMonitorName = GetMonitorName * * @return {undefined} */ -function SetClipboardText (text) { +function SetClipboardText(text) { return r.BindSetClipboardText( text ) @@ -532,17 +568,27 @@ raylib.SetClipboardText = SetClipboardText * * @return {string} The resulting const char *. */ -function GetClipboardText () { +function GetClipboardText() { return r.BindGetClipboardText() } raylib.GetClipboardText = GetClipboardText +/** + * Get clipboard image content + * + * @return {Image} The resulting Image. + */ +function GetClipboardImage() { + return r.BindGetClipboardImage() +} +raylib.GetClipboardImage = GetClipboardImage + /** * Enable waiting for events on EndDrawing(), no automatic event polling * * @return {undefined} */ -function EnableEventWaiting () { +function EnableEventWaiting() { return r.BindEnableEventWaiting() } raylib.EnableEventWaiting = EnableEventWaiting @@ -552,51 +598,17 @@ raylib.EnableEventWaiting = EnableEventWaiting * * @return {undefined} */ -function DisableEventWaiting () { +function DisableEventWaiting() { return r.BindDisableEventWaiting() } raylib.DisableEventWaiting = DisableEventWaiting -/** - * Swap back buffer with front buffer (screen drawing) - * - * @return {undefined} - */ -function SwapScreenBuffer () { - return r.BindSwapScreenBuffer() -} -raylib.SwapScreenBuffer = SwapScreenBuffer - -/** - * Register all input events - * - * @return {undefined} - */ -function PollInputEvents () { - return r.BindPollInputEvents() -} -raylib.PollInputEvents = PollInputEvents - -/** - * Wait for some time (halt program execution) - * - * @param {number} seconds - * - * @return {undefined} - */ -function WaitTime (seconds) { - return r.BindWaitTime( - seconds - ) -} -raylib.WaitTime = WaitTime - /** * Shows cursor * * @return {undefined} */ -function ShowCursor () { +function ShowCursor() { return r.BindShowCursor() } raylib.ShowCursor = ShowCursor @@ -606,7 +618,7 @@ raylib.ShowCursor = ShowCursor * * @return {undefined} */ -function HideCursor () { +function HideCursor() { return r.BindHideCursor() } raylib.HideCursor = HideCursor @@ -616,7 +628,7 @@ raylib.HideCursor = HideCursor * * @return {boolean} The resulting bool. */ -function IsCursorHidden () { +function IsCursorHidden() { return r.BindIsCursorHidden() } raylib.IsCursorHidden = IsCursorHidden @@ -626,7 +638,7 @@ raylib.IsCursorHidden = IsCursorHidden * * @return {undefined} */ -function EnableCursor () { +function EnableCursor() { return r.BindEnableCursor() } raylib.EnableCursor = EnableCursor @@ -636,7 +648,7 @@ raylib.EnableCursor = EnableCursor * * @return {undefined} */ -function DisableCursor () { +function DisableCursor() { return r.BindDisableCursor() } raylib.DisableCursor = DisableCursor @@ -646,7 +658,7 @@ raylib.DisableCursor = DisableCursor * * @return {boolean} The resulting bool. */ -function IsCursorOnScreen () { +function IsCursorOnScreen() { return r.BindIsCursorOnScreen() } raylib.IsCursorOnScreen = IsCursorOnScreen @@ -658,7 +670,7 @@ raylib.IsCursorOnScreen = IsCursorOnScreen * * @return {undefined} */ -function ClearBackground (color) { +function ClearBackground(color) { return r.BindClearBackground( color.r, color.g, @@ -673,7 +685,7 @@ raylib.ClearBackground = ClearBackground * * @return {undefined} */ -function BeginDrawing () { +function BeginDrawing() { return r.BindBeginDrawing() } raylib.BeginDrawing = BeginDrawing @@ -683,7 +695,7 @@ raylib.BeginDrawing = BeginDrawing * * @return {undefined} */ -function EndDrawing () { +function EndDrawing() { return r.BindEndDrawing() } raylib.EndDrawing = EndDrawing @@ -695,7 +707,7 @@ raylib.EndDrawing = EndDrawing * * @return {undefined} */ -function BeginMode2D (camera) { +function BeginMode2D(camera) { return r.BindBeginMode2D( camera.offset.x, camera.offset.y, @@ -712,7 +724,7 @@ raylib.BeginMode2D = BeginMode2D * * @return {undefined} */ -function EndMode2D () { +function EndMode2D() { return r.BindEndMode2D() } raylib.EndMode2D = EndMode2D @@ -724,7 +736,7 @@ raylib.EndMode2D = EndMode2D * * @return {undefined} */ -function BeginMode3D (camera) { +function BeginMode3D(camera) { return r.BindBeginMode3D( camera.position.x, camera.position.y, @@ -746,7 +758,7 @@ raylib.BeginMode3D = BeginMode3D * * @return {undefined} */ -function EndMode3D () { +function EndMode3D() { return r.BindEndMode3D() } raylib.EndMode3D = EndMode3D @@ -758,7 +770,7 @@ raylib.EndMode3D = EndMode3D * * @return {undefined} */ -function BeginTextureMode (target) { +function BeginTextureMode(target) { return r.BindBeginTextureMode( target.id, target.texture.id, @@ -780,7 +792,7 @@ raylib.BeginTextureMode = BeginTextureMode * * @return {undefined} */ -function EndTextureMode () { +function EndTextureMode() { return r.BindEndTextureMode() } raylib.EndTextureMode = EndTextureMode @@ -792,7 +804,7 @@ raylib.EndTextureMode = EndTextureMode * * @return {undefined} */ -function BeginShaderMode (shader) { +function BeginShaderMode(shader) { return r.BindBeginShaderMode( shader.id, shader.locs @@ -805,7 +817,7 @@ raylib.BeginShaderMode = BeginShaderMode * * @return {undefined} */ -function EndShaderMode () { +function EndShaderMode() { return r.BindEndShaderMode() } raylib.EndShaderMode = EndShaderMode @@ -817,7 +829,7 @@ raylib.EndShaderMode = EndShaderMode * * @return {undefined} */ -function BeginBlendMode (mode) { +function BeginBlendMode(mode) { return r.BindBeginBlendMode( mode ) @@ -829,7 +841,7 @@ raylib.BeginBlendMode = BeginBlendMode * * @return {undefined} */ -function EndBlendMode () { +function EndBlendMode() { return r.BindEndBlendMode() } raylib.EndBlendMode = EndBlendMode @@ -844,7 +856,7 @@ raylib.EndBlendMode = EndBlendMode * * @return {undefined} */ -function BeginScissorMode (x, y, width, height) { +function BeginScissorMode(x, y, width, height) { return r.BindBeginScissorMode( x, y, @@ -859,7 +871,7 @@ raylib.BeginScissorMode = BeginScissorMode * * @return {undefined} */ -function EndScissorMode () { +function EndScissorMode() { return r.BindEndScissorMode() } raylib.EndScissorMode = EndScissorMode @@ -869,7 +881,7 @@ raylib.EndScissorMode = EndScissorMode * * @return {undefined} */ -function EndVrStereoMode () { +function EndVrStereoMode() { return r.BindEndVrStereoMode() } raylib.EndVrStereoMode = EndVrStereoMode @@ -882,7 +894,7 @@ raylib.EndVrStereoMode = EndVrStereoMode * * @return {Shader} The resulting Shader. */ -function LoadShader (vsFileName, fsFileName) { +function LoadShader(vsFileName, fsFileName) { return r.BindLoadShader( vsFileName, fsFileName @@ -898,7 +910,7 @@ raylib.LoadShader = LoadShader * * @return {Shader} The resulting Shader. */ -function LoadShaderFromMemory (vsCode, fsCode) { +function LoadShaderFromMemory(vsCode, fsCode) { return r.BindLoadShaderFromMemory( vsCode, fsCode @@ -907,19 +919,19 @@ function LoadShaderFromMemory (vsCode, fsCode) { raylib.LoadShaderFromMemory = LoadShaderFromMemory /** - * Check if a shader is ready + * Check if a shader is valid (loaded on GPU) * * @param {Shader} shader * * @return {boolean} The resulting bool. */ -function IsShaderReady (shader) { - return r.BindIsShaderReady( +function IsShaderValid(shader) { + return r.BindIsShaderValid( shader.id, shader.locs ) } -raylib.IsShaderReady = IsShaderReady +raylib.IsShaderValid = IsShaderValid /** * Get shader uniform location @@ -929,7 +941,7 @@ raylib.IsShaderReady = IsShaderReady * * @return {number} The resulting int. */ -function GetShaderLocation (shader, uniformName) { +function GetShaderLocation(shader, uniformName) { return r.BindGetShaderLocation( shader.id, shader.locs, @@ -946,7 +958,7 @@ raylib.GetShaderLocation = GetShaderLocation * * @return {number} The resulting int. */ -function GetShaderLocationAttrib (shader, attribName) { +function GetShaderLocationAttrib(shader, attribName) { return r.BindGetShaderLocationAttrib( shader.id, shader.locs, @@ -964,7 +976,7 @@ raylib.GetShaderLocationAttrib = GetShaderLocationAttrib * * @return {undefined} */ -function SetShaderValueMatrix (shader, locIndex, mat) { +function SetShaderValueMatrix(shader, locIndex, mat) { return r.BindSetShaderValueMatrix( shader.id, shader.locs, @@ -998,7 +1010,7 @@ raylib.SetShaderValueMatrix = SetShaderValueMatrix * * @return {undefined} */ -function SetShaderValueTexture (shader, locIndex, texture) { +function SetShaderValueTexture(shader, locIndex, texture) { return r.BindSetShaderValueTexture( shader.id, shader.locs, @@ -1019,7 +1031,7 @@ raylib.SetShaderValueTexture = SetShaderValueTexture * * @return {undefined} */ -function UnloadShader (shader) { +function UnloadShader(shader) { return r.BindUnloadShader( shader.id, shader.locs @@ -1028,17 +1040,17 @@ function UnloadShader (shader) { raylib.UnloadShader = UnloadShader /** - * Get a ray trace from mouse position + * Get a ray trace from screen position (i.e mouse) * - * @param {Vector2} mousePosition + * @param {Vector2} position * @param {Camera3D} camera * * @return {Ray} The resulting Ray. */ -function GetMouseRay (mousePosition, camera) { - return r.BindGetMouseRay( - mousePosition.x, - mousePosition.y, +function GetScreenToWorldRay(position, camera) { + return r.BindGetScreenToWorldRay( + position.x, + position.y, camera.position.x, camera.position.y, camera.position.z, @@ -1052,17 +1064,22 @@ function GetMouseRay (mousePosition, camera) { camera.projection ) } -raylib.GetMouseRay = GetMouseRay +raylib.GetScreenToWorldRay = GetScreenToWorldRay /** - * Get camera transform matrix (view matrix) + * Get a ray trace from screen position (i.e mouse) in a viewport * + * @param {Vector2} position * @param {Camera3D} camera + * @param {number} width + * @param {number} height * - * @return {Matrix} The resulting Matrix. + * @return {Ray} The resulting Ray. */ -function GetCameraMatrix (camera) { - return r.BindGetCameraMatrix( +function GetScreenToWorldRayEx(position, camera, width, height) { + return r.BindGetScreenToWorldRayEx( + position.x, + position.y, camera.position.x, camera.position.y, camera.position.z, @@ -1073,40 +1090,53 @@ function GetCameraMatrix (camera) { camera.up.y, camera.up.z, camera.fovy, - camera.projection + camera.projection, + width, + height ) } -raylib.GetCameraMatrix = GetCameraMatrix +raylib.GetScreenToWorldRayEx = GetScreenToWorldRayEx /** - * Get camera 2d transform matrix + * Get the screen space position for a 3d world space position * - * @param {Camera2D} camera + * @param {Vector3} position + * @param {Camera3D} camera * - * @return {Matrix} The resulting Matrix. + * @return {Vector2} The resulting Vector2. */ -function GetCameraMatrix2D (camera) { - return r.BindGetCameraMatrix2D( - camera.offset.x, - camera.offset.y, +function GetWorldToScreen(position, camera) { + return r.BindGetWorldToScreen( + position.x, + position.y, + position.z, + camera.position.x, + camera.position.y, + camera.position.z, camera.target.x, camera.target.y, - camera.rotation, - camera.zoom + camera.target.z, + camera.up.x, + camera.up.y, + camera.up.z, + camera.fovy, + camera.projection ) } -raylib.GetCameraMatrix2D = GetCameraMatrix2D +raylib.GetWorldToScreen = GetWorldToScreen /** - * Get the screen space position for a 3d world space position + * Get size position for a 3d world space position * * @param {Vector3} position * @param {Camera3D} camera + * @param {number} width + * @param {number} height * * @return {Vector2} The resulting Vector2. */ -function GetWorldToScreen (position, camera) { - return r.BindGetWorldToScreen( +function GetWorldToScreenEx(position, camera, width, height) { + return r.BindGetWorldToScreenEx( position.x, position.y, position.z, @@ -1120,10 +1150,34 @@ function GetWorldToScreen (position, camera) { camera.up.y, camera.up.z, camera.fovy, - camera.projection + camera.projection, + width, + height ) } -raylib.GetWorldToScreen = GetWorldToScreen +raylib.GetWorldToScreenEx = GetWorldToScreenEx + +/** + * Get the screen space position for a 2d camera world space position + * + * @param {Vector2} position + * @param {Camera2D} camera + * + * @return {Vector2} The resulting Vector2. + */ +function GetWorldToScreen2D(position, camera) { + return r.BindGetWorldToScreen2D( + position.x, + position.y, + camera.offset.x, + camera.offset.y, + camera.target.x, + camera.target.y, + camera.rotation, + camera.zoom + ) +} +raylib.GetWorldToScreen2D = GetWorldToScreen2D /** * Get the world space position for a 2d camera screen space position @@ -1133,7 +1187,7 @@ raylib.GetWorldToScreen = GetWorldToScreen * * @return {Vector2} The resulting Vector2. */ -function GetScreenToWorld2D (position, camera) { +function GetScreenToWorld2D(position, camera) { return r.BindGetScreenToWorld2D( position.x, position.y, @@ -1148,20 +1202,14 @@ function GetScreenToWorld2D (position, camera) { raylib.GetScreenToWorld2D = GetScreenToWorld2D /** - * Get size position for a 3d world space position + * Get camera transform matrix (view matrix) * - * @param {Vector3} position * @param {Camera3D} camera - * @param {number} width - * @param {number} height * - * @return {Vector2} The resulting Vector2. + * @return {Matrix} The resulting Matrix. */ -function GetWorldToScreenEx (position, camera, width, height) { - return r.BindGetWorldToScreenEx( - position.x, - position.y, - position.z, +function GetCameraMatrix(camera) { + return r.BindGetCameraMatrix( camera.position.x, camera.position.y, camera.position.z, @@ -1172,25 +1220,20 @@ function GetWorldToScreenEx (position, camera, width, height) { camera.up.y, camera.up.z, camera.fovy, - camera.projection, - width, - height + camera.projection ) } -raylib.GetWorldToScreenEx = GetWorldToScreenEx +raylib.GetCameraMatrix = GetCameraMatrix /** - * Get the screen space position for a 2d camera world space position + * Get camera 2d transform matrix * - * @param {Vector2} position * @param {Camera2D} camera * - * @return {Vector2} The resulting Vector2. + * @return {Matrix} The resulting Matrix. */ -function GetWorldToScreen2D (position, camera) { - return r.BindGetWorldToScreen2D( - position.x, - position.y, +function GetCameraMatrix2D(camera) { + return r.BindGetCameraMatrix2D( camera.offset.x, camera.offset.y, camera.target.x, @@ -1199,7 +1242,7 @@ function GetWorldToScreen2D (position, camera) { camera.zoom ) } -raylib.GetWorldToScreen2D = GetWorldToScreen2D +raylib.GetCameraMatrix2D = GetCameraMatrix2D /** * Set target FPS (maximum) @@ -1208,29 +1251,19 @@ raylib.GetWorldToScreen2D = GetWorldToScreen2D * * @return {undefined} */ -function SetTargetFPS (fps) { +function SetTargetFPS(fps) { return r.BindSetTargetFPS( fps ) } raylib.SetTargetFPS = SetTargetFPS -/** - * Get current FPS - * - * @return {number} The resulting int. - */ -function GetFPS () { - return r.BindGetFPS() -} -raylib.GetFPS = GetFPS - /** * Get time in seconds for last frame drawn (delta time) * * @return {number} The resulting float. */ -function GetFrameTime () { +function GetFrameTime() { return r.BindGetFrameTime() } raylib.GetFrameTime = GetFrameTime @@ -1240,126 +1273,144 @@ raylib.GetFrameTime = GetFrameTime * * @return {number} The resulting double. */ -function GetTime () { +function GetTime() { return r.BindGetTime() } raylib.GetTime = GetTime /** - * Get a random value between min and max (both included) - * - * @param {number} min - * @param {number} max + * Get current FPS * * @return {number} The resulting int. */ -function GetRandomValue (min, max) { - return r.BindGetRandomValue( - min, - max - ) +function GetFPS() { + return r.BindGetFPS() } -raylib.GetRandomValue = GetRandomValue +raylib.GetFPS = GetFPS /** - * Set the seed for the random number generator - * - * @param {number} seed + * Swap back buffer with front buffer (screen drawing) * * @return {undefined} */ -function SetRandomSeed (seed) { - return r.BindSetRandomSeed( - seed - ) +function SwapScreenBuffer() { + return r.BindSwapScreenBuffer() } -raylib.SetRandomSeed = SetRandomSeed +raylib.SwapScreenBuffer = SwapScreenBuffer /** - * Takes a screenshot of current screen (filename extension defines format) - * - * @param {string} fileName + * Register all input events * * @return {undefined} */ -function TakeScreenshot (fileName) { - return r.BindTakeScreenshot( - fileName - ) +function PollInputEvents() { + return r.BindPollInputEvents() } -raylib.TakeScreenshot = TakeScreenshot +raylib.PollInputEvents = PollInputEvents /** - * Setup init configuration flags (view FLAGS) + * Wait for some time (halt program execution) * - * @param {number} flags + * @param {number} seconds * * @return {undefined} */ -function SetConfigFlags (flags) { - return r.BindSetConfigFlags( - flags +function WaitTime(seconds) { + return r.BindWaitTime( + seconds ) } -raylib.SetConfigFlags = SetConfigFlags +raylib.WaitTime = WaitTime /** - * Set the current threshold (minimum) log level + * Set the seed for the random number generator * - * @param {number} logLevel + * @param {number} seed * * @return {undefined} */ -function SetTraceLogLevel (logLevel) { - return r.BindSetTraceLogLevel( - logLevel +function SetRandomSeed(seed) { + return r.BindSetRandomSeed( + seed ) } -raylib.SetTraceLogLevel = SetTraceLogLevel +raylib.SetRandomSeed = SetRandomSeed /** - * Internal memory allocator + * Get a random value between min and max (both included) * - * @param {number} size + * @param {number} min + * @param {number} max * - * @return {number} The resulting void *. + * @return {number} The resulting int. */ -function MemAlloc (size) { - return r.BindMemAlloc( - size +function GetRandomValue(min, max) { + return r.BindGetRandomValue( + min, + max ) } -raylib.MemAlloc = MemAlloc +raylib.GetRandomValue = GetRandomValue /** - * Internal memory reallocator + * Load random values sequence, no values repeated * - * @param {number} ptr - * @param {number} size + * @param {number} count + * @param {number} min + * @param {number} max * - * @return {number} The resulting void *. + * @return {number} The resulting int *. */ -function MemRealloc (ptr, size) { - return r.BindMemRealloc( - ptr, - size +function LoadRandomSequence(count, min, max) { + return r.BindLoadRandomSequence( + count, + min, + max ) } -raylib.MemRealloc = MemRealloc +raylib.LoadRandomSequence = LoadRandomSequence /** - * Internal memory free + * Unload random values sequence * - * @param {number} ptr + * @param {number} sequence * * @return {undefined} */ -function MemFree (ptr) { - return r.BindMemFree( - ptr +function UnloadRandomSequence(sequence) { + return r.BindUnloadRandomSequence( + sequence ) } -raylib.MemFree = MemFree +raylib.UnloadRandomSequence = UnloadRandomSequence + +/** + * Takes a screenshot of current screen (filename extension defines format) + * + * @param {string} fileName + * + * @return {undefined} + */ +function TakeScreenshot(fileName) { + return r.BindTakeScreenshot( + fileName + ) +} +raylib.TakeScreenshot = TakeScreenshot + +/** + * Setup init configuration flags (view FLAGS) + * + * @param {number} flags + * + * @return {undefined} + */ +function SetConfigFlags(flags) { + return r.BindSetConfigFlags( + flags + ) +} +raylib.SetConfigFlags = SetConfigFlags /** * Open URL with default system browser (if available) @@ -1368,25 +1419,83 @@ raylib.MemFree = MemFree * * @return {undefined} */ -function OpenURL (url) { +function OpenURL(url) { return r.BindOpenURL( url ) } raylib.OpenURL = OpenURL +/** + * Set the current threshold (minimum) log level + * + * @param {number} logLevel + * + * @return {undefined} + */ +function SetTraceLogLevel(logLevel) { + return r.BindSetTraceLogLevel( + logLevel + ) +} +raylib.SetTraceLogLevel = SetTraceLogLevel + +/** + * Internal memory allocator + * + * @param {number} size + * + * @return {number} The resulting void *. + */ +function MemAlloc(size) { + return r.BindMemAlloc( + size + ) +} +raylib.MemAlloc = MemAlloc + +/** + * Internal memory reallocator + * + * @param {number} ptr + * @param {number} size + * + * @return {number} The resulting void *. + */ +function MemRealloc(ptr, size) { + return r.BindMemRealloc( + ptr, + size + ) +} +raylib.MemRealloc = MemRealloc + +/** + * Internal memory free + * + * @param {number} ptr + * + * @return {undefined} + */ +function MemFree(ptr) { + return r.BindMemFree( + ptr + ) +} +raylib.MemFree = MemFree + /** * Load file data as byte array (read) * * @param {string} fileName - * @param {number} bytesRead + * @param {number} dataSize * * @return {Buffer} The resulting unsigned char *. */ -function LoadFileData (fileName, bytesRead) { +function LoadFileData(fileName, dataSize) { return r.BindLoadFileData( fileName, - bytesRead + dataSize ) } raylib.LoadFileData = LoadFileData @@ -1398,7 +1507,7 @@ raylib.LoadFileData = LoadFileData * * @return {undefined} */ -function UnloadFileData (data) { +function UnloadFileData(data) { return r.BindUnloadFileData( data ) @@ -1410,15 +1519,15 @@ raylib.UnloadFileData = UnloadFileData * * @param {string} fileName * @param {number} data - * @param {number} bytesToWrite + * @param {number} dataSize * * @return {boolean} The resulting bool. */ -function SaveFileData (fileName, data, bytesToWrite) { +function SaveFileData(fileName, data, dataSize) { return r.BindSaveFileData( fileName, data, - bytesToWrite + dataSize ) } raylib.SaveFileData = SaveFileData @@ -1427,15 +1536,15 @@ raylib.SaveFileData = SaveFileData * Export data to code (.h), returns true on success * * @param {Buffer} data - * @param {number} size + * @param {number} dataSize * @param {string} fileName * * @return {boolean} The resulting bool. */ -function ExportDataAsCode (data, size, fileName) { +function ExportDataAsCode(data, dataSize, fileName) { return r.BindExportDataAsCode( data, - size, + dataSize, fileName ) } @@ -1448,7 +1557,7 @@ raylib.ExportDataAsCode = ExportDataAsCode * * @return {string} The resulting char *. */ -function LoadFileText (fileName) { +function LoadFileText(fileName) { return r.BindLoadFileText( fileName ) @@ -1462,7 +1571,7 @@ raylib.LoadFileText = LoadFileText * * @return {undefined} */ -function UnloadFileText (text) { +function UnloadFileText(text) { return r.BindUnloadFileText( text ) @@ -1477,7 +1586,7 @@ raylib.UnloadFileText = UnloadFileText * * @return {boolean} The resulting bool. */ -function SaveFileText (fileName, text) { +function SaveFileText(fileName, text) { return r.BindSaveFileText( fileName, text @@ -1492,7 +1601,7 @@ raylib.SaveFileText = SaveFileText * * @return {boolean} The resulting bool. */ -function FileExists (fileName) { +function FileExists(fileName) { return r.BindFileExists( fileName ) @@ -1506,7 +1615,7 @@ raylib.FileExists = FileExists * * @return {boolean} The resulting bool. */ -function DirectoryExists (dirPath) { +function DirectoryExists(dirPath) { return r.BindDirectoryExists( dirPath ) @@ -1521,7 +1630,7 @@ raylib.DirectoryExists = DirectoryExists * * @return {boolean} The resulting bool. */ -function IsFileExtension (fileName, ext) { +function IsFileExtension(fileName, ext) { return r.BindIsFileExtension( fileName, ext @@ -1536,7 +1645,7 @@ raylib.IsFileExtension = IsFileExtension * * @return {number} The resulting int. */ -function GetFileLength (fileName) { +function GetFileLength(fileName) { return r.BindGetFileLength( fileName ) @@ -1550,7 +1659,7 @@ raylib.GetFileLength = GetFileLength * * @return {string} The resulting const char *. */ -function GetFileExtension (fileName) { +function GetFileExtension(fileName) { return r.BindGetFileExtension( fileName ) @@ -1564,7 +1673,7 @@ raylib.GetFileExtension = GetFileExtension * * @return {string} The resulting const char *. */ -function GetFileName (filePath) { +function GetFileName(filePath) { return r.BindGetFileName( filePath ) @@ -1578,7 +1687,7 @@ raylib.GetFileName = GetFileName * * @return {string} The resulting const char *. */ -function GetFileNameWithoutExt (filePath) { +function GetFileNameWithoutExt(filePath) { return r.BindGetFileNameWithoutExt( filePath ) @@ -1592,7 +1701,7 @@ raylib.GetFileNameWithoutExt = GetFileNameWithoutExt * * @return {string} The resulting const char *. */ -function GetDirectoryPath (filePath) { +function GetDirectoryPath(filePath) { return r.BindGetDirectoryPath( filePath ) @@ -1606,7 +1715,7 @@ raylib.GetDirectoryPath = GetDirectoryPath * * @return {string} The resulting const char *. */ -function GetPrevDirectoryPath (dirPath) { +function GetPrevDirectoryPath(dirPath) { return r.BindGetPrevDirectoryPath( dirPath ) @@ -1618,21 +1727,35 @@ raylib.GetPrevDirectoryPath = GetPrevDirectoryPath * * @return {string} The resulting const char *. */ -function GetWorkingDirectory () { +function GetWorkingDirectory() { return r.BindGetWorkingDirectory() } raylib.GetWorkingDirectory = GetWorkingDirectory /** - * Get the directory if the running application (uses static string) + * Get the directory of the running application (uses static string) * * @return {string} The resulting const char *. */ -function GetApplicationDirectory () { +function GetApplicationDirectory() { return r.BindGetApplicationDirectory() } raylib.GetApplicationDirectory = GetApplicationDirectory +/** + * Create directories (including full path requested), returns 0 on success + * + * @param {string} dirPath + * + * @return {number} The resulting int. + */ +function MakeDirectory(dirPath) { + return r.BindMakeDirectory( + dirPath + ) +} +raylib.MakeDirectory = MakeDirectory + /** * Change working directory, return true on success * @@ -1640,7 +1763,7 @@ raylib.GetApplicationDirectory = GetApplicationDirectory * * @return {boolean} The resulting bool. */ -function ChangeDirectory (dir) { +function ChangeDirectory(dir) { return r.BindChangeDirectory( dir ) @@ -1654,13 +1777,27 @@ raylib.ChangeDirectory = ChangeDirectory * * @return {boolean} The resulting bool. */ -function IsPathFile (path) { +function IsPathFile(path) { return r.BindIsPathFile( path ) } raylib.IsPathFile = IsPathFile +/** + * Check if fileName is valid for the platform/OS + * + * @param {string} fileName + * + * @return {boolean} The resulting bool. + */ +function IsFileNameValid(fileName) { + return r.BindIsFileNameValid( + fileName + ) +} +raylib.IsFileNameValid = IsFileNameValid + /** * Load directory filepaths * @@ -1668,7 +1805,7 @@ raylib.IsPathFile = IsPathFile * * @return {FilePathList} The resulting FilePathList. */ -function LoadDirectoryFiles (dirPath) { +function LoadDirectoryFiles(dirPath) { return r.BindLoadDirectoryFiles( dirPath ) @@ -1676,7 +1813,7 @@ function LoadDirectoryFiles (dirPath) { raylib.LoadDirectoryFiles = LoadDirectoryFiles /** - * Load directory filepaths with extension filtering and recursive directory scan + * Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result * * @param {string} basePath * @param {string} filter @@ -1684,7 +1821,7 @@ raylib.LoadDirectoryFiles = LoadDirectoryFiles * * @return {FilePathList} The resulting FilePathList. */ -function LoadDirectoryFilesEx (basePath, filter, scanSubdirs) { +function LoadDirectoryFilesEx(basePath, filter, scanSubdirs) { return r.BindLoadDirectoryFilesEx( basePath, filter, @@ -1700,7 +1837,7 @@ raylib.LoadDirectoryFilesEx = LoadDirectoryFilesEx * * @return {undefined} */ -function UnloadDirectoryFiles (files) { +function UnloadDirectoryFiles(files) { return r.BindUnloadDirectoryFiles( files.capacity, files.count, @@ -1714,7 +1851,7 @@ raylib.UnloadDirectoryFiles = UnloadDirectoryFiles * * @return {boolean} The resulting bool. */ -function IsFileDropped () { +function IsFileDropped() { return r.BindIsFileDropped() } raylib.IsFileDropped = IsFileDropped @@ -1724,7 +1861,7 @@ raylib.IsFileDropped = IsFileDropped * * @return {FilePathList} The resulting FilePathList. */ -function LoadDroppedFiles () { +function LoadDroppedFiles() { return r.BindLoadDroppedFiles() } raylib.LoadDroppedFiles = LoadDroppedFiles @@ -1736,7 +1873,7 @@ raylib.LoadDroppedFiles = LoadDroppedFiles * * @return {undefined} */ -function UnloadDroppedFiles (files) { +function UnloadDroppedFiles(files) { return r.BindUnloadDroppedFiles( files.capacity, files.count, @@ -1752,7 +1889,7 @@ raylib.UnloadDroppedFiles = UnloadDroppedFiles * * @return {number} The resulting long. */ -function GetFileModTime (fileName) { +function GetFileModTime(fileName) { return r.BindGetFileModTime( fileName ) @@ -1768,7 +1905,7 @@ raylib.GetFileModTime = GetFileModTime * * @return {Buffer} The resulting unsigned char *. */ -function CompressData (data, dataSize, compDataSize) { +function CompressData(data, dataSize, compDataSize) { return r.BindCompressData( data, dataSize, @@ -1786,7 +1923,7 @@ raylib.CompressData = CompressData * * @return {Buffer} The resulting unsigned char *. */ -function DecompressData (compData, compDataSize, dataSize) { +function DecompressData(compData, compDataSize, dataSize) { return r.BindDecompressData( compData, compDataSize, @@ -1804,7 +1941,7 @@ raylib.DecompressData = DecompressData * * @return {string} The resulting char *. */ -function EncodeDataBase64 (data, dataSize, outputSize) { +function EncodeDataBase64(data, dataSize, outputSize) { return r.BindEncodeDataBase64( data, dataSize, @@ -1821,7 +1958,7 @@ raylib.EncodeDataBase64 = EncodeDataBase64 * * @return {Buffer} The resulting unsigned char *. */ -function DecodeDataBase64 (data, outputSize) { +function DecodeDataBase64(data, outputSize) { return r.BindDecodeDataBase64( data, outputSize @@ -1830,193 +1967,367 @@ function DecodeDataBase64 (data, outputSize) { raylib.DecodeDataBase64 = DecodeDataBase64 /** - * Check if a key has been pressed once + * Compute CRC32 hash code * - * @param {number} key + * @param {Buffer} data + * @param {number} dataSize * - * @return {boolean} The resulting bool. + * @return {number} The resulting unsigned int. */ -function IsKeyPressed (key) { - return r.BindIsKeyPressed( - key +function ComputeCRC32(data, dataSize) { + return r.BindComputeCRC32( + data, + dataSize ) } -raylib.IsKeyPressed = IsKeyPressed +raylib.ComputeCRC32 = ComputeCRC32 /** - * Check if a key is being pressed + * Compute MD5 hash code, returns static int[4] (16 bytes) * - * @param {number} key + * @param {Buffer} data + * @param {number} dataSize * - * @return {boolean} The resulting bool. + * @return {number} The resulting unsigned int *. */ -function IsKeyDown (key) { - return r.BindIsKeyDown( - key +function ComputeMD5(data, dataSize) { + return r.BindComputeMD5( + data, + dataSize ) } -raylib.IsKeyDown = IsKeyDown +raylib.ComputeMD5 = ComputeMD5 /** - * Check if a key has been released once + * Compute SHA1 hash code, returns static int[5] (20 bytes) * - * @param {number} key + * @param {Buffer} data + * @param {number} dataSize * - * @return {boolean} The resulting bool. + * @return {number} The resulting unsigned int *. */ -function IsKeyReleased (key) { - return r.BindIsKeyReleased( - key +function ComputeSHA1(data, dataSize) { + return r.BindComputeSHA1( + data, + dataSize ) } -raylib.IsKeyReleased = IsKeyReleased +raylib.ComputeSHA1 = ComputeSHA1 /** - * Check if a key is NOT being pressed + * Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS * - * @param {number} key + * @param {string} fileName * - * @return {boolean} The resulting bool. + * @return {AutomationEventList} The resulting AutomationEventList. */ -function IsKeyUp (key) { - return r.BindIsKeyUp( - key +function LoadAutomationEventList(fileName) { + return r.BindLoadAutomationEventList( + fileName ) } -raylib.IsKeyUp = IsKeyUp +raylib.LoadAutomationEventList = LoadAutomationEventList /** - * Set a custom key to exit program (default is ESC) + * Unload automation events list from file * - * @param {number} key + * @param {AutomationEventList} list * * @return {undefined} */ -function SetExitKey (key) { - return r.BindSetExitKey( - key +function UnloadAutomationEventList(list) { + return r.BindUnloadAutomationEventList( + list.capacity, + list.count, + list.events ) } -raylib.SetExitKey = SetExitKey +raylib.UnloadAutomationEventList = UnloadAutomationEventList /** - * Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty + * Export automation events list as text file * - * @return {number} The resulting int. + * @param {AutomationEventList} list + * @param {string} fileName + * + * @return {boolean} The resulting bool. */ -function GetKeyPressed () { - return r.BindGetKeyPressed() +function ExportAutomationEventList(list, fileName) { + return r.BindExportAutomationEventList( + list.capacity, + list.count, + list.events, + fileName + ) } -raylib.GetKeyPressed = GetKeyPressed +raylib.ExportAutomationEventList = ExportAutomationEventList /** - * Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty + * Set automation event list to record to * - * @return {number} The resulting int. + * @param {number} list + * + * @return {undefined} */ -function GetCharPressed () { - return r.BindGetCharPressed() +function SetAutomationEventList(list) { + return r.BindSetAutomationEventList( + list + ) } -raylib.GetCharPressed = GetCharPressed +raylib.SetAutomationEventList = SetAutomationEventList /** - * Check if a gamepad is available + * Set automation event internal base frame to start recording * - * @param {number} gamepad + * @param {number} frame * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function IsGamepadAvailable (gamepad) { - return r.BindIsGamepadAvailable( - gamepad +function SetAutomationEventBaseFrame(frame) { + return r.BindSetAutomationEventBaseFrame( + frame ) } -raylib.IsGamepadAvailable = IsGamepadAvailable +raylib.SetAutomationEventBaseFrame = SetAutomationEventBaseFrame /** - * Get gamepad internal name id + * Start recording automation events (AutomationEventList must be set) * - * @param {number} gamepad + * @return {undefined} + */ +function StartAutomationEventRecording() { + return r.BindStartAutomationEventRecording() +} +raylib.StartAutomationEventRecording = StartAutomationEventRecording + +/** + * Stop recording automation events * - * @return {string} The resulting const char *. + * @return {undefined} */ -function GetGamepadName (gamepad) { - return r.BindGetGamepadName( - gamepad - ) +function StopAutomationEventRecording() { + return r.BindStopAutomationEventRecording() } -raylib.GetGamepadName = GetGamepadName +raylib.StopAutomationEventRecording = StopAutomationEventRecording /** - * Check if a gamepad button has been pressed once + * Play a recorded automation event * - * @param {number} gamepad - * @param {number} button + * @param {AutomationEvent} event * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function IsGamepadButtonPressed (gamepad, button) { - return r.BindIsGamepadButtonPressed( - gamepad, - button +function PlayAutomationEvent(event) { + return r.BindPlayAutomationEvent( + event.frame, + event.type, + event.params ) } -raylib.IsGamepadButtonPressed = IsGamepadButtonPressed +raylib.PlayAutomationEvent = PlayAutomationEvent /** - * Check if a gamepad button is being pressed + * Check if a key has been pressed once * - * @param {number} gamepad - * @param {number} button + * @param {number} key * * @return {boolean} The resulting bool. */ -function IsGamepadButtonDown (gamepad, button) { - return r.BindIsGamepadButtonDown( - gamepad, - button +function IsKeyPressed(key) { + return r.BindIsKeyPressed( + key ) } -raylib.IsGamepadButtonDown = IsGamepadButtonDown +raylib.IsKeyPressed = IsKeyPressed /** - * Check if a gamepad button has been released once + * Check if a key has been pressed again * - * @param {number} gamepad - * @param {number} button + * @param {number} key * * @return {boolean} The resulting bool. */ -function IsGamepadButtonReleased (gamepad, button) { - return r.BindIsGamepadButtonReleased( - gamepad, - button +function IsKeyPressedRepeat(key) { + return r.BindIsKeyPressedRepeat( + key ) } -raylib.IsGamepadButtonReleased = IsGamepadButtonReleased +raylib.IsKeyPressedRepeat = IsKeyPressedRepeat /** - * Check if a gamepad button is NOT being pressed + * Check if a key is being pressed * - * @param {number} gamepad - * @param {number} button + * @param {number} key * * @return {boolean} The resulting bool. */ -function IsGamepadButtonUp (gamepad, button) { - return r.BindIsGamepadButtonUp( - gamepad, - button +function IsKeyDown(key) { + return r.BindIsKeyDown( + key ) } -raylib.IsGamepadButtonUp = IsGamepadButtonUp +raylib.IsKeyDown = IsKeyDown /** - * Get the last gamepad button pressed + * Check if a key has been released once + * + * @param {number} key + * + * @return {boolean} The resulting bool. + */ +function IsKeyReleased(key) { + return r.BindIsKeyReleased( + key + ) +} +raylib.IsKeyReleased = IsKeyReleased + +/** + * Check if a key is NOT being pressed + * + * @param {number} key + * + * @return {boolean} The resulting bool. + */ +function IsKeyUp(key) { + return r.BindIsKeyUp( + key + ) +} +raylib.IsKeyUp = IsKeyUp + +/** + * Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty + * + * @return {number} The resulting int. + */ +function GetKeyPressed() { + return r.BindGetKeyPressed() +} +raylib.GetKeyPressed = GetKeyPressed + +/** + * Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty + * + * @return {number} The resulting int. + */ +function GetCharPressed() { + return r.BindGetCharPressed() +} +raylib.GetCharPressed = GetCharPressed + +/** + * Set a custom key to exit program (default is ESC) + * + * @param {number} key + * + * @return {undefined} + */ +function SetExitKey(key) { + return r.BindSetExitKey( + key + ) +} +raylib.SetExitKey = SetExitKey + +/** + * Check if a gamepad is available + * + * @param {number} gamepad + * + * @return {boolean} The resulting bool. + */ +function IsGamepadAvailable(gamepad) { + return r.BindIsGamepadAvailable( + gamepad + ) +} +raylib.IsGamepadAvailable = IsGamepadAvailable + +/** + * Get gamepad internal name id + * + * @param {number} gamepad + * + * @return {string} The resulting const char *. + */ +function GetGamepadName(gamepad) { + return r.BindGetGamepadName( + gamepad + ) +} +raylib.GetGamepadName = GetGamepadName + +/** + * Check if a gamepad button has been pressed once + * + * @param {number} gamepad + * @param {number} button + * + * @return {boolean} The resulting bool. + */ +function IsGamepadButtonPressed(gamepad, button) { + return r.BindIsGamepadButtonPressed( + gamepad, + button + ) +} +raylib.IsGamepadButtonPressed = IsGamepadButtonPressed + +/** + * Check if a gamepad button is being pressed + * + * @param {number} gamepad + * @param {number} button + * + * @return {boolean} The resulting bool. + */ +function IsGamepadButtonDown(gamepad, button) { + return r.BindIsGamepadButtonDown( + gamepad, + button + ) +} +raylib.IsGamepadButtonDown = IsGamepadButtonDown + +/** + * Check if a gamepad button has been released once + * + * @param {number} gamepad + * @param {number} button + * + * @return {boolean} The resulting bool. + */ +function IsGamepadButtonReleased(gamepad, button) { + return r.BindIsGamepadButtonReleased( + gamepad, + button + ) +} +raylib.IsGamepadButtonReleased = IsGamepadButtonReleased + +/** + * Check if a gamepad button is NOT being pressed + * + * @param {number} gamepad + * @param {number} button + * + * @return {boolean} The resulting bool. + */ +function IsGamepadButtonUp(gamepad, button) { + return r.BindIsGamepadButtonUp( + gamepad, + button + ) +} +raylib.IsGamepadButtonUp = IsGamepadButtonUp + +/** + * Get the last gamepad button pressed * * @return {number} The resulting int. */ -function GetGamepadButtonPressed () { +function GetGamepadButtonPressed() { return r.BindGetGamepadButtonPressed() } raylib.GetGamepadButtonPressed = GetGamepadButtonPressed @@ -2028,7 +2339,7 @@ raylib.GetGamepadButtonPressed = GetGamepadButtonPressed * * @return {number} The resulting int. */ -function GetGamepadAxisCount (gamepad) { +function GetGamepadAxisCount(gamepad) { return r.BindGetGamepadAxisCount( gamepad ) @@ -2043,7 +2354,7 @@ raylib.GetGamepadAxisCount = GetGamepadAxisCount * * @return {number} The resulting float. */ -function GetGamepadAxisMovement (gamepad, axis) { +function GetGamepadAxisMovement(gamepad, axis) { return r.BindGetGamepadAxisMovement( gamepad, axis @@ -2058,13 +2369,33 @@ raylib.GetGamepadAxisMovement = GetGamepadAxisMovement * * @return {number} The resulting int. */ -function SetGamepadMappings (mappings) { +function SetGamepadMappings(mappings) { return r.BindSetGamepadMappings( mappings ) } raylib.SetGamepadMappings = SetGamepadMappings +/** + * Set gamepad vibration for both motors (duration in seconds) + * + * @param {number} gamepad + * @param {number} leftMotor + * @param {number} rightMotor + * @param {number} duration + * + * @return {undefined} + */ +function SetGamepadVibration(gamepad, leftMotor, rightMotor, duration) { + return r.BindSetGamepadVibration( + gamepad, + leftMotor, + rightMotor, + duration + ) +} +raylib.SetGamepadVibration = SetGamepadVibration + /** * Check if a mouse button has been pressed once * @@ -2072,7 +2403,7 @@ raylib.SetGamepadMappings = SetGamepadMappings * * @return {boolean} The resulting bool. */ -function IsMouseButtonPressed (button) { +function IsMouseButtonPressed(button) { return r.BindIsMouseButtonPressed( button ) @@ -2086,7 +2417,7 @@ raylib.IsMouseButtonPressed = IsMouseButtonPressed * * @return {boolean} The resulting bool. */ -function IsMouseButtonDown (button) { +function IsMouseButtonDown(button) { return r.BindIsMouseButtonDown( button ) @@ -2100,7 +2431,7 @@ raylib.IsMouseButtonDown = IsMouseButtonDown * * @return {boolean} The resulting bool. */ -function IsMouseButtonReleased (button) { +function IsMouseButtonReleased(button) { return r.BindIsMouseButtonReleased( button ) @@ -2114,7 +2445,7 @@ raylib.IsMouseButtonReleased = IsMouseButtonReleased * * @return {boolean} The resulting bool. */ -function IsMouseButtonUp (button) { +function IsMouseButtonUp(button) { return r.BindIsMouseButtonUp( button ) @@ -2126,7 +2457,7 @@ raylib.IsMouseButtonUp = IsMouseButtonUp * * @return {number} The resulting int. */ -function GetMouseX () { +function GetMouseX() { return r.BindGetMouseX() } raylib.GetMouseX = GetMouseX @@ -2136,7 +2467,7 @@ raylib.GetMouseX = GetMouseX * * @return {number} The resulting int. */ -function GetMouseY () { +function GetMouseY() { return r.BindGetMouseY() } raylib.GetMouseY = GetMouseY @@ -2146,7 +2477,7 @@ raylib.GetMouseY = GetMouseY * * @return {Vector2} The resulting Vector2. */ -function GetMousePosition () { +function GetMousePosition() { return r.BindGetMousePosition() } raylib.GetMousePosition = GetMousePosition @@ -2156,7 +2487,7 @@ raylib.GetMousePosition = GetMousePosition * * @return {Vector2} The resulting Vector2. */ -function GetMouseDelta () { +function GetMouseDelta() { return r.BindGetMouseDelta() } raylib.GetMouseDelta = GetMouseDelta @@ -2169,7 +2500,7 @@ raylib.GetMouseDelta = GetMouseDelta * * @return {undefined} */ -function SetMousePosition (x, y) { +function SetMousePosition(x, y) { return r.BindSetMousePosition( x, y @@ -2185,7 +2516,7 @@ raylib.SetMousePosition = SetMousePosition * * @return {undefined} */ -function SetMouseOffset (offsetX, offsetY) { +function SetMouseOffset(offsetX, offsetY) { return r.BindSetMouseOffset( offsetX, offsetY @@ -2201,7 +2532,7 @@ raylib.SetMouseOffset = SetMouseOffset * * @return {undefined} */ -function SetMouseScale (scaleX, scaleY) { +function SetMouseScale(scaleX, scaleY) { return r.BindSetMouseScale( scaleX, scaleY @@ -2214,7 +2545,7 @@ raylib.SetMouseScale = SetMouseScale * * @return {number} The resulting float. */ -function GetMouseWheelMove () { +function GetMouseWheelMove() { return r.BindGetMouseWheelMove() } raylib.GetMouseWheelMove = GetMouseWheelMove @@ -2224,7 +2555,7 @@ raylib.GetMouseWheelMove = GetMouseWheelMove * * @return {Vector2} The resulting Vector2. */ -function GetMouseWheelMoveV () { +function GetMouseWheelMoveV() { return r.BindGetMouseWheelMoveV() } raylib.GetMouseWheelMoveV = GetMouseWheelMoveV @@ -2236,7 +2567,7 @@ raylib.GetMouseWheelMoveV = GetMouseWheelMoveV * * @return {undefined} */ -function SetMouseCursor (cursor) { +function SetMouseCursor(cursor) { return r.BindSetMouseCursor( cursor ) @@ -2248,7 +2579,7 @@ raylib.SetMouseCursor = SetMouseCursor * * @return {number} The resulting int. */ -function GetTouchX () { +function GetTouchX() { return r.BindGetTouchX() } raylib.GetTouchX = GetTouchX @@ -2258,7 +2589,7 @@ raylib.GetTouchX = GetTouchX * * @return {number} The resulting int. */ -function GetTouchY () { +function GetTouchY() { return r.BindGetTouchY() } raylib.GetTouchY = GetTouchY @@ -2270,7 +2601,7 @@ raylib.GetTouchY = GetTouchY * * @return {Vector2} The resulting Vector2. */ -function GetTouchPosition (index) { +function GetTouchPosition(index) { return r.BindGetTouchPosition( index ) @@ -2284,7 +2615,7 @@ raylib.GetTouchPosition = GetTouchPosition * * @return {number} The resulting int. */ -function GetTouchPointId (index) { +function GetTouchPointId(index) { return r.BindGetTouchPointId( index ) @@ -2296,7 +2627,7 @@ raylib.GetTouchPointId = GetTouchPointId * * @return {number} The resulting int. */ -function GetTouchPointCount () { +function GetTouchPointCount() { return r.BindGetTouchPointCount() } raylib.GetTouchPointCount = GetTouchPointCount @@ -2308,7 +2639,7 @@ raylib.GetTouchPointCount = GetTouchPointCount * * @return {undefined} */ -function SetGesturesEnabled (flags) { +function SetGesturesEnabled(flags) { return r.BindSetGesturesEnabled( flags ) @@ -2322,7 +2653,7 @@ raylib.SetGesturesEnabled = SetGesturesEnabled * * @return {boolean} The resulting bool. */ -function IsGestureDetected (gesture) { +function IsGestureDetected(gesture) { return r.BindIsGestureDetected( gesture ) @@ -2334,17 +2665,17 @@ raylib.IsGestureDetected = IsGestureDetected * * @return {number} The resulting int. */ -function GetGestureDetected () { +function GetGestureDetected() { return r.BindGetGestureDetected() } raylib.GetGestureDetected = GetGestureDetected /** - * Get gesture hold time in milliseconds + * Get gesture hold time in seconds * * @return {number} The resulting float. */ -function GetGestureHoldDuration () { +function GetGestureHoldDuration() { return r.BindGetGestureHoldDuration() } raylib.GetGestureHoldDuration = GetGestureHoldDuration @@ -2354,7 +2685,7 @@ raylib.GetGestureHoldDuration = GetGestureHoldDuration * * @return {Vector2} The resulting Vector2. */ -function GetGestureDragVector () { +function GetGestureDragVector() { return r.BindGetGestureDragVector() } raylib.GetGestureDragVector = GetGestureDragVector @@ -2364,7 +2695,7 @@ raylib.GetGestureDragVector = GetGestureDragVector * * @return {number} The resulting float. */ -function GetGestureDragAngle () { +function GetGestureDragAngle() { return r.BindGetGestureDragAngle() } raylib.GetGestureDragAngle = GetGestureDragAngle @@ -2374,7 +2705,7 @@ raylib.GetGestureDragAngle = GetGestureDragAngle * * @return {Vector2} The resulting Vector2. */ -function GetGesturePinchVector () { +function GetGesturePinchVector() { return r.BindGetGesturePinchVector() } raylib.GetGesturePinchVector = GetGesturePinchVector @@ -2384,7 +2715,7 @@ raylib.GetGesturePinchVector = GetGesturePinchVector * * @return {number} The resulting float. */ -function GetGesturePinchAngle () { +function GetGesturePinchAngle() { return r.BindGetGesturePinchAngle() } raylib.GetGesturePinchAngle = GetGesturePinchAngle @@ -2399,7 +2730,7 @@ raylib.GetGesturePinchAngle = GetGesturePinchAngle * * @return {undefined} */ -function UpdateCameraPro (camera, movement, rotation, zoom) { +function UpdateCameraPro(camera, movement, rotation, zoom) { return r.BindUpdateCameraPro( camera, movement.x, @@ -2421,7 +2752,7 @@ raylib.UpdateCameraPro = UpdateCameraPro * * @return {undefined} */ -function SetShapesTexture (texture, source) { +function SetShapesTexture(texture, source) { return r.BindSetShapesTexture( texture.id, texture.width, @@ -2437,7 +2768,27 @@ function SetShapesTexture (texture, source) { raylib.SetShapesTexture = SetShapesTexture /** - * Draw a pixel + * Get texture that is used for shapes drawing + * + * @return {Texture2D} The resulting Texture2D. + */ +function GetShapesTexture() { + return r.BindGetShapesTexture() +} +raylib.GetShapesTexture = GetShapesTexture + +/** + * Get texture source rectangle that is used for shapes drawing + * + * @return {Rectangle} The resulting Rectangle. + */ +function GetShapesTextureRectangle() { + return r.BindGetShapesTextureRectangle() +} +raylib.GetShapesTextureRectangle = GetShapesTextureRectangle + +/** + * Draw a pixel using geometry [Can be slow, use with care] * * @param {number} posX * @param {number} posY @@ -2445,7 +2796,7 @@ raylib.SetShapesTexture = SetShapesTexture * * @return {undefined} */ -function DrawPixel (posX, posY, color) { +function DrawPixel(posX, posY, color) { return r.BindDrawPixel( posX, posY, @@ -2458,14 +2809,14 @@ function DrawPixel (posX, posY, color) { raylib.DrawPixel = DrawPixel /** - * Draw a pixel (Vector version) + * Draw a pixel using geometry (Vector version) [Can be slow, use with care] * * @param {Vector2} position * @param {Color} color * * @return {undefined} */ -function DrawPixelV (position, color) { +function DrawPixelV(position, color) { return r.BindDrawPixelV( position.x, position.y, @@ -2488,7 +2839,7 @@ raylib.DrawPixelV = DrawPixelV * * @return {undefined} */ -function DrawLine (startPosX, startPosY, endPosX, endPosY, color) { +function DrawLine(startPosX, startPosY, endPosX, endPosY, color) { return r.BindDrawLine( startPosX, startPosY, @@ -2503,7 +2854,7 @@ function DrawLine (startPosX, startPosY, endPosX, endPosY, color) { raylib.DrawLine = DrawLine /** - * Draw a line (Vector version) + * Draw a line (using gl lines) * * @param {Vector2} startPos * @param {Vector2} endPos @@ -2511,7 +2862,7 @@ raylib.DrawLine = DrawLine * * @return {undefined} */ -function DrawLineV (startPos, endPos, color) { +function DrawLineV(startPos, endPos, color) { return r.BindDrawLineV( startPos.x, startPos.y, @@ -2526,7 +2877,7 @@ function DrawLineV (startPos, endPos, color) { raylib.DrawLineV = DrawLineV /** - * Draw a line defining thickness + * Draw a line (using triangles/quads) * * @param {Vector2} startPos * @param {Vector2} endPos @@ -2535,7 +2886,7 @@ raylib.DrawLineV = DrawLineV * * @return {undefined} */ -function DrawLineEx (startPos, endPos, thick, color) { +function DrawLineEx(startPos, endPos, thick, color) { return r.BindDrawLineEx( startPos.x, startPos.y, @@ -2551,80 +2902,42 @@ function DrawLineEx (startPos, endPos, thick, color) { raylib.DrawLineEx = DrawLineEx /** - * Draw a line using cubic-bezier curves in-out - * - * @param {Vector2} startPos - * @param {Vector2} endPos - * @param {number} thick - * @param {Color} color - * - * @return {undefined} - */ -function DrawLineBezier (startPos, endPos, thick, color) { - return r.BindDrawLineBezier( - startPos.x, - startPos.y, - endPos.x, - endPos.y, - thick, - color.r, - color.g, - color.b, - color.a - ) -} -raylib.DrawLineBezier = DrawLineBezier - -/** - * Draw line using quadratic bezier curves with a control point + * Draw lines sequence (using gl lines) * - * @param {Vector2} startPos - * @param {Vector2} endPos - * @param {Vector2} controlPos - * @param {number} thick + * @param {number} points + * @param {number} pointCount * @param {Color} color * * @return {undefined} */ -function DrawLineBezierQuad (startPos, endPos, controlPos, thick, color) { - return r.BindDrawLineBezierQuad( - startPos.x, - startPos.y, - endPos.x, - endPos.y, - controlPos.x, - controlPos.y, - thick, +function DrawLineStrip(points, pointCount, color) { + return r.BindDrawLineStrip( + points, + pointCount, color.r, color.g, color.b, color.a ) } -raylib.DrawLineBezierQuad = DrawLineBezierQuad +raylib.DrawLineStrip = DrawLineStrip /** - * Draw line using cubic bezier curves with 2 control points + * Draw line segment cubic-bezier in-out interpolation * * @param {Vector2} startPos * @param {Vector2} endPos - * @param {Vector2} startControlPos - * @param {Vector2} endControlPos * @param {number} thick * @param {Color} color * * @return {undefined} */ -function DrawLineBezierCubic (startPos, endPos, startControlPos, endControlPos, thick, color) { - return r.BindDrawLineBezierCubic( +function DrawLineBezier(startPos, endPos, thick, color) { + return r.BindDrawLineBezier( startPos.x, startPos.y, endPos.x, endPos.y, - startControlPos.x, - startControlPos.y, - endControlPos.x, - endControlPos.y, thick, color.r, color.g, @@ -2632,28 +2945,7 @@ function DrawLineBezierCubic (startPos, endPos, startControlPos, endControlPos, color.a ) } -raylib.DrawLineBezierCubic = DrawLineBezierCubic - -/** - * Draw lines sequence - * - * @param {number} points - * @param {number} pointCount - * @param {Color} color - * - * @return {undefined} - */ -function DrawLineStrip (points, pointCount, color) { - return r.BindDrawLineStrip( - points, - pointCount, - color.r, - color.g, - color.b, - color.a - ) -} -raylib.DrawLineStrip = DrawLineStrip +raylib.DrawLineBezier = DrawLineBezier /** * Draw a color-filled circle @@ -2665,7 +2957,7 @@ raylib.DrawLineStrip = DrawLineStrip * * @return {undefined} */ -function DrawCircle (centerX, centerY, radius, color) { +function DrawCircle(centerX, centerY, radius, color) { return r.BindDrawCircle( centerX, centerY, @@ -2690,7 +2982,7 @@ raylib.DrawCircle = DrawCircle * * @return {undefined} */ -function DrawCircleSector (center, radius, startAngle, endAngle, segments, color) { +function DrawCircleSector(center, radius, startAngle, endAngle, segments, color) { return r.BindDrawCircleSector( center.x, center.y, @@ -2718,7 +3010,7 @@ raylib.DrawCircleSector = DrawCircleSector * * @return {undefined} */ -function DrawCircleSectorLines (center, radius, startAngle, endAngle, segments, color) { +function DrawCircleSectorLines(center, radius, startAngle, endAngle, segments, color) { return r.BindDrawCircleSectorLines( center.x, center.y, @@ -2740,24 +3032,24 @@ raylib.DrawCircleSectorLines = DrawCircleSectorLines * @param {number} centerX * @param {number} centerY * @param {number} radius - * @param {Color} color1 - * @param {Color} color2 + * @param {Color} inner + * @param {Color} outer * * @return {undefined} */ -function DrawCircleGradient (centerX, centerY, radius, color1, color2) { +function DrawCircleGradient(centerX, centerY, radius, inner, outer) { return r.BindDrawCircleGradient( centerX, centerY, radius, - color1.r, - color1.g, - color1.b, - color1.a, - color2.r, - color2.g, - color2.b, - color2.a + inner.r, + inner.g, + inner.b, + inner.a, + outer.r, + outer.g, + outer.b, + outer.a ) } raylib.DrawCircleGradient = DrawCircleGradient @@ -2771,7 +3063,7 @@ raylib.DrawCircleGradient = DrawCircleGradient * * @return {undefined} */ -function DrawCircleV (center, radius, color) { +function DrawCircleV(center, radius, color) { return r.BindDrawCircleV( center.x, center.y, @@ -2794,7 +3086,7 @@ raylib.DrawCircleV = DrawCircleV * * @return {undefined} */ -function DrawCircleLines (centerX, centerY, radius, color) { +function DrawCircleLines(centerX, centerY, radius, color) { return r.BindDrawCircleLines( centerX, centerY, @@ -2808,24 +3100,46 @@ function DrawCircleLines (centerX, centerY, radius, color) { raylib.DrawCircleLines = DrawCircleLines /** - * Draw ellipse + * Draw circle outline (Vector version) * - * @param {number} centerX - * @param {number} centerY - * @param {number} radiusH - * @param {number} radiusV + * @param {Vector2} center + * @param {number} radius * @param {Color} color * * @return {undefined} */ -function DrawEllipse (centerX, centerY, radiusH, radiusV, color) { - return r.BindDrawEllipse( - centerX, - centerY, - radiusH, - radiusV, - color.r, - color.g, +function DrawCircleLinesV(center, radius, color) { + return r.BindDrawCircleLinesV( + center.x, + center.y, + radius, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCircleLinesV = DrawCircleLinesV + +/** + * Draw ellipse + * + * @param {number} centerX + * @param {number} centerY + * @param {number} radiusH + * @param {number} radiusV + * @param {Color} color + * + * @return {undefined} + */ +function DrawEllipse(centerX, centerY, radiusH, radiusV, color) { + return r.BindDrawEllipse( + centerX, + centerY, + radiusH, + radiusV, + color.r, + color.g, color.b, color.a ) @@ -2843,7 +3157,7 @@ raylib.DrawEllipse = DrawEllipse * * @return {undefined} */ -function DrawEllipseLines (centerX, centerY, radiusH, radiusV, color) { +function DrawEllipseLines(centerX, centerY, radiusH, radiusV, color) { return r.BindDrawEllipseLines( centerX, centerY, @@ -2870,7 +3184,7 @@ raylib.DrawEllipseLines = DrawEllipseLines * * @return {undefined} */ -function DrawRing (center, innerRadius, outerRadius, startAngle, endAngle, segments, color) { +function DrawRing(center, innerRadius, outerRadius, startAngle, endAngle, segments, color) { return r.BindDrawRing( center.x, center.y, @@ -2900,7 +3214,7 @@ raylib.DrawRing = DrawRing * * @return {undefined} */ -function DrawRingLines (center, innerRadius, outerRadius, startAngle, endAngle, segments, color) { +function DrawRingLines(center, innerRadius, outerRadius, startAngle, endAngle, segments, color) { return r.BindDrawRingLines( center.x, center.y, @@ -2928,7 +3242,7 @@ raylib.DrawRingLines = DrawRingLines * * @return {undefined} */ -function DrawRectangle (posX, posY, width, height, color) { +function DrawRectangle(posX, posY, width, height, color) { return r.BindDrawRectangle( posX, posY, @@ -2951,7 +3265,7 @@ raylib.DrawRectangle = DrawRectangle * * @return {undefined} */ -function DrawRectangleV (position, size, color) { +function DrawRectangleV(position, size, color) { return r.BindDrawRectangleV( position.x, position.y, @@ -2973,7 +3287,7 @@ raylib.DrawRectangleV = DrawRectangleV * * @return {undefined} */ -function DrawRectangleRec (rec, color) { +function DrawRectangleRec(rec, color) { return r.BindDrawRectangleRec( rec.x, rec.y, @@ -2997,7 +3311,7 @@ raylib.DrawRectangleRec = DrawRectangleRec * * @return {undefined} */ -function DrawRectanglePro (rec, origin, rotation, color) { +function DrawRectanglePro(rec, origin, rotation, color) { return r.BindDrawRectanglePro( rec.x, rec.y, @@ -3021,25 +3335,25 @@ raylib.DrawRectanglePro = DrawRectanglePro * @param {number} posY * @param {number} width * @param {number} height - * @param {Color} color1 - * @param {Color} color2 + * @param {Color} top + * @param {Color} bottom * * @return {undefined} */ -function DrawRectangleGradientV (posX, posY, width, height, color1, color2) { +function DrawRectangleGradientV(posX, posY, width, height, top, bottom) { return r.BindDrawRectangleGradientV( posX, posY, width, height, - color1.r, - color1.g, - color1.b, - color1.a, - color2.r, - color2.g, - color2.b, - color2.a + top.r, + top.g, + top.b, + top.a, + bottom.r, + bottom.g, + bottom.b, + bottom.a ) } raylib.DrawRectangleGradientV = DrawRectangleGradientV @@ -3051,25 +3365,25 @@ raylib.DrawRectangleGradientV = DrawRectangleGradientV * @param {number} posY * @param {number} width * @param {number} height - * @param {Color} color1 - * @param {Color} color2 + * @param {Color} left + * @param {Color} right * * @return {undefined} */ -function DrawRectangleGradientH (posX, posY, width, height, color1, color2) { +function DrawRectangleGradientH(posX, posY, width, height, left, right) { return r.BindDrawRectangleGradientH( posX, posY, width, height, - color1.r, - color1.g, - color1.b, - color1.a, - color2.r, - color2.g, - color2.b, - color2.a + left.r, + left.g, + left.b, + left.a, + right.r, + right.g, + right.b, + right.a ) } raylib.DrawRectangleGradientH = DrawRectangleGradientH @@ -3078,35 +3392,35 @@ raylib.DrawRectangleGradientH = DrawRectangleGradientH * Draw a gradient-filled rectangle with custom vertex colors * * @param {Rectangle} rec - * @param {Color} col1 - * @param {Color} col2 - * @param {Color} col3 - * @param {Color} col4 + * @param {Color} topLeft + * @param {Color} bottomLeft + * @param {Color} topRight + * @param {Color} bottomRight * * @return {undefined} */ -function DrawRectangleGradientEx (rec, col1, col2, col3, col4) { +function DrawRectangleGradientEx(rec, topLeft, bottomLeft, topRight, bottomRight) { return r.BindDrawRectangleGradientEx( rec.x, rec.y, rec.width, rec.height, - col1.r, - col1.g, - col1.b, - col1.a, - col2.r, - col2.g, - col2.b, - col2.a, - col3.r, - col3.g, - col3.b, - col3.a, - col4.r, - col4.g, - col4.b, - col4.a + topLeft.r, + topLeft.g, + topLeft.b, + topLeft.a, + bottomLeft.r, + bottomLeft.g, + bottomLeft.b, + bottomLeft.a, + topRight.r, + topRight.g, + topRight.b, + topRight.a, + bottomRight.r, + bottomRight.g, + bottomRight.b, + bottomRight.a ) } raylib.DrawRectangleGradientEx = DrawRectangleGradientEx @@ -3122,7 +3436,7 @@ raylib.DrawRectangleGradientEx = DrawRectangleGradientEx * * @return {undefined} */ -function DrawRectangleLines (posX, posY, width, height, color) { +function DrawRectangleLines(posX, posY, width, height, color) { return r.BindDrawRectangleLines( posX, posY, @@ -3145,7 +3459,7 @@ raylib.DrawRectangleLines = DrawRectangleLines * * @return {undefined} */ -function DrawRectangleLinesEx (rec, lineThick, color) { +function DrawRectangleLinesEx(rec, lineThick, color) { return r.BindDrawRectangleLinesEx( rec.x, rec.y, @@ -3170,7 +3484,7 @@ raylib.DrawRectangleLinesEx = DrawRectangleLinesEx * * @return {undefined} */ -function DrawRectangleRounded (rec, roundness, segments, color) { +function DrawRectangleRounded(rec, roundness, segments, color) { return r.BindDrawRectangleRounded( rec.x, rec.y, @@ -3186,6 +3500,32 @@ function DrawRectangleRounded (rec, roundness, segments, color) { } raylib.DrawRectangleRounded = DrawRectangleRounded +/** + * Draw rectangle lines with rounded edges + * + * @param {Rectangle} rec + * @param {number} roundness + * @param {number} segments + * @param {Color} color + * + * @return {undefined} + */ +function DrawRectangleRoundedLines(rec, roundness, segments, color) { + return r.BindDrawRectangleRoundedLines( + rec.x, + rec.y, + rec.width, + rec.height, + roundness, + segments, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawRectangleRoundedLines = DrawRectangleRoundedLines + /** * Draw rectangle with rounded edges outline * @@ -3197,8 +3537,8 @@ raylib.DrawRectangleRounded = DrawRectangleRounded * * @return {undefined} */ -function DrawRectangleRoundedLines (rec, roundness, segments, lineThick, color) { - return r.BindDrawRectangleRoundedLines( +function DrawRectangleRoundedLinesEx(rec, roundness, segments, lineThick, color) { + return r.BindDrawRectangleRoundedLinesEx( rec.x, rec.y, rec.width, @@ -3212,7 +3552,7 @@ function DrawRectangleRoundedLines (rec, roundness, segments, lineThick, color) color.a ) } -raylib.DrawRectangleRoundedLines = DrawRectangleRoundedLines +raylib.DrawRectangleRoundedLinesEx = DrawRectangleRoundedLinesEx /** * Draw a color-filled triangle (vertex in counter-clockwise order!) @@ -3224,7 +3564,7 @@ raylib.DrawRectangleRoundedLines = DrawRectangleRoundedLines * * @return {undefined} */ -function DrawTriangle (v1, v2, v3, color) { +function DrawTriangle(v1, v2, v3, color) { return r.BindDrawTriangle( v1.x, v1.y, @@ -3250,7 +3590,7 @@ raylib.DrawTriangle = DrawTriangle * * @return {undefined} */ -function DrawTriangleLines (v1, v2, v3, color) { +function DrawTriangleLines(v1, v2, v3, color) { return r.BindDrawTriangleLines( v1.x, v1.y, @@ -3275,7 +3615,7 @@ raylib.DrawTriangleLines = DrawTriangleLines * * @return {undefined} */ -function DrawTriangleFan (points, pointCount, color) { +function DrawTriangleFan(points, pointCount, color) { return r.BindDrawTriangleFan( points, pointCount, @@ -3296,7 +3636,7 @@ raylib.DrawTriangleFan = DrawTriangleFan * * @return {undefined} */ -function DrawTriangleStrip (points, pointCount, color) { +function DrawTriangleStrip(points, pointCount, color) { return r.BindDrawTriangleStrip( points, pointCount, @@ -3319,7 +3659,7 @@ raylib.DrawTriangleStrip = DrawTriangleStrip * * @return {undefined} */ -function DrawPoly (center, sides, radius, rotation, color) { +function DrawPoly(center, sides, radius, rotation, color) { return r.BindDrawPoly( center.x, center.y, @@ -3345,7 +3685,7 @@ raylib.DrawPoly = DrawPoly * * @return {undefined} */ -function DrawPolyLines (center, sides, radius, rotation, color) { +function DrawPolyLines(center, sides, radius, rotation, color) { return r.BindDrawPolyLines( center.x, center.y, @@ -3372,7 +3712,7 @@ raylib.DrawPolyLines = DrawPolyLines * * @return {undefined} */ -function DrawPolyLinesEx (center, sides, radius, rotation, lineThick, color) { +function DrawPolyLinesEx(center, sides, radius, rotation, lineThick, color) { return r.BindDrawPolyLinesEx( center.x, center.y, @@ -3389,727 +3729,757 @@ function DrawPolyLinesEx (center, sides, radius, rotation, lineThick, color) { raylib.DrawPolyLinesEx = DrawPolyLinesEx /** - * Check collision between two rectangles + * Draw spline: Linear, minimum 2 points * - * @param {Rectangle} rec1 - * @param {Rectangle} rec2 + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionRecs (rec1, rec2) { - return r.BindCheckCollisionRecs( - rec1.x, - rec1.y, - rec1.width, - rec1.height, - rec2.x, - rec2.y, - rec2.width, - rec2.height +function DrawSplineLinear(points, pointCount, thick, color) { + return r.BindDrawSplineLinear( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionRecs = CheckCollisionRecs +raylib.DrawSplineLinear = DrawSplineLinear /** - * Check collision between two circles + * Draw spline: B-Spline, minimum 4 points * - * @param {Vector2} center1 - * @param {number} radius1 - * @param {Vector2} center2 - * @param {number} radius2 + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionCircles (center1, radius1, center2, radius2) { - return r.BindCheckCollisionCircles( - center1.x, - center1.y, - radius1, - center2.x, - center2.y, - radius2 +function DrawSplineBasis(points, pointCount, thick, color) { + return r.BindDrawSplineBasis( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionCircles = CheckCollisionCircles +raylib.DrawSplineBasis = DrawSplineBasis /** - * Check collision between circle and rectangle + * Draw spline: Catmull-Rom, minimum 4 points * - * @param {Vector2} center - * @param {number} radius - * @param {Rectangle} rec + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionCircleRec (center, radius, rec) { - return r.BindCheckCollisionCircleRec( - center.x, - center.y, - radius, - rec.x, - rec.y, - rec.width, - rec.height +function DrawSplineCatmullRom(points, pointCount, thick, color) { + return r.BindDrawSplineCatmullRom( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionCircleRec = CheckCollisionCircleRec +raylib.DrawSplineCatmullRom = DrawSplineCatmullRom /** - * Check if point is inside rectangle + * Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] * - * @param {Vector2} point - * @param {Rectangle} rec + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointRec (point, rec) { - return r.BindCheckCollisionPointRec( - point.x, - point.y, - rec.x, - rec.y, - rec.width, - rec.height +function DrawSplineBezierQuadratic(points, pointCount, thick, color) { + return r.BindDrawSplineBezierQuadratic( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionPointRec = CheckCollisionPointRec +raylib.DrawSplineBezierQuadratic = DrawSplineBezierQuadratic /** - * Check if point is inside circle + * Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] * - * @param {Vector2} point - * @param {Vector2} center - * @param {number} radius + * @param {number} points + * @param {number} pointCount + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointCircle (point, center, radius) { - return r.BindCheckCollisionPointCircle( - point.x, - point.y, - center.x, - center.y, - radius +function DrawSplineBezierCubic(points, pointCount, thick, color) { + return r.BindDrawSplineBezierCubic( + points, + pointCount, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionPointCircle = CheckCollisionPointCircle +raylib.DrawSplineBezierCubic = DrawSplineBezierCubic /** - * Check if point is inside a triangle + * Draw spline segment: Linear, 2 points * - * @param {Vector2} point * @param {Vector2} p1 * @param {Vector2} p2 - * @param {Vector2} p3 + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointTriangle (point, p1, p2, p3) { - return r.BindCheckCollisionPointTriangle( - point.x, - point.y, +function DrawSplineSegmentLinear(p1, p2, thick, color) { + return r.BindDrawSplineSegmentLinear( p1.x, p1.y, p2.x, p2.y, - p3.x, - p3.y + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionPointTriangle = CheckCollisionPointTriangle +raylib.DrawSplineSegmentLinear = DrawSplineSegmentLinear /** - * Check if point is within a polygon described by array of vertices + * Draw spline segment: B-Spline, 4 points * - * @param {Vector2} point - * @param {number} points - * @param {number} pointCount + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {Vector2} p3 + * @param {Vector2} p4 + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointPoly (point, points, pointCount) { - return r.BindCheckCollisionPointPoly( - point.x, - point.y, - points, - pointCount - ) -} -raylib.CheckCollisionPointPoly = CheckCollisionPointPoly - -/** - * Check the collision between two lines defined by two points each, returns collision point by reference - * - * @param {Vector2} startPos1 - * @param {Vector2} endPos1 - * @param {Vector2} startPos2 - * @param {Vector2} endPos2 - * @param {number} collisionPoint - * - * @return {boolean} The resulting bool. - */ -function CheckCollisionLines (startPos1, endPos1, startPos2, endPos2, collisionPoint) { - return r.BindCheckCollisionLines( - startPos1.x, - startPos1.y, - endPos1.x, - endPos1.y, - startPos2.x, - startPos2.y, - endPos2.x, - endPos2.y, - collisionPoint +function DrawSplineSegmentBasis(p1, p2, p3, p4, thick, color) { + return r.BindDrawSplineSegmentBasis( + p1.x, + p1.y, + p2.x, + p2.y, + p3.x, + p3.y, + p4.x, + p4.y, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionLines = CheckCollisionLines +raylib.DrawSplineSegmentBasis = DrawSplineSegmentBasis /** - * Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] + * Draw spline segment: Catmull-Rom, 4 points * - * @param {Vector2} point * @param {Vector2} p1 * @param {Vector2} p2 - * @param {number} threshold + * @param {Vector2} p3 + * @param {Vector2} p4 + * @param {number} thick + * @param {Color} color * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function CheckCollisionPointLine (point, p1, p2, threshold) { - return r.BindCheckCollisionPointLine( - point.x, - point.y, +function DrawSplineSegmentCatmullRom(p1, p2, p3, p4, thick, color) { + return r.BindDrawSplineSegmentCatmullRom( p1.x, p1.y, p2.x, p2.y, - threshold + p3.x, + p3.y, + p4.x, + p4.y, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.CheckCollisionPointLine = CheckCollisionPointLine +raylib.DrawSplineSegmentCatmullRom = DrawSplineSegmentCatmullRom /** - * Get collision rectangle for two rectangles collision + * Draw spline segment: Quadratic Bezier, 2 points, 1 control point * - * @param {Rectangle} rec1 - * @param {Rectangle} rec2 + * @param {Vector2} p1 + * @param {Vector2} c2 + * @param {Vector2} p3 + * @param {number} thick + * @param {Color} color * - * @return {Rectangle} The resulting Rectangle. + * @return {undefined} */ -function GetCollisionRec (rec1, rec2) { - return r.BindGetCollisionRec( - rec1.x, - rec1.y, - rec1.width, - rec1.height, - rec2.x, - rec2.y, - rec2.width, - rec2.height +function DrawSplineSegmentBezierQuadratic(p1, c2, p3, thick, color) { + return r.BindDrawSplineSegmentBezierQuadratic( + p1.x, + p1.y, + c2.x, + c2.y, + p3.x, + p3.y, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.GetCollisionRec = GetCollisionRec +raylib.DrawSplineSegmentBezierQuadratic = DrawSplineSegmentBezierQuadratic /** - * Load image from file into CPU memory (RAM) + * Draw spline segment: Cubic Bezier, 2 points, 2 control points * - * @param {string} fileName + * @param {Vector2} p1 + * @param {Vector2} c2 + * @param {Vector2} c3 + * @param {Vector2} p4 + * @param {number} thick + * @param {Color} color * - * @return {Image} The resulting Image. + * @return {undefined} */ -function LoadImage (fileName) { - return r.BindLoadImage( - fileName +function DrawSplineSegmentBezierCubic(p1, c2, c3, p4, thick, color) { + return r.BindDrawSplineSegmentBezierCubic( + p1.x, + p1.y, + c2.x, + c2.y, + c3.x, + c3.y, + p4.x, + p4.y, + thick, + color.r, + color.g, + color.b, + color.a ) } -raylib.LoadImage = LoadImage +raylib.DrawSplineSegmentBezierCubic = DrawSplineSegmentBezierCubic /** - * Load image from RAW file data + * Get (evaluate) spline point: Linear * - * @param {string} fileName - * @param {number} width - * @param {number} height - * @param {number} format - * @param {number} headerSize + * @param {Vector2} startPos + * @param {Vector2} endPos + * @param {number} t * - * @return {Image} The resulting Image. + * @return {Vector2} The resulting Vector2. */ -function LoadImageRaw (fileName, width, height, format, headerSize) { - return r.BindLoadImageRaw( - fileName, - width, - height, - format, - headerSize +function GetSplinePointLinear(startPos, endPos, t) { + return r.BindGetSplinePointLinear( + startPos.x, + startPos.y, + endPos.x, + endPos.y, + t ) } -raylib.LoadImageRaw = LoadImageRaw +raylib.GetSplinePointLinear = GetSplinePointLinear /** - * Load image sequence from file (frames appended to image.data) + * Get (evaluate) spline point: B-Spline * - * @param {string} fileName - * @param {number} frames + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {Vector2} p3 + * @param {Vector2} p4 + * @param {number} t * - * @return {Image} The resulting Image. + * @return {Vector2} The resulting Vector2. */ -function LoadImageAnim (fileName, frames) { - return r.BindLoadImageAnim( - fileName, - frames +function GetSplinePointBasis(p1, p2, p3, p4, t) { + return r.BindGetSplinePointBasis( + p1.x, + p1.y, + p2.x, + p2.y, + p3.x, + p3.y, + p4.x, + p4.y, + t ) } -raylib.LoadImageAnim = LoadImageAnim +raylib.GetSplinePointBasis = GetSplinePointBasis /** - * Load image from memory buffer, fileType refers to extension: i.e. '.png' + * Get (evaluate) spline point: Catmull-Rom * - * @param {string} fileType - * @param {Buffer} fileData - * @param {number} dataSize + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {Vector2} p3 + * @param {Vector2} p4 + * @param {number} t * - * @return {Image} The resulting Image. + * @return {Vector2} The resulting Vector2. */ -function LoadImageFromMemory (fileType, fileData, dataSize) { - return r.BindLoadImageFromMemory( - fileType, - fileData, - dataSize +function GetSplinePointCatmullRom(p1, p2, p3, p4, t) { + return r.BindGetSplinePointCatmullRom( + p1.x, + p1.y, + p2.x, + p2.y, + p3.x, + p3.y, + p4.x, + p4.y, + t ) } -raylib.LoadImageFromMemory = LoadImageFromMemory +raylib.GetSplinePointCatmullRom = GetSplinePointCatmullRom /** - * Load image from GPU texture data + * Get (evaluate) spline point: Quadratic Bezier * - * @param {Texture} texture + * @param {Vector2} p1 + * @param {Vector2} c2 + * @param {Vector2} p3 + * @param {number} t * - * @return {Image} The resulting Image. + * @return {Vector2} The resulting Vector2. */ -function LoadImageFromTexture (texture) { - return r.BindLoadImageFromTexture( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format +function GetSplinePointBezierQuad(p1, c2, p3, t) { + return r.BindGetSplinePointBezierQuad( + p1.x, + p1.y, + c2.x, + c2.y, + p3.x, + p3.y, + t ) } -raylib.LoadImageFromTexture = LoadImageFromTexture +raylib.GetSplinePointBezierQuad = GetSplinePointBezierQuad /** - * Load image from screen buffer and (screenshot) + * Get (evaluate) spline point: Cubic Bezier * - * @return {Image} The resulting Image. + * @param {Vector2} p1 + * @param {Vector2} c2 + * @param {Vector2} c3 + * @param {Vector2} p4 + * @param {number} t + * + * @return {Vector2} The resulting Vector2. */ -function LoadImageFromScreen () { - return r.BindLoadImageFromScreen() +function GetSplinePointBezierCubic(p1, c2, c3, p4, t) { + return r.BindGetSplinePointBezierCubic( + p1.x, + p1.y, + c2.x, + c2.y, + c3.x, + c3.y, + p4.x, + p4.y, + t + ) } -raylib.LoadImageFromScreen = LoadImageFromScreen +raylib.GetSplinePointBezierCubic = GetSplinePointBezierCubic /** - * Check if an image is ready + * Check collision between two rectangles * - * @param {Image} image + * @param {Rectangle} rec1 + * @param {Rectangle} rec2 * * @return {boolean} The resulting bool. */ -function IsImageReady (image) { - return r.BindIsImageReady( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function CheckCollisionRecs(rec1, rec2) { + return r.BindCheckCollisionRecs( + rec1.x, + rec1.y, + rec1.width, + rec1.height, + rec2.x, + rec2.y, + rec2.width, + rec2.height ) } -raylib.IsImageReady = IsImageReady +raylib.CheckCollisionRecs = CheckCollisionRecs /** - * Unload image from CPU memory (RAM) + * Check collision between two circles * - * @param {Image} image + * @param {Vector2} center1 + * @param {number} radius1 + * @param {Vector2} center2 + * @param {number} radius2 * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function UnloadImage (image) { - return r.BindUnloadImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function CheckCollisionCircles(center1, radius1, center2, radius2) { + return r.BindCheckCollisionCircles( + center1.x, + center1.y, + radius1, + center2.x, + center2.y, + radius2 ) } -raylib.UnloadImage = UnloadImage +raylib.CheckCollisionCircles = CheckCollisionCircles /** - * Export image data to file, returns true on success + * Check collision between circle and rectangle * - * @param {Image} image - * @param {string} fileName + * @param {Vector2} center + * @param {number} radius + * @param {Rectangle} rec * * @return {boolean} The resulting bool. */ -function ExportImage (image, fileName) { - return r.BindExportImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - fileName +function CheckCollisionCircleRec(center, radius, rec) { + return r.BindCheckCollisionCircleRec( + center.x, + center.y, + radius, + rec.x, + rec.y, + rec.width, + rec.height ) } -raylib.ExportImage = ExportImage +raylib.CheckCollisionCircleRec = CheckCollisionCircleRec /** - * Export image as code file defining an array of bytes, returns true on success + * Check if circle collides with a line created betweeen two points [p1] and [p2] * - * @param {Image} image - * @param {string} fileName + * @param {Vector2} center + * @param {number} radius + * @param {Vector2} p1 + * @param {Vector2} p2 * * @return {boolean} The resulting bool. */ -function ExportImageAsCode (image, fileName) { - return r.BindExportImageAsCode( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - fileName +function CheckCollisionCircleLine(center, radius, p1, p2) { + return r.BindCheckCollisionCircleLine( + center.x, + center.y, + radius, + p1.x, + p1.y, + p2.x, + p2.y ) } -raylib.ExportImageAsCode = ExportImageAsCode +raylib.CheckCollisionCircleLine = CheckCollisionCircleLine /** - * Generate image: plain color + * Check if point is inside rectangle * - * @param {number} width - * @param {number} height - * @param {Color} color + * @param {Vector2} point + * @param {Rectangle} rec * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageColor (width, height, color) { - return r.BindGenImageColor( - width, - height, - color.r, - color.g, - color.b, - color.a +function CheckCollisionPointRec(point, rec) { + return r.BindCheckCollisionPointRec( + point.x, + point.y, + rec.x, + rec.y, + rec.width, + rec.height ) } -raylib.GenImageColor = GenImageColor +raylib.CheckCollisionPointRec = CheckCollisionPointRec /** - * Generate image: vertical gradient + * Check if point is inside circle * - * @param {number} width - * @param {number} height - * @param {Color} top - * @param {Color} bottom + * @param {Vector2} point + * @param {Vector2} center + * @param {number} radius * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageGradientV (width, height, top, bottom) { - return r.BindGenImageGradientV( - width, - height, - top.r, - top.g, - top.b, - top.a, - bottom.r, - bottom.g, - bottom.b, - bottom.a +function CheckCollisionPointCircle(point, center, radius) { + return r.BindCheckCollisionPointCircle( + point.x, + point.y, + center.x, + center.y, + radius ) } -raylib.GenImageGradientV = GenImageGradientV +raylib.CheckCollisionPointCircle = CheckCollisionPointCircle /** - * Generate image: horizontal gradient + * Check if point is inside a triangle * - * @param {number} width - * @param {number} height - * @param {Color} left - * @param {Color} right + * @param {Vector2} point + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {Vector2} p3 * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageGradientH (width, height, left, right) { - return r.BindGenImageGradientH( - width, - height, - left.r, - left.g, - left.b, - left.a, - right.r, - right.g, - right.b, - right.a +function CheckCollisionPointTriangle(point, p1, p2, p3) { + return r.BindCheckCollisionPointTriangle( + point.x, + point.y, + p1.x, + p1.y, + p2.x, + p2.y, + p3.x, + p3.y ) } -raylib.GenImageGradientH = GenImageGradientH +raylib.CheckCollisionPointTriangle = CheckCollisionPointTriangle /** - * Generate image: radial gradient + * Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] * - * @param {number} width - * @param {number} height - * @param {number} density - * @param {Color} inner - * @param {Color} outer + * @param {Vector2} point + * @param {Vector2} p1 + * @param {Vector2} p2 + * @param {number} threshold * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageGradientRadial (width, height, density, inner, outer) { - return r.BindGenImageGradientRadial( - width, - height, - density, - inner.r, - inner.g, - inner.b, - inner.a, - outer.r, - outer.g, - outer.b, - outer.a +function CheckCollisionPointLine(point, p1, p2, threshold) { + return r.BindCheckCollisionPointLine( + point.x, + point.y, + p1.x, + p1.y, + p2.x, + p2.y, + threshold ) } -raylib.GenImageGradientRadial = GenImageGradientRadial +raylib.CheckCollisionPointLine = CheckCollisionPointLine /** - * Generate image: checked + * Check if point is within a polygon described by array of vertices * - * @param {number} width - * @param {number} height - * @param {number} checksX - * @param {number} checksY - * @param {Color} col1 - * @param {Color} col2 + * @param {Vector2} point + * @param {number} points + * @param {number} pointCount * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageChecked (width, height, checksX, checksY, col1, col2) { - return r.BindGenImageChecked( - width, - height, - checksX, - checksY, - col1.r, - col1.g, - col1.b, - col1.a, - col2.r, - col2.g, - col2.b, - col2.a +function CheckCollisionPointPoly(point, points, pointCount) { + return r.BindCheckCollisionPointPoly( + point.x, + point.y, + points, + pointCount ) } -raylib.GenImageChecked = GenImageChecked +raylib.CheckCollisionPointPoly = CheckCollisionPointPoly /** - * Generate image: white noise + * Check the collision between two lines defined by two points each, returns collision point by reference * - * @param {number} width - * @param {number} height - * @param {number} factor + * @param {Vector2} startPos1 + * @param {Vector2} endPos1 + * @param {Vector2} startPos2 + * @param {Vector2} endPos2 + * @param {number} collisionPoint * - * @return {Image} The resulting Image. + * @return {boolean} The resulting bool. */ -function GenImageWhiteNoise (width, height, factor) { - return r.BindGenImageWhiteNoise( - width, - height, - factor +function CheckCollisionLines(startPos1, endPos1, startPos2, endPos2, collisionPoint) { + return r.BindCheckCollisionLines( + startPos1.x, + startPos1.y, + endPos1.x, + endPos1.y, + startPos2.x, + startPos2.y, + endPos2.x, + endPos2.y, + collisionPoint ) } -raylib.GenImageWhiteNoise = GenImageWhiteNoise +raylib.CheckCollisionLines = CheckCollisionLines /** - * Generate image: perlin noise + * Get collision rectangle for two rectangles collision * - * @param {number} width - * @param {number} height - * @param {number} offsetX - * @param {number} offsetY - * @param {number} scale + * @param {Rectangle} rec1 + * @param {Rectangle} rec2 * - * @return {Image} The resulting Image. + * @return {Rectangle} The resulting Rectangle. */ -function GenImagePerlinNoise (width, height, offsetX, offsetY, scale) { - return r.BindGenImagePerlinNoise( - width, - height, - offsetX, - offsetY, - scale +function GetCollisionRec(rec1, rec2) { + return r.BindGetCollisionRec( + rec1.x, + rec1.y, + rec1.width, + rec1.height, + rec2.x, + rec2.y, + rec2.width, + rec2.height ) } -raylib.GenImagePerlinNoise = GenImagePerlinNoise +raylib.GetCollisionRec = GetCollisionRec /** - * Generate image: cellular algorithm, bigger tileSize means bigger cells + * Load image from file into CPU memory (RAM) * - * @param {number} width - * @param {number} height - * @param {number} tileSize + * @param {string} fileName * * @return {Image} The resulting Image. */ -function GenImageCellular (width, height, tileSize) { - return r.BindGenImageCellular( - width, - height, - tileSize +function LoadImage(fileName) { + return r.BindLoadImage( + fileName ) } -raylib.GenImageCellular = GenImageCellular +raylib.LoadImage = LoadImage /** - * Generate image: grayscale image from text data + * Load image from RAW file data * + * @param {string} fileName * @param {number} width * @param {number} height - * @param {string} text + * @param {number} format + * @param {number} headerSize * * @return {Image} The resulting Image. */ -function GenImageText (width, height, text) { - return r.BindGenImageText( +function LoadImageRaw(fileName, width, height, format, headerSize) { + return r.BindLoadImageRaw( + fileName, width, height, - text + format, + headerSize ) } -raylib.GenImageText = GenImageText +raylib.LoadImageRaw = LoadImageRaw /** - * Create an image duplicate (useful for transformations) + * Load image sequence from file (frames appended to image.data) * - * @param {Image} image + * @param {string} fileName + * @param {number} frames * * @return {Image} The resulting Image. */ -function ImageCopy (image) { - return r.BindImageCopy( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function LoadImageAnim(fileName, frames) { + return r.BindLoadImageAnim( + fileName, + frames ) } -raylib.ImageCopy = ImageCopy +raylib.LoadImageAnim = LoadImageAnim /** - * Create an image from another image piece + * Load image sequence from memory buffer * - * @param {Image} image - * @param {Rectangle} rec + * @param {string} fileType + * @param {Buffer} fileData + * @param {number} dataSize + * @param {number} frames * * @return {Image} The resulting Image. */ -function ImageFromImage (image, rec) { - return r.BindImageFromImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - rec.x, - rec.y, - rec.width, - rec.height +function LoadImageAnimFromMemory(fileType, fileData, dataSize, frames) { + return r.BindLoadImageAnimFromMemory( + fileType, + fileData, + dataSize, + frames ) } -raylib.ImageFromImage = ImageFromImage +raylib.LoadImageAnimFromMemory = LoadImageAnimFromMemory /** - * Create an image from text (default font) + * Load image from memory buffer, fileType refers to extension: i.e. '.png' * - * @param {string} text - * @param {number} fontSize - * @param {Color} color + * @param {string} fileType + * @param {Buffer} fileData + * @param {number} dataSize * * @return {Image} The resulting Image. */ -function ImageText (text, fontSize, color) { - return r.BindImageText( - text, - fontSize, - color.r, - color.g, - color.b, - color.a +function LoadImageFromMemory(fileType, fileData, dataSize) { + return r.BindLoadImageFromMemory( + fileType, + fileData, + dataSize ) } -raylib.ImageText = ImageText +raylib.LoadImageFromMemory = LoadImageFromMemory /** - * Create an image from text (custom sprite font) + * Load image from GPU texture data * - * @param {Font} font - * @param {string} text - * @param {number} fontSize - * @param {number} spacing - * @param {Color} tint + * @param {Texture} texture * * @return {Image} The resulting Image. */ -function ImageTextEx (font, text, fontSize, spacing, tint) { - return r.BindImageTextEx( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - text, - fontSize, - spacing, - tint.r, - tint.g, - tint.b, - tint.a +function LoadImageFromTexture(texture) { + return r.BindLoadImageFromTexture( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format ) } -raylib.ImageTextEx = ImageTextEx +raylib.LoadImageFromTexture = LoadImageFromTexture /** - * Apply Gaussian blur using a box blur approximation - * - * @param {number} image - * @param {number} blurSize + * Load image from screen buffer and (screenshot) * - * @return {undefined} + * @return {Image} The resulting Image. */ -function ImageBlurGaussian (image, blurSize) { - return r.BindImageBlurGaussian( - image, - blurSize - ) +function LoadImageFromScreen() { + return r.BindLoadImageFromScreen() } -raylib.ImageBlurGaussian = ImageBlurGaussian +raylib.LoadImageFromScreen = LoadImageFromScreen /** - * Load color data from image as a Color array (RGBA - 32bit) + * Check if an image is valid (data and parameters) * * @param {Image} image * - * @return {number} The resulting Color *. + * @return {boolean} The resulting bool. */ -function LoadImageColors (image) { - return r.BindLoadImageColors( +function IsImageValid(image) { + return r.BindIsImageValid( image.data, image.width, image.height, @@ -4117,2446 +4487,3192 @@ function LoadImageColors (image) { image.format ) } -raylib.LoadImageColors = LoadImageColors +raylib.IsImageValid = IsImageValid /** - * Load colors palette from image as a Color array (RGBA - 32bit) + * Unload image from CPU memory (RAM) * * @param {Image} image - * @param {number} maxPaletteSize - * @param {number} colorCount * - * @return {number} The resulting Color *. + * @return {undefined} */ -function LoadImagePalette (image, maxPaletteSize, colorCount) { - return r.BindLoadImagePalette( +function UnloadImage(image) { + return r.BindUnloadImage( image.data, image.width, image.height, image.mipmaps, - image.format, - maxPaletteSize, - colorCount - ) -} -raylib.LoadImagePalette = LoadImagePalette - -/** - * Unload color data loaded with LoadImageColors() - * - * @param {number} colors - * - * @return {undefined} - */ -function UnloadImageColors (colors) { - return r.BindUnloadImageColors( - colors + image.format ) } -raylib.UnloadImageColors = UnloadImageColors +raylib.UnloadImage = UnloadImage /** - * Unload colors palette loaded with LoadImagePalette() + * Export image data to file, returns true on success * - * @param {number} colors + * @param {Image} image + * @param {string} fileName * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function UnloadImagePalette (colors) { - return r.BindUnloadImagePalette( - colors +function ExportImage(image, fileName) { + return r.BindExportImage( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + fileName ) } -raylib.UnloadImagePalette = UnloadImagePalette +raylib.ExportImage = ExportImage /** - * Get image alpha border rectangle + * Export image to memory buffer * * @param {Image} image - * @param {number} threshold + * @param {string} fileType + * @param {number} fileSize * - * @return {Rectangle} The resulting Rectangle. + * @return {Buffer} The resulting unsigned char *. */ -function GetImageAlphaBorder (image, threshold) { - return r.BindGetImageAlphaBorder( +function ExportImageToMemory(image, fileType, fileSize) { + return r.BindExportImageToMemory( image.data, image.width, image.height, image.mipmaps, image.format, - threshold + fileType, + fileSize ) } -raylib.GetImageAlphaBorder = GetImageAlphaBorder +raylib.ExportImageToMemory = ExportImageToMemory /** - * Get image pixel color at (x, y) position + * Export image as code file defining an array of bytes, returns true on success * * @param {Image} image - * @param {number} x - * @param {number} y + * @param {string} fileName * - * @return {Color} The resulting Color. + * @return {boolean} The resulting bool. */ -function GetImageColor (image, x, y) { - return r.BindGetImageColor( +function ExportImageAsCode(image, fileName) { + return r.BindExportImageAsCode( image.data, image.width, image.height, image.mipmaps, image.format, - x, - y + fileName ) } -raylib.GetImageColor = GetImageColor +raylib.ExportImageAsCode = ExportImageAsCode /** - * Draw circle outline within an image + * Generate image: plain color * - * @param {number} dst - * @param {number} centerX - * @param {number} centerY - * @param {number} radius + * @param {number} width + * @param {number} height * @param {Color} color * - * @return {undefined} + * @return {Image} The resulting Image. */ -function ImageDrawCircleLines (dst, centerX, centerY, radius, color) { - return r.BindImageDrawCircleLines( - dst, - centerX, - centerY, - radius, +function GenImageColor(width, height, color) { + return r.BindGenImageColor( + width, + height, color.r, color.g, color.b, color.a ) } -raylib.ImageDrawCircleLines = ImageDrawCircleLines +raylib.GenImageColor = GenImageColor /** - * Draw circle outline within an image (Vector version) + * Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient * - * @param {number} dst - * @param {Vector2} center - * @param {number} radius - * @param {Color} color + * @param {number} width + * @param {number} height + * @param {number} direction + * @param {Color} start + * @param {Color} end * - * @return {undefined} + * @return {Image} The resulting Image. */ -function ImageDrawCircleLinesV (dst, center, radius, color) { - return r.BindImageDrawCircleLinesV( - dst, - center.x, - center.y, - radius, - color.r, - color.g, - color.b, - color.a +function GenImageGradientLinear(width, height, direction, start, end) { + return r.BindGenImageGradientLinear( + width, + height, + direction, + start.r, + start.g, + start.b, + start.a, + end.r, + end.g, + end.b, + end.a ) } -raylib.ImageDrawCircleLinesV = ImageDrawCircleLinesV +raylib.GenImageGradientLinear = GenImageGradientLinear /** - * Load texture from file into GPU memory (VRAM) + * Generate image: radial gradient * - * @param {string} fileName + * @param {number} width + * @param {number} height + * @param {number} density + * @param {Color} inner + * @param {Color} outer * - * @return {Texture2D} The resulting Texture2D. + * @return {Image} The resulting Image. */ -function LoadTexture (fileName) { - return r.BindLoadTexture( - fileName - ) -} -raylib.LoadTexture = LoadTexture - -/** - * Load texture from image data - * - * @param {Image} image - * - * @return {Texture2D} The resulting Texture2D. - */ -function LoadTextureFromImage (image) { - return r.BindLoadTextureFromImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function GenImageGradientRadial(width, height, density, inner, outer) { + return r.BindGenImageGradientRadial( + width, + height, + density, + inner.r, + inner.g, + inner.b, + inner.a, + outer.r, + outer.g, + outer.b, + outer.a ) } -raylib.LoadTextureFromImage = LoadTextureFromImage +raylib.GenImageGradientRadial = GenImageGradientRadial /** - * Load cubemap from image, multiple image cubemap layouts supported + * Generate image: square gradient * - * @param {Image} image - * @param {number} layout + * @param {number} width + * @param {number} height + * @param {number} density + * @param {Color} inner + * @param {Color} outer * - * @return {TextureCubemap} The resulting TextureCubemap. + * @return {Image} The resulting Image. */ -function LoadTextureCubemap (image, layout) { - return r.BindLoadTextureCubemap( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - layout +function GenImageGradientSquare(width, height, density, inner, outer) { + return r.BindGenImageGradientSquare( + width, + height, + density, + inner.r, + inner.g, + inner.b, + inner.a, + outer.r, + outer.g, + outer.b, + outer.a ) } -raylib.LoadTextureCubemap = LoadTextureCubemap +raylib.GenImageGradientSquare = GenImageGradientSquare /** - * Load texture for rendering (framebuffer) + * Generate image: checked * * @param {number} width * @param {number} height + * @param {number} checksX + * @param {number} checksY + * @param {Color} col1 + * @param {Color} col2 * - * @return {RenderTexture2D} The resulting RenderTexture2D. + * @return {Image} The resulting Image. */ -function LoadRenderTexture (width, height) { - return r.BindLoadRenderTexture( +function GenImageChecked(width, height, checksX, checksY, col1, col2) { + return r.BindGenImageChecked( width, - height + height, + checksX, + checksY, + col1.r, + col1.g, + col1.b, + col1.a, + col2.r, + col2.g, + col2.b, + col2.a ) } -raylib.LoadRenderTexture = LoadRenderTexture +raylib.GenImageChecked = GenImageChecked /** - * Check if a texture is ready + * Generate image: white noise * - * @param {Texture} texture + * @param {number} width + * @param {number} height + * @param {number} factor * - * @return {boolean} The resulting bool. + * @return {Image} The resulting Image. */ -function IsTextureReady (texture) { - return r.BindIsTextureReady( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format +function GenImageWhiteNoise(width, height, factor) { + return r.BindGenImageWhiteNoise( + width, + height, + factor ) } -raylib.IsTextureReady = IsTextureReady +raylib.GenImageWhiteNoise = GenImageWhiteNoise /** - * Unload texture from GPU memory (VRAM) + * Generate image: perlin noise * - * @param {Texture} texture + * @param {number} width + * @param {number} height + * @param {number} offsetX + * @param {number} offsetY + * @param {number} scale * - * @return {undefined} + * @return {Image} The resulting Image. */ -function UnloadTexture (texture) { - return r.BindUnloadTexture( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format +function GenImagePerlinNoise(width, height, offsetX, offsetY, scale) { + return r.BindGenImagePerlinNoise( + width, + height, + offsetX, + offsetY, + scale ) } -raylib.UnloadTexture = UnloadTexture +raylib.GenImagePerlinNoise = GenImagePerlinNoise /** - * Check if a render texture is ready + * Generate image: cellular algorithm, bigger tileSize means bigger cells * - * @param {RenderTexture} target + * @param {number} width + * @param {number} height + * @param {number} tileSize * - * @return {boolean} The resulting bool. + * @return {Image} The resulting Image. */ -function IsRenderTextureReady (target) { - return r.BindIsRenderTextureReady( - target.id, - target.texture.id, - target.texture.width, - target.texture.height, - target.texture.mipmaps, - target.texture.format, - target.depth.id, - target.depth.width, - target.depth.height, - target.depth.mipmaps, - target.depth.format +function GenImageCellular(width, height, tileSize) { + return r.BindGenImageCellular( + width, + height, + tileSize ) } -raylib.IsRenderTextureReady = IsRenderTextureReady +raylib.GenImageCellular = GenImageCellular /** - * Unload render texture from GPU memory (VRAM) + * Generate image: grayscale image from text data * - * @param {RenderTexture} target + * @param {number} width + * @param {number} height + * @param {string} text * - * @return {undefined} + * @return {Image} The resulting Image. */ -function UnloadRenderTexture (target) { - return r.BindUnloadRenderTexture( - target.id, - target.texture.id, - target.texture.width, - target.texture.height, - target.texture.mipmaps, - target.texture.format, - target.depth.id, - target.depth.width, - target.depth.height, - target.depth.mipmaps, - target.depth.format +function GenImageText(width, height, text) { + return r.BindGenImageText( + width, + height, + text ) } -raylib.UnloadRenderTexture = UnloadRenderTexture +raylib.GenImageText = GenImageText /** - * Update GPU texture with new data + * Create an image duplicate (useful for transformations) * - * @param {Texture} texture - * @param {number} pixels + * @param {Image} image * - * @return {undefined} + * @return {Image} The resulting Image. */ -function UpdateTexture (texture, pixels) { - return r.BindUpdateTexture( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - pixels +function ImageCopy(image) { + return r.BindImageCopy( + image.data, + image.width, + image.height, + image.mipmaps, + image.format ) } -raylib.UpdateTexture = UpdateTexture +raylib.ImageCopy = ImageCopy /** - * Update GPU texture rectangle with new data + * Create an image from another image piece * - * @param {Texture} texture + * @param {Image} image * @param {Rectangle} rec - * @param {number} pixels * - * @return {undefined} + * @return {Image} The resulting Image. */ -function UpdateTextureRec (texture, rec, pixels) { - return r.BindUpdateTextureRec( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, +function ImageFromImage(image, rec) { + return r.BindImageFromImage( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, rec.x, rec.y, rec.width, - rec.height, - pixels + rec.height ) } -raylib.UpdateTextureRec = UpdateTextureRec +raylib.ImageFromImage = ImageFromImage /** - * Set texture scaling filter mode + * Create an image from a selected channel of another image (GRAYSCALE) * - * @param {Texture} texture - * @param {number} filter + * @param {Image} image + * @param {number} selectedChannel * - * @return {undefined} + * @return {Image} The resulting Image. */ -function SetTextureFilter (texture, filter) { - return r.BindSetTextureFilter( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - filter +function ImageFromChannel(image, selectedChannel) { + return r.BindImageFromChannel( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + selectedChannel ) } -raylib.SetTextureFilter = SetTextureFilter +raylib.ImageFromChannel = ImageFromChannel /** - * Set texture wrapping mode + * Create an image from text (default font) * - * @param {Texture} texture - * @param {number} wrap + * @param {string} text + * @param {number} fontSize + * @param {Color} color * - * @return {undefined} + * @return {Image} The resulting Image. */ -function SetTextureWrap (texture, wrap) { - return r.BindSetTextureWrap( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - wrap - ) -} -raylib.SetTextureWrap = SetTextureWrap - -/** - * Draw a Texture2D - * - * @param {Texture} texture - * @param {number} posX - * @param {number} posY - * @param {Color} tint - * - * @return {undefined} - */ -function DrawTexture (texture, posX, posY, tint) { - return r.BindDrawTexture( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - posX, - posY, - tint.r, - tint.g, - tint.b, - tint.a +function ImageText(text, fontSize, color) { + return r.BindImageText( + text, + fontSize, + color.r, + color.g, + color.b, + color.a ) } -raylib.DrawTexture = DrawTexture +raylib.ImageText = ImageText /** - * Draw a Texture2D with position defined as Vector2 + * Create an image from text (custom sprite font) * - * @param {Texture} texture - * @param {Vector2} position + * @param {Font} font + * @param {string} text + * @param {number} fontSize + * @param {number} spacing * @param {Color} tint * - * @return {undefined} + * @return {Image} The resulting Image. */ -function DrawTextureV (texture, position, tint) { - return r.BindDrawTextureV( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - position.x, - position.y, +function ImageTextEx(font, text, fontSize, spacing, tint) { + return r.BindImageTextEx( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + text, + fontSize, + spacing, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextureV = DrawTextureV +raylib.ImageTextEx = ImageTextEx /** - * Draw a Texture2D with extended parameters + * Apply Gaussian blur using a box blur approximation * - * @param {Texture} texture - * @param {Vector2} position - * @param {number} rotation - * @param {number} scale - * @param {Color} tint + * @param {number} image + * @param {number} blurSize * * @return {undefined} */ -function DrawTextureEx (texture, position, rotation, scale, tint) { - return r.BindDrawTextureEx( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - position.x, - position.y, - rotation, - scale, - tint.r, - tint.g, - tint.b, - tint.a +function ImageBlurGaussian(image, blurSize) { + return r.BindImageBlurGaussian( + image, + blurSize ) } -raylib.DrawTextureEx = DrawTextureEx +raylib.ImageBlurGaussian = ImageBlurGaussian /** - * Draw a part of a texture defined by a rectangle + * Apply custom square convolution kernel to image * - * @param {Texture} texture - * @param {Rectangle} source - * @param {Vector2} position - * @param {Color} tint + * @param {number} image + * @param {number} kernel + * @param {number} kernelSize * * @return {undefined} */ -function DrawTextureRec (texture, source, position, tint) { - return r.BindDrawTextureRec( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - source.x, - source.y, - source.width, - source.height, - position.x, - position.y, - tint.r, - tint.g, - tint.b, - tint.a +function ImageKernelConvolution(image, kernel, kernelSize) { + return r.BindImageKernelConvolution( + image, + kernel, + kernelSize ) } -raylib.DrawTextureRec = DrawTextureRec +raylib.ImageKernelConvolution = ImageKernelConvolution /** - * Draw a part of a texture defined by a rectangle with 'pro' parameters + * Rotate image by input angle in degrees (-359 to 359) * - * @param {Texture} texture - * @param {Rectangle} source - * @param {Rectangle} dest - * @param {Vector2} origin - * @param {number} rotation - * @param {Color} tint + * @param {number} image + * @param {number} degrees * * @return {undefined} */ -function DrawTexturePro (texture, source, dest, origin, rotation, tint) { - return r.BindDrawTexturePro( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - source.x, - source.y, - source.width, - source.height, - dest.x, - dest.y, - dest.width, - dest.height, - origin.x, - origin.y, - rotation, - tint.r, - tint.g, - tint.b, - tint.a +function ImageRotate(image, degrees) { + return r.BindImageRotate( + image, + degrees ) } -raylib.DrawTexturePro = DrawTexturePro +raylib.ImageRotate = ImageRotate /** - * Draws a texture (or part of it) that stretches or shrinks nicely + * Load color data from image as a Color array (RGBA - 32bit) * - * @param {Texture} texture - * @param {NPatchInfo} nPatchInfo - * @param {Rectangle} dest - * @param {Vector2} origin - * @param {number} rotation - * @param {Color} tint + * @param {Image} image * - * @return {undefined} + * @return {number} The resulting Color *. */ -function DrawTextureNPatch (texture, nPatchInfo, dest, origin, rotation, tint) { - return r.BindDrawTextureNPatch( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format, - nPatchInfo.source.x, - nPatchInfo.source.y, - nPatchInfo.source.width, - nPatchInfo.source.height, - nPatchInfo.left, - nPatchInfo.top, - nPatchInfo.right, - nPatchInfo.bottom, - nPatchInfo.layout, - dest.x, - dest.y, - dest.width, - dest.height, - origin.x, - origin.y, - rotation, - tint.r, - tint.g, - tint.b, - tint.a +function LoadImageColors(image) { + return r.BindLoadImageColors( + image.data, + image.width, + image.height, + image.mipmaps, + image.format ) } -raylib.DrawTextureNPatch = DrawTextureNPatch +raylib.LoadImageColors = LoadImageColors /** - * Get color with alpha applied, alpha goes from 0.0f to 1.0f + * Load colors palette from image as a Color array (RGBA - 32bit) * - * @param {Color} color - * @param {number} alpha + * @param {Image} image + * @param {number} maxPaletteSize + * @param {number} colorCount * - * @return {Color} The resulting Color. + * @return {number} The resulting Color *. */ -function Fade (color, alpha) { - return r.BindFade( - color.r, - color.g, - color.b, - color.a, - alpha +function LoadImagePalette(image, maxPaletteSize, colorCount) { + return r.BindLoadImagePalette( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + maxPaletteSize, + colorCount ) } -raylib.Fade = Fade +raylib.LoadImagePalette = LoadImagePalette /** - * Get hexadecimal value for a Color + * Unload color data loaded with LoadImageColors() * - * @param {Color} color + * @param {number} colors * - * @return {number} The resulting int. + * @return {undefined} */ -function ColorToInt (color) { - return r.BindColorToInt( - color.r, - color.g, - color.b, - color.a +function UnloadImageColors(colors) { + return r.BindUnloadImageColors( + colors ) } -raylib.ColorToInt = ColorToInt +raylib.UnloadImageColors = UnloadImageColors /** - * Get Color normalized as float [0..1] + * Unload colors palette loaded with LoadImagePalette() * - * @param {Color} color + * @param {number} colors * - * @return {Vector4} The resulting Vector4. + * @return {undefined} */ -function ColorNormalize (color) { - return r.BindColorNormalize( - color.r, - color.g, - color.b, - color.a +function UnloadImagePalette(colors) { + return r.BindUnloadImagePalette( + colors ) } -raylib.ColorNormalize = ColorNormalize +raylib.UnloadImagePalette = UnloadImagePalette /** - * Get Color from normalized values [0..1] + * Get image alpha border rectangle * - * @param {Vector4} normalized + * @param {Image} image + * @param {number} threshold * - * @return {Color} The resulting Color. + * @return {Rectangle} The resulting Rectangle. */ -function ColorFromNormalized (normalized) { - return r.BindColorFromNormalized( - normalized.x, - normalized.y, - normalized.z, - normalized.w - ) -} -raylib.ColorFromNormalized = ColorFromNormalized - -/** - * Get HSV values for a Color, hue [0..360], saturation/value [0..1] - * - * @param {Color} color - * - * @return {Vector3} The resulting Vector3. - */ -function ColorToHSV (color) { - return r.BindColorToHSV( - color.r, - color.g, - color.b, - color.a +function GetImageAlphaBorder(image, threshold) { + return r.BindGetImageAlphaBorder( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + threshold ) } -raylib.ColorToHSV = ColorToHSV +raylib.GetImageAlphaBorder = GetImageAlphaBorder /** - * Get a Color from HSV values, hue [0..360], saturation/value [0..1] + * Get image pixel color at (x, y) position * - * @param {number} hue - * @param {number} saturation - * @param {number} value + * @param {Image} image + * @param {number} x + * @param {number} y * * @return {Color} The resulting Color. */ -function ColorFromHSV (hue, saturation, value) { - return r.BindColorFromHSV( - hue, - saturation, - value +function GetImageColor(image, x, y) { + return r.BindGetImageColor( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + x, + y ) } -raylib.ColorFromHSV = ColorFromHSV +raylib.GetImageColor = GetImageColor /** - * Get color multiplied with another color + * Draw a line defining thickness within an image * + * @param {number} dst + * @param {Vector2} start + * @param {Vector2} end + * @param {number} thick * @param {Color} color - * @param {Color} tint * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorTint (color, tint) { - return r.BindColorTint( +function ImageDrawLineEx(dst, start, end, thick, color) { + return r.BindImageDrawLineEx( + dst, + start.x, + start.y, + end.x, + end.y, + thick, color.r, color.g, color.b, - color.a, - tint.r, - tint.g, - tint.b, - tint.a + color.a ) } -raylib.ColorTint = ColorTint +raylib.ImageDrawLineEx = ImageDrawLineEx /** - * Get color with brightness correction, brightness factor goes from -1.0f to 1.0f + * Draw circle outline within an image * + * @param {number} dst + * @param {number} centerX + * @param {number} centerY + * @param {number} radius * @param {Color} color - * @param {number} factor * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorBrightness (color, factor) { - return r.BindColorBrightness( +function ImageDrawCircleLines(dst, centerX, centerY, radius, color) { + return r.BindImageDrawCircleLines( + dst, + centerX, + centerY, + radius, color.r, color.g, color.b, - color.a, - factor + color.a ) } -raylib.ColorBrightness = ColorBrightness +raylib.ImageDrawCircleLines = ImageDrawCircleLines /** - * Get color with contrast correction, contrast values between -1.0f and 1.0f + * Draw circle outline within an image (Vector version) * + * @param {number} dst + * @param {Vector2} center + * @param {number} radius * @param {Color} color - * @param {number} contrast * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorContrast (color, contrast) { - return r.BindColorContrast( +function ImageDrawCircleLinesV(dst, center, radius, color) { + return r.BindImageDrawCircleLinesV( + dst, + center.x, + center.y, + radius, color.r, color.g, color.b, - color.a, - contrast + color.a ) } -raylib.ColorContrast = ColorContrast +raylib.ImageDrawCircleLinesV = ImageDrawCircleLinesV /** - * Get color with alpha applied, alpha goes from 0.0f to 1.0f + * Draw triangle within an image * + * @param {number} dst + * @param {Vector2} v1 + * @param {Vector2} v2 + * @param {Vector2} v3 * @param {Color} color - * @param {number} alpha * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorAlpha (color, alpha) { - return r.BindColorAlpha( +function ImageDrawTriangle(dst, v1, v2, v3, color) { + return r.BindImageDrawTriangle( + dst, + v1.x, + v1.y, + v2.x, + v2.y, + v3.x, + v3.y, color.r, color.g, color.b, - color.a, - alpha + color.a ) } -raylib.ColorAlpha = ColorAlpha +raylib.ImageDrawTriangle = ImageDrawTriangle /** - * Get src alpha-blended into dst color with tint + * Draw triangle with interpolated colors within an image * - * @param {Color} dst - * @param {Color} src - * @param {Color} tint + * @param {number} dst + * @param {Vector2} v1 + * @param {Vector2} v2 + * @param {Vector2} v3 + * @param {Color} c1 + * @param {Color} c2 + * @param {Color} c3 * - * @return {Color} The resulting Color. + * @return {undefined} */ -function ColorAlphaBlend (dst, src, tint) { - return r.BindColorAlphaBlend( - dst.r, - dst.g, - dst.b, - dst.a, - src.r, - src.g, - src.b, - src.a, - tint.r, - tint.g, - tint.b, - tint.a +function ImageDrawTriangleEx(dst, v1, v2, v3, c1, c2, c3) { + return r.BindImageDrawTriangleEx( + dst, + v1.x, + v1.y, + v2.x, + v2.y, + v3.x, + v3.y, + c1.r, + c1.g, + c1.b, + c1.a, + c2.r, + c2.g, + c2.b, + c2.a, + c3.r, + c3.g, + c3.b, + c3.a ) } -raylib.ColorAlphaBlend = ColorAlphaBlend +raylib.ImageDrawTriangleEx = ImageDrawTriangleEx /** - * Get Color structure from hexadecimal value + * Draw triangle outline within an image * - * @param {number} hexValue + * @param {number} dst + * @param {Vector2} v1 + * @param {Vector2} v2 + * @param {Vector2} v3 + * @param {Color} color * - * @return {Color} The resulting Color. + * @return {undefined} */ -function GetColor (hexValue) { - return r.BindGetColor( - hexValue +function ImageDrawTriangleLines(dst, v1, v2, v3, color) { + return r.BindImageDrawTriangleLines( + dst, + v1.x, + v1.y, + v2.x, + v2.y, + v3.x, + v3.y, + color.r, + color.g, + color.b, + color.a ) } -raylib.GetColor = GetColor +raylib.ImageDrawTriangleLines = ImageDrawTriangleLines /** - * Get Color from a source pixel pointer of certain format + * Draw a triangle fan defined by points within an image (first vertex is the center) * - * @param {number} srcPtr - * @param {number} format + * @param {number} dst + * @param {number} points + * @param {number} pointCount + * @param {Color} color * - * @return {Color} The resulting Color. + * @return {undefined} */ -function GetPixelColor (srcPtr, format) { - return r.BindGetPixelColor( - srcPtr, - format +function ImageDrawTriangleFan(dst, points, pointCount, color) { + return r.BindImageDrawTriangleFan( + dst, + points, + pointCount, + color.r, + color.g, + color.b, + color.a ) } -raylib.GetPixelColor = GetPixelColor +raylib.ImageDrawTriangleFan = ImageDrawTriangleFan /** - * Set color formatted into destination pixel pointer + * Draw a triangle strip defined by points within an image * - * @param {number} dstPtr + * @param {number} dst + * @param {number} points + * @param {number} pointCount * @param {Color} color - * @param {number} format * * @return {undefined} */ -function SetPixelColor (dstPtr, color, format) { - return r.BindSetPixelColor( - dstPtr, +function ImageDrawTriangleStrip(dst, points, pointCount, color) { + return r.BindImageDrawTriangleStrip( + dst, + points, + pointCount, color.r, color.g, color.b, - color.a, - format + color.a ) } -raylib.SetPixelColor = SetPixelColor +raylib.ImageDrawTriangleStrip = ImageDrawTriangleStrip /** - * Get pixel data size in bytes for certain format + * Load texture from file into GPU memory (VRAM) * - * @param {number} width - * @param {number} height - * @param {number} format + * @param {string} fileName * - * @return {number} The resulting int. + * @return {Texture2D} The resulting Texture2D. */ -function GetPixelDataSize (width, height, format) { - return r.BindGetPixelDataSize( - width, - height, - format +function LoadTexture(fileName) { + return r.BindLoadTexture( + fileName ) } -raylib.GetPixelDataSize = GetPixelDataSize +raylib.LoadTexture = LoadTexture /** - * Get the default Font + * Load texture from image data * - * @return {Font} The resulting Font. + * @param {Image} image + * + * @return {Texture2D} The resulting Texture2D. */ -function GetFontDefault () { - return r.BindGetFontDefault() +function LoadTextureFromImage(image) { + return r.BindLoadTextureFromImage( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) } -raylib.GetFontDefault = GetFontDefault +raylib.LoadTextureFromImage = LoadTextureFromImage /** - * Load font from file into GPU memory (VRAM) + * Load cubemap from image, multiple image cubemap layouts supported * - * @param {string} fileName + * @param {Image} image + * @param {number} layout * - * @return {Font} The resulting Font. + * @return {TextureCubemap} The resulting TextureCubemap. */ -function LoadFont (fileName) { - return r.BindLoadFont( - fileName +function LoadTextureCubemap(image, layout) { + return r.BindLoadTextureCubemap( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + layout ) } -raylib.LoadFont = LoadFont +raylib.LoadTextureCubemap = LoadTextureCubemap /** - * Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set + * Load texture for rendering (framebuffer) * - * @param {string} fileName - * @param {number} fontSize - * @param {number} fontChars - * @param {number} glyphCount + * @param {number} width + * @param {number} height * - * @return {Font} The resulting Font. + * @return {RenderTexture2D} The resulting RenderTexture2D. */ -function LoadFontEx (fileName, fontSize, fontChars, glyphCount) { - return r.BindLoadFontEx( - fileName, - fontSize, - fontChars, - glyphCount +function LoadRenderTexture(width, height) { + return r.BindLoadRenderTexture( + width, + height ) } -raylib.LoadFontEx = LoadFontEx +raylib.LoadRenderTexture = LoadRenderTexture /** - * Load font from Image (XNA style) + * Check if a texture is valid (loaded in GPU) * - * @param {Image} image - * @param {Color} key - * @param {number} firstChar + * @param {Texture} texture * - * @return {Font} The resulting Font. + * @return {boolean} The resulting bool. */ -function LoadFontFromImage (image, key, firstChar) { - return r.BindLoadFontFromImage( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - key.r, - key.g, - key.b, - key.a, - firstChar +function IsTextureValid(texture) { + return r.BindIsTextureValid( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format ) } -raylib.LoadFontFromImage = LoadFontFromImage +raylib.IsTextureValid = IsTextureValid /** - * Load font from memory buffer, fileType refers to extension: i.e. '.ttf' + * Unload texture from GPU memory (VRAM) * - * @param {string} fileType - * @param {Buffer} fileData - * @param {number} dataSize - * @param {number} fontSize - * @param {number} fontChars - * @param {number} glyphCount + * @param {Texture} texture * - * @return {Font} The resulting Font. + * @return {undefined} */ -function LoadFontFromMemory (fileType, fileData, dataSize, fontSize, fontChars, glyphCount) { - return r.BindLoadFontFromMemory( - fileType, - fileData, - dataSize, - fontSize, - fontChars, - glyphCount +function UnloadTexture(texture) { + return r.BindUnloadTexture( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format ) } -raylib.LoadFontFromMemory = LoadFontFromMemory +raylib.UnloadTexture = UnloadTexture /** - * Check if a font is ready + * Check if a render texture is valid (loaded in GPU) * - * @param {Font} font + * @param {RenderTexture} target * * @return {boolean} The resulting bool. */ -function IsFontReady (font) { - return r.BindIsFontReady( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs +function IsRenderTextureValid(target) { + return r.BindIsRenderTextureValid( + target.id, + target.texture.id, + target.texture.width, + target.texture.height, + target.texture.mipmaps, + target.texture.format, + target.depth.id, + target.depth.width, + target.depth.height, + target.depth.mipmaps, + target.depth.format ) } -raylib.IsFontReady = IsFontReady +raylib.IsRenderTextureValid = IsRenderTextureValid /** - * Load font data for further use + * Unload render texture from GPU memory (VRAM) * - * @param {Buffer} fileData - * @param {number} dataSize - * @param {number} fontSize - * @param {number} fontChars - * @param {number} glyphCount - * @param {number} type + * @param {RenderTexture} target * - * @return {number} The resulting GlyphInfo *. + * @return {undefined} */ -function LoadFontData (fileData, dataSize, fontSize, fontChars, glyphCount, type) { - return r.BindLoadFontData( - fileData, - dataSize, - fontSize, - fontChars, - glyphCount, - type +function UnloadRenderTexture(target) { + return r.BindUnloadRenderTexture( + target.id, + target.texture.id, + target.texture.width, + target.texture.height, + target.texture.mipmaps, + target.texture.format, + target.depth.id, + target.depth.width, + target.depth.height, + target.depth.mipmaps, + target.depth.format ) } -raylib.LoadFontData = LoadFontData +raylib.UnloadRenderTexture = UnloadRenderTexture /** - * Generate image font atlas using chars info + * Update GPU texture with new data * - * @param {number} chars - * @param {number} recs - * @param {number} glyphCount - * @param {number} fontSize - * @param {number} padding - * @param {number} packMethod + * @param {Texture} texture + * @param {number} pixels * - * @return {Image} The resulting Image. + * @return {undefined} */ -function GenImageFontAtlas (chars, recs, glyphCount, fontSize, padding, packMethod) { - return r.BindGenImageFontAtlas( - chars, - recs, - glyphCount, - fontSize, - padding, - packMethod +function UpdateTexture(texture, pixels) { + return r.BindUpdateTexture( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + pixels ) } -raylib.GenImageFontAtlas = GenImageFontAtlas +raylib.UpdateTexture = UpdateTexture /** - * Unload font chars info data (RAM) + * Update GPU texture rectangle with new data * - * @param {number} chars - * @param {number} glyphCount + * @param {Texture} texture + * @param {Rectangle} rec + * @param {number} pixels * * @return {undefined} */ -function UnloadFontData (chars, glyphCount) { - return r.BindUnloadFontData( - chars, - glyphCount +function UpdateTextureRec(texture, rec, pixels) { + return r.BindUpdateTextureRec( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + rec.x, + rec.y, + rec.width, + rec.height, + pixels ) } -raylib.UnloadFontData = UnloadFontData +raylib.UpdateTextureRec = UpdateTextureRec /** - * Unload font from GPU memory (VRAM) + * Set texture scaling filter mode * - * @param {Font} font + * @param {Texture} texture + * @param {number} filter * * @return {undefined} */ -function UnloadFont (font) { - return r.BindUnloadFont( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs +function SetTextureFilter(texture, filter) { + return r.BindSetTextureFilter( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + filter ) } -raylib.UnloadFont = UnloadFont +raylib.SetTextureFilter = SetTextureFilter /** - * Export font as code file, returns true on success + * Set texture wrapping mode * - * @param {Font} font - * @param {string} fileName + * @param {Texture} texture + * @param {number} wrap * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function ExportFontAsCode (font, fileName) { - return r.BindExportFontAsCode( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - fileName +function SetTextureWrap(texture, wrap) { + return r.BindSetTextureWrap( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + wrap ) } -raylib.ExportFontAsCode = ExportFontAsCode +raylib.SetTextureWrap = SetTextureWrap /** - * Draw current FPS + * Draw a Texture2D * + * @param {Texture} texture * @param {number} posX * @param {number} posY + * @param {Color} tint * * @return {undefined} */ -function DrawFPS (posX, posY) { - return r.BindDrawFPS( +function DrawTexture(texture, posX, posY, tint) { + return r.BindDrawTexture( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, posX, - posY + posY, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawFPS = DrawFPS +raylib.DrawTexture = DrawTexture /** - * Draw text (using default font) + * Draw a Texture2D with position defined as Vector2 * - * @param {string} text - * @param {number} posX - * @param {number} posY - * @param {number} fontSize - * @param {Color} color + * @param {Texture} texture + * @param {Vector2} position + * @param {Color} tint * * @return {undefined} */ -function DrawText (text, posX, posY, fontSize, color) { - return r.BindDrawText( - text, - posX, - posY, - fontSize, - color.r, - color.g, - color.b, - color.a +function DrawTextureV(texture, position, tint) { + return r.BindDrawTextureV( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + position.x, + position.y, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawText = DrawText +raylib.DrawTextureV = DrawTextureV /** - * Draw text using font and additional parameters + * Draw a Texture2D with extended parameters * - * @param {Font} font - * @param {string} text + * @param {Texture} texture * @param {Vector2} position - * @param {number} fontSize - * @param {number} spacing + * @param {number} rotation + * @param {number} scale * @param {Color} tint * * @return {undefined} */ -function DrawTextEx (font, text, position, fontSize, spacing, tint) { - return r.BindDrawTextEx( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - text, +function DrawTextureEx(texture, position, rotation, scale, tint) { + return r.BindDrawTextureEx( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, position.x, position.y, - fontSize, - spacing, + rotation, + scale, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextEx = DrawTextEx +raylib.DrawTextureEx = DrawTextureEx /** - * Draw text using Font and pro parameters (rotation) + * Draw a part of a texture defined by a rectangle * - * @param {Font} font - * @param {string} text + * @param {Texture} texture + * @param {Rectangle} source * @param {Vector2} position - * @param {Vector2} origin - * @param {number} rotation - * @param {number} fontSize - * @param {number} spacing * @param {Color} tint * * @return {undefined} */ -function DrawTextPro (font, text, position, origin, rotation, fontSize, spacing, tint) { - return r.BindDrawTextPro( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - text, +function DrawTextureRec(texture, source, position, tint) { + return r.BindDrawTextureRec( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + source.x, + source.y, + source.width, + source.height, position.x, position.y, - origin.x, - origin.y, - rotation, - fontSize, - spacing, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextPro = DrawTextPro +raylib.DrawTextureRec = DrawTextureRec /** - * Draw one character (codepoint) + * Draw a part of a texture defined by a rectangle with 'pro' parameters * - * @param {Font} font - * @param {number} codepoint - * @param {Vector2} position - * @param {number} fontSize + * @param {Texture} texture + * @param {Rectangle} source + * @param {Rectangle} dest + * @param {Vector2} origin + * @param {number} rotation * @param {Color} tint * * @return {undefined} */ -function DrawTextCodepoint (font, codepoint, position, fontSize, tint) { - return r.BindDrawTextCodepoint( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoint, - position.x, - position.y, - fontSize, +function DrawTexturePro(texture, source, dest, origin, rotation, tint) { + return r.BindDrawTexturePro( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + source.x, + source.y, + source.width, + source.height, + dest.x, + dest.y, + dest.width, + dest.height, + origin.x, + origin.y, + rotation, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextCodepoint = DrawTextCodepoint +raylib.DrawTexturePro = DrawTexturePro /** - * Draw multiple character (codepoint) + * Draws a texture (or part of it) that stretches or shrinks nicely * - * @param {Font} font - * @param {number} codepoints - * @param {number} count - * @param {Vector2} position - * @param {number} fontSize - * @param {number} spacing + * @param {Texture} texture + * @param {NPatchInfo} nPatchInfo + * @param {Rectangle} dest + * @param {Vector2} origin + * @param {number} rotation * @param {Color} tint * * @return {undefined} */ -function DrawTextCodepoints (font, codepoints, count, position, fontSize, spacing, tint) { - return r.BindDrawTextCodepoints( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoints, - count, - position.x, - position.y, - fontSize, - spacing, +function DrawTextureNPatch(texture, nPatchInfo, dest, origin, rotation, tint) { + return r.BindDrawTextureNPatch( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format, + nPatchInfo.source.x, + nPatchInfo.source.y, + nPatchInfo.source.width, + nPatchInfo.source.height, + nPatchInfo.left, + nPatchInfo.top, + nPatchInfo.right, + nPatchInfo.bottom, + nPatchInfo.layout, + dest.x, + dest.y, + dest.width, + dest.height, + origin.x, + origin.y, + rotation, tint.r, tint.g, tint.b, tint.a ) } -raylib.DrawTextCodepoints = DrawTextCodepoints +raylib.DrawTextureNPatch = DrawTextureNPatch /** - * Measure string width for default font + * Check if two colors are equal * - * @param {string} text - * @param {number} fontSize + * @param {Color} col1 + * @param {Color} col2 * - * @return {number} The resulting int. + * @return {boolean} The resulting bool. */ -function MeasureText (text, fontSize) { - return r.BindMeasureText( - text, - fontSize +function ColorIsEqual(col1, col2) { + return r.BindColorIsEqual( + col1.r, + col1.g, + col1.b, + col1.a, + col2.r, + col2.g, + col2.b, + col2.a ) } -raylib.MeasureText = MeasureText +raylib.ColorIsEqual = ColorIsEqual /** - * Measure string size for Font + * Get color with alpha applied, alpha goes from 0.0f to 1.0f * - * @param {Font} font - * @param {string} text - * @param {number} fontSize - * @param {number} spacing + * @param {Color} color + * @param {number} alpha * - * @return {Vector2} The resulting Vector2. + * @return {Color} The resulting Color. */ -function MeasureTextEx (font, text, fontSize, spacing) { - return r.BindMeasureTextEx( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - text, - fontSize, - spacing +function Fade(color, alpha) { + return r.BindFade( + color.r, + color.g, + color.b, + color.a, + alpha ) } -raylib.MeasureTextEx = MeasureTextEx +raylib.Fade = Fade /** - * Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found + * Get hexadecimal value for a Color (0xRRGGBBAA) * - * @param {Font} font - * @param {number} codepoint + * @param {Color} color * * @return {number} The resulting int. */ -function GetGlyphIndex (font, codepoint) { - return r.BindGetGlyphIndex( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoint +function ColorToInt(color) { + return r.BindColorToInt( + color.r, + color.g, + color.b, + color.a ) } -raylib.GetGlyphIndex = GetGlyphIndex +raylib.ColorToInt = ColorToInt /** - * Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found + * Get Color normalized as float [0..1] * - * @param {Font} font - * @param {number} codepoint + * @param {Color} color * - * @return {GlyphInfo} The resulting GlyphInfo. + * @return {Vector4} The resulting Vector4. */ -function GetGlyphInfo (font, codepoint) { - return r.BindGetGlyphInfo( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoint +function ColorNormalize(color) { + return r.BindColorNormalize( + color.r, + color.g, + color.b, + color.a ) } -raylib.GetGlyphInfo = GetGlyphInfo +raylib.ColorNormalize = ColorNormalize /** - * Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found + * Get Color from normalized values [0..1] * - * @param {Font} font - * @param {number} codepoint + * @param {Vector4} normalized * - * @return {Rectangle} The resulting Rectangle. + * @return {Color} The resulting Color. */ -function GetGlyphAtlasRec (font, codepoint) { - return r.BindGetGlyphAtlasRec( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs, - codepoint +function ColorFromNormalized(normalized) { + return r.BindColorFromNormalized( + normalized.x, + normalized.y, + normalized.z, + normalized.w ) } -raylib.GetGlyphAtlasRec = GetGlyphAtlasRec +raylib.ColorFromNormalized = ColorFromNormalized /** - * Load UTF-8 text encoded from codepoints array + * Get HSV values for a Color, hue [0..360], saturation/value [0..1] * - * @param {number} codepoints - * @param {number} length + * @param {Color} color * - * @return {string} The resulting char *. + * @return {Vector3} The resulting Vector3. */ -function LoadUTF8 (codepoints, length) { - return r.BindLoadUTF8( - codepoints, - length +function ColorToHSV(color) { + return r.BindColorToHSV( + color.r, + color.g, + color.b, + color.a ) } -raylib.LoadUTF8 = LoadUTF8 +raylib.ColorToHSV = ColorToHSV /** - * Unload UTF-8 text encoded from codepoints array + * Get a Color from HSV values, hue [0..360], saturation/value [0..1] * - * @param {string} text + * @param {number} hue + * @param {number} saturation + * @param {number} value * - * @return {undefined} + * @return {Color} The resulting Color. */ -function UnloadUTF8 (text) { - return r.BindUnloadUTF8( - text +function ColorFromHSV(hue, saturation, value) { + return r.BindColorFromHSV( + hue, + saturation, + value ) } -raylib.UnloadUTF8 = UnloadUTF8 +raylib.ColorFromHSV = ColorFromHSV /** - * Load all codepoints from a UTF-8 text string, codepoints count returned by parameter + * Get color multiplied with another color * - * @param {string} text - * @param {number} count + * @param {Color} color + * @param {Color} tint * - * @return {number} The resulting int *. + * @return {Color} The resulting Color. */ -function LoadCodepoints (text, count) { - return r.BindLoadCodepoints( - text, - count +function ColorTint(color, tint) { + return r.BindColorTint( + color.r, + color.g, + color.b, + color.a, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.LoadCodepoints = LoadCodepoints +raylib.ColorTint = ColorTint /** - * Unload codepoints data from memory + * Get color with brightness correction, brightness factor goes from -1.0f to 1.0f * - * @param {number} codepoints + * @param {Color} color + * @param {number} factor * - * @return {undefined} + * @return {Color} The resulting Color. */ -function UnloadCodepoints (codepoints) { - return r.BindUnloadCodepoints( - codepoints +function ColorBrightness(color, factor) { + return r.BindColorBrightness( + color.r, + color.g, + color.b, + color.a, + factor ) } -raylib.UnloadCodepoints = UnloadCodepoints +raylib.ColorBrightness = ColorBrightness /** - * Get total number of codepoints in a UTF-8 encoded string + * Get color with contrast correction, contrast values between -1.0f and 1.0f * - * @param {string} text + * @param {Color} color + * @param {number} contrast * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function GetCodepointCount (text) { - return r.BindGetCodepointCount( - text +function ColorContrast(color, contrast) { + return r.BindColorContrast( + color.r, + color.g, + color.b, + color.a, + contrast ) } -raylib.GetCodepointCount = GetCodepointCount +raylib.ColorContrast = ColorContrast /** - * Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + * Get color with alpha applied, alpha goes from 0.0f to 1.0f * - * @param {string} text - * @param {number} codepointSize + * @param {Color} color + * @param {number} alpha * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function GetCodepoint (text, codepointSize) { - return r.BindGetCodepoint( - text, - codepointSize +function ColorAlpha(color, alpha) { + return r.BindColorAlpha( + color.r, + color.g, + color.b, + color.a, + alpha ) } -raylib.GetCodepoint = GetCodepoint +raylib.ColorAlpha = ColorAlpha /** - * Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + * Get src alpha-blended into dst color with tint * - * @param {string} text - * @param {number} codepointSize + * @param {Color} dst + * @param {Color} src + * @param {Color} tint * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function GetCodepointNext (text, codepointSize) { - return r.BindGetCodepointNext( - text, - codepointSize +function ColorAlphaBlend(dst, src, tint) { + return r.BindColorAlphaBlend( + dst.r, + dst.g, + dst.b, + dst.a, + src.r, + src.g, + src.b, + src.a, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.GetCodepointNext = GetCodepointNext +raylib.ColorAlphaBlend = ColorAlphaBlend /** - * Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure + * Get color lerp interpolation between two colors, factor [0.0f..1.0f] * - * @param {string} text - * @param {number} codepointSize + * @param {Color} color1 + * @param {Color} color2 + * @param {number} factor * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function GetCodepointPrevious (text, codepointSize) { - return r.BindGetCodepointPrevious( - text, - codepointSize +function ColorLerp(color1, color2, factor) { + return r.BindColorLerp( + color1.r, + color1.g, + color1.b, + color1.a, + color2.r, + color2.g, + color2.b, + color2.a, + factor ) } -raylib.GetCodepointPrevious = GetCodepointPrevious +raylib.ColorLerp = ColorLerp /** - * Encode one codepoint into UTF-8 byte array (array length returned as parameter) + * Get Color structure from hexadecimal value * - * @param {number} codepoint - * @param {number} utf8Size + * @param {number} hexValue * - * @return {string} The resulting const char *. + * @return {Color} The resulting Color. */ -function CodepointToUTF8 (codepoint, utf8Size) { - return r.BindCodepointToUTF8( - codepoint, - utf8Size +function GetColor(hexValue) { + return r.BindGetColor( + hexValue ) } -raylib.CodepointToUTF8 = CodepointToUTF8 +raylib.GetColor = GetColor /** - * Copy one string to another, returns bytes copied + * Get Color from a source pixel pointer of certain format * - * @param {string} dst - * @param {string} src + * @param {number} srcPtr + * @param {number} format * - * @return {number} The resulting int. + * @return {Color} The resulting Color. */ -function TextCopy (dst, src) { - return r.BindTextCopy( - dst, - src +function GetPixelColor(srcPtr, format) { + return r.BindGetPixelColor( + srcPtr, + format ) } -raylib.TextCopy = TextCopy +raylib.GetPixelColor = GetPixelColor /** - * Check if two text string are equal + * Set color formatted into destination pixel pointer * - * @param {string} text1 - * @param {string} text2 + * @param {number} dstPtr + * @param {Color} color + * @param {number} format * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function TextIsEqual (text1, text2) { - return r.BindTextIsEqual( - text1, - text2 +function SetPixelColor(dstPtr, color, format) { + return r.BindSetPixelColor( + dstPtr, + color.r, + color.g, + color.b, + color.a, + format ) } -raylib.TextIsEqual = TextIsEqual +raylib.SetPixelColor = SetPixelColor /** - * Get text length, checks for '\0' ending + * Get pixel data size in bytes for certain format * - * @param {string} text + * @param {number} width + * @param {number} height + * @param {number} format * - * @return {number} The resulting unsigned int. + * @return {number} The resulting int. */ -function TextLength (text) { - return r.BindTextLength( - text +function GetPixelDataSize(width, height, format) { + return r.BindGetPixelDataSize( + width, + height, + format ) } -raylib.TextLength = TextLength +raylib.GetPixelDataSize = GetPixelDataSize /** - * Get a piece of a text string - * - * @param {string} text - * @param {number} position - * @param {number} length + * Get the default Font * - * @return {string} The resulting const char *. + * @return {Font} The resulting Font. */ -function TextSubtext (text, position, length) { - return r.BindTextSubtext( - text, - position, - length - ) +function GetFontDefault() { + return r.BindGetFontDefault() } -raylib.TextSubtext = TextSubtext +raylib.GetFontDefault = GetFontDefault /** - * Replace text string (WARNING: memory must be freed!) + * Load font from file into GPU memory (VRAM) * - * @param {string} text - * @param {string} replace - * @param {string} by + * @param {string} fileName * - * @return {string} The resulting char *. + * @return {Font} The resulting Font. */ -function TextReplace (text, replace, by) { - return r.BindTextReplace( - text, - replace, - by +function LoadFont(fileName) { + return r.BindLoadFont( + fileName ) } -raylib.TextReplace = TextReplace +raylib.LoadFont = LoadFont /** - * Insert text in a position (WARNING: memory must be freed!) + * Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height * - * @param {string} text - * @param {string} insert - * @param {number} position + * @param {string} fileName + * @param {number} fontSize + * @param {number} codepoints + * @param {number} codepointCount * - * @return {string} The resulting char *. + * @return {Font} The resulting Font. */ -function TextInsert (text, insert, position) { - return r.BindTextInsert( - text, - insert, - position +function LoadFontEx(fileName, fontSize, codepoints, codepointCount) { + return r.BindLoadFontEx( + fileName, + fontSize, + codepoints, + codepointCount ) } -raylib.TextInsert = TextInsert +raylib.LoadFontEx = LoadFontEx /** - * Join text strings with delimiter + * Load font from Image (XNA style) * - * @param {number} textList - * @param {number} count - * @param {string} delimiter + * @param {Image} image + * @param {Color} key + * @param {number} firstChar * - * @return {string} The resulting const char *. + * @return {Font} The resulting Font. */ -function TextJoin (textList, count, delimiter) { - return r.BindTextJoin( - textList, - count, - delimiter +function LoadFontFromImage(image, key, firstChar) { + return r.BindLoadFontFromImage( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + key.r, + key.g, + key.b, + key.a, + firstChar ) } -raylib.TextJoin = TextJoin +raylib.LoadFontFromImage = LoadFontFromImage /** - * Split text into multiple strings + * Load font from memory buffer, fileType refers to extension: i.e. '.ttf' * - * @param {string} text - * @param {string} delimiter - * @param {number} count + * @param {string} fileType + * @param {Buffer} fileData + * @param {number} dataSize + * @param {number} fontSize + * @param {number} codepoints + * @param {number} codepointCount * - * @return {number} The resulting const char **. + * @return {Font} The resulting Font. */ -function TextSplit (text, delimiter, count) { - return r.BindTextSplit( - text, - delimiter, - count +function LoadFontFromMemory(fileType, fileData, dataSize, fontSize, codepoints, codepointCount) { + return r.BindLoadFontFromMemory( + fileType, + fileData, + dataSize, + fontSize, + codepoints, + codepointCount ) } -raylib.TextSplit = TextSplit +raylib.LoadFontFromMemory = LoadFontFromMemory /** - * Append text at specific position and move cursor! + * Check if a font is valid (font data loaded, WARNING: GPU texture not checked) * - * @param {string} text - * @param {string} append - * @param {number} position + * @param {Font} font * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function TextAppend (text, append, position) { - return r.BindTextAppend( - text, - append, - position +function IsFontValid(font) { + return r.BindIsFontValid( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs ) } -raylib.TextAppend = TextAppend +raylib.IsFontValid = IsFontValid /** - * Find first text occurrence within a string + * Load font data for further use * - * @param {string} text - * @param {string} find + * @param {Buffer} fileData + * @param {number} dataSize + * @param {number} fontSize + * @param {number} codepoints + * @param {number} codepointCount + * @param {number} type * - * @return {number} The resulting int. + * @return {number} The resulting GlyphInfo *. */ -function TextFindIndex (text, find) { - return r.BindTextFindIndex( - text, - find +function LoadFontData(fileData, dataSize, fontSize, codepoints, codepointCount, type) { + return r.BindLoadFontData( + fileData, + dataSize, + fontSize, + codepoints, + codepointCount, + type ) } -raylib.TextFindIndex = TextFindIndex +raylib.LoadFontData = LoadFontData /** - * Get upper case version of provided string + * Generate image font atlas using chars info * - * @param {string} text + * @param {number} glyphs + * @param {number} glyphRecs + * @param {number} glyphCount + * @param {number} fontSize + * @param {number} padding + * @param {number} packMethod * - * @return {string} The resulting const char *. + * @return {Image} The resulting Image. */ -function TextToUpper (text) { - return r.BindTextToUpper( - text +function GenImageFontAtlas(glyphs, glyphRecs, glyphCount, fontSize, padding, packMethod) { + return r.BindGenImageFontAtlas( + glyphs, + glyphRecs, + glyphCount, + fontSize, + padding, + packMethod ) } -raylib.TextToUpper = TextToUpper +raylib.GenImageFontAtlas = GenImageFontAtlas /** - * Get lower case version of provided string + * Unload font chars info data (RAM) * - * @param {string} text + * @param {number} glyphs + * @param {number} glyphCount * - * @return {string} The resulting const char *. + * @return {undefined} */ -function TextToLower (text) { - return r.BindTextToLower( - text +function UnloadFontData(glyphs, glyphCount) { + return r.BindUnloadFontData( + glyphs, + glyphCount ) } -raylib.TextToLower = TextToLower +raylib.UnloadFontData = UnloadFontData /** - * Get Pascal case notation version of provided string + * Unload font from GPU memory (VRAM) * - * @param {string} text + * @param {Font} font * - * @return {string} The resulting const char *. + * @return {undefined} */ -function TextToPascal (text) { - return r.BindTextToPascal( - text +function UnloadFont(font) { + return r.BindUnloadFont( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs ) } -raylib.TextToPascal = TextToPascal +raylib.UnloadFont = UnloadFont /** - * Get integer value from text (negative values not supported) + * Export font as code file, returns true on success * - * @param {string} text + * @param {Font} font + * @param {string} fileName * - * @return {number} The resulting int. + * @return {boolean} The resulting bool. */ -function TextToInteger (text) { - return r.BindTextToInteger( - text +function ExportFontAsCode(font, fileName) { + return r.BindExportFontAsCode( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + fileName ) } -raylib.TextToInteger = TextToInteger +raylib.ExportFontAsCode = ExportFontAsCode /** - * Draw a line in 3D world space + * Draw current FPS * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {Color} color + * @param {number} posX + * @param {number} posY * * @return {undefined} */ -function DrawLine3D (startPos, endPos, color) { - return r.BindDrawLine3D( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - color.r, - color.g, - color.b, - color.a +function DrawFPS(posX, posY) { + return r.BindDrawFPS( + posX, + posY ) } -raylib.DrawLine3D = DrawLine3D +raylib.DrawFPS = DrawFPS /** - * Draw a point in 3D space, actually a small line + * Draw text (using default font) * - * @param {Vector3} position + * @param {string} text + * @param {number} posX + * @param {number} posY + * @param {number} fontSize * @param {Color} color * * @return {undefined} */ -function DrawPoint3D (position, color) { - return r.BindDrawPoint3D( - position.x, - position.y, - position.z, +function DrawText(text, posX, posY, fontSize, color) { + return r.BindDrawText( + text, + posX, + posY, + fontSize, color.r, color.g, color.b, color.a ) } -raylib.DrawPoint3D = DrawPoint3D +raylib.DrawText = DrawText /** - * Draw a circle in 3D world space + * Draw text using font and additional parameters * - * @param {Vector3} center - * @param {number} radius - * @param {Vector3} rotationAxis - * @param {number} rotationAngle - * @param {Color} color + * @param {Font} font + * @param {string} text + * @param {Vector2} position + * @param {number} fontSize + * @param {number} spacing + * @param {Color} tint * * @return {undefined} */ -function DrawCircle3D (center, radius, rotationAxis, rotationAngle, color) { - return r.BindDrawCircle3D( - center.x, - center.y, - center.z, - radius, - rotationAxis.x, - rotationAxis.y, - rotationAxis.z, - rotationAngle, - color.r, - color.g, - color.b, - color.a +function DrawTextEx(font, text, position, fontSize, spacing, tint) { + return r.BindDrawTextEx( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + text, + position.x, + position.y, + fontSize, + spacing, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawCircle3D = DrawCircle3D +raylib.DrawTextEx = DrawTextEx /** - * Draw a color-filled triangle (vertex in counter-clockwise order!) + * Draw text using Font and pro parameters (rotation) * - * @param {Vector3} v1 - * @param {Vector3} v2 - * @param {Vector3} v3 - * @param {Color} color + * @param {Font} font + * @param {string} text + * @param {Vector2} position + * @param {Vector2} origin + * @param {number} rotation + * @param {number} fontSize + * @param {number} spacing + * @param {Color} tint * * @return {undefined} */ -function DrawTriangle3D (v1, v2, v3, color) { - return r.BindDrawTriangle3D( - v1.x, - v1.y, - v1.z, - v2.x, - v2.y, - v2.z, - v3.x, - v3.y, - v3.z, - color.r, - color.g, - color.b, - color.a +function DrawTextPro(font, text, position, origin, rotation, fontSize, spacing, tint) { + return r.BindDrawTextPro( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + text, + position.x, + position.y, + origin.x, + origin.y, + rotation, + fontSize, + spacing, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawTriangle3D = DrawTriangle3D +raylib.DrawTextPro = DrawTextPro /** - * Draw a triangle strip defined by points + * Draw one character (codepoint) * - * @param {number} points - * @param {number} pointCount - * @param {Color} color + * @param {Font} font + * @param {number} codepoint + * @param {Vector2} position + * @param {number} fontSize + * @param {Color} tint * * @return {undefined} */ -function DrawTriangleStrip3D (points, pointCount, color) { - return r.BindDrawTriangleStrip3D( - points, - pointCount, - color.r, - color.g, - color.b, - color.a +function DrawTextCodepoint(font, codepoint, position, fontSize, tint) { + return r.BindDrawTextCodepoint( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoint, + position.x, + position.y, + fontSize, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawTriangleStrip3D = DrawTriangleStrip3D +raylib.DrawTextCodepoint = DrawTextCodepoint /** - * Draw cube + * Draw multiple character (codepoint) * - * @param {Vector3} position - * @param {number} width - * @param {number} height - * @param {number} length - * @param {Color} color + * @param {Font} font + * @param {number} codepoints + * @param {number} codepointCount + * @param {Vector2} position + * @param {number} fontSize + * @param {number} spacing + * @param {Color} tint * * @return {undefined} */ -function DrawCube (position, width, height, length, color) { - return r.BindDrawCube( +function DrawTextCodepoints(font, codepoints, codepointCount, position, fontSize, spacing, tint) { + return r.BindDrawTextCodepoints( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoints, + codepointCount, position.x, position.y, - position.z, - width, - height, - length, - color.r, - color.g, - color.b, - color.a + fontSize, + spacing, + tint.r, + tint.g, + tint.b, + tint.a ) } -raylib.DrawCube = DrawCube +raylib.DrawTextCodepoints = DrawTextCodepoints /** - * Draw cube (Vector version) + * Set vertical line spacing when drawing with line-breaks * - * @param {Vector3} position - * @param {Vector3} size - * @param {Color} color + * @param {number} spacing * * @return {undefined} */ -function DrawCubeV (position, size, color) { - return r.BindDrawCubeV( - position.x, - position.y, - position.z, - size.x, - size.y, - size.z, - color.r, - color.g, - color.b, - color.a +function SetTextLineSpacing(spacing) { + return r.BindSetTextLineSpacing( + spacing ) } -raylib.DrawCubeV = DrawCubeV +raylib.SetTextLineSpacing = SetTextLineSpacing /** - * Draw cube wires + * Measure string width for default font * - * @param {Vector3} position - * @param {number} width - * @param {number} height - * @param {number} length - * @param {Color} color + * @param {string} text + * @param {number} fontSize * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawCubeWires (position, width, height, length, color) { - return r.BindDrawCubeWires( - position.x, - position.y, - position.z, - width, - height, - length, - color.r, - color.g, - color.b, - color.a +function MeasureText(text, fontSize) { + return r.BindMeasureText( + text, + fontSize ) } -raylib.DrawCubeWires = DrawCubeWires +raylib.MeasureText = MeasureText /** - * Draw cube wires (Vector version) + * Measure string size for Font * - * @param {Vector3} position - * @param {Vector3} size - * @param {Color} color + * @param {Font} font + * @param {string} text + * @param {number} fontSize + * @param {number} spacing * - * @return {undefined} + * @return {Vector2} The resulting Vector2. */ -function DrawCubeWiresV (position, size, color) { - return r.BindDrawCubeWiresV( - position.x, - position.y, - position.z, - size.x, - size.y, - size.z, - color.r, - color.g, - color.b, - color.a +function MeasureTextEx(font, text, fontSize, spacing) { + return r.BindMeasureTextEx( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + text, + fontSize, + spacing ) } -raylib.DrawCubeWiresV = DrawCubeWiresV +raylib.MeasureTextEx = MeasureTextEx /** - * Draw sphere + * Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found * - * @param {Vector3} centerPos - * @param {number} radius - * @param {Color} color + * @param {Font} font + * @param {number} codepoint * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawSphere (centerPos, radius, color) { - return r.BindDrawSphere( - centerPos.x, - centerPos.y, - centerPos.z, - radius, - color.r, - color.g, - color.b, - color.a +function GetGlyphIndex(font, codepoint) { + return r.BindGetGlyphIndex( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoint ) } -raylib.DrawSphere = DrawSphere +raylib.GetGlyphIndex = GetGlyphIndex /** - * Draw sphere with extended parameters + * Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found * - * @param {Vector3} centerPos - * @param {number} radius - * @param {number} rings - * @param {number} slices - * @param {Color} color + * @param {Font} font + * @param {number} codepoint * - * @return {undefined} + * @return {GlyphInfo} The resulting GlyphInfo. */ -function DrawSphereEx (centerPos, radius, rings, slices, color) { - return r.BindDrawSphereEx( - centerPos.x, - centerPos.y, - centerPos.z, - radius, - rings, - slices, - color.r, - color.g, - color.b, - color.a +function GetGlyphInfo(font, codepoint) { + return r.BindGetGlyphInfo( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoint ) } -raylib.DrawSphereEx = DrawSphereEx +raylib.GetGlyphInfo = GetGlyphInfo /** - * Draw sphere wires + * Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found * - * @param {Vector3} centerPos - * @param {number} radius - * @param {number} rings - * @param {number} slices - * @param {Color} color + * @param {Font} font + * @param {number} codepoint * - * @return {undefined} + * @return {Rectangle} The resulting Rectangle. */ -function DrawSphereWires (centerPos, radius, rings, slices, color) { - return r.BindDrawSphereWires( - centerPos.x, - centerPos.y, - centerPos.z, - radius, - rings, - slices, - color.r, - color.g, - color.b, - color.a +function GetGlyphAtlasRec(font, codepoint) { + return r.BindGetGlyphAtlasRec( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs, + codepoint ) } -raylib.DrawSphereWires = DrawSphereWires +raylib.GetGlyphAtlasRec = GetGlyphAtlasRec /** - * Draw a cylinder/cone + * Load UTF-8 text encoded from codepoints array * - * @param {Vector3} position - * @param {number} radiusTop - * @param {number} radiusBottom - * @param {number} height - * @param {number} slices - * @param {Color} color + * @param {number} codepoints + * @param {number} length * - * @return {undefined} + * @return {string} The resulting char *. */ -function DrawCylinder (position, radiusTop, radiusBottom, height, slices, color) { - return r.BindDrawCylinder( - position.x, - position.y, - position.z, - radiusTop, - radiusBottom, - height, - slices, - color.r, - color.g, - color.b, - color.a +function LoadUTF8(codepoints, length) { + return r.BindLoadUTF8( + codepoints, + length ) } -raylib.DrawCylinder = DrawCylinder +raylib.LoadUTF8 = LoadUTF8 /** - * Draw a cylinder with base at startPos and top at endPos + * Unload UTF-8 text encoded from codepoints array * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {number} startRadius - * @param {number} endRadius - * @param {number} sides - * @param {Color} color + * @param {string} text * * @return {undefined} */ -function DrawCylinderEx (startPos, endPos, startRadius, endRadius, sides, color) { - return r.BindDrawCylinderEx( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - startRadius, - endRadius, - sides, - color.r, - color.g, - color.b, - color.a +function UnloadUTF8(text) { + return r.BindUnloadUTF8( + text ) } -raylib.DrawCylinderEx = DrawCylinderEx +raylib.UnloadUTF8 = UnloadUTF8 /** - * Draw a cylinder/cone wires + * Load all codepoints from a UTF-8 text string, codepoints count returned by parameter * - * @param {Vector3} position - * @param {number} radiusTop - * @param {number} radiusBottom - * @param {number} height - * @param {number} slices - * @param {Color} color + * @param {string} text + * @param {number} count * - * @return {undefined} + * @return {number} The resulting int *. */ -function DrawCylinderWires (position, radiusTop, radiusBottom, height, slices, color) { - return r.BindDrawCylinderWires( - position.x, - position.y, - position.z, - radiusTop, - radiusBottom, - height, - slices, - color.r, - color.g, - color.b, - color.a +function LoadCodepoints(text, count) { + return r.BindLoadCodepoints( + text, + count ) } -raylib.DrawCylinderWires = DrawCylinderWires +raylib.LoadCodepoints = LoadCodepoints /** - * Draw a cylinder wires with base at startPos and top at endPos + * Unload codepoints data from memory * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {number} startRadius - * @param {number} endRadius - * @param {number} sides - * @param {Color} color + * @param {number} codepoints * * @return {undefined} */ -function DrawCylinderWiresEx (startPos, endPos, startRadius, endRadius, sides, color) { - return r.BindDrawCylinderWiresEx( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - startRadius, - endRadius, - sides, - color.r, - color.g, - color.b, - color.a +function UnloadCodepoints(codepoints) { + return r.BindUnloadCodepoints( + codepoints ) } -raylib.DrawCylinderWiresEx = DrawCylinderWiresEx +raylib.UnloadCodepoints = UnloadCodepoints /** - * Draw a capsule with the center of its sphere caps at startPos and endPos + * Get total number of codepoints in a UTF-8 encoded string * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {number} radius - * @param {number} slices - * @param {number} rings - * @param {Color} color + * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawCapsule (startPos, endPos, radius, slices, rings, color) { - return r.BindDrawCapsule( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - radius, - slices, - rings, - color.r, - color.g, - color.b, - color.a +function GetCodepointCount(text) { + return r.BindGetCodepointCount( + text ) } -raylib.DrawCapsule = DrawCapsule +raylib.GetCodepointCount = GetCodepointCount /** - * Draw capsule wireframe with the center of its sphere caps at startPos and endPos + * Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure * - * @param {Vector3} startPos - * @param {Vector3} endPos - * @param {number} radius - * @param {number} slices - * @param {number} rings - * @param {Color} color + * @param {string} text + * @param {number} codepointSize * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawCapsuleWires (startPos, endPos, radius, slices, rings, color) { - return r.BindDrawCapsuleWires( - startPos.x, - startPos.y, - startPos.z, - endPos.x, - endPos.y, - endPos.z, - radius, - slices, - rings, - color.r, - color.g, - color.b, - color.a +function GetCodepoint(text, codepointSize) { + return r.BindGetCodepoint( + text, + codepointSize ) } -raylib.DrawCapsuleWires = DrawCapsuleWires +raylib.GetCodepoint = GetCodepoint /** - * Draw a plane XZ + * Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure * - * @param {Vector3} centerPos - * @param {Vector2} size - * @param {Color} color + * @param {string} text + * @param {number} codepointSize * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawPlane (centerPos, size, color) { - return r.BindDrawPlane( - centerPos.x, - centerPos.y, - centerPos.z, - size.x, - size.y, - color.r, - color.g, - color.b, - color.a +function GetCodepointNext(text, codepointSize) { + return r.BindGetCodepointNext( + text, + codepointSize ) } -raylib.DrawPlane = DrawPlane +raylib.GetCodepointNext = GetCodepointNext /** - * Draw a ray line + * Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure * - * @param {Ray} ray - * @param {Color} color + * @param {string} text + * @param {number} codepointSize * - * @return {undefined} + * @return {number} The resulting int. */ -function DrawRay (ray, color) { - return r.BindDrawRay( - ray.position.x, - ray.position.y, - ray.position.z, - ray.direction.x, - ray.direction.y, - ray.direction.z, - color.r, - color.g, - color.b, - color.a +function GetCodepointPrevious(text, codepointSize) { + return r.BindGetCodepointPrevious( + text, + codepointSize ) } -raylib.DrawRay = DrawRay +raylib.GetCodepointPrevious = GetCodepointPrevious /** - * Draw a grid (centered at (0, 0, 0)) + * Encode one codepoint into UTF-8 byte array (array length returned as parameter) * - * @param {number} slices - * @param {number} spacing + * @param {number} codepoint + * @param {number} utf8Size * - * @return {undefined} + * @return {string} The resulting const char *. */ -function DrawGrid (slices, spacing) { - return r.BindDrawGrid( - slices, - spacing +function CodepointToUTF8(codepoint, utf8Size) { + return r.BindCodepointToUTF8( + codepoint, + utf8Size ) } -raylib.DrawGrid = DrawGrid +raylib.CodepointToUTF8 = CodepointToUTF8 /** - * Load model from files (meshes and materials) + * Copy one string to another, returns bytes copied * - * @param {string} fileName + * @param {string} dst + * @param {string} src * - * @return {Model} The resulting Model. + * @return {number} The resulting int. */ -function LoadModel (fileName) { - return r.BindLoadModel( - fileName +function TextCopy(dst, src) { + return r.BindTextCopy( + dst, + src ) } -raylib.LoadModel = LoadModel +raylib.TextCopy = TextCopy /** - * Load model from generated mesh (default material) + * Check if two text string are equal * - * @param {Mesh} mesh + * @param {string} text1 + * @param {string} text2 * - * @return {Model} The resulting Model. + * @return {boolean} The resulting bool. */ -function LoadModelFromMesh (mesh) { - return r.BindLoadModelFromMesh( - mesh.vertexCount, - mesh.triangleCount, - mesh.vertices, - mesh.texcoords, - mesh.texcoords2, - mesh.normals, - mesh.tangents, - mesh.colors, - mesh.indices, - mesh.animVertices, - mesh.animNormals, - mesh.boneIds, - mesh.boneWeights, - mesh.vaoId, - mesh.vboId +function TextIsEqual(text1, text2) { + return r.BindTextIsEqual( + text1, + text2 ) } -raylib.LoadModelFromMesh = LoadModelFromMesh +raylib.TextIsEqual = TextIsEqual /** - * Check if a model is ready + * Get text length, checks for '\0' ending * - * @param {Model} model + * @param {string} text * - * @return {boolean} The resulting bool. + * @return {number} The resulting unsigned int. */ -function IsModelReady (model) { - return r.BindIsModelReady( - model.transform.m0, - model.transform.m4, - model.transform.m8, - model.transform.m12, - model.transform.m1, - model.transform.m5, - model.transform.m9, - model.transform.m13, - model.transform.m2, - model.transform.m6, - model.transform.m10, - model.transform.m14, - model.transform.m3, - model.transform.m7, - model.transform.m11, - model.transform.m15, - model.meshCount, - model.materialCount, - model.meshes, - model.materials, - model.meshMaterial, - model.boneCount, - model.bones, - model.bindPose +function TextLength(text) { + return r.BindTextLength( + text ) } -raylib.IsModelReady = IsModelReady +raylib.TextLength = TextLength /** - * Unload model (including meshes) from memory (RAM and/or VRAM) + * Get a piece of a text string * - * @param {Model} model + * @param {string} text + * @param {number} position + * @param {number} length * - * @return {undefined} + * @return {string} The resulting const char *. */ -function UnloadModel (model) { - return r.BindUnloadModel( - model.transform.m0, - model.transform.m4, - model.transform.m8, - model.transform.m12, - model.transform.m1, - model.transform.m5, - model.transform.m9, - model.transform.m13, - model.transform.m2, - model.transform.m6, - model.transform.m10, - model.transform.m14, - model.transform.m3, - model.transform.m7, - model.transform.m11, - model.transform.m15, - model.meshCount, - model.materialCount, - model.meshes, - model.materials, - model.meshMaterial, - model.boneCount, - model.bones, - model.bindPose +function TextSubtext(text, position, length) { + return r.BindTextSubtext( + text, + position, + length ) } -raylib.UnloadModel = UnloadModel +raylib.TextSubtext = TextSubtext /** - * Compute model bounding box limits (considers all meshes) + * Replace text string (WARNING: memory must be freed!) * - * @param {Model} model + * @param {string} text + * @param {string} replace + * @param {string} by * - * @return {BoundingBox} The resulting BoundingBox. + * @return {string} The resulting char *. */ -function GetModelBoundingBox (model) { - return r.BindGetModelBoundingBox( - model.transform.m0, - model.transform.m4, +function TextReplace(text, replace, by) { + return r.BindTextReplace( + text, + replace, + by + ) +} +raylib.TextReplace = TextReplace + +/** + * Insert text in a position (WARNING: memory must be freed!) + * + * @param {string} text + * @param {string} insert + * @param {number} position + * + * @return {string} The resulting char *. + */ +function TextInsert(text, insert, position) { + return r.BindTextInsert( + text, + insert, + position + ) +} +raylib.TextInsert = TextInsert + +/** + * Join text strings with delimiter + * + * @param {number} textList + * @param {number} count + * @param {string} delimiter + * + * @return {string} The resulting const char *. + */ +function TextJoin(textList, count, delimiter) { + return r.BindTextJoin( + textList, + count, + delimiter + ) +} +raylib.TextJoin = TextJoin + +/** + * Split text into multiple strings + * + * @param {string} text + * @param {string} delimiter + * @param {number} count + * + * @return {number} The resulting const char **. + */ +function TextSplit(text, delimiter, count) { + return r.BindTextSplit( + text, + delimiter, + count + ) +} +raylib.TextSplit = TextSplit + +/** + * Append text at specific position and move cursor! + * + * @param {string} text + * @param {string} append + * @param {number} position + * + * @return {undefined} + */ +function TextAppend(text, append, position) { + return r.BindTextAppend( + text, + append, + position + ) +} +raylib.TextAppend = TextAppend + +/** + * Find first text occurrence within a string + * + * @param {string} text + * @param {string} find + * + * @return {number} The resulting int. + */ +function TextFindIndex(text, find) { + return r.BindTextFindIndex( + text, + find + ) +} +raylib.TextFindIndex = TextFindIndex + +/** + * Get upper case version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToUpper(text) { + return r.BindTextToUpper( + text + ) +} +raylib.TextToUpper = TextToUpper + +/** + * Get lower case version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToLower(text) { + return r.BindTextToLower( + text + ) +} +raylib.TextToLower = TextToLower + +/** + * Get Pascal case notation version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToPascal(text) { + return r.BindTextToPascal( + text + ) +} +raylib.TextToPascal = TextToPascal + +/** + * Get Snake case notation version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToSnake(text) { + return r.BindTextToSnake( + text + ) +} +raylib.TextToSnake = TextToSnake + +/** + * Get Camel case notation version of provided string + * + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function TextToCamel(text) { + return r.BindTextToCamel( + text + ) +} +raylib.TextToCamel = TextToCamel + +/** + * Get integer value from text (negative values not supported) + * + * @param {string} text + * + * @return {number} The resulting int. + */ +function TextToInteger(text) { + return r.BindTextToInteger( + text + ) +} +raylib.TextToInteger = TextToInteger + +/** + * Get float value from text (negative values not supported) + * + * @param {string} text + * + * @return {number} The resulting float. + */ +function TextToFloat(text) { + return r.BindTextToFloat( + text + ) +} +raylib.TextToFloat = TextToFloat + +/** + * Draw a line in 3D world space + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {Color} color + * + * @return {undefined} + */ +function DrawLine3D(startPos, endPos, color) { + return r.BindDrawLine3D( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawLine3D = DrawLine3D + +/** + * Draw a point in 3D space, actually a small line + * + * @param {Vector3} position + * @param {Color} color + * + * @return {undefined} + */ +function DrawPoint3D(position, color) { + return r.BindDrawPoint3D( + position.x, + position.y, + position.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawPoint3D = DrawPoint3D + +/** + * Draw a circle in 3D world space + * + * @param {Vector3} center + * @param {number} radius + * @param {Vector3} rotationAxis + * @param {number} rotationAngle + * @param {Color} color + * + * @return {undefined} + */ +function DrawCircle3D(center, radius, rotationAxis, rotationAngle, color) { + return r.BindDrawCircle3D( + center.x, + center.y, + center.z, + radius, + rotationAxis.x, + rotationAxis.y, + rotationAxis.z, + rotationAngle, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCircle3D = DrawCircle3D + +/** + * Draw a color-filled triangle (vertex in counter-clockwise order!) + * + * @param {Vector3} v1 + * @param {Vector3} v2 + * @param {Vector3} v3 + * @param {Color} color + * + * @return {undefined} + */ +function DrawTriangle3D(v1, v2, v3, color) { + return r.BindDrawTriangle3D( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z, + v3.x, + v3.y, + v3.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawTriangle3D = DrawTriangle3D + +/** + * Draw a triangle strip defined by points + * + * @param {number} points + * @param {number} pointCount + * @param {Color} color + * + * @return {undefined} + */ +function DrawTriangleStrip3D(points, pointCount, color) { + return r.BindDrawTriangleStrip3D( + points, + pointCount, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawTriangleStrip3D = DrawTriangleStrip3D + +/** + * Draw cube + * + * @param {Vector3} position + * @param {number} width + * @param {number} height + * @param {number} length + * @param {Color} color + * + * @return {undefined} + */ +function DrawCube(position, width, height, length, color) { + return r.BindDrawCube( + position.x, + position.y, + position.z, + width, + height, + length, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCube = DrawCube + +/** + * Draw cube (Vector version) + * + * @param {Vector3} position + * @param {Vector3} size + * @param {Color} color + * + * @return {undefined} + */ +function DrawCubeV(position, size, color) { + return r.BindDrawCubeV( + position.x, + position.y, + position.z, + size.x, + size.y, + size.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCubeV = DrawCubeV + +/** + * Draw cube wires + * + * @param {Vector3} position + * @param {number} width + * @param {number} height + * @param {number} length + * @param {Color} color + * + * @return {undefined} + */ +function DrawCubeWires(position, width, height, length, color) { + return r.BindDrawCubeWires( + position.x, + position.y, + position.z, + width, + height, + length, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCubeWires = DrawCubeWires + +/** + * Draw cube wires (Vector version) + * + * @param {Vector3} position + * @param {Vector3} size + * @param {Color} color + * + * @return {undefined} + */ +function DrawCubeWiresV(position, size, color) { + return r.BindDrawCubeWiresV( + position.x, + position.y, + position.z, + size.x, + size.y, + size.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCubeWiresV = DrawCubeWiresV + +/** + * Draw sphere + * + * @param {Vector3} centerPos + * @param {number} radius + * @param {Color} color + * + * @return {undefined} + */ +function DrawSphere(centerPos, radius, color) { + return r.BindDrawSphere( + centerPos.x, + centerPos.y, + centerPos.z, + radius, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawSphere = DrawSphere + +/** + * Draw sphere with extended parameters + * + * @param {Vector3} centerPos + * @param {number} radius + * @param {number} rings + * @param {number} slices + * @param {Color} color + * + * @return {undefined} + */ +function DrawSphereEx(centerPos, radius, rings, slices, color) { + return r.BindDrawSphereEx( + centerPos.x, + centerPos.y, + centerPos.z, + radius, + rings, + slices, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawSphereEx = DrawSphereEx + +/** + * Draw sphere wires + * + * @param {Vector3} centerPos + * @param {number} radius + * @param {number} rings + * @param {number} slices + * @param {Color} color + * + * @return {undefined} + */ +function DrawSphereWires(centerPos, radius, rings, slices, color) { + return r.BindDrawSphereWires( + centerPos.x, + centerPos.y, + centerPos.z, + radius, + rings, + slices, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawSphereWires = DrawSphereWires + +/** + * Draw a cylinder/cone + * + * @param {Vector3} position + * @param {number} radiusTop + * @param {number} radiusBottom + * @param {number} height + * @param {number} slices + * @param {Color} color + * + * @return {undefined} + */ +function DrawCylinder(position, radiusTop, radiusBottom, height, slices, color) { + return r.BindDrawCylinder( + position.x, + position.y, + position.z, + radiusTop, + radiusBottom, + height, + slices, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCylinder = DrawCylinder + +/** + * Draw a cylinder with base at startPos and top at endPos + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {number} startRadius + * @param {number} endRadius + * @param {number} sides + * @param {Color} color + * + * @return {undefined} + */ +function DrawCylinderEx(startPos, endPos, startRadius, endRadius, sides, color) { + return r.BindDrawCylinderEx( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + startRadius, + endRadius, + sides, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCylinderEx = DrawCylinderEx + +/** + * Draw a cylinder/cone wires + * + * @param {Vector3} position + * @param {number} radiusTop + * @param {number} radiusBottom + * @param {number} height + * @param {number} slices + * @param {Color} color + * + * @return {undefined} + */ +function DrawCylinderWires(position, radiusTop, radiusBottom, height, slices, color) { + return r.BindDrawCylinderWires( + position.x, + position.y, + position.z, + radiusTop, + radiusBottom, + height, + slices, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCylinderWires = DrawCylinderWires + +/** + * Draw a cylinder wires with base at startPos and top at endPos + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {number} startRadius + * @param {number} endRadius + * @param {number} sides + * @param {Color} color + * + * @return {undefined} + */ +function DrawCylinderWiresEx(startPos, endPos, startRadius, endRadius, sides, color) { + return r.BindDrawCylinderWiresEx( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + startRadius, + endRadius, + sides, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCylinderWiresEx = DrawCylinderWiresEx + +/** + * Draw a capsule with the center of its sphere caps at startPos and endPos + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {number} radius + * @param {number} slices + * @param {number} rings + * @param {Color} color + * + * @return {undefined} + */ +function DrawCapsule(startPos, endPos, radius, slices, rings, color) { + return r.BindDrawCapsule( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + radius, + slices, + rings, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCapsule = DrawCapsule + +/** + * Draw capsule wireframe with the center of its sphere caps at startPos and endPos + * + * @param {Vector3} startPos + * @param {Vector3} endPos + * @param {number} radius + * @param {number} slices + * @param {number} rings + * @param {Color} color + * + * @return {undefined} + */ +function DrawCapsuleWires(startPos, endPos, radius, slices, rings, color) { + return r.BindDrawCapsuleWires( + startPos.x, + startPos.y, + startPos.z, + endPos.x, + endPos.y, + endPos.z, + radius, + slices, + rings, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawCapsuleWires = DrawCapsuleWires + +/** + * Draw a plane XZ + * + * @param {Vector3} centerPos + * @param {Vector2} size + * @param {Color} color + * + * @return {undefined} + */ +function DrawPlane(centerPos, size, color) { + return r.BindDrawPlane( + centerPos.x, + centerPos.y, + centerPos.z, + size.x, + size.y, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawPlane = DrawPlane + +/** + * Draw a ray line + * + * @param {Ray} ray + * @param {Color} color + * + * @return {undefined} + */ +function DrawRay(ray, color) { + return r.BindDrawRay( + ray.position.x, + ray.position.y, + ray.position.z, + ray.direction.x, + ray.direction.y, + ray.direction.z, + color.r, + color.g, + color.b, + color.a + ) +} +raylib.DrawRay = DrawRay + +/** + * Draw a grid (centered at (0, 0, 0)) + * + * @param {number} slices + * @param {number} spacing + * + * @return {undefined} + */ +function DrawGrid(slices, spacing) { + return r.BindDrawGrid( + slices, + spacing + ) +} +raylib.DrawGrid = DrawGrid + +/** + * Load model from files (meshes and materials) + * + * @param {string} fileName + * + * @return {Model} The resulting Model. + */ +function LoadModel(fileName) { + return r.BindLoadModel( + fileName + ) +} +raylib.LoadModel = LoadModel + +/** + * Load model from generated mesh (default material) + * + * @param {Mesh} mesh + * + * @return {Model} The resulting Model. + */ +function LoadModelFromMesh(mesh) { + return r.BindLoadModelFromMesh( + mesh.vertexCount, + mesh.triangleCount, + mesh.vertices, + mesh.texcoords, + mesh.texcoords2, + mesh.normals, + mesh.tangents, + mesh.colors, + mesh.indices, + mesh.animVertices, + mesh.animNormals, + mesh.boneIds, + mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, + mesh.vaoId, + mesh.vboId + ) +} +raylib.LoadModelFromMesh = LoadModelFromMesh + +/** + * Check if a model is valid (loaded in GPU, VAO/VBOs) + * + * @param {Model} model + * + * @return {boolean} The resulting bool. + */ +function IsModelValid(model) { + return r.BindIsModelValid( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose + ) +} +raylib.IsModelValid = IsModelValid + +/** + * Unload model (including meshes) from memory (RAM and/or VRAM) + * + * @param {Model} model + * + * @return {undefined} + */ +function UnloadModel(model) { + return r.BindUnloadModel( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose + ) +} +raylib.UnloadModel = UnloadModel + +/** + * Compute model bounding box limits (considers all meshes) + * + * @param {Model} model + * + * @return {BoundingBox} The resulting BoundingBox. + */ +function GetModelBoundingBox(model) { + return r.BindGetModelBoundingBox( + model.transform.m0, + model.transform.m4, model.transform.m8, model.transform.m12, model.transform.m1, @@ -6593,7 +7709,7 @@ raylib.GetModelBoundingBox = GetModelBoundingBox * * @return {undefined} */ -function DrawModel (model, position, scale, tint) { +function DrawModel(model, position, scale, tint) { return r.BindDrawModel( model.transform.m0, model.transform.m4, @@ -6643,7 +7759,7 @@ raylib.DrawModel = DrawModel * * @return {undefined} */ -function DrawModelEx (model, position, rotationAxis, rotationAngle, scale, tint) { +function DrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint) { return r.BindDrawModelEx( model.transform.m0, model.transform.m4, @@ -6697,7 +7813,7 @@ raylib.DrawModelEx = DrawModelEx * * @return {undefined} */ -function DrawModelWires (model, position, scale, tint) { +function DrawModelWires(model, position, scale, tint) { return r.BindDrawModelWires( model.transform.m0, model.transform.m4, @@ -6747,7 +7863,7 @@ raylib.DrawModelWires = DrawModelWires * * @return {undefined} */ -function DrawModelWiresEx (model, position, rotationAxis, rotationAngle, scale, tint) { +function DrawModelWiresEx(model, position, rotationAxis, rotationAngle, scale, tint) { return r.BindDrawModelWiresEx( model.transform.m0, model.transform.m4, @@ -6791,6 +7907,110 @@ function DrawModelWiresEx (model, position, rotationAxis, rotationAngle, scale, } raylib.DrawModelWiresEx = DrawModelWiresEx +/** + * Draw a model as points + * + * @param {Model} model + * @param {Vector3} position + * @param {number} scale + * @param {Color} tint + * + * @return {undefined} + */ +function DrawModelPoints(model, position, scale, tint) { + return r.BindDrawModelPoints( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose, + position.x, + position.y, + position.z, + scale, + tint.r, + tint.g, + tint.b, + tint.a + ) +} +raylib.DrawModelPoints = DrawModelPoints + +/** + * Draw a model as points with extended parameters + * + * @param {Model} model + * @param {Vector3} position + * @param {Vector3} rotationAxis + * @param {number} rotationAngle + * @param {Vector3} scale + * @param {Color} tint + * + * @return {undefined} + */ +function DrawModelPointsEx(model, position, rotationAxis, rotationAngle, scale, tint) { + return r.BindDrawModelPointsEx( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose, + position.x, + position.y, + position.z, + rotationAxis.x, + rotationAxis.y, + rotationAxis.z, + rotationAngle, + scale.x, + scale.y, + scale.z, + tint.r, + tint.g, + tint.b, + tint.a + ) +} +raylib.DrawModelPointsEx = DrawModelPointsEx + /** * Draw bounding box (wires) * @@ -6799,7 +8019,7 @@ raylib.DrawModelWiresEx = DrawModelWiresEx * * @return {undefined} */ -function DrawBoundingBox (box, color) { +function DrawBoundingBox(box, color) { return r.BindDrawBoundingBox( box.min.x, box.min.y, @@ -6821,12 +8041,12 @@ raylib.DrawBoundingBox = DrawBoundingBox * @param {Camera3D} camera * @param {Texture} texture * @param {Vector3} position - * @param {number} size + * @param {number} scale * @param {Color} tint * * @return {undefined} */ -function DrawBillboard (camera, texture, position, size, tint) { +function DrawBillboard(camera, texture, position, scale, tint) { return r.BindDrawBillboard( camera.position.x, camera.position.y, @@ -6847,7 +8067,7 @@ function DrawBillboard (camera, texture, position, size, tint) { position.x, position.y, position.z, - size, + scale, tint.r, tint.g, tint.b, @@ -6868,7 +8088,7 @@ raylib.DrawBillboard = DrawBillboard * * @return {undefined} */ -function DrawBillboardRec (camera, texture, source, position, size, tint) { +function DrawBillboardRec(camera, texture, source, position, size, tint) { return r.BindDrawBillboardRec( camera.position.x, camera.position.y, @@ -6918,7 +8138,7 @@ raylib.DrawBillboardRec = DrawBillboardRec * * @return {undefined} */ -function DrawBillboardPro (camera, texture, source, position, up, size, origin, rotation, tint) { +function DrawBillboardPro(camera, texture, source, position, up, size, origin, rotation, tint) { return r.BindDrawBillboardPro( camera.position.x, camera.position.y, @@ -6970,7 +8190,7 @@ raylib.DrawBillboardPro = DrawBillboardPro * * @return {undefined} */ -function UpdateMeshBuffer (mesh, index, data, dataSize, offset) { +function UpdateMeshBuffer(mesh, index, data, dataSize, offset) { return r.BindUpdateMeshBuffer( mesh.vertexCount, mesh.triangleCount, @@ -6985,6 +8205,8 @@ function UpdateMeshBuffer (mesh, index, data, dataSize, offset) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId, index, @@ -7002,7 +8224,7 @@ raylib.UpdateMeshBuffer = UpdateMeshBuffer * * @return {undefined} */ -function UnloadMesh (mesh) { +function UnloadMesh(mesh) { return r.BindUnloadMesh( mesh.vertexCount, mesh.triangleCount, @@ -7017,12 +8239,44 @@ function UnloadMesh (mesh) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId ) } raylib.UnloadMesh = UnloadMesh +/** + * Compute mesh bounding box limits + * + * @param {Mesh} mesh + * + * @return {BoundingBox} The resulting BoundingBox. + */ +function GetMeshBoundingBox(mesh) { + return r.BindGetMeshBoundingBox( + mesh.vertexCount, + mesh.triangleCount, + mesh.vertices, + mesh.texcoords, + mesh.texcoords2, + mesh.normals, + mesh.tangents, + mesh.colors, + mesh.indices, + mesh.animVertices, + mesh.animNormals, + mesh.boneIds, + mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, + mesh.vaoId, + mesh.vboId + ) +} +raylib.GetMeshBoundingBox = GetMeshBoundingBox + /** * Export mesh data to file, returns true on success * @@ -7031,7 +8285,7 @@ raylib.UnloadMesh = UnloadMesh * * @return {boolean} The resulting bool. */ -function ExportMesh (mesh, fileName) { +function ExportMesh(mesh, fileName) { return r.BindExportMesh( mesh.vertexCount, mesh.triangleCount, @@ -7046,6 +8300,8 @@ function ExportMesh (mesh, fileName) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId, fileName @@ -7054,14 +8310,15 @@ function ExportMesh (mesh, fileName) { raylib.ExportMesh = ExportMesh /** - * Compute mesh bounding box limits + * Export mesh as code file (.h) defining multiple arrays of vertex attributes * * @param {Mesh} mesh + * @param {string} fileName * - * @return {BoundingBox} The resulting BoundingBox. + * @return {boolean} The resulting bool. */ -function GetMeshBoundingBox (mesh) { - return r.BindGetMeshBoundingBox( +function ExportMeshAsCode(mesh, fileName) { + return r.BindExportMeshAsCode( mesh.vertexCount, mesh.triangleCount, mesh.vertices, @@ -7075,11 +8332,14 @@ function GetMeshBoundingBox (mesh) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, - mesh.vboId + mesh.vboId, + fileName ) } -raylib.GetMeshBoundingBox = GetMeshBoundingBox +raylib.ExportMeshAsCode = ExportMeshAsCode /** * Generate polygonal mesh @@ -7089,7 +8349,7 @@ raylib.GetMeshBoundingBox = GetMeshBoundingBox * * @return {Mesh} The resulting Mesh. */ -function GenMeshPoly (sides, radius) { +function GenMeshPoly(sides, radius) { return r.BindGenMeshPoly( sides, radius @@ -7107,7 +8367,7 @@ raylib.GenMeshPoly = GenMeshPoly * * @return {Mesh} The resulting Mesh. */ -function GenMeshPlane (width, length, resX, resZ) { +function GenMeshPlane(width, length, resX, resZ) { return r.BindGenMeshPlane( width, length, @@ -7126,7 +8386,7 @@ raylib.GenMeshPlane = GenMeshPlane * * @return {Mesh} The resulting Mesh. */ -function GenMeshCube (width, height, length) { +function GenMeshCube(width, height, length) { return r.BindGenMeshCube( width, height, @@ -7144,7 +8404,7 @@ raylib.GenMeshCube = GenMeshCube * * @return {Mesh} The resulting Mesh. */ -function GenMeshSphere (radius, rings, slices) { +function GenMeshSphere(radius, rings, slices) { return r.BindGenMeshSphere( radius, rings, @@ -7162,7 +8422,7 @@ raylib.GenMeshSphere = GenMeshSphere * * @return {Mesh} The resulting Mesh. */ -function GenMeshHemiSphere (radius, rings, slices) { +function GenMeshHemiSphere(radius, rings, slices) { return r.BindGenMeshHemiSphere( radius, rings, @@ -7180,7 +8440,7 @@ raylib.GenMeshHemiSphere = GenMeshHemiSphere * * @return {Mesh} The resulting Mesh. */ -function GenMeshCylinder (radius, height, slices) { +function GenMeshCylinder(radius, height, slices) { return r.BindGenMeshCylinder( radius, height, @@ -7198,7 +8458,7 @@ raylib.GenMeshCylinder = GenMeshCylinder * * @return {Mesh} The resulting Mesh. */ -function GenMeshCone (radius, height, slices) { +function GenMeshCone(radius, height, slices) { return r.BindGenMeshCone( radius, height, @@ -7217,7 +8477,7 @@ raylib.GenMeshCone = GenMeshCone * * @return {Mesh} The resulting Mesh. */ -function GenMeshTorus (radius, size, radSeg, sides) { +function GenMeshTorus(radius, size, radSeg, sides) { return r.BindGenMeshTorus( radius, size, @@ -7237,7 +8497,7 @@ raylib.GenMeshTorus = GenMeshTorus * * @return {Mesh} The resulting Mesh. */ -function GenMeshKnot (radius, size, radSeg, sides) { +function GenMeshKnot(radius, size, radSeg, sides) { return r.BindGenMeshKnot( radius, size, @@ -7255,7 +8515,7 @@ raylib.GenMeshKnot = GenMeshKnot * * @return {Mesh} The resulting Mesh. */ -function GenMeshHeightmap (heightmap, size) { +function GenMeshHeightmap(heightmap, size) { return r.BindGenMeshHeightmap( heightmap.data, heightmap.width, @@ -7277,7 +8537,7 @@ raylib.GenMeshHeightmap = GenMeshHeightmap * * @return {Mesh} The resulting Mesh. */ -function GenMeshCubicmap (cubicmap, cubeSize) { +function GenMeshCubicmap(cubicmap, cubeSize) { return r.BindGenMeshCubicmap( cubicmap.data, cubicmap.width, @@ -7299,7 +8559,7 @@ raylib.GenMeshCubicmap = GenMeshCubicmap * * @return {number} The resulting ModelAnimation *. */ -function LoadModelAnimations (fileName, animCount) { +function LoadModelAnimations(fileName, animCount) { return r.BindLoadModelAnimations( fileName, animCount @@ -7308,7 +8568,7 @@ function LoadModelAnimations (fileName, animCount) { raylib.LoadModelAnimations = LoadModelAnimations /** - * Update model animation pose + * Update model animation pose (CPU) * * @param {Model} model * @param {ModelAnimation} anim @@ -7316,7 +8576,7 @@ raylib.LoadModelAnimations = LoadModelAnimations * * @return {undefined} */ -function UpdateModelAnimation (model, anim, frame) { +function UpdateModelAnimation(model, anim, frame) { return r.BindUpdateModelAnimation( model.transform.m0, model.transform.m4, @@ -7346,11 +8606,57 @@ function UpdateModelAnimation (model, anim, frame) { anim.frameCount, anim.bones, anim.framePoses, + anim.name, frame ) } raylib.UpdateModelAnimation = UpdateModelAnimation +/** + * Update model animation mesh bone matrices (GPU skinning) + * + * @param {Model} model + * @param {ModelAnimation} anim + * @param {number} frame + * + * @return {undefined} + */ +function UpdateModelAnimationBones(model, anim, frame) { + return r.BindUpdateModelAnimationBones( + model.transform.m0, + model.transform.m4, + model.transform.m8, + model.transform.m12, + model.transform.m1, + model.transform.m5, + model.transform.m9, + model.transform.m13, + model.transform.m2, + model.transform.m6, + model.transform.m10, + model.transform.m14, + model.transform.m3, + model.transform.m7, + model.transform.m11, + model.transform.m15, + model.meshCount, + model.materialCount, + model.meshes, + model.materials, + model.meshMaterial, + model.boneCount, + model.bones, + model.bindPose, + anim.boneCount, + anim.frameCount, + anim.bones, + anim.framePoses, + anim.name, + frame + ) +} +raylib.UpdateModelAnimationBones = UpdateModelAnimationBones + /** * Unload animation data * @@ -7358,12 +8664,13 @@ raylib.UpdateModelAnimation = UpdateModelAnimation * * @return {undefined} */ -function UnloadModelAnimation (anim) { +function UnloadModelAnimation(anim) { return r.BindUnloadModelAnimation( anim.boneCount, anim.frameCount, anim.bones, - anim.framePoses + anim.framePoses, + anim.name ) } raylib.UnloadModelAnimation = UnloadModelAnimation @@ -7372,14 +8679,14 @@ raylib.UnloadModelAnimation = UnloadModelAnimation * Unload animation array data * * @param {number} animations - * @param {number} count + * @param {number} animCount * * @return {undefined} */ -function UnloadModelAnimations (animations, count) { +function UnloadModelAnimations(animations, animCount) { return r.BindUnloadModelAnimations( animations, - count + animCount ) } raylib.UnloadModelAnimations = UnloadModelAnimations @@ -7392,7 +8699,7 @@ raylib.UnloadModelAnimations = UnloadModelAnimations * * @return {boolean} The resulting bool. */ -function IsModelAnimationValid (model, anim) { +function IsModelAnimationValid(model, anim) { return r.BindIsModelAnimationValid( model.transform.m0, model.transform.m4, @@ -7421,7 +8728,8 @@ function IsModelAnimationValid (model, anim) { anim.boneCount, anim.frameCount, anim.bones, - anim.framePoses + anim.framePoses, + anim.name ) } raylib.IsModelAnimationValid = IsModelAnimationValid @@ -7436,7 +8744,7 @@ raylib.IsModelAnimationValid = IsModelAnimationValid * * @return {boolean} The resulting bool. */ -function CheckCollisionSpheres (center1, radius1, center2, radius2) { +function CheckCollisionSpheres(center1, radius1, center2, radius2) { return r.BindCheckCollisionSpheres( center1.x, center1.y, @@ -7458,7 +8766,7 @@ raylib.CheckCollisionSpheres = CheckCollisionSpheres * * @return {boolean} The resulting bool. */ -function CheckCollisionBoxes (box1, box2) { +function CheckCollisionBoxes(box1, box2) { return r.BindCheckCollisionBoxes( box1.min.x, box1.min.y, @@ -7485,7 +8793,7 @@ raylib.CheckCollisionBoxes = CheckCollisionBoxes * * @return {boolean} The resulting bool. */ -function CheckCollisionBoxSphere (box, center, radius) { +function CheckCollisionBoxSphere(box, center, radius) { return r.BindCheckCollisionBoxSphere( box.min.x, box.min.y, @@ -7510,7 +8818,7 @@ raylib.CheckCollisionBoxSphere = CheckCollisionBoxSphere * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionSphere (ray, center, radius) { +function GetRayCollisionSphere(ray, center, radius) { return r.BindGetRayCollisionSphere( ray.position.x, ray.position.y, @@ -7534,7 +8842,7 @@ raylib.GetRayCollisionSphere = GetRayCollisionSphere * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionBox (ray, box) { +function GetRayCollisionBox(ray, box) { return r.BindGetRayCollisionBox( ray.position.x, ray.position.y, @@ -7561,7 +8869,7 @@ raylib.GetRayCollisionBox = GetRayCollisionBox * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionMesh (ray, mesh, transform) { +function GetRayCollisionMesh(ray, mesh, transform) { return r.BindGetRayCollisionMesh( ray.position.x, ray.position.y, @@ -7582,6 +8890,8 @@ function GetRayCollisionMesh (ray, mesh, transform) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId, transform.m0, @@ -7614,7 +8924,7 @@ raylib.GetRayCollisionMesh = GetRayCollisionMesh * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionTriangle (ray, p1, p2, p3) { +function GetRayCollisionTriangle(ray, p1, p2, p3) { return r.BindGetRayCollisionTriangle( ray.position.x, ray.position.y, @@ -7646,7 +8956,7 @@ raylib.GetRayCollisionTriangle = GetRayCollisionTriangle * * @return {RayCollision} The resulting RayCollision. */ -function GetRayCollisionQuad (ray, p1, p2, p3, p4) { +function GetRayCollisionQuad(ray, p1, p2, p3, p4) { return r.BindGetRayCollisionQuad( ray.position.x, ray.position.y, @@ -7675,7 +8985,7 @@ raylib.GetRayCollisionQuad = GetRayCollisionQuad * * @return {undefined} */ -function InitAudioDevice () { +function InitAudioDevice() { return r.BindInitAudioDevice() } raylib.InitAudioDevice = InitAudioDevice @@ -7685,7 +8995,7 @@ raylib.InitAudioDevice = InitAudioDevice * * @return {undefined} */ -function CloseAudioDevice () { +function CloseAudioDevice() { return r.BindCloseAudioDevice() } raylib.CloseAudioDevice = CloseAudioDevice @@ -7695,7 +9005,7 @@ raylib.CloseAudioDevice = CloseAudioDevice * * @return {boolean} The resulting bool. */ -function IsAudioDeviceReady () { +function IsAudioDeviceReady() { return r.BindIsAudioDeviceReady() } raylib.IsAudioDeviceReady = IsAudioDeviceReady @@ -7707,13 +9017,23 @@ raylib.IsAudioDeviceReady = IsAudioDeviceReady * * @return {undefined} */ -function SetMasterVolume (volume) { +function SetMasterVolume(volume) { return r.BindSetMasterVolume( volume ) } raylib.SetMasterVolume = SetMasterVolume +/** + * Get master volume (listener) + * + * @return {number} The resulting float. + */ +function GetMasterVolume() { + return r.BindGetMasterVolume() +} +raylib.GetMasterVolume = GetMasterVolume + /** * Load wave data from file * @@ -7721,7 +9041,7 @@ raylib.SetMasterVolume = SetMasterVolume * * @return {Wave} The resulting Wave. */ -function LoadWave (fileName) { +function LoadWave(fileName) { return r.BindLoadWave( fileName ) @@ -7737,7 +9057,7 @@ raylib.LoadWave = LoadWave * * @return {Wave} The resulting Wave. */ -function LoadWaveFromMemory (fileType, fileData, dataSize) { +function LoadWaveFromMemory(fileType, fileData, dataSize) { return r.BindLoadWaveFromMemory( fileType, fileData, @@ -7747,14 +9067,14 @@ function LoadWaveFromMemory (fileType, fileData, dataSize) { raylib.LoadWaveFromMemory = LoadWaveFromMemory /** - * Checks if wave data is ready + * Checks if wave data is valid (data loaded and parameters) * * @param {Wave} wave * * @return {boolean} The resulting bool. */ -function IsWaveReady (wave) { - return r.BindIsWaveReady( +function IsWaveValid(wave) { + return r.BindIsWaveValid( wave.frameCount, wave.sampleRate, wave.sampleSize, @@ -7762,7 +9082,7 @@ function IsWaveReady (wave) { wave.data ) } -raylib.IsWaveReady = IsWaveReady +raylib.IsWaveValid = IsWaveValid /** * Load sound from file @@ -7771,7 +9091,7 @@ raylib.IsWaveReady = IsWaveReady * * @return {Sound} The resulting Sound. */ -function LoadSound (fileName) { +function LoadSound(fileName) { return r.BindLoadSound( fileName ) @@ -7785,7 +9105,7 @@ raylib.LoadSound = LoadSound * * @return {Sound} The resulting Sound. */ -function LoadSoundFromWave (wave) { +function LoadSoundFromWave(wave) { return r.BindLoadSoundFromWave( wave.frameCount, wave.sampleRate, @@ -7797,14 +9117,33 @@ function LoadSoundFromWave (wave) { raylib.LoadSoundFromWave = LoadSoundFromWave /** - * Checks if a sound is ready + * Create a new sound that shares the same sample data as the source sound, does not own the sound data + * + * @param {Sound} source + * + * @return {Sound} The resulting Sound. + */ +function LoadSoundAlias(source) { + return r.BindLoadSoundAlias( + source.stream.buffer, + source.stream.processor, + source.stream.sampleRate, + source.stream.sampleSize, + source.stream.channels, + source.frameCount + ) +} +raylib.LoadSoundAlias = LoadSoundAlias + +/** + * Checks if a sound is valid (data loaded and buffers initialized) * * @param {Sound} sound * * @return {boolean} The resulting bool. */ -function IsSoundReady (sound) { - return r.BindIsSoundReady( +function IsSoundValid(sound) { + return r.BindIsSoundValid( sound.stream.buffer, sound.stream.processor, sound.stream.sampleRate, @@ -7813,7 +9152,7 @@ function IsSoundReady (sound) { sound.frameCount ) } -raylib.IsSoundReady = IsSoundReady +raylib.IsSoundValid = IsSoundValid /** * Update sound buffer with new data @@ -7824,7 +9163,7 @@ raylib.IsSoundReady = IsSoundReady * * @return {undefined} */ -function UpdateSound (sound, data, sampleCount) { +function UpdateSound(sound, data, sampleCount) { return r.BindUpdateSound( sound.stream.buffer, sound.stream.processor, @@ -7845,7 +9184,7 @@ raylib.UpdateSound = UpdateSound * * @return {undefined} */ -function UnloadWave (wave) { +function UnloadWave(wave) { return r.BindUnloadWave( wave.frameCount, wave.sampleRate, @@ -7863,7 +9202,7 @@ raylib.UnloadWave = UnloadWave * * @return {undefined} */ -function UnloadSound (sound) { +function UnloadSound(sound) { return r.BindUnloadSound( sound.stream.buffer, sound.stream.processor, @@ -7875,6 +9214,25 @@ function UnloadSound (sound) { } raylib.UnloadSound = UnloadSound +/** + * Unload a sound alias (does not deallocate sample data) + * + * @param {Sound} alias + * + * @return {undefined} + */ +function UnloadSoundAlias(alias) { + return r.BindUnloadSoundAlias( + alias.stream.buffer, + alias.stream.processor, + alias.stream.sampleRate, + alias.stream.sampleSize, + alias.stream.channels, + alias.frameCount + ) +} +raylib.UnloadSoundAlias = UnloadSoundAlias + /** * Export wave data to file, returns true on success * @@ -7883,7 +9241,7 @@ raylib.UnloadSound = UnloadSound * * @return {boolean} The resulting bool. */ -function ExportWave (wave, fileName) { +function ExportWave(wave, fileName) { return r.BindExportWave( wave.frameCount, wave.sampleRate, @@ -7903,7 +9261,7 @@ raylib.ExportWave = ExportWave * * @return {boolean} The resulting bool. */ -function ExportWaveAsCode (wave, fileName) { +function ExportWaveAsCode(wave, fileName) { return r.BindExportWaveAsCode( wave.frameCount, wave.sampleRate, @@ -7922,7 +9280,7 @@ raylib.ExportWaveAsCode = ExportWaveAsCode * * @return {undefined} */ -function PlaySound (sound) { +function PlaySound(sound) { return r.BindPlaySound( sound.stream.buffer, sound.stream.processor, @@ -7941,7 +9299,7 @@ raylib.PlaySound = PlaySound * * @return {undefined} */ -function StopSound (sound) { +function StopSound(sound) { return r.BindStopSound( sound.stream.buffer, sound.stream.processor, @@ -7960,7 +9318,7 @@ raylib.StopSound = StopSound * * @return {undefined} */ -function PauseSound (sound) { +function PauseSound(sound) { return r.BindPauseSound( sound.stream.buffer, sound.stream.processor, @@ -7979,7 +9337,7 @@ raylib.PauseSound = PauseSound * * @return {undefined} */ -function ResumeSound (sound) { +function ResumeSound(sound) { return r.BindResumeSound( sound.stream.buffer, sound.stream.processor, @@ -7998,7 +9356,7 @@ raylib.ResumeSound = ResumeSound * * @return {boolean} The resulting bool. */ -function IsSoundPlaying (sound) { +function IsSoundPlaying(sound) { return r.BindIsSoundPlaying( sound.stream.buffer, sound.stream.processor, @@ -8018,7 +9376,7 @@ raylib.IsSoundPlaying = IsSoundPlaying * * @return {undefined} */ -function SetSoundVolume (sound, volume) { +function SetSoundVolume(sound, volume) { return r.BindSetSoundVolume( sound.stream.buffer, sound.stream.processor, @@ -8039,7 +9397,7 @@ raylib.SetSoundVolume = SetSoundVolume * * @return {undefined} */ -function SetSoundPitch (sound, pitch) { +function SetSoundPitch(sound, pitch) { return r.BindSetSoundPitch( sound.stream.buffer, sound.stream.processor, @@ -8060,7 +9418,7 @@ raylib.SetSoundPitch = SetSoundPitch * * @return {undefined} */ -function SetSoundPan (sound, pan) { +function SetSoundPan(sound, pan) { return r.BindSetSoundPan( sound.stream.buffer, sound.stream.processor, @@ -8080,7 +9438,7 @@ raylib.SetSoundPan = SetSoundPan * * @return {Wave} The resulting Wave. */ -function WaveCopy (wave) { +function WaveCopy(wave) { return r.BindWaveCopy( wave.frameCount, wave.sampleRate, @@ -8098,7 +9456,7 @@ raylib.WaveCopy = WaveCopy * * @return {number} The resulting float *. */ -function LoadWaveSamples (wave) { +function LoadWaveSamples(wave) { return r.BindLoadWaveSamples( wave.frameCount, wave.sampleRate, @@ -8116,7 +9474,7 @@ raylib.LoadWaveSamples = LoadWaveSamples * * @return {undefined} */ -function UnloadWaveSamples (samples) { +function UnloadWaveSamples(samples) { return r.BindUnloadWaveSamples( samples ) @@ -8130,7 +9488,7 @@ raylib.UnloadWaveSamples = UnloadWaveSamples * * @return {Music} The resulting Music. */ -function LoadMusicStream (fileName) { +function LoadMusicStream(fileName) { return r.BindLoadMusicStream( fileName ) @@ -8146,7 +9504,7 @@ raylib.LoadMusicStream = LoadMusicStream * * @return {Music} The resulting Music. */ -function LoadMusicStreamFromMemory (fileType, data, dataSize) { +function LoadMusicStreamFromMemory(fileType, data, dataSize) { return r.BindLoadMusicStreamFromMemory( fileType, data, @@ -8156,14 +9514,14 @@ function LoadMusicStreamFromMemory (fileType, data, dataSize) { raylib.LoadMusicStreamFromMemory = LoadMusicStreamFromMemory /** - * Checks if a music stream is ready + * Checks if a music stream is valid (context and buffers initialized) * * @param {Music} music * * @return {boolean} The resulting bool. */ -function IsMusicReady (music) { - return r.BindIsMusicReady( +function IsMusicValid(music) { + return r.BindIsMusicValid( music.stream.buffer, music.stream.processor, music.stream.sampleRate, @@ -8175,7 +9533,7 @@ function IsMusicReady (music) { music.ctxData ) } -raylib.IsMusicReady = IsMusicReady +raylib.IsMusicValid = IsMusicValid /** * Unload music stream @@ -8184,7 +9542,7 @@ raylib.IsMusicReady = IsMusicReady * * @return {undefined} */ -function UnloadMusicStream (music) { +function UnloadMusicStream(music) { return r.BindUnloadMusicStream( music.stream.buffer, music.stream.processor, @@ -8206,7 +9564,7 @@ raylib.UnloadMusicStream = UnloadMusicStream * * @return {undefined} */ -function PlayMusicStream (music) { +function PlayMusicStream(music) { return r.BindPlayMusicStream( music.stream.buffer, music.stream.processor, @@ -8228,7 +9586,7 @@ raylib.PlayMusicStream = PlayMusicStream * * @return {boolean} The resulting bool. */ -function IsMusicStreamPlaying (music) { +function IsMusicStreamPlaying(music) { return r.BindIsMusicStreamPlaying( music.stream.buffer, music.stream.processor, @@ -8250,7 +9608,7 @@ raylib.IsMusicStreamPlaying = IsMusicStreamPlaying * * @return {undefined} */ -function UpdateMusicStream (music) { +function UpdateMusicStream(music) { return r.BindUpdateMusicStream( music.stream.buffer, music.stream.processor, @@ -8272,7 +9630,7 @@ raylib.UpdateMusicStream = UpdateMusicStream * * @return {undefined} */ -function StopMusicStream (music) { +function StopMusicStream(music) { return r.BindStopMusicStream( music.stream.buffer, music.stream.processor, @@ -8294,7 +9652,7 @@ raylib.StopMusicStream = StopMusicStream * * @return {undefined} */ -function PauseMusicStream (music) { +function PauseMusicStream(music) { return r.BindPauseMusicStream( music.stream.buffer, music.stream.processor, @@ -8316,7 +9674,7 @@ raylib.PauseMusicStream = PauseMusicStream * * @return {undefined} */ -function ResumeMusicStream (music) { +function ResumeMusicStream(music) { return r.BindResumeMusicStream( music.stream.buffer, music.stream.processor, @@ -8339,7 +9697,7 @@ raylib.ResumeMusicStream = ResumeMusicStream * * @return {undefined} */ -function SeekMusicStream (music, position) { +function SeekMusicStream(music, position) { return r.BindSeekMusicStream( music.stream.buffer, music.stream.processor, @@ -8363,7 +9721,7 @@ raylib.SeekMusicStream = SeekMusicStream * * @return {undefined} */ -function SetMusicVolume (music, volume) { +function SetMusicVolume(music, volume) { return r.BindSetMusicVolume( music.stream.buffer, music.stream.processor, @@ -8387,7 +9745,7 @@ raylib.SetMusicVolume = SetMusicVolume * * @return {undefined} */ -function SetMusicPitch (music, pitch) { +function SetMusicPitch(music, pitch) { return r.BindSetMusicPitch( music.stream.buffer, music.stream.processor, @@ -8411,7 +9769,7 @@ raylib.SetMusicPitch = SetMusicPitch * * @return {undefined} */ -function SetMusicPan (music, pan) { +function SetMusicPan(music, pan) { return r.BindSetMusicPan( music.stream.buffer, music.stream.processor, @@ -8434,7 +9792,7 @@ raylib.SetMusicPan = SetMusicPan * * @return {number} The resulting float. */ -function GetMusicTimeLength (music) { +function GetMusicTimeLength(music) { return r.BindGetMusicTimeLength( music.stream.buffer, music.stream.processor, @@ -8456,7 +9814,7 @@ raylib.GetMusicTimeLength = GetMusicTimeLength * * @return {number} The resulting float. */ -function GetMusicTimePlayed (music) { +function GetMusicTimePlayed(music) { return r.BindGetMusicTimePlayed( music.stream.buffer, music.stream.processor, @@ -8480,7 +9838,7 @@ raylib.GetMusicTimePlayed = GetMusicTimePlayed * * @return {AudioStream} The resulting AudioStream. */ -function LoadAudioStream (sampleRate, sampleSize, channels) { +function LoadAudioStream(sampleRate, sampleSize, channels) { return r.BindLoadAudioStream( sampleRate, sampleSize, @@ -8490,14 +9848,14 @@ function LoadAudioStream (sampleRate, sampleSize, channels) { raylib.LoadAudioStream = LoadAudioStream /** - * Checks if an audio stream is ready + * Checks if an audio stream is valid (buffers initialized) * * @param {AudioStream} stream * * @return {boolean} The resulting bool. */ -function IsAudioStreamReady (stream) { - return r.BindIsAudioStreamReady( +function IsAudioStreamValid(stream) { + return r.BindIsAudioStreamValid( stream.buffer, stream.processor, stream.sampleRate, @@ -8505,7 +9863,7 @@ function IsAudioStreamReady (stream) { stream.channels ) } -raylib.IsAudioStreamReady = IsAudioStreamReady +raylib.IsAudioStreamValid = IsAudioStreamValid /** * Unload audio stream and free memory @@ -8514,7 +9872,7 @@ raylib.IsAudioStreamReady = IsAudioStreamReady * * @return {undefined} */ -function UnloadAudioStream (stream) { +function UnloadAudioStream(stream) { return r.BindUnloadAudioStream( stream.buffer, stream.processor, @@ -8534,7 +9892,7 @@ raylib.UnloadAudioStream = UnloadAudioStream * * @return {undefined} */ -function UpdateAudioStream (stream, data, frameCount) { +function UpdateAudioStream(stream, data, frameCount) { return r.BindUpdateAudioStream( stream.buffer, stream.processor, @@ -8554,7 +9912,7 @@ raylib.UpdateAudioStream = UpdateAudioStream * * @return {boolean} The resulting bool. */ -function IsAudioStreamProcessed (stream) { +function IsAudioStreamProcessed(stream) { return r.BindIsAudioStreamProcessed( stream.buffer, stream.processor, @@ -8572,7 +9930,7 @@ raylib.IsAudioStreamProcessed = IsAudioStreamProcessed * * @return {undefined} */ -function PlayAudioStream (stream) { +function PlayAudioStream(stream) { return r.BindPlayAudioStream( stream.buffer, stream.processor, @@ -8590,7 +9948,7 @@ raylib.PlayAudioStream = PlayAudioStream * * @return {undefined} */ -function PauseAudioStream (stream) { +function PauseAudioStream(stream) { return r.BindPauseAudioStream( stream.buffer, stream.processor, @@ -8608,7 +9966,7 @@ raylib.PauseAudioStream = PauseAudioStream * * @return {undefined} */ -function ResumeAudioStream (stream) { +function ResumeAudioStream(stream) { return r.BindResumeAudioStream( stream.buffer, stream.processor, @@ -8626,7 +9984,7 @@ raylib.ResumeAudioStream = ResumeAudioStream * * @return {boolean} The resulting bool. */ -function IsAudioStreamPlaying (stream) { +function IsAudioStreamPlaying(stream) { return r.BindIsAudioStreamPlaying( stream.buffer, stream.processor, @@ -8644,7 +10002,7 @@ raylib.IsAudioStreamPlaying = IsAudioStreamPlaying * * @return {undefined} */ -function StopAudioStream (stream) { +function StopAudioStream(stream) { return r.BindStopAudioStream( stream.buffer, stream.processor, @@ -8663,7 +10021,7 @@ raylib.StopAudioStream = StopAudioStream * * @return {undefined} */ -function SetAudioStreamVolume (stream, volume) { +function SetAudioStreamVolume(stream, volume) { return r.BindSetAudioStreamVolume( stream.buffer, stream.processor, @@ -8683,7 +10041,7 @@ raylib.SetAudioStreamVolume = SetAudioStreamVolume * * @return {undefined} */ -function SetAudioStreamPitch (stream, pitch) { +function SetAudioStreamPitch(stream, pitch) { return r.BindSetAudioStreamPitch( stream.buffer, stream.processor, @@ -8703,7 +10061,7 @@ raylib.SetAudioStreamPitch = SetAudioStreamPitch * * @return {undefined} */ -function SetAudioStreamPan (stream, pan) { +function SetAudioStreamPan(stream, pan) { return r.BindSetAudioStreamPan( stream.buffer, stream.processor, @@ -8722,7 +10080,7 @@ raylib.SetAudioStreamPan = SetAudioStreamPan * * @return {undefined} */ -function SetAudioStreamBufferSizeDefault (size) { +function SetAudioStreamBufferSizeDefault(size) { return r.BindSetAudioStreamBufferSizeDefault( size ) @@ -8739,7 +10097,7 @@ raylib.SetAudioStreamBufferSizeDefault = SetAudioStreamBufferSizeDefault * * @return {number} The resulting float. */ -function EaseLinearNone (t, b, c, d) { +function EaseLinearNone(t, b, c, d) { return r.BindEaseLinearNone( t, b, @@ -8759,7 +10117,7 @@ raylib.EaseLinearNone = EaseLinearNone * * @return {number} The resulting float. */ -function EaseLinearIn (t, b, c, d) { +function EaseLinearIn(t, b, c, d) { return r.BindEaseLinearIn( t, b, @@ -8779,7 +10137,7 @@ raylib.EaseLinearIn = EaseLinearIn * * @return {number} The resulting float. */ -function EaseLinearOut (t, b, c, d) { +function EaseLinearOut(t, b, c, d) { return r.BindEaseLinearOut( t, b, @@ -8799,7 +10157,7 @@ raylib.EaseLinearOut = EaseLinearOut * * @return {number} The resulting float. */ -function EaseLinearInOut (t, b, c, d) { +function EaseLinearInOut(t, b, c, d) { return r.BindEaseLinearInOut( t, b, @@ -8819,7 +10177,7 @@ raylib.EaseLinearInOut = EaseLinearInOut * * @return {number} The resulting float. */ -function EaseSineIn (t, b, c, d) { +function EaseSineIn(t, b, c, d) { return r.BindEaseSineIn( t, b, @@ -8827,10 +10185,170 @@ function EaseSineIn (t, b, c, d) { d ) } -raylib.EaseSineIn = EaseSineIn +raylib.EaseSineIn = EaseSineIn + +/** + * Ease: Sine Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseSineOut(t, b, c, d) { + return r.BindEaseSineOut( + t, + b, + c, + d + ) +} +raylib.EaseSineOut = EaseSineOut + +/** + * Ease: Sine Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseSineInOut(t, b, c, d) { + return r.BindEaseSineInOut( + t, + b, + c, + d + ) +} +raylib.EaseSineInOut = EaseSineInOut + +/** + * Ease: Circular In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCircIn(t, b, c, d) { + return r.BindEaseCircIn( + t, + b, + c, + d + ) +} +raylib.EaseCircIn = EaseCircIn + +/** + * Ease: Circular Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCircOut(t, b, c, d) { + return r.BindEaseCircOut( + t, + b, + c, + d + ) +} +raylib.EaseCircOut = EaseCircOut + +/** + * Ease: Circular In Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCircInOut(t, b, c, d) { + return r.BindEaseCircInOut( + t, + b, + c, + d + ) +} +raylib.EaseCircInOut = EaseCircInOut + +/** + * Ease: Cubic In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCubicIn(t, b, c, d) { + return r.BindEaseCubicIn( + t, + b, + c, + d + ) +} +raylib.EaseCubicIn = EaseCubicIn + +/** + * Ease: Cubic Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCubicOut(t, b, c, d) { + return r.BindEaseCubicOut( + t, + b, + c, + d + ) +} +raylib.EaseCubicOut = EaseCubicOut + +/** + * Ease: Cubic In Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ +function EaseCubicInOut(t, b, c, d) { + return r.BindEaseCubicInOut( + t, + b, + c, + d + ) +} +raylib.EaseCubicInOut = EaseCubicInOut /** - * Ease: Sine Out + * Ease: Quadratic In * * @param {number} t * @param {number} b @@ -8839,18 +10357,18 @@ raylib.EaseSineIn = EaseSineIn * * @return {number} The resulting float. */ -function EaseSineOut (t, b, c, d) { - return r.BindEaseSineOut( +function EaseQuadIn(t, b, c, d) { + return r.BindEaseQuadIn( t, b, c, d ) } -raylib.EaseSineOut = EaseSineOut +raylib.EaseQuadIn = EaseQuadIn /** - * Ease: Sine Out + * Ease: Quadratic Out * * @param {number} t * @param {number} b @@ -8859,18 +10377,18 @@ raylib.EaseSineOut = EaseSineOut * * @return {number} The resulting float. */ -function EaseSineInOut (t, b, c, d) { - return r.BindEaseSineInOut( +function EaseQuadOut(t, b, c, d) { + return r.BindEaseQuadOut( t, b, c, d ) } -raylib.EaseSineInOut = EaseSineInOut +raylib.EaseQuadOut = EaseQuadOut /** - * Ease: Circular In + * Ease: Quadratic In Out * * @param {number} t * @param {number} b @@ -8879,18 +10397,18 @@ raylib.EaseSineInOut = EaseSineInOut * * @return {number} The resulting float. */ -function EaseCircIn (t, b, c, d) { - return r.BindEaseCircIn( +function EaseQuadInOut(t, b, c, d) { + return r.BindEaseQuadInOut( t, b, c, d ) } -raylib.EaseCircIn = EaseCircIn +raylib.EaseQuadInOut = EaseQuadInOut /** - * Ease: Circular Out + * Ease: Exponential In * * @param {number} t * @param {number} b @@ -8899,18 +10417,18 @@ raylib.EaseCircIn = EaseCircIn * * @return {number} The resulting float. */ -function EaseCircOut (t, b, c, d) { - return r.BindEaseCircOut( +function EaseExpoIn(t, b, c, d) { + return r.BindEaseExpoIn( t, b, c, d ) } -raylib.EaseCircOut = EaseCircOut +raylib.EaseExpoIn = EaseExpoIn /** - * Ease: Circular In Out + * Ease: Exponential Out * * @param {number} t * @param {number} b @@ -8919,18 +10437,18 @@ raylib.EaseCircOut = EaseCircOut * * @return {number} The resulting float. */ -function EaseCircInOut (t, b, c, d) { - return r.BindEaseCircInOut( +function EaseExpoOut(t, b, c, d) { + return r.BindEaseExpoOut( t, b, c, d ) } -raylib.EaseCircInOut = EaseCircInOut +raylib.EaseExpoOut = EaseExpoOut /** - * Ease: Cubic In + * Ease: Exponential In Out * * @param {number} t * @param {number} b @@ -8939,18 +10457,18 @@ raylib.EaseCircInOut = EaseCircInOut * * @return {number} The resulting float. */ -function EaseCubicIn (t, b, c, d) { - return r.BindEaseCubicIn( +function EaseExpoInOut(t, b, c, d) { + return r.BindEaseExpoInOut( t, b, c, d ) } -raylib.EaseCubicIn = EaseCubicIn +raylib.EaseExpoInOut = EaseExpoInOut /** - * Ease: Cubic Out + * Ease: Back In * * @param {number} t * @param {number} b @@ -8959,18 +10477,18 @@ raylib.EaseCubicIn = EaseCubicIn * * @return {number} The resulting float. */ -function EaseCubicOut (t, b, c, d) { - return r.BindEaseCubicOut( +function EaseBackIn(t, b, c, d) { + return r.BindEaseBackIn( t, b, c, d ) } -raylib.EaseCubicOut = EaseCubicOut +raylib.EaseBackIn = EaseBackIn /** - * Ease: Cubic In Out + * Ease: Back Out * * @param {number} t * @param {number} b @@ -8979,18 +10497,18 @@ raylib.EaseCubicOut = EaseCubicOut * * @return {number} The resulting float. */ -function EaseCubicInOut (t, b, c, d) { - return r.BindEaseCubicInOut( +function EaseBackOut(t, b, c, d) { + return r.BindEaseBackOut( t, b, c, d ) } -raylib.EaseCubicInOut = EaseCubicInOut +raylib.EaseBackOut = EaseBackOut /** - * Ease: Quadratic In + * Ease: Back In Out * * @param {number} t * @param {number} b @@ -8999,18 +10517,18 @@ raylib.EaseCubicInOut = EaseCubicInOut * * @return {number} The resulting float. */ -function EaseQuadIn (t, b, c, d) { - return r.BindEaseQuadIn( +function EaseBackInOut(t, b, c, d) { + return r.BindEaseBackInOut( t, b, c, d ) } -raylib.EaseQuadIn = EaseQuadIn +raylib.EaseBackInOut = EaseBackInOut /** - * Ease: Quadratic Out + * Ease: Bounce Out * * @param {number} t * @param {number} b @@ -9019,18 +10537,18 @@ raylib.EaseQuadIn = EaseQuadIn * * @return {number} The resulting float. */ -function EaseQuadOut (t, b, c, d) { - return r.BindEaseQuadOut( +function EaseBounceOut(t, b, c, d) { + return r.BindEaseBounceOut( t, b, c, d ) } -raylib.EaseQuadOut = EaseQuadOut +raylib.EaseBounceOut = EaseBounceOut /** - * Ease: Quadratic In Out + * Ease: Bounce In * * @param {number} t * @param {number} b @@ -9039,18 +10557,18 @@ raylib.EaseQuadOut = EaseQuadOut * * @return {number} The resulting float. */ -function EaseQuadInOut (t, b, c, d) { - return r.BindEaseQuadInOut( +function EaseBounceIn(t, b, c, d) { + return r.BindEaseBounceIn( t, b, c, d ) } -raylib.EaseQuadInOut = EaseQuadInOut +raylib.EaseBounceIn = EaseBounceIn /** - * Ease: Exponential In + * Ease: Bounce In Out * * @param {number} t * @param {number} b @@ -9059,18 +10577,18 @@ raylib.EaseQuadInOut = EaseQuadInOut * * @return {number} The resulting float. */ -function EaseExpoIn (t, b, c, d) { - return r.BindEaseExpoIn( +function EaseBounceInOut(t, b, c, d) { + return r.BindEaseBounceInOut( t, b, c, d ) } -raylib.EaseExpoIn = EaseExpoIn +raylib.EaseBounceInOut = EaseBounceInOut /** - * Ease: Exponential Out + * Ease: Elastic In * * @param {number} t * @param {number} b @@ -9079,18 +10597,18 @@ raylib.EaseExpoIn = EaseExpoIn * * @return {number} The resulting float. */ -function EaseExpoOut (t, b, c, d) { - return r.BindEaseExpoOut( +function EaseElasticIn(t, b, c, d) { + return r.BindEaseElasticIn( t, b, c, d ) } -raylib.EaseExpoOut = EaseExpoOut +raylib.EaseElasticIn = EaseElasticIn /** - * Ease: Exponential In Out + * Ease: Elastic Out * * @param {number} t * @param {number} b @@ -9099,18 +10617,18 @@ raylib.EaseExpoOut = EaseExpoOut * * @return {number} The resulting float. */ -function EaseExpoInOut (t, b, c, d) { - return r.BindEaseExpoInOut( +function EaseElasticOut(t, b, c, d) { + return r.BindEaseElasticOut( t, b, c, d ) } -raylib.EaseExpoInOut = EaseExpoInOut +raylib.EaseElasticOut = EaseElasticOut /** - * Ease: Back In + * Ease: Elastic In Out * * @param {number} t * @param {number} b @@ -9119,394 +10637,592 @@ raylib.EaseExpoInOut = EaseExpoInOut * * @return {number} The resulting float. */ -function EaseBackIn (t, b, c, d) { - return r.BindEaseBackIn( +function EaseElasticInOut(t, b, c, d) { + return r.BindEaseElasticInOut( t, b, c, d ) } -raylib.EaseBackIn = EaseBackIn +raylib.EaseElasticInOut = EaseElasticInOut + +function Clamp(value, min, max) { + return r.BindClamp( + value, + min, + max + ) +} +raylib.Clamp = Clamp + +function Lerp(start, end, amount) { + return r.BindLerp( + start, + end, + amount + ) +} +raylib.Lerp = Lerp + +function Normalize(value, start, end) { + return r.BindNormalize( + value, + start, + end + ) +} +raylib.Normalize = Normalize + +function Remap(value, inputStart, inputEnd, outputStart, outputEnd) { + return r.BindRemap( + value, + inputStart, + inputEnd, + outputStart, + outputEnd + ) +} +raylib.Remap = Remap + +function Wrap(value, min, max) { + return r.BindWrap( + value, + min, + max + ) +} +raylib.Wrap = Wrap + +function FloatEquals(x, y) { + return r.BindFloatEquals( + x, + y + ) +} +raylib.FloatEquals = FloatEquals + +function Vector2Zero() { + return r.BindVector2Zero() +} +raylib.Vector2Zero = Vector2Zero + +function Vector2One() { + return r.BindVector2One() +} +raylib.Vector2One = Vector2One + +function Vector2Add(v1, v2) { + return r.BindVector2Add( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Add = Vector2Add + +function Vector2AddValue(v, add) { + return r.BindVector2AddValue( + v.x, + v.y, + add + ) +} +raylib.Vector2AddValue = Vector2AddValue + +function Vector2Subtract(v1, v2) { + return r.BindVector2Subtract( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Subtract = Vector2Subtract + +function Vector2SubtractValue(v, sub) { + return r.BindVector2SubtractValue( + v.x, + v.y, + sub + ) +} +raylib.Vector2SubtractValue = Vector2SubtractValue + +function Vector2Length(v) { + return r.BindVector2Length( + v.x, + v.y + ) +} +raylib.Vector2Length = Vector2Length + +function Vector2LengthSqr(v) { + return r.BindVector2LengthSqr( + v.x, + v.y + ) +} +raylib.Vector2LengthSqr = Vector2LengthSqr + +function Vector2DotProduct(v1, v2) { + return r.BindVector2DotProduct( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2DotProduct = Vector2DotProduct + +function Vector2Distance(v1, v2) { + return r.BindVector2Distance( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Distance = Vector2Distance + +function Vector2DistanceSqr(v1, v2) { + return r.BindVector2DistanceSqr( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2DistanceSqr = Vector2DistanceSqr + +function Vector2Angle(v1, v2) { + return r.BindVector2Angle( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Angle = Vector2Angle + +function Vector2LineAngle(start, end) { + return r.BindVector2LineAngle( + start.x, + start.y, + end.x, + end.y + ) +} +raylib.Vector2LineAngle = Vector2LineAngle + +function Vector2Scale(v, scale) { + return r.BindVector2Scale( + v.x, + v.y, + scale + ) +} +raylib.Vector2Scale = Vector2Scale + +function Vector2Multiply(v1, v2) { + return r.BindVector2Multiply( + v1.x, + v1.y, + v2.x, + v2.y + ) +} +raylib.Vector2Multiply = Vector2Multiply -/** - * Ease: Back Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBackOut (t, b, c, d) { - return r.BindEaseBackOut( - t, - b, - c, - d +function Vector2Negate(v) { + return r.BindVector2Negate( + v.x, + v.y ) } -raylib.EaseBackOut = EaseBackOut +raylib.Vector2Negate = Vector2Negate -/** - * Ease: Back In Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBackInOut (t, b, c, d) { - return r.BindEaseBackInOut( - t, - b, - c, - d +function Vector2Divide(v1, v2) { + return r.BindVector2Divide( + v1.x, + v1.y, + v2.x, + v2.y ) } -raylib.EaseBackInOut = EaseBackInOut +raylib.Vector2Divide = Vector2Divide -/** - * Ease: Bounce Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBounceOut (t, b, c, d) { - return r.BindEaseBounceOut( - t, - b, - c, - d +function Vector2Normalize(v) { + return r.BindVector2Normalize( + v.x, + v.y ) } -raylib.EaseBounceOut = EaseBounceOut +raylib.Vector2Normalize = Vector2Normalize -/** - * Ease: Bounce In - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBounceIn (t, b, c, d) { - return r.BindEaseBounceIn( - t, - b, - c, - d +function Vector2Transform(v, mat) { + return r.BindVector2Transform( + v.x, + v.y, + mat.m0, + mat.m4, + mat.m8, + mat.m12, + mat.m1, + mat.m5, + mat.m9, + mat.m13, + mat.m2, + mat.m6, + mat.m10, + mat.m14, + mat.m3, + mat.m7, + mat.m11, + mat.m15 ) } -raylib.EaseBounceIn = EaseBounceIn +raylib.Vector2Transform = Vector2Transform -/** - * Ease: Bounce In Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseBounceInOut (t, b, c, d) { - return r.BindEaseBounceInOut( - t, - b, - c, - d +function Vector2Lerp(v1, v2, amount) { + return r.BindVector2Lerp( + v1.x, + v1.y, + v2.x, + v2.y, + amount ) } -raylib.EaseBounceInOut = EaseBounceInOut +raylib.Vector2Lerp = Vector2Lerp -/** - * Ease: Elastic In - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseElasticIn (t, b, c, d) { - return r.BindEaseElasticIn( - t, - b, - c, - d +function Vector2Reflect(v, normal) { + return r.BindVector2Reflect( + v.x, + v.y, + normal.x, + normal.y ) } -raylib.EaseElasticIn = EaseElasticIn +raylib.Vector2Reflect = Vector2Reflect -/** - * Ease: Elastic Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseElasticOut (t, b, c, d) { - return r.BindEaseElasticOut( - t, - b, - c, - d +function Vector2Min(v1, v2) { + return r.BindVector2Min( + v1.x, + v1.y, + v2.x, + v2.y ) } -raylib.EaseElasticOut = EaseElasticOut +raylib.Vector2Min = Vector2Min -/** - * Ease: Elastic In Out - * - * @param {number} t - * @param {number} b - * @param {number} c - * @param {number} d - * - * @return {number} The resulting float. - */ -function EaseElasticInOut (t, b, c, d) { - return r.BindEaseElasticInOut( - t, - b, - c, - d +function Vector2Max(v1, v2) { + return r.BindVector2Max( + v1.x, + v1.y, + v2.x, + v2.y ) } -raylib.EaseElasticInOut = EaseElasticInOut +raylib.Vector2Max = Vector2Max -function Clamp (value, min, max) { - return r.BindClamp( - value, - min, - max +function Vector2Rotate(v, angle) { + return r.BindVector2Rotate( + v.x, + v.y, + angle ) } -raylib.Clamp = Clamp +raylib.Vector2Rotate = Vector2Rotate -function Lerp (start, end, amount) { - return r.BindLerp( - start, - end, - amount +function Vector2MoveTowards(v, target, maxDistance) { + return r.BindVector2MoveTowards( + v.x, + v.y, + target.x, + target.y, + maxDistance ) } -raylib.Lerp = Lerp +raylib.Vector2MoveTowards = Vector2MoveTowards -function Normalize (value, start, end) { - return r.BindNormalize( - value, - start, - end +function Vector2Invert(v) { + return r.BindVector2Invert( + v.x, + v.y ) } -raylib.Normalize = Normalize +raylib.Vector2Invert = Vector2Invert -function Remap (value, inputStart, inputEnd, outputStart, outputEnd) { - return r.BindRemap( - value, - inputStart, - inputEnd, - outputStart, - outputEnd +function Vector2Clamp(v, min, max) { + return r.BindVector2Clamp( + v.x, + v.y, + min.x, + min.y, + max.x, + max.y ) } -raylib.Remap = Remap +raylib.Vector2Clamp = Vector2Clamp -function Wrap (value, min, max) { - return r.BindWrap( - value, +function Vector2ClampValue(v, min, max) { + return r.BindVector2ClampValue( + v.x, + v.y, min, max ) } -raylib.Wrap = Wrap +raylib.Vector2ClampValue = Vector2ClampValue -function FloatEquals (x, y) { - return r.BindFloatEquals( - x, - y +function Vector2Equals(p, q) { + return r.BindVector2Equals( + p.x, + p.y, + q.x, + q.y + ) +} +raylib.Vector2Equals = Vector2Equals + +function Vector2Refract(v, n, r) { + return r.BindVector2Refract( + v.x, + v.y, + n.x, + n.y, + r ) } -raylib.FloatEquals = FloatEquals +raylib.Vector2Refract = Vector2Refract -function Vector2Zero () { - return r.BindVector2Zero() +function Vector3Zero() { + return r.BindVector3Zero() } -raylib.Vector2Zero = Vector2Zero +raylib.Vector3Zero = Vector3Zero -function Vector2One () { - return r.BindVector2One() +function Vector3One() { + return r.BindVector3One() } -raylib.Vector2One = Vector2One +raylib.Vector3One = Vector3One -function Vector2Add (v1, v2) { - return r.BindVector2Add( +function Vector3Add(v1, v2) { + return r.BindVector3Add( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Add = Vector2Add +raylib.Vector3Add = Vector3Add -function Vector2AddValue (v, add) { - return r.BindVector2AddValue( +function Vector3AddValue(v, add) { + return r.BindVector3AddValue( v.x, v.y, + v.z, add ) } -raylib.Vector2AddValue = Vector2AddValue +raylib.Vector3AddValue = Vector3AddValue -function Vector2Subtract (v1, v2) { - return r.BindVector2Subtract( +function Vector3Subtract(v1, v2) { + return r.BindVector3Subtract( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Subtract = Vector2Subtract +raylib.Vector3Subtract = Vector3Subtract -function Vector2SubtractValue (v, sub) { - return r.BindVector2SubtractValue( +function Vector3SubtractValue(v, sub) { + return r.BindVector3SubtractValue( v.x, v.y, + v.z, sub ) } -raylib.Vector2SubtractValue = Vector2SubtractValue +raylib.Vector3SubtractValue = Vector3SubtractValue -function Vector2Length (v) { - return r.BindVector2Length( +function Vector3Scale(v, scalar) { + return r.BindVector3Scale( v.x, - v.y + v.y, + v.z, + scalar ) } -raylib.Vector2Length = Vector2Length +raylib.Vector3Scale = Vector3Scale -function Vector2LengthSqr (v) { - return r.BindVector2LengthSqr( - v.x, - v.y +function Vector3Multiply(v1, v2) { + return r.BindVector3Multiply( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z ) } -raylib.Vector2LengthSqr = Vector2LengthSqr +raylib.Vector3Multiply = Vector3Multiply -function Vector2DotProduct (v1, v2) { - return r.BindVector2DotProduct( +function Vector3CrossProduct(v1, v2) { + return r.BindVector3CrossProduct( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2DotProduct = Vector2DotProduct +raylib.Vector3CrossProduct = Vector3CrossProduct -function Vector2Distance (v1, v2) { - return r.BindVector2Distance( +function Vector3Perpendicular(v) { + return r.BindVector3Perpendicular( + v.x, + v.y, + v.z + ) +} +raylib.Vector3Perpendicular = Vector3Perpendicular + +function Vector3Length(v) { + return r.BindVector3Length( + v + ) +} +raylib.Vector3Length = Vector3Length + +function Vector3LengthSqr(v) { + return r.BindVector3LengthSqr( + v + ) +} +raylib.Vector3LengthSqr = Vector3LengthSqr + +function Vector3DotProduct(v1, v2) { + return r.BindVector3DotProduct( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Distance = Vector2Distance +raylib.Vector3DotProduct = Vector3DotProduct -function Vector2DistanceSqr (v1, v2) { - return r.BindVector2DistanceSqr( +function Vector3Distance(v1, v2) { + return r.BindVector3Distance( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2DistanceSqr = Vector2DistanceSqr +raylib.Vector3Distance = Vector3Distance -function Vector2Angle (v1, v2) { - return r.BindVector2Angle( +function Vector3DistanceSqr(v1, v2) { + return r.BindVector3DistanceSqr( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Angle = Vector2Angle +raylib.Vector3DistanceSqr = Vector3DistanceSqr -function Vector2LineAngle (start, end) { - return r.BindVector2LineAngle( - start.x, - start.y, - end.x, - end.y +function Vector3Angle(v1, v2) { + return r.BindVector3Angle( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z ) } -raylib.Vector2LineAngle = Vector2LineAngle +raylib.Vector3Angle = Vector3Angle -function Vector2Scale (v, scale) { - return r.BindVector2Scale( +function Vector3Negate(v) { + return r.BindVector3Negate( v.x, v.y, - scale + v.z ) } -raylib.Vector2Scale = Vector2Scale +raylib.Vector3Negate = Vector3Negate -function Vector2Multiply (v1, v2) { - return r.BindVector2Multiply( +function Vector3Divide(v1, v2) { + return r.BindVector3Divide( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Multiply = Vector2Multiply +raylib.Vector3Divide = Vector3Divide -function Vector2Negate (v) { - return r.BindVector2Negate( +function Vector3Normalize(v) { + return r.BindVector3Normalize( v.x, - v.y + v.y, + v.z ) } -raylib.Vector2Negate = Vector2Negate +raylib.Vector3Normalize = Vector3Normalize -function Vector2Divide (v1, v2) { - return r.BindVector2Divide( +function Vector3Project(v1, v2) { + return r.BindVector3Project( v1.x, v1.y, + v1.z, v2.x, - v2.y + v2.y, + v2.z ) } -raylib.Vector2Divide = Vector2Divide +raylib.Vector3Project = Vector3Project -function Vector2Normalize (v) { - return r.BindVector2Normalize( - v.x, - v.y +function Vector3Reject(v1, v2) { + return r.BindVector3Reject( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z ) } -raylib.Vector2Normalize = Vector2Normalize +raylib.Vector3Reject = Vector3Reject -function Vector2Transform (v, mat) { - return r.BindVector2Transform( +function Vector3OrthoNormalize(v1, v2) { + return r.BindVector3OrthoNormalize( + v1, + v2 + ) +} +raylib.Vector3OrthoNormalize = Vector3OrthoNormalize + +function Vector3Transform(v, mat) { + return r.BindVector3Transform( v.x, v.y, + v.z, mat.m0, mat.m4, mat.m8, @@ -9525,503 +11241,495 @@ function Vector2Transform (v, mat) { mat.m15 ) } -raylib.Vector2Transform = Vector2Transform +raylib.Vector3Transform = Vector3Transform -function Vector2Lerp (v1, v2, amount) { - return r.BindVector2Lerp( +function Vector3RotateByQuaternion(v, q) { + return r.BindVector3RotateByQuaternion( + v.x, + v.y, + v.z, + q + ) +} +raylib.Vector3RotateByQuaternion = Vector3RotateByQuaternion + +function Vector3RotateByAxisAngle(v, axis, angle) { + return r.BindVector3RotateByAxisAngle( + v.x, + v.y, + v.z, + axis.x, + axis.y, + axis.z, + angle + ) +} +raylib.Vector3RotateByAxisAngle = Vector3RotateByAxisAngle + +function Vector3MoveTowards(v, target, maxDistance) { + return r.BindVector3MoveTowards( + v.x, + v.y, + v.z, + target.x, + target.y, + target.z, + maxDistance + ) +} +raylib.Vector3MoveTowards = Vector3MoveTowards + +function Vector3Lerp(v1, v2, amount) { + return r.BindVector3Lerp( v1.x, v1.y, + v1.z, v2.x, v2.y, + v2.z, amount ) } -raylib.Vector2Lerp = Vector2Lerp +raylib.Vector3Lerp = Vector3Lerp -function Vector2Reflect (v, normal) { - return r.BindVector2Reflect( +function Vector3CubicHermite(v1, tangent1, v2, tangent2, amount) { + return r.BindVector3CubicHermite( + v1.x, + v1.y, + v1.z, + tangent1.x, + tangent1.y, + tangent1.z, + v2.x, + v2.y, + v2.z, + tangent2.x, + tangent2.y, + tangent2.z, + amount + ) +} +raylib.Vector3CubicHermite = Vector3CubicHermite + +function Vector3Reflect(v, normal) { + return r.BindVector3Reflect( v.x, v.y, + v.z, normal.x, - normal.y + normal.y, + normal.z + ) +} +raylib.Vector3Reflect = Vector3Reflect + +function Vector3Min(v1, v2) { + return r.BindVector3Min( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z + ) +} +raylib.Vector3Min = Vector3Min + +function Vector3Max(v1, v2) { + return r.BindVector3Max( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z + ) +} +raylib.Vector3Max = Vector3Max + +function Vector3Barycenter(p, a, b, c) { + return r.BindVector3Barycenter( + p.x, + p.y, + p.z, + a.x, + a.y, + a.z, + b.x, + b.y, + b.z, + c.x, + c.y, + c.z ) } -raylib.Vector2Reflect = Vector2Reflect +raylib.Vector3Barycenter = Vector3Barycenter -function Vector2Rotate (v, angle) { - return r.BindVector2Rotate( - v.x, - v.y, - angle +function Vector3Unproject(source, projection, view) { + return r.BindVector3Unproject( + source.x, + source.y, + source.z, + projection.m0, + projection.m4, + projection.m8, + projection.m12, + projection.m1, + projection.m5, + projection.m9, + projection.m13, + projection.m2, + projection.m6, + projection.m10, + projection.m14, + projection.m3, + projection.m7, + projection.m11, + projection.m15, + view.m0, + view.m4, + view.m8, + view.m12, + view.m1, + view.m5, + view.m9, + view.m13, + view.m2, + view.m6, + view.m10, + view.m14, + view.m3, + view.m7, + view.m11, + view.m15 ) } -raylib.Vector2Rotate = Vector2Rotate +raylib.Vector3Unproject = Vector3Unproject -function Vector2MoveTowards (v, target, maxDistance) { - return r.BindVector2MoveTowards( +function Vector3Invert(v) { + return r.BindVector3Invert( v.x, v.y, - target.x, - target.y, - maxDistance - ) -} -raylib.Vector2MoveTowards = Vector2MoveTowards - -function Vector2Invert (v) { - return r.BindVector2Invert( - v.x, - v.y + v.z ) } -raylib.Vector2Invert = Vector2Invert +raylib.Vector3Invert = Vector3Invert -function Vector2Clamp (v, min, max) { - return r.BindVector2Clamp( +function Vector3Clamp(v, min, max) { + return r.BindVector3Clamp( v.x, v.y, + v.z, min.x, min.y, + min.z, max.x, - max.y + max.y, + max.z ) } -raylib.Vector2Clamp = Vector2Clamp +raylib.Vector3Clamp = Vector3Clamp -function Vector2ClampValue (v, min, max) { - return r.BindVector2ClampValue( +function Vector3ClampValue(v, min, max) { + return r.BindVector3ClampValue( v.x, v.y, + v.z, min, max ) } -raylib.Vector2ClampValue = Vector2ClampValue +raylib.Vector3ClampValue = Vector3ClampValue -function Vector2Equals (p, q) { - return r.BindVector2Equals( +function Vector3Equals(p, q) { + return r.BindVector3Equals( p.x, p.y, + p.z, q.x, - q.y + q.y, + q.z ) } -raylib.Vector2Equals = Vector2Equals +raylib.Vector3Equals = Vector3Equals -function Vector3Zero () { - return r.BindVector3Zero() +function Vector3Refract(v, n, r) { + return r.BindVector3Refract( + v.x, + v.y, + v.z, + n.x, + n.y, + n.z, + r + ) } -raylib.Vector3Zero = Vector3Zero +raylib.Vector3Refract = Vector3Refract -function Vector3One () { - return r.BindVector3One() +function Vector4Zero() { + return r.BindVector4Zero() } -raylib.Vector3One = Vector3One +raylib.Vector4Zero = Vector4Zero -function Vector3Add (v1, v2) { - return r.BindVector3Add( +function Vector4One() { + return r.BindVector4One() +} +raylib.Vector4One = Vector4One + +function Vector4Add(v1, v2) { + return r.BindVector4Add( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Add = Vector3Add +raylib.Vector4Add = Vector4Add -function Vector3AddValue (v, add) { - return r.BindVector3AddValue( +function Vector4AddValue(v, add) { + return r.BindVector4AddValue( v.x, v.y, v.z, + v.w, add ) } -raylib.Vector3AddValue = Vector3AddValue +raylib.Vector4AddValue = Vector4AddValue -function Vector3Subtract (v1, v2) { - return r.BindVector3Subtract( +function Vector4Subtract(v1, v2) { + return r.BindVector4Subtract( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Subtract = Vector3Subtract +raylib.Vector4Subtract = Vector4Subtract -function Vector3SubtractValue (v, sub) { - return r.BindVector3SubtractValue( +function Vector4SubtractValue(v, add) { + return r.BindVector4SubtractValue( v.x, v.y, v.z, - sub + v.w, + add ) } -raylib.Vector3SubtractValue = Vector3SubtractValue +raylib.Vector4SubtractValue = Vector4SubtractValue -function Vector3Scale (v, scalar) { - return r.BindVector3Scale( +function Vector4Length(v) { + return r.BindVector4Length( v.x, v.y, v.z, - scalar - ) -} -raylib.Vector3Scale = Vector3Scale - -function Vector3Multiply (v1, v2) { - return r.BindVector3Multiply( - v1.x, - v1.y, - v1.z, - v2.x, - v2.y, - v2.z - ) -} -raylib.Vector3Multiply = Vector3Multiply - -function Vector3CrossProduct (v1, v2) { - return r.BindVector3CrossProduct( - v1.x, - v1.y, - v1.z, - v2.x, - v2.y, - v2.z + v.w ) } -raylib.Vector3CrossProduct = Vector3CrossProduct +raylib.Vector4Length = Vector4Length -function Vector3Perpendicular (v) { - return r.BindVector3Perpendicular( +function Vector4LengthSqr(v) { + return r.BindVector4LengthSqr( v.x, v.y, - v.z - ) -} -raylib.Vector3Perpendicular = Vector3Perpendicular - -function Vector3Length (v) { - return r.BindVector3Length( - v - ) -} -raylib.Vector3Length = Vector3Length - -function Vector3LengthSqr (v) { - return r.BindVector3LengthSqr( - v - ) -} -raylib.Vector3LengthSqr = Vector3LengthSqr - -function Vector3DotProduct (v1, v2) { - return r.BindVector3DotProduct( - v1.x, - v1.y, - v1.z, - v2.x, - v2.y, - v2.z + v.z, + v.w ) } -raylib.Vector3DotProduct = Vector3DotProduct +raylib.Vector4LengthSqr = Vector4LengthSqr -function Vector3Distance (v1, v2) { - return r.BindVector3Distance( +function Vector4DotProduct(v1, v2) { + return r.BindVector4DotProduct( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Distance = Vector3Distance +raylib.Vector4DotProduct = Vector4DotProduct -function Vector3DistanceSqr (v1, v2) { - return r.BindVector3DistanceSqr( +function Vector4Distance(v1, v2) { + return r.BindVector4Distance( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3DistanceSqr = Vector3DistanceSqr +raylib.Vector4Distance = Vector4Distance -function Vector3Angle (v1, v2) { - return r.BindVector3Angle( +function Vector4DistanceSqr(v1, v2) { + return r.BindVector4DistanceSqr( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Angle = Vector3Angle +raylib.Vector4DistanceSqr = Vector4DistanceSqr -function Vector3Negate (v) { - return r.BindVector3Negate( +function Vector4Scale(v, scale) { + return r.BindVector4Scale( v.x, v.y, - v.z + v.z, + v.w, + scale ) } -raylib.Vector3Negate = Vector3Negate +raylib.Vector4Scale = Vector4Scale -function Vector3Divide (v1, v2) { - return r.BindVector3Divide( +function Vector4Multiply(v1, v2) { + return r.BindVector4Multiply( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z - ) -} -raylib.Vector3Divide = Vector3Divide - -function Vector3Normalize (v) { - return r.BindVector3Normalize( - v.x, - v.y, - v.z - ) -} -raylib.Vector3Normalize = Vector3Normalize - -function Vector3OrthoNormalize (v1, v2) { - return r.BindVector3OrthoNormalize( - v1, - v2 + v2.z, + v2.w ) } -raylib.Vector3OrthoNormalize = Vector3OrthoNormalize +raylib.Vector4Multiply = Vector4Multiply -function Vector3Transform (v, mat) { - return r.BindVector3Transform( +function Vector4Negate(v) { + return r.BindVector4Negate( v.x, v.y, v.z, - mat.m0, - mat.m4, - mat.m8, - mat.m12, - mat.m1, - mat.m5, - mat.m9, - mat.m13, - mat.m2, - mat.m6, - mat.m10, - mat.m14, - mat.m3, - mat.m7, - mat.m11, - mat.m15 + v.w ) } -raylib.Vector3Transform = Vector3Transform +raylib.Vector4Negate = Vector4Negate -function Vector3RotateByQuaternion (v, q) { - return r.BindVector3RotateByQuaternion( - v.x, - v.y, - v.z, - q +function Vector4Divide(v1, v2) { + return r.BindVector4Divide( + v1.x, + v1.y, + v1.z, + v1.w, + v2.x, + v2.y, + v2.z, + v2.w ) } -raylib.Vector3RotateByQuaternion = Vector3RotateByQuaternion +raylib.Vector4Divide = Vector4Divide -function Vector3RotateByAxisAngle (v, axis, angle) { - return r.BindVector3RotateByAxisAngle( +function Vector4Normalize(v) { + return r.BindVector4Normalize( v.x, v.y, v.z, - axis.x, - axis.y, - axis.z, - angle + v.w ) } -raylib.Vector3RotateByAxisAngle = Vector3RotateByAxisAngle +raylib.Vector4Normalize = Vector4Normalize -function Vector3Lerp (v1, v2, amount) { - return r.BindVector3Lerp( +function Vector4Min(v1, v2) { + return r.BindVector4Min( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, v2.z, - amount - ) -} -raylib.Vector3Lerp = Vector3Lerp - -function Vector3Reflect (v, normal) { - return r.BindVector3Reflect( - v.x, - v.y, - v.z, - normal.x, - normal.y, - normal.z + v2.w ) } -raylib.Vector3Reflect = Vector3Reflect +raylib.Vector4Min = Vector4Min -function Vector3Min (v1, v2) { - return r.BindVector3Min( +function Vector4Max(v1, v2) { + return r.BindVector4Max( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z + v2.z, + v2.w ) } -raylib.Vector3Min = Vector3Min +raylib.Vector4Max = Vector4Max -function Vector3Max (v1, v2) { - return r.BindVector3Max( +function Vector4Lerp(v1, v2, amount) { + return r.BindVector4Lerp( v1.x, v1.y, v1.z, + v1.w, v2.x, v2.y, - v2.z - ) -} -raylib.Vector3Max = Vector3Max - -function Vector3Barycenter (p, a, b, c) { - return r.BindVector3Barycenter( - p.x, - p.y, - p.z, - a.x, - a.y, - a.z, - b.x, - b.y, - b.z, - c.x, - c.y, - c.z - ) -} -raylib.Vector3Barycenter = Vector3Barycenter - -function Vector3Unproject (source, projection, view) { - return r.BindVector3Unproject( - source.x, - source.y, - source.z, - projection.m0, - projection.m4, - projection.m8, - projection.m12, - projection.m1, - projection.m5, - projection.m9, - projection.m13, - projection.m2, - projection.m6, - projection.m10, - projection.m14, - projection.m3, - projection.m7, - projection.m11, - projection.m15, - view.m0, - view.m4, - view.m8, - view.m12, - view.m1, - view.m5, - view.m9, - view.m13, - view.m2, - view.m6, - view.m10, - view.m14, - view.m3, - view.m7, - view.m11, - view.m15 - ) -} -raylib.Vector3Unproject = Vector3Unproject - -function Vector3Invert (v) { - return r.BindVector3Invert( - v.x, - v.y, - v.z + v2.z, + v2.w, + amount ) } -raylib.Vector3Invert = Vector3Invert +raylib.Vector4Lerp = Vector4Lerp -function Vector3Clamp (v, min, max) { - return r.BindVector3Clamp( +function Vector4MoveTowards(v, target, maxDistance) { + return r.BindVector4MoveTowards( v.x, v.y, v.z, - min.x, - min.y, - min.z, - max.x, - max.y, - max.z + v.w, + target.x, + target.y, + target.z, + target.w, + maxDistance ) } -raylib.Vector3Clamp = Vector3Clamp +raylib.Vector4MoveTowards = Vector4MoveTowards -function Vector3ClampValue (v, min, max) { - return r.BindVector3ClampValue( +function Vector4Invert(v) { + return r.BindVector4Invert( v.x, v.y, v.z, - min, - max + v.w ) } -raylib.Vector3ClampValue = Vector3ClampValue +raylib.Vector4Invert = Vector4Invert -function Vector3Equals (p, q) { - return r.BindVector3Equals( +function Vector4Equals(p, q) { + return r.BindVector4Equals( p.x, p.y, p.z, + p.w, q.x, q.y, - q.z - ) -} -raylib.Vector3Equals = Vector3Equals - -function Vector3Refract (v, n, r) { - return r.BindVector3Refract( - v.x, - v.y, - v.z, - n.x, - n.y, - n.z, - r + q.z, + q.w ) } -raylib.Vector3Refract = Vector3Refract +raylib.Vector4Equals = Vector4Equals -function MatrixDeterminant (mat) { +function MatrixDeterminant(mat) { return r.BindMatrixDeterminant( mat.m0, mat.m4, @@ -10043,7 +11751,7 @@ function MatrixDeterminant (mat) { } raylib.MatrixDeterminant = MatrixDeterminant -function MatrixTrace (mat) { +function MatrixTrace(mat) { return r.BindMatrixTrace( mat.m0, mat.m4, @@ -10065,7 +11773,7 @@ function MatrixTrace (mat) { } raylib.MatrixTrace = MatrixTrace -function MatrixTranspose (mat) { +function MatrixTranspose(mat) { return r.BindMatrixTranspose( mat.m0, mat.m4, @@ -10087,7 +11795,7 @@ function MatrixTranspose (mat) { } raylib.MatrixTranspose = MatrixTranspose -function MatrixInvert (mat) { +function MatrixInvert(mat) { return r.BindMatrixInvert( mat.m0, mat.m4, @@ -10109,12 +11817,12 @@ function MatrixInvert (mat) { } raylib.MatrixInvert = MatrixInvert -function MatrixIdentity () { +function MatrixIdentity() { return r.BindMatrixIdentity() } raylib.MatrixIdentity = MatrixIdentity -function MatrixAdd (left, right) { +function MatrixAdd(left, right) { return r.BindMatrixAdd( left.m0, left.m4, @@ -10152,7 +11860,7 @@ function MatrixAdd (left, right) { } raylib.MatrixAdd = MatrixAdd -function MatrixSubtract (left, right) { +function MatrixSubtract(left, right) { return r.BindMatrixSubtract( left.m0, left.m4, @@ -10190,7 +11898,7 @@ function MatrixSubtract (left, right) { } raylib.MatrixSubtract = MatrixSubtract -function MatrixMultiply (left, right) { +function MatrixMultiply(left, right) { return r.BindMatrixMultiply( left.m0, left.m4, @@ -10228,7 +11936,7 @@ function MatrixMultiply (left, right) { } raylib.MatrixMultiply = MatrixMultiply -function MatrixTranslate (x, y, z) { +function MatrixTranslate(x, y, z) { return r.BindMatrixTranslate( x, y, @@ -10237,7 +11945,7 @@ function MatrixTranslate (x, y, z) { } raylib.MatrixTranslate = MatrixTranslate -function MatrixRotate (axis, angle) { +function MatrixRotate(axis, angle) { return r.BindMatrixRotate( axis.x, axis.y, @@ -10247,28 +11955,28 @@ function MatrixRotate (axis, angle) { } raylib.MatrixRotate = MatrixRotate -function MatrixRotateX (angle) { +function MatrixRotateX(angle) { return r.BindMatrixRotateX( angle ) } raylib.MatrixRotateX = MatrixRotateX -function MatrixRotateY (angle) { +function MatrixRotateY(angle) { return r.BindMatrixRotateY( angle ) } raylib.MatrixRotateY = MatrixRotateY -function MatrixRotateZ (angle) { +function MatrixRotateZ(angle) { return r.BindMatrixRotateZ( angle ) } raylib.MatrixRotateZ = MatrixRotateZ -function MatrixRotateXYZ (angle) { +function MatrixRotateXYZ(angle) { return r.BindMatrixRotateXYZ( angle.x, angle.y, @@ -10277,7 +11985,7 @@ function MatrixRotateXYZ (angle) { } raylib.MatrixRotateXYZ = MatrixRotateXYZ -function MatrixRotateZYX (angle) { +function MatrixRotateZYX(angle) { return r.BindMatrixRotateZYX( angle.x, angle.y, @@ -10286,7 +11994,7 @@ function MatrixRotateZYX (angle) { } raylib.MatrixRotateZYX = MatrixRotateZYX -function MatrixScale (x, y, z) { +function MatrixScale(x, y, z) { return r.BindMatrixScale( x, y, @@ -10295,41 +12003,41 @@ function MatrixScale (x, y, z) { } raylib.MatrixScale = MatrixScale -function MatrixFrustum (left, right, bottom, top, near, far) { +function MatrixFrustum(left, right, bottom, top, nearPlane, farPlane) { return r.BindMatrixFrustum( left, right, bottom, top, - near, - far + nearPlane, + farPlane ) } raylib.MatrixFrustum = MatrixFrustum -function MatrixPerspective (fovy, aspect, near, far) { +function MatrixPerspective(fovY, aspect, nearPlane, farPlane) { return r.BindMatrixPerspective( - fovy, + fovY, aspect, - near, - far + nearPlane, + farPlane ) } raylib.MatrixPerspective = MatrixPerspective -function MatrixOrtho (left, right, bottom, top, near, far) { +function MatrixOrtho(left, right, bottom, top, nearPlane, farPlane) { return r.BindMatrixOrtho( left, right, bottom, top, - near, - far + nearPlane, + farPlane ) } raylib.MatrixOrtho = MatrixOrtho -function MatrixLookAt (eye, target, up) { +function MatrixLookAt(eye, target, up) { return r.BindMatrixLookAt( eye.x, eye.y, @@ -10344,7 +12052,7 @@ function MatrixLookAt (eye, target, up) { } raylib.MatrixLookAt = MatrixLookAt -function QuaternionAdd (q1, q2) { +function QuaternionAdd(q1, q2) { return r.BindQuaternionAdd( q1, q2 @@ -10352,7 +12060,7 @@ function QuaternionAdd (q1, q2) { } raylib.QuaternionAdd = QuaternionAdd -function QuaternionAddValue (q, add) { +function QuaternionAddValue(q, add) { return r.BindQuaternionAddValue( q, add @@ -10360,7 +12068,7 @@ function QuaternionAddValue (q, add) { } raylib.QuaternionAddValue = QuaternionAddValue -function QuaternionSubtract (q1, q2) { +function QuaternionSubtract(q1, q2) { return r.BindQuaternionSubtract( q1, q2 @@ -10368,7 +12076,7 @@ function QuaternionSubtract (q1, q2) { } raylib.QuaternionSubtract = QuaternionSubtract -function QuaternionSubtractValue (q, sub) { +function QuaternionSubtractValue(q, sub) { return r.BindQuaternionSubtractValue( q, sub @@ -10376,33 +12084,33 @@ function QuaternionSubtractValue (q, sub) { } raylib.QuaternionSubtractValue = QuaternionSubtractValue -function QuaternionIdentity () { +function QuaternionIdentity() { return r.BindQuaternionIdentity() } raylib.QuaternionIdentity = QuaternionIdentity -function QuaternionLength (q) { +function QuaternionLength(q) { return r.BindQuaternionLength( q ) } raylib.QuaternionLength = QuaternionLength -function QuaternionNormalize (q) { +function QuaternionNormalize(q) { return r.BindQuaternionNormalize( q ) } raylib.QuaternionNormalize = QuaternionNormalize -function QuaternionInvert (q) { +function QuaternionInvert(q) { return r.BindQuaternionInvert( q ) } raylib.QuaternionInvert = QuaternionInvert -function QuaternionMultiply (q1, q2) { +function QuaternionMultiply(q1, q2) { return r.BindQuaternionMultiply( q1, q2 @@ -10410,7 +12118,7 @@ function QuaternionMultiply (q1, q2) { } raylib.QuaternionMultiply = QuaternionMultiply -function QuaternionScale (q, mul) { +function QuaternionScale(q, mul) { return r.BindQuaternionScale( q, mul @@ -10418,7 +12126,7 @@ function QuaternionScale (q, mul) { } raylib.QuaternionScale = QuaternionScale -function QuaternionDivide (q1, q2) { +function QuaternionDivide(q1, q2) { return r.BindQuaternionDivide( q1, q2 @@ -10426,7 +12134,7 @@ function QuaternionDivide (q1, q2) { } raylib.QuaternionDivide = QuaternionDivide -function QuaternionLerp (q1, q2, amount) { +function QuaternionLerp(q1, q2, amount) { return r.BindQuaternionLerp( q1, q2, @@ -10435,7 +12143,7 @@ function QuaternionLerp (q1, q2, amount) { } raylib.QuaternionLerp = QuaternionLerp -function QuaternionNlerp (q1, q2, amount) { +function QuaternionNlerp(q1, q2, amount) { return r.BindQuaternionNlerp( q1, q2, @@ -10444,7 +12152,7 @@ function QuaternionNlerp (q1, q2, amount) { } raylib.QuaternionNlerp = QuaternionNlerp -function QuaternionSlerp (q1, q2, amount) { +function QuaternionSlerp(q1, q2, amount) { return r.BindQuaternionSlerp( q1, q2, @@ -10453,7 +12161,18 @@ function QuaternionSlerp (q1, q2, amount) { } raylib.QuaternionSlerp = QuaternionSlerp -function QuaternionFromVector3ToVector3 (from, to) { +function QuaternionCubicHermiteSpline(q1, outTangent1, q2, inTangent2, t) { + return r.BindQuaternionCubicHermiteSpline( + q1, + outTangent1, + q2, + inTangent2, + t + ) +} +raylib.QuaternionCubicHermiteSpline = QuaternionCubicHermiteSpline + +function QuaternionFromVector3ToVector3(from, to) { return r.BindQuaternionFromVector3ToVector3( from.x, from.y, @@ -10465,7 +12184,7 @@ function QuaternionFromVector3ToVector3 (from, to) { } raylib.QuaternionFromVector3ToVector3 = QuaternionFromVector3ToVector3 -function QuaternionFromMatrix (mat) { +function QuaternionFromMatrix(mat) { return r.BindQuaternionFromMatrix( mat.m0, mat.m4, @@ -10487,14 +12206,14 @@ function QuaternionFromMatrix (mat) { } raylib.QuaternionFromMatrix = QuaternionFromMatrix -function QuaternionToMatrix (q) { +function QuaternionToMatrix(q) { return r.BindQuaternionToMatrix( q ) } raylib.QuaternionToMatrix = QuaternionToMatrix -function QuaternionFromAxisAngle (axis, angle) { +function QuaternionFromAxisAngle(axis, angle) { return r.BindQuaternionFromAxisAngle( axis.x, axis.y, @@ -10504,7 +12223,7 @@ function QuaternionFromAxisAngle (axis, angle) { } raylib.QuaternionFromAxisAngle = QuaternionFromAxisAngle -function QuaternionToAxisAngle (q, outAxis, outAngle) { +function QuaternionToAxisAngle(q, outAxis, outAngle) { return r.BindQuaternionToAxisAngle( q, outAxis, @@ -10513,7 +12232,7 @@ function QuaternionToAxisAngle (q, outAxis, outAngle) { } raylib.QuaternionToAxisAngle = QuaternionToAxisAngle -function QuaternionFromEuler (pitch, yaw, roll) { +function QuaternionFromEuler(pitch, yaw, roll) { return r.BindQuaternionFromEuler( pitch, yaw, @@ -10522,14 +12241,14 @@ function QuaternionFromEuler (pitch, yaw, roll) { } raylib.QuaternionFromEuler = QuaternionFromEuler -function QuaternionToEuler (q) { +function QuaternionToEuler(q) { return r.BindQuaternionToEuler( q ) } raylib.QuaternionToEuler = QuaternionToEuler -function QuaternionTransform (q, mat) { +function QuaternionTransform(q, mat) { return r.BindQuaternionTransform( q, mat.m0, @@ -10552,7 +12271,7 @@ function QuaternionTransform (q, mat) { } raylib.QuaternionTransform = QuaternionTransform -function QuaternionEquals (p, q) { +function QuaternionEquals(p, q) { return r.BindQuaternionEquals( p, q @@ -10560,12 +12279,37 @@ function QuaternionEquals (p, q) { } raylib.QuaternionEquals = QuaternionEquals +function MatrixDecompose(mat, translation, rotation, scale) { + return r.BindMatrixDecompose( + mat.m0, + mat.m4, + mat.m8, + mat.m12, + mat.m1, + mat.m5, + mat.m9, + mat.m13, + mat.m2, + mat.m6, + mat.m10, + mat.m14, + mat.m3, + mat.m7, + mat.m11, + mat.m15, + translation, + rotation, + scale + ) +} +raylib.MatrixDecompose = MatrixDecompose + /** * Enable gui controls (global state) * * @return {undefined} */ -function GuiEnable () { +function GuiEnable() { return r.BindGuiEnable() } raylib.GuiEnable = GuiEnable @@ -10575,7 +12319,7 @@ raylib.GuiEnable = GuiEnable * * @return {undefined} */ -function GuiDisable () { +function GuiDisable() { return r.BindGuiDisable() } raylib.GuiDisable = GuiDisable @@ -10585,7 +12329,7 @@ raylib.GuiDisable = GuiDisable * * @return {undefined} */ -function GuiLock () { +function GuiLock() { return r.BindGuiLock() } raylib.GuiLock = GuiLock @@ -10595,7 +12339,7 @@ raylib.GuiLock = GuiLock * * @return {undefined} */ -function GuiUnlock () { +function GuiUnlock() { return r.BindGuiUnlock() } raylib.GuiUnlock = GuiUnlock @@ -10605,7 +12349,7 @@ raylib.GuiUnlock = GuiUnlock * * @return {boolean} The resulting bool. */ -function GuiIsLocked () { +function GuiIsLocked() { return r.BindGuiIsLocked() } raylib.GuiIsLocked = GuiIsLocked @@ -10617,12 +12361,12 @@ raylib.GuiIsLocked = GuiIsLocked * * @return {undefined} */ -function GuiFade (alpha) { - return r.BindGuiFade( +function GuiSetAlpha(alpha) { + return r.BindGuiSetAlpha( alpha ) } -raylib.GuiFade = GuiFade +raylib.GuiSetAlpha = GuiSetAlpha /** * Set gui state (global state) @@ -10631,7 +12375,7 @@ raylib.GuiFade = GuiFade * * @return {undefined} */ -function GuiSetState (state) { +function GuiSetState(state) { return r.BindGuiSetState( state ) @@ -10643,77 +12387,216 @@ raylib.GuiSetState = GuiSetState * * @return {number} The resulting int. */ -function GuiGetState () { - return r.BindGuiGetState() +function GuiGetState() { + return r.BindGuiGetState() +} +raylib.GuiGetState = GuiGetState + +/** + * Set gui custom font (global state) + * + * @param {Font} font + * + * @return {undefined} + */ +function GuiSetFont(font) { + return r.BindGuiSetFont( + font.baseSize, + font.glyphCount, + font.glyphPadding, + font.texture.id, + font.texture.width, + font.texture.height, + font.texture.mipmaps, + font.texture.format, + font.recs, + font.glyphs + ) +} +raylib.GuiSetFont = GuiSetFont + +/** + * Get gui custom font (global state) + * + * @return {Font} The resulting Font. + */ +function GuiGetFont() { + return r.BindGuiGetFont() +} +raylib.GuiGetFont = GuiGetFont + +/** + * Set one style property + * + * @param {number} control + * @param {number} property + * @param {number} value + * + * @return {undefined} + */ +function GuiSetStyle(control, property, value) { + return r.BindGuiSetStyle( + control, + property, + value + ) +} +raylib.GuiSetStyle = GuiSetStyle + +/** + * Get one style property + * + * @param {number} control + * @param {number} property + * + * @return {number} The resulting int. + */ +function GuiGetStyle(control, property) { + return r.BindGuiGetStyle( + control, + property + ) +} +raylib.GuiGetStyle = GuiGetStyle + +/** + * Load style file over global style variable (.rgs) + * + * @param {string} fileName + * + * @return {undefined} + */ +function GuiLoadStyle(fileName) { + return r.BindGuiLoadStyle( + fileName + ) +} +raylib.GuiLoadStyle = GuiLoadStyle + +/** + * Load style default over global style + * + * @return {undefined} + */ +function GuiLoadStyleDefault() { + return r.BindGuiLoadStyleDefault() +} +raylib.GuiLoadStyleDefault = GuiLoadStyleDefault + +/** + * Enable gui tooltips (global state) + * + * @return {undefined} + */ +function GuiEnableTooltip() { + return r.BindGuiEnableTooltip() +} +raylib.GuiEnableTooltip = GuiEnableTooltip + +/** + * Disable gui tooltips (global state) + * + * @return {undefined} + */ +function GuiDisableTooltip() { + return r.BindGuiDisableTooltip() +} +raylib.GuiDisableTooltip = GuiDisableTooltip + +/** + * Set tooltip string + * + * @param {string} tooltip + * + * @return {undefined} + */ +function GuiSetTooltip(tooltip) { + return r.BindGuiSetTooltip( + tooltip + ) +} +raylib.GuiSetTooltip = GuiSetTooltip + +/** + * Get text with icon id prepended (if supported) + * + * @param {number} iconId + * @param {string} text + * + * @return {string} The resulting const char *. + */ +function GuiIconText(iconId, text) { + return r.BindGuiIconText( + iconId, + text + ) } -raylib.GuiGetState = GuiGetState +raylib.GuiIconText = GuiIconText /** - * Set gui custom font (global state) + * Set default icon drawing size * - * @param {Font} font + * @param {number} scale * * @return {undefined} */ -function GuiSetFont (font) { - return r.BindGuiSetFont( - font.baseSize, - font.glyphCount, - font.glyphPadding, - font.texture.id, - font.texture.width, - font.texture.height, - font.texture.mipmaps, - font.texture.format, - font.recs, - font.glyphs +function GuiSetIconScale(scale) { + return r.BindGuiSetIconScale( + scale ) } -raylib.GuiSetFont = GuiSetFont +raylib.GuiSetIconScale = GuiSetIconScale /** - * Get gui custom font (global state) + * Get raygui icons data pointer * - * @return {Font} The resulting Font. + * @return {number} The resulting unsigned int *. */ -function GuiGetFont () { - return r.BindGuiGetFont() +function GuiGetIcons() { + return r.BindGuiGetIcons() } -raylib.GuiGetFont = GuiGetFont +raylib.GuiGetIcons = GuiGetIcons /** - * Set one style property + * Load raygui icons file (.rgi) into internal icons data * - * @param {number} control - * @param {number} property - * @param {number} value + * @param {string} fileName + * @param {boolean} loadIconsName * - * @return {undefined} + * @return {number} The resulting char **. */ -function GuiSetStyle (control, property, value) { - return r.BindGuiSetStyle( - control, - property, - value +function GuiLoadIcons(fileName, loadIconsName) { + return r.BindGuiLoadIcons( + fileName, + loadIconsName ) } -raylib.GuiSetStyle = GuiSetStyle +raylib.GuiLoadIcons = GuiLoadIcons /** - * Get one style property + * Draw icon using pixel size at specified position * - * @param {number} control - * @param {number} property + * @param {number} iconId + * @param {number} posX + * @param {number} posY + * @param {number} pixelSize + * @param {Color} color * - * @return {number} The resulting int. + * @return {undefined} */ -function GuiGetStyle (control, property) { - return r.BindGuiGetStyle( - control, - property +function GuiDrawIcon(iconId, posX, posY, pixelSize, color) { + return r.BindGuiDrawIcon( + iconId, + posX, + posY, + pixelSize, + color.r, + color.g, + color.b, + color.a ) } -raylib.GuiGetStyle = GuiGetStyle +raylib.GuiDrawIcon = GuiDrawIcon /** * Window Box control, shows a window that can be closed @@ -10721,9 +12604,9 @@ raylib.GuiGetStyle = GuiGetStyle * @param {Rectangle} bounds * @param {string} title * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiWindowBox (bounds, title) { +function GuiWindowBox(bounds, title) { return r.BindGuiWindowBox( bounds.x, bounds.y, @@ -10740,9 +12623,9 @@ raylib.GuiWindowBox = GuiWindowBox * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiGroupBox (bounds, text) { +function GuiGroupBox(bounds, text) { return r.BindGuiGroupBox( bounds.x, bounds.y, @@ -10759,9 +12642,9 @@ raylib.GuiGroupBox = GuiGroupBox * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiLine (bounds, text) { +function GuiLine(bounds, text) { return r.BindGuiLine( bounds.x, bounds.y, @@ -10778,9 +12661,9 @@ raylib.GuiLine = GuiLine * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiPanel (bounds, text) { +function GuiPanel(bounds, text) { return r.BindGuiPanel( bounds.x, bounds.y, @@ -10801,7 +12684,7 @@ raylib.GuiPanel = GuiPanel * * @return {number} The resulting int. */ -function GuiTabBar (bounds, text, count, active) { +function GuiTabBar(bounds, text, count, active) { return r.BindGuiTabBar( bounds.x, bounds.y, @@ -10821,10 +12704,11 @@ raylib.GuiTabBar = GuiTabBar * @param {string} text * @param {Rectangle} content * @param {number} scroll + * @param {number} view * - * @return {Rectangle} The resulting Rectangle. + * @return {number} The resulting int. */ -function GuiScrollPanel (bounds, text, content, scroll) { +function GuiScrollPanel(bounds, text, content, scroll, view) { return r.BindGuiScrollPanel( bounds.x, bounds.y, @@ -10835,20 +12719,21 @@ function GuiScrollPanel (bounds, text, content, scroll) { content.y, content.width, content.height, - scroll + scroll, + view ) } raylib.GuiScrollPanel = GuiScrollPanel /** - * Label control, shows text + * Label control * * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiLabel (bounds, text) { +function GuiLabel(bounds, text) { return r.BindGuiLabel( bounds.x, bounds.y, @@ -10865,9 +12750,9 @@ raylib.GuiLabel = GuiLabel * @param {Rectangle} bounds * @param {string} text * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiButton (bounds, text) { +function GuiButton(bounds, text) { return r.BindGuiButton( bounds.x, bounds.y, @@ -10879,14 +12764,14 @@ function GuiButton (bounds, text) { raylib.GuiButton = GuiButton /** - * Label button control, show true when clicked + * Label button control, returns true when clicked * * @param {Rectangle} bounds * @param {string} text * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiLabelButton (bounds, text) { +function GuiLabelButton(bounds, text) { return r.BindGuiLabelButton( bounds.x, bounds.y, @@ -10898,15 +12783,15 @@ function GuiLabelButton (bounds, text) { raylib.GuiLabelButton = GuiLabelButton /** - * Toggle Button control, returns true when active + * Toggle Button control * * @param {Rectangle} bounds * @param {string} text - * @param {boolean} active + * @param {number} active * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiToggle (bounds, text, active) { +function GuiToggle(bounds, text, active) { return r.BindGuiToggle( bounds.x, bounds.y, @@ -10919,7 +12804,7 @@ function GuiToggle (bounds, text, active) { raylib.GuiToggle = GuiToggle /** - * Toggle Group control, returns active toggle index + * Toggle Group control * * @param {Rectangle} bounds * @param {string} text @@ -10927,7 +12812,7 @@ raylib.GuiToggle = GuiToggle * * @return {number} The resulting int. */ -function GuiToggleGroup (bounds, text, active) { +function GuiToggleGroup(bounds, text, active) { return r.BindGuiToggleGroup( bounds.x, bounds.y, @@ -10939,16 +12824,37 @@ function GuiToggleGroup (bounds, text, active) { } raylib.GuiToggleGroup = GuiToggleGroup +/** + * Toggle Slider control + * + * @param {Rectangle} bounds + * @param {string} text + * @param {number} active + * + * @return {number} The resulting int. + */ +function GuiToggleSlider(bounds, text, active) { + return r.BindGuiToggleSlider( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + active + ) +} +raylib.GuiToggleSlider = GuiToggleSlider + /** * Check Box control, returns true when active * * @param {Rectangle} bounds * @param {string} text - * @param {boolean} checked + * @param {number} checked * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiCheckBox (bounds, text, checked) { +function GuiCheckBox(bounds, text, checked) { return r.BindGuiCheckBox( bounds.x, bounds.y, @@ -10961,7 +12867,7 @@ function GuiCheckBox (bounds, text, checked) { raylib.GuiCheckBox = GuiCheckBox /** - * Combo Box control, returns selected item index + * Combo Box control * * @param {Rectangle} bounds * @param {string} text @@ -10969,7 +12875,7 @@ raylib.GuiCheckBox = GuiCheckBox * * @return {number} The resulting int. */ -function GuiComboBox (bounds, text, active) { +function GuiComboBox(bounds, text, active) { return r.BindGuiComboBox( bounds.x, bounds.y, @@ -10982,16 +12888,16 @@ function GuiComboBox (bounds, text, active) { raylib.GuiComboBox = GuiComboBox /** - * Dropdown Box control, returns selected item + * Dropdown Box control * * @param {Rectangle} bounds * @param {string} text * @param {number} active * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiDropdownBox (bounds, text, active, editMode) { +function GuiDropdownBox(bounds, text, active, editMode) { return r.BindGuiDropdownBox( bounds.x, bounds.y, @@ -11005,7 +12911,7 @@ function GuiDropdownBox (bounds, text, active, editMode) { raylib.GuiDropdownBox = GuiDropdownBox /** - * Spinner control, returns selected value + * Spinner control * * @param {Rectangle} bounds * @param {string} text @@ -11014,9 +12920,9 @@ raylib.GuiDropdownBox = GuiDropdownBox * @param {number} maxValue * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiSpinner (bounds, text, value, minValue, maxValue, editMode) { +function GuiSpinner(bounds, text, value, minValue, maxValue, editMode) { return r.BindGuiSpinner( bounds.x, bounds.y, @@ -11041,9 +12947,9 @@ raylib.GuiSpinner = GuiSpinner * @param {number} maxValue * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiValueBox (bounds, text, value, minValue, maxValue, editMode) { +function GuiValueBox(bounds, text, value, minValue, maxValue, editMode) { return r.BindGuiValueBox( bounds.x, bounds.y, @@ -11059,40 +12965,42 @@ function GuiValueBox (bounds, text, value, minValue, maxValue, editMode) { raylib.GuiValueBox = GuiValueBox /** - * Text Box control, updates input text + * Value box control for float values * * @param {Rectangle} bounds * @param {string} text - * @param {number} textSize + * @param {string} textValue + * @param {number} value * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiTextBox (bounds, text, textSize, editMode) { - return r.BindGuiTextBox( +function GuiValueBoxFloat(bounds, text, textValue, value, editMode) { + return r.BindGuiValueBoxFloat( bounds.x, bounds.y, bounds.width, bounds.height, text, - textSize, + textValue, + value, editMode ) } -raylib.GuiTextBox = GuiTextBox +raylib.GuiValueBoxFloat = GuiValueBoxFloat /** - * Text Box control with multiple lines + * Text Box control, updates input text * * @param {Rectangle} bounds * @param {string} text * @param {number} textSize * @param {boolean} editMode * - * @return {boolean} The resulting bool. + * @return {number} The resulting int. */ -function GuiTextBoxMulti (bounds, text, textSize, editMode) { - return r.BindGuiTextBoxMulti( +function GuiTextBox(bounds, text, textSize, editMode) { + return r.BindGuiTextBox( bounds.x, bounds.y, bounds.width, @@ -11102,10 +13010,10 @@ function GuiTextBoxMulti (bounds, text, textSize, editMode) { editMode ) } -raylib.GuiTextBoxMulti = GuiTextBoxMulti +raylib.GuiTextBox = GuiTextBox /** - * Slider control, returns selected value + * Slider control * * @param {Rectangle} bounds * @param {string} textLeft @@ -11114,9 +13022,9 @@ raylib.GuiTextBoxMulti = GuiTextBoxMulti * @param {number} minValue * @param {number} maxValue * - * @return {number} The resulting float. + * @return {number} The resulting int. */ -function GuiSlider (bounds, textLeft, textRight, value, minValue, maxValue) { +function GuiSlider(bounds, textLeft, textRight, value, minValue, maxValue) { return r.BindGuiSlider( bounds.x, bounds.y, @@ -11132,7 +13040,7 @@ function GuiSlider (bounds, textLeft, textRight, value, minValue, maxValue) { raylib.GuiSlider = GuiSlider /** - * Slider Bar control, returns selected value + * Slider Bar control * * @param {Rectangle} bounds * @param {string} textLeft @@ -11141,9 +13049,9 @@ raylib.GuiSlider = GuiSlider * @param {number} minValue * @param {number} maxValue * - * @return {number} The resulting float. + * @return {number} The resulting int. */ -function GuiSliderBar (bounds, textLeft, textRight, value, minValue, maxValue) { +function GuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue) { return r.BindGuiSliderBar( bounds.x, bounds.y, @@ -11159,7 +13067,7 @@ function GuiSliderBar (bounds, textLeft, textRight, value, minValue, maxValue) { raylib.GuiSliderBar = GuiSliderBar /** - * Progress Bar control, shows current progress value + * Progress Bar control * * @param {Rectangle} bounds * @param {string} textLeft @@ -11168,9 +13076,9 @@ raylib.GuiSliderBar = GuiSliderBar * @param {number} minValue * @param {number} maxValue * - * @return {number} The resulting float. + * @return {number} The resulting int. */ -function GuiProgressBar (bounds, textLeft, textRight, value, minValue, maxValue) { +function GuiProgressBar(bounds, textLeft, textRight, value, minValue, maxValue) { return r.BindGuiProgressBar( bounds.x, bounds.y, @@ -11191,9 +13099,9 @@ raylib.GuiProgressBar = GuiProgressBar * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiStatusBar (bounds, text) { +function GuiStatusBar(bounds, text) { return r.BindGuiStatusBar( bounds.x, bounds.y, @@ -11210,9 +13118,9 @@ raylib.GuiStatusBar = GuiStatusBar * @param {Rectangle} bounds * @param {string} text * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiDummyRec (bounds, text) { +function GuiDummyRec(bounds, text) { return r.BindGuiDummyRec( bounds.x, bounds.y, @@ -11224,16 +13132,17 @@ function GuiDummyRec (bounds, text) { raylib.GuiDummyRec = GuiDummyRec /** - * Grid control, returns mouse cell position + * Grid control * * @param {Rectangle} bounds * @param {string} text * @param {number} spacing * @param {number} subdivs + * @param {number} mouseCell * - * @return {Vector2} The resulting Vector2. + * @return {number} The resulting int. */ -function GuiGrid (bounds, text, spacing, subdivs) { +function GuiGrid(bounds, text, spacing, subdivs, mouseCell) { return r.BindGuiGrid( bounds.x, bounds.y, @@ -11241,13 +13150,14 @@ function GuiGrid (bounds, text, spacing, subdivs) { bounds.height, text, spacing, - subdivs + subdivs, + mouseCell ) } raylib.GuiGrid = GuiGrid /** - * List View control, returns selected list item index + * List View control * * @param {Rectangle} bounds * @param {string} text @@ -11256,7 +13166,7 @@ raylib.GuiGrid = GuiGrid * * @return {number} The resulting int. */ -function GuiListView (bounds, text, scrollIndex, active) { +function GuiListView(bounds, text, scrollIndex, active) { return r.BindGuiListView( bounds.x, bounds.y, @@ -11275,13 +13185,13 @@ raylib.GuiListView = GuiListView * @param {Rectangle} bounds * @param {number} text * @param {number} count - * @param {number} focus * @param {number} scrollIndex * @param {number} active + * @param {number} focus * * @return {number} The resulting int. */ -function GuiListViewEx (bounds, text, count, focus, scrollIndex, active) { +function GuiListViewEx(bounds, text, count, scrollIndex, active, focus) { return r.BindGuiListViewEx( bounds.x, bounds.y, @@ -11289,9 +13199,9 @@ function GuiListViewEx (bounds, text, count, focus, scrollIndex, active) { bounds.height, text, count, - focus, scrollIndex, - active + active, + focus ) } raylib.GuiListViewEx = GuiListViewEx @@ -11306,7 +13216,7 @@ raylib.GuiListViewEx = GuiListViewEx * * @return {number} The resulting int. */ -function GuiMessageBox (bounds, title, message, buttons) { +function GuiMessageBox(bounds, title, message, buttons) { return r.BindGuiMessageBox( bounds.x, bounds.y, @@ -11332,7 +13242,7 @@ raylib.GuiMessageBox = GuiMessageBox * * @return {number} The resulting int. */ -function GuiTextInputBox (bounds, title, message, buttons, text, textMaxSize, secretViewActive) { +function GuiTextInputBox(bounds, title, message, buttons, text, textMaxSize, secretViewActive) { return r.BindGuiTextInputBox( bounds.x, bounds.y, @@ -11353,21 +13263,18 @@ raylib.GuiTextInputBox = GuiTextInputBox * * @param {Rectangle} bounds * @param {string} text - * @param {Color} color + * @param {number} color * - * @return {Color} The resulting Color. + * @return {number} The resulting int. */ -function GuiColorPicker (bounds, text, color) { +function GuiColorPicker(bounds, text, color) { return r.BindGuiColorPicker( bounds.x, bounds.y, bounds.width, bounds.height, text, - color.r, - color.g, - color.b, - color.a + color ) } raylib.GuiColorPicker = GuiColorPicker @@ -11377,21 +13284,18 @@ raylib.GuiColorPicker = GuiColorPicker * * @param {Rectangle} bounds * @param {string} text - * @param {Color} color + * @param {number} color * - * @return {Color} The resulting Color. + * @return {number} The resulting int. */ -function GuiColorPanel (bounds, text, color) { +function GuiColorPanel(bounds, text, color) { return r.BindGuiColorPanel( bounds.x, bounds.y, bounds.width, bounds.height, text, - color.r, - color.g, - color.b, - color.a + color ) } raylib.GuiColorPanel = GuiColorPanel @@ -11399,172 +13303,86 @@ raylib.GuiColorPanel = GuiColorPanel /** * Color Bar Alpha control * - * @param {Rectangle} bounds - * @param {string} text - * @param {number} alpha - * - * @return {number} The resulting float. - */ -function GuiColorBarAlpha (bounds, text, alpha) { - return r.BindGuiColorBarAlpha( - bounds.x, - bounds.y, - bounds.width, - bounds.height, - text, - alpha - ) -} -raylib.GuiColorBarAlpha = GuiColorBarAlpha - -/** - * Color Bar Hue control - * - * @param {Rectangle} bounds - * @param {string} text - * @param {number} value - * - * @return {number} The resulting float. - */ -function GuiColorBarHue (bounds, text, value) { - return r.BindGuiColorBarHue( - bounds.x, - bounds.y, - bounds.width, - bounds.height, - text, - value - ) -} -raylib.GuiColorBarHue = GuiColorBarHue - -/** - * Load style file over global style variable (.rgs) - * - * @param {string} fileName - * - * @return {undefined} - */ -function GuiLoadStyle (fileName) { - return r.BindGuiLoadStyle( - fileName - ) -} -raylib.GuiLoadStyle = GuiLoadStyle - -/** - * Load style default over global style - * - * @return {undefined} - */ -function GuiLoadStyleDefault () { - return r.BindGuiLoadStyleDefault() -} -raylib.GuiLoadStyleDefault = GuiLoadStyleDefault - -/** - * Enable gui tooltips (global state) - * - * @return {undefined} - */ -function GuiEnableTooltip () { - return r.BindGuiEnableTooltip() -} -raylib.GuiEnableTooltip = GuiEnableTooltip - -/** - * Disable gui tooltips (global state) - * - * @return {undefined} - */ -function GuiDisableTooltip () { - return r.BindGuiDisableTooltip() -} -raylib.GuiDisableTooltip = GuiDisableTooltip - -/** - * Set tooltip string - * - * @param {string} tooltip - * - * @return {undefined} - */ -function GuiSetTooltip (tooltip) { - return r.BindGuiSetTooltip( - tooltip - ) -} -raylib.GuiSetTooltip = GuiSetTooltip - -/** - * Get text with icon id prepended (if supported) - * - * @param {number} iconId + * @param {Rectangle} bounds * @param {string} text + * @param {number} alpha * - * @return {string} The resulting const char *. + * @return {number} The resulting int. */ -function GuiIconText (iconId, text) { - return r.BindGuiIconText( - iconId, - text +function GuiColorBarAlpha(bounds, text, alpha) { + return r.BindGuiColorBarAlpha( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + alpha ) } -raylib.GuiIconText = GuiIconText +raylib.GuiColorBarAlpha = GuiColorBarAlpha /** - * Get raygui icons data pointer + * Color Bar Hue control * - * @return {number} The resulting unsigned int *. + * @param {Rectangle} bounds + * @param {string} text + * @param {number} value + * + * @return {number} The resulting int. */ -function GuiGetIcons () { - return r.BindGuiGetIcons() +function GuiColorBarHue(bounds, text, value) { + return r.BindGuiColorBarHue( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + value + ) } -raylib.GuiGetIcons = GuiGetIcons +raylib.GuiColorBarHue = GuiColorBarHue /** - * Load raygui icons file (.rgi) into internal icons data + * Color Picker control that avoids conversion to RGB on each call (multiple color controls) * - * @param {string} fileName - * @param {boolean} loadIconsName + * @param {Rectangle} bounds + * @param {string} text + * @param {number} colorHsv * - * @return {number} The resulting char **. + * @return {number} The resulting int. */ -function GuiLoadIcons (fileName, loadIconsName) { - return r.BindGuiLoadIcons( - fileName, - loadIconsName - ) -} -raylib.GuiLoadIcons = GuiLoadIcons - -function GuiDrawIcon (iconId, posX, posY, pixelSize, color) { - return r.BindGuiDrawIcon( - iconId, - posX, - posY, - pixelSize, - color.r, - color.g, - color.b, - color.a +function GuiColorPickerHSV(bounds, text, colorHsv) { + return r.BindGuiColorPickerHSV( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + colorHsv ) } -raylib.GuiDrawIcon = GuiDrawIcon +raylib.GuiColorPickerHSV = GuiColorPickerHSV /** - * Set icon drawing size + * Color Panel control that updates Hue-Saturation-Value color value, used by GuiColorPickerHSV() * - * @param {number} scale + * @param {Rectangle} bounds + * @param {string} text + * @param {number} colorHsv * - * @return {undefined} + * @return {number} The resulting int. */ -function GuiSetIconScale (scale) { - return r.BindGuiSetIconScale( - scale +function GuiColorPanelHSV(bounds, text, colorHsv) { + return r.BindGuiColorPanelHSV( + bounds.x, + bounds.y, + bounds.width, + bounds.height, + text, + colorHsv ) } -raylib.GuiSetIconScale = GuiSetIconScale +raylib.GuiColorPanelHSV = GuiColorPanelHSV /** * Choose the current matrix to be transformed @@ -11573,7 +13391,7 @@ raylib.GuiSetIconScale = GuiSetIconScale * * @return {undefined} */ -function rlMatrixMode (mode) { +function rlMatrixMode(mode) { return r.BindrlMatrixMode( mode ) @@ -11585,7 +13403,7 @@ raylib.rlMatrixMode = rlMatrixMode * * @return {undefined} */ -function rlPushMatrix () { +function rlPushMatrix() { return r.BindrlPushMatrix() } raylib.rlPushMatrix = rlPushMatrix @@ -11595,7 +13413,7 @@ raylib.rlPushMatrix = rlPushMatrix * * @return {undefined} */ -function rlPopMatrix () { +function rlPopMatrix() { return r.BindrlPopMatrix() } raylib.rlPopMatrix = rlPopMatrix @@ -11605,7 +13423,7 @@ raylib.rlPopMatrix = rlPopMatrix * * @return {undefined} */ -function rlLoadIdentity () { +function rlLoadIdentity() { return r.BindrlLoadIdentity() } raylib.rlLoadIdentity = rlLoadIdentity @@ -11619,7 +13437,7 @@ raylib.rlLoadIdentity = rlLoadIdentity * * @return {undefined} */ -function rlTranslatef (x, y, z) { +function rlTranslatef(x, y, z) { return r.BindrlTranslatef( x, y, @@ -11638,7 +13456,7 @@ raylib.rlTranslatef = rlTranslatef * * @return {undefined} */ -function rlRotatef (angle, x, y, z) { +function rlRotatef(angle, x, y, z) { return r.BindrlRotatef( angle, x, @@ -11657,7 +13475,7 @@ raylib.rlRotatef = rlRotatef * * @return {undefined} */ -function rlScalef (x, y, z) { +function rlScalef(x, y, z) { return r.BindrlScalef( x, y, @@ -11673,14 +13491,14 @@ raylib.rlScalef = rlScalef * * @return {undefined} */ -function rlMultMatrixf (matf) { +function rlMultMatrixf(matf) { return r.BindrlMultMatrixf( matf ) } raylib.rlMultMatrixf = rlMultMatrixf -function rlFrustum (left, right, bottom, top, znear, zfar) { +function rlFrustum(left, right, bottom, top, znear, zfar) { return r.BindrlFrustum( left, right, @@ -11692,7 +13510,7 @@ function rlFrustum (left, right, bottom, top, znear, zfar) { } raylib.rlFrustum = rlFrustum -function rlOrtho (left, right, bottom, top, znear, zfar) { +function rlOrtho(left, right, bottom, top, znear, zfar) { return r.BindrlOrtho( left, right, @@ -11714,7 +13532,7 @@ raylib.rlOrtho = rlOrtho * * @return {undefined} */ -function rlViewport (x, y, width, height) { +function rlViewport(x, y, width, height) { return r.BindrlViewport( x, y, @@ -11724,6 +13542,42 @@ function rlViewport (x, y, width, height) { } raylib.rlViewport = rlViewport +/** + * Set clip planes distances + * + * @param {number} nearPlane + * @param {number} farPlane + * + * @return {undefined} + */ +function rlSetClipPlanes(nearPlane, farPlane) { + return r.BindrlSetClipPlanes( + nearPlane, + farPlane + ) +} +raylib.rlSetClipPlanes = rlSetClipPlanes + +/** + * Get cull plane distance near + * + * @return {number} The resulting double. + */ +function rlGetCullDistanceNear() { + return r.BindrlGetCullDistanceNear() +} +raylib.rlGetCullDistanceNear = rlGetCullDistanceNear + +/** + * Get cull plane distance far + * + * @return {number} The resulting double. + */ +function rlGetCullDistanceFar() { + return r.BindrlGetCullDistanceFar() +} +raylib.rlGetCullDistanceFar = rlGetCullDistanceFar + /** * Initialize drawing mode (how to organize vertex) * @@ -11731,7 +13585,7 @@ raylib.rlViewport = rlViewport * * @return {undefined} */ -function rlBegin (mode) { +function rlBegin(mode) { return r.BindrlBegin( mode ) @@ -11743,7 +13597,7 @@ raylib.rlBegin = rlBegin * * @return {undefined} */ -function rlEnd () { +function rlEnd() { return r.BindrlEnd() } raylib.rlEnd = rlEnd @@ -11756,7 +13610,7 @@ raylib.rlEnd = rlEnd * * @return {undefined} */ -function rlVertex2i (x, y) { +function rlVertex2i(x, y) { return r.BindrlVertex2i( x, y @@ -11772,7 +13626,7 @@ raylib.rlVertex2i = rlVertex2i * * @return {undefined} */ -function rlVertex2f (x, y) { +function rlVertex2f(x, y) { return r.BindrlVertex2f( x, y @@ -11789,7 +13643,7 @@ raylib.rlVertex2f = rlVertex2f * * @return {undefined} */ -function rlVertex3f (x, y, z) { +function rlVertex3f(x, y, z) { return r.BindrlVertex3f( x, y, @@ -11806,7 +13660,7 @@ raylib.rlVertex3f = rlVertex3f * * @return {undefined} */ -function rlTexCoord2f (x, y) { +function rlTexCoord2f(x, y) { return r.BindrlTexCoord2f( x, y @@ -11823,7 +13677,7 @@ raylib.rlTexCoord2f = rlTexCoord2f * * @return {undefined} */ -function rlNormal3f (x, y, z) { +function rlNormal3f(x, y, z) { return r.BindrlNormal3f( x, y, @@ -11842,7 +13696,7 @@ raylib.rlNormal3f = rlNormal3f * * @return {undefined} */ -function rlColor4ub (r, g, b, a) { +function rlColor4ub(r, g, b, a) { return r.BindrlColor4ub( r, g, @@ -11861,7 +13715,7 @@ raylib.rlColor4ub = rlColor4ub * * @return {undefined} */ -function rlColor3f (x, y, z) { +function rlColor3f(x, y, z) { return r.BindrlColor3f( x, y, @@ -11880,7 +13734,7 @@ raylib.rlColor3f = rlColor3f * * @return {undefined} */ -function rlColor4f (x, y, z, w) { +function rlColor4f(x, y, z, w) { return r.BindrlColor4f( x, y, @@ -11897,7 +13751,7 @@ raylib.rlColor4f = rlColor4f * * @return {boolean} The resulting bool. */ -function rlEnableVertexArray (vaoId) { +function rlEnableVertexArray(vaoId) { return r.BindrlEnableVertexArray( vaoId ) @@ -11909,7 +13763,7 @@ raylib.rlEnableVertexArray = rlEnableVertexArray * * @return {undefined} */ -function rlDisableVertexArray () { +function rlDisableVertexArray() { return r.BindrlDisableVertexArray() } raylib.rlDisableVertexArray = rlDisableVertexArray @@ -11921,7 +13775,7 @@ raylib.rlDisableVertexArray = rlDisableVertexArray * * @return {undefined} */ -function rlEnableVertexBuffer (id) { +function rlEnableVertexBuffer(id) { return r.BindrlEnableVertexBuffer( id ) @@ -11933,7 +13787,7 @@ raylib.rlEnableVertexBuffer = rlEnableVertexBuffer * * @return {undefined} */ -function rlDisableVertexBuffer () { +function rlDisableVertexBuffer() { return r.BindrlDisableVertexBuffer() } raylib.rlDisableVertexBuffer = rlDisableVertexBuffer @@ -11945,7 +13799,7 @@ raylib.rlDisableVertexBuffer = rlDisableVertexBuffer * * @return {undefined} */ -function rlEnableVertexBufferElement (id) { +function rlEnableVertexBufferElement(id) { return r.BindrlEnableVertexBufferElement( id ) @@ -11957,7 +13811,7 @@ raylib.rlEnableVertexBufferElement = rlEnableVertexBufferElement * * @return {undefined} */ -function rlDisableVertexBufferElement () { +function rlDisableVertexBufferElement() { return r.BindrlDisableVertexBufferElement() } raylib.rlDisableVertexBufferElement = rlDisableVertexBufferElement @@ -11969,7 +13823,7 @@ raylib.rlDisableVertexBufferElement = rlDisableVertexBufferElement * * @return {undefined} */ -function rlEnableVertexAttribute (index) { +function rlEnableVertexAttribute(index) { return r.BindrlEnableVertexAttribute( index ) @@ -11983,7 +13837,7 @@ raylib.rlEnableVertexAttribute = rlEnableVertexAttribute * * @return {undefined} */ -function rlDisableVertexAttribute (index) { +function rlDisableVertexAttribute(index) { return r.BindrlDisableVertexAttribute( index ) @@ -11997,7 +13851,7 @@ raylib.rlDisableVertexAttribute = rlDisableVertexAttribute * * @return {undefined} */ -function rlActiveTextureSlot (slot) { +function rlActiveTextureSlot(slot) { return r.BindrlActiveTextureSlot( slot ) @@ -12011,7 +13865,7 @@ raylib.rlActiveTextureSlot = rlActiveTextureSlot * * @return {undefined} */ -function rlEnableTexture (id) { +function rlEnableTexture(id) { return r.BindrlEnableTexture( id ) @@ -12023,7 +13877,7 @@ raylib.rlEnableTexture = rlEnableTexture * * @return {undefined} */ -function rlDisableTexture () { +function rlDisableTexture() { return r.BindrlDisableTexture() } raylib.rlDisableTexture = rlDisableTexture @@ -12035,7 +13889,7 @@ raylib.rlDisableTexture = rlDisableTexture * * @return {undefined} */ -function rlEnableTextureCubemap (id) { +function rlEnableTextureCubemap(id) { return r.BindrlEnableTextureCubemap( id ) @@ -12047,7 +13901,7 @@ raylib.rlEnableTextureCubemap = rlEnableTextureCubemap * * @return {undefined} */ -function rlDisableTextureCubemap () { +function rlDisableTextureCubemap() { return r.BindrlDisableTextureCubemap() } raylib.rlDisableTextureCubemap = rlDisableTextureCubemap @@ -12061,7 +13915,7 @@ raylib.rlDisableTextureCubemap = rlDisableTextureCubemap * * @return {undefined} */ -function rlTextureParameters (id, param, value) { +function rlTextureParameters(id, param, value) { return r.BindrlTextureParameters( id, param, @@ -12079,7 +13933,7 @@ raylib.rlTextureParameters = rlTextureParameters * * @return {undefined} */ -function rlCubemapParameters (id, param, value) { +function rlCubemapParameters(id, param, value) { return r.BindrlCubemapParameters( id, param, @@ -12095,7 +13949,7 @@ raylib.rlCubemapParameters = rlCubemapParameters * * @return {undefined} */ -function rlEnableShader (id) { +function rlEnableShader(id) { return r.BindrlEnableShader( id ) @@ -12107,7 +13961,7 @@ raylib.rlEnableShader = rlEnableShader * * @return {undefined} */ -function rlDisableShader () { +function rlDisableShader() { return r.BindrlDisableShader() } raylib.rlDisableShader = rlDisableShader @@ -12119,7 +13973,7 @@ raylib.rlDisableShader = rlDisableShader * * @return {undefined} */ -function rlEnableFramebuffer (id) { +function rlEnableFramebuffer(id) { return r.BindrlEnableFramebuffer( id ) @@ -12131,11 +13985,21 @@ raylib.rlEnableFramebuffer = rlEnableFramebuffer * * @return {undefined} */ -function rlDisableFramebuffer () { +function rlDisableFramebuffer() { return r.BindrlDisableFramebuffer() } raylib.rlDisableFramebuffer = rlDisableFramebuffer +/** + * Get the currently active render texture (fbo), 0 for default framebuffer + * + * @return {number} The resulting unsigned int. + */ +function rlGetActiveFramebuffer() { + return r.BindrlGetActiveFramebuffer() +} +raylib.rlGetActiveFramebuffer = rlGetActiveFramebuffer + /** * Activate multiple draw color buffers * @@ -12143,19 +14007,65 @@ raylib.rlDisableFramebuffer = rlDisableFramebuffer * * @return {undefined} */ -function rlActiveDrawBuffers (count) { +function rlActiveDrawBuffers(count) { return r.BindrlActiveDrawBuffers( count ) } raylib.rlActiveDrawBuffers = rlActiveDrawBuffers +/** + * Blit active framebuffer to main framebuffer + * + * @param {number} srcX + * @param {number} srcY + * @param {number} srcWidth + * @param {number} srcHeight + * @param {number} dstX + * @param {number} dstY + * @param {number} dstWidth + * @param {number} dstHeight + * @param {number} bufferMask + * + * @return {undefined} + */ +function rlBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask) { + return r.BindrlBlitFramebuffer( + srcX, + srcY, + srcWidth, + srcHeight, + dstX, + dstY, + dstWidth, + dstHeight, + bufferMask + ) +} +raylib.rlBlitFramebuffer = rlBlitFramebuffer + +/** + * Bind framebuffer (FBO) + * + * @param {number} target + * @param {number} framebuffer + * + * @return {undefined} + */ +function rlBindFramebuffer(target, framebuffer) { + return r.BindrlBindFramebuffer( + target, + framebuffer + ) +} +raylib.rlBindFramebuffer = rlBindFramebuffer + /** * Enable color blending * * @return {undefined} */ -function rlEnableColorBlend () { +function rlEnableColorBlend() { return r.BindrlEnableColorBlend() } raylib.rlEnableColorBlend = rlEnableColorBlend @@ -12165,7 +14075,7 @@ raylib.rlEnableColorBlend = rlEnableColorBlend * * @return {undefined} */ -function rlDisableColorBlend () { +function rlDisableColorBlend() { return r.BindrlDisableColorBlend() } raylib.rlDisableColorBlend = rlDisableColorBlend @@ -12175,7 +14085,7 @@ raylib.rlDisableColorBlend = rlDisableColorBlend * * @return {undefined} */ -function rlEnableDepthTest () { +function rlEnableDepthTest() { return r.BindrlEnableDepthTest() } raylib.rlEnableDepthTest = rlEnableDepthTest @@ -12185,7 +14095,7 @@ raylib.rlEnableDepthTest = rlEnableDepthTest * * @return {undefined} */ -function rlDisableDepthTest () { +function rlDisableDepthTest() { return r.BindrlDisableDepthTest() } raylib.rlDisableDepthTest = rlDisableDepthTest @@ -12195,7 +14105,7 @@ raylib.rlDisableDepthTest = rlDisableDepthTest * * @return {undefined} */ -function rlEnableDepthMask () { +function rlEnableDepthMask() { return r.BindrlEnableDepthMask() } raylib.rlEnableDepthMask = rlEnableDepthMask @@ -12205,7 +14115,7 @@ raylib.rlEnableDepthMask = rlEnableDepthMask * * @return {undefined} */ -function rlDisableDepthMask () { +function rlDisableDepthMask() { return r.BindrlDisableDepthMask() } raylib.rlDisableDepthMask = rlDisableDepthMask @@ -12215,7 +14125,7 @@ raylib.rlDisableDepthMask = rlDisableDepthMask * * @return {undefined} */ -function rlEnableBackfaceCulling () { +function rlEnableBackfaceCulling() { return r.BindrlEnableBackfaceCulling() } raylib.rlEnableBackfaceCulling = rlEnableBackfaceCulling @@ -12225,11 +14135,31 @@ raylib.rlEnableBackfaceCulling = rlEnableBackfaceCulling * * @return {undefined} */ -function rlDisableBackfaceCulling () { +function rlDisableBackfaceCulling() { return r.BindrlDisableBackfaceCulling() } raylib.rlDisableBackfaceCulling = rlDisableBackfaceCulling +/** + * Color mask control + * + * @param {boolean} r + * @param {boolean} g + * @param {boolean} b + * @param {boolean} a + * + * @return {undefined} + */ +function rlColorMask(r, g, b, a) { + return r.BindrlColorMask( + r, + g, + b, + a + ) +} +raylib.rlColorMask = rlColorMask + /** * Set face culling mode * @@ -12237,7 +14167,7 @@ raylib.rlDisableBackfaceCulling = rlDisableBackfaceCulling * * @return {undefined} */ -function rlSetCullFace (mode) { +function rlSetCullFace(mode) { return r.BindrlSetCullFace( mode ) @@ -12249,7 +14179,7 @@ raylib.rlSetCullFace = rlSetCullFace * * @return {undefined} */ -function rlEnableScissorTest () { +function rlEnableScissorTest() { return r.BindrlEnableScissorTest() } raylib.rlEnableScissorTest = rlEnableScissorTest @@ -12259,7 +14189,7 @@ raylib.rlEnableScissorTest = rlEnableScissorTest * * @return {undefined} */ -function rlDisableScissorTest () { +function rlDisableScissorTest() { return r.BindrlDisableScissorTest() } raylib.rlDisableScissorTest = rlDisableScissorTest @@ -12274,7 +14204,7 @@ raylib.rlDisableScissorTest = rlDisableScissorTest * * @return {undefined} */ -function rlScissor (x, y, width, height) { +function rlScissor(x, y, width, height) { return r.BindrlScissor( x, y, @@ -12289,17 +14219,27 @@ raylib.rlScissor = rlScissor * * @return {undefined} */ -function rlEnableWireMode () { +function rlEnableWireMode() { return r.BindrlEnableWireMode() } raylib.rlEnableWireMode = rlEnableWireMode /** - * Disable wire mode + * Enable point mode + * + * @return {undefined} + */ +function rlEnablePointMode() { + return r.BindrlEnablePointMode() +} +raylib.rlEnablePointMode = rlEnablePointMode + +/** + * Disable wire (and point) mode * * @return {undefined} */ -function rlDisableWireMode () { +function rlDisableWireMode() { return r.BindrlDisableWireMode() } raylib.rlDisableWireMode = rlDisableWireMode @@ -12311,7 +14251,7 @@ raylib.rlDisableWireMode = rlDisableWireMode * * @return {undefined} */ -function rlSetLineWidth (width) { +function rlSetLineWidth(width) { return r.BindrlSetLineWidth( width ) @@ -12323,7 +14263,7 @@ raylib.rlSetLineWidth = rlSetLineWidth * * @return {number} The resulting float. */ -function rlGetLineWidth () { +function rlGetLineWidth() { return r.BindrlGetLineWidth() } raylib.rlGetLineWidth = rlGetLineWidth @@ -12333,7 +14273,7 @@ raylib.rlGetLineWidth = rlGetLineWidth * * @return {undefined} */ -function rlEnableSmoothLines () { +function rlEnableSmoothLines() { return r.BindrlEnableSmoothLines() } raylib.rlEnableSmoothLines = rlEnableSmoothLines @@ -12343,7 +14283,7 @@ raylib.rlEnableSmoothLines = rlEnableSmoothLines * * @return {undefined} */ -function rlDisableSmoothLines () { +function rlDisableSmoothLines() { return r.BindrlDisableSmoothLines() } raylib.rlDisableSmoothLines = rlDisableSmoothLines @@ -12353,7 +14293,7 @@ raylib.rlDisableSmoothLines = rlDisableSmoothLines * * @return {undefined} */ -function rlEnableStereoRender () { +function rlEnableStereoRender() { return r.BindrlEnableStereoRender() } raylib.rlEnableStereoRender = rlEnableStereoRender @@ -12363,7 +14303,7 @@ raylib.rlEnableStereoRender = rlEnableStereoRender * * @return {undefined} */ -function rlDisableStereoRender () { +function rlDisableStereoRender() { return r.BindrlDisableStereoRender() } raylib.rlDisableStereoRender = rlDisableStereoRender @@ -12373,7 +14313,7 @@ raylib.rlDisableStereoRender = rlDisableStereoRender * * @return {boolean} The resulting bool. */ -function rlIsStereoRenderEnabled () { +function rlIsStereoRenderEnabled() { return r.BindrlIsStereoRenderEnabled() } raylib.rlIsStereoRenderEnabled = rlIsStereoRenderEnabled @@ -12388,7 +14328,7 @@ raylib.rlIsStereoRenderEnabled = rlIsStereoRenderEnabled * * @return {undefined} */ -function rlClearColor (r, g, b, a) { +function rlClearColor(r, g, b, a) { return r.BindrlClearColor( r, g, @@ -12403,7 +14343,7 @@ raylib.rlClearColor = rlClearColor * * @return {undefined} */ -function rlClearScreenBuffers () { +function rlClearScreenBuffers() { return r.BindrlClearScreenBuffers() } raylib.rlClearScreenBuffers = rlClearScreenBuffers @@ -12413,7 +14353,7 @@ raylib.rlClearScreenBuffers = rlClearScreenBuffers * * @return {undefined} */ -function rlCheckErrors () { +function rlCheckErrors() { return r.BindrlCheckErrors() } raylib.rlCheckErrors = rlCheckErrors @@ -12425,7 +14365,7 @@ raylib.rlCheckErrors = rlCheckErrors * * @return {undefined} */ -function rlSetBlendMode (mode) { +function rlSetBlendMode(mode) { return r.BindrlSetBlendMode( mode ) @@ -12441,7 +14381,7 @@ raylib.rlSetBlendMode = rlSetBlendMode * * @return {undefined} */ -function rlSetBlendFactors (glSrcFactor, glDstFactor, glEquation) { +function rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation) { return r.BindrlSetBlendFactors( glSrcFactor, glDstFactor, @@ -12462,7 +14402,7 @@ raylib.rlSetBlendFactors = rlSetBlendFactors * * @return {undefined} */ -function rlSetBlendFactorsSeparate (glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha) { +function rlSetBlendFactorsSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha) { return r.BindrlSetBlendFactorsSeparate( glSrcRGB, glDstRGB, @@ -12482,7 +14422,7 @@ raylib.rlSetBlendFactorsSeparate = rlSetBlendFactorsSeparate * * @return {undefined} */ -function rlglInit (width, height) { +function rlglInit(width, height) { return r.BindrlglInit( width, height @@ -12495,7 +14435,7 @@ raylib.rlglInit = rlglInit * * @return {undefined} */ -function rlglClose () { +function rlglClose() { return r.BindrlglClose() } raylib.rlglClose = rlglClose @@ -12507,7 +14447,7 @@ raylib.rlglClose = rlglClose * * @return {undefined} */ -function rlLoadExtensions (loader) { +function rlLoadExtensions(loader) { return r.BindrlLoadExtensions( loader ) @@ -12519,7 +14459,7 @@ raylib.rlLoadExtensions = rlLoadExtensions * * @return {number} The resulting int. */ -function rlGetVersion () { +function rlGetVersion() { return r.BindrlGetVersion() } raylib.rlGetVersion = rlGetVersion @@ -12531,7 +14471,7 @@ raylib.rlGetVersion = rlGetVersion * * @return {undefined} */ -function rlSetFramebufferWidth (width) { +function rlSetFramebufferWidth(width) { return r.BindrlSetFramebufferWidth( width ) @@ -12543,7 +14483,7 @@ raylib.rlSetFramebufferWidth = rlSetFramebufferWidth * * @return {number} The resulting int. */ -function rlGetFramebufferWidth () { +function rlGetFramebufferWidth() { return r.BindrlGetFramebufferWidth() } raylib.rlGetFramebufferWidth = rlGetFramebufferWidth @@ -12555,7 +14495,7 @@ raylib.rlGetFramebufferWidth = rlGetFramebufferWidth * * @return {undefined} */ -function rlSetFramebufferHeight (height) { +function rlSetFramebufferHeight(height) { return r.BindrlSetFramebufferHeight( height ) @@ -12567,7 +14507,7 @@ raylib.rlSetFramebufferHeight = rlSetFramebufferHeight * * @return {number} The resulting int. */ -function rlGetFramebufferHeight () { +function rlGetFramebufferHeight() { return r.BindrlGetFramebufferHeight() } raylib.rlGetFramebufferHeight = rlGetFramebufferHeight @@ -12577,7 +14517,7 @@ raylib.rlGetFramebufferHeight = rlGetFramebufferHeight * * @return {number} The resulting unsigned int. */ -function rlGetTextureIdDefault () { +function rlGetTextureIdDefault() { return r.BindrlGetTextureIdDefault() } raylib.rlGetTextureIdDefault = rlGetTextureIdDefault @@ -12587,7 +14527,7 @@ raylib.rlGetTextureIdDefault = rlGetTextureIdDefault * * @return {number} The resulting unsigned int. */ -function rlGetShaderIdDefault () { +function rlGetShaderIdDefault() { return r.BindrlGetShaderIdDefault() } raylib.rlGetShaderIdDefault = rlGetShaderIdDefault @@ -12597,7 +14537,7 @@ raylib.rlGetShaderIdDefault = rlGetShaderIdDefault * * @return {number} The resulting int *. */ -function rlGetShaderLocsDefault () { +function rlGetShaderLocsDefault() { return r.BindrlGetShaderLocsDefault() } raylib.rlGetShaderLocsDefault = rlGetShaderLocsDefault @@ -12610,7 +14550,7 @@ raylib.rlGetShaderLocsDefault = rlGetShaderLocsDefault * * @return {rlRenderBatch} The resulting rlRenderBatch. */ -function rlLoadRenderBatch (numBuffers, bufferElements) { +function rlLoadRenderBatch(numBuffers, bufferElements) { return r.BindrlLoadRenderBatch( numBuffers, bufferElements @@ -12625,7 +14565,7 @@ raylib.rlLoadRenderBatch = rlLoadRenderBatch * * @return {undefined} */ -function rlUnloadRenderBatch (batch) { +function rlUnloadRenderBatch(batch) { return r.BindrlUnloadRenderBatch( batch.bufferCount, batch.currentBuffer, @@ -12644,7 +14584,7 @@ raylib.rlUnloadRenderBatch = rlUnloadRenderBatch * * @return {undefined} */ -function rlDrawRenderBatch (batch) { +function rlDrawRenderBatch(batch) { return r.BindrlDrawRenderBatch( batch ) @@ -12658,7 +14598,7 @@ raylib.rlDrawRenderBatch = rlDrawRenderBatch * * @return {undefined} */ -function rlSetRenderBatchActive (batch) { +function rlSetRenderBatchActive(batch) { return r.BindrlSetRenderBatchActive( batch ) @@ -12670,7 +14610,7 @@ raylib.rlSetRenderBatchActive = rlSetRenderBatchActive * * @return {undefined} */ -function rlDrawRenderBatchActive () { +function rlDrawRenderBatchActive() { return r.BindrlDrawRenderBatchActive() } raylib.rlDrawRenderBatchActive = rlDrawRenderBatchActive @@ -12682,7 +14622,7 @@ raylib.rlDrawRenderBatchActive = rlDrawRenderBatchActive * * @return {boolean} The resulting bool. */ -function rlCheckRenderBatchLimit (vCount) { +function rlCheckRenderBatchLimit(vCount) { return r.BindrlCheckRenderBatchLimit( vCount ) @@ -12696,7 +14636,7 @@ raylib.rlCheckRenderBatchLimit = rlCheckRenderBatchLimit * * @return {undefined} */ -function rlSetTexture (id) { +function rlSetTexture(id) { return r.BindrlSetTexture( id ) @@ -12708,13 +14648,13 @@ raylib.rlSetTexture = rlSetTexture * * @return {number} The resulting unsigned int. */ -function rlLoadVertexArray () { +function rlLoadVertexArray() { return r.BindrlLoadVertexArray() } raylib.rlLoadVertexArray = rlLoadVertexArray /** - * Load a vertex buffer attribute + * Load a vertex buffer object * * @param {number} buffer * @param {number} size @@ -12722,7 +14662,7 @@ raylib.rlLoadVertexArray = rlLoadVertexArray * * @return {number} The resulting unsigned int. */ -function rlLoadVertexBuffer (buffer, size, dynamic) { +function rlLoadVertexBuffer(buffer, size, dynamic) { return r.BindrlLoadVertexBuffer( buffer, size, @@ -12732,7 +14672,7 @@ function rlLoadVertexBuffer (buffer, size, dynamic) { raylib.rlLoadVertexBuffer = rlLoadVertexBuffer /** - * Load a new attributes element buffer + * Load vertex buffer elements object * * @param {number} buffer * @param {number} size @@ -12740,7 +14680,7 @@ raylib.rlLoadVertexBuffer = rlLoadVertexBuffer * * @return {number} The resulting unsigned int. */ -function rlLoadVertexBufferElement (buffer, size, dynamic) { +function rlLoadVertexBufferElement(buffer, size, dynamic) { return r.BindrlLoadVertexBufferElement( buffer, size, @@ -12750,7 +14690,7 @@ function rlLoadVertexBufferElement (buffer, size, dynamic) { raylib.rlLoadVertexBufferElement = rlLoadVertexBufferElement /** - * Update GPU buffer with new data + * Update vertex buffer object data on GPU buffer * * @param {number} bufferId * @param {number} data @@ -12759,7 +14699,7 @@ raylib.rlLoadVertexBufferElement = rlLoadVertexBufferElement * * @return {undefined} */ -function rlUpdateVertexBuffer (bufferId, data, dataSize, offset) { +function rlUpdateVertexBuffer(bufferId, data, dataSize, offset) { return r.BindrlUpdateVertexBuffer( bufferId, data, @@ -12770,7 +14710,7 @@ function rlUpdateVertexBuffer (bufferId, data, dataSize, offset) { raylib.rlUpdateVertexBuffer = rlUpdateVertexBuffer /** - * Update vertex buffer elements with new data + * Update vertex buffer elements data on GPU buffer * * @param {number} id * @param {number} data @@ -12779,7 +14719,7 @@ raylib.rlUpdateVertexBuffer = rlUpdateVertexBuffer * * @return {undefined} */ -function rlUpdateVertexBufferElements (id, data, dataSize, offset) { +function rlUpdateVertexBufferElements(id, data, dataSize, offset) { return r.BindrlUpdateVertexBufferElements( id, data, @@ -12789,33 +14729,67 @@ function rlUpdateVertexBufferElements (id, data, dataSize, offset) { } raylib.rlUpdateVertexBufferElements = rlUpdateVertexBufferElements -function rlUnloadVertexArray (vaoId) { +/** + * Unload vertex array (vao) + * + * @param {number} vaoId + * + * @return {undefined} + */ +function rlUnloadVertexArray(vaoId) { return r.BindrlUnloadVertexArray( vaoId ) } raylib.rlUnloadVertexArray = rlUnloadVertexArray -function rlUnloadVertexBuffer (vboId) { +/** + * Unload vertex buffer object + * + * @param {number} vboId + * + * @return {undefined} + */ +function rlUnloadVertexBuffer(vboId) { return r.BindrlUnloadVertexBuffer( vboId ) } raylib.rlUnloadVertexBuffer = rlUnloadVertexBuffer -function rlSetVertexAttribute (index, compSize, type, normalized, stride, pointer) { +/** + * Set vertex attribute data configuration + * + * @param {number} index + * @param {number} compSize + * @param {number} type + * @param {boolean} normalized + * @param {number} stride + * @param {number} offset + * + * @return {undefined} + */ +function rlSetVertexAttribute(index, compSize, type, normalized, stride, offset) { return r.BindrlSetVertexAttribute( index, compSize, type, normalized, stride, - pointer + offset ) } raylib.rlSetVertexAttribute = rlSetVertexAttribute -function rlSetVertexAttributeDivisor (index, divisor) { +/** + * Set vertex attribute data divisor + * + * @param {number} index + * @param {number} divisor + * + * @return {undefined} + */ +function rlSetVertexAttributeDivisor(index, divisor) { return r.BindrlSetVertexAttributeDivisor( index, divisor @@ -12824,7 +14798,7 @@ function rlSetVertexAttributeDivisor (index, divisor) { raylib.rlSetVertexAttributeDivisor = rlSetVertexAttributeDivisor /** - * Set vertex attribute default value + * Set vertex attribute default value, when attribute to provided * * @param {number} locIndex * @param {number} value @@ -12833,7 +14807,7 @@ raylib.rlSetVertexAttributeDivisor = rlSetVertexAttributeDivisor * * @return {undefined} */ -function rlSetVertexAttributeDefault (locIndex, value, attribType, count) { +function rlSetVertexAttributeDefault(locIndex, value, attribType, count) { return r.BindrlSetVertexAttributeDefault( locIndex, value, @@ -12843,7 +14817,15 @@ function rlSetVertexAttributeDefault (locIndex, value, attribType, count) { } raylib.rlSetVertexAttributeDefault = rlSetVertexAttributeDefault -function rlDrawVertexArray (offset, count) { +/** + * Draw vertex array (currently active vao) + * + * @param {number} offset + * @param {number} count + * + * @return {undefined} + */ +function rlDrawVertexArray(offset, count) { return r.BindrlDrawVertexArray( offset, count @@ -12851,7 +14833,16 @@ function rlDrawVertexArray (offset, count) { } raylib.rlDrawVertexArray = rlDrawVertexArray -function rlDrawVertexArrayElements (offset, count, buffer) { +/** + * Draw vertex array elements + * + * @param {number} offset + * @param {number} count + * @param {number} buffer + * + * @return {undefined} + */ +function rlDrawVertexArrayElements(offset, count, buffer) { return r.BindrlDrawVertexArrayElements( offset, count, @@ -12860,7 +14851,16 @@ function rlDrawVertexArrayElements (offset, count, buffer) { } raylib.rlDrawVertexArrayElements = rlDrawVertexArrayElements -function rlDrawVertexArrayInstanced (offset, count, instances) { +/** + * Draw vertex array (currently active vao) with instancing + * + * @param {number} offset + * @param {number} count + * @param {number} instances + * + * @return {undefined} + */ +function rlDrawVertexArrayInstanced(offset, count, instances) { return r.BindrlDrawVertexArrayInstanced( offset, count, @@ -12869,7 +14869,17 @@ function rlDrawVertexArrayInstanced (offset, count, instances) { } raylib.rlDrawVertexArrayInstanced = rlDrawVertexArrayInstanced -function rlDrawVertexArrayElementsInstanced (offset, count, buffer, instances) { +/** + * Draw vertex array elements with instancing + * + * @param {number} offset + * @param {number} count + * @param {number} buffer + * @param {number} instances + * + * @return {undefined} + */ +function rlDrawVertexArrayElementsInstanced(offset, count, buffer, instances) { return r.BindrlDrawVertexArrayElementsInstanced( offset, count, @@ -12880,7 +14890,7 @@ function rlDrawVertexArrayElementsInstanced (offset, count, buffer, instances) { raylib.rlDrawVertexArrayElementsInstanced = rlDrawVertexArrayElementsInstanced /** - * Load texture in GPU + * Load texture data * * @param {number} data * @param {number} width @@ -12890,7 +14900,7 @@ raylib.rlDrawVertexArrayElementsInstanced = rlDrawVertexArrayElementsInstanced * * @return {number} The resulting unsigned int. */ -function rlLoadTexture (data, width, height, format, mipmapCount) { +function rlLoadTexture(data, width, height, format, mipmapCount) { return r.BindrlLoadTexture( data, width, @@ -12910,7 +14920,7 @@ raylib.rlLoadTexture = rlLoadTexture * * @return {number} The resulting unsigned int. */ -function rlLoadTextureDepth (width, height, useRenderBuffer) { +function rlLoadTextureDepth(width, height, useRenderBuffer) { return r.BindrlLoadTextureDepth( width, height, @@ -12920,25 +14930,27 @@ function rlLoadTextureDepth (width, height, useRenderBuffer) { raylib.rlLoadTextureDepth = rlLoadTextureDepth /** - * Load texture cubemap + * Load texture cubemap data * * @param {number} data * @param {number} size * @param {number} format + * @param {number} mipmapCount * * @return {number} The resulting unsigned int. */ -function rlLoadTextureCubemap (data, size, format) { +function rlLoadTextureCubemap(data, size, format, mipmapCount) { return r.BindrlLoadTextureCubemap( data, size, - format + format, + mipmapCount ) } raylib.rlLoadTextureCubemap = rlLoadTextureCubemap /** - * Update GPU texture with new data + * Update texture with new data on GPU * * @param {number} id * @param {number} offsetX @@ -12950,7 +14962,7 @@ raylib.rlLoadTextureCubemap = rlLoadTextureCubemap * * @return {undefined} */ -function rlUpdateTexture (id, offsetX, offsetY, width, height, format, data) { +function rlUpdateTexture(id, offsetX, offsetY, width, height, format, data) { return r.BindrlUpdateTexture( id, offsetX, @@ -12973,7 +14985,7 @@ raylib.rlUpdateTexture = rlUpdateTexture * * @return {undefined} */ -function rlGetGlTextureFormats (format, glInternalFormat, glFormat, glType) { +function rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType) { return r.BindrlGetGlTextureFormats( format, glInternalFormat, @@ -12990,7 +15002,7 @@ raylib.rlGetGlTextureFormats = rlGetGlTextureFormats * * @return {string} The resulting const char *. */ -function rlGetPixelFormatName (format) { +function rlGetPixelFormatName(format) { return r.BindrlGetPixelFormatName( format ) @@ -13004,7 +15016,7 @@ raylib.rlGetPixelFormatName = rlGetPixelFormatName * * @return {undefined} */ -function rlUnloadTexture (id) { +function rlUnloadTexture(id) { return r.BindrlUnloadTexture( id ) @@ -13022,7 +15034,7 @@ raylib.rlUnloadTexture = rlUnloadTexture * * @return {undefined} */ -function rlGenTextureMipmaps (id, width, height, format, mipmaps) { +function rlGenTextureMipmaps(id, width, height, format, mipmaps) { return r.BindrlGenTextureMipmaps( id, width, @@ -13043,7 +15055,7 @@ raylib.rlGenTextureMipmaps = rlGenTextureMipmaps * * @return {number} The resulting void *. */ -function rlReadTexturePixels (id, width, height, format) { +function rlReadTexturePixels(id, width, height, format) { return r.BindrlReadTexturePixels( id, width, @@ -13061,7 +15073,7 @@ raylib.rlReadTexturePixels = rlReadTexturePixels * * @return {Buffer} The resulting unsigned char *. */ -function rlReadScreenPixels (width, height) { +function rlReadScreenPixels(width, height) { return r.BindrlReadScreenPixels( width, height @@ -13072,16 +15084,10 @@ raylib.rlReadScreenPixels = rlReadScreenPixels /** * Load an empty framebuffer * - * @param {number} width - * @param {number} height - * * @return {number} The resulting unsigned int. */ -function rlLoadFramebuffer (width, height) { - return r.BindrlLoadFramebuffer( - width, - height - ) +function rlLoadFramebuffer() { + return r.BindrlLoadFramebuffer() } raylib.rlLoadFramebuffer = rlLoadFramebuffer @@ -13096,7 +15102,7 @@ raylib.rlLoadFramebuffer = rlLoadFramebuffer * * @return {undefined} */ -function rlFramebufferAttach (fboId, texId, attachType, texType, mipLevel) { +function rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel) { return r.BindrlFramebufferAttach( fboId, texId, @@ -13114,7 +15120,7 @@ raylib.rlFramebufferAttach = rlFramebufferAttach * * @return {boolean} The resulting bool. */ -function rlFramebufferComplete (id) { +function rlFramebufferComplete(id) { return r.BindrlFramebufferComplete( id ) @@ -13128,7 +15134,7 @@ raylib.rlFramebufferComplete = rlFramebufferComplete * * @return {undefined} */ -function rlUnloadFramebuffer (id) { +function rlUnloadFramebuffer(id) { return r.BindrlUnloadFramebuffer( id ) @@ -13143,7 +15149,7 @@ raylib.rlUnloadFramebuffer = rlUnloadFramebuffer * * @return {number} The resulting unsigned int. */ -function rlLoadShaderCode (vsCode, fsCode) { +function rlLoadShaderCode(vsCode, fsCode) { return r.BindrlLoadShaderCode( vsCode, fsCode @@ -13159,7 +15165,7 @@ raylib.rlLoadShaderCode = rlLoadShaderCode * * @return {number} The resulting unsigned int. */ -function rlCompileShader (shaderCode, type) { +function rlCompileShader(shaderCode, type) { return r.BindrlCompileShader( shaderCode, type @@ -13175,7 +15181,7 @@ raylib.rlCompileShader = rlCompileShader * * @return {number} The resulting unsigned int. */ -function rlLoadShaderProgram (vShaderId, fShaderId) { +function rlLoadShaderProgram(vShaderId, fShaderId) { return r.BindrlLoadShaderProgram( vShaderId, fShaderId @@ -13190,7 +15196,7 @@ raylib.rlLoadShaderProgram = rlLoadShaderProgram * * @return {undefined} */ -function rlUnloadShaderProgram (id) { +function rlUnloadShaderProgram(id) { return r.BindrlUnloadShaderProgram( id ) @@ -13205,7 +15211,7 @@ raylib.rlUnloadShaderProgram = rlUnloadShaderProgram * * @return {number} The resulting int. */ -function rlGetLocationUniform (shaderId, uniformName) { +function rlGetLocationUniform(shaderId, uniformName) { return r.BindrlGetLocationUniform( shaderId, uniformName @@ -13221,7 +15227,7 @@ raylib.rlGetLocationUniform = rlGetLocationUniform * * @return {number} The resulting int. */ -function rlGetLocationAttrib (shaderId, attribName) { +function rlGetLocationAttrib(shaderId, attribName) { return r.BindrlGetLocationAttrib( shaderId, attribName @@ -13239,7 +15245,7 @@ raylib.rlGetLocationAttrib = rlGetLocationAttrib * * @return {undefined} */ -function rlSetUniform (locIndex, value, uniformType, count) { +function rlSetUniform(locIndex, value, uniformType, count) { return r.BindrlSetUniform( locIndex, value, @@ -13257,7 +15263,7 @@ raylib.rlSetUniform = rlSetUniform * * @return {undefined} */ -function rlSetUniformMatrix (locIndex, mat) { +function rlSetUniformMatrix(locIndex, mat) { return r.BindrlSetUniformMatrix( locIndex, mat.m0, @@ -13280,6 +15286,24 @@ function rlSetUniformMatrix (locIndex, mat) { } raylib.rlSetUniformMatrix = rlSetUniformMatrix +/** + * Set shader value matrices + * + * @param {number} locIndex + * @param {number} mat + * @param {number} count + * + * @return {undefined} + */ +function rlSetUniformMatrices(locIndex, mat, count) { + return r.BindrlSetUniformMatrices( + locIndex, + mat, + count + ) +} +raylib.rlSetUniformMatrices = rlSetUniformMatrices + /** * Set shader value sampler * @@ -13288,7 +15312,7 @@ raylib.rlSetUniformMatrix = rlSetUniformMatrix * * @return {undefined} */ -function rlSetUniformSampler (locIndex, textureId) { +function rlSetUniformSampler(locIndex, textureId) { return r.BindrlSetUniformSampler( locIndex, textureId @@ -13304,7 +15328,7 @@ raylib.rlSetUniformSampler = rlSetUniformSampler * * @return {undefined} */ -function rlSetShader (id, locs) { +function rlSetShader(id, locs) { return r.BindrlSetShader( id, locs @@ -13319,7 +15343,7 @@ raylib.rlSetShader = rlSetShader * * @return {number} The resulting unsigned int. */ -function rlLoadComputeShaderProgram (shaderId) { +function rlLoadComputeShaderProgram(shaderId) { return r.BindrlLoadComputeShaderProgram( shaderId ) @@ -13335,7 +15359,7 @@ raylib.rlLoadComputeShaderProgram = rlLoadComputeShaderProgram * * @return {undefined} */ -function rlComputeShaderDispatch (groupX, groupY, groupZ) { +function rlComputeShaderDispatch(groupX, groupY, groupZ) { return r.BindrlComputeShaderDispatch( groupX, groupY, @@ -13353,7 +15377,7 @@ raylib.rlComputeShaderDispatch = rlComputeShaderDispatch * * @return {number} The resulting unsigned int. */ -function rlLoadShaderBuffer (size, data, usageHint) { +function rlLoadShaderBuffer(size, data, usageHint) { return r.BindrlLoadShaderBuffer( size, data, @@ -13369,7 +15393,7 @@ raylib.rlLoadShaderBuffer = rlLoadShaderBuffer * * @return {undefined} */ -function rlUnloadShaderBuffer (ssboId) { +function rlUnloadShaderBuffer(ssboId) { return r.BindrlUnloadShaderBuffer( ssboId ) @@ -13386,7 +15410,7 @@ raylib.rlUnloadShaderBuffer = rlUnloadShaderBuffer * * @return {undefined} */ -function rlUpdateShaderBuffer (id, data, dataSize, offset) { +function rlUpdateShaderBuffer(id, data, dataSize, offset) { return r.BindrlUpdateShaderBuffer( id, data, @@ -13404,7 +15428,7 @@ raylib.rlUpdateShaderBuffer = rlUpdateShaderBuffer * * @return {undefined} */ -function rlBindShaderBuffer (id, index) { +function rlBindShaderBuffer(id, index) { return r.BindrlBindShaderBuffer( id, index @@ -13422,7 +15446,7 @@ raylib.rlBindShaderBuffer = rlBindShaderBuffer * * @return {undefined} */ -function rlReadShaderBuffer (id, dest, count, offset) { +function rlReadShaderBuffer(id, dest, count, offset) { return r.BindrlReadShaderBuffer( id, dest, @@ -13443,7 +15467,7 @@ raylib.rlReadShaderBuffer = rlReadShaderBuffer * * @return {undefined} */ -function rlCopyShaderBuffer (destId, srcId, destOffset, srcOffset, count) { +function rlCopyShaderBuffer(destId, srcId, destOffset, srcOffset, count) { return r.BindrlCopyShaderBuffer( destId, srcId, @@ -13461,7 +15485,7 @@ raylib.rlCopyShaderBuffer = rlCopyShaderBuffer * * @return {number} The resulting unsigned int. */ -function rlGetShaderBufferSize (id) { +function rlGetShaderBufferSize(id) { return r.BindrlGetShaderBufferSize( id ) @@ -13478,7 +15502,7 @@ raylib.rlGetShaderBufferSize = rlGetShaderBufferSize * * @return {undefined} */ -function rlBindImageTexture (id, index, format, readonly) { +function rlBindImageTexture(id, index, format, readonly) { return r.BindrlBindImageTexture( id, index, @@ -13493,7 +15517,7 @@ raylib.rlBindImageTexture = rlBindImageTexture * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixModelview () { +function rlGetMatrixModelview() { return r.BindrlGetMatrixModelview() } raylib.rlGetMatrixModelview = rlGetMatrixModelview @@ -13503,7 +15527,7 @@ raylib.rlGetMatrixModelview = rlGetMatrixModelview * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixProjection () { +function rlGetMatrixProjection() { return r.BindrlGetMatrixProjection() } raylib.rlGetMatrixProjection = rlGetMatrixProjection @@ -13513,7 +15537,7 @@ raylib.rlGetMatrixProjection = rlGetMatrixProjection * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixTransform () { +function rlGetMatrixTransform() { return r.BindrlGetMatrixTransform() } raylib.rlGetMatrixTransform = rlGetMatrixTransform @@ -13525,7 +15549,7 @@ raylib.rlGetMatrixTransform = rlGetMatrixTransform * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixProjectionStereo (eye) { +function rlGetMatrixProjectionStereo(eye) { return r.BindrlGetMatrixProjectionStereo( eye ) @@ -13539,7 +15563,7 @@ raylib.rlGetMatrixProjectionStereo = rlGetMatrixProjectionStereo * * @return {Matrix} The resulting Matrix. */ -function rlGetMatrixViewOffsetStereo (eye) { +function rlGetMatrixViewOffsetStereo(eye) { return r.BindrlGetMatrixViewOffsetStereo( eye ) @@ -13553,7 +15577,7 @@ raylib.rlGetMatrixViewOffsetStereo = rlGetMatrixViewOffsetStereo * * @return {undefined} */ -function rlSetMatrixProjection (proj) { +function rlSetMatrixProjection(proj) { return r.BindrlSetMatrixProjection( proj.m0, proj.m4, @@ -13582,7 +15606,7 @@ raylib.rlSetMatrixProjection = rlSetMatrixProjection * * @return {undefined} */ -function rlSetMatrixModelview (view) { +function rlSetMatrixModelview(view) { return r.BindrlSetMatrixModelview( view.m0, view.m4, @@ -13612,7 +15636,7 @@ raylib.rlSetMatrixModelview = rlSetMatrixModelview * * @return {undefined} */ -function rlSetMatrixProjectionStereo (right, left) { +function rlSetMatrixProjectionStereo(right, left) { return r.BindrlSetMatrixProjectionStereo( right.m0, right.m4, @@ -13658,7 +15682,7 @@ raylib.rlSetMatrixProjectionStereo = rlSetMatrixProjectionStereo * * @return {undefined} */ -function rlSetMatrixViewOffsetStereo (right, left) { +function rlSetMatrixViewOffsetStereo(right, left) { return r.BindrlSetMatrixViewOffsetStereo( right.m0, right.m4, @@ -13701,7 +15725,7 @@ raylib.rlSetMatrixViewOffsetStereo = rlSetMatrixViewOffsetStereo * * @return {undefined} */ -function rlLoadDrawCube () { +function rlLoadDrawCube() { return r.BindrlLoadDrawCube() } raylib.rlLoadDrawCube = rlLoadDrawCube @@ -13711,7 +15735,7 @@ raylib.rlLoadDrawCube = rlLoadDrawCube * * @return {undefined} */ -function rlLoadDrawQuad () { +function rlLoadDrawQuad() { return r.BindrlLoadDrawQuad() } raylib.rlLoadDrawQuad = rlLoadDrawQuad @@ -13724,7 +15748,7 @@ raylib.rlLoadDrawQuad = rlLoadDrawQuad * * @return {undefined} */ -function UpdateCamera (camera, mode) { +function UpdateCamera(camera, mode) { const obj = r.BindUpdateCamera( camera.position.x, camera.position.y, @@ -13755,7 +15779,7 @@ raylib.UpdateCamera = UpdateCamera * * @return {undefined} */ -function ImageFormat (image, newFormat) { +function ImageFormat(image, newFormat) { const obj = r.BindImageFormat( image.data, image.width, @@ -13780,7 +15804,7 @@ raylib.ImageFormat = ImageFormat * * @return {undefined} */ -function ImageToPOT (image, fill) { +function ImageToPOT(image, fill) { const obj = r.BindImageToPOT( image.data, image.width, @@ -13808,7 +15832,7 @@ raylib.ImageToPOT = ImageToPOT * * @return {undefined} */ -function ImageCrop (image, crop) { +function ImageCrop(image, crop) { const obj = r.BindImageCrop( image.data, image.width, @@ -13836,7 +15860,7 @@ raylib.ImageCrop = ImageCrop * * @return {undefined} */ -function ImageAlphaCrop (image, threshold) { +function ImageAlphaCrop(image, threshold) { const obj = r.BindImageAlphaCrop( image.data, image.width, @@ -13862,7 +15886,7 @@ raylib.ImageAlphaCrop = ImageAlphaCrop * * @return {undefined} */ -function ImageAlphaClear (image, color, threshold) { +function ImageAlphaClear(image, color, threshold) { const obj = r.BindImageAlphaClear( image.data, image.width, @@ -13891,7 +15915,7 @@ raylib.ImageAlphaClear = ImageAlphaClear * * @return {undefined} */ -function ImageAlphaMask (image, alphaMask) { +function ImageAlphaMask(image, alphaMask) { const obj = r.BindImageAlphaMask( image.data, image.width, @@ -13919,7 +15943,7 @@ raylib.ImageAlphaMask = ImageAlphaMask * * @return {undefined} */ -function ImageAlphaPremultiply (image) { +function ImageAlphaPremultiply(image) { const obj = r.BindImageAlphaPremultiply( image.data, image.width, @@ -13944,7 +15968,7 @@ raylib.ImageAlphaPremultiply = ImageAlphaPremultiply * * @return {undefined} */ -function ImageResize (image, newWidth, newHeight) { +function ImageResize(image, newWidth, newHeight) { const obj = r.BindImageResize( image.data, image.width, @@ -13971,7 +15995,7 @@ raylib.ImageResize = ImageResize * * @return {undefined} */ -function ImageResizeNN (image, newWidth, newHeight) { +function ImageResizeNN(image, newWidth, newHeight) { const obj = r.BindImageResizeNN( image.data, image.width, @@ -14001,7 +16025,7 @@ raylib.ImageResizeNN = ImageResizeNN * * @return {undefined} */ -function ImageResizeCanvas (image, newWidth, newHeight, offsetX, offsetY, fill) { +function ImageResizeCanvas(image, newWidth, newHeight, offsetX, offsetY, fill) { const obj = r.BindImageResizeCanvas( image.data, image.width, @@ -14032,7 +16056,7 @@ raylib.ImageResizeCanvas = ImageResizeCanvas * * @return {undefined} */ -function ImageMipmaps (image) { +function ImageMipmaps(image) { const obj = r.BindImageMipmaps( image.data, image.width, @@ -14059,7 +16083,7 @@ raylib.ImageMipmaps = ImageMipmaps * * @return {undefined} */ -function ImageDither (image, rBpp, gBpp, bBpp, aBpp) { +function ImageDither(image, rBpp, gBpp, bBpp, aBpp) { const obj = r.BindImageDither( image.data, image.width, @@ -14086,7 +16110,7 @@ raylib.ImageDither = ImageDither * * @return {undefined} */ -function ImageFlipVertical (image) { +function ImageFlipVertical(image) { const obj = r.BindImageFlipVertical( image.data, image.width, @@ -14109,7 +16133,7 @@ raylib.ImageFlipVertical = ImageFlipVertical * * @return {undefined} */ -function ImageFlipHorizontal (image) { +function ImageFlipHorizontal(image) { const obj = r.BindImageFlipHorizontal( image.data, image.width, @@ -14132,7 +16156,7 @@ raylib.ImageFlipHorizontal = ImageFlipHorizontal * * @return {undefined} */ -function ImageRotateCW (image) { +function ImageRotateCW(image) { const obj = r.BindImageRotateCW( image.data, image.width, @@ -14155,7 +16179,7 @@ raylib.ImageRotateCW = ImageRotateCW * * @return {undefined} */ -function ImageRotateCCW (image) { +function ImageRotateCCW(image) { const obj = r.BindImageRotateCCW( image.data, image.width, @@ -14179,7 +16203,7 @@ raylib.ImageRotateCCW = ImageRotateCCW * * @return {undefined} */ -function ImageColorTint (image, color) { +function ImageColorTint(image, color) { const obj = r.BindImageColorTint( image.data, image.width, @@ -14206,7 +16230,7 @@ raylib.ImageColorTint = ImageColorTint * * @return {undefined} */ -function ImageColorInvert (image) { +function ImageColorInvert(image) { const obj = r.BindImageColorInvert( image.data, image.width, @@ -14229,7 +16253,7 @@ raylib.ImageColorInvert = ImageColorInvert * * @return {undefined} */ -function ImageColorGrayscale (image) { +function ImageColorGrayscale(image) { const obj = r.BindImageColorGrayscale( image.data, image.width, @@ -14253,7 +16277,7 @@ raylib.ImageColorGrayscale = ImageColorGrayscale * * @return {undefined} */ -function ImageColorContrast (image, contrast) { +function ImageColorContrast(image, contrast) { const obj = r.BindImageColorContrast( image.data, image.width, @@ -14278,7 +16302,7 @@ raylib.ImageColorContrast = ImageColorContrast * * @return {undefined} */ -function ImageColorBrightness (image, brightness) { +function ImageColorBrightness(image, brightness) { const obj = r.BindImageColorBrightness( image.data, image.width, @@ -14304,7 +16328,7 @@ raylib.ImageColorBrightness = ImageColorBrightness * * @return {undefined} */ -function ImageColorReplace (image, color, replace) { +function ImageColorReplace(image, color, replace) { const obj = r.BindImageColorReplace( image.data, image.width, @@ -14336,7 +16360,7 @@ raylib.ImageColorReplace = ImageColorReplace * * @return {undefined} */ -function ImageClearBackground (dst, color) { +function ImageClearBackground(dst, color) { const obj = r.BindImageClearBackground( dst.data, dst.width, @@ -14366,7 +16390,7 @@ raylib.ImageClearBackground = ImageClearBackground * * @return {undefined} */ -function ImageDrawPixel (dst, posX, posY, color) { +function ImageDrawPixel(dst, posX, posY, color) { const obj = r.BindImageDrawPixel( dst.data, dst.width, @@ -14397,7 +16421,7 @@ raylib.ImageDrawPixel = ImageDrawPixel * * @return {undefined} */ -function ImageDrawPixelV (dst, position, color) { +function ImageDrawPixelV(dst, position, color) { const obj = r.BindImageDrawPixelV( dst.data, dst.width, @@ -14431,7 +16455,7 @@ raylib.ImageDrawPixelV = ImageDrawPixelV * * @return {undefined} */ -function ImageDrawLine (dst, startPosX, startPosY, endPosX, endPosY, color) { +function ImageDrawLine(dst, startPosX, startPosY, endPosX, endPosY, color) { const obj = r.BindImageDrawLine( dst.data, dst.width, @@ -14465,7 +16489,7 @@ raylib.ImageDrawLine = ImageDrawLine * * @return {undefined} */ -function ImageDrawLineV (dst, start, end, color) { +function ImageDrawLineV(dst, start, end, color) { const obj = r.BindImageDrawLineV( dst.data, dst.width, @@ -14500,7 +16524,7 @@ raylib.ImageDrawLineV = ImageDrawLineV * * @return {undefined} */ -function ImageDrawCircle (dst, centerX, centerY, radius, color) { +function ImageDrawCircle(dst, centerX, centerY, radius, color) { const obj = r.BindImageDrawCircle( dst.data, dst.width, @@ -14533,7 +16557,7 @@ raylib.ImageDrawCircle = ImageDrawCircle * * @return {undefined} */ -function ImageDrawCircleV (dst, center, radius, color) { +function ImageDrawCircleV(dst, center, radius, color) { const obj = r.BindImageDrawCircleV( dst.data, dst.width, @@ -14568,7 +16592,7 @@ raylib.ImageDrawCircleV = ImageDrawCircleV * * @return {undefined} */ -function ImageDrawRectangle (dst, posX, posY, width, height, color) { +function ImageDrawRectangle(dst, posX, posY, width, height, color) { const obj = r.BindImageDrawRectangle( dst.data, dst.width, @@ -14602,7 +16626,7 @@ raylib.ImageDrawRectangle = ImageDrawRectangle * * @return {undefined} */ -function ImageDrawRectangleV (dst, position, size, color) { +function ImageDrawRectangleV(dst, position, size, color) { const obj = r.BindImageDrawRectangleV( dst.data, dst.width, @@ -14635,7 +16659,7 @@ raylib.ImageDrawRectangleV = ImageDrawRectangleV * * @return {undefined} */ -function ImageDrawRectangleRec (dst, rec, color) { +function ImageDrawRectangleRec(dst, rec, color) { const obj = r.BindImageDrawRectangleRec( dst.data, dst.width, @@ -14669,7 +16693,7 @@ raylib.ImageDrawRectangleRec = ImageDrawRectangleRec * * @return {undefined} */ -function ImageDrawRectangleLines (dst, rec, thick, color) { +function ImageDrawRectangleLines(dst, rec, thick, color) { const obj = r.BindImageDrawRectangleLines( dst.data, dst.width, @@ -14705,7 +16729,7 @@ raylib.ImageDrawRectangleLines = ImageDrawRectangleLines * * @return {undefined} */ -function ImageDraw (dst, src, srcRec, dstRec, tint) { +function ImageDraw(dst, src, srcRec, dstRec, tint) { const obj = r.BindImageDraw( dst.data, dst.width, @@ -14750,7 +16774,7 @@ raylib.ImageDraw = ImageDraw * * @return {undefined} */ -function ImageDrawText (dst, text, posX, posY, fontSize, color) { +function ImageDrawText(dst, text, posX, posY, fontSize, color) { const obj = r.BindImageDrawText( dst.data, dst.width, @@ -14787,7 +16811,7 @@ raylib.ImageDrawText = ImageDrawText * * @return {undefined} */ -function ImageDrawTextEx (dst, font, text, position, fontSize, spacing, tint) { +function ImageDrawTextEx(dst, font, text, position, fontSize, spacing, tint) { const obj = r.BindImageDrawTextEx( dst.data, dst.width, @@ -14829,7 +16853,7 @@ raylib.ImageDrawTextEx = ImageDrawTextEx * * @return {undefined} */ -function GenTextureMipmaps (texture) { +function GenTextureMipmaps(texture) { const obj = r.BindGenTextureMipmaps( texture.id, texture.width, @@ -14853,7 +16877,7 @@ raylib.GenTextureMipmaps = GenTextureMipmaps * * @return {undefined} */ -function UploadMesh (mesh, dynamic) { +function UploadMesh(mesh, dynamic) { const obj = r.BindUploadMesh( mesh.vertexCount, mesh.triangleCount, @@ -14868,6 +16892,8 @@ function UploadMesh (mesh, dynamic) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId, dynamic @@ -14887,7 +16913,7 @@ raylib.UploadMesh = UploadMesh * * @return {undefined} */ -function GenMeshTangents (mesh) { +function GenMeshTangents(mesh) { const obj = r.BindGenMeshTangents( mesh.vertexCount, mesh.triangleCount, @@ -14902,6 +16928,8 @@ function GenMeshTangents (mesh) { mesh.animNormals, mesh.boneIds, mesh.boneWeights, + mesh.boneMatrices, + mesh.boneCount, mesh.vaoId, mesh.vboId ) @@ -14922,7 +16950,7 @@ raylib.GenMeshTangents = GenMeshTangents * * @return {undefined} */ -function SetModelMeshMaterial (model, meshId, materialId) { +function SetModelMeshMaterial(model, meshId, materialId) { const obj = r.BindSetModelMeshMaterial( model.transform.m0, model.transform.m4, @@ -14960,23 +16988,23 @@ function SetModelMeshMaterial (model, meshId, materialId) { raylib.SetModelMeshMaterial = SetModelMeshMaterial /** - * Crop a wave to defined samples range + * Crop a wave to defined frames range * * @param {Wave} wave - * @param {number} initSample - * @param {number} finalSample + * @param {number} initFrame + * @param {number} finalFrame * * @return {undefined} */ -function WaveCrop (wave, initSample, finalSample) { +function WaveCrop(wave, initFrame, finalFrame) { const obj = r.BindWaveCrop( wave.frameCount, wave.sampleRate, wave.sampleSize, wave.channels, wave.data, - initSample, - finalSample + initFrame, + finalFrame ) if (typeof obj !== 'undefined') { for (const key in obj) { @@ -14996,7 +17024,7 @@ raylib.WaveCrop = WaveCrop * * @return {undefined} */ -function WaveFormat (wave, sampleRate, sampleSize, channels) { +function WaveFormat(wave, sampleRate, sampleSize, channels) { const obj = r.BindWaveFormat( wave.frameCount, wave.sampleRate, @@ -15025,8 +17053,8 @@ raylib.WaveFormat = WaveFormat * * @return {Color} The new Color. */ -function Color (r, g, b, a) { - return { r, g, b, a } +function Color(r,g,b,a) { + return {r,g,b,a} } raylib.Color = Color @@ -15038,8 +17066,8 @@ raylib.Color = Color * * @return {Vector2} The new Vector2. */ -function Vector2 (x, y) { - return { x, y } +function Vector2(x,y) { + return {x,y} } raylib.Vector2 = Vector2 @@ -15052,8 +17080,8 @@ raylib.Vector2 = Vector2 * * @return {Vector3} The new Vector3. */ -function Vector3 (x, y, z) { - return { x, y, z } +function Vector3(x,y,z) { + return {x,y,z} } raylib.Vector3 = Vector3 @@ -15067,8 +17095,8 @@ raylib.Vector3 = Vector3 * * @return {Vector4} The new Vector4. */ -function Vector4 (x, y, z, w) { - return { x, y, z, w } +function Vector4(x,y,z,w) { + return {x,y,z,w} } raylib.Vector4 = Vector4 @@ -15082,8 +17110,8 @@ raylib.Vector4 = Vector4 * * @return {Rectangle} The new Rectangle. */ -function Rectangle (x, y, width, height) { - return { x, y, width, height } +function Rectangle(x,y,width,height) { + return {x,y,width,height} } raylib.Rectangle = Rectangle @@ -15097,8 +17125,8 @@ raylib.Rectangle = Rectangle * * @return {Camera2D} The new Camera2D. */ -function Camera2D (offset, target, rotation, zoom) { - return { offset, target, rotation, zoom } +function Camera2D(offset,target,rotation,zoom) { + return {offset,target,rotation,zoom} } raylib.Camera2D = Camera2D @@ -15113,8 +17141,8 @@ raylib.Camera2D = Camera2D * * @return {Camera3D} The new Camera3D. */ -function Camera3D (position, target, up, fovy, projection) { - return { position, target, up, fovy, projection } +function Camera3D(position,target,up,fovy,projection) { + return {position,target,up,fovy,projection} } raylib.Camera3D = Camera3D raylib.Camera = raylib.Camera3D @@ -15123,14 +17151,14 @@ raylib.Camera = raylib.Camera3D /** * Set shader uniform value float - * + * * @param {Shader} shader * @param {number} locIndex * @param {number} value - * + * * @returns {undefined} */ -function SetShaderFloat (shader, locIndex, value) { +function SetShaderFloat(shader, locIndex, value) { return r.BindSetShaderFloat( shader.id, shader.locs, @@ -15142,14 +17170,14 @@ raylib.SetShaderFloat = SetShaderFloat /** * Set shader uniform value float - * + * * @param {Shader} shader * @param {number} locIndex * @param {number} value - * + * * @returns {undefined} */ -function SetShaderInt (shader, locIndex, value) { +function SetShaderInt(shader, locIndex, value) { return r.BindSetShaderInt( shader.id, shader.locs, @@ -15161,14 +17189,14 @@ raylib.SetShaderInt = SetShaderInt /** * Set shader uniform value vector2 - * + * * @param {Shader} shader * @param {number} locIndex * @param {Vector2} value - * + * * @returns {undefined} */ -function SetShaderVec2 (shader, locIndex, value) { +function SetShaderVec2(shader, locIndex, value) { return r.BindSetShaderVec2( shader.id, shader.locs, @@ -15181,14 +17209,14 @@ raylib.SetShaderVec2 = SetShaderVec2 /** * Set shader uniform value vector3 - * + * * @param {Shader} shader * @param {number} locIndex * @param {Vector3} value - * + * * @returns {undefined} */ -function SetShaderVec3 (shader, locIndex, value) { +function SetShaderVec3(shader, locIndex, value) { return r.BindSetShaderVec3( shader.id, shader.locs, @@ -15202,14 +17230,14 @@ raylib.SetShaderVec3 = SetShaderVec3 /** * Set shader uniform value vector4 - * + * * @param {Shader} shader * @param {number} locIndex * @param {Vector4} value - * + * * @returns {undefined} */ -function SetShaderVec4 (shader, locIndex, value) { +function SetShaderVec4(shader, locIndex, value) { return r.BindSetShaderVec4( shader.id, shader.locs, @@ -15326,6 +17354,14 @@ raylib.FLAG_WINDOW_HIGHDPI = 8192 */ raylib.FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384 +/** + * Set to run program in borderless windowed mode + * + * @type {number} + * @constant + */ +raylib.FLAG_BORDERLESS_WINDOWED_MODE = 32768 + /** * Set to try enabling MSAA 4X * @@ -16268,7 +18304,7 @@ raylib.KEY_BACK = 4 * @type {number} * @constant */ -raylib.KEY_MENU = 82 +raylib.KEY_MENU = 5 /** * Key: Android volume up button @@ -16479,7 +18515,7 @@ raylib.GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4 raylib.GAMEPAD_BUTTON_RIGHT_FACE_UP = 5 /** - * Gamepad right button right (i.e. PS3: Square, Xbox: X) + * Gamepad right button right (i.e. PS3: Circle, Xbox: B) * * @type {number} * @constant @@ -16495,7 +18531,7 @@ raylib.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6 raylib.GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7 /** - * Gamepad right button left (i.e. PS3: Circle, Xbox: B) + * Gamepad right button left (i.e. PS3: Square, Xbox: X) * * @type {number} * @constant @@ -16519,7 +18555,7 @@ raylib.GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9 raylib.GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10 /** - * Gamepad top/back trigger right (one), it could be a trailing button + * Gamepad top/back trigger right (first), it could be a trailing button * * @type {number} * @constant @@ -16895,28 +18931,52 @@ raylib.SHADER_LOC_MAP_HEIGHT = 21 raylib.SHADER_LOC_MAP_CUBEMAP = 22 /** - * Shader location: samplerCube texture: irradiance + * Shader location: samplerCube texture: irradiance + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_IRRADIANCE = 23 + +/** + * Shader location: samplerCube texture: prefilter + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_PREFILTER = 24 + +/** + * Shader location: sampler2d texture: brdf + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_BRDF = 25 + +/** + * Shader location: vertex attribute: boneIds * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_IRRADIANCE = 23 +raylib.SHADER_LOC_VERTEX_BONEIDS = 26 /** - * Shader location: samplerCube texture: prefilter + * Shader location: vertex attribute: boneWeights * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_PREFILTER = 24 +raylib.SHADER_LOC_VERTEX_BONEWEIGHTS = 27 /** - * Shader location: sampler2d texture: brdf + * Shader location: array of matrices uniform: boneMatrices * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_BRDF = 25 +raylib.SHADER_LOC_BONE_MATRICES = 28 /** * Shader uniform type: float @@ -17102,13 +19162,37 @@ raylib.PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 */ raylib.PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 +/** + * 16 bpp (1 channel - half float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R16 = 11 + +/** + * 16*3 bpp (3 channels - half float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12 + +/** + * 16*4 bpp (4 channels - half float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13 + /** * 4 bpp (no alpha) * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 +raylib.PIXELFORMAT_COMPRESSED_DXT1_RGB = 14 /** * 4 bpp (1 bit alpha) @@ -17116,7 +19200,7 @@ raylib.PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 +raylib.PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15 /** * 8 bpp @@ -17124,7 +19208,7 @@ raylib.PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 +raylib.PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16 /** * 8 bpp @@ -17132,7 +19216,7 @@ raylib.PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 +raylib.PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17 /** * 4 bpp @@ -17140,7 +19224,7 @@ raylib.PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 +raylib.PIXELFORMAT_COMPRESSED_ETC1_RGB = 18 /** * 4 bpp @@ -17148,7 +19232,7 @@ raylib.PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 +raylib.PIXELFORMAT_COMPRESSED_ETC2_RGB = 19 /** * 8 bpp @@ -17156,7 +19240,7 @@ raylib.PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 +raylib.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20 /** * 4 bpp @@ -17164,7 +19248,7 @@ raylib.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 +raylib.PIXELFORMAT_COMPRESSED_PVRT_RGB = 21 /** * 4 bpp @@ -17172,7 +19256,7 @@ raylib.PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 +raylib.PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22 /** * 8 bpp @@ -17180,7 +19264,7 @@ raylib.PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 +raylib.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23 /** * 2 bpp @@ -17188,7 +19272,7 @@ raylib.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 +raylib.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24 /** * No filter, just pixel approximation @@ -17310,14 +19394,6 @@ raylib.CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 */ raylib.CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 -/** - * Layout is defined by a panorama image (equirrectangular map) - * - * @type {number} - * @constant - */ -raylib.CUBEMAP_LAYOUT_PANORAMA = 5 - /** * Default font generation, anti-aliased * @@ -17495,7 +19571,7 @@ raylib.GESTURE_PINCH_IN = 256 raylib.GESTURE_PINCH_OUT = 512 /** - * Custom camera + * Camera custom, controlled by user (UpdateCamera() does nothing) * * @type {number} * @constant @@ -17503,7 +19579,7 @@ raylib.GESTURE_PINCH_OUT = 512 raylib.CAMERA_CUSTOM = 0 /** - * Free camera + * Camera free mode * * @type {number} * @constant @@ -17511,7 +19587,7 @@ raylib.CAMERA_CUSTOM = 0 raylib.CAMERA_FREE = 1 /** - * Orbital camera + * Camera orbital, around target, zoom supported * * @type {number} * @constant @@ -17519,7 +19595,7 @@ raylib.CAMERA_FREE = 1 raylib.CAMERA_ORBITAL = 2 /** - * First person camera + * Camera first person * * @type {number} * @constant @@ -17527,7 +19603,7 @@ raylib.CAMERA_ORBITAL = 2 raylib.CAMERA_FIRST_PERSON = 3 /** - * Third person camera + * Camera third person * * @type {number} * @constant @@ -17575,7 +19651,7 @@ raylib.NPATCH_THREE_PATCH_VERTICAL = 1 raylib.NPATCH_THREE_PATCH_HORIZONTAL = 2 /** - * + * * * @type {number} * @constant @@ -17583,7 +19659,7 @@ raylib.NPATCH_THREE_PATCH_HORIZONTAL = 2 raylib.STATE_NORMAL = 0 /** - * + * * * @type {number} * @constant @@ -17591,7 +19667,7 @@ raylib.STATE_NORMAL = 0 raylib.STATE_FOCUSED = 1 /** - * + * * * @type {number} * @constant @@ -17599,7 +19675,7 @@ raylib.STATE_FOCUSED = 1 raylib.STATE_PRESSED = 2 /** - * + * * * @type {number} * @constant @@ -17607,7 +19683,7 @@ raylib.STATE_PRESSED = 2 raylib.STATE_DISABLED = 3 /** - * + * * * @type {number} * @constant @@ -17615,7 +19691,7 @@ raylib.STATE_DISABLED = 3 raylib.TEXT_ALIGN_LEFT = 0 /** - * + * * * @type {number} * @constant @@ -17623,7 +19699,7 @@ raylib.TEXT_ALIGN_LEFT = 0 raylib.TEXT_ALIGN_CENTER = 1 /** - * + * * * @type {number} * @constant @@ -17631,7 +19707,55 @@ raylib.TEXT_ALIGN_CENTER = 1 raylib.TEXT_ALIGN_RIGHT = 2 /** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_TOP = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_MIDDLE = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_BOTTOM = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_WRAP_NONE = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_WRAP_CHAR = 1 + +/** + * * + * @type {number} + * @constant + */ +raylib.TEXT_WRAP_WORD = 2 + +/** + * * * @type {number} * @constant @@ -17647,7 +19771,7 @@ raylib.DEFAULT = 0 raylib.LABEL = 1 /** - * + * * * @type {number} * @constant @@ -17663,7 +19787,7 @@ raylib.BUTTON = 2 raylib.TOGGLE = 3 /** - * Used also for: SLIDERBAR + * Used also for: SLIDERBAR, TOGGLESLIDER * * @type {number} * @constant @@ -17671,7 +19795,7 @@ raylib.TOGGLE = 3 raylib.SLIDER = 4 /** - * + * * * @type {number} * @constant @@ -17679,7 +19803,7 @@ raylib.SLIDER = 4 raylib.PROGRESSBAR = 5 /** - * + * * * @type {number} * @constant @@ -17687,7 +19811,7 @@ raylib.PROGRESSBAR = 5 raylib.CHECKBOX = 6 /** - * + * * * @type {number} * @constant @@ -17695,7 +19819,7 @@ raylib.CHECKBOX = 6 raylib.COMBOBOX = 7 /** - * + * * * @type {number} * @constant @@ -17711,7 +19835,7 @@ raylib.DROPDOWNBOX = 8 raylib.TEXTBOX = 9 /** - * + * * * @type {number} * @constant @@ -17727,7 +19851,7 @@ raylib.VALUEBOX = 10 raylib.SPINNER = 11 /** - * + * * * @type {number} * @constant @@ -17735,7 +19859,7 @@ raylib.SPINNER = 11 raylib.LISTVIEW = 12 /** - * + * * * @type {number} * @constant @@ -17743,7 +19867,7 @@ raylib.LISTVIEW = 12 raylib.COLORPICKER = 13 /** - * + * * * @type {number} * @constant @@ -17751,7 +19875,7 @@ raylib.COLORPICKER = 13 raylib.SCROLLBAR = 14 /** - * + * * * @type {number} * @constant @@ -17759,7 +19883,7 @@ raylib.SCROLLBAR = 14 raylib.STATUSBAR = 15 /** - * + * Control border color in STATE_NORMAL * * @type {number} * @constant @@ -17767,7 +19891,7 @@ raylib.STATUSBAR = 15 raylib.BORDER_COLOR_NORMAL = 0 /** - * + * Control base color in STATE_NORMAL * * @type {number} * @constant @@ -17775,7 +19899,7 @@ raylib.BORDER_COLOR_NORMAL = 0 raylib.BASE_COLOR_NORMAL = 1 /** - * + * Control text color in STATE_NORMAL * * @type {number} * @constant @@ -17783,7 +19907,7 @@ raylib.BASE_COLOR_NORMAL = 1 raylib.TEXT_COLOR_NORMAL = 2 /** - * + * Control border color in STATE_FOCUSED * * @type {number} * @constant @@ -17791,7 +19915,7 @@ raylib.TEXT_COLOR_NORMAL = 2 raylib.BORDER_COLOR_FOCUSED = 3 /** - * + * Control base color in STATE_FOCUSED * * @type {number} * @constant @@ -17799,7 +19923,7 @@ raylib.BORDER_COLOR_FOCUSED = 3 raylib.BASE_COLOR_FOCUSED = 4 /** - * + * Control text color in STATE_FOCUSED * * @type {number} * @constant @@ -17807,7 +19931,7 @@ raylib.BASE_COLOR_FOCUSED = 4 raylib.TEXT_COLOR_FOCUSED = 5 /** - * + * Control border color in STATE_PRESSED * * @type {number} * @constant @@ -17815,7 +19939,7 @@ raylib.TEXT_COLOR_FOCUSED = 5 raylib.BORDER_COLOR_PRESSED = 6 /** - * + * Control base color in STATE_PRESSED * * @type {number} * @constant @@ -17823,7 +19947,7 @@ raylib.BORDER_COLOR_PRESSED = 6 raylib.BASE_COLOR_PRESSED = 7 /** - * + * Control text color in STATE_PRESSED * * @type {number} * @constant @@ -17831,7 +19955,7 @@ raylib.BASE_COLOR_PRESSED = 7 raylib.TEXT_COLOR_PRESSED = 8 /** - * + * Control border color in STATE_DISABLED * * @type {number} * @constant @@ -17839,7 +19963,7 @@ raylib.TEXT_COLOR_PRESSED = 8 raylib.BORDER_COLOR_DISABLED = 9 /** - * + * Control base color in STATE_DISABLED * * @type {number} * @constant @@ -17847,7 +19971,7 @@ raylib.BORDER_COLOR_DISABLED = 9 raylib.BASE_COLOR_DISABLED = 10 /** - * + * Control text color in STATE_DISABLED * * @type {number} * @constant @@ -17855,7 +19979,7 @@ raylib.BASE_COLOR_DISABLED = 10 raylib.TEXT_COLOR_DISABLED = 11 /** - * + * Control border size, 0 for no border * * @type {number} * @constant @@ -17863,7 +19987,7 @@ raylib.TEXT_COLOR_DISABLED = 11 raylib.BORDER_WIDTH = 12 /** - * + * Control text padding, not considering border * * @type {number} * @constant @@ -17871,21 +19995,13 @@ raylib.BORDER_WIDTH = 12 raylib.TEXT_PADDING = 13 /** - * + * Control text horizontal alignment inside control text bound (after border and padding) * * @type {number} * @constant */ raylib.TEXT_ALIGNMENT = 14 -/** - * - * - * @type {number} - * @constant - */ -raylib.RESERVED = 15 - /** * Text size (glyphs max height) * @@ -17918,6 +20034,30 @@ raylib.LINE_COLOR = 18 */ raylib.BACKGROUND_COLOR = 19 +/** + * Text spacing between lines + * + * @type {number} + * @constant + */ +raylib.TEXT_LINE_SPACING = 20 + +/** + * Text vertical alignment inside text bounds (after border and padding) + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGNMENT_VERTICAL = 21 + +/** + * Text wrap-mode inside text bounds + * + * @type {number} + * @constant + */ +raylib.TEXT_WRAP_MODE = 22 + /** * ToggleGroup separation between toggles * @@ -17951,7 +20091,7 @@ raylib.SLIDER_PADDING = 17 raylib.PROGRESS_PADDING = 16 /** - * + * ScrollBar arrows size * * @type {number} * @constant @@ -17959,7 +20099,7 @@ raylib.PROGRESS_PADDING = 16 raylib.ARROWS_SIZE = 16 /** - * + * ScrollBar arrows visible * * @type {number} * @constant @@ -17967,7 +20107,7 @@ raylib.ARROWS_SIZE = 16 raylib.ARROWS_VISIBLE = 17 /** - * (SLIDERBAR, SLIDER_PADDING) + * ScrollBar slider internal padding * * @type {number} * @constant @@ -17975,7 +20115,7 @@ raylib.ARROWS_VISIBLE = 17 raylib.SCROLL_SLIDER_PADDING = 18 /** - * + * ScrollBar slider size * * @type {number} * @constant @@ -17983,7 +20123,7 @@ raylib.SCROLL_SLIDER_PADDING = 18 raylib.SCROLL_SLIDER_SIZE = 19 /** - * + * ScrollBar scroll padding from arrows * * @type {number} * @constant @@ -17991,7 +20131,7 @@ raylib.SCROLL_SLIDER_SIZE = 19 raylib.SCROLL_PADDING = 20 /** - * + * ScrollBar scrolling speed * * @type {number} * @constant @@ -18039,20 +20179,28 @@ raylib.ARROW_PADDING = 16 raylib.DROPDOWN_ITEMS_SPACING = 17 /** - * TextBox/TextBoxMulti/ValueBox/Spinner inner text padding + * DropdownBox arrow hidden * * @type {number} * @constant */ -raylib.TEXT_INNER_PADDING = 16 +raylib.DROPDOWN_ARROW_HIDDEN = 18 /** - * TextBoxMulti lines separation + * DropdownBox roll up flag (default rolls down) * * @type {number} * @constant */ -raylib.TEXT_LINES_SPACING = 17 +raylib.DROPDOWN_ROLL_UP = 19 + +/** + * TextBox in read-only mode: 0-text editable, 1-text no-editable + * + * @type {number} + * @constant + */ +raylib.TEXT_READONLY = 16 /** * Spinner left/right buttons width @@ -18095,7 +20243,7 @@ raylib.LIST_ITEMS_SPACING = 17 raylib.SCROLLBAR_WIDTH = 18 /** - * ListView scrollbar side (0-left, 1-right) + * ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) * * @type {number} * @constant @@ -18103,7 +20251,15 @@ raylib.SCROLLBAR_WIDTH = 18 raylib.SCROLLBAR_SIDE = 19 /** + * ListView items border width * + * @type {number} + * @constant + */ +raylib.LIST_ITEMS_BORDER_WIDTH = 20 + +/** + * * * @type {number} * @constant @@ -18143,7 +20299,7 @@ raylib.HUEBAR_SELECTOR_HEIGHT = 19 raylib.HUEBAR_SELECTOR_OVERFLOW = 20 /** - * + * * * @type {number} * @constant @@ -18151,7 +20307,7 @@ raylib.HUEBAR_SELECTOR_OVERFLOW = 20 raylib.ICON_NONE = 0 /** - * + * * * @type {number} * @constant @@ -18159,7 +20315,7 @@ raylib.ICON_NONE = 0 raylib.ICON_FOLDER_FILE_OPEN = 1 /** - * + * * * @type {number} * @constant @@ -18167,7 +20323,7 @@ raylib.ICON_FOLDER_FILE_OPEN = 1 raylib.ICON_FILE_SAVE_CLASSIC = 2 /** - * + * * * @type {number} * @constant @@ -18175,7 +20331,7 @@ raylib.ICON_FILE_SAVE_CLASSIC = 2 raylib.ICON_FOLDER_OPEN = 3 /** - * + * * * @type {number} * @constant @@ -18183,7 +20339,7 @@ raylib.ICON_FOLDER_OPEN = 3 raylib.ICON_FOLDER_SAVE = 4 /** - * + * * * @type {number} * @constant @@ -18191,7 +20347,7 @@ raylib.ICON_FOLDER_SAVE = 4 raylib.ICON_FILE_OPEN = 5 /** - * + * * * @type {number} * @constant @@ -18199,7 +20355,7 @@ raylib.ICON_FILE_OPEN = 5 raylib.ICON_FILE_SAVE = 6 /** - * + * * * @type {number} * @constant @@ -18207,7 +20363,7 @@ raylib.ICON_FILE_SAVE = 6 raylib.ICON_FILE_EXPORT = 7 /** - * + * * * @type {number} * @constant @@ -18215,7 +20371,7 @@ raylib.ICON_FILE_EXPORT = 7 raylib.ICON_FILE_ADD = 8 /** - * + * * * @type {number} * @constant @@ -18223,7 +20379,7 @@ raylib.ICON_FILE_ADD = 8 raylib.ICON_FILE_DELETE = 9 /** - * + * * * @type {number} * @constant @@ -18231,7 +20387,7 @@ raylib.ICON_FILE_DELETE = 9 raylib.ICON_FILETYPE_TEXT = 10 /** - * + * * * @type {number} * @constant @@ -18239,7 +20395,7 @@ raylib.ICON_FILETYPE_TEXT = 10 raylib.ICON_FILETYPE_AUDIO = 11 /** - * + * * * @type {number} * @constant @@ -18247,7 +20403,7 @@ raylib.ICON_FILETYPE_AUDIO = 11 raylib.ICON_FILETYPE_IMAGE = 12 /** - * + * * * @type {number} * @constant @@ -18255,7 +20411,7 @@ raylib.ICON_FILETYPE_IMAGE = 12 raylib.ICON_FILETYPE_PLAY = 13 /** - * + * * * @type {number} * @constant @@ -18263,7 +20419,7 @@ raylib.ICON_FILETYPE_PLAY = 13 raylib.ICON_FILETYPE_VIDEO = 14 /** - * + * * * @type {number} * @constant @@ -18271,7 +20427,7 @@ raylib.ICON_FILETYPE_VIDEO = 14 raylib.ICON_FILETYPE_INFO = 15 /** - * + * * * @type {number} * @constant @@ -18279,7 +20435,7 @@ raylib.ICON_FILETYPE_INFO = 15 raylib.ICON_FILE_COPY = 16 /** - * + * * * @type {number} * @constant @@ -18287,7 +20443,7 @@ raylib.ICON_FILE_COPY = 16 raylib.ICON_FILE_CUT = 17 /** - * + * * * @type {number} * @constant @@ -18295,7 +20451,7 @@ raylib.ICON_FILE_CUT = 17 raylib.ICON_FILE_PASTE = 18 /** - * + * * * @type {number} * @constant @@ -18303,7 +20459,7 @@ raylib.ICON_FILE_PASTE = 18 raylib.ICON_CURSOR_HAND = 19 /** - * + * * * @type {number} * @constant @@ -18311,7 +20467,7 @@ raylib.ICON_CURSOR_HAND = 19 raylib.ICON_CURSOR_POINTER = 20 /** - * + * * * @type {number} * @constant @@ -18319,7 +20475,7 @@ raylib.ICON_CURSOR_POINTER = 20 raylib.ICON_CURSOR_CLASSIC = 21 /** - * + * * * @type {number} * @constant @@ -18327,7 +20483,7 @@ raylib.ICON_CURSOR_CLASSIC = 21 raylib.ICON_PENCIL = 22 /** - * + * * * @type {number} * @constant @@ -18335,7 +20491,7 @@ raylib.ICON_PENCIL = 22 raylib.ICON_PENCIL_BIG = 23 /** - * + * * * @type {number} * @constant @@ -18343,7 +20499,7 @@ raylib.ICON_PENCIL_BIG = 23 raylib.ICON_BRUSH_CLASSIC = 24 /** - * + * * * @type {number} * @constant @@ -18351,7 +20507,7 @@ raylib.ICON_BRUSH_CLASSIC = 24 raylib.ICON_BRUSH_PAINTER = 25 /** - * + * * * @type {number} * @constant @@ -18359,7 +20515,7 @@ raylib.ICON_BRUSH_PAINTER = 25 raylib.ICON_WATER_DROP = 26 /** - * + * * * @type {number} * @constant @@ -18367,7 +20523,7 @@ raylib.ICON_WATER_DROP = 26 raylib.ICON_COLOR_PICKER = 27 /** - * + * * * @type {number} * @constant @@ -18375,7 +20531,7 @@ raylib.ICON_COLOR_PICKER = 27 raylib.ICON_RUBBER = 28 /** - * + * * * @type {number} * @constant @@ -18383,7 +20539,7 @@ raylib.ICON_RUBBER = 28 raylib.ICON_COLOR_BUCKET = 29 /** - * + * * * @type {number} * @constant @@ -18391,7 +20547,7 @@ raylib.ICON_COLOR_BUCKET = 29 raylib.ICON_TEXT_T = 30 /** - * + * * * @type {number} * @constant @@ -18399,7 +20555,7 @@ raylib.ICON_TEXT_T = 30 raylib.ICON_TEXT_A = 31 /** - * + * * * @type {number} * @constant @@ -18407,7 +20563,7 @@ raylib.ICON_TEXT_A = 31 raylib.ICON_SCALE = 32 /** - * + * * * @type {number} * @constant @@ -18415,7 +20571,7 @@ raylib.ICON_SCALE = 32 raylib.ICON_RESIZE = 33 /** - * + * * * @type {number} * @constant @@ -18423,7 +20579,7 @@ raylib.ICON_RESIZE = 33 raylib.ICON_FILTER_POINT = 34 /** - * + * * * @type {number} * @constant @@ -18431,7 +20587,7 @@ raylib.ICON_FILTER_POINT = 34 raylib.ICON_FILTER_BILINEAR = 35 /** - * + * * * @type {number} * @constant @@ -18439,7 +20595,7 @@ raylib.ICON_FILTER_BILINEAR = 35 raylib.ICON_CROP = 36 /** - * + * * * @type {number} * @constant @@ -18447,7 +20603,7 @@ raylib.ICON_CROP = 36 raylib.ICON_CROP_ALPHA = 37 /** - * + * * * @type {number} * @constant @@ -18455,7 +20611,7 @@ raylib.ICON_CROP_ALPHA = 37 raylib.ICON_SQUARE_TOGGLE = 38 /** - * + * * * @type {number} * @constant @@ -18463,7 +20619,7 @@ raylib.ICON_SQUARE_TOGGLE = 38 raylib.ICON_SYMMETRY = 39 /** - * + * * * @type {number} * @constant @@ -18471,7 +20627,7 @@ raylib.ICON_SYMMETRY = 39 raylib.ICON_SYMMETRY_HORIZONTAL = 40 /** - * + * * * @type {number} * @constant @@ -18479,7 +20635,7 @@ raylib.ICON_SYMMETRY_HORIZONTAL = 40 raylib.ICON_SYMMETRY_VERTICAL = 41 /** - * + * * * @type {number} * @constant @@ -18487,7 +20643,7 @@ raylib.ICON_SYMMETRY_VERTICAL = 41 raylib.ICON_LENS = 42 /** - * + * * * @type {number} * @constant @@ -18495,7 +20651,7 @@ raylib.ICON_LENS = 42 raylib.ICON_LENS_BIG = 43 /** - * + * * * @type {number} * @constant @@ -18503,7 +20659,7 @@ raylib.ICON_LENS_BIG = 43 raylib.ICON_EYE_ON = 44 /** - * + * * * @type {number} * @constant @@ -18511,7 +20667,7 @@ raylib.ICON_EYE_ON = 44 raylib.ICON_EYE_OFF = 45 /** - * + * * * @type {number} * @constant @@ -18519,7 +20675,7 @@ raylib.ICON_EYE_OFF = 45 raylib.ICON_FILTER_TOP = 46 /** - * + * * * @type {number} * @constant @@ -18527,7 +20683,7 @@ raylib.ICON_FILTER_TOP = 46 raylib.ICON_FILTER = 47 /** - * + * * * @type {number} * @constant @@ -18535,7 +20691,7 @@ raylib.ICON_FILTER = 47 raylib.ICON_TARGET_POINT = 48 /** - * + * * * @type {number} * @constant @@ -18543,7 +20699,7 @@ raylib.ICON_TARGET_POINT = 48 raylib.ICON_TARGET_SMALL = 49 /** - * + * * * @type {number} * @constant @@ -18551,7 +20707,7 @@ raylib.ICON_TARGET_SMALL = 49 raylib.ICON_TARGET_BIG = 50 /** - * + * * * @type {number} * @constant @@ -18559,7 +20715,7 @@ raylib.ICON_TARGET_BIG = 50 raylib.ICON_TARGET_MOVE = 51 /** - * + * * * @type {number} * @constant @@ -18567,7 +20723,7 @@ raylib.ICON_TARGET_MOVE = 51 raylib.ICON_CURSOR_MOVE = 52 /** - * + * * * @type {number} * @constant @@ -18575,7 +20731,7 @@ raylib.ICON_CURSOR_MOVE = 52 raylib.ICON_CURSOR_SCALE = 53 /** - * + * * * @type {number} * @constant @@ -18583,7 +20739,7 @@ raylib.ICON_CURSOR_SCALE = 53 raylib.ICON_CURSOR_SCALE_RIGHT = 54 /** - * + * * * @type {number} * @constant @@ -18591,7 +20747,7 @@ raylib.ICON_CURSOR_SCALE_RIGHT = 54 raylib.ICON_CURSOR_SCALE_LEFT = 55 /** - * + * * * @type {number} * @constant @@ -18599,7 +20755,7 @@ raylib.ICON_CURSOR_SCALE_LEFT = 55 raylib.ICON_UNDO = 56 /** - * + * * * @type {number} * @constant @@ -18607,7 +20763,7 @@ raylib.ICON_UNDO = 56 raylib.ICON_REDO = 57 /** - * + * * * @type {number} * @constant @@ -18615,7 +20771,7 @@ raylib.ICON_REDO = 57 raylib.ICON_REREDO = 58 /** - * + * * * @type {number} * @constant @@ -18623,7 +20779,7 @@ raylib.ICON_REREDO = 58 raylib.ICON_MUTATE = 59 /** - * + * * * @type {number} * @constant @@ -18631,7 +20787,7 @@ raylib.ICON_MUTATE = 59 raylib.ICON_ROTATE = 60 /** - * + * * * @type {number} * @constant @@ -18639,7 +20795,7 @@ raylib.ICON_ROTATE = 60 raylib.ICON_REPEAT = 61 /** - * + * * * @type {number} * @constant @@ -18647,7 +20803,7 @@ raylib.ICON_REPEAT = 61 raylib.ICON_SHUFFLE = 62 /** - * + * * * @type {number} * @constant @@ -18655,7 +20811,7 @@ raylib.ICON_SHUFFLE = 62 raylib.ICON_EMPTYBOX = 63 /** - * + * * * @type {number} * @constant @@ -18663,7 +20819,7 @@ raylib.ICON_EMPTYBOX = 63 raylib.ICON_TARGET = 64 /** - * + * * * @type {number} * @constant @@ -18671,7 +20827,7 @@ raylib.ICON_TARGET = 64 raylib.ICON_TARGET_SMALL_FILL = 65 /** - * + * * * @type {number} * @constant @@ -18679,7 +20835,7 @@ raylib.ICON_TARGET_SMALL_FILL = 65 raylib.ICON_TARGET_BIG_FILL = 66 /** - * + * * * @type {number} * @constant @@ -18687,7 +20843,7 @@ raylib.ICON_TARGET_BIG_FILL = 66 raylib.ICON_TARGET_MOVE_FILL = 67 /** - * + * * * @type {number} * @constant @@ -18695,7 +20851,7 @@ raylib.ICON_TARGET_MOVE_FILL = 67 raylib.ICON_CURSOR_MOVE_FILL = 68 /** - * + * * * @type {number} * @constant @@ -18703,7 +20859,7 @@ raylib.ICON_CURSOR_MOVE_FILL = 68 raylib.ICON_CURSOR_SCALE_FILL = 69 /** - * + * * * @type {number} * @constant @@ -18711,7 +20867,7 @@ raylib.ICON_CURSOR_SCALE_FILL = 69 raylib.ICON_CURSOR_SCALE_RIGHT_FILL = 70 /** - * + * * * @type {number} * @constant @@ -18719,7 +20875,7 @@ raylib.ICON_CURSOR_SCALE_RIGHT_FILL = 70 raylib.ICON_CURSOR_SCALE_LEFT_FILL = 71 /** - * + * * * @type {number} * @constant @@ -18727,7 +20883,7 @@ raylib.ICON_CURSOR_SCALE_LEFT_FILL = 71 raylib.ICON_UNDO_FILL = 72 /** - * + * * * @type {number} * @constant @@ -18735,7 +20891,7 @@ raylib.ICON_UNDO_FILL = 72 raylib.ICON_REDO_FILL = 73 /** - * + * * * @type {number} * @constant @@ -18743,7 +20899,7 @@ raylib.ICON_REDO_FILL = 73 raylib.ICON_REREDO_FILL = 74 /** - * + * * * @type {number} * @constant @@ -18751,7 +20907,7 @@ raylib.ICON_REREDO_FILL = 74 raylib.ICON_MUTATE_FILL = 75 /** - * + * * * @type {number} * @constant @@ -18759,7 +20915,7 @@ raylib.ICON_MUTATE_FILL = 75 raylib.ICON_ROTATE_FILL = 76 /** - * + * * * @type {number} * @constant @@ -18767,7 +20923,7 @@ raylib.ICON_ROTATE_FILL = 76 raylib.ICON_REPEAT_FILL = 77 /** - * + * * * @type {number} * @constant @@ -18775,7 +20931,7 @@ raylib.ICON_REPEAT_FILL = 77 raylib.ICON_SHUFFLE_FILL = 78 /** - * + * * * @type {number} * @constant @@ -18783,7 +20939,7 @@ raylib.ICON_SHUFFLE_FILL = 78 raylib.ICON_EMPTYBOX_SMALL = 79 /** - * + * * * @type {number} * @constant @@ -18791,7 +20947,7 @@ raylib.ICON_EMPTYBOX_SMALL = 79 raylib.ICON_BOX = 80 /** - * + * * * @type {number} * @constant @@ -18799,7 +20955,7 @@ raylib.ICON_BOX = 80 raylib.ICON_BOX_TOP = 81 /** - * + * * * @type {number} * @constant @@ -18807,7 +20963,7 @@ raylib.ICON_BOX_TOP = 81 raylib.ICON_BOX_TOP_RIGHT = 82 /** - * + * * * @type {number} * @constant @@ -18815,7 +20971,7 @@ raylib.ICON_BOX_TOP_RIGHT = 82 raylib.ICON_BOX_RIGHT = 83 /** - * + * * * @type {number} * @constant @@ -18823,7 +20979,7 @@ raylib.ICON_BOX_RIGHT = 83 raylib.ICON_BOX_BOTTOM_RIGHT = 84 /** - * + * * * @type {number} * @constant @@ -18831,7 +20987,7 @@ raylib.ICON_BOX_BOTTOM_RIGHT = 84 raylib.ICON_BOX_BOTTOM = 85 /** - * + * * * @type {number} * @constant @@ -18839,7 +20995,7 @@ raylib.ICON_BOX_BOTTOM = 85 raylib.ICON_BOX_BOTTOM_LEFT = 86 /** - * + * * * @type {number} * @constant @@ -18847,7 +21003,7 @@ raylib.ICON_BOX_BOTTOM_LEFT = 86 raylib.ICON_BOX_LEFT = 87 /** - * + * * * @type {number} * @constant @@ -18855,7 +21011,7 @@ raylib.ICON_BOX_LEFT = 87 raylib.ICON_BOX_TOP_LEFT = 88 /** - * + * * * @type {number} * @constant @@ -18863,7 +21019,7 @@ raylib.ICON_BOX_TOP_LEFT = 88 raylib.ICON_BOX_CENTER = 89 /** - * + * * * @type {number} * @constant @@ -18871,7 +21027,7 @@ raylib.ICON_BOX_CENTER = 89 raylib.ICON_BOX_CIRCLE_MASK = 90 /** - * + * * * @type {number} * @constant @@ -18879,7 +21035,7 @@ raylib.ICON_BOX_CIRCLE_MASK = 90 raylib.ICON_POT = 91 /** - * + * * * @type {number} * @constant @@ -18887,7 +21043,7 @@ raylib.ICON_POT = 91 raylib.ICON_ALPHA_MULTIPLY = 92 /** - * + * * * @type {number} * @constant @@ -18895,7 +21051,7 @@ raylib.ICON_ALPHA_MULTIPLY = 92 raylib.ICON_ALPHA_CLEAR = 93 /** - * + * * * @type {number} * @constant @@ -18903,7 +21059,7 @@ raylib.ICON_ALPHA_CLEAR = 93 raylib.ICON_DITHERING = 94 /** - * + * * * @type {number} * @constant @@ -18911,7 +21067,7 @@ raylib.ICON_DITHERING = 94 raylib.ICON_MIPMAPS = 95 /** - * + * * * @type {number} * @constant @@ -18919,7 +21075,7 @@ raylib.ICON_MIPMAPS = 95 raylib.ICON_BOX_GRID = 96 /** - * + * * * @type {number} * @constant @@ -18927,7 +21083,7 @@ raylib.ICON_BOX_GRID = 96 raylib.ICON_GRID = 97 /** - * + * * * @type {number} * @constant @@ -18935,7 +21091,7 @@ raylib.ICON_GRID = 97 raylib.ICON_BOX_CORNERS_SMALL = 98 /** - * + * * * @type {number} * @constant @@ -18943,7 +21099,7 @@ raylib.ICON_BOX_CORNERS_SMALL = 98 raylib.ICON_BOX_CORNERS_BIG = 99 /** - * + * * * @type {number} * @constant @@ -18951,7 +21107,7 @@ raylib.ICON_BOX_CORNERS_BIG = 99 raylib.ICON_FOUR_BOXES = 100 /** - * + * * * @type {number} * @constant @@ -18959,7 +21115,7 @@ raylib.ICON_FOUR_BOXES = 100 raylib.ICON_GRID_FILL = 101 /** - * + * * * @type {number} * @constant @@ -18967,7 +21123,7 @@ raylib.ICON_GRID_FILL = 101 raylib.ICON_BOX_MULTISIZE = 102 /** - * + * * * @type {number} * @constant @@ -18975,7 +21131,7 @@ raylib.ICON_BOX_MULTISIZE = 102 raylib.ICON_ZOOM_SMALL = 103 /** - * + * * * @type {number} * @constant @@ -18983,7 +21139,7 @@ raylib.ICON_ZOOM_SMALL = 103 raylib.ICON_ZOOM_MEDIUM = 104 /** - * + * * * @type {number} * @constant @@ -18991,7 +21147,7 @@ raylib.ICON_ZOOM_MEDIUM = 104 raylib.ICON_ZOOM_BIG = 105 /** - * + * * * @type {number} * @constant @@ -18999,7 +21155,7 @@ raylib.ICON_ZOOM_BIG = 105 raylib.ICON_ZOOM_ALL = 106 /** - * + * * * @type {number} * @constant @@ -19007,7 +21163,7 @@ raylib.ICON_ZOOM_ALL = 106 raylib.ICON_ZOOM_CENTER = 107 /** - * + * * * @type {number} * @constant @@ -19015,7 +21171,7 @@ raylib.ICON_ZOOM_CENTER = 107 raylib.ICON_BOX_DOTS_SMALL = 108 /** - * + * * * @type {number} * @constant @@ -19023,7 +21179,7 @@ raylib.ICON_BOX_DOTS_SMALL = 108 raylib.ICON_BOX_DOTS_BIG = 109 /** - * + * * * @type {number} * @constant @@ -19031,7 +21187,7 @@ raylib.ICON_BOX_DOTS_BIG = 109 raylib.ICON_BOX_CONCENTRIC = 110 /** - * + * * * @type {number} * @constant @@ -19039,7 +21195,7 @@ raylib.ICON_BOX_CONCENTRIC = 110 raylib.ICON_BOX_GRID_BIG = 111 /** - * + * * * @type {number} * @constant @@ -19047,7 +21203,7 @@ raylib.ICON_BOX_GRID_BIG = 111 raylib.ICON_OK_TICK = 112 /** - * + * * * @type {number} * @constant @@ -19055,7 +21211,7 @@ raylib.ICON_OK_TICK = 112 raylib.ICON_CROSS = 113 /** - * + * * * @type {number} * @constant @@ -19063,7 +21219,7 @@ raylib.ICON_CROSS = 113 raylib.ICON_ARROW_LEFT = 114 /** - * + * * * @type {number} * @constant @@ -19071,7 +21227,7 @@ raylib.ICON_ARROW_LEFT = 114 raylib.ICON_ARROW_RIGHT = 115 /** - * + * * * @type {number} * @constant @@ -19079,7 +21235,7 @@ raylib.ICON_ARROW_RIGHT = 115 raylib.ICON_ARROW_DOWN = 116 /** - * + * * * @type {number} * @constant @@ -19087,7 +21243,7 @@ raylib.ICON_ARROW_DOWN = 116 raylib.ICON_ARROW_UP = 117 /** - * + * * * @type {number} * @constant @@ -19095,7 +21251,7 @@ raylib.ICON_ARROW_UP = 117 raylib.ICON_ARROW_LEFT_FILL = 118 /** - * + * * * @type {number} * @constant @@ -19103,7 +21259,7 @@ raylib.ICON_ARROW_LEFT_FILL = 118 raylib.ICON_ARROW_RIGHT_FILL = 119 /** - * + * * * @type {number} * @constant @@ -19111,7 +21267,7 @@ raylib.ICON_ARROW_RIGHT_FILL = 119 raylib.ICON_ARROW_DOWN_FILL = 120 /** - * + * * * @type {number} * @constant @@ -19119,7 +21275,7 @@ raylib.ICON_ARROW_DOWN_FILL = 120 raylib.ICON_ARROW_UP_FILL = 121 /** - * + * * * @type {number} * @constant @@ -19127,7 +21283,7 @@ raylib.ICON_ARROW_UP_FILL = 121 raylib.ICON_AUDIO = 122 /** - * + * * * @type {number} * @constant @@ -19135,7 +21291,7 @@ raylib.ICON_AUDIO = 122 raylib.ICON_FX = 123 /** - * + * * * @type {number} * @constant @@ -19143,7 +21299,7 @@ raylib.ICON_FX = 123 raylib.ICON_WAVE = 124 /** - * + * * * @type {number} * @constant @@ -19151,7 +21307,7 @@ raylib.ICON_WAVE = 124 raylib.ICON_WAVE_SINUS = 125 /** - * + * * * @type {number} * @constant @@ -19159,7 +21315,7 @@ raylib.ICON_WAVE_SINUS = 125 raylib.ICON_WAVE_SQUARE = 126 /** - * + * * * @type {number} * @constant @@ -19167,7 +21323,7 @@ raylib.ICON_WAVE_SQUARE = 126 raylib.ICON_WAVE_TRIANGULAR = 127 /** - * + * * * @type {number} * @constant @@ -19175,7 +21331,7 @@ raylib.ICON_WAVE_TRIANGULAR = 127 raylib.ICON_CROSS_SMALL = 128 /** - * + * * * @type {number} * @constant @@ -19183,7 +21339,7 @@ raylib.ICON_CROSS_SMALL = 128 raylib.ICON_PLAYER_PREVIOUS = 129 /** - * + * * * @type {number} * @constant @@ -19191,7 +21347,7 @@ raylib.ICON_PLAYER_PREVIOUS = 129 raylib.ICON_PLAYER_PLAY_BACK = 130 /** - * + * * * @type {number} * @constant @@ -19199,7 +21355,7 @@ raylib.ICON_PLAYER_PLAY_BACK = 130 raylib.ICON_PLAYER_PLAY = 131 /** - * + * * * @type {number} * @constant @@ -19207,7 +21363,7 @@ raylib.ICON_PLAYER_PLAY = 131 raylib.ICON_PLAYER_PAUSE = 132 /** - * + * * * @type {number} * @constant @@ -19215,7 +21371,7 @@ raylib.ICON_PLAYER_PAUSE = 132 raylib.ICON_PLAYER_STOP = 133 /** - * + * * * @type {number} * @constant @@ -19223,7 +21379,7 @@ raylib.ICON_PLAYER_STOP = 133 raylib.ICON_PLAYER_NEXT = 134 /** - * + * * * @type {number} * @constant @@ -19231,7 +21387,7 @@ raylib.ICON_PLAYER_NEXT = 134 raylib.ICON_PLAYER_RECORD = 135 /** - * + * * * @type {number} * @constant @@ -19239,7 +21395,7 @@ raylib.ICON_PLAYER_RECORD = 135 raylib.ICON_MAGNET = 136 /** - * + * * * @type {number} * @constant @@ -19247,7 +21403,7 @@ raylib.ICON_MAGNET = 136 raylib.ICON_LOCK_CLOSE = 137 /** - * + * * * @type {number} * @constant @@ -19255,7 +21411,7 @@ raylib.ICON_LOCK_CLOSE = 137 raylib.ICON_LOCK_OPEN = 138 /** - * + * * * @type {number} * @constant @@ -19263,7 +21419,7 @@ raylib.ICON_LOCK_OPEN = 138 raylib.ICON_CLOCK = 139 /** - * + * * * @type {number} * @constant @@ -19271,7 +21427,7 @@ raylib.ICON_CLOCK = 139 raylib.ICON_TOOLS = 140 /** - * + * * * @type {number} * @constant @@ -19279,7 +21435,7 @@ raylib.ICON_TOOLS = 140 raylib.ICON_GEAR = 141 /** - * + * * * @type {number} * @constant @@ -19287,7 +21443,7 @@ raylib.ICON_GEAR = 141 raylib.ICON_GEAR_BIG = 142 /** - * + * * * @type {number} * @constant @@ -19295,7 +21451,7 @@ raylib.ICON_GEAR_BIG = 142 raylib.ICON_BIN = 143 /** - * + * * * @type {number} * @constant @@ -19303,7 +21459,7 @@ raylib.ICON_BIN = 143 raylib.ICON_HAND_POINTER = 144 /** - * + * * * @type {number} * @constant @@ -19311,7 +21467,7 @@ raylib.ICON_HAND_POINTER = 144 raylib.ICON_LASER = 145 /** - * + * * * @type {number} * @constant @@ -19319,7 +21475,7 @@ raylib.ICON_LASER = 145 raylib.ICON_COIN = 146 /** - * + * * * @type {number} * @constant @@ -19327,7 +21483,7 @@ raylib.ICON_COIN = 146 raylib.ICON_EXPLOSION = 147 /** - * + * * * @type {number} * @constant @@ -19335,7 +21491,7 @@ raylib.ICON_EXPLOSION = 147 raylib.ICON_1UP = 148 /** - * + * * * @type {number} * @constant @@ -19343,7 +21499,7 @@ raylib.ICON_1UP = 148 raylib.ICON_PLAYER = 149 /** - * + * * * @type {number} * @constant @@ -19351,7 +21507,7 @@ raylib.ICON_PLAYER = 149 raylib.ICON_PLAYER_JUMP = 150 /** - * + * * * @type {number} * @constant @@ -19359,7 +21515,7 @@ raylib.ICON_PLAYER_JUMP = 150 raylib.ICON_KEY = 151 /** - * + * * * @type {number} * @constant @@ -19367,7 +21523,7 @@ raylib.ICON_KEY = 151 raylib.ICON_DEMON = 152 /** - * + * * * @type {number} * @constant @@ -19375,7 +21531,7 @@ raylib.ICON_DEMON = 152 raylib.ICON_TEXT_POPUP = 153 /** - * + * * * @type {number} * @constant @@ -19383,7 +21539,7 @@ raylib.ICON_TEXT_POPUP = 153 raylib.ICON_GEAR_EX = 154 /** - * + * * * @type {number} * @constant @@ -19391,7 +21547,7 @@ raylib.ICON_GEAR_EX = 154 raylib.ICON_CRACK = 155 /** - * + * * * @type {number} * @constant @@ -19399,7 +21555,7 @@ raylib.ICON_CRACK = 155 raylib.ICON_CRACK_POINTS = 156 /** - * + * * * @type {number} * @constant @@ -19407,7 +21563,7 @@ raylib.ICON_CRACK_POINTS = 156 raylib.ICON_STAR = 157 /** - * + * * * @type {number} * @constant @@ -19415,7 +21571,7 @@ raylib.ICON_STAR = 157 raylib.ICON_DOOR = 158 /** - * + * * * @type {number} * @constant @@ -19423,7 +21579,7 @@ raylib.ICON_DOOR = 158 raylib.ICON_EXIT = 159 /** - * + * * * @type {number} * @constant @@ -19431,7 +21587,7 @@ raylib.ICON_EXIT = 159 raylib.ICON_MODE_2D = 160 /** - * + * * * @type {number} * @constant @@ -19439,7 +21595,7 @@ raylib.ICON_MODE_2D = 160 raylib.ICON_MODE_3D = 161 /** - * + * * * @type {number} * @constant @@ -19447,7 +21603,7 @@ raylib.ICON_MODE_3D = 161 raylib.ICON_CUBE = 162 /** - * + * * * @type {number} * @constant @@ -19455,7 +21611,7 @@ raylib.ICON_CUBE = 162 raylib.ICON_CUBE_FACE_TOP = 163 /** - * + * * * @type {number} * @constant @@ -19463,7 +21619,7 @@ raylib.ICON_CUBE_FACE_TOP = 163 raylib.ICON_CUBE_FACE_LEFT = 164 /** - * + * * * @type {number} * @constant @@ -19471,7 +21627,7 @@ raylib.ICON_CUBE_FACE_LEFT = 164 raylib.ICON_CUBE_FACE_FRONT = 165 /** - * + * * * @type {number} * @constant @@ -19479,7 +21635,7 @@ raylib.ICON_CUBE_FACE_FRONT = 165 raylib.ICON_CUBE_FACE_BOTTOM = 166 /** - * + * * * @type {number} * @constant @@ -19487,7 +21643,7 @@ raylib.ICON_CUBE_FACE_BOTTOM = 166 raylib.ICON_CUBE_FACE_RIGHT = 167 /** - * + * * * @type {number} * @constant @@ -19495,7 +21651,7 @@ raylib.ICON_CUBE_FACE_RIGHT = 167 raylib.ICON_CUBE_FACE_BACK = 168 /** - * + * * * @type {number} * @constant @@ -19503,7 +21659,7 @@ raylib.ICON_CUBE_FACE_BACK = 168 raylib.ICON_CAMERA = 169 /** - * + * * * @type {number} * @constant @@ -19511,7 +21667,7 @@ raylib.ICON_CAMERA = 169 raylib.ICON_SPECIAL = 170 /** - * + * * * @type {number} * @constant @@ -19519,7 +21675,7 @@ raylib.ICON_SPECIAL = 170 raylib.ICON_LINK_NET = 171 /** - * + * * * @type {number} * @constant @@ -19527,7 +21683,7 @@ raylib.ICON_LINK_NET = 171 raylib.ICON_LINK_BOXES = 172 /** - * + * * * @type {number} * @constant @@ -19535,7 +21691,7 @@ raylib.ICON_LINK_BOXES = 172 raylib.ICON_LINK_MULTI = 173 /** - * + * * * @type {number} * @constant @@ -19543,7 +21699,7 @@ raylib.ICON_LINK_MULTI = 173 raylib.ICON_LINK = 174 /** - * + * * * @type {number} * @constant @@ -19551,7 +21707,7 @@ raylib.ICON_LINK = 174 raylib.ICON_LINK_BROKE = 175 /** - * + * * * @type {number} * @constant @@ -19559,7 +21715,7 @@ raylib.ICON_LINK_BROKE = 175 raylib.ICON_TEXT_NOTES = 176 /** - * + * * * @type {number} * @constant @@ -19567,7 +21723,7 @@ raylib.ICON_TEXT_NOTES = 176 raylib.ICON_NOTEBOOK = 177 /** - * + * * * @type {number} * @constant @@ -19575,7 +21731,7 @@ raylib.ICON_NOTEBOOK = 177 raylib.ICON_SUITCASE = 178 /** - * + * * * @type {number} * @constant @@ -19583,7 +21739,7 @@ raylib.ICON_SUITCASE = 178 raylib.ICON_SUITCASE_ZIP = 179 /** - * + * * * @type {number} * @constant @@ -19591,7 +21747,7 @@ raylib.ICON_SUITCASE_ZIP = 179 raylib.ICON_MAILBOX = 180 /** - * + * * * @type {number} * @constant @@ -19599,7 +21755,7 @@ raylib.ICON_MAILBOX = 180 raylib.ICON_MONITOR = 181 /** - * + * * * @type {number} * @constant @@ -19607,7 +21763,7 @@ raylib.ICON_MONITOR = 181 raylib.ICON_PRINTER = 182 /** - * + * * * @type {number} * @constant @@ -19615,7 +21771,7 @@ raylib.ICON_PRINTER = 182 raylib.ICON_PHOTO_CAMERA = 183 /** - * + * * * @type {number} * @constant @@ -19623,7 +21779,7 @@ raylib.ICON_PHOTO_CAMERA = 183 raylib.ICON_PHOTO_CAMERA_FLASH = 184 /** - * + * * * @type {number} * @constant @@ -19631,7 +21787,7 @@ raylib.ICON_PHOTO_CAMERA_FLASH = 184 raylib.ICON_HOUSE = 185 /** - * + * * * @type {number} * @constant @@ -19639,7 +21795,7 @@ raylib.ICON_HOUSE = 185 raylib.ICON_HEART = 186 /** - * + * * * @type {number} * @constant @@ -19647,7 +21803,7 @@ raylib.ICON_HEART = 186 raylib.ICON_CORNER = 187 /** - * + * * * @type {number} * @constant @@ -19655,7 +21811,7 @@ raylib.ICON_CORNER = 187 raylib.ICON_VERTICAL_BARS = 188 /** - * + * * * @type {number} * @constant @@ -19663,7 +21819,7 @@ raylib.ICON_VERTICAL_BARS = 188 raylib.ICON_VERTICAL_BARS_FILL = 189 /** - * + * * * @type {number} * @constant @@ -19671,7 +21827,7 @@ raylib.ICON_VERTICAL_BARS_FILL = 189 raylib.ICON_LIFE_BARS = 190 /** - * + * * * @type {number} * @constant @@ -19679,7 +21835,7 @@ raylib.ICON_LIFE_BARS = 190 raylib.ICON_INFO = 191 /** - * + * * * @type {number} * @constant @@ -19687,7 +21843,7 @@ raylib.ICON_INFO = 191 raylib.ICON_CROSSLINE = 192 /** - * + * * * @type {number} * @constant @@ -19695,7 +21851,7 @@ raylib.ICON_CROSSLINE = 192 raylib.ICON_HELP = 193 /** - * + * * * @type {number} * @constant @@ -19703,7 +21859,7 @@ raylib.ICON_HELP = 193 raylib.ICON_FILETYPE_ALPHA = 194 /** - * + * * * @type {number} * @constant @@ -19711,7 +21867,7 @@ raylib.ICON_FILETYPE_ALPHA = 194 raylib.ICON_FILETYPE_HOME = 195 /** - * + * * * @type {number} * @constant @@ -19719,7 +21875,7 @@ raylib.ICON_FILETYPE_HOME = 195 raylib.ICON_LAYERS_VISIBLE = 196 /** - * + * * * @type {number} * @constant @@ -19727,7 +21883,7 @@ raylib.ICON_LAYERS_VISIBLE = 196 raylib.ICON_LAYERS = 197 /** - * + * * * @type {number} * @constant @@ -19735,7 +21891,7 @@ raylib.ICON_LAYERS = 197 raylib.ICON_WINDOW = 198 /** - * + * * * @type {number} * @constant @@ -19743,7 +21899,7 @@ raylib.ICON_WINDOW = 198 raylib.ICON_HIDPI = 199 /** - * + * * * @type {number} * @constant @@ -19751,7 +21907,7 @@ raylib.ICON_HIDPI = 199 raylib.ICON_FILETYPE_BINARY = 200 /** - * + * * * @type {number} * @constant @@ -19759,7 +21915,7 @@ raylib.ICON_FILETYPE_BINARY = 200 raylib.ICON_HEX = 201 /** - * + * * * @type {number} * @constant @@ -19767,7 +21923,7 @@ raylib.ICON_HEX = 201 raylib.ICON_SHIELD = 202 /** - * + * * * @type {number} * @constant @@ -19775,7 +21931,7 @@ raylib.ICON_SHIELD = 202 raylib.ICON_FILE_NEW = 203 /** - * + * * * @type {number} * @constant @@ -19783,7 +21939,7 @@ raylib.ICON_FILE_NEW = 203 raylib.ICON_FOLDER_ADD = 204 /** - * + * * * @type {number} * @constant @@ -19791,7 +21947,7 @@ raylib.ICON_FOLDER_ADD = 204 raylib.ICON_ALARM = 205 /** - * + * * * @type {number} * @constant @@ -19799,7 +21955,7 @@ raylib.ICON_ALARM = 205 raylib.ICON_CPU = 206 /** - * + * * * @type {number} * @constant @@ -19807,7 +21963,7 @@ raylib.ICON_CPU = 206 raylib.ICON_ROM = 207 /** - * + * * * @type {number} * @constant @@ -19815,7 +21971,7 @@ raylib.ICON_ROM = 207 raylib.ICON_STEP_OVER = 208 /** - * + * * * @type {number} * @constant @@ -19823,7 +21979,7 @@ raylib.ICON_STEP_OVER = 208 raylib.ICON_STEP_INTO = 209 /** - * + * * * @type {number} * @constant @@ -19831,7 +21987,7 @@ raylib.ICON_STEP_INTO = 209 raylib.ICON_STEP_OUT = 210 /** - * + * * * @type {number} * @constant @@ -19839,7 +21995,7 @@ raylib.ICON_STEP_OUT = 210 raylib.ICON_RESTART = 211 /** - * + * * * @type {number} * @constant @@ -19847,7 +22003,7 @@ raylib.ICON_RESTART = 211 raylib.ICON_BREAKPOINT_ON = 212 /** - * + * * * @type {number} * @constant @@ -19855,7 +22011,7 @@ raylib.ICON_BREAKPOINT_ON = 212 raylib.ICON_BREAKPOINT_OFF = 213 /** - * + * * * @type {number} * @constant @@ -19863,7 +22019,7 @@ raylib.ICON_BREAKPOINT_OFF = 213 raylib.ICON_BURGER_MENU = 214 /** - * + * * * @type {number} * @constant @@ -19871,7 +22027,7 @@ raylib.ICON_BURGER_MENU = 214 raylib.ICON_CASE_SENSITIVE = 215 /** - * + * * * @type {number} * @constant @@ -19879,7 +22035,7 @@ raylib.ICON_CASE_SENSITIVE = 215 raylib.ICON_REG_EXP = 216 /** - * + * * * @type {number} * @constant @@ -19887,7 +22043,7 @@ raylib.ICON_REG_EXP = 216 raylib.ICON_FOLDER = 217 /** - * + * * * @type {number} * @constant @@ -19895,87 +22051,87 @@ raylib.ICON_FOLDER = 217 raylib.ICON_FILE = 218 /** - * + * * * @type {number} * @constant */ -raylib.ICON_219 = 219 +raylib.ICON_SAND_TIMER = 219 /** - * + * * * @type {number} * @constant */ -raylib.ICON_220 = 220 +raylib.ICON_WARNING = 220 /** - * + * * * @type {number} * @constant */ -raylib.ICON_221 = 221 +raylib.ICON_HELP_BOX = 221 /** - * + * * * @type {number} * @constant */ -raylib.ICON_222 = 222 +raylib.ICON_INFO_BOX = 222 /** - * + * * * @type {number} * @constant */ -raylib.ICON_223 = 223 +raylib.ICON_PRIORITY = 223 /** - * + * * * @type {number} * @constant */ -raylib.ICON_224 = 224 +raylib.ICON_LAYERS_ISO = 224 /** - * + * * * @type {number} * @constant */ -raylib.ICON_225 = 225 +raylib.ICON_LAYERS2 = 225 /** - * + * * * @type {number} * @constant */ -raylib.ICON_226 = 226 +raylib.ICON_MLAYERS = 226 /** - * + * * * @type {number} * @constant */ -raylib.ICON_227 = 227 +raylib.ICON_MAPS = 227 /** - * + * * * @type {number} * @constant */ -raylib.ICON_228 = 228 +raylib.ICON_HOT = 228 /** - * + * * * @type {number} * @constant @@ -19983,7 +22139,7 @@ raylib.ICON_228 = 228 raylib.ICON_229 = 229 /** - * + * * * @type {number} * @constant @@ -19991,7 +22147,7 @@ raylib.ICON_229 = 229 raylib.ICON_230 = 230 /** - * + * * * @type {number} * @constant @@ -19999,7 +22155,7 @@ raylib.ICON_230 = 230 raylib.ICON_231 = 231 /** - * + * * * @type {number} * @constant @@ -20007,7 +22163,7 @@ raylib.ICON_231 = 231 raylib.ICON_232 = 232 /** - * + * * * @type {number} * @constant @@ -20015,7 +22171,7 @@ raylib.ICON_232 = 232 raylib.ICON_233 = 233 /** - * + * * * @type {number} * @constant @@ -20023,7 +22179,7 @@ raylib.ICON_233 = 233 raylib.ICON_234 = 234 /** - * + * * * @type {number} * @constant @@ -20031,7 +22187,7 @@ raylib.ICON_234 = 234 raylib.ICON_235 = 235 /** - * + * * * @type {number} * @constant @@ -20039,7 +22195,7 @@ raylib.ICON_235 = 235 raylib.ICON_236 = 236 /** - * + * * * @type {number} * @constant @@ -20047,7 +22203,7 @@ raylib.ICON_236 = 236 raylib.ICON_237 = 237 /** - * + * * * @type {number} * @constant @@ -20055,7 +22211,7 @@ raylib.ICON_237 = 237 raylib.ICON_238 = 238 /** - * + * * * @type {number} * @constant @@ -20063,7 +22219,7 @@ raylib.ICON_238 = 238 raylib.ICON_239 = 239 /** - * + * * * @type {number} * @constant @@ -20071,7 +22227,7 @@ raylib.ICON_239 = 239 raylib.ICON_240 = 240 /** - * + * * * @type {number} * @constant @@ -20079,7 +22235,7 @@ raylib.ICON_240 = 240 raylib.ICON_241 = 241 /** - * + * * * @type {number} * @constant @@ -20087,7 +22243,7 @@ raylib.ICON_241 = 241 raylib.ICON_242 = 242 /** - * + * * * @type {number} * @constant @@ -20095,7 +22251,7 @@ raylib.ICON_242 = 242 raylib.ICON_243 = 243 /** - * + * * * @type {number} * @constant @@ -20103,7 +22259,7 @@ raylib.ICON_243 = 243 raylib.ICON_244 = 244 /** - * + * * * @type {number} * @constant @@ -20111,7 +22267,7 @@ raylib.ICON_244 = 244 raylib.ICON_245 = 245 /** - * + * * * @type {number} * @constant @@ -20119,7 +22275,7 @@ raylib.ICON_245 = 245 raylib.ICON_246 = 246 /** - * + * * * @type {number} * @constant @@ -20127,7 +22283,7 @@ raylib.ICON_246 = 246 raylib.ICON_247 = 247 /** - * + * * * @type {number} * @constant @@ -20135,7 +22291,7 @@ raylib.ICON_247 = 247 raylib.ICON_248 = 248 /** - * + * * * @type {number} * @constant @@ -20143,7 +22299,7 @@ raylib.ICON_248 = 248 raylib.ICON_249 = 249 /** - * + * * * @type {number} * @constant @@ -20151,7 +22307,7 @@ raylib.ICON_249 = 249 raylib.ICON_250 = 250 /** - * + * * * @type {number} * @constant @@ -20159,7 +22315,7 @@ raylib.ICON_250 = 250 raylib.ICON_251 = 251 /** - * + * * * @type {number} * @constant @@ -20167,7 +22323,7 @@ raylib.ICON_251 = 251 raylib.ICON_252 = 252 /** - * + * * * @type {number} * @constant @@ -20175,7 +22331,7 @@ raylib.ICON_252 = 252 raylib.ICON_253 = 253 /** - * + * * * @type {number} * @constant @@ -20183,7 +22339,7 @@ raylib.ICON_253 = 253 raylib.ICON_254 = 254 /** - * + * * * @type {number} * @constant @@ -20230,6 +22386,14 @@ raylib.RL_OPENGL_43 = 4 */ raylib.RL_OPENGL_ES_20 = 5 +/** + * OpenGL ES 3.0 (GLSL 300 es) + * + * @type {number} + * @constant + */ +raylib.RL_OPENGL_ES_30 = 6 + /** * Display all logs * @@ -20374,13 +22538,37 @@ raylib.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 */ raylib.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 +/** + * 16 bpp (1 channel - half float) + * + * @type {number} + * @constant + */ +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R16 = 11 + +/** + * 16*3 bpp (3 channels - half float) + * + * @type {number} + * @constant + */ +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16 = 12 + +/** + * 16*4 bpp (4 channels - half float) + * + * @type {number} + * @constant + */ +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 = 13 + /** * 4 bpp (no alpha) * * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 14 /** * 4 bpp (1 bit alpha) @@ -20388,7 +22576,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 15 /** * 8 bpp @@ -20396,7 +22584,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 16 /** * 8 bpp @@ -20404,7 +22592,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 17 /** * 4 bpp @@ -20412,7 +22600,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 18 /** * 4 bpp @@ -20420,7 +22608,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 19 /** * 8 bpp @@ -20428,7 +22616,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 20 /** * 4 bpp @@ -20436,7 +22624,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 +raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 21 /** * 4 bpp @@ -20444,7 +22632,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 +raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 22 /** * 8 bpp @@ -20452,7 +22640,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 +raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 23 /** * 2 bpp @@ -20460,7 +22648,7 @@ raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 * @type {number} * @constant */ -raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 +raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 24 /** * No filter, just pixel approximation @@ -20846,13 +23034,45 @@ raylib.RL_SHADER_UNIFORM_IVEC3 = 6 */ raylib.RL_SHADER_UNIFORM_IVEC4 = 7 +/** + * Shader uniform type: unsigned int + * + * @type {number} + * @constant + */ +raylib.RL_SHADER_UNIFORM_UINT = 8 + +/** + * Shader uniform type: uivec2 (2 unsigned int) + * + * @type {number} + * @constant + */ +raylib.RL_SHADER_UNIFORM_UIVEC2 = 9 + +/** + * Shader uniform type: uivec3 (3 unsigned int) + * + * @type {number} + * @constant + */ +raylib.RL_SHADER_UNIFORM_UIVEC3 = 10 + +/** + * Shader uniform type: uivec4 (4 unsigned int) + * + * @type {number} + * @constant + */ +raylib.RL_SHADER_UNIFORM_UIVEC4 = 11 + /** * Shader uniform type: sampler2d * * @type {number} * @constant */ -raylib.RL_SHADER_UNIFORM_SAMPLER2D = 8 +raylib.RL_SHADER_UNIFORM_SAMPLER2D = 12 /** * Shader attribute type: float @@ -21031,7 +23251,7 @@ raylib.RL_ATTACHMENT_TEXTURE2D = 100 raylib.RL_ATTACHMENT_RENDERBUFFER = 200 /** - * + * * * @type {number} * @constant @@ -21039,7 +23259,7 @@ raylib.RL_ATTACHMENT_RENDERBUFFER = 200 raylib.RL_CULL_FACE_FRONT = 0 /** - * + * * * @type {number} * @constant @@ -21047,7 +23267,7 @@ raylib.RL_CULL_FACE_FRONT = 0 raylib.RL_CULL_FACE_BACK = 1 /** - * + * * * @type {number} * @constant @@ -21606,6 +23826,94 @@ raylib.RL_BLEND_SRC_ALPHA = 32971 */ raylib.RL_BLEND_COLOR = 32773 +/** + * GL_READ_FRAMEBUFFER + * + * @type {number} + * @constant + */ +raylib.RL_READ_FRAMEBUFFER = 36008 + +/** + * GL_DRAW_FRAMEBUFFER + * + * @type {number} + * @constant + */ +raylib.RL_DRAW_FRAMEBUFFER = 36009 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR = 3 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT = 4 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 = 5 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES = 6 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS = 7 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS = 8 + raylib.LIGHTGRAY = { r: 200, g: 200, b: 200, a: 255 } raylib.GRAY = { r: 130, g: 130, b: 130, a: 255 } raylib.DARKGRAY = { r: 80, g: 80, b: 80, a: 255 } diff --git a/test/resources/node-raylib-test.js b/test/resources/node-raylib-test.js index 8173710..a2655a6 100644 --- a/test/resources/node-raylib-test.js +++ b/test/resources/node-raylib-test.js @@ -3,7 +3,7 @@ */ const r = require('raylib') -const assert = require('assert') +const assert = require('node:assert') console.log('node-raylib-test: Test runner for node-raylib CLI') diff --git a/tools/generate.js b/tools/generate.js index a27a691..6b18335 100644 --- a/tools/generate.js +++ b/tools/generate.js @@ -1,159 +1,161 @@ // this will generate the wrappers & type-adapters in src/generated -const { writeFileSync } = require('fs') -const raylibApi = require('@raylib/api') -const path = require('path') +const { writeFileSync } = require("node:fs"); +const raylibApi = require("@raylib/api"); +const path = require("node:path"); // use this to keep from wrapping things const blocklist = [ // Error: invalid conversion from ‘void (*)(int, const char*, ...)’ to ‘void (*)()’ [-fpermissive] - 'TraceLog', - 'TextFormat', + "TraceLog", + "TextFormat", // Edge case: need additional wrapping to function - 'SetShaderValue', - 'SetShaderValueV', + "SetShaderValue", + "SetShaderValueV", // Callbacks: Not supported yet - 'SetTraceLogCallback', - 'SetLoadFileDataCallback', - 'SetSaveFileDataCallback', - 'SetLoadFileTextCallback', - 'SetSaveFileTextCallback', + "SetTraceLogCallback", + "SetLoadFileDataCallback", + "SetSaveFileDataCallback", + "SetLoadFileTextCallback", + "SetSaveFileTextCallback", - 'AudioCallback', - 'AttachAudioMixedProcessor', - 'DetachAudioMixedProcessor', + "AudioCallback", + "AttachAudioMixedProcessor", + "DetachAudioMixedProcessor", // Callbacks: AudioStream - 'SetAudioStreamCallback', - 'AttachAudioStreamProcessor', - 'DetachAudioStreamProcessor', + "SetAudioStreamCallback", + "AttachAudioStreamProcessor", + "DetachAudioStreamProcessor", // Structs // @todo Verify Structs that have array properties - 'VrStereoConfig', // Matrix[2], float[2] - 'VrDeviceInfo', // float[4] - 'Material', // float[4] + "VrStereoConfig", // Matrix[2], float[2] + "VrDeviceInfo", // float[4] + "Material", // float[4] // raymath // @todo Fix helper structs for float arrays - 'Vector3ToFloatV', // float3 - 'MatrixToFloatV', // float16 + "Vector3ToFloatV", // float3 + "MatrixToFloatV", // float16 // raygui - 'UnloadGuiStyle', // Commented out - 'LoadGuiStyle', // Commented out + "UnloadGuiStyle", // Commented out + "LoadGuiStyle", // Commented out // rlgl - 'rlEnableStatePointer', // undefined - 'rlDisableStatePointer' // undefined - -] + "rlEnableStatePointer", // undefined + "rlDisableStatePointer", // undefined +]; // these functions expect the first argument to be passed as a reference in C++ // so some extra wrapping needs to be done to return updated values from C++ to JS const byreflist = [ - 'UpdateCamera', - 'ImageFormat', - 'ImageToPOT', - 'ImageCrop', - 'ImageAlphaCrop', - 'ImageAlphaClear', - 'ImageAlphaMask', - 'ImageAlphaPremultiply', - 'ImageResize', - 'ImageResizeNN', - 'ImageResizeCanvas', - 'ImageMipmaps', - 'ImageDither', - 'ImageFlipVertical', - 'ImageFlipHorizontal', - 'ImageRotateCW', - 'ImageRotateCCW', - 'ImageColorTint', - 'ImageColorInvert', - 'ImageColorGrayscale', - 'ImageColorContrast', - 'ImageColorBrightness', - 'ImageColorReplace', - 'ImageClearBackground', - 'ImageDrawPixel', - 'ImageDrawPixelV', - 'ImageDrawLine', - 'ImageDrawLineV', - 'ImageDrawCircle', - 'ImageDrawCircleV', - 'ImageDrawRectangle', - 'ImageDrawRectangleV', - 'ImageDrawRectangleRec', - 'ImageDrawRectangleLines', - 'ImageDraw', - 'ImageDrawText', - 'ImageDrawTextEx', - 'GenTextureMipmaps', - 'GenTextureMipmaps', - 'UploadMesh', - 'GenMeshTangents', - 'GenMeshBinormals', - 'SetMaterialTexture', - 'SetModelMeshMaterial', - 'WaveFormat', - 'WaveCrop' -] + "UpdateCamera", + "ImageFormat", + "ImageToPOT", + "ImageCrop", + "ImageAlphaCrop", + "ImageAlphaClear", + "ImageAlphaMask", + "ImageAlphaPremultiply", + "ImageResize", + "ImageResizeNN", + "ImageResizeCanvas", + "ImageMipmaps", + "ImageDither", + "ImageFlipVertical", + "ImageFlipHorizontal", + "ImageRotateCW", + "ImageRotateCCW", + "ImageColorTint", + "ImageColorInvert", + "ImageColorGrayscale", + "ImageColorContrast", + "ImageColorBrightness", + "ImageColorReplace", + "ImageClearBackground", + "ImageDrawPixel", + "ImageDrawPixelV", + "ImageDrawLine", + "ImageDrawLineV", + "ImageDrawCircle", + "ImageDrawCircleV", + "ImageDrawRectangle", + "ImageDrawRectangleV", + "ImageDrawRectangleRec", + "ImageDrawRectangleLines", + "ImageDraw", + "ImageDrawText", + "ImageDrawTextEx", + "GenTextureMipmaps", + "GenTextureMipmaps", + "UploadMesh", + "GenMeshTangents", + "GenMeshBinormals", + "SetMaterialTexture", + "SetModelMeshMaterial", + "WaveFormat", + "WaveCrop", +]; // these are aliased types, so you use the resolved-type const typeAliases = { - Quaternion: 'Vector4', - RenderTexture2D: 'Texture', - Texture2D: 'Texture', - Camera: 'Camera3D' -} + Quaternion: "Vector4", + RenderTexture2D: "Texture", + Texture2D: "Texture", + Camera: "Camera3D", +}; // used to find array-size in defs -const rSize = /\[([0-9]+)\]/g +const rSize = /\[([0-9]+)\]/g; // pre-process the data for later analysis -function getDefs () { - const { structs, enums, functions } = raylibApi.raylib +function getDefs() { + const { structs, enums, functions } = raylibApi.raylib; for (const struct of structs) { // take multi-fields (like in Matrix) and make them all distinct fields // temporary fix for building on Mac/Win? Wonder why this is necessary - if (struct.name === 'BoneInfo') { - struct.fields[0].type = 'char' - struct.fields[1].type = 'char' + if (struct.name === "BoneInfo") { + struct.fields[0].type = "char"; + struct.fields[1].type = "char"; } - let newfields = [] + let newfields = []; for (const i in struct.fields) { - const field = struct.fields[i] - - if (field.name.includes(',')) { - newfields = [...newfields, ...field.name.split(',').map(n => { - return { - ...field, - name: n.trim() - } - })].sort((a, b) => a.name.match(/\d+/)[0] - b.name.match(/\d+/)[0]) + const field = struct.fields[i]; + + if (field.name.includes(",")) { + newfields = [ + ...newfields, + ...field.name.split(",").map((n) => { + return { + ...field, + name: n.trim(), + }; + }), + ].sort((a, b) => a.name.match(/\d+/)[0] - b.name.match(/\d+/)[0]); } else { - newfields.push(field) + newfields.push(field); } } - struct.fields = newfields + struct.fields = newfields; // find all arrays in structs, and give all fields a size and stripped name for later for (const field of struct.fields) { - const n = [...field.name.matchAll(rSize)] + const n = [...field.name.matchAll(rSize)]; if (n.length) { - field.size = parseInt(n[0][1]) - field.name = field.name.replace(rSize, '') + field.size = Number.parseInt(n[0][1]); + field.name = field.name.replace(rSize, ""); } else { - field.size = 1 + field.size = 1; } - const type = field.type.replace(/[* ]+/g, '') + const type = field.type.replace(/[* ]+/g, ""); if (typeAliases[type]) { - field.type = typeAliases[type] + field.type = typeAliases[type]; } } @@ -167,78 +169,101 @@ function getDefs () { // so we get an (incomplete) wrapper that will build. for (const struct of structs) { - const usesArray = struct.fields.find(f => f.size !== 1) + const usesArray = struct.fields.find((f) => f.size !== 1); if (usesArray) { - blocklist.push(struct.name) + blocklist.push(struct.name); } } // filter out all functions that use blocked types for (const f of functions) { - if (blocklist.includes(f.returnType.replace(/[* ]/g, ''))) { - blocklist.push(f.name) + if (blocklist.includes(f.returnType.replace(/[* ]/g, ""))) { + blocklist.push(f.name); } else { - for (const param of (f.params || [])) { - if (blocklist.includes(param.type.replace(/[* ]/g, ''))) { - blocklist.push(f.name) - break + for (const param of f.params || []) { + if (blocklist.includes(param.type.replace(/[* ]/g, ""))) { + blocklist.push(f.name); + break; } } } } // Add the Easings API - const reasings = raylibApi.reasings - functions.push(...reasings.functions) + const reasings = raylibApi.reasings; + functions.push(...reasings.functions); // Add Raymath - const raymath = raylibApi.raymath - functions.push(...raymath.functions) + const raymath = raylibApi.raymath; + functions.push(...raymath.functions); // Add Raygui - const raygui = raylibApi.raygui - functions.push(...raygui.functions) - enums.push(...raygui.enums) + const raygui = raylibApi.raygui; + functions.push(...raygui.functions); + enums.push(...raygui.enums); - const rlgl = raylibApi.rlgl - functions.push(...rlgl.functions) - enums.push(...rlgl.enums) + const rlgl = raylibApi.rlgl; + functions.push(...rlgl.functions); + enums.push(...rlgl.enums); const tmp = { - name: 'RLGL Defines', - description: '', - values: [] - } + name: "RLGL Defines", + description: "", + values: [], + }; for (const define of rlgl.defines) { - if (define.type === 'INT') { + if (define.type === "INT") { tmp.values.push({ name: define.name, description: define.description, - value: define.value - }) + value: define.value, + }); } } - enums.push(tmp) + enums.push(tmp); for (const struct of rlgl.structs) { - if (struct.name === 'rlVertexBuffer') { - struct.fields.splice(4, 6) + if (struct.name === "rlVertexBuffer") { + struct.fields.splice(4, 6); struct.fields.splice(4, 0, { - description: 'Vertex indices (in case vertex data comes indexed) (6 indices per quad)', - name: 'indices', - type: 'unsigned int *' - }) + description: + "Vertex indices (in case vertex data comes indexed) (6 indices per quad)", + name: "indices", + type: "unsigned int *", + }); } } - structs.push(...rlgl.structs.filter(s => { return s.name !== 'Matrix' })) + structs.push( + ...rlgl.structs.filter((s) => { + return s.name !== "Matrix"; + }) + ); - return { structs, enums, functions } + return { structs, enums, functions }; } -const { structs, enums, functions } = getDefs() -const GenBindings = require('./generate_templates/node-raylib-bindings.js') -const GenWrapper = require('./generate_templates/node-raylib-wrapper.js') -const GenTSDefs = require('./generate_templates/node-raylib-definitions.js') -const GenDRMWrapper = GenWrapper({ enums, blocklist, functions, structs, byreflist }).replace('node-raylib.node', 'node-raylib-drm.node') -writeFileSync(path.join(__dirname, '..', 'src', 'generated', 'node-raylib.cc'), GenBindings({ enums, blocklist, functions, structs, byreflist })) -writeFileSync(path.join(__dirname, '..', 'src', 'generated', 'node-raylib.js'), GenWrapper({ enums, blocklist, functions, structs, byreflist })) -writeFileSync(path.join(__dirname, '..', 'src', 'generated', 'node-raylib.d.ts'), GenTSDefs({ enums, blocklist, functions, structs, byreflist })) -writeFileSync(path.join(__dirname, '..', 'src', 'generated', 'node-raylib-drm.js'), GenDRMWrapper) +const { structs, enums, functions } = getDefs(); +const GenBindings = require("./generate_templates/node-raylib-bindings.js"); +const GenWrapper = require("./generate_templates/node-raylib-wrapper.js"); +const GenTSDefs = require("./generate_templates/node-raylib-definitions.js"); +const GenDRMWrapper = GenWrapper({ + enums, + blocklist, + functions, + structs, + byreflist, +}).replace("node-raylib.node", "node-raylib-drm.node"); +writeFileSync( + path.join(__dirname, "..", "src", "generated", "node-raylib.cc"), + GenBindings({ enums, blocklist, functions, structs, byreflist }) +); +writeFileSync( + path.join(__dirname, "..", "src", "generated", "node-raylib.js"), + GenWrapper({ enums, blocklist, functions, structs, byreflist }) +); +writeFileSync( + path.join(__dirname, "..", "src", "generated", "node-raylib.d.ts"), + GenTSDefs({ enums, blocklist, functions, structs, byreflist }) +); +writeFileSync( + path.join(__dirname, "..", "src", "generated", "node-raylib-drm.js"), + GenDRMWrapper +); diff --git a/tools/generate_templates/node-raylib-bindings.js b/tools/generate_templates/node-raylib-bindings.js index 68f90c9..9437e3c 100644 --- a/tools/generate_templates/node-raylib-bindings.js +++ b/tools/generate_templates/node-raylib-bindings.js @@ -4,90 +4,97 @@ * @param {*} name * @returns */ -const SanitizeTypeName = name => { - if (name === 'const Vector3') { - return 'Vector3' +const SanitizeTypeName = (name) => { + if (name === "const Vector3") { + return "Vector3"; } - if (name === 'float[2]') { - return 'pointer' + if (name === "float[2]") { + return "pointer"; } - if (name === 'char[32]') { - return 'pointer' + if (name === "char[32]") { + return "pointer"; } - if (name === 'float[4]') { - return 'pointer' + if (name === "float[4]") { + return "pointer"; } - if (name === 'unsigned int[4]') { - return '(unsigned int) pointer' + if (name === "unsigned int[4]") { + return "(unsigned int) pointer"; } - if (name === 'Matrix[2]') { - return 'pointer' + if (name === "Matrix[2]") { + return "pointer"; } - if (name === 'const char *') { - return 'string' + if (name === "const char *") { + return "string"; } - if (name.endsWith('*')) { - return 'pointer' + if (name.endsWith("*")) { + return "pointer"; } - if (name.endsWith('Callback')) { - return 'function' + if (name.endsWith("Callback")) { + return "function"; } - if (name === 'Camera') { - return 'Camera3D' + if (name === "Camera") { + return "Camera3D"; } - if (name === 'Quaternion') { - return 'Vector4' + if (name === "Quaternion") { + return "Vector4"; } - if (name === 'Texture2D') { - return 'Texture' + if (name === "Texture2D") { + return "Texture"; } - return name.replace(/ /g, '') -} + return name.replace(/ /g, ""); +}; const TypeUnwrappedLength = (structs, type) => { - if (type === 'Camera') { - type = 'Camera3D' + if (type === "Camera") { + type = "Camera3D"; } - if (type === 'Texture2D') { - type = 'Texture' + if (type === "Texture2D") { + type = "Texture"; } - let properties = 0 + let properties = 0; for (const struct of structs) { if (struct.name === type) { for (const field of struct.fields) { - properties += TypeUnwrappedLength(structs, field.type) + properties += TypeUnwrappedLength(structs, field.type); } } } - if (properties === 0) { // primitive, not struct. return length 1 - return 1 + if (properties === 0) { + // primitive, not struct. return length 1 + return 1; } - return properties -} + return properties; +}; const UnwrappedStructProperties = (structs, struct) => { - let length = 0 + let length = 0; return struct.fields - .map(field => { - const out = `${field.type.endsWith('*') ? ` (${field.type})` : ''} ${SanitizeTypeName(field.type)}FromValue(info, index + ${length})` - length += TypeUnwrappedLength(structs, field.type) - return out + .map((field) => { + const out = `${ + field.type.endsWith("*") ? ` (${field.type})` : "" + } ${SanitizeTypeName(field.type)}FromValue(info, index + ${length})`; + length += TypeUnwrappedLength(structs, field.type); + return out; }) - .join(',\n ') -} + .join(",\n "); +}; const UnwrappedFuncArguments = (structs, func) => { - if (!func.params) { return '' } - let length = 0 + if (!func.params) { + return ""; + } + let length = 0; return func.params - .map(param => { - const out = `${param.type.endsWith('*') ? ` (${param.type})` : ''} ${SanitizeTypeName(param.type)}FromValue(info, ${length})` - length += TypeUnwrappedLength(structs, param.type) - return out + .map((param) => { + const out = `${ + param.type.endsWith("*") ? ` (${param.type})` : "" + } ${SanitizeTypeName(param.type)}FromValue(info, ${length})`; + length += TypeUnwrappedLength(structs, param.type); + return out; }) - .join(',\n ') -} + .join(",\n "); +}; /** * @@ -95,11 +102,13 @@ const UnwrappedFuncArguments = (structs, func) => { * @returns */ const FromValue = (structs, struct) => ` -inline ${struct.name} ${SanitizeTypeName(struct.name)}FromValue(const Napi::CallbackInfo& info, int index) { +inline ${struct.name} ${SanitizeTypeName( + struct.name +)}FromValue(const Napi::CallbackInfo& info, int index) { return { ${UnwrappedStructProperties(structs, struct)} }; -}` +}`; /** * @@ -110,11 +119,12 @@ const ToValue = (struct) => ` inline Napi::Value ToValue(Napi::Env env, ${struct.name} obj) { Napi::Object out = Napi::Object::New(env); ${struct.fields - .map(field => `out.Set("${field.name}", ToValue(env, obj.${field.name}));`) - .join('\n ') - } + .map( + (field) => `out.Set("${field.name}", ToValue(env, obj.${field.name}));` + ) + .join("\n ")} return out; -}` +}`; /** * @@ -128,7 +138,7 @@ Napi::Value Bind${func.name}(const Napi::CallbackInfo& info) { ${UnwrappedFuncArguments(structs, func)} ) ); -}` +}`; /** * @@ -140,7 +150,7 @@ void Bind${func.name}(const Napi::CallbackInfo& info) { ${func.name}( ${UnwrappedFuncArguments(structs, func)} ); -}` +}`; /** * @@ -148,35 +158,41 @@ void Bind${func.name}(const Napi::CallbackInfo& info) { * @returns */ const BindFunctionPassByRef = (structs, func) => { - let returnType = func.params[0].type - returnType = returnType.replace(' *', '') - let length = TypeUnwrappedLength(structs, returnType) + let returnType = func.params[0].type; + returnType = returnType.replace(" *", ""); + let length = TypeUnwrappedLength(structs, returnType); return ` Napi::Value Bind${func.name}(const Napi::CallbackInfo& info) { ${returnType} obj = ${returnType}FromValue(info, 0); ${func.name}( - ${func.params.length === 1 - ? '&obj\n' - : ['&obj'].concat(func.params - ?.filter((param, index) => index !== 0) - .map(param => { - const out = `${param.type.endsWith('*') ? ` (${param.type})` : ''} ${SanitizeTypeName(param.type)}FromValue(info, ${length})` - length += TypeUnwrappedLength(structs, param.type) - return out - }) - .join(',\n ')) + ${ + func.params.length === 1 + ? "&obj\n" + : ["&obj"].concat( + func.params + ?.filter((param, index) => index !== 0) + .map((param) => { + const out = `${ + param.type.endsWith("*") ? ` (${param.type})` : "" + } ${SanitizeTypeName(param.type)}FromValue(info, ${length})`; + length += TypeUnwrappedLength(structs, param.type); + return out; + }) + .join(",\n ") + ) } ); return ToValue(info.Env(), obj); -}` -} +}`; +}; /** * * @param {*} func * @returns */ -const ExportFunctionBinding = func => `exports.Set("Bind${func.name}", Napi::Function::New(env, Bind${func.name}));` +const ExportFunctionBinding = (func) => + `exports.Set("Bind${func.name}", Napi::Function::New(env, Bind${func.name}));`; module.exports = ({ functions, structs, enums, blocklist, byreflist }) => ` // GENERATED CODE: DO NOT MODIFY @@ -270,30 +286,36 @@ inline rlVertexBuffer rlVertexBufferFromValue(const Napi::CallbackInfo& info, in intFromValue(info, index + 0), (float *) pointerFromValue(info, index + 1), (float *) pointerFromValue(info, index + 2), - (unsigned char *) pointerFromValue(info, index + 3), + (float *) pointerFromValue(info, index + 3), #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) - (unsigned int *) pointerFromValue(info, index + 4), // Vertex indices (in case vertex data comes indexed) (6 indices per quad) + (unsigned char*) pointerFromValue(info, index + 4), // Vertex indices (in case vertex data comes indexed) (6 indices per quad) #endif #if defined(GRAPHICS_API_OPENGL_ES2) (unsigned short *) pointerFromValue(info, index + 4), // Vertex indices (in case vertex data comes indexed) (6 indices per quad) - #endif - unsignedintFromValue(info, index + 5), + #endif + (unsigned int*) pointerFromValue(info, index + 5), (unsigned int) pointerFromValue(info, index + 6) }; } // Convert structs from Napi::Values in info[] arguments ${structs - .filter(({ name }) => !blocklist.includes(name) && name !== 'rlVertexBuffer') - .map(struct => { return FromValue(structs, struct) }) - .join('\n') - } + .filter( + ({ name }) => + !blocklist.includes(name) && + name !== "rlVertexBuffer" && + name !== "AutomationEvent" && + name !== "ModelAnimation" + ) + .map((struct) => { + return FromValue(structs, struct); + }) + .join("\n")} // Convert structs to Napi::Objects for output to JS ${structs - .filter(({ name }) => !blocklist.includes(name)) - .map(ToValue) - .join('\n') - } + .filter(({ name }) => !blocklist.includes(name)) + .map(ToValue) + .join("\n")} inline Texture2D Texture2DFromValue(const Napi::CallbackInfo& info, int index) { return (Texture2D) TextureFromValue(info, index); @@ -305,28 +327,50 @@ inline Camera CameraFromValue(const Napi::CallbackInfo& info, int index) { return Camera3DFromValue(info, index); } +inline AutomationEvent AutomationEventFromValue(const Napi::CallbackInfo &info, int index) +{ + return { + unsignedintFromValue(info, index + 0), + unsignedintFromValue(info, index + 1), + {intFromValue(info, index + 2), intFromValue(info, index + 3), intFromValue(info, index + 4), intFromValue(info, index + 5)}, + }; +} + +inline ModelAnimation ModelAnimationFromValue(const Napi::CallbackInfo& info, int index) { + return { + intFromValue(info, index + 0), + intFromValue(info, index + 1), + (BoneInfo *) pointerFromValue(info, index + 2), + (Transform **) pointerFromValue(info, index + 3), + charFromValue(info ,index+4) + }; +} + // Raylib API function bindings ${functions - .filter(({ name }) => !blocklist.includes(name)) - .filter(({ name }) => !byreflist.includes(name)) - .filter((func) => func.returnType !== 'void') - .map((func) => { return BindFunction(structs, func) }) - .join('\n') - } + .filter(({ name }) => !blocklist.includes(name)) + .filter(({ name }) => !byreflist.includes(name)) + .filter((func) => func.returnType !== "void") + .map((func) => { + return BindFunction(structs, func); + }) + .join("\n")} ${functions - .filter(({ name }) => !blocklist.includes(name)) - .filter(({ name }) => !byreflist.includes(name)) - .filter((func) => func.returnType === 'void') - .map((func) => { return BindVoidFunction(structs, func) }) - .join('\n') - } + .filter(({ name }) => !blocklist.includes(name)) + .filter(({ name }) => !byreflist.includes(name)) + .filter((func) => func.returnType === "void") + .map((func) => { + return BindVoidFunction(structs, func); + }) + .join("\n")} // By-Reference function bindings ${functions - .filter(({ name }) => !blocklist.includes(name)) - .filter(({ name }) => byreflist.includes(name)) - .map((func) => { return BindFunctionPassByRef(structs, func) }) - .join('\n') - } + .filter(({ name }) => !blocklist.includes(name)) + .filter(({ name }) => byreflist.includes(name)) + .map((func) => { + return BindFunctionPassByRef(structs, func); + }) + .join("\n")} // Shader Functions void BindSetShaderFloat(const Napi::CallbackInfo& info) { @@ -390,8 +434,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { ${functions .filter(({ name }) => !blocklist.includes(name)) .map(ExportFunctionBinding) - .join('\n ') - } + .join("\n ")} exports.Set("BindSetShaderFloat", Napi::Function::New(env, BindSetShaderFloat)); exports.Set("BindSetShaderInt", Napi::Function::New(env, BindSetShaderInt)); @@ -403,4 +446,4 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { } NODE_API_MODULE(addon, Init); -` +`; diff --git a/tools/generate_templates/node-raylib-definitions.js b/tools/generate_templates/node-raylib-definitions.js index 97fec4f..ae62a07 100644 --- a/tools/generate_templates/node-raylib-definitions.js +++ b/tools/generate_templates/node-raylib-definitions.js @@ -1,33 +1,38 @@ -const ArgumentTypeConversion = require('./ArgumentTypeConversion') +const ArgumentTypeConversion = require("./ArgumentTypeConversion"); const FunctionDefinition = (func) => { return `/** ${func.description} */ - export function ${func.name}(${!func.params - ? '' + export function ${func.name}(${ + !func.params + ? "" : func.params - .map(param => `${param.name}: ${ArgumentTypeConversion(param.type)}`) - .join(', ') - }): ${ArgumentTypeConversion(func.returnType)} - ` -} + .map( + (param) => `${param.name}: ${ArgumentTypeConversion(param.type)}` + ) + .join(", ") + }): ${ArgumentTypeConversion(func.returnType)} + `; +}; const StructInterface = (struct) => { return `/** ${struct.description} */ export interface ${struct.name} { ${struct.fields - .map(field => `/** ${field.description}. (${field.type}) */\n ${field.name}: ${ArgumentTypeConversion(field.type)}`) - .join('\n ') - } - }` -} + .filter((field) => !field.type.trim().startsWith("#")) + .map( + (field) => + `/** ${field.description}. (${field.type}) */\n ${ + field.name + }: ${ArgumentTypeConversion(field.type)}` + ) + .join("\n ")} + }`; +}; module.exports = ({ functions, structs, enums, blocklist }) => { return `// GENERATED CODE: DO NOT MODIFY declare module "raylib" { - ${structs - .map(StructInterface) - .join('\n ') - } + ${structs.map(StructInterface).join("\n ")} /** RenderTexture, fbo for texture rendering */ export type RenderTexture2D = RenderTexture @@ -44,10 +49,9 @@ declare module "raylib" { /** Quaternion, same as Vector4 */ export type Quaternion = Vector4 ${functions - .filter(({ name }) => !blocklist.includes(name)) - .map(FunctionDefinition) - .join('\n ') - } + .filter(({ name }) => !blocklist.includes(name)) + .map(FunctionDefinition) + .join("\n ")} /** Set shader uniform float */ export function SetShaderFloat(shader: Shader, locIndex: number, value: number): void @@ -60,10 +64,45 @@ declare module "raylib" { /** Set shader uniform Vec4 */ export function SetShaderVec4(shader: Shader, locIndex: number, value: Vector4): void + export function Camera3D( + /** Camera position. (Vector3) */ + position: Vector3, + /** Camera target it looks-at. (Vector3) */ + target: Vector3, + /** Camera up vector (rotation over its axis). (Vector3) */ + up: Vector3, + /** Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic. (float) */ + fovy: number, + /** Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC. (int) */ + projection: number, + ): Camera3D + + export function Vector3( + /** Vector x component. (float) */ + x: number, + /** Vector y component. (float) */ + y: number, + /** Vector z component. (float) */ + z: number, + ): Vector3 + + export function Vector2( + /** Vector x component. (float) */ + x: number, + /** Vector y component. (float) */ + y: number, + ): Vector2 + ${enums - .map((e) => { return e.values.map(v => ` /** ${v.description} */\n export const ${v.name} = ${v.value}`).join('\n') }) - .join('\n') - } + .map((e) => { + return e.values + .map( + (v) => + ` /** ${v.description} */\n export const ${v.name} = ${v.value}` + ) + .join("\n"); + }) + .join("\n")} export const LIGHTGRAY: { r: 200, g: 200, b: 200, a: 255 } export const GRAY: { r: 130, g: 130, b: 130, a: 255 } @@ -91,6 +130,8 @@ declare module "raylib" { export const BLANK: { r: 0, g: 0, b: 0, a: 0 } export const MAGENTA: { r: 255, g: 0, b: 255, a: 255 } export const RAYWHITE: { r: 245, g: 245, b: 245, a: 255 } + + } -` -} +`; +}; diff --git a/tools/pkg.js b/tools/pkg.js index 95867d9..b516199 100644 --- a/tools/pkg.js +++ b/tools/pkg.js @@ -1,7 +1,7 @@ const { exec } = require('pkg') const archiver = require('archiver') -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') // Options let binaryFilename = 'node-raylib' diff --git a/tools/postinstall.js b/tools/postinstall.js index f619369..5afcaa6 100644 --- a/tools/postinstall.js +++ b/tools/postinstall.js @@ -1,80 +1,100 @@ // this is run after npm install // download pre-made module, if possible & exit 1, or exit 0 to tell system if it needs to build -const { promises: fs } = require('fs') -const path = require('path') -const fetch = require('cross-fetch') +const { fs } = require("node:fs/promises"); +const path = require("node:path"); +const fetch = require("cross-fetch"); -let targetPath = path.join(__dirname, '..', 'build', 'Release', 'node-raylib.node') +let targetPath = path.join( + __dirname, + "..", + "build", + "Release", + "node-raylib.node" +); -function toBuffer (ab) { - const buf = Buffer.alloc(ab.byteLength) - const view = new Uint8Array(ab) +const { version } = require("../package.json"); + +function toBuffer(ab) { + const buf = Buffer.alloc(ab.byteLength); + const view = new Uint8Array(ab); for (let i = 0; i < buf.length; ++i) { - buf[i] = view[i] + buf[i] = view[i]; } - return buf + return buf; } -async function exists (path) { +async function exists(path) { try { - await fs.access(path) - return true + await fs.access(path); + return true; } catch { - return false + return false; } } -async function main () { +async function main() { if (await exists(targetPath)) { - console.log('Found node-raylib.node.') - process.exit(0) + console.log("Found node-raylib.node."); + process.exit(0); } - let url = `https://github.com/RobLoach/node-raylib/releases/download/v${process.env.npm_package_version}/node-raylib-${process.platform}-${process.arch}.node` + let url = `https://github.com/RobLoach/node-raylib/releases/download/v${version}/node-raylib-${process.platform}-${process.arch}.node`; - console.log(`Checking for ${url}`) + console.log(`Checking for ${url}`); try { - await fs.mkdir(path.join(__dirname, '..', 'build')) + await fs.mkdir(path.join(__dirname, "..", "build")); } catch (e) {} try { - await fs.mkdir(path.join(__dirname, '..', 'build', 'Release')) + await fs.mkdir(path.join(__dirname, "..", "build", "Release")); } catch (e) {} - if (process.platform === 'linux' && (process.arch === 'arm' || process.arch === 'arm64')) { - targetPath = path.join(__dirname, '..', 'build', 'Release', 'node-raylib-drm.node') - url = `https://github.com/RobLoach/node-raylib/releases/download/v${process.env.npm_package_version}/node-raylib-${process.platform}-${process.arch}-drm.node` + if ( + process.platform === "linux" && + (process.arch === "arm" || process.arch === "arm64") + ) { + targetPath = path.join( + __dirname, + "..", + "build", + "Release", + "node-raylib-drm.node" + ); + url = `https://github.com/RobLoach/node-raylib/releases/download/v${version}/node-raylib-${process.platform}-${process.arch}-drm.node`; try { - const data = await fetch(url).then(r => { - if (r.status !== 200) { - throw new Error(`Status: ${r.status}`) - } - return r - }).then(r => r.arrayBuffer()) - await fs.writeFile(targetPath, toBuffer(data)) - console.log('Found DRM on releases.') - } catch (e) { - } + const data = await fetch(url) + .then((r) => { + if (r.status !== 200) { + throw new Error(`Status: ${r.status}`); + } + return r; + }) + .then((r) => r.arrayBuffer()); + await fs.writeFile(targetPath, toBuffer(data)); + console.log("Found DRM on releases."); + } catch (e) {} } try { - const data = await fetch(url).then(r => { - if (r.status !== 200) { - throw new Error(`Status: ${r.status}`) - } - return r - }).then(r => r.arrayBuffer()) - await fs.writeFile(targetPath, toBuffer(data)) - console.log('Found on releases.') - process.exit(0) + const data = await fetch(url) + .then((r) => { + if (r.status !== 200) { + throw new Error(`Status: ${r.status}`); + } + return r; + }) + .then((r) => r.arrayBuffer()); + await fs.writeFile(targetPath, toBuffer(data)); + console.log("Found on releases."); + process.exit(0); } catch (e) { - console.error(e.message) + console.error(e.message); } // couldn't find it, so tell postinstall to compile it - console.log('Not found. Building.') - process.exit(1) + console.log("Not found. Building."); + process.exit(1); } -main() +main();