diff --git a/CMakeLists.txt b/CMakeLists.txt index e3955fb..e7d02a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,13 +23,13 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") # version doesn't seem to pick correct version -#find_package(raylib 4.0 QUIET EXACT) +#find_package(raylib 4.2 QUIET EXACT) if (NOT raylib_FOUND) include(FetchContent) FetchContent_Declare( raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git - GIT_TAG 4.0.0 + GIT_TAG 4.2.0 GIT_SHALLOW TRUE ) FetchContent_GetProperties(raylib) diff --git a/docs/API.md b/docs/API.md index 34e75af..2c30c88 100644 --- a/docs/API.md +++ b/docs/API.md @@ -35,7 +35,7 @@

Check if one specific window flag is enabled

SetWindowState(flags)undefined
-

Set window configuration state using flags

+

Set window configuration state using flags (only PLATFORM_DESKTOP)

ClearWindowState(flags)undefined

Clear window configuration state flags

@@ -70,6 +70,9 @@
SetWindowSize(width, height)undefined

Set window dimensions

+
SetWindowOpacity(opacity)undefined
+

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

+
GetWindowHandle()number

Get native window handle

@@ -79,6 +82,12 @@
GetScreenHeight()number

Get current screen height

+
GetRenderWidth()number
+

Get current render width (it considers HiDPI)

+
+
GetRenderHeight()number
+

Get current render height (it considers HiDPI)

+
GetMonitorCount()number

Get number of connected monitors

@@ -89,10 +98,10 @@

Get specified monitor position

GetMonitorWidth(monitor)number
-

Get specified monitor width (max available by monitor)

+

Get specified monitor width (current video mode used by monitor)

GetMonitorHeight(monitor)number
-

Get specified monitor height (max available by monitor)

+

Get specified monitor height (current video mode used by monitor)

GetMonitorPhysicalWidth(monitor)number

Get specified monitor physical width in millimetres

@@ -118,14 +127,20 @@
GetClipboardText()string

Get clipboard text 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(ms)undefined
-

Wait for some milliseconds (halt program execution)

+
WaitTime(seconds)undefined
+

Wait for some time (halt program execution)

ShowCursor()undefined

Shows cursor

@@ -226,15 +241,15 @@
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

-
SetTargetFPS(fps)undefined

Set target FPS (maximum)

@@ -271,6 +286,9 @@
MemFree(ptr)undefined

Internal memory free

+
OpenURL(url)undefined
+

Open URL with default system browser (if available)

+
LoadFileData(fileName, bytesRead)Buffer

Load file data as byte array (read)

@@ -280,6 +298,9 @@
SaveFileData(fileName, data, bytesToWrite)boolean

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

+
ExportDataAsCode(data, size, fileName)boolean
+

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

+
LoadFileText(fileName)string

Load text data from file (read), returns a '\0' terminated string

@@ -298,6 +319,9 @@
IsFileExtension(fileName, ext)boolean

Check file extension (including point: .png, .wav)

+
GetFileLength(fileName)number
+

Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)

+
GetFileExtension(fileName)string

Get pointer to extension for a filename string (includes dot: '.png')

@@ -316,47 +340,47 @@
GetWorkingDirectory()string

Get current working directory (uses static string)

-
GetDirectoryFiles(dirPath, count)number
-

Get filenames in a directory path (memory should be freed)

-
-
ClearDirectoryFiles()undefined
-

Clear directory files paths buffers (free memory)

+
GetApplicationDirectory()string
+

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

ChangeDirectory(dir)boolean

Change working directory, return true on success

+
IsPathFile(path)boolean
+

Check if a given path is a file or a directory

+
+
LoadDirectoryFiles(dirPath)FilePathList
+

Load directory filepaths

+
+
LoadDirectoryFilesEx(basePath, filter, scanSubdirs)FilePathList
+

Load directory filepaths with extension filtering and recursive directory scan

+
+
UnloadDirectoryFiles(files)undefined
+

Unload filepaths

+
IsFileDropped()boolean

Check if a file has been dropped into window

-
GetDroppedFiles(count)number
-

Get dropped files names (memory should be freed)

+
LoadDroppedFiles()FilePathList
+

Load dropped filepaths

-
ClearDroppedFiles()undefined
-

Clear dropped files paths buffer (free memory)

+
UnloadDroppedFiles(files)undefined
+

Unload dropped filepaths

GetFileModTime(fileName)number

Get file modification time (last write time)

-
CompressData(data, dataLength, compDataLength)Buffer
-

Compress data (DEFLATE algorithm)

-
-
DecompressData(compData, compDataLength, dataLength)Buffer
-

Decompress data (DEFLATE algorithm)

-
-
EncodeDataBase64(data, dataLength, outputLength)string
-

Encode data to Base64 string

-
-
DecodeDataBase64(data, outputLength)Buffer
-

Decode Base64 string data

+
CompressData(data, dataSize, compDataSize)Buffer
+

Compress data (DEFLATE algorithm), memory must be MemFree()

-
SaveStorageValue(position, value)boolean
-

Save integer value to storage file (to defined position), returns true on success

+
DecompressData(compData, compDataSize, dataSize)Buffer
+

Decompress data (DEFLATE algorithm), memory must be MemFree()

-
LoadStorageValue(position)number
-

Load integer value from storage file (from defined position)

+
EncodeDataBase64(data, dataSize, outputSize)string
+

Encode data to Base64 string, memory must be MemFree()

-
OpenURL(url)undefined
-

Open URL with default system browser (if available)

+
DecodeDataBase64(data, outputSize)Buffer
+

Decode Base64 string data, memory must be MemFree()

IsKeyPressed(key)boolean

Check if a key has been pressed once

@@ -443,7 +467,10 @@

Set mouse scaling

GetMouseWheelMove()number
-

Get mouse wheel movement Y

+

Get mouse wheel movement for X or Y, whichever is larger

+
+
GetMouseWheelMoveV()Vector2
+

Get mouse wheel movement for both X and Y

SetMouseCursor(cursor)undefined

Set mouse cursor

@@ -821,7 +848,7 @@

Load font from file into GPU memory (VRAM)

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

Load font from file with extended parameters

+

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

LoadFontFromImage(image, key, firstChar)Font

Load font from Image (XNA style)

@@ -839,7 +866,10 @@

Unload font chars info data (RAM)

UnloadFont(font)undefined
-

Unload Font from GPU memory (VRAM)

+

Unload font from GPU memory (VRAM)

+
+
ExportFontAsCode(font, fileName)boolean
+

Export font as code file, returns true on success

DrawFPS(posX, posY)undefined

Draw current FPS

@@ -856,6 +886,9 @@
DrawTextCodepoint(font, codepoint, position, fontSize, tint)undefined

Draw one character (codepoint)

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

Draw multiple character (codepoint)

+
MeasureText(text, fontSize)number

Measure string width for default font

@@ -1108,9 +1141,6 @@
GetRayCollisionBox(ray, box)RayCollision

Get collision info between ray and box

-
GetRayCollisionModel(ray, model)RayCollision
-

Get collision info between ray and model

-
GetRayCollisionMesh(ray, mesh, transform)RayCollision

Get collision info between ray and mesh

@@ -1189,11 +1219,14 @@
SetSoundPitch(sound, pitch)undefined

Set pitch for a sound (1.0 is base level)

+
SetSoundPan(sound, pan)undefined
+

Set pan for a sound (0.5 is center)

+
WaveCopy(wave)Wave

Copy a wave to a new wave

LoadWaveSamples(wave)number
-

Load samples data from wave as a floats array

+

Load samples data from wave as a 32bit float data array

UnloadWaveSamples(samples)undefined

Unload samples data loaded with LoadWaveSamples()

@@ -1234,6 +1267,9 @@
SetMusicPitch(music, pitch)undefined

Set pitch for a music (1.0 is base level)

+
SetMusicPan(music, pan)undefined
+

Set pan for a music (0.5 is center)

+
GetMusicTimeLength(music)number

Get music time length (in seconds)

@@ -1273,9 +1309,96 @@
SetAudioStreamPitch(stream, pitch)undefined

Set pitch for audio stream (1.0 is base level)

+
SetAudioStreamPan(stream, pan)undefined
+

Set pan for audio stream (0.5 is centered)

+
SetAudioStreamBufferSizeDefault(size)undefined

Default size for new audio streams

+
EaseLinearNone(t, b, c, d)number
+

Ease: Linear

+
+
EaseLinearIn(t, b, c, d)number
+

Ease: Linear In

+
+
EaseLinearOut(t, b, c, d)number
+

Ease: Linear Out

+
+
EaseLinearInOut(t, b, c, d)number
+

Ease: Linear In Out

+
+
EaseSineIn(t, b, c, d)number
+

Ease: Sine In

+
+
EaseSineOut(t, b, c, d)number
+

Ease: Sine Out

+
+
EaseSineInOut(t, b, c, d)number
+

Ease: Sine Out

+
+
EaseCircIn(t, b, c, d)number
+

Ease: Circular In

+
+
EaseCircOut(t, b, c, d)number
+

Ease: Circular Out

+
+
EaseCircInOut(t, b, c, d)number
+

Ease: Circular In Out

+
+
EaseCubicIn(t, b, c, d)number
+

Ease: Cubic In

+
+
EaseCubicOut(t, b, c, d)number
+

Ease: Cubic Out

+
+
EaseCubicInOut(t, b, c, d)number
+

Ease: Cubic In Out

+
+
EaseQuadIn(t, b, c, d)number
+

Ease: Quadratic In

+
+
EaseQuadOut(t, b, c, d)number
+

Ease: Quadratic Out

+
+
EaseQuadInOut(t, b, c, d)number
+

Ease: Quadratic In Out

+
+
EaseExpoIn(t, b, c, d)number
+

Ease: Exponential In

+
+
EaseExpoOut(t, b, c, d)number
+

Ease: Exponential Out

+
+
EaseExpoInOut(t, b, c, d)number
+

Ease: Exponential In Out

+
+
EaseBackIn(t, b, c, d)number
+

Ease: Back In

+
+
EaseBackOut(t, b, c, d)number
+

Ease: Back Out

+
+
EaseBackInOut(t, b, c, d)number
+

Ease: Back In Out

+
+
EaseBounceOut(t, b, c, d)number
+

Ease: Bounce Out

+
+
EaseBounceIn(t, b, c, d)number
+

Ease: Bounce In

+
+
EaseBounceInOut(t, b, c, d)number
+

Ease: Bounce In Out

+
+
EaseElasticIn(t, b, c, d)number
+

Ease: Elastic In

+
+
EaseElasticOut(t, b, c, d)number
+

Ease: Elastic Out

+
+
EaseElasticInOut(t, b, c, d)number
+

Ease: Elastic In Out

+
GuiEnable()undefined

Enable gui controls (global state)

@@ -1321,10 +1444,10 @@
GuiLine(bounds, text)undefined

Line separator control, could contain text

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

Panel control, useful to group controls

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

Scroll Panel control

GuiLabel(bounds, text)undefined
@@ -1378,11 +1501,8 @@
GuiDummyRec(bounds, text)undefined

Dummy control for placeholders

-
GuiScrollBar(bounds, value, minValue, maxValue)number
-

Scroll Bar control

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

Grid control

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

Grid control, returns mouse cell position

GuiListView(bounds, text, scrollIndex, active)number

List View control, returns selected list item index

@@ -1393,19 +1513,19 @@
GuiMessageBox(bounds, title, message, buttons)number

Message Box control, displays a message

-
GuiTextInputBox(bounds, title, message, buttons, text)number
-

Text Input Box control, ask for text

+
GuiTextInputBox(bounds, title, message, buttons, text, textMaxSize, secretViewActive)number
+

Text Input Box control, ask for text, supports secret

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

Color Picker control (multiple color controls)

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

Color Panel control

-
GuiColorBarAlpha(bounds, alpha)number
+
GuiColorBarAlpha(bounds, text, alpha)number

Color Bar Alpha control

-
GuiColorBarHue(bounds, value)number
+
GuiColorBarHue(bounds, text, value)number

Color Bar Hue control

GuiLoadStyle(fileName)undefined
@@ -1426,6 +1546,9 @@
GuiSetIconData(iconId, data)undefined

Set icon bit data

+
GuiSetIconScale(scale)undefined
+

Set icon scale (1 by default)

+
GuiSetIconPixel(iconId, x, y)undefined

Set icon pixel value

@@ -1435,6 +1558,402 @@
GuiCheckIconPixel(iconId, x, y)boolean

Check icon pixel value

+
rlMatrixMode(mode)undefined
+

Choose the current matrix to be transformed

+
+
rlPushMatrix()undefined
+

Push the current matrix to stack

+
+
rlPopMatrix()undefined
+

Pop lattest inserted matrix from stack

+
+
rlLoadIdentity()undefined
+

Reset current matrix to identity matrix

+
+
rlTranslatef(x, y, z)undefined
+

Multiply the current matrix by a translation matrix

+
+
rlRotatef(angle, x, y, z)undefined
+

Multiply the current matrix by a rotation matrix

+
+
rlScalef(x, y, z)undefined
+

Multiply the current matrix by a scaling matrix

+
+
rlMultMatrixf(matf)undefined
+

Multiply the current matrix by another matrix

+
+
rlViewport(x, y, width, height)undefined
+

Set the viewport area

+
+
rlBegin(mode)undefined
+

Initialize drawing mode (how to organize vertex)

+
+
rlEnd()undefined
+

Finish vertex providing

+
+
rlVertex2i(x, y)undefined
+

Define one vertex (position) - 2 int

+
+
rlVertex2f(x, y)undefined
+

Define one vertex (position) - 2 float

+
+
rlVertex3f(x, y, z)undefined
+

Define one vertex (position) - 3 float

+
+
rlTexCoord2f(x, y)undefined
+

Define one vertex (texture coordinate) - 2 float

+
+
rlNormal3f(x, y, z)undefined
+

Define one vertex (normal) - 3 float

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

Define one vertex (color) - 4 byte

+
+
rlColor3f(x, y, z)undefined
+

Define one vertex (color) - 3 float

+
+
rlColor4f(x, y, z, w)undefined
+

Define one vertex (color) - 4 float

+
+
rlEnableVertexArray(vaoId)boolean
+

Enable vertex array (VAO, if supported)

+
+
rlDisableVertexArray()undefined
+

Disable vertex array (VAO, if supported)

+
+
rlEnableVertexBuffer(id)undefined
+

Enable vertex buffer (VBO)

+
+
rlDisableVertexBuffer()undefined
+

Disable vertex buffer (VBO)

+
+
rlEnableVertexBufferElement(id)undefined
+

Enable vertex buffer element (VBO element)

+
+
rlDisableVertexBufferElement()undefined
+

Disable vertex buffer element (VBO element)

+
+
rlEnableVertexAttribute(index)undefined
+

Enable vertex attribute index

+
+
rlDisableVertexAttribute(index)undefined
+

Disable vertex attribute index

+
+
rlActiveTextureSlot(slot)undefined
+

Select and active a texture slot

+
+
rlEnableTexture(id)undefined
+

Enable texture

+
+
rlDisableTexture()undefined
+

Disable texture

+
+
rlEnableTextureCubemap(id)undefined
+

Enable texture cubemap

+
+
rlDisableTextureCubemap()undefined
+

Disable texture cubemap

+
+
rlTextureParameters(id, param, value)undefined
+

Set texture parameters (filter, wrap)

+
+
rlEnableShader(id)undefined
+

Enable shader program

+
+
rlDisableShader()undefined
+

Disable shader program

+
+
rlEnableFramebuffer(id)undefined
+

Enable render texture (fbo)

+
+
rlDisableFramebuffer()undefined
+

Disable render texture (fbo), return to default framebuffer

+
+
rlActiveDrawBuffers(count)undefined
+

Activate multiple draw color buffers

+
+
rlEnableColorBlend()undefined
+

Enable color blending

+
+
rlDisableColorBlend()undefined
+

Disable color blending

+
+
rlEnableDepthTest()undefined
+

Enable depth test

+
+
rlDisableDepthTest()undefined
+

Disable depth test

+
+
rlEnableDepthMask()undefined
+

Enable depth write

+
+
rlDisableDepthMask()undefined
+

Disable depth write

+
+
rlEnableBackfaceCulling()undefined
+

Enable backface culling

+
+
rlDisableBackfaceCulling()undefined
+

Disable backface culling

+
+
rlEnableScissorTest()undefined
+

Enable scissor test

+
+
rlDisableScissorTest()undefined
+

Disable scissor test

+
+
rlScissor(x, y, width, height)undefined
+

Scissor test

+
+
rlEnableWireMode()undefined
+

Enable wire mode

+
+
rlDisableWireMode()undefined
+

Disable wire mode

+
+
rlSetLineWidth(width)undefined
+

Set the line drawing width

+
+
rlGetLineWidth()number
+

Get the line drawing width

+
+
rlEnableSmoothLines()undefined
+

Enable line aliasing

+
+
rlDisableSmoothLines()undefined
+

Disable line aliasing

+
+
rlEnableStereoRender()undefined
+

Enable stereo rendering

+
+
rlDisableStereoRender()undefined
+

Disable stereo rendering

+
+
rlIsStereoRenderEnabled()boolean
+

Check if stereo render is enabled

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

Clear color buffer with color

+
+
rlClearScreenBuffers()undefined
+

Clear used screen buffers (color and depth)

+
+
rlCheckErrors()undefined
+

Check and log OpenGL error codes

+
+
rlSetBlendMode(mode)undefined
+

Set blending mode

+
+
rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation)undefined
+

Set blending mode factor and equation (using OpenGL factors)

+
+
rlglInit(width, height)undefined
+

Initialize rlgl (buffers, shaders, textures, states)

+
+
rlglClose()undefined
+

De-inititialize rlgl (buffers, shaders, textures)

+
+
rlLoadExtensions(loader)undefined
+

Load OpenGL extensions (loader function required)

+
+
rlGetVersion()number
+

Get current OpenGL version

+
+
rlSetFramebufferWidth(width)undefined
+

Set current framebuffer width

+
+
rlGetFramebufferWidth()number
+

Get default framebuffer width

+
+
rlSetFramebufferHeight(height)undefined
+

Set current framebuffer height

+
+
rlGetFramebufferHeight()number
+

Get default framebuffer height

+
+
rlGetTextureIdDefault()number
+

Get default texture id

+
+
rlGetShaderIdDefault()number
+

Get default shader id

+
+
rlGetShaderLocsDefault()number
+

Get default shader locations

+
+
rlLoadRenderBatch(numBuffers, bufferElements)rlRenderBatch
+

Load a render batch system

+
+
rlUnloadRenderBatch(batch)undefined
+

Unload render batch system

+
+
rlDrawRenderBatch(batch)undefined
+

Draw render batch data (Update->Draw->Reset)

+
+
rlSetRenderBatchActive(batch)undefined
+

Set the active render batch for rlgl (NULL for default internal)

+
+
rlDrawRenderBatchActive()undefined
+

Update and draw internal render batch

+
+
rlCheckRenderBatchLimit(vCount)boolean
+

Check internal buffer overflow for a given number of vertex

+
+
rlSetTexture(id)undefined
+

Set current texture for render batch and check buffers limits

+
+
rlLoadVertexArray()number
+

Load vertex array (vao) if supported

+
+
rlLoadVertexBuffer(buffer, size, dynamic)number
+

Load a vertex buffer attribute

+
+
rlLoadVertexBufferElement(buffer, size, dynamic)number
+

Load a new attributes element buffer

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

Update GPU buffer with new data

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

Update vertex buffer elements with new data

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

Set vertex attribute default value

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

Load texture in GPU

+
+
rlLoadTextureDepth(width, height, useRenderBuffer)number
+

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

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

Load texture cubemap

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

Update GPU texture with new data

+
+
rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType)undefined
+

Get OpenGL internal formats

+
+
rlGetPixelFormatName(format)string
+

Get name string for pixel format

+
+
rlUnloadTexture(id)undefined
+

Unload texture from GPU memory

+
+
rlGenTextureMipmaps(id, width, height, format, mipmaps)undefined
+

Generate mipmap data for selected texture

+
+
rlReadTexturePixels(id, width, height, format)number
+

Read texture pixel data

+
+
rlReadScreenPixels(width, height)Buffer
+

Read screen pixel data (color buffer)

+
+
rlLoadFramebuffer(width, height)number
+

Load an empty framebuffer

+
+
rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel)undefined
+

Attach texture/renderbuffer to a framebuffer

+
+
rlFramebufferComplete(id)boolean
+

Verify framebuffer is complete

+
+
rlUnloadFramebuffer(id)undefined
+

Delete framebuffer from GPU

+
+
rlLoadShaderCode(vsCode, fsCode)number
+

Load shader from code strings

+
+
rlCompileShader(shaderCode, type)number
+

Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER)

+
+
rlLoadShaderProgram(vShaderId, fShaderId)number
+

Load custom shader program

+
+
rlUnloadShaderProgram(id)undefined
+

Unload shader program

+
+
rlGetLocationUniform(shaderId, uniformName)number
+

Get shader location uniform

+
+
rlGetLocationAttrib(shaderId, attribName)number
+

Get shader location attribute

+
+
rlSetUniform(locIndex, value, uniformType, count)undefined
+

Set shader value uniform

+
+
rlSetUniformMatrix(locIndex, mat)undefined
+

Set shader value matrix

+
+
rlSetUniformSampler(locIndex, textureId)undefined
+

Set shader value sampler

+
+
rlSetShader(id, locs)undefined
+

Set shader currently active (id and locations)

+
+
rlLoadComputeShaderProgram(shaderId)number
+

Load compute shader program

+
+
rlComputeShaderDispatch(groupX, groupY, groupZ)undefined
+

Dispatch compute shader (equivalent to draw for graphics pilepine)

+
+
rlLoadShaderBuffer(size, data, usageHint)number
+

Load shader storage buffer object (SSBO)

+
+
rlUnloadShaderBuffer(ssboId)undefined
+

Unload shader storage buffer object (SSBO)

+
+
rlUpdateShaderBufferElements(id, data, dataSize, offset)undefined
+

Update SSBO buffer data

+
+
rlGetShaderBufferSize(id)BigInt
+

Get SSBO buffer size

+
+
rlReadShaderBufferElements(id, dest, count, offset)undefined
+

Bind SSBO buffer

+
+
rlBindShaderBuffer(id, index)undefined
+

Copy SSBO buffer data

+
+
rlCopyBuffersElements(destId, srcId, destOffset, srcOffset, count)undefined
+

Copy SSBO buffer data

+
+
rlBindImageTexture(id, index, format, readonly)undefined
+

Bind image texture

+
+
rlGetMatrixModelview()Matrix
+

Get internal modelview matrix

+
+
rlGetMatrixProjection()Matrix
+

Get internal projection matrix

+
+
rlGetMatrixTransform()Matrix
+

Get internal accumulated transform matrix

+
+
rlGetMatrixProjectionStereo(eye)Matrix
+

Get internal projection matrix for stereo render (selected eye)

+
+
rlGetMatrixViewOffsetStereo(eye)Matrix
+

Get internal view offset matrix for stereo render (selected eye)

+
+
rlSetMatrixProjection(proj)undefined
+

Set a custom projection matrix (replaces internal projection matrix)

+
+
rlSetMatrixModelview(view)undefined
+

Set a custom modelview matrix (replaces internal modelview matrix)

+
+
rlSetMatrixProjectionStereo(right, left)undefined
+

Set eyes projection matrices for stereo rendering

+
+
rlSetMatrixViewOffsetStereo(right, left)undefined
+

Set eyes view offsets matrices for stereo rendering

+
+
rlLoadDrawCube()undefined
+

Load and draw a cube

+
+
rlLoadDrawQuad()undefined
+

Load and draw a quad

+
UpdateCamera(camera)undefined

Update camera position for selected mode

@@ -1555,18 +2074,15 @@
GenMeshTangents(mesh)undefined

Compute mesh tangents

-
GenMeshBinormals(mesh)undefined
-

Compute mesh binormals

-
SetModelMeshMaterial(model, meshId, materialId)undefined

Set material for a mesh

-
WaveFormat(wave, sampleRate, sampleSize, channels)undefined
-

Convert wave data to desired format

-
WaveCrop(wave, initSample, finalSample)undefined

Crop a wave to defined samples range

+
WaveFormat(wave, sampleRate, sampleSize, channels)undefined
+

Convert wave data to desired format

+
Color(r, g, b, a)Color

Color, 4 components, R8G8B8A8 (32bit)

@@ -1695,7 +2211,7 @@ Check if one specific window flag is enabled ## SetWindowState(flags) ⇒ undefined -Set window configuration state using flags +Set window configuration state using flags (only PLATFORM_DESKTOP) **Kind**: global function @@ -1807,6 +2323,17 @@ Set window dimensions | width | number | | height | number | + + +## SetWindowOpacity(opacity) ⇒ undefined +Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| opacity | number | + ## GetWindowHandle() ⇒ number @@ -1826,6 +2353,20 @@ Get current screen width ## GetScreenHeight() ⇒ number Get current screen height +**Kind**: global function +**Returns**: number - The resulting int. + + +## GetRenderWidth() ⇒ number +Get current render width (it considers HiDPI) + +**Kind**: global function +**Returns**: number - The resulting int. + + +## GetRenderHeight() ⇒ number +Get current render height (it considers HiDPI) + **Kind**: global function **Returns**: number - The resulting int. @@ -1857,7 +2398,7 @@ Get specified monitor position ## GetMonitorWidth(monitor) ⇒ number -Get specified monitor width (max available by monitor) +Get specified monitor width (current video mode used by monitor) **Kind**: global function **Returns**: number - The resulting int. @@ -1869,7 +2410,7 @@ Get specified monitor width (max available by monitor) ## GetMonitorHeight(monitor) ⇒ number -Get specified monitor height (max available by monitor) +Get specified monitor height (current video mode used by monitor) **Kind**: global function **Returns**: number - The resulting int. @@ -1958,6 +2499,18 @@ Get clipboard text content **Kind**: global function **Returns**: string - The resulting const char *. + + +## EnableEventWaiting() ⇒ undefined +Enable waiting for events on EndDrawing(), no automatic event polling + +**Kind**: global function + + +## DisableEventWaiting() ⇒ undefined +Disable waiting for events on EndDrawing(), automatic events polling + +**Kind**: global function ## SwapScreenBuffer() ⇒ undefined @@ -1972,14 +2525,14 @@ Register all input events **Kind**: global function -## WaitTime(ms) ⇒ undefined -Wait for some milliseconds (halt program execution) +## WaitTime(seconds) ⇒ undefined +Wait for some time (halt program execution) **Kind**: global function | Param | Type | | --- | --- | -| ms | number | +| seconds | number | @@ -2292,6 +2845,19 @@ Get the screen space position for a 3d world space position | position | [Vector3](#Vector3) | | camera | Camera | + + +## GetScreenToWorld2D(position, camera) ⇒ [Vector2](#Vector2) +Get the world space position for a 2d camera screen space position + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. + +| Param | Type | +| --- | --- | +| position | [Vector2](#Vector2) | +| camera | [Camera2D](#Camera2D) | + ## GetWorldToScreenEx(position, camera, width, height) ⇒ [Vector2](#Vector2) @@ -2320,19 +2886,6 @@ Get the screen space position for a 2d camera world space position | position | [Vector2](#Vector2) | | camera | [Camera2D](#Camera2D) | - - -## GetScreenToWorld2D(position, camera) ⇒ [Vector2](#Vector2) -Get the world space position for a 2d camera screen space position - -**Kind**: global function -**Returns**: [Vector2](#Vector2) - The resulting Vector2. - -| Param | Type | -| --- | --- | -| position | [Vector2](#Vector2) | -| camera | [Camera2D](#Camera2D) | - ## SetTargetFPS(fps) ⇒ undefined @@ -2458,10 +3011,21 @@ Internal memory free | --- | --- | | ptr | number | - + -## LoadFileData(fileName, bytesRead) ⇒ Buffer -Load file data as byte array (read) +## OpenURL(url) ⇒ undefined +Open URL with default system browser (if available) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| url | string | + + + +## LoadFileData(fileName, bytesRead) ⇒ Buffer +Load file data as byte array (read) **Kind**: global function **Returns**: Buffer - The resulting unsigned char *. @@ -2496,6 +3060,20 @@ Save data to file from byte array (write), returns true on success | data | number | | bytesToWrite | number | + + +## ExportDataAsCode(data, size, fileName) ⇒ boolean +Export data to code (.h), returns true on success + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| data | string | +| size | number | +| fileName | string | + ## LoadFileText(fileName) ⇒ string @@ -2569,6 +3147,18 @@ Check file extension (including point: .png, .wav) | fileName | string | | ext | string | + + +## GetFileLength(fileName) ⇒ number +Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| fileName | string | + ## GetFileExtension(fileName) ⇒ string @@ -2636,25 +3226,13 @@ Get current working directory (uses static string) **Kind**: global function **Returns**: string - The resulting const char *. - - -## GetDirectoryFiles(dirPath, count) ⇒ number -Get filenames in a directory path (memory should be freed) - -**Kind**: global function -**Returns**: number - The resulting char **. - -| Param | Type | -| --- | --- | -| dirPath | string | -| count | number | + - - -## ClearDirectoryFiles() ⇒ undefined -Clear directory files paths buffers (free memory) +## GetApplicationDirectory() ⇒ string +Get the directory if the running application (uses static string) **Kind**: global function +**Returns**: string - The resulting const char *. ## ChangeDirectory(dir) ⇒ boolean @@ -2667,89 +3245,96 @@ Change working directory, return true on success | --- | --- | | dir | string | - + -## IsFileDropped() ⇒ boolean -Check if a file has been dropped into window +## IsPathFile(path) ⇒ boolean +Check if a given path is a file or a directory **Kind**: global function **Returns**: boolean - The resulting bool. - -## GetDroppedFiles(count) ⇒ number -Get dropped files names (memory should be freed) +| Param | Type | +| --- | --- | +| path | string | + + + +## LoadDirectoryFiles(dirPath) ⇒ FilePathList +Load directory filepaths **Kind**: global function -**Returns**: number - The resulting char **. +**Returns**: FilePathList - The resulting FilePathList. | Param | Type | | --- | --- | -| count | number | +| dirPath | string | - + -## ClearDroppedFiles() ⇒ undefined -Clear dropped files paths buffer (free memory) +## LoadDirectoryFilesEx(basePath, filter, scanSubdirs) ⇒ FilePathList +Load directory filepaths with extension filtering and recursive directory scan **Kind**: global function - +**Returns**: FilePathList - The resulting FilePathList. -## GetFileModTime(fileName) ⇒ number -Get file modification time (last write time) +| Param | Type | +| --- | --- | +| basePath | string | +| filter | string | +| scanSubdirs | boolean | + + + +## UnloadDirectoryFiles(files) ⇒ undefined +Unload filepaths **Kind**: global function -**Returns**: number - The resulting long. | Param | Type | | --- | --- | -| fileName | string | +| files | FilePathList | - + -## CompressData(data, dataLength, compDataLength) ⇒ Buffer -Compress data (DEFLATE algorithm) +## IsFileDropped() ⇒ boolean +Check if a file has been dropped into window **Kind**: global function -**Returns**: Buffer - The resulting unsigned char *. +**Returns**: boolean - The resulting bool. + -| Param | Type | -| --- | --- | -| data | Buffer | -| dataLength | number | -| compDataLength | number | +## LoadDroppedFiles() ⇒ FilePathList +Load dropped filepaths - +**Kind**: global function +**Returns**: FilePathList - The resulting FilePathList. + -## DecompressData(compData, compDataLength, dataLength) ⇒ Buffer -Decompress data (DEFLATE algorithm) +## UnloadDroppedFiles(files) ⇒ undefined +Unload dropped filepaths **Kind**: global function -**Returns**: Buffer - The resulting unsigned char *. | Param | Type | | --- | --- | -| compData | Buffer | -| compDataLength | number | -| dataLength | number | +| files | FilePathList | - + -## EncodeDataBase64(data, dataLength, outputLength) ⇒ string -Encode data to Base64 string +## GetFileModTime(fileName) ⇒ number +Get file modification time (last write time) **Kind**: global function -**Returns**: string - The resulting char *. +**Returns**: number - The resulting long. | Param | Type | | --- | --- | -| data | Buffer | -| dataLength | number | -| outputLength | number | +| fileName | string | - + -## DecodeDataBase64(data, outputLength) ⇒ Buffer -Decode Base64 string data +## CompressData(data, dataSize, compDataSize) ⇒ Buffer +Compress data (DEFLATE algorithm), memory must be MemFree() **Kind**: global function **Returns**: Buffer - The resulting unsigned char *. @@ -2757,43 +3342,49 @@ Decode Base64 string data | Param | Type | | --- | --- | | data | Buffer | -| outputLength | number | +| dataSize | number | +| compDataSize | number | - + -## SaveStorageValue(position, value) ⇒ boolean -Save integer value to storage file (to defined position), returns true on success +## DecompressData(compData, compDataSize, dataSize) ⇒ Buffer +Decompress data (DEFLATE algorithm), memory must be MemFree() **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: Buffer - The resulting unsigned char *. | Param | Type | | --- | --- | -| position | number | -| value | number | +| compData | Buffer | +| compDataSize | number | +| dataSize | number | - + -## LoadStorageValue(position) ⇒ number -Load integer value from storage file (from defined position) +## EncodeDataBase64(data, dataSize, outputSize) ⇒ string +Encode data to Base64 string, memory must be MemFree() **Kind**: global function -**Returns**: number - The resulting int. +**Returns**: string - The resulting char *. | Param | Type | | --- | --- | -| position | number | +| data | Buffer | +| dataSize | number | +| outputSize | number | - + -## OpenURL(url) ⇒ undefined -Open URL with default system browser (if available) +## DecodeDataBase64(data, outputSize) ⇒ Buffer +Decode Base64 string data, memory must be MemFree() **Kind**: global function +**Returns**: Buffer - The resulting unsigned char *. | Param | Type | | --- | --- | -| url | string | +| data | Buffer | +| outputSize | number | @@ -3103,10 +3694,17 @@ Set mouse scaling ## GetMouseWheelMove() ⇒ number -Get mouse wheel movement Y +Get mouse wheel movement for X or Y, whichever is larger **Kind**: global function **Returns**: number - The resulting float. + + +## GetMouseWheelMoveV() ⇒ [Vector2](#Vector2) +Get mouse wheel movement for both X and Y + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. ## SetMouseCursor(cursor) ⇒ undefined @@ -4743,7 +5341,7 @@ Load font from file into GPU memory (VRAM) ## LoadFontEx(fileName, fontSize, fontChars, glyphCount) ⇒ Font -Load font from file with extended parameters +Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set **Kind**: global function **Returns**: Font - The resulting Font. @@ -4835,13 +5433,26 @@ Unload font chars info data (RAM) ## UnloadFont(font) ⇒ undefined -Unload Font from GPU memory (VRAM) +Unload font from GPU memory (VRAM) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| font | Font | + + + +## ExportFontAsCode(font, fileName) ⇒ boolean +Export font as code file, returns true on success **Kind**: global function +**Returns**: boolean - The resulting bool. | Param | Type | | --- | --- | | font | Font | +| fileName | string | @@ -4919,6 +5530,23 @@ Draw one character (codepoint) | fontSize | number | | tint | [Color](#Color) | + + +## DrawTextCodepoints(font, codepoints, count, position, fontSize, spacing, tint) ⇒ undefined +Draw multiple character (codepoint) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| font | Font | +| codepoints | number | +| count | number | +| position | [Vector2](#Vector2) | +| fontSize | number | +| spacing | number | +| tint | [Color](#Color) | + ## MeasureText(text, fontSize) ⇒ number @@ -6059,19 +6687,6 @@ Get collision info between ray and box | ray | Ray | | box | BoundingBox | - - -## GetRayCollisionModel(ray, model) ⇒ RayCollision -Get collision info between ray and model - -**Kind**: global function -**Returns**: RayCollision - The resulting RayCollision. - -| Param | Type | -| --- | --- | -| ray | Ray | -| model | Model | - ## GetRayCollisionMesh(ray, mesh, transform) ⇒ RayCollision @@ -6362,6 +6977,18 @@ Set pitch for a sound (1.0 is base level) | sound | Sound | | pitch | number | + + +## SetSoundPan(sound, pan) ⇒ undefined +Set pan for a sound (0.5 is center) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| sound | Sound | +| pan | number | + ## WaveCopy(wave) ⇒ Wave @@ -6377,7 +7004,7 @@ Copy a wave to a new wave ## LoadWaveSamples(wave) ⇒ number -Load samples data from wave as a floats array +Load samples data from wave as a 32bit float data array **Kind**: global function **Returns**: number - The resulting float *. @@ -6537,6 +7164,18 @@ Set pitch for a music (1.0 is base level) | music | Music | | pitch | number | + + +## SetMusicPan(music, pan) ⇒ undefined +Set pan for a music (0.5 is center) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| music | Music | +| pan | number | + ## GetMusicTimeLength(music) ⇒ number @@ -6691,6 +7330,18 @@ Set pitch for audio stream (1.0 is base level) | stream | AudioStream | | pitch | number | + + +## SetAudioStreamPan(stream, pan) ⇒ undefined +Set pan for audio stream (0.5 is centered) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| stream | AudioStream | +| pan | number | + ## SetAudioStreamBufferSizeDefault(size) ⇒ undefined @@ -6702,242 +7353,534 @@ Default size for new audio streams | --- | --- | | size | number | - - -## GuiEnable() ⇒ undefined -Enable gui controls (global state) - -**Kind**: global function - + -## GuiDisable() ⇒ undefined -Disable gui controls (global state) +## EaseLinearNone(t, b, c, d) ⇒ number +Ease: Linear **Kind**: global function - +**Returns**: number - The resulting float. -## GuiLock() ⇒ undefined -Lock gui controls (global state) +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | -**Kind**: global function - + -## GuiUnlock() ⇒ undefined -Unlock gui controls (global state) +## EaseLinearIn(t, b, c, d) ⇒ number +Ease: Linear In **Kind**: global function - +**Returns**: number - The resulting float. -## GuiIsLocked() ⇒ boolean -Check if gui is locked (global state) +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | -**Kind**: global function -**Returns**: boolean - The resulting bool. - + -## GuiFade(alpha) ⇒ undefined -Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f +## EaseLinearOut(t, b, c, d) ⇒ number +Ease: Linear Out **Kind**: global function +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| alpha | number | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiSetState(state) ⇒ undefined -Set gui state (global state) +## EaseLinearInOut(t, b, c, d) ⇒ number +Ease: Linear In Out **Kind**: global function +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| state | number | - - - -## GuiGetState() ⇒ number -Get gui state (global state) +| t | number | +| b | number | +| c | number | +| d | number | -**Kind**: global function -**Returns**: number - The resulting int. - + -## GuiSetFont(font) ⇒ undefined -Set gui custom font (global state) +## EaseSineIn(t, b, c, d) ⇒ number +Ease: Sine In **Kind**: global function +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| font | Font | - - - -## GuiGetFont() ⇒ Font -Get gui custom font (global state) +| t | number | +| b | number | +| c | number | +| d | number | -**Kind**: global function -**Returns**: Font - The resulting Font. - + -## GuiSetStyle(control, property, value) ⇒ undefined -Set one style property +## EaseSineOut(t, b, c, d) ⇒ number +Ease: Sine Out **Kind**: global function +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| control | number | -| property | number | -| value | number | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiGetStyle(control, property) ⇒ number -Get one style property +## EaseSineInOut(t, b, c, d) ⇒ number +Ease: Sine Out **Kind**: global function -**Returns**: number - The resulting int. +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| control | number | -| property | number | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiWindowBox(bounds, title) ⇒ boolean -Window Box control, shows a window that can be closed +## EaseCircIn(t, b, c, d) ⇒ number +Ease: Circular In **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| title | string | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiGroupBox(bounds, text) ⇒ undefined -Group Box control with text name +## EaseCircOut(t, b, c, d) ⇒ number +Ease: Circular Out **Kind**: global function +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiLine(bounds, text) ⇒ undefined -Line separator control, could contain text +## EaseCircInOut(t, b, c, d) ⇒ number +Ease: Circular In Out **Kind**: global function +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiPanel(bounds) ⇒ undefined -Panel control, useful to group controls +## EaseCubicIn(t, b, c, d) ⇒ number +Ease: Cubic In **Kind**: global function +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiScrollPanel(bounds, content, scroll) ⇒ [Rectangle](#Rectangle) -Scroll Panel control +## EaseCubicOut(t, b, c, d) ⇒ number +Ease: Cubic Out **Kind**: global function -**Returns**: [Rectangle](#Rectangle) - The resulting Rectangle. +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| content | [Rectangle](#Rectangle) | -| scroll | number | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiLabel(bounds, text) ⇒ undefined -Label control, shows text +## EaseCubicInOut(t, b, c, d) ⇒ number +Ease: Cubic In Out **Kind**: global function +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiButton(bounds, text) ⇒ boolean -Button control, returns true when clicked +## EaseQuadIn(t, b, c, d) ⇒ number +Ease: Quadratic In **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiLabelButton(bounds, text) ⇒ boolean -Label button control, show true when clicked +## EaseQuadOut(t, b, c, d) ⇒ number +Ease: Quadratic Out **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | +| t | number | +| b | number | +| c | number | +| d | number | - + -## GuiToggle(bounds, text, active) ⇒ boolean -Toggle Button control, returns true when active +## EaseQuadInOut(t, b, c, d) ⇒ number +Ease: Quadratic In Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseExpoIn(t, b, c, d) ⇒ number +Ease: Exponential In + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseExpoOut(t, b, c, d) ⇒ number +Ease: Exponential Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseExpoInOut(t, b, c, d) ⇒ number +Ease: Exponential In Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseBackIn(t, b, c, d) ⇒ number +Ease: Back In + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseBackOut(t, b, c, d) ⇒ number +Ease: Back Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseBackInOut(t, b, c, d) ⇒ number +Ease: Back In Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseBounceOut(t, b, c, d) ⇒ number +Ease: Bounce Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseBounceIn(t, b, c, d) ⇒ number +Ease: Bounce In + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseBounceInOut(t, b, c, d) ⇒ number +Ease: Bounce In Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseElasticIn(t, b, c, d) ⇒ number +Ease: Elastic In + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseElasticOut(t, b, c, d) ⇒ number +Ease: Elastic Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## EaseElasticInOut(t, b, c, d) ⇒ number +Ease: Elastic In Out + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| t | number | +| b | number | +| c | number | +| d | number | + + + +## GuiEnable() ⇒ undefined +Enable gui controls (global state) + +**Kind**: global function + + +## GuiDisable() ⇒ undefined +Disable gui controls (global state) + +**Kind**: global function + + +## GuiLock() ⇒ undefined +Lock gui controls (global state) + +**Kind**: global function + + +## GuiUnlock() ⇒ undefined +Unlock gui controls (global state) + +**Kind**: global function + + +## GuiIsLocked() ⇒ boolean +Check if gui is locked (global state) **Kind**: global function **Returns**: boolean - The resulting bool. + + +## GuiFade(alpha) ⇒ undefined +Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f + +**Kind**: global function | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | -| active | boolean | +| alpha | number | - + -## GuiToggleGroup(bounds, text, active) ⇒ number -Toggle Group control, returns active toggle index +## GuiSetState(state) ⇒ undefined +Set gui state (global state) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| state | number | + + + +## GuiGetState() ⇒ number +Get gui state (global state) + +**Kind**: global function +**Returns**: number - The resulting int. + + +## GuiSetFont(font) ⇒ undefined +Set gui custom font (global state) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| font | Font | + + + +## GuiGetFont() ⇒ Font +Get gui custom font (global state) + +**Kind**: global function +**Returns**: Font - The resulting Font. + + +## GuiSetStyle(control, property, value) ⇒ undefined +Set one style property + +**Kind**: global function + +| Param | Type | +| --- | --- | +| control | number | +| property | number | +| value | number | + + + +## GuiGetStyle(control, property) ⇒ number +Get one style property **Kind**: global function **Returns**: number - The resulting int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | -| active | number | +| control | number | +| property | number | - + -## GuiCheckBox(bounds, text, checked) ⇒ boolean -Check Box control, returns true when active +## GuiWindowBox(bounds, title) ⇒ boolean +Window Box control, shows a window that can be closed **Kind**: global function **Returns**: boolean - The resulting bool. @@ -6945,422 +7888,1928 @@ Check Box control, returns true when active | Param | Type | | --- | --- | | bounds | [Rectangle](#Rectangle) | -| text | string | -| checked | boolean | +| title | string | - + -## GuiComboBox(bounds, text, active) ⇒ number -Combo Box control, returns selected item index +## GuiGroupBox(bounds, text) ⇒ undefined +Group Box control with text name **Kind**: global function -**Returns**: number - The resulting int. | Param | Type | | --- | --- | | bounds | [Rectangle](#Rectangle) | | text | string | -| active | number | - + -## GuiDropdownBox(bounds, text, active, editMode) ⇒ boolean -Dropdown Box control, returns selected item +## GuiLine(bounds, text) ⇒ undefined +Line separator control, could contain text + +**Kind**: global function + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | + + + +## GuiPanel(bounds, text) ⇒ undefined +Panel control, useful to group controls + +**Kind**: global function + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | + + + +## GuiScrollPanel(bounds, text, content, scroll) ⇒ [Rectangle](#Rectangle) +Scroll Panel control + +**Kind**: global function +**Returns**: [Rectangle](#Rectangle) - The resulting Rectangle. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| content | [Rectangle](#Rectangle) | +| scroll | number | + + + +## GuiLabel(bounds, text) ⇒ undefined +Label control, shows text + +**Kind**: global function + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | + + + +## GuiButton(bounds, text) ⇒ boolean +Button control, returns true when clicked + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | + + + +## GuiLabelButton(bounds, text) ⇒ boolean +Label button control, show true when clicked + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | + + + +## GuiToggle(bounds, text, active) ⇒ boolean +Toggle Button control, returns true when active + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| active | boolean | + + + +## GuiToggleGroup(bounds, text, active) ⇒ number +Toggle Group control, returns active toggle index + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| active | number | + + + +## GuiCheckBox(bounds, text, checked) ⇒ boolean +Check Box control, returns true when active + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| checked | boolean | + + + +## GuiComboBox(bounds, text, active) ⇒ number +Combo Box control, returns selected item index + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| active | number | + + + +## GuiDropdownBox(bounds, text, active, editMode) ⇒ boolean +Dropdown Box control, returns selected item + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| active | number | +| editMode | boolean | + + + +## GuiSpinner(bounds, text, value, minValue, maxValue, editMode) ⇒ boolean +Spinner control, returns selected value + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| value | number | +| minValue | number | +| maxValue | number | +| editMode | boolean | + + + +## GuiValueBox(bounds, text, value, minValue, maxValue, editMode) ⇒ boolean +Value Box control, updates input text with numbers + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| value | number | +| minValue | number | +| maxValue | number | +| editMode | boolean | + + + +## GuiTextBox(bounds, text, textSize, editMode) ⇒ boolean +Text Box control, updates input text + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| textSize | number | +| editMode | boolean | + + + +## GuiTextBoxMulti(bounds, text, textSize, editMode) ⇒ boolean +Text Box control with multiple lines + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| textSize | number | +| editMode | boolean | + + + +## GuiSlider(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number +Slider control, returns selected value + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| textLeft | string | +| textRight | string | +| value | number | +| minValue | number | +| maxValue | number | + + + +## GuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number +Slider Bar control, returns selected value + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| textLeft | string | +| textRight | string | +| value | number | +| minValue | number | +| maxValue | number | + + + +## GuiProgressBar(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number +Progress Bar control, shows current progress value + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| textLeft | string | +| textRight | string | +| value | number | +| minValue | number | +| maxValue | number | + + + +## GuiStatusBar(bounds, text) ⇒ undefined +Status Bar control, shows info text + +**Kind**: global function + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | + + + +## GuiDummyRec(bounds, text) ⇒ undefined +Dummy control for placeholders + +**Kind**: global function + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | + + + +## GuiGrid(bounds, text, spacing, subdivs) ⇒ [Vector2](#Vector2) +Grid control, returns mouse cell position + +**Kind**: global function +**Returns**: [Vector2](#Vector2) - The resulting Vector2. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| spacing | number | +| subdivs | number | + + + +## GuiListView(bounds, text, scrollIndex, active) ⇒ number +List View control, returns selected list item index + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| scrollIndex | number | +| active | number | + + + +## GuiListViewEx(bounds, text, count, focus, scrollIndex, active) ⇒ number +List View with extended parameters + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | number | +| count | number | +| focus | number | +| scrollIndex | number | +| active | number | + + + +## GuiMessageBox(bounds, title, message, buttons) ⇒ number +Message Box control, displays a message + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| title | string | +| message | string | +| buttons | string | + + + +## GuiTextInputBox(bounds, title, message, buttons, text, textMaxSize, secretViewActive) ⇒ number +Text Input Box control, ask for text, supports secret + +**Kind**: global function +**Returns**: number - The resulting int. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| title | string | +| message | string | +| buttons | string | +| text | string | +| textMaxSize | number | +| secretViewActive | number | + + + +## GuiColorPicker(bounds, text, color) ⇒ [Color](#Color) +Color Picker control (multiple color controls) + +**Kind**: global function +**Returns**: [Color](#Color) - The resulting Color. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| color | [Color](#Color) | + + + +## GuiColorPanel(bounds, text, color) ⇒ [Color](#Color) +Color Panel control + +**Kind**: global function +**Returns**: [Color](#Color) - The resulting Color. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| color | [Color](#Color) | + + + +## GuiColorBarAlpha(bounds, text, alpha) ⇒ number +Color Bar Alpha control + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| text | string | +| alpha | number | + + + +## GuiColorBarHue(bounds, text, value) ⇒ number +Color Bar Hue control + +**Kind**: global function +**Returns**: number - The resulting float. + +| Param | Type | +| --- | --- | +| bounds | [Rectangle](#Rectangle) | +| 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 + + +## 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 | + + + +## GuiGetIcons() ⇒ number +Get full icons data pointer + +**Kind**: global function +**Returns**: number - The resulting unsigned int *. + + +## GuiGetIconData(iconId) ⇒ number +Get icon bit data + +**Kind**: global function +**Returns**: number - The resulting unsigned int *. + +| Param | Type | +| --- | --- | +| iconId | number | + + + +## GuiSetIconData(iconId, data) ⇒ undefined +Set icon bit data + +**Kind**: global function + +| Param | Type | +| --- | --- | +| iconId | number | +| data | number | + + + +## GuiSetIconScale(scale) ⇒ undefined +Set icon scale (1 by default) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| scale | number | + + + +## GuiSetIconPixel(iconId, x, y) ⇒ undefined +Set icon pixel value + +**Kind**: global function + +| Param | Type | +| --- | --- | +| iconId | number | +| x | number | +| y | number | + + + +## GuiClearIconPixel(iconId, x, y) ⇒ undefined +Clear icon pixel value + +**Kind**: global function + +| Param | Type | +| --- | --- | +| iconId | number | +| x | number | +| y | number | + + + +## GuiCheckIconPixel(iconId, x, y) ⇒ boolean +Check icon pixel value + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| iconId | number | +| x | number | +| y | number | + + + +## rlMatrixMode(mode) ⇒ undefined +Choose the current matrix to be transformed + +**Kind**: global function + +| Param | Type | +| --- | --- | +| mode | number | + + + +## rlPushMatrix() ⇒ undefined +Push the current matrix to stack + +**Kind**: global function + + +## rlPopMatrix() ⇒ undefined +Pop lattest inserted matrix from stack + +**Kind**: global function + + +## rlLoadIdentity() ⇒ undefined +Reset current matrix to identity matrix + +**Kind**: global function + + +## rlTranslatef(x, y, z) ⇒ undefined +Multiply the current matrix by a translation matrix + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | +| z | number | + + + +## rlRotatef(angle, x, y, z) ⇒ undefined +Multiply the current matrix by a rotation matrix + +**Kind**: global function + +| Param | Type | +| --- | --- | +| angle | number | +| x | number | +| y | number | +| z | number | + + + +## rlScalef(x, y, z) ⇒ undefined +Multiply the current matrix by a scaling matrix + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | +| z | number | + + + +## rlMultMatrixf(matf) ⇒ undefined +Multiply the current matrix by another matrix + +**Kind**: global function + +| Param | Type | +| --- | --- | +| matf | number | + + + +## rlViewport(x, y, width, height) ⇒ undefined +Set the viewport area + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | +| width | number | +| height | number | + + + +## rlBegin(mode) ⇒ undefined +Initialize drawing mode (how to organize vertex) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| mode | number | + + + +## rlEnd() ⇒ undefined +Finish vertex providing + +**Kind**: global function + + +## rlVertex2i(x, y) ⇒ undefined +Define one vertex (position) - 2 int + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | + + + +## rlVertex2f(x, y) ⇒ undefined +Define one vertex (position) - 2 float + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | + + + +## rlVertex3f(x, y, z) ⇒ undefined +Define one vertex (position) - 3 float + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | +| z | number | + + + +## rlTexCoord2f(x, y) ⇒ undefined +Define one vertex (texture coordinate) - 2 float + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | + + + +## rlNormal3f(x, y, z) ⇒ undefined +Define one vertex (normal) - 3 float + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | +| z | number | + + + +## rlColor4ub(r, g, b, a) ⇒ undefined +Define one vertex (color) - 4 byte + +**Kind**: global function + +| Param | Type | +| --- | --- | +| r | number | +| g | number | +| b | number | +| a | number | + + + +## rlColor3f(x, y, z) ⇒ undefined +Define one vertex (color) - 3 float + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | +| z | number | + + + +## rlColor4f(x, y, z, w) ⇒ undefined +Define one vertex (color) - 4 float + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | +| z | number | +| w | number | + + + +## rlEnableVertexArray(vaoId) ⇒ boolean +Enable vertex array (VAO, if supported) + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| vaoId | number | + + + +## rlDisableVertexArray() ⇒ undefined +Disable vertex array (VAO, if supported) + +**Kind**: global function + + +## rlEnableVertexBuffer(id) ⇒ undefined +Enable vertex buffer (VBO) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlDisableVertexBuffer() ⇒ undefined +Disable vertex buffer (VBO) + +**Kind**: global function + + +## rlEnableVertexBufferElement(id) ⇒ undefined +Enable vertex buffer element (VBO element) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlDisableVertexBufferElement() ⇒ undefined +Disable vertex buffer element (VBO element) + +**Kind**: global function + + +## rlEnableVertexAttribute(index) ⇒ undefined +Enable vertex attribute index + +**Kind**: global function + +| Param | Type | +| --- | --- | +| index | number | + + + +## rlDisableVertexAttribute(index) ⇒ undefined +Disable vertex attribute index + +**Kind**: global function + +| Param | Type | +| --- | --- | +| index | number | + + + +## rlActiveTextureSlot(slot) ⇒ undefined +Select and active a texture slot + +**Kind**: global function + +| Param | Type | +| --- | --- | +| slot | number | + + + +## rlEnableTexture(id) ⇒ undefined +Enable texture + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlDisableTexture() ⇒ undefined +Disable texture + +**Kind**: global function + + +## rlEnableTextureCubemap(id) ⇒ undefined +Enable texture cubemap + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlDisableTextureCubemap() ⇒ undefined +Disable texture cubemap + +**Kind**: global function + + +## rlTextureParameters(id, param, value) ⇒ undefined +Set texture parameters (filter, wrap) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | +| param | number | +| value | number | + + + +## rlEnableShader(id) ⇒ undefined +Enable shader program + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlDisableShader() ⇒ undefined +Disable shader program + +**Kind**: global function + + +## rlEnableFramebuffer(id) ⇒ undefined +Enable render texture (fbo) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlDisableFramebuffer() ⇒ undefined +Disable render texture (fbo), return to default framebuffer + +**Kind**: global function + + +## rlActiveDrawBuffers(count) ⇒ undefined +Activate multiple draw color buffers + +**Kind**: global function + +| Param | Type | +| --- | --- | +| count | number | + + + +## rlEnableColorBlend() ⇒ undefined +Enable color blending + +**Kind**: global function + + +## rlDisableColorBlend() ⇒ undefined +Disable color blending + +**Kind**: global function + + +## rlEnableDepthTest() ⇒ undefined +Enable depth test + +**Kind**: global function + + +## rlDisableDepthTest() ⇒ undefined +Disable depth test + +**Kind**: global function + + +## rlEnableDepthMask() ⇒ undefined +Enable depth write + +**Kind**: global function + + +## rlDisableDepthMask() ⇒ undefined +Disable depth write + +**Kind**: global function + + +## rlEnableBackfaceCulling() ⇒ undefined +Enable backface culling + +**Kind**: global function + + +## rlDisableBackfaceCulling() ⇒ undefined +Disable backface culling + +**Kind**: global function + + +## rlEnableScissorTest() ⇒ undefined +Enable scissor test + +**Kind**: global function + + +## rlDisableScissorTest() ⇒ undefined +Disable scissor test + +**Kind**: global function + + +## rlScissor(x, y, width, height) ⇒ undefined +Scissor test + +**Kind**: global function + +| Param | Type | +| --- | --- | +| x | number | +| y | number | +| width | number | +| height | number | + + + +## rlEnableWireMode() ⇒ undefined +Enable wire mode + +**Kind**: global function + + +## rlDisableWireMode() ⇒ undefined +Disable wire mode + +**Kind**: global function + + +## rlSetLineWidth(width) ⇒ undefined +Set the line drawing width + +**Kind**: global function + +| Param | Type | +| --- | --- | +| width | number | + + + +## rlGetLineWidth() ⇒ number +Get the line drawing width + +**Kind**: global function +**Returns**: number - The resulting float. + + +## rlEnableSmoothLines() ⇒ undefined +Enable line aliasing + +**Kind**: global function + + +## rlDisableSmoothLines() ⇒ undefined +Disable line aliasing + +**Kind**: global function + + +## rlEnableStereoRender() ⇒ undefined +Enable stereo rendering + +**Kind**: global function + + +## rlDisableStereoRender() ⇒ undefined +Disable stereo rendering + +**Kind**: global function + + +## rlIsStereoRenderEnabled() ⇒ boolean +Check if stereo render is enabled + +**Kind**: global function +**Returns**: boolean - The resulting bool. + + +## rlClearColor(r, g, b, a) ⇒ undefined +Clear color buffer with color + +**Kind**: global function + +| Param | Type | +| --- | --- | +| r | number | +| g | number | +| b | number | +| a | number | + + + +## rlClearScreenBuffers() ⇒ undefined +Clear used screen buffers (color and depth) + +**Kind**: global function + + +## rlCheckErrors() ⇒ undefined +Check and log OpenGL error codes + +**Kind**: global function + + +## rlSetBlendMode(mode) ⇒ undefined +Set blending mode + +**Kind**: global function + +| Param | Type | +| --- | --- | +| mode | number | + + + +## rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation) ⇒ undefined +Set blending mode factor and equation (using OpenGL factors) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| glSrcFactor | number | +| glDstFactor | number | +| glEquation | number | + + + +## rlglInit(width, height) ⇒ undefined +Initialize rlgl (buffers, shaders, textures, states) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| width | number | +| height | number | + + + +## rlglClose() ⇒ undefined +De-inititialize rlgl (buffers, shaders, textures) + +**Kind**: global function + + +## rlLoadExtensions(loader) ⇒ undefined +Load OpenGL extensions (loader function required) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| loader | number | + + + +## rlGetVersion() ⇒ number +Get current OpenGL version + +**Kind**: global function +**Returns**: number - The resulting int. + + +## rlSetFramebufferWidth(width) ⇒ undefined +Set current framebuffer width + +**Kind**: global function + +| Param | Type | +| --- | --- | +| width | number | + + + +## rlGetFramebufferWidth() ⇒ number +Get default framebuffer width + +**Kind**: global function +**Returns**: number - The resulting int. + + +## rlSetFramebufferHeight(height) ⇒ undefined +Set current framebuffer height + +**Kind**: global function + +| Param | Type | +| --- | --- | +| height | number | + + + +## rlGetFramebufferHeight() ⇒ number +Get default framebuffer height + +**Kind**: global function +**Returns**: number - The resulting int. + + +## rlGetTextureIdDefault() ⇒ number +Get default texture id + +**Kind**: global function +**Returns**: number - The resulting unsigned int. + + +## rlGetShaderIdDefault() ⇒ number +Get default shader id + +**Kind**: global function +**Returns**: number - The resulting unsigned int. + + +## rlGetShaderLocsDefault() ⇒ number +Get default shader locations + +**Kind**: global function +**Returns**: number - The resulting int *. + + +## rlLoadRenderBatch(numBuffers, bufferElements) ⇒ rlRenderBatch +Load a render batch system + +**Kind**: global function +**Returns**: rlRenderBatch - The resulting rlRenderBatch. + +| Param | Type | +| --- | --- | +| numBuffers | number | +| bufferElements | number | + + + +## rlUnloadRenderBatch(batch) ⇒ undefined +Unload render batch system + +**Kind**: global function + +| Param | Type | +| --- | --- | +| batch | rlRenderBatch | + + + +## rlDrawRenderBatch(batch) ⇒ undefined +Draw render batch data (Update->Draw->Reset) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| batch | number | + + + +## rlSetRenderBatchActive(batch) ⇒ undefined +Set the active render batch for rlgl (NULL for default internal) + +**Kind**: global function + +| Param | Type | +| --- | --- | +| batch | number | + + + +## rlDrawRenderBatchActive() ⇒ undefined +Update and draw internal render batch + +**Kind**: global function + + +## rlCheckRenderBatchLimit(vCount) ⇒ boolean +Check internal buffer overflow for a given number of vertex + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| vCount | number | + + + +## rlSetTexture(id) ⇒ undefined +Set current texture for render batch and check buffers limits + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlLoadVertexArray() ⇒ number +Load vertex array (vao) if supported + +**Kind**: global function +**Returns**: number - The resulting unsigned int. + + +## rlLoadVertexBuffer(buffer, size, dynamic) ⇒ number +Load a vertex buffer attribute + +**Kind**: global function +**Returns**: number - The resulting unsigned int. + +| Param | Type | +| --- | --- | +| buffer | number | +| size | number | +| dynamic | boolean | + + + +## rlLoadVertexBufferElement(buffer, size, dynamic) ⇒ number +Load a new attributes element buffer + +**Kind**: global function +**Returns**: number - The resulting unsigned int. + +| Param | Type | +| --- | --- | +| buffer | number | +| size | number | +| dynamic | boolean | + + + +## rlUpdateVertexBuffer(bufferId, data, dataSize, offset) ⇒ undefined +Update GPU buffer with new data + +**Kind**: global function + +| Param | Type | +| --- | --- | +| bufferId | number | +| data | number | +| dataSize | number | +| offset | number | + + + +## rlUpdateVertexBufferElements(id, data, dataSize, offset) ⇒ undefined +Update vertex buffer elements with new data + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | +| data | number | +| dataSize | number | +| offset | number | + + + +## rlSetVertexAttributeDefault(locIndex, value, attribType, count) ⇒ undefined +Set vertex attribute default value + +**Kind**: global function + +| Param | Type | +| --- | --- | +| locIndex | number | +| value | number | +| attribType | number | +| count | number | + + + +## rlLoadTexture(data, width, height, format, mipmapCount) ⇒ number +Load texture in GPU + +**Kind**: global function +**Returns**: number - The resulting unsigned int. + +| Param | Type | +| --- | --- | +| data | number | +| width | number | +| height | number | +| format | number | +| mipmapCount | number | + + + +## rlLoadTextureDepth(width, height, useRenderBuffer) ⇒ number +Load depth texture/renderbuffer (to be attached to fbo) + +**Kind**: global function +**Returns**: number - The resulting unsigned int. + +| Param | Type | +| --- | --- | +| width | number | +| height | number | +| useRenderBuffer | boolean | + + + +## rlLoadTextureCubemap(data, size, format) ⇒ number +Load texture cubemap + +**Kind**: global function +**Returns**: number - The resulting unsigned int. + +| Param | Type | +| --- | --- | +| data | number | +| size | number | +| format | number | + + + +## rlUpdateTexture(id, offsetX, offsetY, width, height, format, data) ⇒ undefined +Update GPU texture with new data + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | +| offsetX | number | +| offsetY | number | +| width | number | +| height | number | +| format | number | +| data | number | + + + +## rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType) ⇒ undefined +Get OpenGL internal formats + +**Kind**: global function + +| Param | Type | +| --- | --- | +| format | number | +| glInternalFormat | number | +| glFormat | number | +| glType | number | + + + +## rlGetPixelFormatName(format) ⇒ string +Get name string for pixel format + +**Kind**: global function +**Returns**: string - The resulting const char *. + +| Param | Type | +| --- | --- | +| format | number | + + + +## rlUnloadTexture(id) ⇒ undefined +Unload texture from GPU memory + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlGenTextureMipmaps(id, width, height, format, mipmaps) ⇒ undefined +Generate mipmap data for selected texture + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | +| width | number | +| height | number | +| format | number | +| mipmaps | number | + + + +## rlReadTexturePixels(id, width, height, format) ⇒ number +Read texture pixel data + +**Kind**: global function +**Returns**: number - The resulting void *. + +| Param | Type | +| --- | --- | +| id | number | +| width | number | +| height | number | +| format | number | + + + +## rlReadScreenPixels(width, height) ⇒ Buffer +Read screen pixel data (color buffer) + +**Kind**: global function +**Returns**: Buffer - The resulting unsigned char *. + +| Param | Type | +| --- | --- | +| width | number | +| height | number | + + + +## rlLoadFramebuffer(width, height) ⇒ 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 +Attach texture/renderbuffer to a framebuffer + +**Kind**: global function + +| Param | Type | +| --- | --- | +| fboId | number | +| texId | number | +| attachType | number | +| texType | number | +| mipLevel | number | + + + +## rlFramebufferComplete(id) ⇒ boolean +Verify framebuffer is complete + +**Kind**: global function +**Returns**: boolean - The resulting bool. + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlUnloadFramebuffer(id) ⇒ undefined +Delete framebuffer from GPU + +**Kind**: global function + +| Param | Type | +| --- | --- | +| id | number | + + + +## rlLoadShaderCode(vsCode, fsCode) ⇒ number +Load shader from code strings **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting unsigned int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | -| active | number | -| editMode | boolean | +| vsCode | string | +| fsCode | string | - + -## GuiSpinner(bounds, text, value, minValue, maxValue, editMode) ⇒ boolean -Spinner control, returns selected value +## rlCompileShader(shaderCode, type) ⇒ number +Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER) **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting unsigned int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | -| value | number | -| minValue | number | -| maxValue | number | -| editMode | boolean | +| shaderCode | string | +| type | number | - + -## GuiValueBox(bounds, text, value, minValue, maxValue, editMode) ⇒ boolean -Value Box control, updates input text with numbers +## rlLoadShaderProgram(vShaderId, fShaderId) ⇒ number +Load custom shader program **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting unsigned int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | -| value | number | -| minValue | number | -| maxValue | number | -| editMode | boolean | +| vShaderId | number | +| fShaderId | number | - + -## GuiTextBox(bounds, text, textSize, editMode) ⇒ boolean -Text Box control, updates input text +## rlUnloadShaderProgram(id) ⇒ undefined +Unload shader program **Kind**: global function -**Returns**: boolean - The resulting bool. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | -| textSize | number | -| editMode | boolean | +| id | number | - + -## GuiTextBoxMulti(bounds, text, textSize, editMode) ⇒ boolean -Text Box control with multiple lines +## rlGetLocationUniform(shaderId, uniformName) ⇒ number +Get shader location uniform **Kind**: global function -**Returns**: boolean - The resulting bool. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | -| textSize | number | -| editMode | boolean | +| shaderId | number | +| uniformName | string | - + -## GuiSlider(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number -Slider control, returns selected value +## rlGetLocationAttrib(shaderId, attribName) ⇒ number +Get shader location attribute **Kind**: global function -**Returns**: number - The resulting float. +**Returns**: number - The resulting int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| textLeft | string | -| textRight | string | -| value | number | -| minValue | number | -| maxValue | number | +| shaderId | number | +| attribName | string | - + -## GuiSliderBar(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number -Slider Bar control, returns selected value +## rlSetUniform(locIndex, value, uniformType, count) ⇒ undefined +Set shader value uniform **Kind**: global function -**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| textLeft | string | -| textRight | string | +| locIndex | number | | value | number | -| minValue | number | -| maxValue | number | +| uniformType | number | +| count | number | - + -## GuiProgressBar(bounds, textLeft, textRight, value, minValue, maxValue) ⇒ number -Progress Bar control, shows current progress value +## rlSetUniformMatrix(locIndex, mat) ⇒ undefined +Set shader value matrix **Kind**: global function -**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| textLeft | string | -| textRight | string | -| value | number | -| minValue | number | -| maxValue | number | +| locIndex | number | +| mat | Matrix | - + -## GuiStatusBar(bounds, text) ⇒ undefined -Status Bar control, shows info text +## rlSetUniformSampler(locIndex, textureId) ⇒ undefined +Set shader value sampler **Kind**: global function | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | +| locIndex | number | +| textureId | number | - + -## GuiDummyRec(bounds, text) ⇒ undefined -Dummy control for placeholders +## rlSetShader(id, locs) ⇒ undefined +Set shader currently active (id and locations) **Kind**: global function | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | +| id | number | +| locs | number | - + -## GuiScrollBar(bounds, value, minValue, maxValue) ⇒ number -Scroll Bar control +## rlLoadComputeShaderProgram(shaderId) ⇒ number +Load compute shader program **Kind**: global function -**Returns**: number - The resulting int. +**Returns**: number - The resulting unsigned int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| value | number | -| minValue | number | -| maxValue | number | +| shaderId | number | - + -## GuiGrid(bounds, spacing, subdivs) ⇒ [Vector2](#Vector2) -Grid control +## rlComputeShaderDispatch(groupX, groupY, groupZ) ⇒ undefined +Dispatch compute shader (equivalent to *draw* for graphics pilepine) **Kind**: global function -**Returns**: [Vector2](#Vector2) - The resulting Vector2. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| spacing | number | -| subdivs | number | +| groupX | number | +| groupY | number | +| groupZ | number | - + -## GuiListView(bounds, text, scrollIndex, active) ⇒ number -List View control, returns selected list item index +## rlLoadShaderBuffer(size, data, usageHint) ⇒ number +Load shader storage buffer object (SSBO) **Kind**: global function -**Returns**: number - The resulting int. +**Returns**: number - The resulting unsigned int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | string | -| scrollIndex | number | -| active | number | +| size | BigInt | +| data | number | +| usageHint | number | - + -## GuiListViewEx(bounds, text, count, focus, scrollIndex, active) ⇒ number -List View with extended parameters +## rlUnloadShaderBuffer(ssboId) ⇒ undefined +Unload shader storage buffer object (SSBO) **Kind**: global function -**Returns**: number - The resulting int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| text | number | -| count | number | -| focus | number | -| scrollIndex | number | -| active | number | +| ssboId | number | - + -## GuiMessageBox(bounds, title, message, buttons) ⇒ number -Message Box control, displays a message +## rlUpdateShaderBufferElements(id, data, dataSize, offset) ⇒ undefined +Update SSBO buffer data **Kind**: global function -**Returns**: number - The resulting int. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| title | string | -| message | string | -| buttons | string | +| id | number | +| data | number | +| dataSize | BigInt | +| offset | BigInt | - + -## GuiTextInputBox(bounds, title, message, buttons, text) ⇒ number -Text Input Box control, ask for text +## rlGetShaderBufferSize(id) ⇒ BigInt +Get SSBO buffer size **Kind**: global function -**Returns**: number - The resulting int. +**Returns**: BigInt - The resulting unsigned long long. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| title | string | -| message | string | -| buttons | string | -| text | string | +| id | number | - + -## GuiColorPicker(bounds, color) ⇒ [Color](#Color) -Color Picker control (multiple color controls) +## rlReadShaderBufferElements(id, dest, count, offset) ⇒ undefined +Bind SSBO buffer **Kind**: global function -**Returns**: [Color](#Color) - The resulting Color. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| color | [Color](#Color) | +| id | number | +| dest | number | +| count | BigInt | +| offset | BigInt | - + -## GuiColorPanel(bounds, color) ⇒ [Color](#Color) -Color Panel control +## rlBindShaderBuffer(id, index) ⇒ undefined +Copy SSBO buffer data **Kind**: global function -**Returns**: [Color](#Color) - The resulting Color. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| color | [Color](#Color) | +| id | number | +| index | number | - + -## GuiColorBarAlpha(bounds, alpha) ⇒ number -Color Bar Alpha control +## rlCopyBuffersElements(destId, srcId, destOffset, srcOffset, count) ⇒ undefined +Copy SSBO buffer data **Kind**: global function -**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| alpha | number | +| destId | number | +| srcId | number | +| destOffset | BigInt | +| srcOffset | BigInt | +| count | BigInt | - + -## GuiColorBarHue(bounds, value) ⇒ number -Color Bar Hue control +## rlBindImageTexture(id, index, format, readonly) ⇒ undefined +Bind image texture **Kind**: global function -**Returns**: number - The resulting float. | Param | Type | | --- | --- | -| bounds | [Rectangle](#Rectangle) | -| value | number | +| id | number | +| index | number | +| format | number | +| readonly | number | - + -## GuiLoadStyle(fileName) ⇒ undefined -Load style file over global style variable (.rgs) +## rlGetMatrixModelview() ⇒ Matrix +Get internal modelview matrix **Kind**: global function +**Returns**: Matrix - The resulting Matrix. + -| Param | Type | -| --- | --- | -| fileName | string | +## rlGetMatrixProjection() ⇒ Matrix +Get internal projection matrix - +**Kind**: global function +**Returns**: Matrix - The resulting Matrix. + -## GuiLoadStyleDefault() ⇒ undefined -Load style default over global style +## rlGetMatrixTransform() ⇒ Matrix +Get internal accumulated transform matrix **Kind**: global function - +**Returns**: Matrix - The resulting Matrix. + -## GuiIconText(iconId, text) ⇒ string -Get text with icon id prepended (if supported) +## rlGetMatrixProjectionStereo(eye) ⇒ Matrix +Get internal projection matrix for stereo render (selected eye) **Kind**: global function -**Returns**: string - The resulting const char *. +**Returns**: Matrix - The resulting Matrix. | Param | Type | | --- | --- | -| iconId | number | -| text | string | +| eye | number | - + -## GuiGetIcons() ⇒ number -Get full icons data pointer +## rlGetMatrixViewOffsetStereo(eye) ⇒ Matrix +Get internal view offset matrix for stereo render (selected eye) **Kind**: global function -**Returns**: number - The resulting unsigned int *. - +**Returns**: Matrix - The resulting Matrix. -## GuiGetIconData(iconId) ⇒ number -Get icon bit data +| Param | Type | +| --- | --- | +| eye | number | + + + +## rlSetMatrixProjection(proj) ⇒ undefined +Set a custom projection matrix (replaces internal projection matrix) **Kind**: global function -**Returns**: number - The resulting unsigned int *. | Param | Type | | --- | --- | -| iconId | number | +| proj | Matrix | - + -## GuiSetIconData(iconId, data) ⇒ undefined -Set icon bit data +## rlSetMatrixModelview(view) ⇒ undefined +Set a custom modelview matrix (replaces internal modelview matrix) **Kind**: global function | Param | Type | | --- | --- | -| iconId | number | -| data | number | +| view | Matrix | - + -## GuiSetIconPixel(iconId, x, y) ⇒ undefined -Set icon pixel value +## rlSetMatrixProjectionStereo(right, left) ⇒ undefined +Set eyes projection matrices for stereo rendering **Kind**: global function | Param | Type | | --- | --- | -| iconId | number | -| x | number | -| y | number | +| right | Matrix | +| left | Matrix | - + -## GuiClearIconPixel(iconId, x, y) ⇒ undefined -Clear icon pixel value +## rlSetMatrixViewOffsetStereo(right, left) ⇒ undefined +Set eyes view offsets matrices for stereo rendering **Kind**: global function | Param | Type | | --- | --- | -| iconId | number | -| x | number | -| y | number | +| right | Matrix | +| left | Matrix | - + -## GuiCheckIconPixel(iconId, x, y) ⇒ boolean -Check icon pixel value +## rlLoadDrawCube() ⇒ undefined +Load and draw a cube **Kind**: global function -**Returns**: boolean - The resulting bool. + -| Param | Type | -| --- | --- | -| iconId | number | -| x | number | -| y | number | +## rlLoadDrawQuad() ⇒ undefined +Load and draw a quad +**Kind**: global function ## UpdateCamera(camera) ⇒ undefined @@ -7876,17 +10325,6 @@ Compute mesh tangents | --- | --- | | mesh | Mesh | - - -## GenMeshBinormals(mesh) ⇒ undefined -Compute mesh binormals - -**Kind**: global function - -| Param | Type | -| --- | --- | -| mesh | Mesh | - ## SetModelMeshMaterial(model, meshId, materialId) ⇒ undefined @@ -7900,32 +10338,32 @@ Set material for a mesh | meshId | number | | materialId | number | - + -## WaveFormat(wave, sampleRate, sampleSize, channels) ⇒ undefined -Convert wave data to desired format +## WaveCrop(wave, initSample, finalSample) ⇒ undefined +Crop a wave to defined samples range **Kind**: global function | Param | Type | | --- | --- | | wave | Wave | -| sampleRate | number | -| sampleSize | number | -| channels | number | +| initSample | number | +| finalSample | number | - + -## WaveCrop(wave, initSample, finalSample) ⇒ undefined -Crop a wave to defined samples range +## WaveFormat(wave, sampleRate, sampleSize, channels) ⇒ undefined +Convert wave data to desired format **Kind**: global function | Param | Type | | --- | --- | | wave | Wave | -| initSample | number | -| finalSample | number | +| sampleRate | number | +| sampleSize | number | +| channels | number | diff --git a/examples/models/models_rlgl_solar_system.js b/examples/models/models_rlgl_solar_system.js index b3b1be8..b9aa6c1 100644 --- a/examples/models/models_rlgl_solar_system.js +++ b/examples/models/models_rlgl_solar_system.js @@ -2,52 +2,21 @@ * * raylib [models] example - rlgl module usage with push/pop matrix transformations * -* This example uses [rlgl] module funtionality (pseudo-OpenGL 1.1 style coding) +* NOTE: This example uses [rlgl] module functionality (pseudo-OpenGL 1.1 style coding) * -* This example has been created using raylib 2.5 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) +* Example originally created with raylib 2.5, last time updated with raylib 4.0 * -* Copyright (c) 2018 Ramon Santamaria (@raysan5) +* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +* BSD-like license that allows static linking with closed source software +* +* Copyright (c) 2018-2022 Ramon Santamaria (@raysan5) * ********************************************************************************************/ const r = require('raylib') - // ------------------------------------------------------------------------------------ // Module Functions Declaration // ------------------------------------------------------------------------------------ -function DrawSphereBasic (color) { - const rings = 16 - const slices = 16 - - r.rlBegin(r.RL_TRIANGLES) - r.rlColor4ub(color.r, color.g, color.b, color.a) - - for (let i = 0; i < (rings + 2); i++) { - for (let j = 0; j < slices; j++) { - r.rlVertex3f(Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)) * Math.sin(r.DEG2RAD * (j * 360 / slices)), - Math.sin(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)), - Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)) * Math.cos(r.DEG2RAD * (j * 360 / slices))) - r.rlVertex3f(Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * Math.sin(r.DEG2RAD * ((j + 1) * 360 / slices)), - Math.sin(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))), - Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * Math.cos(r.DEG2RAD * ((j + 1) * 360 / slices))) - r.rlVertex3f(Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * Math.sin(r.DEG2RAD * (j * 360 / slices)), - Math.sin(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))), - Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * Math.cos(r.DEG2RAD * (j * 360 / slices))) - - r.rlVertex3f(Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)) * Math.sin(r.DEG2RAD * (j * 360 / slices)), - Math.sin(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)), - Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)) * Math.cos(r.DEG2RAD * (j * 360 / slices))) - r.rlVertex3f(Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i))) * Math.sin(r.DEG2RAD * ((j + 1) * 360 / slices)), - Math.sin(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i))), - Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i))) * Math.cos(r.DEG2RAD * ((j + 1) * 360 / slices))) - r.rlVertex3f(Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * Math.sin(r.DEG2RAD * ((j + 1) * 360 / slices)), - Math.sin(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))), - Math.cos(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * Math.cos(r.DEG2RAD * ((j + 1) * 360 / slices))) - } - } - r.rlEnd() -} // ------------------------------------------------------------------------------------ // Program main entry point @@ -64,39 +33,38 @@ const earthOrbitRadius = 8.0 const moonRadius = 0.16 const moonOrbitRadius = 1.5 -r.InitWindow(screenWidth, screenHeight, 'raylib [models] example - rlgl module usage with push/pop matrix transformations') +r.InitWindow(screenWidth, screenHeight, 'node raylib [models] example - rlgl module usage with push/pop matrix transformations') -// Define the camera to look into our 3d world -const camera = r.Camera() -camera.position = r.Vector3(16, 16, 16) -camera.target = r.Vector3(0, 0, 0) -camera.up = r.Vector3(0, 1, 0) -camera.fovy = 45 -camera.type = r.CAMERA_PERSPECTIVE -camera.projection = r.CAMERA_PERSPECTIVE +const camera = { + position: { x: 16, y: 16, z: 16 }, + target: { x: 0, y: 0, z: 0 }, + up: { x: 0, y: 1, z: 0 }, + fovy: 45, + projection: r.CAMERA_PERSPECTIVE +} r.SetCameraMode(camera, r.CAMERA_FREE) const rotationSpeed = 0.2 // General system rotation speed -let earthRotation = 0 // Rotation of earth around itself (days) in degrees -let earthOrbitRotation = 0 // Rotation of earth around the Sun (years) in degrees +let earthRotation = 0.0 // Rotation of earth around itself (days) in degrees +let earthOrbitRotation = 0.0 // Rotation of earth around the Sun (years) in degrees let moonRotation = 0.0 // Rotation of moon around itself -let moonOrbitRotation = 0 // Rotation of moon around earth in degrees +let moonOrbitRotation = 0.0 // Rotation of moon around earth in degrees 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()) { // Update // ---------------------------------------------------------------------------------- r.UpdateCamera(camera) - earthRotation += (5 * rotationSpeed) - earthOrbitRotation += (365 / 360 * (5 * rotationSpeed) * rotationSpeed) - moonRotation += (2 * rotationSpeed) - moonOrbitRotation += (8 * rotationSpeed) + earthRotation += (5.0 * rotationSpeed) + earthOrbitRotation += (365 / 360.0 * (5.0 * rotationSpeed) * rotationSpeed) + moonRotation += (2.0 * rotationSpeed) + moonOrbitRotation += (8.0 * rotationSpeed) // ---------------------------------------------------------------------------------- // Draw @@ -115,7 +83,6 @@ while (!r.WindowShouldClose()) { // Detect window close button or ESC key r.rlPushMatrix() r.rlRotatef(earthOrbitRotation, 0.0, 1.0, 0.0) // Rotation for Earth orbit around Sun r.rlTranslatef(earthOrbitRadius, 0.0, 0.0) // Translation for Earth orbit - r.rlRotatef(-earthOrbitRotation, 0.0, 1.0, 0.0) // Rotation for Earth orbit around Sun inverted r.rlPushMatrix() r.rlRotatef(earthRotation, 0.25, 1.0, 0.0) // Rotation for Earth itself @@ -126,7 +93,6 @@ while (!r.WindowShouldClose()) { // Detect window close button or ESC key r.rlRotatef(moonOrbitRotation, 0.0, 1.0, 0.0) // Rotation for Moon orbit around Earth r.rlTranslatef(moonOrbitRadius, 0.0, 0.0) // Translation for Moon orbit - r.rlRotatef(-moonOrbitRotation, 0.0, 1.0, 0.0) // Rotation for Moon orbit around Earth inverted r.rlRotatef(moonRotation, 0.0, 1.0, 0.0) // Rotation for Moon itself r.rlScalef(moonRadius, moonRadius, moonRadius) // Scale Moon @@ -134,7 +100,7 @@ while (!r.WindowShouldClose()) { // Detect window close button or ESC key r.rlPopMatrix() // Some reference elements (not affected by previous matrix transformations) - r.DrawCircle3D(r.Vector3(0.0, 0.0, 0.0), earthOrbitRadius, r.Vector3(1, 0, 0), 90.0, r.Fade(r.RED, 0.5)) + r.DrawCircle3D({ x: 0, y: 0, z: 0 }, earthOrbitRadius, { x: 1, y: 0, z: 0 }, 90.0, r.Fade(r.RED, 0.5)) r.DrawGrid(20, 1.0) r.EndMode3D() @@ -150,3 +116,48 @@ while (!r.WindowShouldClose()) { // Detect window close button or ESC key // -------------------------------------------------------------------------------------- r.CloseWindow() // Close window and OpenGL context // -------------------------------------------------------------------------------------- + +// -------------------------------------------------------------------------------------------- +// Module Functions Definitions (local) +// -------------------------------------------------------------------------------------------- + +// Draw sphere without any matrix transformation +// NOTE: Sphere is drawn in world position ( 0, 0, 0 ) with radius 1.0f +function DrawSphereBasic (color) { + const rings = 16 + const slices = 16 + + // Make sure there is enough space in the internal render batch + // buffer to store all required vertex, batch is reseted if required + r.rlCheckRenderBatchLimit((rings + 2) * slices * 6) + + r.rlBegin(r.RL_TRIANGLES) + r.rlColor4ub(color.r, color.g, color.b, color.a) + const cosf = Math.cos + const sinf = Math.sin + r.DEG2RAD = Math.PI / 180 + for (let i = 0; i < (rings + 2); i++) { + for (let j = 0; j < slices; j++) { + r.rlVertex3f(cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)) * sinf(r.DEG2RAD * (j * 360 / slices)), + sinf(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)), + cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)) * cosf(r.DEG2RAD * (j * 360 / slices))) + r.rlVertex3f(cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * sinf(r.DEG2RAD * ((j + 1) * 360 / slices)), + sinf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))), + cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * cosf(r.DEG2RAD * ((j + 1) * 360 / slices))) + r.rlVertex3f(cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * sinf(r.DEG2RAD * (j * 360 / slices)), + sinf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))), + cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * cosf(r.DEG2RAD * (j * 360 / slices))) + + r.rlVertex3f(cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)) * sinf(r.DEG2RAD * (j * 360 / slices)), + sinf(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)), + cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * i)) * cosf(r.DEG2RAD * (j * 360 / slices))) + r.rlVertex3f(cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i))) * sinf(r.DEG2RAD * ((j + 1) * 360 / slices)), + sinf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i))), + cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i))) * cosf(r.DEG2RAD * ((j + 1) * 360 / slices))) + r.rlVertex3f(cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * sinf(r.DEG2RAD * ((j + 1) * 360 / slices)), + sinf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))), + cosf(r.DEG2RAD * (270 + (180 / (rings + 1)) * (i + 1))) * cosf(r.DEG2RAD * ((j + 1) * 360 / slices))) + } + } + r.rlEnd() +} diff --git a/index.js b/index.js index f14dce8..a01bcfc 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ raylib.MAX_GAMEPAD_AXIS = 8 raylib.MAX_GAMEPAD_BUTTONS = 32 raylib.MAX_TOUCH_POINTS = 10 raylib.MAX_KEY_PRESSED_QUEUE = 16 - +raylib.DEG2RAD = Math.PI / 180 // Wrapped Functions /** @@ -21,5 +21,16 @@ raylib.MAX_KEY_PRESSED_QUEUE = 16 */ raylib.TextFormat = format +/** + * Define one vertex (color) - 4 byte + * @param {number} r + * @param {number} g + * @param {number} b + * @param {number} a + */ +raylib.rlColor4ub = (r, g, b, a) => { + // workaround as the C addon version isn't compiling? + raylib.rlColor4f(r / 255, g / 255, b / 255, a / 255) +} // Export the bindings for the module. module.exports = raylib diff --git a/package-lock.json b/package-lock.json index cc20774..aad12bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "raylib", - "version": "0.10.0", + "version": "0.11.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "raylib", - "version": "0.10.0", + "version": "0.11.0", "hasInstallScript": true, "license": "Zlib", "dependencies": { @@ -17,7 +17,7 @@ "raylib": "bin/node-raylib" }, "devDependencies": { - "@raylib/api": "^4.0.1", + "@raylib/api": "^4.2.0", "archiver": "^5.3.1", "jest": "^28.1.3", "jsdoc-to-markdown": "^7.1.1", @@ -92,18 +92,6 @@ "url": "https://opencollective.com/babel" } }, - "node_modules/@babel/core/node_modules/@babel/parser": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", - "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@babel/generator": { "version": "7.18.12", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.12.tgz", @@ -375,9 +363,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.18.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.4.tgz", - "integrity": "sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow==", + "version": "7.18.11", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", + "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -562,18 +550,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/template/node_modules/@babel/parser": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", - "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@babel/traverse": { "version": "7.18.11", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.11.tgz", @@ -595,18 +571,6 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/traverse/node_modules/@babel/parser": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", - "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@babel/types": { "version": "7.18.10", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.10.tgz", @@ -654,9 +618,9 @@ "dev": true }, "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -693,9 +657,9 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", - "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", + "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -706,6 +670,16 @@ "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/gitignore-to-minimatch": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", + "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -1054,9 +1028,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz", - "integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==", + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", + "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", @@ -1099,15 +1073,15 @@ } }, "node_modules/@raylib/api": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@raylib/api/-/api-4.0.1.tgz", - "integrity": "sha512-jn4Gneog5aNypz3dTarWKJxalKurlMCDLZ74293EcZmnH3mlj8j7OZEufGptVTMysTcqwOnmtI/fGVlmpb3C3A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@raylib/api/-/api-4.2.0.tgz", + "integrity": "sha512-YWUpL2zUYYaE5dSkbpUKWkSU6x/z9a9Go7ZPlvusm3BSyDBN7cH0DMrP5mQUo4VoqdpEsm0hfMGt2YOl9anWaQ==", "dev": true }, "node_modules/@sinclair/typebox": { - "version": "0.24.27", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.27.tgz", - "integrity": "sha512-K7C7IlQ3zLePEZleUN21ceBA2aLcMnLHTLph8QWk1JK37L90obdpY+QGY8bXMKxf1ht1Z0MNewvXxWv0oGDYFg==", + "version": "0.24.28", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.28.tgz", + "integrity": "sha512-dgJd3HLOkLmz4Bw50eZx/zJwtBq65nms3N9VBYu5LTjJ883oBFkTyXRlCB/ZGGwqYpJJHA5zW2Ibhl5ngITfow==", "dev": true }, "node_modules/@sinonjs/commons": { @@ -1231,9 +1205,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.6.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.4.tgz", - "integrity": "sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg==", + "version": "18.7.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.8.tgz", + "integrity": "sha512-/YP55EMK2341JkODUb8DM9O0x1SIz2aBvyF33Uf1c76St3VpsMXEIW0nxuKkq/5cxnbz0RD9cfwNZHEAZQD3ag==", "dev": true }, "node_modules/@types/prettier": { @@ -1264,9 +1238,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", - "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", + "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1571,9 +1545,9 @@ } }, "node_modules/async": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "dev": true }, "node_modules/at-least-node": { @@ -1818,9 +1792,9 @@ "dev": true }, "node_modules/builtins": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-4.1.0.tgz", - "integrity": "sha512-1bPRZQtmKaO6h7qV1YHXNtr6nCK28k0Zo95KM4dXfILcZZwoHJBN1m3lfLv9LPkcOZlrSr+J1bzMaZFO98Yq0w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", "dev": true, "dependencies": { "semver": "^7.0.0" @@ -1896,9 +1870,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001374", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001374.tgz", - "integrity": "sha512-mWvzatRx3w+j5wx/mpFN5v5twlPrabG8NqX2c6e45LCpymdoGqNvRkRutFUqpRTXKFQFNQJasvK0YT7suW6/Hw==", + "version": "1.0.30001379", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001379.tgz", + "integrity": "sha512-zXf+qxuN8OJrK5Bl5HbJg8cc5/Zm01WNW4ooVWUh92YlKqQZW3fwN5lXLB+kI8wkP5vTWkIIN+rutZuJhf4ykw==", "dev": true, "funding": [ { @@ -2186,7 +2160,7 @@ "node_modules/config-master/node_modules/walk-back": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/walk-back/-/walk-back-2.0.1.tgz", - "integrity": "sha1-VU4qnYdPrEeoywBr9EwvDEmYoKQ=", + "integrity": "sha512-Nb6GvBR8UWX1D+Le+xUq0+Q1kFmRBIWVrfLnQAOmcpEzA9oAxwJ9gIr36t9TWYfzvWRvuMtjHiVsJYEkXWaTAQ==", "dev": true, "engines": { "node": ">=0.10.0" @@ -2419,9 +2393,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.211", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.211.tgz", - "integrity": "sha512-BZSbMpyFQU0KBJ1JG26XGeFI3i4op+qOYGxftmZXFZoHkhLgsSv4DHDJfl8ogII3hIuzGt51PaZ195OVu0yJ9A==", + "version": "1.4.225", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.225.tgz", + "integrity": "sha512-ICHvGaCIQR3P88uK8aRtx8gmejbVJyC6bB4LEC3anzBrIzdzC7aiZHY4iFfXhN4st6I7lMO0x4sgBHf/7kBvRw==", "dev": true }, "node_modules/emittery": { @@ -2551,13 +2525,14 @@ } }, "node_modules/eslint": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.16.0.tgz", - "integrity": "sha512-MBndsoXY/PeVTDJeWsYj7kLZ5hQpJOfMYLsF6LicLHQWbRDG19lK5jOix4DPl8yY4SUFcE3txy86OzFLWT+yoA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.22.0.tgz", + "integrity": "sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA==", "dev": true, "dependencies": { "@eslint/eslintrc": "^1.3.0", - "@humanwhocodes/config-array": "^0.9.2", + "@humanwhocodes/config-array": "^0.10.4", + "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -2567,14 +2542,17 @@ "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.2", + "espree": "^9.3.3", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", "functional-red-black-tree": "^1.0.1", "glob-parent": "^6.0.1", "globals": "^13.15.0", + "globby": "^11.1.0", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", @@ -2672,16 +2650,20 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", - "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", + "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", "dev": true, "dependencies": { - "debug": "^3.2.7", - "find-up": "^2.1.0" + "debug": "^3.2.7" }, "engines": { "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } } }, "node_modules/eslint-module-utils/node_modules/debug": { @@ -2693,73 +2675,6 @@ "ms": "^2.1.1" } }, - "node_modules/eslint-module-utils/node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/eslint-plugin-es": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", @@ -2858,19 +2773,19 @@ "dev": true }, "node_modules/eslint-plugin-n": { - "version": "15.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.0.tgz", - "integrity": "sha512-lWLg++jGwC88GDGGBX3CMkk0GIWq0y41aH51lavWApOKcMQcYoL3Ayd0lEdtD3SnQtR+3qBvWQS3qGbR2BxRWg==", + "version": "15.2.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz", + "integrity": "sha512-tjnVMv2fiXYMnuiIFI8QMtyUFI42SckEEWvi8h68SWGWshfqO6SSCASy24dGMGAiy7NUk6DZt90DM0iNUsmQ5w==", "dev": true, "dependencies": { - "builtins": "^4.0.0", + "builtins": "^5.0.1", "eslint-plugin-es": "^4.1.0", "eslint-utils": "^3.0.0", "ignore": "^5.1.1", - "is-core-module": "^2.3.0", - "minimatch": "^3.0.4", + "is-core-module": "^2.9.0", + "minimatch": "^3.1.2", "resolve": "^1.10.1", - "semver": "^6.3.0" + "semver": "^7.3.7" }, "engines": { "node": ">=12.22.0" @@ -2882,6 +2797,21 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-n/node_modules/semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/eslint-plugin-promise": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.0.tgz", @@ -2895,9 +2825,9 @@ } }, "node_modules/eslint-plugin-react": { - "version": "7.30.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.30.0.tgz", - "integrity": "sha512-RgwH7hjW48BleKsYyHK5vUAvxtE9SMPDKmcPRQgtRCYaZA0XQPt5FSkrU3nhz5ifzMZcA8opwmRJ2cmOO8tr5A==", + "version": "7.30.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.30.1.tgz", + "integrity": "sha512-NbEvI9jtqO46yJA3wcRF9Mo0lF9T/jhdHqhCHXiXtD+Zcb98812wvokjWpU7Q4QH5edo6dmqrukxVvWWXHlsUg==", "dev": true, "dependencies": { "array-includes": "^3.1.5", @@ -2935,13 +2865,17 @@ } }, "node_modules/eslint-plugin-react/node_modules/resolve": { - "version": "2.0.0-next.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.3.tgz", - "integrity": "sha512-W8LucSynKUIDu9ylraa7ueVZ7hc0uAgJBxVsQSKOXOyle8a93qXhcz+XAXZ8bIq2d6i4Ehddn6Evt+0/UwKk6Q==", + "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", "dev": true, "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3014,6 +2948,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/eslint/node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -3027,9 +2977,9 @@ } }, "node_modules/eslint/node_modules/globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -3053,55 +3003,34 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/eslint/node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" + "p-locate": "^5.0.0" }, "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/eslint/node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "node": ">=10" }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/eslint/node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "engines": { - "node": ">= 0.8.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "dependencies": { - "prelude-ls": "^1.2.1" + "p-limit": "^3.0.2" }, "engines": { - "node": ">= 0.8.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/eslint/node_modules/type-fest": { @@ -3117,17 +3046,20 @@ } }, "node_modules/espree": { - "version": "9.3.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", - "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "version": "9.3.3", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.3.tgz", + "integrity": "sha512-ORs1Rt/uQTqUKjDdGCyrtYxbazf5umATSf/K4qxjmZHORR6HJk+2s/2Pqe+Kk49HHINC/xNIrGfgh8sZcll0ng==", "dev": true, "dependencies": { - "acorn": "^8.7.1", + "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.3.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/esprima": { @@ -3388,9 +3320,9 @@ } }, "node_modules/flatted": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", - "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, "node_modules/from2": { @@ -3544,7 +3476,7 @@ "node_modules/gauge/node_modules/strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", "dev": true, "dependencies": { "ansi-regex": "^2.0.0" @@ -3572,14 +3504,14 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", + "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3707,6 +3639,12 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "node_modules/handlebars": { "version": "4.7.7", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", @@ -4315,21 +4253,6 @@ "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, - "node_modules/jest-changed-files/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/jest-circus": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-28.1.3.tgz", @@ -4360,21 +4283,6 @@ "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, - "node_modules/jest-circus/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/jest-cli": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-28.1.3.tgz", @@ -4700,21 +4608,6 @@ "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, - "node_modules/jest-runner/node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/jest-runtime": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-28.1.3.tgz", @@ -4920,9 +4813,9 @@ } }, "node_modules/jsdoc": { - "version": "3.6.10", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.10.tgz", - "integrity": "sha512-IdQ8ppSo5LKZ9o3M+LKIIK8i00DIe5msDvG3G81Km+1dhy0XrOWD0Ji8H61ElgyEj/O9KRLokgKbAM9XX9CJAg==", + "version": "3.6.11", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.11.tgz", + "integrity": "sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg==", "dev": true, "dependencies": { "@babel/parser": "^7.9.4", @@ -4931,7 +4824,7 @@ "catharsis": "^0.9.0", "escape-string-regexp": "^2.0.0", "js2xmlparser": "^4.0.2", - "klaw": "^4.0.1", + "klaw": "^3.0.0", "markdown-it": "^12.3.2", "markdown-it-anchor": "^8.4.1", "marked": "^4.0.10", @@ -4945,7 +4838,7 @@ "jsdoc": "jsdoc.js" }, "engines": { - "node": ">=8.15.0" + "node": ">=12.0.0" } }, "node_modules/jsdoc-api": { @@ -5067,25 +4960,25 @@ } }, "node_modules/jsx-ast-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.0.tgz", - "integrity": "sha512-XzO9luP6L0xkxwhIJMTJQpZo/eeN60K08jHdexfD569AGxeNug6UketeHXEhROoM8aR7EcUoOQmIhcJQjcuq8Q==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.3.tgz", + "integrity": "sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==", "dev": true, "dependencies": { - "array-includes": "^3.1.4", - "object.assign": "^4.1.2" + "array-includes": "^3.1.5", + "object.assign": "^4.1.3" }, "engines": { "node": ">=4.0" } }, "node_modules/klaw": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-4.0.1.tgz", - "integrity": "sha512-pgsE40/SvC7st04AHiISNewaIMUbY5V/K8b21ekiPiFoYs/EYSdsGa+FJArB1d441uq4Q8zZyIxvAzkGNlBdRw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", "dev": true, - "engines": { - "node": ">=14.14.0" + "dependencies": { + "graceful-fs": "^4.1.9" } }, "node_modules/kleur": { @@ -5142,6 +5035,19 @@ "node": ">=6" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -5189,7 +5095,7 @@ "node_modules/load-json-file/node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, "engines": { "node": ">=4" @@ -5363,9 +5269,9 @@ "dev": true }, "node_modules/marked": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.16.tgz", - "integrity": "sha512-wahonIQ5Jnyatt2fn8KqF/nIqZM8mh3oRu2+l5EANGMhu6RFjiSG52QNE2eWzFMI94HqYSgN184NurgNG6CztA==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.18.tgz", + "integrity": "sha512-wbLDJ7Zh0sqA0Vdg6aqlbT+yPxqLblpAZh1mK2+AO2twQkPywvvqQNfEPVwSSRjZ7dZcdeVBIAgiO7MMp3Dszw==", "dev": true, "bin": { "marked": "bin/marked.js" @@ -5658,14 +5564,14 @@ } }, "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" }, "engines": { @@ -5760,6 +5666,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-is-promise": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", @@ -5770,15 +5693,15 @@ } }, "node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "dependencies": { - "p-try": "^2.0.0" + "yocto-queue": "^0.1.0" }, "engines": { - "node": ">=6" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5796,6 +5719,21 @@ "node": ">=8" } }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -5984,6 +5922,21 @@ "node": ">=6" } }, + "node_modules/pkg-conf/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/pkg-conf/node_modules/p-locate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", @@ -6112,7 +6065,19 @@ "jsesc": "^2.5.1" }, "engines": { - "node": ">=6.9.0" + "node": ">=6.9.0" + } + }, + "node_modules/pkg/node_modules/@babel/parser": { + "version": "7.18.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.4.tgz", + "integrity": "sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" } }, "node_modules/pkg/node_modules/@babel/types": { @@ -6169,6 +6134,15 @@ "node": ">=6" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/pretty-format": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", @@ -6298,7 +6272,7 @@ "node_modules/rc/node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", "dev": true, "engines": { "node": ">=0.10.0" @@ -6325,18 +6299,39 @@ } }, "node_modules/readdir-glob": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.1.tgz", - "integrity": "sha512-91/k1EzZwDx6HbERR+zucygRFfiPl2zkIYZtv3Jjr6Mn7SkKcVct8aVO+sSRiGMc6fLf72du3d92/uY63YPdEA==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.2.tgz", + "integrity": "sha512-6RLVvwJtVwEDfPdn6X6Ille4/lxGl0ATOY4FN/B9nxQcgOazvvI0nodiD19ScKq0PvA/29VpaOQML36o5IzZWA==", "dev": true, "dependencies": { - "minimatch": "^3.0.4" + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" } }, "node_modules/reduce-extract": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/reduce-extract/-/reduce-extract-1.0.0.tgz", - "integrity": "sha1-Z/I4W+2mUGG19fQxJmLosIDKFSU=", + "integrity": "sha512-QF8vjWx3wnRSL5uFMyCjDeDc5EBMiryoT9tz94VvgjKfzecHAVnqmXAwQDcr7X4JmLc2cjkjFGCVzhMqDjgR9g==", "dev": true, "dependencies": { "test-value": "^1.0.1" @@ -6360,7 +6355,7 @@ "node_modules/reduce-extract/node_modules/test-value": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/test-value/-/test-value-1.1.0.tgz", - "integrity": "sha1-oJE29y7AQ9J8iTcHwrFZv6196T8=", + "integrity": "sha512-wrsbRo7qP+2Je8x8DsK8ovCGyxe3sYfQwOraIY/09A2gFXU9DYKiTF14W4ki/01AEh56kMzAmlj9CaHGDDUBJA==", "dev": true, "dependencies": { "array-back": "^1.0.2", @@ -6391,7 +6386,7 @@ "node_modules/reduce-without": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/reduce-without/-/reduce-without-1.0.1.tgz", - "integrity": "sha1-aK0OrRGFXJo31OglbBW7+Hly/Iw=", + "integrity": "sha512-zQv5y/cf85sxvdrKPlfcRzlDn/OqKFThNimYmsS3flmkioKvkUGn2Qg9cJVoQiEvdxFGLE0MQER/9fZ9sUqdxg==", "dev": true, "dependencies": { "test-value": "^2.0.0" @@ -6415,7 +6410,7 @@ "node_modules/reduce-without/node_modules/test-value": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/test-value/-/test-value-2.1.0.tgz", - "integrity": "sha1-Edpv9nDzRxpztiXKTz/c97t0gpE=", + "integrity": "sha512-+1epbAxtKeXttkGFMTX9H42oqzOTufR1ceCF+GYA5aOmvaPq9wd4PUS8329fn2RRLGNeUkgRLnVpycjx8DsO2w==", "dev": true, "dependencies": { "array-back": "^1.0.3", @@ -6473,12 +6468,12 @@ } }, "node_modules/resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", "dev": true, "dependencies": { - "is-core-module": "^2.8.1", + "is-core-module": "^2.9.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -6585,7 +6580,7 @@ "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, "node_modules/shebang-command": { @@ -6811,7 +6806,7 @@ "node_modules/stream-connect": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/stream-connect/-/stream-connect-1.0.2.tgz", - "integrity": "sha1-GLyB8u2zW4tdmoAJIAqYUxRCipc=", + "integrity": "sha512-68Kl+79cE0RGKemKkhxTSg8+6AGrqBt+cbZAXevg2iJ6Y3zX4JhA/sZeGzLpxW9cXhmqAcE7KnJCisUmIUfnFQ==", "dev": true, "dependencies": { "array-back": "^1.0.2" @@ -6835,7 +6830,7 @@ "node_modules/stream-meter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.4.tgz", - "integrity": "sha1-Uq+Vql6nYKJJFxZwTb/5D3Ov3R0=", + "integrity": "sha512-4sOEtrbgFotXwnEuzzsQBYEV1elAeFSO8rSGeTwabuX1RRn/kEq9JVH7I0MRBhKVRR0sJkr0M0QCH7yOLf9fhQ==", "dev": true, "dependencies": { "readable-stream": "^2.1.4" @@ -6919,7 +6914,7 @@ "node_modules/string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", "dev": true, "dependencies": { "code-point-at": "^1.0.0", @@ -6942,7 +6937,7 @@ "node_modules/string-width/node_modules/strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", "dev": true, "dependencies": { "ansi-regex": "^2.0.0" @@ -7108,7 +7103,7 @@ "node_modules/taffydb": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", + "integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==", "dev": true }, "node_modules/tar-fs": { @@ -7142,7 +7137,7 @@ "node_modules/temp-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/temp-path/-/temp-path-1.0.0.tgz", - "integrity": "sha1-JLFUOXOrRCiW2a02fdnL2/r+kYs=", + "integrity": "sha512-TvmyH7kC6ZVTYkqCODjJIbgvu0FKiwQpZ4D1aknE7xpcDf/qEOB8KZEK5ef2pfbVoiBhNWs3yx4y+ESMtNYmlg==", "dev": true }, "node_modules/terminal-link": { @@ -7203,7 +7198,7 @@ "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, "node_modules/tmpl": { @@ -7236,7 +7231,7 @@ "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/tsconfig-paths": { "version": "3.14.1", @@ -7265,7 +7260,7 @@ "node_modules/tsconfig-paths/node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, "engines": { "node": ">=4" @@ -7274,7 +7269,7 @@ "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", "dev": true, "dependencies": { "safe-buffer": "^5.0.1" @@ -7283,6 +7278,18 @@ "node": "*" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -7307,7 +7314,7 @@ "node_modules/typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=", + "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==", "dev": true }, "node_modules/uc.micro": { @@ -7317,9 +7324,9 @@ "dev": true }, "node_modules/uglify-js": { - "version": "3.15.5", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.5.tgz", - "integrity": "sha512-hNM5q5GbBRB5xB+PMqVRcgYe4c8jbyZ1pzZhS6jbq54/4F2gFK869ZheiE5A8/t+W5jtTNpWef/5Q9zk639FNQ==", + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.0.tgz", + "integrity": "sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg==", "dev": true, "optional": true, "bin": { @@ -7345,9 +7352,9 @@ } }, "node_modules/underscore": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.3.tgz", - "integrity": "sha512-QvjkYpiD+dJJraRA8+dGAU4i7aBbb2s0S3jA45TFOvg2VgqvdCDd/3N6CqA8gluk1W91GLoXg5enMUx560QzuA==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.4.tgz", + "integrity": "sha512-BQFnUDuAQ4Yf/cYY5LNrK9NCJFKriaRbD9uR1fTeXnBeoa97W0i41qkZfGO9pSo8I5KzjAcSY2XYtdf0oKd7KQ==", "dev": true }, "node_modules/universalify": { @@ -7397,7 +7404,7 @@ "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, "node_modules/v8-compile-cache": { @@ -7441,12 +7448,12 @@ "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -7504,7 +7511,7 @@ "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", "dev": true }, "node_modules/wordwrapjs": { @@ -7523,7 +7530,7 @@ "node_modules/wordwrapjs/node_modules/reduce-flatten": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-1.0.1.tgz", - "integrity": "sha1-JYx479FT3fk8tWEjf2EYTzaW4yc=", + "integrity": "sha512-j5WfFJfc9CoXv/WbwVLHq74i/hdTUpy+iNC534LxczMRP67vJeK3V9JOdnL0N1cIRbn9mYhE2yVjvvKXDxvNXQ==", "dev": true, "engines": { "node": ">=0.10.0" @@ -7572,20 +7579,20 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "node_modules/write-file-atomic": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.1.tgz", - "integrity": "sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/xdg-basedir": { @@ -7742,14 +7749,6 @@ "gensync": "^1.0.0-beta.2", "json5": "^2.2.1", "semver": "^6.3.0" - }, - "dependencies": { - "@babel/parser": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", - "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", - "dev": true - } } }, "@babel/generator": { @@ -7961,9 +7960,9 @@ } }, "@babel/parser": { - "version": "7.18.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.4.tgz", - "integrity": "sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow==", + "version": "7.18.11", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", + "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", "dev": true }, "@babel/plugin-syntax-async-generators": { @@ -8092,14 +8091,6 @@ "@babel/code-frame": "^7.18.6", "@babel/parser": "^7.18.10", "@babel/types": "^7.18.10" - }, - "dependencies": { - "@babel/parser": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", - "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", - "dev": true - } } }, "@babel/traverse": { @@ -8118,14 +8109,6 @@ "@babel/types": "^7.18.10", "debug": "^4.1.0", "globals": "^11.1.0" - }, - "dependencies": { - "@babel/parser": { - "version": "7.18.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.11.tgz", - "integrity": "sha512-9JKn5vN+hDt0Hdqn1PiJ2guflwP+B6Ga8qbDuoF0PzzVhrzsKIJo8yGqVk6CmMHiMei9w1C1Bp9IMJSIK+HPIQ==", - "dev": true - } } }, "@babel/types": { @@ -8169,9 +8152,9 @@ "dev": true }, "globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -8195,9 +8178,9 @@ } }, "@humanwhocodes/config-array": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", - "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", + "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", @@ -8205,6 +8188,12 @@ "minimatch": "^3.0.4" } }, + "@humanwhocodes/gitignore-to-minimatch": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", + "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", + "dev": true + }, "@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -8480,9 +8469,9 @@ "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.14", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz", - "integrity": "sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==", + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", + "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", @@ -8516,15 +8505,15 @@ } }, "@raylib/api": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@raylib/api/-/api-4.0.1.tgz", - "integrity": "sha512-jn4Gneog5aNypz3dTarWKJxalKurlMCDLZ74293EcZmnH3mlj8j7OZEufGptVTMysTcqwOnmtI/fGVlmpb3C3A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@raylib/api/-/api-4.2.0.tgz", + "integrity": "sha512-YWUpL2zUYYaE5dSkbpUKWkSU6x/z9a9Go7ZPlvusm3BSyDBN7cH0DMrP5mQUo4VoqdpEsm0hfMGt2YOl9anWaQ==", "dev": true }, "@sinclair/typebox": { - "version": "0.24.27", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.27.tgz", - "integrity": "sha512-K7C7IlQ3zLePEZleUN21ceBA2aLcMnLHTLph8QWk1JK37L90obdpY+QGY8bXMKxf1ht1Z0MNewvXxWv0oGDYFg==", + "version": "0.24.28", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.28.tgz", + "integrity": "sha512-dgJd3HLOkLmz4Bw50eZx/zJwtBq65nms3N9VBYu5LTjJ883oBFkTyXRlCB/ZGGwqYpJJHA5zW2Ibhl5ngITfow==", "dev": true }, "@sinonjs/commons": { @@ -8648,9 +8637,9 @@ "dev": true }, "@types/node": { - "version": "18.6.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.4.tgz", - "integrity": "sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg==", + "version": "18.7.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.8.tgz", + "integrity": "sha512-/YP55EMK2341JkODUb8DM9O0x1SIz2aBvyF33Uf1c76St3VpsMXEIW0nxuKkq/5cxnbz0RD9cfwNZHEAZQD3ag==", "dev": true }, "@types/prettier": { @@ -8681,9 +8670,9 @@ "dev": true }, "acorn": { - "version": "8.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", - "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", + "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", "dev": true }, "acorn-jsx": { @@ -8925,9 +8914,9 @@ } }, "async": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "dev": true }, "at-least-node": { @@ -9098,9 +9087,9 @@ "dev": true }, "builtins": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-4.1.0.tgz", - "integrity": "sha512-1bPRZQtmKaO6h7qV1YHXNtr6nCK28k0Zo95KM4dXfILcZZwoHJBN1m3lfLv9LPkcOZlrSr+J1bzMaZFO98Yq0w==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", "dev": true, "requires": { "semver": "^7.0.0" @@ -9159,9 +9148,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001374", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001374.tgz", - "integrity": "sha512-mWvzatRx3w+j5wx/mpFN5v5twlPrabG8NqX2c6e45LCpymdoGqNvRkRutFUqpRTXKFQFNQJasvK0YT7suW6/Hw==", + "version": "1.0.30001379", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001379.tgz", + "integrity": "sha512-zXf+qxuN8OJrK5Bl5HbJg8cc5/Zm01WNW4ooVWUh92YlKqQZW3fwN5lXLB+kI8wkP5vTWkIIN+rutZuJhf4ykw==", "dev": true }, "catharsis": { @@ -9389,7 +9378,7 @@ "walk-back": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/walk-back/-/walk-back-2.0.1.tgz", - "integrity": "sha1-VU4qnYdPrEeoywBr9EwvDEmYoKQ=", + "integrity": "sha512-Nb6GvBR8UWX1D+Le+xUq0+Q1kFmRBIWVrfLnQAOmcpEzA9oAxwJ9gIr36t9TWYfzvWRvuMtjHiVsJYEkXWaTAQ==", "dev": true } } @@ -9565,9 +9554,9 @@ } }, "electron-to-chromium": { - "version": "1.4.211", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.211.tgz", - "integrity": "sha512-BZSbMpyFQU0KBJ1JG26XGeFI3i4op+qOYGxftmZXFZoHkhLgsSv4DHDJfl8ogII3hIuzGt51PaZ195OVu0yJ9A==", + "version": "1.4.225", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.225.tgz", + "integrity": "sha512-ICHvGaCIQR3P88uK8aRtx8gmejbVJyC6bB4LEC3anzBrIzdzC7aiZHY4iFfXhN4st6I7lMO0x4sgBHf/7kBvRw==", "dev": true }, "emittery": { @@ -9670,13 +9659,14 @@ "dev": true }, "eslint": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.16.0.tgz", - "integrity": "sha512-MBndsoXY/PeVTDJeWsYj7kLZ5hQpJOfMYLsF6LicLHQWbRDG19lK5jOix4DPl8yY4SUFcE3txy86OzFLWT+yoA==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.22.0.tgz", + "integrity": "sha512-ci4t0sz6vSRKdmkOGmprBo6fmI4PrphDFMy5JEq/fNS0gQkJM3rLmrqcp8ipMcdobH3KtUP40KniAE9W19S4wA==", "dev": true, "requires": { "@eslint/eslintrc": "^1.3.0", - "@humanwhocodes/config-array": "^0.9.2", + "@humanwhocodes/config-array": "^0.10.4", + "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -9686,14 +9676,17 @@ "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.2", + "espree": "^9.3.3", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", "functional-red-black-tree": "^1.0.1", "glob-parent": "^6.0.1", "globals": "^13.15.0", + "globby": "^11.1.0", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", @@ -9724,6 +9717,16 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, "glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -9734,9 +9737,9 @@ } }, "globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "version": "13.17.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", + "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -9751,43 +9754,22 @@ "argparse": "^2.0.1" } }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "p-locate": "^5.0.0" } }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "requires": { - "prelude-ls": "^1.2.1" + "p-limit": "^3.0.2" } }, "type-fest": { @@ -9834,13 +9816,12 @@ } }, "eslint-module-utils": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", - "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", + "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", "dev": true, "requires": { - "debug": "^3.2.7", - "find-up": "^2.1.0" + "debug": "^3.2.7" }, "dependencies": { "debug": { @@ -9851,55 +9832,6 @@ "requires": { "ms": "^2.1.1" } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true } } }, @@ -9978,19 +9910,30 @@ } }, "eslint-plugin-n": { - "version": "15.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.0.tgz", - "integrity": "sha512-lWLg++jGwC88GDGGBX3CMkk0GIWq0y41aH51lavWApOKcMQcYoL3Ayd0lEdtD3SnQtR+3qBvWQS3qGbR2BxRWg==", + "version": "15.2.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz", + "integrity": "sha512-tjnVMv2fiXYMnuiIFI8QMtyUFI42SckEEWvi8h68SWGWshfqO6SSCASy24dGMGAiy7NUk6DZt90DM0iNUsmQ5w==", "dev": true, "requires": { - "builtins": "^4.0.0", + "builtins": "^5.0.1", "eslint-plugin-es": "^4.1.0", "eslint-utils": "^3.0.0", "ignore": "^5.1.1", - "is-core-module": "^2.3.0", - "minimatch": "^3.0.4", + "is-core-module": "^2.9.0", + "minimatch": "^3.1.2", "resolve": "^1.10.1", - "semver": "^6.3.0" + "semver": "^7.3.7" + }, + "dependencies": { + "semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "eslint-plugin-promise": { @@ -10001,9 +9944,9 @@ "requires": {} }, "eslint-plugin-react": { - "version": "7.30.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.30.0.tgz", - "integrity": "sha512-RgwH7hjW48BleKsYyHK5vUAvxtE9SMPDKmcPRQgtRCYaZA0XQPt5FSkrU3nhz5ifzMZcA8opwmRJ2cmOO8tr5A==", + "version": "7.30.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.30.1.tgz", + "integrity": "sha512-NbEvI9jtqO46yJA3wcRF9Mo0lF9T/jhdHqhCHXiXtD+Zcb98812wvokjWpU7Q4QH5edo6dmqrukxVvWWXHlsUg==", "dev": true, "requires": { "array-includes": "^3.1.5", @@ -10032,13 +9975,14 @@ } }, "resolve": { - "version": "2.0.0-next.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.3.tgz", - "integrity": "sha512-W8LucSynKUIDu9ylraa7ueVZ7hc0uAgJBxVsQSKOXOyle8a93qXhcz+XAXZ8bIq2d6i4Ehddn6Evt+0/UwKk6Q==", + "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", "dev": true, "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" } } } @@ -10077,12 +10021,12 @@ "dev": true }, "espree": { - "version": "9.3.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", - "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "version": "9.3.3", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.3.tgz", + "integrity": "sha512-ORs1Rt/uQTqUKjDdGCyrtYxbazf5umATSf/K4qxjmZHORR6HJk+2s/2Pqe+Kk49HHINC/xNIrGfgh8sZcll0ng==", "dev": true, "requires": { - "acorn": "^8.7.1", + "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.3.0" } @@ -10288,9 +10232,9 @@ } }, "flatted": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", - "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, "from2": { @@ -10421,7 +10365,7 @@ "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", "dev": true, "requires": { "ansi-regex": "^2.0.0" @@ -10442,14 +10386,14 @@ "dev": true }, "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", + "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" } }, "get-package-type": { @@ -10535,6 +10479,12 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "handlebars": { "version": "4.7.7", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", @@ -10945,17 +10895,6 @@ "requires": { "execa": "^5.0.0", "p-limit": "^3.1.0" - }, - "dependencies": { - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - } } }, "jest-circus": { @@ -10983,17 +10922,6 @@ "pretty-format": "^28.1.3", "slash": "^3.0.0", "stack-utils": "^2.0.3" - }, - "dependencies": { - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - } } }, "jest-cli": { @@ -11236,17 +11164,6 @@ "jest-worker": "^28.1.3", "p-limit": "^3.1.0", "source-map-support": "0.5.13" - }, - "dependencies": { - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - } } }, "jest-runtime": { @@ -11421,9 +11338,9 @@ } }, "jsdoc": { - "version": "3.6.10", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.10.tgz", - "integrity": "sha512-IdQ8ppSo5LKZ9o3M+LKIIK8i00DIe5msDvG3G81Km+1dhy0XrOWD0Ji8H61ElgyEj/O9KRLokgKbAM9XX9CJAg==", + "version": "3.6.11", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.11.tgz", + "integrity": "sha512-8UCU0TYeIYD9KeLzEcAu2q8N/mx9O3phAGl32nmHlE0LpaJL71mMkP4d+QE5zWfNt50qheHtOZ0qoxVrsX5TUg==", "dev": true, "requires": { "@babel/parser": "^7.9.4", @@ -11432,7 +11349,7 @@ "catharsis": "^0.9.0", "escape-string-regexp": "^2.0.0", "js2xmlparser": "^4.0.2", - "klaw": "^4.0.1", + "klaw": "^3.0.0", "markdown-it": "^12.3.2", "markdown-it-anchor": "^8.4.1", "marked": "^4.0.10", @@ -11536,20 +11453,23 @@ } }, "jsx-ast-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.0.tgz", - "integrity": "sha512-XzO9luP6L0xkxwhIJMTJQpZo/eeN60K08jHdexfD569AGxeNug6UketeHXEhROoM8aR7EcUoOQmIhcJQjcuq8Q==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.3.tgz", + "integrity": "sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==", "dev": true, "requires": { - "array-includes": "^3.1.4", - "object.assign": "^4.1.2" + "array-includes": "^3.1.5", + "object.assign": "^4.1.3" } }, "klaw": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-4.0.1.tgz", - "integrity": "sha512-pgsE40/SvC7st04AHiISNewaIMUbY5V/K8b21ekiPiFoYs/EYSdsGa+FJArB1d441uq4Q8zZyIxvAzkGNlBdRw==", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.9" + } }, "kleur": { "version": "3.0.3", @@ -11598,6 +11518,16 @@ "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", "dev": true }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -11639,7 +11569,7 @@ "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true }, "type-fest": { @@ -11790,9 +11720,9 @@ "requires": {} }, "marked": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.16.tgz", - "integrity": "sha512-wahonIQ5Jnyatt2fn8KqF/nIqZM8mh3oRu2+l5EANGMhu6RFjiSG52QNE2eWzFMI94HqYSgN184NurgNG6CztA==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.0.18.tgz", + "integrity": "sha512-wbLDJ7Zh0sqA0Vdg6aqlbT+yPxqLblpAZh1mK2+AO2twQkPywvvqQNfEPVwSSRjZ7dZcdeVBIAgiO7MMp3Dszw==", "dev": true }, "mdurl": { @@ -12008,14 +11938,14 @@ "dev": true }, "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" } }, @@ -12080,6 +12010,20 @@ "mimic-fn": "^2.1.0" } }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, "p-is-promise": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", @@ -12087,12 +12031,12 @@ "dev": true }, "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "requires": { - "p-try": "^2.0.0" + "yocto-queue": "^0.1.0" } }, "p-locate": { @@ -12102,6 +12046,17 @@ "dev": true, "requires": { "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + } } }, "p-try": { @@ -12218,6 +12173,12 @@ "jsesc": "^2.5.1" } }, + "@babel/parser": { + "version": "7.18.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.4.tgz", + "integrity": "sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow==", + "dev": true + }, "@babel/types": { "version": "7.18.4", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.4.tgz", @@ -12270,6 +12231,15 @@ "path-exists": "^3.0.0" } }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, "p-locate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", @@ -12382,6 +12352,12 @@ "tunnel-agent": "^0.6.0" } }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, "pretty-format": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", @@ -12480,7 +12456,7 @@ "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", "dev": true } } @@ -12503,18 +12479,38 @@ } }, "readdir-glob": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.1.tgz", - "integrity": "sha512-91/k1EzZwDx6HbERR+zucygRFfiPl2zkIYZtv3Jjr6Mn7SkKcVct8aVO+sSRiGMc6fLf72du3d92/uY63YPdEA==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.2.tgz", + "integrity": "sha512-6RLVvwJtVwEDfPdn6X6Ille4/lxGl0ATOY4FN/B9nxQcgOazvvI0nodiD19ScKq0PvA/29VpaOQML36o5IzZWA==", "dev": true, "requires": { - "minimatch": "^3.0.4" + "minimatch": "^5.1.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "reduce-extract": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/reduce-extract/-/reduce-extract-1.0.0.tgz", - "integrity": "sha1-Z/I4W+2mUGG19fQxJmLosIDKFSU=", + "integrity": "sha512-QF8vjWx3wnRSL5uFMyCjDeDc5EBMiryoT9tz94VvgjKfzecHAVnqmXAwQDcr7X4JmLc2cjkjFGCVzhMqDjgR9g==", "dev": true, "requires": { "test-value": "^1.0.1" @@ -12532,7 +12528,7 @@ "test-value": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/test-value/-/test-value-1.1.0.tgz", - "integrity": "sha1-oJE29y7AQ9J8iTcHwrFZv6196T8=", + "integrity": "sha512-wrsbRo7qP+2Je8x8DsK8ovCGyxe3sYfQwOraIY/09A2gFXU9DYKiTF14W4ki/01AEh56kMzAmlj9CaHGDDUBJA==", "dev": true, "requires": { "array-back": "^1.0.2", @@ -12556,7 +12552,7 @@ "reduce-without": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/reduce-without/-/reduce-without-1.0.1.tgz", - "integrity": "sha1-aK0OrRGFXJo31OglbBW7+Hly/Iw=", + "integrity": "sha512-zQv5y/cf85sxvdrKPlfcRzlDn/OqKFThNimYmsS3flmkioKvkUGn2Qg9cJVoQiEvdxFGLE0MQER/9fZ9sUqdxg==", "dev": true, "requires": { "test-value": "^2.0.0" @@ -12574,7 +12570,7 @@ "test-value": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/test-value/-/test-value-2.1.0.tgz", - "integrity": "sha1-Edpv9nDzRxpztiXKTz/c97t0gpE=", + "integrity": "sha512-+1epbAxtKeXttkGFMTX9H42oqzOTufR1ceCF+GYA5aOmvaPq9wd4PUS8329fn2RRLGNeUkgRLnVpycjx8DsO2w==", "dev": true, "requires": { "array-back": "^1.0.3", @@ -12616,12 +12612,12 @@ } }, "resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", "dev": true, "requires": { - "is-core-module": "^2.8.1", + "is-core-module": "^2.9.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -12686,7 +12682,7 @@ "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, "shebang-command": { @@ -12836,7 +12832,7 @@ "stream-connect": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/stream-connect/-/stream-connect-1.0.2.tgz", - "integrity": "sha1-GLyB8u2zW4tdmoAJIAqYUxRCipc=", + "integrity": "sha512-68Kl+79cE0RGKemKkhxTSg8+6AGrqBt+cbZAXevg2iJ6Y3zX4JhA/sZeGzLpxW9cXhmqAcE7KnJCisUmIUfnFQ==", "dev": true, "requires": { "array-back": "^1.0.2" @@ -12856,7 +12852,7 @@ "stream-meter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.4.tgz", - "integrity": "sha1-Uq+Vql6nYKJJFxZwTb/5D3Ov3R0=", + "integrity": "sha512-4sOEtrbgFotXwnEuzzsQBYEV1elAeFSO8rSGeTwabuX1RRn/kEq9JVH7I0MRBhKVRR0sJkr0M0QCH7yOLf9fhQ==", "dev": true, "requires": { "readable-stream": "^2.1.4" @@ -12924,7 +12920,7 @@ "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", "dev": true, "requires": { "code-point-at": "^1.0.0", @@ -12941,7 +12937,7 @@ "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", "dev": true, "requires": { "ansi-regex": "^2.0.0" @@ -13066,7 +13062,7 @@ "taffydb": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", - "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", + "integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==", "dev": true }, "tar-fs": { @@ -13097,7 +13093,7 @@ "temp-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/temp-path/-/temp-path-1.0.0.tgz", - "integrity": "sha1-JLFUOXOrRCiW2a02fdnL2/r+kYs=", + "integrity": "sha512-TvmyH7kC6ZVTYkqCODjJIbgvu0FKiwQpZ4D1aknE7xpcDf/qEOB8KZEK5ef2pfbVoiBhNWs3yx4y+ESMtNYmlg==", "dev": true }, "terminal-link": { @@ -13145,7 +13141,7 @@ "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, "tmpl": { @@ -13172,7 +13168,7 @@ "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "tsconfig-paths": { "version": "3.14.1", @@ -13198,7 +13194,7 @@ "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true } } @@ -13206,12 +13202,21 @@ "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", "dev": true, "requires": { "safe-buffer": "^5.0.1" } }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -13227,7 +13232,7 @@ "typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=", + "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==", "dev": true }, "uc.micro": { @@ -13237,9 +13242,9 @@ "dev": true }, "uglify-js": { - "version": "3.15.5", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.5.tgz", - "integrity": "sha512-hNM5q5GbBRB5xB+PMqVRcgYe4c8jbyZ1pzZhS6jbq54/4F2gFK869ZheiE5A8/t+W5jtTNpWef/5Q9zk639FNQ==", + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.0.tgz", + "integrity": "sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg==", "dev": true, "optional": true }, @@ -13256,9 +13261,9 @@ } }, "underscore": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.3.tgz", - "integrity": "sha512-QvjkYpiD+dJJraRA8+dGAU4i7aBbb2s0S3jA45TFOvg2VgqvdCDd/3N6CqA8gluk1W91GLoXg5enMUx560QzuA==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.4.tgz", + "integrity": "sha512-BQFnUDuAQ4Yf/cYY5LNrK9NCJFKriaRbD9uR1fTeXnBeoa97W0i41qkZfGO9pSo8I5KzjAcSY2XYtdf0oKd7KQ==", "dev": true }, "universalify": { @@ -13289,7 +13294,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, "v8-compile-cache": { @@ -13327,12 +13332,12 @@ "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "requires": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -13378,7 +13383,7 @@ "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", "dev": true }, "wordwrapjs": { @@ -13394,7 +13399,7 @@ "reduce-flatten": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-1.0.1.tgz", - "integrity": "sha1-JYx479FT3fk8tWEjf2EYTzaW4yc=", + "integrity": "sha512-j5WfFJfc9CoXv/WbwVLHq74i/hdTUpy+iNC534LxczMRP67vJeK3V9JOdnL0N1cIRbn9mYhE2yVjvvKXDxvNXQ==", "dev": true } } @@ -13432,13 +13437,13 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "write-file-atomic": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.1.tgz", - "integrity": "sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "requires": { "imurmurhash": "^0.1.4", diff --git a/package.json b/package.json index a4efa5f..85c905c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "raylib", - "version": "0.10.0", + "version": "0.11.0", "description": "Node.js bindings for raylib.", "main": "index.js", "types": "src/generated/node-raylib.d.ts", @@ -62,7 +62,7 @@ "module-alias": "^2.2.2" }, "devDependencies": { - "@raylib/api": "^4.0.1", + "@raylib/api": "^4.2.0", "archiver": "^5.3.1", "jest": "^28.1.3", "jsdoc-to-markdown": "^7.1.1", diff --git a/src/extras/raygui.h b/src/extras/raygui.h new file mode 100644 index 0000000..38440de --- /dev/null +++ b/src/extras/raygui.h @@ -0,0 +1,4505 @@ +/******************************************************************************************* +* +* raygui v3.2 - 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. +* +* Controls provided: +* +* # Container/separators Controls +* - WindowBox --> StatusBar, Panel +* - GroupBox --> Line +* - Line +* - Panel --> StatusBar +* - ScrollPanel --> StatusBar +* +* # Basic Controls +* - Label +* - Button +* - LabelButton --> Label +* - Toggle +* - ToggleGroup --> Toggle +* - CheckBox +* - ComboBox +* - DropdownBox +* - TextBox +* - TextBoxMulti +* - ValueBox --> TextBox +* - Spinner --> Button, ValueBox +* - Slider +* - SliderBar --> Slider +* - ProgressBar +* - StatusBar +* - DummyRec +* - Grid +* +* # 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). +* +* +* 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 +* +* 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)]; +* +* 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. +* +* 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. +* +* TOOL: rGuiStyler is a visual tool to customize raygui style. +* +* +* 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 +* +* 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. +* +* 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]; +* +* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB +* +* TOOL: rGuiIcons is a visual tool to customize raygui icons. +* +* +* 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_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_CUSTOM_ICONS +* Includes custom ricons.h header defining a set of custom icons, +* this file can be generated using rGuiIcons tool +* +* +* VERSIONS HISTORY: +* 3.2 (22-May-2022) RENAMED: Some enum values, for unification, avoiding prefixes +* REMOVED: GuiScrollBar(), only internal +* REDESIGNED: GuiPanel() to support text parameter +* REDESIGNED: GuiScrollPanel() to support text parameter +* REDESIGNED: GuiColorPicker() to support text parameter +* REDESIGNED: GuiColorPanel() to support text parameter +* 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 +* REVIEWED: GuiLine() for centered alignment when including text +* 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 +* 2.6 (09-Sep-2019) ADDED: GuiTextInputBox() +* REDESIGNED: GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox() +* REVIEWED: GuiTextBox(), GuiSpinner(), GuiValueBox(), GuiLoadStyle() +* 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 +* 2.2 (05-Feb-2019) ADDED: GuiScrollBar(), GuiScrollPanel(), reviewed GuiListView(), removed Gui*Ex() controls +* 2.1 (26-Dec-2018) REDESIGNED: GuiCheckBox(), GuiComboBox(), GuiDropdownBox(), GuiToggleGroup() > Use combined text string +* REDESIGNED: Style system (breaking change) +* 2.0 (08-Nov-2018) ADDED: Support controls guiLock and custom fonts +* REVIEWED: GuiComboBox(), GuiListView()... +* 1.9 (09-Oct-2018) REVIEWED: GuiGrid(), GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()... +* 1.8 (01-May-2018) Lot of rework and redesign to align with rGuiStyler and rGuiLayout +* 1.5 (21-Jun-2017) Working in an improved styles system +* 1.4 (15-Jun-2017) Rewritten all GUI functions (removed useless ones) +* 1.3 (12-Jun-2017) Complete redesign of style system +* 1.1 (01-Jun-2017) Complete review of the library +* 1.0 (07-Jun-2016) Converted to header-only by Ramon Santamaria. +* 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. +* +* +* 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) +* 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) +* Daniel Nicolas: Initial implementation of basic components (2014) +* +* +* LICENSE: zlib/libpng +* +* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) +* +* This software is provided "as-is", without any express or implied warranty. In no event +* will the authors be held liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, including commercial +* applications, and to alter it and redistribute it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not claim that you +* wrote the original software. If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but is not required. +* +* 2. Altered source versions must be plainly marked as such, and must not be misrepresented +* as being the original software. +* +* 3. This notice may not be removed or altered from any source distribution. +* +**********************************************************************************************/ + +#ifndef RAYGUI_H +#define RAYGUI_H + +#define RAYGUI_VERSION "3.2" + +#if !defined(RAYGUI_STANDALONE) + #include "raylib.h" +#endif + +// Function specifiers in case library is build/used as a shared library (Windows) +// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll +#if defined(_WIN32) + #if defined(BUILD_LIBTYPE_SHARED) + #define RAYGUIAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll) + #elif defined(USE_LIBTYPE_SHARED) + #define RAYGUIAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll) + #endif +#endif + +// Function specifiers definition +#ifndef RAYGUIAPI + #define RAYGUIAPI // Functions defined as 'extern' by default (implicit specifiers) +#endif + +//---------------------------------------------------------------------------------- +// Defines and Macros +//---------------------------------------------------------------------------------- +// Allow custom memory allocators +#ifndef RAYGUI_MALLOC + #define RAYGUI_MALLOC(sz) malloc(sz) +#endif +#ifndef RAYGUI_CALLOC + #define RAYGUI_CALLOC(n,sz) calloc(n,sz) +#endif +#ifndef RAYGUI_FREE + #define RAYGUI_FREE(p) free(p) +#endif + +// Simple log system to avoid printf() calls if required +// NOTE: Avoiding those calls, also avoids const strings memory usage +#define RAYGUI_SUPPORT_LOG_INFO +#if defined(RAYGUI_SUPPORT_LOG_INFO) + #define RAYGUI_LOG(...) printf(__VA_ARGS__) +#else + #define RAYGUI_LOG(...) +#endif + +//---------------------------------------------------------------------------------- +// Types and Structures Definition +// NOTE: Some types are required for RAYGUI_STANDALONE usage +//---------------------------------------------------------------------------------- +#if defined(RAYGUI_STANDALONE) + #ifndef __cplusplus + // Boolean type + #ifndef true + typedef enum { false, true } bool; + #endif + #endif + + // Vector2 type + typedef struct Vector2 { + float x; + float y; + } Vector2; + + // Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV() + typedef struct Vector3 { + float x; + float y; + float z; + } Vector3; + + // Color type, RGBA (32bit) + typedef struct Color { + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; + } Color; + + // Rectangle type + typedef struct Rectangle { + float x; + float y; + float width; + float height; + } Rectangle; + + // TODO: Texture2D type is very coupled to raylib, required by Font type + // It should be redesigned to be provided by user + typedef struct Texture2D { + unsigned int id; // OpenGL texture id + int width; // Texture base width + int height; // Texture base height + int mipmaps; // Mipmap levels, 1 by default + int format; // Data format (PixelFormat type) + } Texture2D; + + // GlyphInfo, font characters glyphs info + typedef struct GlyphInfo { + int value; // Character value (Unicode) + int offsetX; // Character offset X when drawing + int offsetY; // Character offset Y when drawing + int advanceX; // Character advance position X + Image image; // Character image data + } GlyphInfo; + + // TODO: Font type is very coupled to raylib, mostly required by GuiLoadStyle() + // It should be redesigned to be provided by user + typedef struct Font { + int baseSize; // Base size (default chars height) + int glyphCount; // Number of characters + Texture2D texture; // Characters texture atlas + Rectangle *recs; // Characters rectangles in texture + GlyphInfo *chars; // Characters info data + } Font; +#endif + +// Style property +typedef struct GuiStyleProp { + unsigned short controlId; + unsigned short propertyId; + unsigned int propertyValue; +} GuiStyleProp; + +// Gui control state +typedef enum { + STATE_NORMAL = 0, + STATE_FOCUSED, + STATE_PRESSED, + STATE_DISABLED, +} GuiState; + +// Gui control text alignment +typedef enum { + TEXT_ALIGN_LEFT = 0, + TEXT_ALIGN_CENTER, + TEXT_ALIGN_RIGHT, +} GuiTextAlignment; + +// 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 + PROGRESSBAR, + CHECKBOX, + COMBOBOX, + DROPDOWNBOX, + TEXTBOX, // Used also for: TEXTBOXMULTI + VALUEBOX, + SPINNER, // Uses: BUTTON, VALUEBOX + LISTVIEW, + COLORPICKER, + SCROLLBAR, + STATUSBAR +} GuiControl; + +// 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 +} GuiControlProperty; + +// Gui extended properties depend on control +// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default 8 properties) +//---------------------------------------------------------------------------------- + +// DEFAULT extended properties +// NOTE: Those properties are common to all controls or global +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 +} GuiDefaultProperty; + +// Label +//typedef enum { } GuiLabelProperty; + +// Button/Spinner +//typedef enum { } GuiButtonProperty; + +// Toggle/ToggleGroup +typedef enum { + GROUP_PADDING = 16, // ToggleGroup separation between toggles +} GuiToggleProperty; + +// Slider/SliderBar +typedef enum { + SLIDER_WIDTH = 16, // Slider size of internal bar + SLIDER_PADDING // Slider/SliderBar internal bar padding +} GuiSliderProperty; + +// ProgressBar +typedef enum { + PROGRESS_PADDING = 16, // ProgressBar internal padding +} GuiProgressBarProperty; + +// ScrollBar +typedef enum { + ARROWS_SIZE = 16, + ARROWS_VISIBLE, + SCROLL_SLIDER_PADDING, // (SLIDERBAR, SLIDER_PADDING) + SCROLL_SLIDER_SIZE, + SCROLL_PADDING, + SCROLL_SPEED, +} GuiScrollBarProperty; + +// CheckBox +typedef enum { + CHECK_PADDING = 16 // CheckBox internal check padding +} GuiCheckBoxProperty; + +// ComboBox +typedef enum { + COMBO_BUTTON_WIDTH = 16, // ComboBox right button width + COMBO_BUTTON_SPACING // ComboBox button separation +} GuiComboBoxProperty; + +// DropdownBox +typedef enum { + ARROW_PADDING = 16, // DropdownBox arrow separation from border and items + DROPDOWN_ITEMS_SPACING // DropdownBox items separation +} GuiDropdownBoxProperty; + +// TextBox/TextBoxMulti/ValueBox/Spinner +typedef enum { + TEXT_INNER_PADDING = 16, // TextBox/TextBoxMulti/ValueBox/Spinner inner text padding + TEXT_LINES_SPACING, // TextBoxMulti lines separation +} GuiTextBoxProperty; + +// Spinner +typedef enum { + SPIN_BUTTON_WIDTH = 16, // Spinner left/right buttons width + SPIN_BUTTON_SPACING, // Spinner buttons separation +} GuiSpinnerProperty; + +// ListView +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) +} GuiListViewProperty; + +// ColorPicker +typedef enum { + COLOR_SELECTOR_SIZE = 16, + HUEBAR_WIDTH, // ColorPicker right hue bar width + HUEBAR_PADDING, // ColorPicker right hue bar separation from panel + HUEBAR_SELECTOR_HEIGHT, // ColorPicker right hue bar selector height + HUEBAR_SELECTOR_OVERFLOW // ColorPicker right hue bar selector overflow +} GuiColorPickerProperty; + +#define SCROLLBAR_LEFT_SIDE 0 +#define SCROLLBAR_RIGHT_SIDE 1 + +//---------------------------------------------------------------------------------- +// Global Variables Definition +//---------------------------------------------------------------------------------- +// ... + +//---------------------------------------------------------------------------------- +// Module Functions Declaration +//---------------------------------------------------------------------------------- + +#if defined(__cplusplus) +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) + +// 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) + +// 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 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 + +// 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 + +// 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 GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color); + +RAYGUIAPI unsigned int *GuiGetIcons(void); // Get full icons data pointer +RAYGUIAPI unsigned int *GuiGetIconData(int iconId); // Get icon bit data +RAYGUIAPI void GuiSetIconData(int iconId, unsigned int *data); // Set icon bit data +RAYGUIAPI void GuiSetIconScale(unsigned int scale); // Set icon scale (1 by default) + +RAYGUIAPI void GuiSetIconPixel(int iconId, int x, int y); // Set icon pixel value +RAYGUIAPI void GuiClearIconPixel(int iconId, int x, int y); // Clear icon pixel value +RAYGUIAPI bool GuiCheckIconPixel(int iconId, int x, int y); // Check icon pixel value + +#if !defined(RAYGUI_CUSTOM_ICONS) +//---------------------------------------------------------------------------------- +// Icons enumeration +//---------------------------------------------------------------------------------- +typedef enum { + ICON_NONE = 0, + ICON_FOLDER_FILE_OPEN = 1, + ICON_FILE_SAVE_CLASSIC = 2, + ICON_FOLDER_OPEN = 3, + ICON_FOLDER_SAVE = 4, + ICON_FILE_OPEN = 5, + ICON_FILE_SAVE = 6, + ICON_FILE_EXPORT = 7, + ICON_FILE_ADD = 8, + ICON_FILE_DELETE = 9, + ICON_FILETYPE_TEXT = 10, + ICON_FILETYPE_AUDIO = 11, + ICON_FILETYPE_IMAGE = 12, + ICON_FILETYPE_PLAY = 13, + ICON_FILETYPE_VIDEO = 14, + ICON_FILETYPE_INFO = 15, + ICON_FILE_COPY = 16, + ICON_FILE_CUT = 17, + ICON_FILE_PASTE = 18, + ICON_CURSOR_HAND = 19, + ICON_CURSOR_POINTER = 20, + ICON_CURSOR_CLASSIC = 21, + ICON_PENCIL = 22, + ICON_PENCIL_BIG = 23, + ICON_BRUSH_CLASSIC = 24, + ICON_BRUSH_PAINTER = 25, + ICON_WATER_DROP = 26, + ICON_COLOR_PICKER = 27, + ICON_RUBBER = 28, + ICON_COLOR_BUCKET = 29, + ICON_TEXT_T = 30, + ICON_TEXT_A = 31, + ICON_SCALE = 32, + ICON_RESIZE = 33, + ICON_FILTER_POINT = 34, + ICON_FILTER_BILINEAR = 35, + ICON_CROP = 36, + ICON_CROP_ALPHA = 37, + ICON_SQUARE_TOGGLE = 38, + ICON_SYMMETRY = 39, + ICON_SYMMETRY_HORIZONTAL = 40, + ICON_SYMMETRY_VERTICAL = 41, + ICON_LENS = 42, + ICON_LENS_BIG = 43, + ICON_EYE_ON = 44, + ICON_EYE_OFF = 45, + ICON_FILTER_TOP = 46, + ICON_FILTER = 47, + ICON_TARGET_POINT = 48, + ICON_TARGET_SMALL = 49, + ICON_TARGET_BIG = 50, + ICON_TARGET_MOVE = 51, + ICON_CURSOR_MOVE = 52, + ICON_CURSOR_SCALE = 53, + ICON_CURSOR_SCALE_RIGHT = 54, + ICON_CURSOR_SCALE_LEFT = 55, + ICON_UNDO = 56, + ICON_REDO = 57, + ICON_REREDO = 58, + ICON_MUTATE = 59, + ICON_ROTATE = 60, + ICON_REPEAT = 61, + ICON_SHUFFLE = 62, + ICON_EMPTYBOX = 63, + ICON_TARGET = 64, + ICON_TARGET_SMALL_FILL = 65, + ICON_TARGET_BIG_FILL = 66, + ICON_TARGET_MOVE_FILL = 67, + ICON_CURSOR_MOVE_FILL = 68, + ICON_CURSOR_SCALE_FILL = 69, + ICON_CURSOR_SCALE_RIGHT_FILL = 70, + ICON_CURSOR_SCALE_LEFT_FILL = 71, + ICON_UNDO_FILL = 72, + ICON_REDO_FILL = 73, + ICON_REREDO_FILL = 74, + ICON_MUTATE_FILL = 75, + ICON_ROTATE_FILL = 76, + ICON_REPEAT_FILL = 77, + ICON_SHUFFLE_FILL = 78, + ICON_EMPTYBOX_SMALL = 79, + ICON_BOX = 80, + ICON_BOX_TOP = 81, + ICON_BOX_TOP_RIGHT = 82, + ICON_BOX_RIGHT = 83, + ICON_BOX_BOTTOM_RIGHT = 84, + ICON_BOX_BOTTOM = 85, + ICON_BOX_BOTTOM_LEFT = 86, + ICON_BOX_LEFT = 87, + ICON_BOX_TOP_LEFT = 88, + ICON_BOX_CENTER = 89, + ICON_BOX_CIRCLE_MASK = 90, + ICON_POT = 91, + ICON_ALPHA_MULTIPLY = 92, + ICON_ALPHA_CLEAR = 93, + ICON_DITHERING = 94, + ICON_MIPMAPS = 95, + ICON_BOX_GRID = 96, + ICON_GRID = 97, + ICON_BOX_CORNERS_SMALL = 98, + ICON_BOX_CORNERS_BIG = 99, + ICON_FOUR_BOXES = 100, + ICON_GRID_FILL = 101, + ICON_BOX_MULTISIZE = 102, + ICON_ZOOM_SMALL = 103, + ICON_ZOOM_MEDIUM = 104, + ICON_ZOOM_BIG = 105, + ICON_ZOOM_ALL = 106, + ICON_ZOOM_CENTER = 107, + ICON_BOX_DOTS_SMALL = 108, + ICON_BOX_DOTS_BIG = 109, + ICON_BOX_CONCENTRIC = 110, + ICON_BOX_GRID_BIG = 111, + ICON_OK_TICK = 112, + ICON_CROSS = 113, + ICON_ARROW_LEFT = 114, + ICON_ARROW_RIGHT = 115, + ICON_ARROW_DOWN = 116, + ICON_ARROW_UP = 117, + ICON_ARROW_LEFT_FILL = 118, + ICON_ARROW_RIGHT_FILL = 119, + ICON_ARROW_DOWN_FILL = 120, + ICON_ARROW_UP_FILL = 121, + ICON_AUDIO = 122, + ICON_FX = 123, + ICON_WAVE = 124, + ICON_WAVE_SINUS = 125, + ICON_WAVE_SQUARE = 126, + ICON_WAVE_TRIANGULAR = 127, + ICON_CROSS_SMALL = 128, + ICON_PLAYER_PREVIOUS = 129, + ICON_PLAYER_PLAY_BACK = 130, + ICON_PLAYER_PLAY = 131, + ICON_PLAYER_PAUSE = 132, + ICON_PLAYER_STOP = 133, + ICON_PLAYER_NEXT = 134, + ICON_PLAYER_RECORD = 135, + ICON_MAGNET = 136, + ICON_LOCK_CLOSE = 137, + ICON_LOCK_OPEN = 138, + ICON_CLOCK = 139, + ICON_TOOLS = 140, + ICON_GEAR = 141, + ICON_GEAR_BIG = 142, + ICON_BIN = 143, + ICON_HAND_POINTER = 144, + ICON_LASER = 145, + ICON_COIN = 146, + ICON_EXPLOSION = 147, + ICON_1UP = 148, + ICON_PLAYER = 149, + ICON_PLAYER_JUMP = 150, + ICON_KEY = 151, + ICON_DEMON = 152, + ICON_TEXT_POPUP = 153, + ICON_GEAR_EX = 154, + ICON_CRACK = 155, + ICON_CRACK_POINTS = 156, + ICON_STAR = 157, + ICON_DOOR = 158, + ICON_EXIT = 159, + ICON_MODE_2D = 160, + ICON_MODE_3D = 161, + ICON_CUBE = 162, + ICON_CUBE_FACE_TOP = 163, + ICON_CUBE_FACE_LEFT = 164, + ICON_CUBE_FACE_FRONT = 165, + ICON_CUBE_FACE_BOTTOM = 166, + ICON_CUBE_FACE_RIGHT = 167, + ICON_CUBE_FACE_BACK = 168, + ICON_CAMERA = 169, + ICON_SPECIAL = 170, + ICON_LINK_NET = 171, + ICON_LINK_BOXES = 172, + ICON_LINK_MULTI = 173, + ICON_LINK = 174, + ICON_LINK_BROKE = 175, + ICON_TEXT_NOTES = 176, + ICON_NOTEBOOK = 177, + ICON_SUITCASE = 178, + ICON_SUITCASE_ZIP = 179, + ICON_MAILBOX = 180, + ICON_MONITOR = 181, + ICON_PRINTER = 182, + ICON_PHOTO_CAMERA = 183, + ICON_PHOTO_CAMERA_FLASH = 184, + ICON_HOUSE = 185, + ICON_HEART = 186, + ICON_CORNER = 187, + ICON_VERTICAL_BARS = 188, + ICON_VERTICAL_BARS_FILL = 189, + ICON_LIFE_BARS = 190, + ICON_INFO = 191, + ICON_CROSSLINE = 192, + ICON_HELP = 193, + ICON_FILETYPE_ALPHA = 194, + ICON_FILETYPE_HOME = 195, + ICON_LAYERS_VISIBLE = 196, + ICON_LAYERS = 197, + ICON_WINDOW = 198, + ICON_HIDPI = 199, + ICON_FILETYPE_BINARY = 200, + ICON_HEX = 201, + ICON_SHIELD = 202, + ICON_FILE_NEW = 203, + ICON_FOLDER_ADD = 204, + ICON_ALARM = 205, + ICON_206 = 206, + ICON_207 = 207, + ICON_208 = 208, + ICON_209 = 209, + ICON_210 = 210, + ICON_211 = 211, + ICON_212 = 212, + ICON_213 = 213, + ICON_214 = 214, + ICON_215 = 215, + ICON_216 = 216, + ICON_217 = 217, + ICON_218 = 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_229 = 229, + ICON_230 = 230, + ICON_231 = 231, + ICON_232 = 232, + ICON_233 = 233, + ICON_234 = 234, + ICON_235 = 235, + ICON_236 = 236, + ICON_237 = 237, + ICON_238 = 238, + ICON_239 = 239, + ICON_240 = 240, + ICON_241 = 241, + ICON_242 = 242, + ICON_243 = 243, + ICON_244 = 244, + ICON_245 = 245, + ICON_246 = 246, + ICON_247 = 247, + ICON_248 = 248, + ICON_249 = 249, + ICON_250 = 250, + ICON_251 = 251, + ICON_252 = 252, + ICON_253 = 253, + ICON_254 = 254, + ICON_255 = 255, +} GuiIconName; +#endif + +#endif + +#if defined(__cplusplus) +} // Prevents name mangling of functions +#endif + +#endif // RAYGUI_H + +/*********************************************************************************** +* +* RAYGUI IMPLEMENTATION +* +************************************************************************************/ + +#if defined(RAYGUI_IMPLEMENTATION) + +#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: va_list, va_start(), vfprintf(), va_end() [TextFormat()] +#include // Required for: roundf() [GuiColorPicker()] + +#ifdef __cplusplus + #define RAYGUI_CLITERAL(name) name +#else + #define RAYGUI_CLITERAL(name) (name) +#endif + +#if !defined(RAYGUI_NO_ICONS) && !defined(RAYGUI_CUSTOM_ICONS) + +// Embedded icons, no external file provided +#define RAYGUI_ICON_SIZE 16 // Size of icons in pixels (squared) +#define RAYGUI_ICON_MAX_ICONS 256 // Maximum number of icons +#define RAYGUI_ICON_MAX_NAME_LENGTH 32 // Maximum length of icon name id + +// Icons data is defined by bit array (every bit represents one pixel) +// Those arrays are stored as unsigned int data arrays, so, +// every array element defines 32 pixels (bits) of information +// One icon is defined by 8 int, (8 int * 32 bit = 256 bit = 16*16 pixels) +// NOTE: Number of elemens depend on RAYGUI_ICON_SIZE (by default 16x16 pixels) +#define RAYGUI_ICON_DATA_ELEMENTS (RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32) + +//---------------------------------------------------------------------------------- +// Icons data for all gui possible icons (allocated on data segment by default) +// +// NOTE 1: 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 +// +// NOTE 2: A different icon 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 +// +// guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB +//---------------------------------------------------------------------------------- +static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_NONE + 0x3ff80000, 0x2f082008, 0x2042207e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x00007ffe, // ICON_FOLDER_FILE_OPEN + 0x3ffe0000, 0x44226422, 0x400247e2, 0x5ffa4002, 0x57ea500a, 0x500a500a, 0x40025ffa, 0x00007ffe, // ICON_FILE_SAVE_CLASSIC + 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024002, 0x44424282, 0x793e4102, 0x00000100, // ICON_FOLDER_OPEN + 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024102, 0x44424102, 0x793e4282, 0x00000000, // ICON_FOLDER_SAVE + 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x24442284, 0x21042104, 0x20042104, 0x00003ffc, // ICON_FILE_OPEN + 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x21042104, 0x22842444, 0x20042104, 0x00003ffc, // ICON_FILE_SAVE + 0x3ff00000, 0x201c2010, 0x00042004, 0x20041004, 0x20844784, 0x00841384, 0x20042784, 0x00003ffc, // ICON_FILE_EXPORT + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x22042204, 0x22042f84, 0x20042204, 0x00003ffc, // ICON_FILE_ADD + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x25042884, 0x25042204, 0x20042884, 0x00003ffc, // ICON_FILE_DELETE + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // ICON_FILETYPE_TEXT + 0x3ff00000, 0x201c2010, 0x27042004, 0x244424c4, 0x26442444, 0x20642664, 0x20042004, 0x00003ffc, // ICON_FILETYPE_AUDIO + 0x3ff00000, 0x201c2010, 0x26042604, 0x20042004, 0x35442884, 0x2414222c, 0x20042004, 0x00003ffc, // ICON_FILETYPE_IMAGE + 0x3ff00000, 0x201c2010, 0x20c42004, 0x22442144, 0x22442444, 0x20c42144, 0x20042004, 0x00003ffc, // ICON_FILETYPE_PLAY + 0x3ff00000, 0x3ffc2ff0, 0x3f3c2ff4, 0x3dbc2eb4, 0x3dbc2bb4, 0x3f3c2eb4, 0x3ffc2ff4, 0x00002ff4, // ICON_FILETYPE_VIDEO + 0x3ff00000, 0x201c2010, 0x21842184, 0x21842004, 0x21842184, 0x21842184, 0x20042184, 0x00003ffc, // ICON_FILETYPE_INFO + 0x0ff00000, 0x381c0810, 0x28042804, 0x28042804, 0x28042804, 0x28042804, 0x20102ffc, 0x00003ff0, // ICON_FILE_COPY + 0x00000000, 0x701c0000, 0x079c1e14, 0x55a000f0, 0x079c00f0, 0x701c1e14, 0x00000000, 0x00000000, // ICON_FILE_CUT + 0x01c00000, 0x13e41bec, 0x3f841004, 0x204420c4, 0x20442044, 0x20442044, 0x207c2044, 0x00003fc0, // ICON_FILE_PASTE + 0x00000000, 0x3aa00fe0, 0x2abc2aa0, 0x2aa42aa4, 0x20042aa4, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_CURSOR_HAND + 0x00000000, 0x003c000c, 0x030800c8, 0x30100c10, 0x10202020, 0x04400840, 0x01800280, 0x00000000, // ICON_CURSOR_POINTER + 0x00000000, 0x00180000, 0x01f00078, 0x03e007f0, 0x07c003e0, 0x04000e40, 0x00000000, 0x00000000, // ICON_CURSOR_CLASSIC + 0x00000000, 0x04000000, 0x11000a00, 0x04400a80, 0x01100220, 0x00580088, 0x00000038, 0x00000000, // ICON_PENCIL + 0x04000000, 0x15000a00, 0x50402880, 0x14102820, 0x05040a08, 0x015c028c, 0x007c00bc, 0x00000000, // ICON_PENCIL_BIG + 0x01c00000, 0x01400140, 0x01400140, 0x0ff80140, 0x0ff80808, 0x0aa80808, 0x0aa80aa8, 0x00000ff8, // ICON_BRUSH_CLASSIC + 0x1ffc0000, 0x5ffc7ffe, 0x40004000, 0x00807f80, 0x01c001c0, 0x01c001c0, 0x01c001c0, 0x00000080, // ICON_BRUSH_PAINTER + 0x00000000, 0x00800000, 0x01c00080, 0x03e001c0, 0x07f003e0, 0x036006f0, 0x000001c0, 0x00000000, // ICON_WATER_DROP + 0x00000000, 0x3e003800, 0x1f803f80, 0x0c201e40, 0x02080c10, 0x00840104, 0x00380044, 0x00000000, // ICON_COLOR_PICKER + 0x00000000, 0x07800300, 0x1fe00fc0, 0x3f883fd0, 0x0e021f04, 0x02040402, 0x00f00108, 0x00000000, // ICON_RUBBER + 0x00c00000, 0x02800140, 0x08200440, 0x20081010, 0x2ffe3004, 0x03f807fc, 0x00e001f0, 0x00000040, // ICON_COLOR_BUCKET + 0x00000000, 0x21843ffc, 0x01800180, 0x01800180, 0x01800180, 0x01800180, 0x03c00180, 0x00000000, // ICON_TEXT_T + 0x00800000, 0x01400180, 0x06200340, 0x0c100620, 0x1ff80c10, 0x380c1808, 0x70067004, 0x0000f80f, // ICON_TEXT_A + 0x78000000, 0x50004000, 0x00004800, 0x03c003c0, 0x03c003c0, 0x00100000, 0x0002000a, 0x0000000e, // ICON_SCALE + 0x75560000, 0x5e004002, 0x54001002, 0x41001202, 0x408200fe, 0x40820082, 0x40820082, 0x00006afe, // ICON_RESIZE + 0x00000000, 0x3f003f00, 0x3f003f00, 0x3f003f00, 0x00400080, 0x001c0020, 0x001c001c, 0x00000000, // ICON_FILTER_POINT + 0x6d800000, 0x00004080, 0x40804080, 0x40800000, 0x00406d80, 0x001c0020, 0x001c001c, 0x00000000, // ICON_FILTER_BILINEAR + 0x40080000, 0x1ffe2008, 0x14081008, 0x11081208, 0x10481088, 0x10081028, 0x10047ff8, 0x00001002, // ICON_CROP + 0x00100000, 0x3ffc0010, 0x2ab03550, 0x22b02550, 0x20b02150, 0x20302050, 0x2000fff0, 0x00002000, // ICON_CROP_ALPHA + 0x40000000, 0x1ff82000, 0x04082808, 0x01082208, 0x00482088, 0x00182028, 0x35542008, 0x00000002, // ICON_SQUARE_TOGGLE + 0x00000000, 0x02800280, 0x06c006c0, 0x0ea00ee0, 0x1e901eb0, 0x3e883e98, 0x7efc7e8c, 0x00000000, // ICON_SYMMETRY + 0x01000000, 0x05600100, 0x1d480d50, 0x7d423d44, 0x3d447d42, 0x0d501d48, 0x01000560, 0x00000100, // ICON_SYMMETRY_HORIZONTAL + 0x01800000, 0x04200240, 0x10080810, 0x00001ff8, 0x00007ffe, 0x0ff01ff8, 0x03c007e0, 0x00000180, // ICON_SYMMETRY_VERTICAL + 0x00000000, 0x010800f0, 0x02040204, 0x02040204, 0x07f00308, 0x1c000e00, 0x30003800, 0x00000000, // ICON_LENS + 0x00000000, 0x061803f0, 0x08240c0c, 0x08040814, 0x0c0c0804, 0x23f01618, 0x18002400, 0x00000000, // ICON_LENS_BIG + 0x00000000, 0x00000000, 0x1c7007c0, 0x638e3398, 0x1c703398, 0x000007c0, 0x00000000, 0x00000000, // ICON_EYE_ON + 0x00000000, 0x10002000, 0x04700fc0, 0x610e3218, 0x1c703098, 0x001007a0, 0x00000008, 0x00000000, // ICON_EYE_OFF + 0x00000000, 0x00007ffc, 0x40047ffc, 0x10102008, 0x04400820, 0x02800280, 0x02800280, 0x00000100, // ICON_FILTER_TOP + 0x00000000, 0x40027ffe, 0x10082004, 0x04200810, 0x02400240, 0x02400240, 0x01400240, 0x000000c0, // ICON_FILTER + 0x00800000, 0x00800080, 0x00000080, 0x3c9e0000, 0x00000000, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_POINT + 0x00800000, 0x00800080, 0x00800080, 0x3f7e01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_SMALL + 0x00800000, 0x00800080, 0x03e00080, 0x3e3e0220, 0x03e00220, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_BIG + 0x01000000, 0x04400280, 0x01000100, 0x43842008, 0x43849ab2, 0x01002008, 0x04400100, 0x01000280, // ICON_TARGET_MOVE + 0x01000000, 0x04400280, 0x01000100, 0x41042108, 0x41049ff2, 0x01002108, 0x04400100, 0x01000280, // ICON_CURSOR_MOVE + 0x781e0000, 0x500a4002, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x4002500a, 0x0000781e, // ICON_CURSOR_SCALE + 0x00000000, 0x20003c00, 0x24002800, 0x01000200, 0x00400080, 0x00140024, 0x003c0004, 0x00000000, // ICON_CURSOR_SCALE_RIGHT + 0x00000000, 0x0004003c, 0x00240014, 0x00800040, 0x02000100, 0x28002400, 0x3c002000, 0x00000000, // ICON_CURSOR_SCALE_LEFT + 0x00000000, 0x00100020, 0x10101fc8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // ICON_UNDO + 0x00000000, 0x08000400, 0x080813f8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // ICON_REDO + 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3f902020, 0x00400020, 0x00000000, // ICON_REREDO + 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3fc82010, 0x00200010, 0x00000000, // ICON_MUTATE + 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18101020, 0x00100fc8, 0x00000020, // ICON_ROTATE + 0x00000000, 0x04000200, 0x240429fc, 0x20042204, 0x20442004, 0x3f942024, 0x00400020, 0x00000000, // ICON_REPEAT + 0x00000000, 0x20001000, 0x22104c0e, 0x00801120, 0x11200040, 0x4c0e2210, 0x10002000, 0x00000000, // ICON_SHUFFLE + 0x7ffe0000, 0x50024002, 0x44024802, 0x41024202, 0x40424082, 0x40124022, 0x4002400a, 0x00007ffe, // ICON_EMPTYBOX + 0x00800000, 0x03e00080, 0x08080490, 0x3c9e0808, 0x08080808, 0x03e00490, 0x00800080, 0x00000000, // ICON_TARGET + 0x00800000, 0x00800080, 0x00800080, 0x3ffe01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_SMALL_FILL + 0x00800000, 0x00800080, 0x03e00080, 0x3ffe03e0, 0x03e003e0, 0x00800080, 0x00800080, 0x00000000, // ICON_TARGET_BIG_FILL + 0x01000000, 0x07c00380, 0x01000100, 0x638c2008, 0x638cfbbe, 0x01002008, 0x07c00100, 0x01000380, // ICON_TARGET_MOVE_FILL + 0x01000000, 0x07c00380, 0x01000100, 0x610c2108, 0x610cfffe, 0x01002108, 0x07c00100, 0x01000380, // ICON_CURSOR_MOVE_FILL + 0x781e0000, 0x6006700e, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x700e6006, 0x0000781e, // ICON_CURSOR_SCALE_FILL + 0x00000000, 0x38003c00, 0x24003000, 0x01000200, 0x00400080, 0x000c0024, 0x003c001c, 0x00000000, // ICON_CURSOR_SCALE_RIGHT_FILL + 0x00000000, 0x001c003c, 0x0024000c, 0x00800040, 0x02000100, 0x30002400, 0x3c003800, 0x00000000, // ICON_CURSOR_SCALE_LEFT_FILL + 0x00000000, 0x00300020, 0x10301ff8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // ICON_UNDO_FILL + 0x00000000, 0x0c000400, 0x0c081ff8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // ICON_REDO_FILL + 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3ff02060, 0x00400060, 0x00000000, // ICON_REREDO_FILL + 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3ff82030, 0x00200030, 0x00000000, // ICON_MUTATE_FILL + 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18301020, 0x00300ff8, 0x00000020, // ICON_ROTATE_FILL + 0x00000000, 0x06000200, 0x26042ffc, 0x20042204, 0x20442004, 0x3ff42064, 0x00400060, 0x00000000, // ICON_REPEAT_FILL + 0x00000000, 0x30001000, 0x32107c0e, 0x00801120, 0x11200040, 0x7c0e3210, 0x10003000, 0x00000000, // ICON_SHUFFLE_FILL + 0x00000000, 0x30043ffc, 0x24042804, 0x21042204, 0x20442084, 0x20142024, 0x3ffc200c, 0x00000000, // ICON_EMPTYBOX_SMALL + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX + 0x00000000, 0x23c43ffc, 0x23c423c4, 0x200423c4, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP + 0x00000000, 0x3e043ffc, 0x3e043e04, 0x20043e04, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x3e043e04, 0x3e043e04, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x3e042004, 0x3e043e04, 0x3ffc3e04, 0x00000000, // ICON_BOX_BOTTOM_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x23c42004, 0x23c423c4, 0x3ffc23c4, 0x00000000, // ICON_BOX_BOTTOM + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x207c2004, 0x207c207c, 0x3ffc207c, 0x00000000, // ICON_BOX_BOTTOM_LEFT + 0x00000000, 0x20043ffc, 0x20042004, 0x207c207c, 0x207c207c, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_LEFT + 0x00000000, 0x207c3ffc, 0x207c207c, 0x2004207c, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_TOP_LEFT + 0x00000000, 0x20043ffc, 0x20042004, 0x23c423c4, 0x23c423c4, 0x20042004, 0x3ffc2004, 0x00000000, // ICON_BOX_CENTER + 0x7ffe0000, 0x40024002, 0x47e24182, 0x4ff247e2, 0x47e24ff2, 0x418247e2, 0x40024002, 0x00007ffe, // ICON_BOX_CIRCLE_MASK + 0x7fff0000, 0x40014001, 0x40014001, 0x49555ddd, 0x4945495d, 0x400149c5, 0x40014001, 0x00007fff, // ICON_POT + 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x404e40ce, 0x48125432, 0x4006540e, 0x00007ffe, // ICON_ALPHA_MULTIPLY + 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x5c4e40ce, 0x44124432, 0x40065c0e, 0x00007ffe, // ICON_ALPHA_CLEAR + 0x7ffe0000, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x00007ffe, // ICON_DITHERING + 0x07fe0000, 0x1ffa0002, 0x7fea000a, 0x402a402a, 0x5b2a512a, 0x5128552a, 0x40205128, 0x00007fe0, // ICON_MIPMAPS + 0x00000000, 0x1ff80000, 0x12481248, 0x12481ff8, 0x1ff81248, 0x12481248, 0x00001ff8, 0x00000000, // ICON_BOX_GRID + 0x12480000, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x00001248, // ICON_GRID + 0x00000000, 0x1c380000, 0x1c3817e8, 0x08100810, 0x08100810, 0x17e81c38, 0x00001c38, 0x00000000, // ICON_BOX_CORNERS_SMALL + 0x700e0000, 0x700e5ffa, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x5ffa700e, 0x0000700e, // ICON_BOX_CORNERS_BIG + 0x3f7e0000, 0x21422142, 0x21422142, 0x00003f7e, 0x21423f7e, 0x21422142, 0x3f7e2142, 0x00000000, // ICON_FOUR_BOXES + 0x00000000, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x00000000, // ICON_GRID_FILL + 0x7ffe0000, 0x7ffe7ffe, 0x77fe7000, 0x77fe77fe, 0x777e7700, 0x777e777e, 0x777e777e, 0x0000777e, // ICON_BOX_MULTISIZE + 0x781e0000, 0x40024002, 0x00004002, 0x01800000, 0x00000180, 0x40020000, 0x40024002, 0x0000781e, // ICON_ZOOM_SMALL + 0x781e0000, 0x40024002, 0x00004002, 0x03c003c0, 0x03c003c0, 0x40020000, 0x40024002, 0x0000781e, // ICON_ZOOM_MEDIUM + 0x781e0000, 0x40024002, 0x07e04002, 0x07e007e0, 0x07e007e0, 0x400207e0, 0x40024002, 0x0000781e, // ICON_ZOOM_BIG + 0x781e0000, 0x5ffa4002, 0x1ff85ffa, 0x1ff81ff8, 0x1ff81ff8, 0x5ffa1ff8, 0x40025ffa, 0x0000781e, // ICON_ZOOM_ALL + 0x00000000, 0x2004381c, 0x00002004, 0x00000000, 0x00000000, 0x20040000, 0x381c2004, 0x00000000, // ICON_ZOOM_CENTER + 0x00000000, 0x1db80000, 0x10081008, 0x10080000, 0x00001008, 0x10081008, 0x00001db8, 0x00000000, // ICON_BOX_DOTS_SMALL + 0x35560000, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x35562002, 0x00000000, // ICON_BOX_DOTS_BIG + 0x7ffe0000, 0x40024002, 0x48124ff2, 0x49924812, 0x48124992, 0x4ff24812, 0x40024002, 0x00007ffe, // ICON_BOX_CONCENTRIC + 0x00000000, 0x10841ffc, 0x10841084, 0x1ffc1084, 0x10841084, 0x10841084, 0x00001ffc, 0x00000000, // ICON_BOX_GRID_BIG + 0x00000000, 0x00000000, 0x10000000, 0x04000800, 0x01040200, 0x00500088, 0x00000020, 0x00000000, // ICON_OK_TICK + 0x00000000, 0x10080000, 0x04200810, 0x01800240, 0x02400180, 0x08100420, 0x00001008, 0x00000000, // ICON_CROSS + 0x00000000, 0x02000000, 0x00800100, 0x00200040, 0x00200010, 0x00800040, 0x02000100, 0x00000000, // ICON_ARROW_LEFT + 0x00000000, 0x00400000, 0x01000080, 0x04000200, 0x04000800, 0x01000200, 0x00400080, 0x00000000, // ICON_ARROW_RIGHT + 0x00000000, 0x00000000, 0x00000000, 0x08081004, 0x02200410, 0x00800140, 0x00000000, 0x00000000, // ICON_ARROW_DOWN + 0x00000000, 0x00000000, 0x01400080, 0x04100220, 0x10040808, 0x00000000, 0x00000000, 0x00000000, // ICON_ARROW_UP + 0x00000000, 0x02000000, 0x03800300, 0x03e003c0, 0x03e003f0, 0x038003c0, 0x02000300, 0x00000000, // ICON_ARROW_LEFT_FILL + 0x00000000, 0x00400000, 0x01c000c0, 0x07c003c0, 0x07c00fc0, 0x01c003c0, 0x004000c0, 0x00000000, // ICON_ARROW_RIGHT_FILL + 0x00000000, 0x00000000, 0x00000000, 0x0ff81ffc, 0x03e007f0, 0x008001c0, 0x00000000, 0x00000000, // ICON_ARROW_DOWN_FILL + 0x00000000, 0x00000000, 0x01c00080, 0x07f003e0, 0x1ffc0ff8, 0x00000000, 0x00000000, 0x00000000, // ICON_ARROW_UP_FILL + 0x00000000, 0x18a008c0, 0x32881290, 0x24822686, 0x26862482, 0x12903288, 0x08c018a0, 0x00000000, // ICON_AUDIO + 0x00000000, 0x04800780, 0x004000c0, 0x662000f0, 0x08103c30, 0x130a0e18, 0x0000318e, 0x00000000, // ICON_FX + 0x00000000, 0x00800000, 0x08880888, 0x2aaa0a8a, 0x0a8a2aaa, 0x08880888, 0x00000080, 0x00000000, // ICON_WAVE + 0x00000000, 0x00600000, 0x01080090, 0x02040108, 0x42044204, 0x24022402, 0x00001800, 0x00000000, // ICON_WAVE_SINUS + 0x00000000, 0x07f80000, 0x04080408, 0x04080408, 0x04080408, 0x7c0e0408, 0x00000000, 0x00000000, // ICON_WAVE_SQUARE + 0x00000000, 0x00000000, 0x00a00040, 0x22084110, 0x08021404, 0x00000000, 0x00000000, 0x00000000, // ICON_WAVE_TRIANGULAR + 0x00000000, 0x00000000, 0x04200000, 0x01800240, 0x02400180, 0x00000420, 0x00000000, 0x00000000, // ICON_CROSS_SMALL + 0x00000000, 0x18380000, 0x12281428, 0x10a81128, 0x112810a8, 0x14281228, 0x00001838, 0x00000000, // ICON_PLAYER_PREVIOUS + 0x00000000, 0x18000000, 0x11801600, 0x10181060, 0x10601018, 0x16001180, 0x00001800, 0x00000000, // ICON_PLAYER_PLAY_BACK + 0x00000000, 0x00180000, 0x01880068, 0x18080608, 0x06081808, 0x00680188, 0x00000018, 0x00000000, // ICON_PLAYER_PLAY + 0x00000000, 0x1e780000, 0x12481248, 0x12481248, 0x12481248, 0x12481248, 0x00001e78, 0x00000000, // ICON_PLAYER_PAUSE + 0x00000000, 0x1ff80000, 0x10081008, 0x10081008, 0x10081008, 0x10081008, 0x00001ff8, 0x00000000, // ICON_PLAYER_STOP + 0x00000000, 0x1c180000, 0x14481428, 0x15081488, 0x14881508, 0x14281448, 0x00001c18, 0x00000000, // ICON_PLAYER_NEXT + 0x00000000, 0x03c00000, 0x08100420, 0x10081008, 0x10081008, 0x04200810, 0x000003c0, 0x00000000, // ICON_PLAYER_RECORD + 0x00000000, 0x0c3007e0, 0x13c81818, 0x14281668, 0x14281428, 0x1c381c38, 0x08102244, 0x00000000, // ICON_MAGNET + 0x07c00000, 0x08200820, 0x3ff80820, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // ICON_LOCK_CLOSE + 0x07c00000, 0x08000800, 0x3ff80800, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // ICON_LOCK_OPEN + 0x01c00000, 0x0c180770, 0x3086188c, 0x60832082, 0x60034781, 0x30062002, 0x0c18180c, 0x01c00770, // ICON_CLOCK + 0x0a200000, 0x1b201b20, 0x04200e20, 0x04200420, 0x04700420, 0x0e700e70, 0x0e700e70, 0x04200e70, // ICON_TOOLS + 0x01800000, 0x3bdc318c, 0x0ff01ff8, 0x7c3e1e78, 0x1e787c3e, 0x1ff80ff0, 0x318c3bdc, 0x00000180, // ICON_GEAR + 0x01800000, 0x3ffc318c, 0x1c381ff8, 0x781e1818, 0x1818781e, 0x1ff81c38, 0x318c3ffc, 0x00000180, // ICON_GEAR_BIG + 0x00000000, 0x08080ff8, 0x08081ffc, 0x0aa80aa8, 0x0aa80aa8, 0x0aa80aa8, 0x08080aa8, 0x00000ff8, // ICON_BIN + 0x00000000, 0x00000000, 0x20043ffc, 0x08043f84, 0x04040f84, 0x04040784, 0x000007fc, 0x00000000, // ICON_HAND_POINTER + 0x00000000, 0x24400400, 0x00001480, 0x6efe0e00, 0x00000e00, 0x24401480, 0x00000400, 0x00000000, // ICON_LASER + 0x00000000, 0x03c00000, 0x08300460, 0x11181118, 0x11181118, 0x04600830, 0x000003c0, 0x00000000, // ICON_COIN + 0x00000000, 0x10880080, 0x06c00810, 0x366c07e0, 0x07e00240, 0x00001768, 0x04200240, 0x00000000, // ICON_EXPLOSION + 0x00000000, 0x3d280000, 0x2528252c, 0x3d282528, 0x05280528, 0x05e80528, 0x00000000, 0x00000000, // ICON_1UP + 0x01800000, 0x03c003c0, 0x018003c0, 0x0ff007e0, 0x0bd00bd0, 0x0a500bd0, 0x02400240, 0x02400240, // ICON_PLAYER + 0x01800000, 0x03c003c0, 0x118013c0, 0x03c81ff8, 0x07c003c8, 0x04400440, 0x0c080478, 0x00000000, // ICON_PLAYER_JUMP + 0x3ff80000, 0x30183ff8, 0x30183018, 0x3ff83ff8, 0x03000300, 0x03c003c0, 0x03e00300, 0x000003e0, // ICON_KEY + 0x3ff80000, 0x3ff83ff8, 0x33983ff8, 0x3ff83398, 0x3ff83ff8, 0x00000540, 0x0fe00aa0, 0x00000fe0, // ICON_DEMON + 0x00000000, 0x0ff00000, 0x20041008, 0x25442004, 0x10082004, 0x06000bf0, 0x00000300, 0x00000000, // ICON_TEXT_POPUP + 0x00000000, 0x11440000, 0x07f00be8, 0x1c1c0e38, 0x1c1c0c18, 0x07f00e38, 0x11440be8, 0x00000000, // ICON_GEAR_EX + 0x00000000, 0x20080000, 0x0c601010, 0x07c00fe0, 0x07c007c0, 0x0c600fe0, 0x20081010, 0x00000000, // ICON_CRACK + 0x00000000, 0x20080000, 0x0c601010, 0x04400fe0, 0x04405554, 0x0c600fe0, 0x20081010, 0x00000000, // ICON_CRACK_POINTS + 0x00000000, 0x00800080, 0x01c001c0, 0x1ffc3ffe, 0x03e007f0, 0x07f003e0, 0x0c180770, 0x00000808, // ICON_STAR + 0x0ff00000, 0x08180810, 0x08100818, 0x0a100810, 0x08180810, 0x08100818, 0x08100810, 0x00001ff8, // ICON_DOOR + 0x0ff00000, 0x08100810, 0x08100810, 0x10100010, 0x4f902010, 0x10102010, 0x08100010, 0x00000ff0, // ICON_EXIT + 0x00040000, 0x001f000e, 0x0ef40004, 0x12f41284, 0x0ef41214, 0x10040004, 0x7ffc3004, 0x10003000, // ICON_MODE_2D + 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, 0x50286030, 0x47fe4804, 0x47fe47fe, 0x47fe47fe, 0x27fe77fe, 0x0ffe17fe, 0x000007fe, // ICON_CUBE_FACE_FRONT + 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3ff27fe2, 0x0ffe1ffa, 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 + 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 + 0x00000000, 0x44007c00, 0x45004600, 0x00627cbe, 0x00620022, 0x45007cbe, 0x44004600, 0x00007c00, // ICON_LINK_BOXES + 0x00000000, 0x0044007c, 0x0010007c, 0x3f100010, 0x3f1021f0, 0x3f100010, 0x3f0021f0, 0x00000000, // ICON_LINK_MULTI + 0x00000000, 0x0044007c, 0x00440044, 0x0010007c, 0x00100010, 0x44107c10, 0x440047f0, 0x00007c00, // ICON_LINK + 0x00000000, 0x0044007c, 0x00440044, 0x0000007c, 0x00000010, 0x44007c10, 0x44004550, 0x00007c00, // ICON_LINK_BROKE + 0x02a00000, 0x22a43ffc, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // ICON_TEXT_NOTES + 0x3ffc0000, 0x20042004, 0x245e27c4, 0x27c42444, 0x2004201e, 0x201e2004, 0x20042004, 0x00003ffc, // ICON_NOTEBOOK + 0x00000000, 0x07e00000, 0x04200420, 0x24243ffc, 0x24242424, 0x24242424, 0x3ffc2424, 0x00000000, // ICON_SUITCASE + 0x00000000, 0x0fe00000, 0x08200820, 0x40047ffc, 0x7ffc5554, 0x40045554, 0x7ffc4004, 0x00000000, // ICON_SUITCASE_ZIP + 0x00000000, 0x20043ffc, 0x3ffc2004, 0x13c81008, 0x100813c8, 0x10081008, 0x1ff81008, 0x00000000, // ICON_MAILBOX + 0x00000000, 0x40027ffe, 0x5ffa5ffa, 0x5ffa5ffa, 0x40025ffa, 0x03c07ffe, 0x1ff81ff8, 0x00000000, // ICON_MONITOR + 0x0ff00000, 0x6bfe7ffe, 0x7ffe7ffe, 0x68167ffe, 0x08106816, 0x08100810, 0x0ff00810, 0x00000000, // ICON_PRINTER + 0x3ff80000, 0xfffe2008, 0x870a8002, 0x904a888a, 0x904a904a, 0x870a888a, 0xfffe8002, 0x00000000, // ICON_PHOTO_CAMERA + 0x0fc00000, 0xfcfe0cd8, 0x8002fffe, 0x84428382, 0x84428442, 0x80028382, 0xfffe8002, 0x00000000, // ICON_PHOTO_CAMERA_FLASH + 0x00000000, 0x02400180, 0x08100420, 0x20041008, 0x23c42004, 0x22442244, 0x3ffc2244, 0x00000000, // ICON_HOUSE + 0x00000000, 0x1c700000, 0x3ff83ef8, 0x3ff83ff8, 0x0fe01ff0, 0x038007c0, 0x00000100, 0x00000000, // ICON_HEART + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0xe000c000, // ICON_CORNER + 0x00000000, 0x14001c00, 0x15c01400, 0x15401540, 0x155c1540, 0x15541554, 0x1ddc1554, 0x00000000, // ICON_VERTICAL_BARS + 0x00000000, 0x03000300, 0x1b001b00, 0x1b601b60, 0x1b6c1b60, 0x1b6c1b6c, 0x1b6c1b6c, 0x00000000, // ICON_VERTICAL_BARS_FILL + 0x00000000, 0x00000000, 0x403e7ffe, 0x7ffe403e, 0x7ffe0000, 0x43fe43fe, 0x00007ffe, 0x00000000, // ICON_LIFE_BARS + 0x7ffc0000, 0x43844004, 0x43844284, 0x43844004, 0x42844284, 0x42844284, 0x40044384, 0x00007ffc, // ICON_INFO + 0x40008000, 0x10002000, 0x04000800, 0x01000200, 0x00400080, 0x00100020, 0x00040008, 0x00010002, // ICON_CROSSLINE + 0x00000000, 0x1ff01ff0, 0x18301830, 0x1f001830, 0x03001f00, 0x00000300, 0x03000300, 0x00000000, // ICON_HELP + 0x3ff00000, 0x2abc3550, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x00003ffc, // ICON_FILETYPE_ALPHA + 0x3ff00000, 0x201c2010, 0x22442184, 0x28142424, 0x29942814, 0x2ff42994, 0x20042004, 0x00003ffc, // ICON_FILETYPE_HOME + 0x07fe0000, 0x04020402, 0x7fe20402, 0x44224422, 0x44224422, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_LAYERS_VISIBLE + 0x07fe0000, 0x04020402, 0x7c020402, 0x44024402, 0x44024402, 0x402047fe, 0x40204020, 0x00007fe0, // ICON_LAYERS + 0x00000000, 0x40027ffe, 0x7ffe4002, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // ICON_WINDOW + 0x09100000, 0x09f00910, 0x09100910, 0x00000910, 0x24a2779e, 0x27a224a2, 0x709e20a2, 0x00000000, // ICON_HIDPI + 0x3ff00000, 0x201c2010, 0x2a842e84, 0x2e842a84, 0x2ba42004, 0x2aa42aa4, 0x20042ba4, 0x00003ffc, // ICON_FILETYPE_BINARY + 0x00000000, 0x00000000, 0x00120012, 0x4a5e4bd2, 0x485233d2, 0x00004bd2, 0x00000000, 0x00000000, // ICON_HEX + 0x01800000, 0x381c0660, 0x23c42004, 0x23c42044, 0x13c82204, 0x08101008, 0x02400420, 0x00000180, // ICON_SHIELD + 0x007e0000, 0x20023fc2, 0x40227fe2, 0x400a403a, 0x400a400a, 0x400a400a, 0x4008400e, 0x00007ff8, // ICON_FILE_NEW + 0x00000000, 0x0042007e, 0x40027fc2, 0x44024002, 0x5f024402, 0x44024402, 0x7ffe4002, 0x00000000, // ICON_FOLDER_ADD + 0x44220000, 0x12482244, 0xf3cf0000, 0x14280420, 0x48122424, 0x08100810, 0x1ff81008, 0x03c00420, // ICON_ALARM + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_206 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_207 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_208 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_209 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_210 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_211 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_212 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_213 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_214 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_215 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_216 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_217 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_218 + 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 + 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 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_232 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_233 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_234 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_235 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_236 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_237 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_238 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_239 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_240 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_241 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_242 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_243 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_244 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_245 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_246 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_247 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_248 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_249 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_250 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_251 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_252 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_253 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_254 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // ICON_255 +}; + +#endif // !RAYGUI_NO_ICONS && !RAYGUI_CUSTOM_ICONS + +#ifndef RAYGUI_ICON_SIZE + #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 +#define RAYGUI_MAX_PROPS_EXTENDED 8 // Maximum number of extended properties + +//---------------------------------------------------------------------------------- +// Types and Structures Definition +//---------------------------------------------------------------------------------- +// Gui control property style color element +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 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 unsigned int guiIconScale = 1; // Gui icon default scale (if icons enabled) + +//---------------------------------------------------------------------------------- +// Style data array for all gui style properties (allocated on data segment by default) +// +// NOTE 1: First set of BASE properties are generic to all controls but could be individually +// overwritten per control, first set of EXTENDED properties are generic to all controls and +// can not be overwritten individually but custom EXTENDED properties can be used by control +// +// NOTE 2: A new style set could be loaded over this array using GuiLoadStyle(), +// but default gui style could always be recovered with GuiLoadStyleDefault() +// +// guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB +//---------------------------------------------------------------------------------- +static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)] = { 0 }; + +static bool guiStyleLoaded = false; // Style loaded flag for lazy style initialization + +//---------------------------------------------------------------------------------- +// Standalone Mode Functions Declaration +// +// NOTE: raygui depend on some raylib input and drawing functions +// To use raygui as standalone library, below functions must be defined by the user +//---------------------------------------------------------------------------------- +#if defined(RAYGUI_STANDALONE) + +#define KEY_RIGHT 262 +#define KEY_LEFT 263 +#define KEY_DOWN 264 +#define KEY_UP 265 +#define KEY_BACKSPACE 259 +#define KEY_ENTER 257 + +#define MOUSE_LEFT_BUTTON 0 + +// Input required functions +//------------------------------------------------------------------------------- +static Vector2 GetMousePosition(void); +static float GetMouseWheelMove(void); +static bool IsMouseButtonDown(int button); +static bool IsMouseButtonPressed(int button); +static bool IsMouseButtonReleased(int button); + +static bool IsKeyDown(int key); +static bool IsKeyPressed(int key); +static int GetCharPressed(void); // -- GuiTextBox(), GuiTextBoxMulti(), GuiValueBox() +//------------------------------------------------------------------------------- + +// Drawing required functions +//------------------------------------------------------------------------------- +static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle(), GuiDrawIcon() + +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 Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // -- GetTextWidth(), GuiTextBoxMulti() +static void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // -- GuiDrawText() +//------------------------------------------------------------------------------- + +// 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 int GetCodepoint(const char *text, int *bytesProcessed); // 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) + +static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); // Draw rectangle vertical gradient +//------------------------------------------------------------------------------- + +#endif // RAYGUI_STANDALONE + +//---------------------------------------------------------------------------------- +// Module specific Functions Declaration +//---------------------------------------------------------------------------------- +static int GetTextWidth(const char *text); // Gui get text width using default font +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 GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color); // Gui draw rectangle using default raygui style + +static const char **GuiTextSplit(const char *text, int *count, int *textRow); // Split controls text into multiple strings +static Vector3 ConvertHSVtoRGB(Vector3 hsv); // Convert color data from HSV to RGB +static Vector3 ConvertRGBtoHSV(Vector3 rgb); // Convert color data from RGB to HSV + +static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue); // Scroll bar control, used by GuiScrollPanel() + +//---------------------------------------------------------------------------------- +// Gui Setup Functions Definition +//---------------------------------------------------------------------------------- +// Enable gui global state +// NOTE: We check for STATE_DISABLED to avoid messing custom global state setups +void GuiEnable(void) { if (guiState == STATE_DISABLED) guiState = STATE_NORMAL; } + +// Disable gui global state +// NOTE: We check for STATE_NORMAL to avoid messing custom global state setups +void GuiDisable(void) { if (guiState == STATE_NORMAL) guiState = STATE_DISABLED; } + +// Lock gui global state +void GuiLock(void) { guiLocked = true; } + +// Unlock gui global state +void GuiUnlock(void) { guiLocked = false; } + +// Check if gui is locked (global state) +bool GuiIsLocked(void) { return guiLocked; } + +// Set gui controls alpha global state +void GuiFade(float alpha) +{ + if (alpha < 0.0f) alpha = 0.0f; + else if (alpha > 1.0f) alpha = 1.0f; + + guiAlpha = alpha; +} + +// Set gui state (global state) +void GuiSetState(int state) { guiState = (GuiState)state; } + +// Get gui state (global state) +int GuiGetState(void) { return guiState; } + +// Set custom gui font +// NOTE: Font loading/unloading is external to raygui +void GuiSetFont(Font font) +{ + if (font.texture.id > 0) + { + // NOTE: If we try to setup a font but default style has not been + // lazily loaded before, it will be overwritten, so we need to force + // default style loading first + if (!guiStyleLoaded) GuiLoadStyleDefault(); + + guiFont = font; + GuiSetStyle(DEFAULT, TEXT_SIZE, font.baseSize); + } +} + +// Get custom gui font +Font GuiGetFont(void) +{ + return guiFont; +} + +// Set control style property value +void GuiSetStyle(int control, int property, int value) +{ + if (!guiStyleLoaded) GuiLoadStyleDefault(); + guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value; + + // Default properties are propagated to all controls + if ((control == 0) && (property < RAYGUI_MAX_PROPS_BASE)) + { + for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) guiStyle[i*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value; + } +} + +// Get control style property value +int GuiGetStyle(int control, int property) +{ + if (!guiStyleLoaded) GuiLoadStyleDefault(); + return guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property]; +} + +//---------------------------------------------------------------------------------- +// Gui Controls Functions Definition +//---------------------------------------------------------------------------------- + +// Window Box control +bool GuiWindowBox(Rectangle bounds, const char *title) +{ + // Window title bar height (including borders) + // NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox() + #if !defined(RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT) + #define RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT 24 + #endif + + //GuiState state = guiState; + bool clicked = false; + + int statusBarHeight = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT; + + Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight }; + if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f; + + Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight + 1 }; + Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - 20, + statusBar.y + statusBarHeight/2.0f - 18.0f/2.0f, 18, 18 }; + + // Update control + //-------------------------------------------------------------------- + // NOTE: Logic is directly managed by button + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiStatusBar(statusBar, title); // Draw window header as status bar + GuiPanel(windowPanel, NULL); // Draw window base + + // Draw window close button + 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) + clicked = GuiButton(closeButtonRec, "x"); +#else + clicked = GuiButton(closeButtonRec, GuiIconText(ICON_CROSS_SMALL, NULL)); +#endif + GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment); + //-------------------------------------------------------------------- + + return clicked; +} + +// Group Box control with text name +void GuiGroupBox(Rectangle bounds, const char *text) +{ + #if !defined(RAYGUI_GROUPBOX_LINE_THICK) + #define RAYGUI_GROUPBOX_LINE_THICK 1 + #endif + + 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)); + + GuiLine(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y - GuiGetStyle(DEFAULT, TEXT_SIZE)/2, bounds.width, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) }, text); + //-------------------------------------------------------------------- +} + +// Line control +void GuiLine(Rectangle bounds, const char *text) +{ + #if !defined(RAYGUI_LINE_ORIGIN_SIZE) + #define RAYGUI_LINE_MARGIN_TEXT 12 + #endif + #if !defined(RAYGUI_LINE_TEXT_PADDING) + #define RAYGUI_LINE_TEXT_PADDING 4 + #endif + + GuiState state = guiState; + + Color color = Fade(GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha); + + // Draw control + //-------------------------------------------------------------------- + if (text == NULL) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height/2, bounds.width, 1 }, 0, BLANK, color); + else + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(text); + textBounds.height = bounds.height; + textBounds.x = bounds.x + RAYGUI_LINE_MARGIN_TEXT; + textBounds.y = bounds.y; + + // Draw line with embedded text label: "--- text --------------" + GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height/2, RAYGUI_LINE_MARGIN_TEXT - RAYGUI_LINE_TEXT_PADDING, 1 }, 0, BLANK, color); + GuiDrawText(text, textBounds, TEXT_ALIGN_LEFT, color); + 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); + } + //-------------------------------------------------------------------- +} + +// Panel control +void GuiPanel(Rectangle bounds, const char *text) +{ + #if !defined(RAYGUI_PANEL_BORDER_WIDTH) + #define RAYGUI_PANEL_BORDER_WIDTH 1 + #endif + + GuiState state = guiState; + + // Text will be drawn as a header bar (if provided) + Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT }; + if ((text != NULL) && (bounds.height < RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f)) bounds.height = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f; + + if (text != NULL) + { + // Move panel bounds after the header bar + bounds.y += (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)); + //-------------------------------------------------------------------- +} + +// Scroll Panel control +Rectangle GuiScrollPanel(Rectangle bounds, const char *text, Rectangle content, Vector2 *scroll) +{ + GuiState state = guiState; + + Vector2 scrollPos = { 0.0f, 0.0f }; + if (scroll != NULL) scrollPos = *scroll; + + // Text will be drawn as a header bar (if provided) + Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT }; + if (bounds.height < RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f) bounds.height = RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT*2.0f; + + if (text != NULL) + { + // Move panel bounds after the header bar + bounds.y += (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - 1; + bounds.height -= (float)RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + 1; + } + + bool hasHorizontalScrollBar = (content.width > bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false; + bool hasVerticalScrollBar = (content.height > bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false; + + // Recheck to account for the other scrollbar being visible + if (!hasHorizontalScrollBar) hasHorizontalScrollBar = (hasVerticalScrollBar && (content.width > (bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false; + if (!hasVerticalScrollBar) hasVerticalScrollBar = (hasHorizontalScrollBar && (content.height > (bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false; + + 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) }; + + // Calculate view area (area without the scrollbars) + Rectangle 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; + + 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); + float verticalMin = hasVerticalScrollBar? 0 : -1; + float verticalMax = hasVerticalScrollBar? content.height - bounds.height + (float)horizontalScrollBarWidth + (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH); + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check button state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + +#if defined(SUPPORT_SCROLLBAR_KEY_INPUT) + if (hasHorizontalScrollBar) + { + if (IsKeyDown(KEY_RIGHT)) scrollPos.x -= GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + if (IsKeyDown(KEY_LEFT)) scrollPos.x += GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + } + + if (hasVerticalScrollBar) + { + if (IsKeyDown(KEY_DOWN)) scrollPos.y -= GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + if (IsKeyDown(KEY_UP)) scrollPos.y += GuiGetStyle(SCROLLBAR, SCROLL_SPEED); + } +#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 + } + } + + // Normalize scroll values + if (scrollPos.x > -horizontalMin) scrollPos.x = -horizontalMin; + if (scrollPos.x < -horizontalMax) scrollPos.x = -horizontalMax; + if (scrollPos.y > -verticalMin) scrollPos.y = -verticalMin; + if (scrollPos.y < -verticalMax) scrollPos.y = -verticalMax; + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + if (text != NULL) GuiStatusBar(statusBar, text); // Draw panel header as status bar + + 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); + + // Draw horizontal scrollbar if visible + if (hasHorizontalScrollBar) + { + // Change scrollbar slider size to show the diff in size between the content width and the widget width + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth)/(int)content.width)*((int)bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth))); + scrollPos.x = (float)-GuiScrollBar(horizontalScrollBar, (int)-scrollPos.x, (int)horizontalMin, (int)horizontalMax); + } + else scrollPos.x = 0.0f; + + // Draw vertical scrollbar if visible + if (hasVerticalScrollBar) + { + // Change scrollbar slider size to show the diff in size between the content height and the widget height + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth)/(int)content.height)*((int)bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth))); + scrollPos.y = (float)-GuiScrollBar(verticalScrollBar, (int)-scrollPos.y, (int)verticalMin, (int)verticalMax); + } + else scrollPos.y = 0.0f; + + // Draw detail corner rectangle if both scroll bars are visible + 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)); + } + + // Draw scrollbar lines depending on current state + GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), guiAlpha), BLANK); + + // Set scrollbar slider size back to the way it was before + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, slider); + //-------------------------------------------------------------------- + + if (scroll != NULL) *scroll = scrollPos; + + return view; +} + +// Label control +void GuiLabel(Rectangle bounds, const char *text) +{ + GuiState state = guiState; + + // Update control + //-------------------------------------------------------------------- + // ... + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + //-------------------------------------------------------------------- +} + +// Button control, returns true when clicked +bool GuiButton(Rectangle bounds, const char *text) +{ + GuiState state = guiState; + bool pressed = false; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check button state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + } + } + //-------------------------------------------------------------------- + + // 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)); + //------------------------------------------------------------------ + + return pressed; +} + +// Label button control +bool GuiLabelButton(Rectangle bounds, const char *text) +{ + GuiState state = guiState; + bool pressed = false; + + // NOTE: We force bounds.width to be all text + float textWidth = MeasureTextEx(guiFont, text, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING)).x; + if (bounds.width < textWidth) bounds.width = textWidth; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check checkbox state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + //-------------------------------------------------------------------- + + return pressed; +} + +// Toggle Button control, returns true when active +bool GuiToggle(Rectangle bounds, const char *text, bool active) +{ + GuiState state = guiState; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check toggle button state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + state = STATE_NORMAL; + active = !active; + } + else state = STATE_FOCUSED; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + 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)); + } + 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)); + } + //-------------------------------------------------------------------- + + return active; +} + +// Toggle Group control, returns toggled button index +int GuiToggleGroup(Rectangle bounds, const char *text, int active) +{ + #if !defined(RAYGUI_TOGGLEGROUP_MAX_ITEMS) + #define RAYGUI_TOGGLEGROUP_MAX_ITEMS 32 + #endif + + float initBoundsX = bounds.x; + + // Get substrings items from text (items pointers) + int rows[RAYGUI_TOGGLEGROUP_MAX_ITEMS] = { 0 }; + int itemCount = 0; + const char **items = GuiTextSplit(text, &itemCount, rows); + + int prevRow = rows[0]; + + for (int i = 0; i < itemCount; i++) + { + if (prevRow != rows[i]) + { + bounds.x = initBoundsX; + bounds.y += (bounds.height + GuiGetStyle(TOGGLE, GROUP_PADDING)); + prevRow = rows[i]; + } + + if (i == active) GuiToggle(bounds, items[i], true); + else if (GuiToggle(bounds, items[i], false) == true) active = i; + + bounds.x += (bounds.width + GuiGetStyle(TOGGLE, GROUP_PADDING)); + } + + return active; +} + +// Check Box control, returns true when active +bool GuiCheckBox(Rectangle bounds, const char *text, bool checked) +{ + GuiState state = guiState; + + Rectangle textBounds = { 0 }; + + if (text != NULL) + { + textBounds.width = (float)GetTextWidth(text); + 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); + } + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + Rectangle totalBounds = { + (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT)? textBounds.x : bounds.x, + bounds.y, + bounds.width + textBounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING), + bounds.height, + }; + + // Check checkbox state + if (CheckCollisionPointRec(mousePoint, totalBounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) checked = !checked; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), guiAlpha), BLANK); + + 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)); + } + + GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == TEXT_ALIGN_RIGHT)? TEXT_ALIGN_LEFT : TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha)); + //-------------------------------------------------------------------- + + return checked; +} + +// Combo Box control, returns selected item index +int GuiComboBox(Rectangle bounds, const char *text, int active) +{ + GuiState state = guiState; + + bounds.width -= (GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH) + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING)); + + Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_SPACING), + (float)bounds.y, (float)GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH), (float)bounds.height }; + + // Get substrings items from text (items pointers, lengths and count) + int itemCount = 0; + const char **items = GuiTextSplit(text, &itemCount, NULL); + + if (active < 0) active = 0; + else if (active > itemCount - 1) active = itemCount - 1; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked && (itemCount > 1)) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds) || + CheckCollisionPointRec(mousePoint, selector)) + { + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + active += 1; + if (active >= itemCount) active = 0; + } + + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + } + } + //-------------------------------------------------------------------- + + // 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)); + + // Draw selector using a custom button + // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values + int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); + int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, BORDER_WIDTH, 1); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + GuiButton(selector, TextFormat("%i/%i", active + 1, itemCount)); + + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign); + GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth); + //-------------------------------------------------------------------- + + return active; +} + +// Dropdown Box control +// NOTE: Returns mouse click +bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode) +{ + GuiState state = guiState; + int itemSelected = *active; + int itemFocused = -1; + + // 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)); + + Rectangle itemBounds = bounds; + + bool pressed = false; // Check mouse button pressed + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1)) + { + Vector2 mousePoint = GetMousePosition(); + + if (editMode) + { + state = STATE_PRESSED; + + // 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; + } + + // Check if already selected item has been pressed again + if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + + // 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 (CheckCollisionPointRec(mousePoint, itemBounds)) + { + itemFocused = i; + if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) + { + itemSelected = i; + pressed = true; // Item selected, change to editMode = false + } + break; + } + } + + itemBounds = bounds; + } + else + { + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + pressed = true; + state = STATE_PRESSED; + } + else state = STATE_FOCUSED; + } + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + 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)); + + if (editMode) + { + // Draw visible items + 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 (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)); + } + 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)); + } + else GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL)), guiAlpha)); + } + } + + // 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)); +#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 +#endif + //-------------------------------------------------------------------- + + *active = itemSelected; + return pressed; +} + +// 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) +{ + GuiState state = guiState; + bool pressed = false; + int textWidth = GetTextWidth(text); + Rectangle textBounds = GetTextBounds(TEXTBOX, bounds); + int textAlignment = editMode && textWidth >= textBounds.width ? TEXT_ALIGN_RIGHT : GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT); + + Rectangle cursor = { + bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GetTextWidth(text) + 2, + bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE), + 4, + (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); + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = 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); + + // Only allow keys in range [32..125] + if ((keyCount + byteSize) < textSize) + { + float maxWidth = (bounds.width - (GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)*2)); + + if (key >= 32) + { + for (int i = 0; i < byteSize; i++) + { + text[keyCount] = textUTF8[i]; + keyCount++; + } + + text[keyCount] = '\0'; + } + } + + // Delete text + if (keyCount > 0) + { + if (IsKeyPressed(KEY_BACKSPACE)) + { + while ((keyCount > 0) && ((text[--keyCount] & 0xc0) == 0x80)); + text[keyCount] = '\0'; + } + } + + if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true; + + // Check text alignment to position cursor properly + if (textAlignment == TEXT_ALIGN_CENTER) cursor.x = bounds.x + GetTextWidth(text)/2 + bounds.width/2 + 1; + else if (textAlignment == TEXT_ALIGN_RIGHT) cursor.x = bounds.x + bounds.width - GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING) - GuiGetStyle(TEXTBOX, BORDER_WIDTH); + } + else + { + if (CheckCollisionPointRec(mousePoint, bounds)) + { + state = STATE_FOCUSED; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + } + } + } + //-------------------------------------------------------------------- + + // 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, 1, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK); + + // in case we edit and text does not fit in the textbox show right aligned and character clipped, slower but working + while (editMode && textWidth >= textBounds.width && *text) + { + int bytes = 0; + GetCodepoint(text, &bytes); + text += bytes; + textWidth = GetTextWidth(text); + } + GuiDrawText(text, textBounds, textAlignment, Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha)); + + // Draw cursor + if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha)); + //-------------------------------------------------------------------- + + return pressed; +} + +// Spinner control, returns selected value +bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode) +{ + GuiState state = guiState; + + bool pressed = false; + 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); + 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; + if (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SPINNER, TEXT_PADDING); + } + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check spinner state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + } + } + +#if defined(RAYGUI_NO_ICONS) + if (GuiButton(leftButtonBound, "<")) tempValue--; + if (GuiButton(rightButtonBound, ">")) tempValue++; +#else + if (GuiButton(leftButtonBound, GuiIconText(ICON_ARROW_LEFT_FILL, NULL))) tempValue--; + if (GuiButton(rightButtonBound, GuiIconText(ICON_ARROW_RIGHT_FILL, NULL))) tempValue++; +#endif + + if (!editMode) + { + if (tempValue < minValue) tempValue = minValue; + if (tempValue > maxValue) tempValue = maxValue; + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + // TODO: Set Spinner properties for ValueBox + pressed = GuiValueBox(spinner, NULL, &tempValue, minValue, maxValue, editMode); + + // Draw value selector custom buttons + // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values + int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH); + int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, BORDER_WIDTH, GuiGetStyle(SPINNER, BORDER_WIDTH)); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign); + 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)); + //-------------------------------------------------------------------- + + *value = tempValue; + return pressed; +} + +// 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) +{ + #if !defined(RAYGUI_VALUEBOX_MAX_CHARS) + #define RAYGUI_VALUEBOX_MAX_CHARS 32 + #endif + + GuiState state = guiState; + bool pressed = false; + + char textValue[RAYGUI_VALUEBOX_MAX_CHARS + 1] = "\0"; + sprintf(textValue, "%i", *value); + + Rectangle textBounds = { 0 }; + if (text != NULL) + { + textBounds.width = (float)GetTextWidth(text); + 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) + { + Vector2 mousePoint = GetMousePosition(); + + bool valueHasChanged = false; + + if (editMode) + { + state = STATE_PRESSED; + + int keyCount = (int)strlen(textValue); + + // Only allow keys in range [48..57] + if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS) + { + if (GetTextWidth(textValue) < bounds.width) + { + int key = GetCharPressed(); + if ((key >= 48) && (key <= 57)) + { + textValue[keyCount] = (char)key; + keyCount++; + valueHasChanged = true; + } + } + } + + // Delete text + if (keyCount > 0) + { + if (IsKeyPressed(KEY_BACKSPACE)) + { + keyCount--; + textValue[keyCount] = '\0'; + valueHasChanged = true; + } + } + + if (valueHasChanged) *value = TextToInteger(textValue); + + // NOTE: We are not clamp values until user input finishes + //if (*value > maxValue) *value = maxValue; + //else if (*value < minValue) *value = minValue; + + if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true; + } + else + { + if (*value > maxValue) *value = maxValue; + else if (*value < minValue) *value = minValue; + + if (CheckCollisionPointRec(mousePoint, bounds)) + { + state = STATE_FOCUSED; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + } + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + 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)); + + // 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)); + + // Draw cursor + if (editMode) + { + // NOTE: ValueBox internal text is always centered + Rectangle cursor = { bounds.x + GetTextWidth(textValue)/2 + bounds.width/2 + 2, 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)); + } + + // 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)); + //-------------------------------------------------------------------- + + return pressed; +} + +// Text Box control with multiple lines +bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode) +{ + GuiState state = guiState; + bool pressed = false; + + 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)) + }; + + // Cursor position, [x, y] values should be updated + Rectangle cursor = { 0, -1, 4, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 }; + + float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize; // Character rectangle scaling factor + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + 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); + + // Introduce characters + if ((textLength + byteSize) < textSize) + { + if (IsKeyPressed(KEY_ENTER)) + { + text[textLength] = '\n'; + textLength++; + } + else if (codepoint >= 32) + { + // Supports Unicode inputs -> Encoded to UTF-8 + int charUTF8Length = 0; + const char *charEncoded = CodepointToUTF8(codepoint, &charUTF8Length); + memcpy(text + textLength, charEncoded, charUTF8Length); + textLength += charUTF8Length; + } + } + + // Delete characters + if (textLength > 0) + { + if (IsKeyPressed(KEY_BACKSPACE)) + { + 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'; + } + } + } + + // Exit edit mode + if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + } + else + { + if (CheckCollisionPointRec(mousePoint, bounds)) + { + state = STATE_FOCUSED; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true; + } + } + } + //-------------------------------------------------------------------- + + // 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, 1, 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 }; + + //int lastSpacePos = 0; + //int lastSpaceWidth = 0; + //int lastSpaceCursorPos = 0; + + for (int i = 0, codepointLength = 0; text[i] != '\0'; i += codepointLength) + { + int codepoint = GetCodepoint(text + i, &codepointLength); + 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 ((codepointLength == 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 ((codepointLength == 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)); + } + } + + 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)); + //-------------------------------------------------------------------- + + return pressed; +} + +// 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) +{ + GuiState state = guiState; + + int sliderValue = (int)(((value - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))); + + 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 (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + state = STATE_PRESSED; + + // 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 + } + else state = STATE_FOCUSED; + } + + if (value > maxValue) value = maxValue; + else if (value < minValue) value = minValue; + } + + // Bar limits check + if (sliderWidth > 0) // Slider + { + 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 + { + 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)); + + // 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)); + + // Draw left/right text if provided + if (textLeft != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(textLeft); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + 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)); + } + + if (textRight != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(textRight); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + 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)); + } + //-------------------------------------------------------------------- + + return value; +} + +// 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) +{ + 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) +{ + 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) +{ + GuiState state = guiState; + + 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 (state != STATE_DISABLED) progress.width = ((float)(value/(maxValue - minValue))*(float)(bounds.width - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH))); + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), guiAlpha), BLANK); + + // 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 left/right text if provided + if (textLeft != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(textLeft); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + 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)); + } + + if (textRight != NULL) + { + Rectangle textBounds = { 0 }; + textBounds.width = (float)GetTextWidth(textRight); + textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + 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)); + } + //-------------------------------------------------------------------- + + return value; +} + +// Status Bar control +void GuiStatusBar(Rectangle bounds, const char *text) +{ + 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)); + //-------------------------------------------------------------------- +} + +// Dummy rectangle control, intended for placeholding +void GuiDummyRec(Rectangle bounds, const char *text) +{ + GuiState state = guiState; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check button state + if (CheckCollisionPointRec(mousePoint, bounds)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) state = STATE_PRESSED; + else state = STATE_FOCUSED; + } + } + //-------------------------------------------------------------------- + + // 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)); + //------------------------------------------------------------------ +} + +// List View control +int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active) +{ + int itemCount = 0; + const char **items = NULL; + + if (text != NULL) items = GuiTextSplit(text, &itemCount, NULL); + + return GuiListViewEx(bounds, items, itemCount, NULL, scrollIndex, active); +} + +// List View control with extended parameters +int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active) +{ + GuiState state = guiState; + int itemFocused = (focus == NULL)? -1 : *focus; + int itemSelected = active; + + // Check if we need a scroll bar + bool useScrollBar = false; + if ((GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING))*count > bounds.height) useScrollBar = true; + + // Define base item rectangle [0] + Rectangle itemBounds = { 0 }; + itemBounds.x = bounds.x + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING); + itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH); + itemBounds.width = bounds.width - 2*GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) - GuiGetStyle(DEFAULT, BORDER_WIDTH); + itemBounds.height = (float)GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT); + if (useScrollBar) itemBounds.width -= GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH); + + // Get items on the list + int visibleItems = (int)bounds.height/(GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); + if (visibleItems > count) visibleItems = count; + + int startIndex = (scrollIndex == NULL)? 0 : *scrollIndex; + if ((startIndex < 0) || (startIndex > (count - visibleItems))) startIndex = 0; + int endIndex = startIndex + visibleItems; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + // Check mouse inside list view + if (CheckCollisionPointRec(mousePoint, bounds)) + { + state = STATE_FOCUSED; + + // Check focused and selected item + for (int i = 0; i < visibleItems; i++) + { + if (CheckCollisionPointRec(mousePoint, itemBounds)) + { + itemFocused = startIndex + i; + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) + { + if (itemSelected == (startIndex + i)) itemSelected = -1; + else itemSelected = startIndex + i; + } + break; + } + + // Update item rectangle y position for next item + itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); + } + + if (useScrollBar) + { + int wheelMove = (int)GetMouseWheelMove(); + startIndex -= wheelMove; + + if (startIndex < 0) startIndex = 0; + else if (startIndex > (count - visibleItems)) startIndex = count - visibleItems; + + endIndex = startIndex + visibleItems; + if (endIndex > count) endIndex = count; + } + } + else itemFocused = -1; + + // Reset item rectangle y to [0] + itemBounds.y = bounds.y + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING) + GuiGetStyle(DEFAULT, BORDER_WIDTH); + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background + + // Draw visible items + for (int i = 0; ((i < visibleItems) && (text != NULL)); i++) + { + 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)); + + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)), guiAlpha)); + } + else + { + if ((startIndex + i) == itemSelected) + { + // 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)); + } + else if ((startIndex + i) == itemFocused) + { + // 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)); + } + else + { + // Draw item normal + GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)), guiAlpha)); + } + } + + // Update item rectangle y position for next item + itemBounds.y += (GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_SPACING)); + } + + if (useScrollBar) + { + Rectangle scrollBarBounds = { + bounds.x + bounds.width - GuiGetStyle(LISTVIEW, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH), + bounds.y + GuiGetStyle(LISTVIEW, BORDER_WIDTH), (float)GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH), + bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) + }; + + // Calculate percentage of visible items and apply same percentage to scrollbar + float percentVisible = (float)(endIndex - startIndex)/count; + float sliderSize = bounds.height*percentVisible; + + int prevSliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); // Save default slider size + int prevScrollSpeed = GuiGetStyle(SCROLLBAR, SCROLL_SPEED); // Save default scroll speed + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)sliderSize); // Change slider size + GuiSetStyle(SCROLLBAR, SCROLL_SPEED, count - visibleItems); // Change scroll speed + + startIndex = GuiScrollBar(scrollBarBounds, startIndex, 0, count - visibleItems); + + GuiSetStyle(SCROLLBAR, SCROLL_SPEED, prevScrollSpeed); // Reset scroll speed to default + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, prevSliderSize); // Reset slider size to default + } + //-------------------------------------------------------------------- + + if (focus != NULL) *focus = itemFocused; + if (scrollIndex != NULL) *scrollIndex = startIndex; + + return itemSelected; +} + +// Color Panel control +Color 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 }; + + Vector3 vcolor = { (float)color.r/255.0f, (float)color.g/255.0f, (float)color.b/255.0f }; + Vector3 hsv = ConvertRGBtoHSV(vcolor); + + 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 }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + 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)); + } + + GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK); + //-------------------------------------------------------------------- + + return color; +} + +// Color Bar Alpha control +// NOTE: Returns alpha value normalized [0..1] +float GuiColorBarAlpha(Rectangle bounds, const char *text, float alpha) +{ + #if !defined(RAYGUI_COLORBARALPHA_CHECKED_SIZE) + #define RAYGUI_COLORBARALPHA_CHECKED_SIZE 10 + #endif + + 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 }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds) || + CheckCollisionPointRec(mousePoint, selector)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + state = STATE_PRESSED; + + 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; + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + + // Draw alpha bar: checked background + if (state != STATE_DISABLED) + { + int checksX = (int)bounds.width/RAYGUI_COLORBARALPHA_CHECKED_SIZE; + int checksY = (int)bounds.height/RAYGUI_COLORBARALPHA_CHECKED_SIZE; + + for (int x = 0; x < checksX; x++) + { + 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)); + } + } + + DrawRectangleGradientEx(bounds, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha)); + } + 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); + + // Draw alpha bar: selector + GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha)); + //-------------------------------------------------------------------- + + return alpha; +} + +// Color Bar Hue control +// Returns hue value normalized [0..1] +// NOTE: Other similar bars (for reference): +// Color GuiColorBarSat() [WHITE->color] +// Color GuiColorBarValue() [BLACK->color], HSV/HSL +// float GuiColorBarLuminance() [BLACK->WHITE] +float GuiColorBarHue(Rectangle bounds, const char *text, float hue) +{ + 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) }; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds) || + CheckCollisionPointRec(mousePoint, selector)) + { + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + 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 state = STATE_FOCUSED; + + /*if (IsKeyDown(KEY_UP)) + { + hue -= 2.0f; + if (hue <= 0.0f) hue = 0.0f; + } + else if (IsKeyDown(KEY_DOWN)) + { + hue += 2.0f; + if (hue >= 360.0f) hue = 360.0f; + }*/ + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + 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)); + 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)); + DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 4*(bounds.height/6)), (int)bounds.width, (int)ceilf(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 0, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 255, 255 }, guiAlpha)); + DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 5*(bounds.height/6)), (int)bounds.width, (int)(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 0, 255 }, guiAlpha)); + } + 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); + + // Draw hue bar: selector + GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha)); + //-------------------------------------------------------------------- + + return hue; +} + +// Color Picker control +// NOTE: It's divided in multiple controls: +// Color GuiColorPanel(Rectangle bounds, Color color) +// 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) +{ + color = 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); + //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 }; + + return color; +} + +// Message Box control +int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons) +{ + #if !defined(RAYGUI_MESSAGEBOX_BUTTON_HEIGHT) + #define RAYGUI_MESSAGEBOX_BUTTON_HEIGHT 24 + #endif + #if !defined(RAYGUI_MESSAGEBOX_BUTTON_PADDING) + #define RAYGUI_MESSAGEBOX_BUTTON_PADDING 12 + #endif + + int clicked = -1; // Returns clicked button from buttons list, 0 refers to closed window button + + int buttonCount = 0; + const char **buttonsText = GuiTextSplit(buttons, &buttonCount, NULL); + Rectangle buttonBounds = { 0 }; + buttonBounds.x = bounds.x + RAYGUI_MESSAGEBOX_BUTTON_PADDING; + buttonBounds.y = bounds.y + bounds.height - RAYGUI_MESSAGEBOX_BUTTON_HEIGHT - RAYGUI_MESSAGEBOX_BUTTON_PADDING; + buttonBounds.width = (bounds.width - RAYGUI_MESSAGEBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount; + buttonBounds.height = RAYGUI_MESSAGEBOX_BUTTON_HEIGHT; + + Vector2 textSize = MeasureTextEx(guiFont, message, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), 1); + + Rectangle textBounds = { 0 }; + textBounds.x = bounds.x + bounds.width/2 - textSize.x/2; + textBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + RAYGUI_MESSAGEBOX_BUTTON_PADDING; + textBounds.width = textSize.x; + 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; + + int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + GuiLabel(textBounds, message); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment); + + prevTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + for (int i = 0; i < buttonCount; i++) + { + if (GuiButton(buttonBounds, buttonsText[i])) clicked = i + 1; + buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); + } + + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevTextAlignment); + //-------------------------------------------------------------------- + + return clicked; +} + +// 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) +{ + #if !defined(RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT) + #define RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT 28 + #endif + #if !defined(RAYGUI_TEXTINPUTBOX_BUTTON_PADDING) + #define RAYGUI_TEXTINPUTBOX_BUTTON_PADDING 12 + #endif + #if !defined(RAYGUI_TEXTINPUTBOX_HEIGHT) + #define RAYGUI_TEXTINPUTBOX_HEIGHT 28 + #endif + + // Used to enable text edit mode + // WARNING: No more than one GuiTextInputBox() should be open at the same time + static bool textEditMode = false; + + int btnIndex = -1; + + int buttonCount = 0; + const char **buttonsText = GuiTextSplit(buttons, &buttonCount, NULL); + Rectangle buttonBounds = { 0 }; + buttonBounds.x = bounds.x + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + buttonBounds.y = bounds.y + bounds.height - RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + buttonBounds.width = (bounds.width - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount; + buttonBounds.height = RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT; + + int messageInputHeight = (int)bounds.height - RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT - 2*RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + + Rectangle textBounds = { 0 }; + if (message != NULL) + { + Vector2 textSize = MeasureTextEx(guiFont, message, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), 1); + + textBounds.x = bounds.x + bounds.width/2 - textSize.x/2; + textBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + messageInputHeight/4 - textSize.y/2; + textBounds.width = textSize.x; + textBounds.height = textSize.y; + } + + Rectangle textBoxBounds = { 0 }; + textBoxBounds.x = bounds.x + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + textBoxBounds.y = bounds.y + RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - RAYGUI_TEXTINPUTBOX_HEIGHT/2; + if (message == NULL) textBoxBounds.y = bounds.y + 24 + RAYGUI_TEXTINPUTBOX_BUTTON_PADDING; + else textBoxBounds.y += (messageInputHeight/2 + messageInputHeight/4); + textBoxBounds.width = bounds.width - RAYGUI_TEXTINPUTBOX_BUTTON_PADDING*2; + textBoxBounds.height = RAYGUI_TEXTINPUTBOX_HEIGHT; + + // Draw control + //-------------------------------------------------------------------- + if (GuiWindowBox(bounds, title)) btnIndex = 0; + + // Draw message if available + if (message != NULL) + { + int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + GuiLabel(textBounds, message); + GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment); + } + + if (secretViewActive != NULL) + { + static char stars[] = "****************"; + 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); + } + else + { + if (GuiTextBox(textBoxBounds, text, textMaxSize, textEditMode)) textEditMode = !textEditMode; + } + + int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT); + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER); + + for (int i = 0; i < buttonCount; i++) + { + if (GuiButton(buttonBounds, buttonsText[i])) btnIndex = i + 1; + buttonBounds.x += (buttonBounds.width + RAYGUI_MESSAGEBOX_BUTTON_PADDING); + } + + GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevBtnTextAlignment); + //-------------------------------------------------------------------- + + return btnIndex; +} + +// 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) +{ + // Grid lines alpha amount + #if !defined(RAYGUI_GRID_ALPHA) + #define RAYGUI_GRID_ALPHA 0.15f + #endif + + GuiState state = guiState; + Vector2 mousePoint = GetMousePosition(); + Vector2 currentCell = { -1, -1 }; + + int linesV = ((int)(bounds.width/spacing))*subdivs + 1; + int linesH = ((int)(bounds.height/spacing))*subdivs + 1; + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + if (CheckCollisionPointRec(mousePoint, bounds)) + { + // NOTE: Cell values must be rounded to int + currentCell.x = (int)((mousePoint.x - bounds.x)/spacing); + currentCell.y = (int)((mousePoint.y - bounds.y)/spacing); + } + } + //-------------------------------------------------------------------- + + // Draw control + //-------------------------------------------------------------------- + + // TODO: Draw background panel? + + switch (state) + { + case STATE_NORMAL: + { + 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)); + } + + // 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; + } + + return currentCell; +} + +//---------------------------------------------------------------------------------- +// Styles loading functions +//---------------------------------------------------------------------------------- + +// Load raygui style file (.rgs) +// NOTE: By default a binary file is expected, that file could contain a custom font, +// in that case, custom font image atlas is GRAY+ALPHA and pixel data can be compressed (DEFLATE) +void GuiLoadStyle(const char *fileName) +{ + #define MAX_LINE_BUFFER_SIZE 256 + + bool tryBinary = false; + + // Try reading the files as text file first + FILE *rgsFile = fopen(fileName, "rt"); + + if (rgsFile != NULL) + { + char buffer[MAX_LINE_BUFFER_SIZE] = { 0 }; + fgets(buffer, MAX_LINE_BUFFER_SIZE, rgsFile); + + if (buffer[0] == '#') + { + int controlId = 0; + int propertyId = 0; + unsigned int propertyValue = 0; + + while (!feof(rgsFile)) + { + switch (buffer[0]) + { + case 'p': + { + // Style property: p + + sscanf(buffer, "p %d %d 0x%x", &controlId, &propertyId, &propertyValue); + GuiSetStyle(controlId, propertyId, (int)propertyValue); + + } break; + case 'f': + { + // Style font: f + + int fontSize = 0; + char charmapFileName[256] = { 0 }; + char fontFileName[256] = { 0 }; + sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName); + + Font font = { 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); + } + } + else + { + 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, 1, sizeof(short), rgsFile); + fread(&reserved, 1, sizeof(short), rgsFile); + fread(&propertyCount, 1, sizeof(int), 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, 1, sizeof(short), rgsFile); + fread(&propertyId, 1, sizeof(short), rgsFile); + fread(&propertyValue, 1, sizeof(unsigned int), 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); + } + + // 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, 1, sizeof(int), rgsFile); + + if (fontDataSize > 0) + { + Font font = { 0 }; + int fontType = 0; // 0-Normal, 1-SDF + Rectangle whiteRec = { 0 }; + + fread(&font.baseSize, 1, sizeof(int), rgsFile); + fread(&font.glyphCount, 1, sizeof(int), rgsFile); + fread(&fontType, 1, sizeof(int), rgsFile); + + // Load font white rectangle + fread(&whiteRec, 1, sizeof(Rectangle), rgsFile); + + // Load font image parameters + int fontImageUncompSize = 0; + int fontImageCompSize = 0; + fread(&fontImageUncompSize, 1, sizeof(int), rgsFile); + fread(&fontImageCompSize, 1, sizeof(int), rgsFile); + + Image imFont = { 0 }; + imFont.mipmaps = 1; + fread(&imFont.width, 1, sizeof(int), rgsFile); + fread(&imFont.height, 1, sizeof(int), rgsFile); + fread(&imFont.format, 1, sizeof(int), 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); + + // 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); + fread(imFont.data, 1, fontImageUncompSize, rgsFile); + } + + if (font.texture.id != GetFontDefault().texture.id) UnloadTexture(font.texture); + font.texture = LoadTextureFromImage(imFont); + if (font.texture.id == 0) font = GetFontDefault(); + + RAYGUI_FREE(imFont.data); + + // 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], 1, sizeof(Rectangle), rgsFile); + + // 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, 1, sizeof(int), rgsFile); + fread(&font.glyphs[i].offsetX, 1, sizeof(int), rgsFile); + fread(&font.glyphs[i].offsetY, 1, sizeof(int), rgsFile); + fread(&font.glyphs[i].advanceX, 1, sizeof(int), rgsFile); + } + + GuiSetFont(font); + + // 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); + } +#endif + } + + fclose(rgsFile); + } +} + +// Load style default over global style +void GuiLoadStyleDefault(void) +{ + // We set this variable first to avoid cyclic function calls + // when calling GuiSetStyle() and GuiGetStyle() + guiStyleLoaded = true; + + // Initialize default LIGHT style property values + GuiSetStyle(DEFAULT, BORDER_COLOR_NORMAL, 0x838383ff); + GuiSetStyle(DEFAULT, BASE_COLOR_NORMAL, 0xc9c9c9ff); + GuiSetStyle(DEFAULT, TEXT_COLOR_NORMAL, 0x686868ff); + GuiSetStyle(DEFAULT, BORDER_COLOR_FOCUSED, 0x5bb2d9ff); + GuiSetStyle(DEFAULT, BASE_COLOR_FOCUSED, 0xc9effeff); + GuiSetStyle(DEFAULT, TEXT_COLOR_FOCUSED, 0x6c9bbcff); + GuiSetStyle(DEFAULT, BORDER_COLOR_PRESSED, 0x0492c7ff); + GuiSetStyle(DEFAULT, BASE_COLOR_PRESSED, 0x97e8ffff); + GuiSetStyle(DEFAULT, TEXT_COLOR_PRESSED, 0x368bafff); + 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 + + // 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(CHECKBOX, TEXT_PADDING, 4); + GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_RIGHT); + GuiSetStyle(TEXTBOX, TEXT_PADDING, 4); + GuiSetStyle(TEXTBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + GuiSetStyle(VALUEBOX, TEXT_PADDING, 4); + GuiSetStyle(VALUEBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + GuiSetStyle(SPINNER, TEXT_PADDING, 4); + GuiSetStyle(SPINNER, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + GuiSetStyle(STATUSBAR, TEXT_PADDING, 8); + GuiSetStyle(STATUSBAR, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT); + + // 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); + GuiSetStyle(PROGRESSBAR, PROGRESS_PADDING, 1); + GuiSetStyle(CHECKBOX, CHECK_PADDING, 1); + GuiSetStyle(COMBOBOX, COMBO_BUTTON_WIDTH, 32); + 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); + GuiSetStyle(SCROLLBAR, ARROWS_VISIBLE, 0); + GuiSetStyle(SCROLLBAR, ARROWS_SIZE, 6); + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING, 0); + GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, 16); + GuiSetStyle(SCROLLBAR, SCROLL_PADDING, 0); + GuiSetStyle(SCROLLBAR, SCROLL_SPEED, 12); + GuiSetStyle(LISTVIEW, LIST_ITEMS_HEIGHT, 24); + GuiSetStyle(LISTVIEW, LIST_ITEMS_SPACING, 2); + GuiSetStyle(LISTVIEW, SCROLLBAR_WIDTH, 12); + GuiSetStyle(LISTVIEW, SCROLLBAR_SIDE, SCROLLBAR_RIGHT_SIDE); + GuiSetStyle(COLORPICKER, COLOR_SELECTOR_SIZE, 8); + GuiSetStyle(COLORPICKER, HUEBAR_WIDTH, 16); + GuiSetStyle(COLORPICKER, HUEBAR_PADDING, 8); + GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT, 8); + GuiSetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW, 2); + + guiFont = GetFontDefault(); // Initialize default font +} + +// Get text with icon id prepended +// NOTE: Useful to add icons by name id (enum) instead of +// a number that can change between ricon versions +const char *GuiIconText(int iconId, const char *text) +{ +#if defined(RAYGUI_NO_ICONS) + return NULL; +#else + static char buffer[1024] = { 0 }; + static char iconBuffer[6] = { 0 }; + + if (text != NULL) + { + memset(buffer, 0, 1024); + sprintf(buffer, "#%03i#", iconId); + + for (int i = 5; i < 1024; i++) + { + buffer[i] = text[i - 5]; + if (text[i - 5] == '\0') break; + } + + return buffer; + } + else + { + sprintf(iconBuffer, "#%03i#", iconId & 0x1ff); + + return iconBuffer; + } +#endif +} + +#if !defined(RAYGUI_NO_ICONS) + +// Get full icons data pointer +unsigned int *GuiGetIcons(void) { return guiIcons; } + +// Load raygui icons file (.rgi) +// NOTE: In case nameIds are required, they can be requested with loadIconsName, +// they are returned as a guiIconsName[iconCount][RAYGUI_ICON_MAX_NAME_LENGTH], +// WARNING: guiIconsName[]][] memory should be manually freed! +char **GuiLoadIcons(const char *fileName, bool loadIconsName) +{ + // Style File Structure (.rgi) + // ------------------------------------------------------ + // Offset | Size | Type | Description + // ------------------------------------------------------ + // 0 | 4 | char | Signature: "rGI " + // 4 | 2 | short | Version: 100 + // 6 | 2 | short | reserved + + // 8 | 2 | short | Num icons (N) + // 10 | 2 | short | Icons size (Options: 16, 32, 64) (S) + + // Icons name id (32 bytes per name id) + // foreach (icon) + // { + // 12+32*i | 32 | char | Icon NameId + // } + + // Icons data: One bit per pixel, stored as unsigned int array (depends on icon size) + // S*S pixels/32bit per unsigned int = K unsigned int per icon + // foreach (icon) + // { + // ... | K | unsigned int | Icon Data + // } + + FILE *rgiFile = fopen(fileName, "rb"); + + char **guiIconsName = NULL; + + if (rgiFile != NULL) + { + char signature[5] = { 0 }; + short version = 0; + short reserved = 0; + short iconCount = 0; + short iconSize = 0; + + fread(signature, 1, 4, rgiFile); + fread(&version, 1, sizeof(short), rgiFile); + fread(&reserved, 1, sizeof(short), rgiFile); + fread(&iconCount, 1, sizeof(short), rgiFile); + fread(&iconSize, 1, sizeof(short), rgiFile); + + if ((signature[0] == 'r') && + (signature[1] == 'G') && + (signature[2] == 'I') && + (signature[3] == ' ')) + { + if (loadIconsName) + { + guiIconsName = (char **)RAYGUI_MALLOC(iconCount*sizeof(char **)); + for (int i = 0; i < iconCount; i++) + { + guiIconsName[i] = (char *)RAYGUI_MALLOC(RAYGUI_ICON_MAX_NAME_LENGTH); + fread(guiIconsName[i], RAYGUI_ICON_MAX_NAME_LENGTH, 1, rgiFile); + } + } + else fseek(rgiFile, iconCount*RAYGUI_ICON_MAX_NAME_LENGTH, SEEK_CUR); + + // Read icons data directly over guiIcons data array + fread(guiIcons, iconCount*(iconSize*iconSize/32), sizeof(unsigned int), rgiFile); + } + + fclose(rgiFile); + } + + return guiIconsName; +} + +// Draw selected icon using rectangles pixel-by-pixel +void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color) +{ + #define BIT_CHECK(a,b) ((a) & (1u<<(b))) + + for (int i = 0, y = 0; i < RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32; i++) + { + for (int k = 0; k < 32; k++) + { + if (BIT_CHECK(guiIcons[iconId*RAYGUI_ICON_DATA_ELEMENTS + i], k)) + { + #if !defined(RAYGUI_STANDALONE) + DrawRectangle(posX + (k%RAYGUI_ICON_SIZE)*pixelSize, posY + y*pixelSize, pixelSize, pixelSize, color); + #endif + } + + if ((k == 15) || (k == 31)) y++; + } + } +} + +// Get icon bit data +// NOTE: Bit data array grouped as unsigned int (RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32 elements) +unsigned int *GuiGetIconData(int iconId) +{ + static unsigned int iconData[RAYGUI_ICON_DATA_ELEMENTS] = { 0 }; + memset(iconData, 0, RAYGUI_ICON_DATA_ELEMENTS*sizeof(unsigned int)); + + if (iconId < RAYGUI_ICON_MAX_ICONS) memcpy(iconData, &guiIcons[iconId*RAYGUI_ICON_DATA_ELEMENTS], RAYGUI_ICON_DATA_ELEMENTS*sizeof(unsigned int)); + + return iconData; +} + +// Set icon bit data +// NOTE: Data must be provided as unsigned int array (RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32 elements) +void GuiSetIconData(int iconId, unsigned int *data) +{ + if (iconId < RAYGUI_ICON_MAX_ICONS) memcpy(&guiIcons[iconId*RAYGUI_ICON_DATA_ELEMENTS], data, RAYGUI_ICON_DATA_ELEMENTS*sizeof(unsigned int)); +} + +// Set icon scale (1 by default) +void GuiSetIconScale(unsigned int scale) +{ + guiIconScale = (scale < 1)? 1 : scale; +} + +// Set icon pixel value +void GuiSetIconPixel(int iconId, int x, int y) +{ + #define BIT_SET(a,b) ((a) |= (1u<<(b))) + + // This logic works for any RAYGUI_ICON_SIZE pixels icons, + // For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element + BIT_SET(guiIcons[iconId*RAYGUI_ICON_DATA_ELEMENTS + y/(sizeof(unsigned int)*8/RAYGUI_ICON_SIZE)], x + (y%(sizeof(unsigned int)*8/RAYGUI_ICON_SIZE)*RAYGUI_ICON_SIZE)); +} + +// Clear icon pixel value +void GuiClearIconPixel(int iconId, int x, int y) +{ + #define BIT_CLEAR(a,b) ((a) &= ~((1u)<<(b))) + + // This logic works for any RAYGUI_ICON_SIZE pixels icons, + // For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element + BIT_CLEAR(guiIcons[iconId*RAYGUI_ICON_DATA_ELEMENTS + y/(sizeof(unsigned int)*8/RAYGUI_ICON_SIZE)], x + (y%(sizeof(unsigned int)*8/RAYGUI_ICON_SIZE)*RAYGUI_ICON_SIZE)); +} + +// Check icon pixel value +bool GuiCheckIconPixel(int iconId, int x, int y) +{ + #define BIT_CHECK(a,b) ((a) & (1u<<(b))) + + return (BIT_CHECK(guiIcons[iconId*8 + y/2], x + (y%2*16))); +} +#endif // !RAYGUI_NO_ICONS + +//---------------------------------------------------------------------------------- +// Module specific Functions Definition +//---------------------------------------------------------------------------------- +// Gui get text width considering icon +static int GetTextWidth(const char *text) +{ + #if !defined(ICON_TEXT_PADDING) + #define ICON_TEXT_PADDING 4 + #endif + + Vector2 size = { 0 }; + int textIconOffset = 0; + + if ((text != NULL) && (text[0] != '\0')) + { + if (text[0] == '#') + { + for (int i = 1; (text[i] != '\0') && (i < 5); i++) + { + if (text[i] == '#') + { + textIconOffset = i; + break; + } + } + } + + // Make sure guiFont is set, GuiGetStyle() initializes it lazynessly + float fontSize = (float)GuiGetStyle(DEFAULT, TEXT_SIZE); + + size = MeasureTextEx(guiFont, text + textIconOffset, fontSize, (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); + if (textIconOffset > 0) size.x += (RAYGUI_ICON_SIZE - ICON_TEXT_PADDING); + } + + return (int)size.x; +} + +// Get text bounds considering control bounds +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.width = bounds.width - 2*GuiGetStyle(control, BORDER_WIDTH); + textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH); + + // Consider TEXT_PADDING properly, depends on control type and TEXT_ALIGNMENT + switch (control) + { + case COMBOBOX: bounds.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 + default: + { + 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; +} + +// Get text icon if provided and move text cursor +// NOTE: We support up to 999 values for iconId +static const char *GetTextIcon(const char *text, int *iconId) +{ +#if !defined(RAYGUI_NO_ICONS) + *iconId = -1; + if (text[0] == '#') // Maybe we have an icon! + { + char iconValue[4] = { 0 }; // Maximum length for icon value: 3 digits + '\0' + + int pos = 1; + while ((pos < 4) && (text[pos] >= '0') && (text[pos] <= '9')) + { + iconValue[pos - 1] = text[pos]; + pos++; + } + + if (text[pos] == '#') + { + *iconId = TextToInteger(iconValue); + + // Move text pointer after icon + // WARNING: If only icon provided, it could point to EOL character: '\0' + if (*iconId >= 0) text += (pos + 1); + } + } +#endif + + return text; +} + +// Gui draw text using default font +static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint) +{ + #define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect + + #if !defined(ICON_TEXT_PADDING) + #define ICON_TEXT_PADDING 4 + #endif + + if ((text != NULL) && (text[0] != '\0')) + { + int iconId = 0; + text = GetTextIcon(text, &iconId); // Check text for icon and move cursor + + // Get text position depending on alignment and iconId + //--------------------------------------------------------------------------------- + Vector2 position = { bounds.x, bounds.y }; + + // NOTE: We get text size after icon has been processed + // TODO: REVIEW: We consider text size in case of line breaks! -> MeasureTextEx() depends on raylib! + Vector2 textSize = MeasureTextEx(GuiGetFont(), text, GuiGetStyle(DEFAULT, TEXT_SIZE), GuiGetStyle(DEFAULT, TEXT_SPACING)); + //int textWidth = GetTextWidth(text); + //int textHeight = GuiGetStyle(DEFAULT, TEXT_SIZE); + + // If text requires an icon, add size to measure + if (iconId >= 0) + { + textSize.x += RAYGUI_ICON_SIZE*guiIconScale; + + // WARNING: If only icon provided, text could be pointing to EOF character: '\0' + if ((text != NULL) && (text[0] != '\0')) textSize.x += ICON_TEXT_PADDING; + } + + // Check guiTextAlign global variables + switch (alignment) + { + case TEXT_ALIGN_LEFT: + { + position.x = bounds.x; + position.y = bounds.y + bounds.height/2 - textSize.y/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height); + } break; + case TEXT_ALIGN_CENTER: + { + position.x = bounds.x + bounds.width/2 - textSize.x/2; + position.y = bounds.y + bounds.height/2 - textSize.y/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height); + } break; + case TEXT_ALIGN_RIGHT: + { + position.x = bounds.x + bounds.width - textSize.x; + position.y = bounds.y + bounds.height/2 - textSize.y/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.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); + //--------------------------------------------------------------------------------- + + // 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); + } +#endif + DrawTextEx(guiFont, text, position, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING), tint); + //--------------------------------------------------------------------------------- + } +} + +// Gui draw rectangle using default raygui plain style with borders +static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color) +{ + if (color.a > 0) + { + // Draw rectangle filled with color + DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, color); + } + + 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); + } +} + +// Split controls text into multiple strings +// Also check for multiple columns (required by GuiToggleGroup()) +static const char **GuiTextSplit(const char *text, int *count, int *textRow) +{ + // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter) + // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated, + // all used memory is static... it has some limitations: + // 1. Maximum number of possible split strings is set by RAYGUI_TEXTSPLIT_MAX_ITEMS + // 2. Maximum size of text to split is RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE + // NOTE: Those definitions could be externally provided if required + + #if !defined(RAYGUI_TEXTSPLIT_MAX_ITEMS) + #define RAYGUI_TEXTSPLIT_MAX_ITEMS 128 + #endif + #if !defined(RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE) + #define RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE 1024 + #endif + + static const char *result[RAYGUI_TEXTSPLIT_MAX_ITEMS] = { NULL }; + static char buffer[RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE] = { 0 }; + memset(buffer, 0, RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE); + + result[0] = buffer; + int counter = 1; + + if (textRow != NULL) textRow[0] = 0; + + // Count how many substrings we have on text and point to every one + for (int i = 0; i < RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE; i++) + { + buffer[i] = text[i]; + if (buffer[i] == '\0') break; + else if ((buffer[i] == ';') || (buffer[i] == '\n')) + { + result[counter] = buffer + i + 1; + + if (textRow != NULL) + { + if (buffer[i] == '\n') textRow[counter] = textRow[counter - 1] + 1; + else textRow[counter] = textRow[counter - 1]; + } + + buffer[i] = '\0'; // Set an end of string at this point + + counter++; + if (counter == RAYGUI_TEXTSPLIT_MAX_ITEMS) break; + } + } + + *count = counter; + + return result; +} + +// Convert color data from RGB to HSV +// NOTE: Color data should be passed normalized +static Vector3 ConvertRGBtoHSV(Vector3 rgb) +{ + Vector3 hsv = { 0 }; + float min = 0.0f; + float max = 0.0f; + float delta = 0.0f; + + min = (rgb.x < rgb.y)? rgb.x : rgb.y; + min = (min < rgb.z)? min : rgb.z; + + max = (rgb.x > rgb.y)? rgb.x : rgb.y; + max = (max > rgb.z)? max : rgb.z; + + hsv.z = max; // Value + delta = max - min; + + if (delta < 0.00001f) + { + hsv.y = 0.0f; + hsv.x = 0.0f; // Undefined, maybe NAN? + return hsv; + } + + if (max > 0.0f) + { + // NOTE: If max is 0, this divide would cause a crash + hsv.y = (delta/max); // Saturation + } + else + { + // NOTE: If max is 0, then r = g = b = 0, s = 0, h is undefined + hsv.y = 0.0f; + hsv.x = 0.0f; // Undefined, maybe NAN? + return hsv; + } + + // NOTE: Comparing float values could not work properly + if (rgb.x >= max) hsv.x = (rgb.y - rgb.z)/delta; // Between yellow & magenta + else + { + if (rgb.y >= max) hsv.x = 2.0f + (rgb.z - rgb.x)/delta; // Between cyan & yellow + else hsv.x = 4.0f + (rgb.x - rgb.y)/delta; // Between magenta & cyan + } + + hsv.x *= 60.0f; // Convert to degrees + + if (hsv.x < 0.0f) hsv.x += 360.0f; + + return hsv; +} + +// Convert color data from HSV to RGB +// NOTE: Color data should be passed normalized +static Vector3 ConvertHSVtoRGB(Vector3 hsv) +{ + Vector3 rgb = { 0 }; + float hh = 0.0f, p = 0.0f, q = 0.0f, t = 0.0f, ff = 0.0f; + long i = 0; + + // NOTE: Comparing float values could not work properly + if (hsv.y <= 0.0f) + { + rgb.x = hsv.z; + rgb.y = hsv.z; + rgb.z = hsv.z; + return rgb; + } + + hh = hsv.x; + if (hh >= 360.0f) hh = 0.0f; + hh /= 60.0f; + + i = (long)hh; + ff = hh - i; + p = hsv.z*(1.0f - hsv.y); + q = hsv.z*(1.0f - (hsv.y*ff)); + t = hsv.z*(1.0f - (hsv.y*(1.0f - ff))); + + switch (i) + { + case 0: + { + rgb.x = hsv.z; + rgb.y = t; + rgb.z = p; + } break; + case 1: + { + rgb.x = q; + rgb.y = hsv.z; + rgb.z = p; + } break; + case 2: + { + rgb.x = p; + rgb.y = hsv.z; + rgb.z = t; + } break; + case 3: + { + rgb.x = p; + rgb.y = q; + rgb.z = hsv.z; + } break; + case 4: + { + rgb.x = t; + rgb.y = p; + rgb.z = hsv.z; + } break; + case 5: + default: + { + rgb.x = hsv.z; + rgb.y = p; + rgb.z = q; + } break; + } + + return rgb; +} + +// Scroll bar control (used by GuiScrollPanel()) +static int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue) +{ + GuiState state = guiState; + + // Is the scrollbar horizontal or vertical? + bool isVertical = (bounds.width > bounds.height) ? false : true; + + // The size (width or height depending on scrollbar type) of the spinner buttons + const int spinnerSize = GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE) ? (isVertical ? (int)bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) : (int)bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH)) : 0; + + // Arrow buttons [<] [>] [∧] [∨] + Rectangle arrowUpLeft = { 0 }; + Rectangle arrowDownRight = { 0 }; + + // Actual area of the scrollbar excluding the arrow buttons + Rectangle scrollbar = { 0 }; + + // Slider bar that moves --[///]----- + Rectangle slider = { 0 }; + + // Normalize value + if (value > maxValue) value = maxValue; + if (value < minValue) value = minValue; + + const int range = maxValue - minValue; + int sliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); + + // Calculate rectangles for all of the components + arrowUpLeft = RAYGUI_CLITERAL(Rectangle) { (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize }; + + if (isVertical) + { + 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 }; + } + else + { + 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)) }; + } + + // Update control + //-------------------------------------------------------------------- + if ((state != STATE_DISABLED) && !guiLocked) + { + Vector2 mousePoint = GetMousePosition(); + + if (CheckCollisionPointRec(mousePoint, bounds)) + { + state = STATE_FOCUSED; + + // Handle mouse wheel + int wheel = (int)GetMouseWheelMove(); + if (wheel != 0) value += wheel; + + 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); + + state = STATE_PRESSED; + } + else if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) + { + 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); + } + } + } + + // Normalize value + if (value > maxValue) value = maxValue; + if (value < minValue) value = minValue; + } + //-------------------------------------------------------------------- + + // 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(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 + + // Draw arrows (using icon if available) + if (GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)) + { +#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)); + 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)); +#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 + 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 +#endif + } + //-------------------------------------------------------------------- + + return value; +} + +#if defined(RAYGUI_STANDALONE) +// Returns a Color struct from hexadecimal value +static Color GetColor(int hexValue) +{ + Color color; + + color.r = (unsigned char)(hexValue >> 24) & 0xFF; + color.g = (unsigned char)(hexValue >> 16) & 0xFF; + color.b = (unsigned char)(hexValue >> 8) & 0xFF; + color.a = (unsigned char)hexValue & 0xFF; + + return color; +} + +// Returns hexadecimal value for a Color +static int ColorToInt(Color color) +{ + return (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a); +} + +// Check if point is inside rectangle +static bool CheckCollisionPointRec(Vector2 point, Rectangle rec) +{ + bool collision = false; + + if ((point.x >= rec.x) && (point.x <= (rec.x + rec.width)) && + (point.y >= rec.y) && (point.y <= (rec.y + rec.height))) collision = true; + + 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, ...) +{ + #if !defined(RAYGUI_TEXTFORMAT_MAX_SIZE) + #define RAYGUI_TEXTFORMAT_MAX_SIZE 256 + #endif + + static char buffer[RAYGUI_TEXTFORMAT_MAX_SIZE]; + + va_list args; + va_start(args, text); + vsprintf(buffer, text, args); + va_end(args); + + return buffer; +} + +// Draw rectangle with vertical gradient fill color +// NOTE: This function is only used by GuiColorPicker() +static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2) +{ + Rectangle bounds = { (float)posX, (float)posY, (float)width, (float)height }; + DrawRectangleGradientEx(bounds, color1, color2, color2, color1); +} + +// Split string into multiple strings +const char **TextSplit(const char *text, char delimiter, int *count) +{ + // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter) + // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated, + // all used memory is static... it has some limitations: + // 1. Maximum number of possible split strings is set by RAYGUI_TEXTSPLIT_MAX_ITEMS + // 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 + #endif + #if !defined(RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE) + #define RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE 1024 + #endif + + static const char *result[RAYGUI_TEXTSPLIT_MAX_ITEMS] = { NULL }; + static char buffer[RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE] = { 0 }; + memset(buffer, 0, RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE); + + result[0] = buffer; + int counter = 0; + + if (text != NULL) + { + counter = 1; + + // Count how many substrings we have on text and point to every one + for (int i = 0; i < RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE; i++) + { + buffer[i] = text[i]; + if (buffer[i] == '\0') break; + else if (buffer[i] == delimiter) + { + buffer[i] = '\0'; // Set an end of string at this point + result[counter] = buffer + i + 1; + counter++; + + if (counter == RAYGUI_TEXTSPLIT_MAX_ITEMS) break; + } + } + } + + *count = counter; + return result; +} + +// Get integer value from text +// NOTE: This function replaces atoi() [stdlib.h] +static int TextToInteger(const char *text) +{ + int value = 0; + int sign = 1; + + if ((text[0] == '+') || (text[0] == '-')) + { + if (text[0] == '-') sign = -1; + text++; + } + + for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); ++i) value = value*10 + (int)(text[i] - '0'); + + return value*sign; +} + +// Encode codepoint into UTF-8 text (char array size returned as parameter) +static const char *CodepointToUTF8(int codepoint, int *byteSize) +{ + static char utf8[6] = { 0 }; + int size = 0; + + if (codepoint <= 0x7f) + { + utf8[0] = (char)codepoint; + size = 1; + } + else if (codepoint <= 0x7ff) + { + utf8[0] = (char)(((codepoint >> 6) & 0x1f) | 0xc0); + utf8[1] = (char)((codepoint & 0x3f) | 0x80); + size = 2; + } + else if (codepoint <= 0xffff) + { + utf8[0] = (char)(((codepoint >> 12) & 0x0f) | 0xe0); + utf8[1] = (char)(((codepoint >> 6) & 0x3f) | 0x80); + utf8[2] = (char)((codepoint & 0x3f) | 0x80); + size = 3; + } + else if (codepoint <= 0x10ffff) + { + utf8[0] = (char)(((codepoint >> 18) & 0x07) | 0xf0); + utf8[1] = (char)(((codepoint >> 12) & 0x3f) | 0x80); + utf8[2] = (char)(((codepoint >> 6) & 0x3f) | 0x80); + utf8[3] = (char)((codepoint & 0x3f) | 0x80); + size = 4; + } + + *byteSize = size; + + return utf8; +} + +// Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found +// When a invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned +// Total number of bytes processed are returned as a parameter +// NOTE: the standard says U+FFFD should be returned in case of errors +// but that character is not supported by the default font in raylib +static int GetCodepoint(const char *text, int *bytesProcessed) +{ +/* + UTF-8 specs from https://www.ietf.org/rfc/rfc3629.txt + + Char. number range | UTF-8 octet sequence + (hexadecimal) | (binary) + --------------------+--------------------------------------------- + 0000 0000-0000 007F | 0xxxxxxx + 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx +*/ + // NOTE: on decode errors we return as soon as possible + + int code = 0x3f; // Codepoint (defaults to '?') + int octet = (unsigned char)(text[0]); // The first UTF8 octet + *bytesProcessed = 1; + + if (octet <= 0x7f) + { + // Only one octet (ASCII range x00-7F) + code = text[0]; + } + else if ((octet & 0xe0) == 0xc0) + { + // Two octets + + // [0]xC2-DF [1]UTF8-tail(x80-BF) + unsigned char octet1 = text[1]; + + if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence + + if ((octet >= 0xc2) && (octet <= 0xdf)) + { + code = ((octet & 0x1f) << 6) | (octet1 & 0x3f); + *bytesProcessed = 2; + } + } + else if ((octet & 0xf0) == 0xe0) + { + // Three octets + unsigned char octet1 = text[1]; + unsigned char octet2 = '\0'; + + if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence + + octet2 = text[2]; + + if ((octet2 == '\0') || ((octet2 >> 6) != 2)) { *bytesProcessed = 3; return code; } // Unexpected sequence + + // [0]xE0 [1]xA0-BF [2]UTF8-tail(x80-BF) + // [0]xE1-EC [1]UTF8-tail [2]UTF8-tail(x80-BF) + // [0]xED [1]x80-9F [2]UTF8-tail(x80-BF) + // [0]xEE-EF [1]UTF8-tail [2]UTF8-tail(x80-BF) + + if (((octet == 0xe0) && !((octet1 >= 0xa0) && (octet1 <= 0xbf))) || + ((octet == 0xed) && !((octet1 >= 0x80) && (octet1 <= 0x9f)))) { *bytesProcessed = 2; return code; } + + if ((octet >= 0xe0) && (0 <= 0xef)) + { + code = ((octet & 0xf) << 12) | ((octet1 & 0x3f) << 6) | (octet2 & 0x3f); + *bytesProcessed = 3; + } + } + else if ((octet & 0xf8) == 0xf0) + { + // Four octets + if (octet > 0xf4) return code; + + unsigned char octet1 = text[1]; + unsigned char octet2 = '\0'; + unsigned char octet3 = '\0'; + + if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence + + octet2 = text[2]; + + if ((octet2 == '\0') || ((octet2 >> 6) != 2)) { *bytesProcessed = 3; return code; } // Unexpected sequence + + octet3 = text[3]; + + if ((octet3 == '\0') || ((octet3 >> 6) != 2)) { *bytesProcessed = 4; return code; } // Unexpected sequence + + // [0]xF0 [1]x90-BF [2]UTF8-tail [3]UTF8-tail + // [0]xF1-F3 [1]UTF8-tail [2]UTF8-tail [3]UTF8-tail + // [0]xF4 [1]x80-8F [2]UTF8-tail [3]UTF8-tail + + if (((octet == 0xf0) && !((octet1 >= 0x90) && (octet1 <= 0xbf))) || + ((octet == 0xf4) && !((octet1 >= 0x80) && (octet1 <= 0x8f)))) { *bytesProcessed = 2; return code; } // Unexpected sequence + + if (octet >= 0xf0) + { + code = ((octet & 0x7) << 18) | ((octet1 & 0x3f) << 12) | ((octet2 & 0x3f) << 6) | (octet3 & 0x3f); + *bytesProcessed = 4; + } + } + + if (code > 0x10ffff) code = 0x3f; // Codepoints after U+10ffff are invalid + + return code; +} +#endif // RAYGUI_STANDALONE + +#endif // RAYGUI_IMPLEMENTATION diff --git a/src/extras/reasings.h b/src/extras/reasings.h new file mode 100644 index 0000000..4f32dee --- /dev/null +++ b/src/extras/reasings.h @@ -0,0 +1,263 @@ +/******************************************************************************************* +* +* reasings - raylib easings library, based on Robert Penner library +* +* Useful easing functions for values animation +* +* This header uses: +* #define REASINGS_STATIC_INLINE // Inlines all functions code, so it runs faster. +* // This requires lots of memory on system. +* How to use: +* The four inputs t,b,c,d are defined as follows: +* t = current time (in any unit measure, but same unit as duration) +* b = starting value to interpolate +* c = the total change in value of b that needs to occur +* d = total time it should take to complete (duration) +* +* Example: +* +* int currentTime = 0; +* int duration = 100; +* float startPositionX = 0.0f; +* float finalPositionX = 30.0f; +* float currentPositionX = startPositionX; +* +* while (currentPositionX < finalPositionX) +* { +* currentPositionX = EaseSineIn(currentTime, startPositionX, finalPositionX - startPositionX, duration); +* currentTime++; +* } +* +* A port of Robert Penner's easing equations to C (http://robertpenner.com/easing/) +* +* Robert Penner License +* --------------------------------------------------------------------------------- +* Open source under the BSD License. +* +* Copyright (c) 2001 Robert Penner. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* - Neither the name of the author nor the names of contributors may be used +* to endorse or promote products derived from this software without specific +* prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +* OF THE POSSIBILITY OF SUCH DAMAGE. +* --------------------------------------------------------------------------------- +* +* Copyright (c) 2015-2022 Ramon Santamaria (@raysan5) +* +* This software is provided "as-is", without any express or implied warranty. In no event +* will the authors be held liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, including commercial +* applications, and to alter it and redistribute it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not claim that you +* wrote the original software. If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but is not required. +* +* 2. Altered source versions must be plainly marked as such, and must not be misrepresented +* as being the original software. +* +* 3. This notice may not be removed or altered from any source distribution. +* +**********************************************************************************************/ + +#ifndef REASINGS_H +#define REASINGS_H + +#define REASINGS_STATIC_INLINE // NOTE: By default, compile functions as static inline + +#if defined(REASINGS_STATIC_INLINE) + #define EASEDEF static inline +#else + #define EASEDEF extern +#endif + +#include // Required for: sinf(), cosf(), sqrtf(), powf() + +#ifndef PI + #define PI 3.14159265358979323846f //Required as PI is not always defined in math.h +#endif + +#if defined(__cplusplus) +extern "C" { // Prevents name mangling of functions +#endif + +// Linear Easing functions +EASEDEF float EaseLinearNone(float t, float b, float c, float d) { return (c*t/d + b); } // Ease: Linear +EASEDEF float EaseLinearIn(float t, float b, float c, float d) { return (c*t/d + b); } // Ease: Linear In +EASEDEF float EaseLinearOut(float t, float b, float c, float d) { return (c*t/d + b); } // Ease: Linear Out +EASEDEF float EaseLinearInOut(float t, float b, float c, float d) { return (c*t/d + b); } // Ease: Linear In Out + +// Sine Easing functions +EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cosf(t/d*(PI/2.0f)) + c + b); } // Ease: Sine In +EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sinf(t/d*(PI/2.0f)) + b); } // Ease: Sine Out +EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cosf(PI*t/d) - 1.0f) + b); } // Ease: Sine Out + +// Circular Easing functions +EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrtf(1.0f - t*t) - 1.0f) + b); } // Ease: Circular In +EASEDEF float EaseCircOut(float t, float b, float c, float d) { t = t/d - 1.0f; return (c*sqrtf(1.0f - t*t) + b); } // Ease: Circular Out +EASEDEF float EaseCircInOut(float t, float b, float c, float d) // Ease: Circular In Out +{ + if ((t/=d/2.0f) < 1.0f) return (-c/2.0f*(sqrtf(1.0f - t*t) - 1.0f) + b); + t -= 2.0f; return (c/2.0f*(sqrtf(1.0f - t*t) + 1.0f) + b); +} + +// Cubic Easing functions +EASEDEF float EaseCubicIn(float t, float b, float c, float d) { t /= d; return (c*t*t*t + b); } // Ease: Cubic In +EASEDEF float EaseCubicOut(float t, float b, float c, float d) { t = t/d - 1.0f; return (c*(t*t*t + 1.0f) + b); } // Ease: Cubic Out +EASEDEF float EaseCubicInOut(float t, float b, float c, float d) // Ease: Cubic In Out +{ + if ((t/=d/2.0f) < 1.0f) return (c/2.0f*t*t*t + b); + t -= 2.0f; return (c/2.0f*(t*t*t + 2.0f) + b); +} + +// Quadratic Easing functions +EASEDEF float EaseQuadIn(float t, float b, float c, float d) { t /= d; return (c*t*t + b); } // Ease: Quadratic In +EASEDEF float EaseQuadOut(float t, float b, float c, float d) { t /= d; return (-c*t*(t - 2.0f) + b); } // Ease: Quadratic Out +EASEDEF float EaseQuadInOut(float t, float b, float c, float d) // Ease: Quadratic In Out +{ + if ((t/=d/2) < 1) return (((c/2)*(t*t)) + b); + return (-c/2.0f*(((t - 1.0f)*(t - 3.0f)) - 1.0f) + b); +} + +// Exponential Easing functions +EASEDEF float EaseExpoIn(float t, float b, float c, float d) { return (t == 0.0f) ? b : (c*powf(2.0f, 10.0f*(t/d - 1.0f)) + b); } // Ease: Exponential In +EASEDEF float EaseExpoOut(float t, float b, float c, float d) { return (t == d) ? (b + c) : (c*(-powf(2.0f, -10.0f*t/d) + 1.0f) + b); } // Ease: Exponential Out +EASEDEF float EaseExpoInOut(float t, float b, float c, float d) // Ease: Exponential In Out +{ + if (t == 0.0f) return b; + if (t == d) return (b + c); + if ((t/=d/2.0f) < 1.0f) return (c/2.0f*powf(2.0f, 10.0f*(t - 1.0f)) + b); + + return (c/2.0f*(-powf(2.0f, -10.0f*(t - 1.0f)) + 2.0f) + b); +} + +// Back Easing functions +EASEDEF float EaseBackIn(float t, float b, float c, float d) // Ease: Back In +{ + float s = 1.70158f; + float postFix = t/=d; + return (c*(postFix)*t*((s + 1.0f)*t - s) + b); +} + +EASEDEF float EaseBackOut(float t, float b, float c, float d) // Ease: Back Out +{ + float s = 1.70158f; + t = t/d - 1.0f; + return (c*(t*t*((s + 1.0f)*t + s) + 1.0f) + b); +} + +EASEDEF float EaseBackInOut(float t, float b, float c, float d) // Ease: Back In Out +{ + float s = 1.70158f; + if ((t/=d/2.0f) < 1.0f) + { + s *= 1.525f; + return (c/2.0f*(t*t*((s + 1.0f)*t - s)) + b); + } + + float postFix = t-=2.0f; + s *= 1.525f; + return (c/2.0f*((postFix)*t*((s + 1.0f)*t + s) + 2.0f) + b); +} + +// Bounce Easing functions +EASEDEF float EaseBounceOut(float t, float b, float c, float d) // Ease: Bounce Out +{ + if ((t/=d) < (1.0f/2.75f)) + { + return (c*(7.5625f*t*t) + b); + } + else if (t < (2.0f/2.75f)) + { + float postFix = t-=(1.5f/2.75f); + return (c*(7.5625f*(postFix)*t + 0.75f) + b); + } + else if (t < (2.5/2.75)) + { + float postFix = t-=(2.25f/2.75f); + return (c*(7.5625f*(postFix)*t + 0.9375f) + b); + } + else + { + float postFix = t-=(2.625f/2.75f); + return (c*(7.5625f*(postFix)*t + 0.984375f) + b); + } +} + +EASEDEF float EaseBounceIn(float t, float b, float c, float d) { return (c - EaseBounceOut(d - t, 0.0f, c, d) + b); } // Ease: Bounce In +EASEDEF float EaseBounceInOut(float t, float b, float c, float d) // Ease: Bounce In Out +{ + if (t < d/2.0f) return (EaseBounceIn(t*2.0f, 0.0f, c, d)*0.5f + b); + else return (EaseBounceOut(t*2.0f - d, 0.0f, c, d)*0.5f + c*0.5f + b); +} + +// Elastic Easing functions +EASEDEF float EaseElasticIn(float t, float b, float c, float d) // Ease: Elastic In +{ + if (t == 0.0f) return b; + if ((t/=d) == 1.0f) return (b + c); + + float p = d*0.3f; + float a = c; + float s = p/4.0f; + float postFix = a*powf(2.0f, 10.0f*(t-=1.0f)); + + return (-(postFix*sinf((t*d-s)*(2.0f*PI)/p )) + b); +} + +EASEDEF float EaseElasticOut(float t, float b, float c, float d) // Ease: Elastic Out +{ + if (t == 0.0f) return b; + if ((t/=d) == 1.0f) return (b + c); + + float p = d*0.3f; + float a = c; + float s = p/4.0f; + + return (a*powf(2.0f,-10.0f*t)*sinf((t*d-s)*(2.0f*PI)/p) + c + b); +} + +EASEDEF float EaseElasticInOut(float t, float b, float c, float d) // Ease: Elastic In Out +{ + if (t == 0.0f) return b; + if ((t/=d/2.0f) == 2.0f) return (b + c); + + float p = d*(0.3f*1.5f); + float a = c; + float s = p/4.0f; + + if (t < 1.0f) + { + float postFix = a*powf(2.0f, 10.0f*(t-=1.0f)); + return -0.5f*(postFix*sinf((t*d-s)*(2.0f*PI)/p)) + b; + } + + float postFix = a*powf(2.0f, -10.0f*(t-=1.0f)); + + return (postFix*sinf((t*d-s)*(2.0f*PI)/p)*0.5f + c + b); +} + +#if defined(__cplusplus) +} +#endif + +#endif // REASINGS_H diff --git a/src/extras/rlgl.h b/src/extras/rlgl.h new file mode 100644 index 0000000..123791a --- /dev/null +++ b/src/extras/rlgl.h @@ -0,0 +1,4717 @@ +/********************************************************************************************** +* +* rlgl v4.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...) +* +* When chosing 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, +* additioanlly, rlDrawRenderBatchActive() could be called to force flushing of the batch. +* +* Some additional resources are also loaded for convenience, here the complete list: +* - Default batch (RLGL.defaultBatch): RenderBatch system to accumulate vertex data +* - Default texture (RLGL.defaultTextureId): 1x1 white pixel R8G8B8A8 +* - Default shader (RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs) +* +* Internal buffer (and additional resources) must be manually unloaded calling rlglClose(). +* +* +* CONFIGURATION: +* +* #define GRAPHICS_API_OPENGL_11 +* #define GRAPHICS_API_OPENGL_21 +* #define GRAPHICS_API_OPENGL_33 +* #define GRAPHICS_API_OPENGL_43 +* #define GRAPHICS_API_OPENGL_ES2 +* Use selected OpenGL graphics backend, should be supported by platform +* Those preprocessor defines are only used on rlgl module, if OpenGL version is +* required by any other module, use rlGetVersion() to check it +* +* #define RLGL_IMPLEMENTATION +* Generates the implementation of the library into the included file. +* If not defined, the library is in header only mode and can be included in other headers +* or source files without problems. But only ONE file should hold the implementation. +* +* #define RLGL_RENDER_TEXTURES_HINT +* Enable framebuffer objects (fbo) support (enabled by default) +* Some GPUs could not support them despite the OpenGL version +* +* #define RLGL_SHOW_GL_DETAILS_INFO +* Show OpenGL extensions and capabilities detailed logs on init +* +* #define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT +* Enable debug context (only available on OpenGL 4.3) +* +* rlgl capabilities could be customized just defining some internal +* values before library inclusion (default values listed): +* +* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits +* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering) +* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture) +* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture()) +* +* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack +* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported +* #define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance +* #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance +* +* When loading a shader, the following vertex attribute and uniform +* location names are tried to be set automatically: +* +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Binded by default to shader location: 0 +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Binded by default to shader location: 1 +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Binded by default to shader location: 2 +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Binded by default to shader location: 3 +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Binded by default to shader location: 4 +* #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Binded by default to shader location: 5 +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)) +* #define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color) +* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0) +* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1) +* #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2) +* +* DEPENDENCIES: +* +* - OpenGL libraries (depending on platform and OpenGL version selected) +* - GLAD OpenGL extensions loading library (only for OpenGL 3.3 Core, 4.3 Core) +* +* +* LICENSE: zlib/libpng +* +* Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) +* +* This software is provided "as-is", without any express or implied warranty. In no event +* will the authors be held liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, including commercial +* applications, and to alter it and redistribute it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not claim that you +* wrote the original software. If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but is not required. +* +* 2. Altered source versions must be plainly marked as such, and must not be misrepresented +* as being the original software. +* +* 3. This notice may not be removed or altered from any source distribution. +* +**********************************************************************************************/ + +#ifndef RLGL_H +#define RLGL_H + +#define RLGL_VERSION "4.0" + +// Function specifiers in case library is build/used as a shared library (Windows) +// 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 +#endif + +// Function specifiers definition +#ifndef RLAPI + #define RLAPI // Functions defined as 'extern' by default (implicit specifiers) +#endif + +// Support TRACELOG macros +#ifndef TRACELOG + #define TRACELOG(level, ...) (void)0 + #define TRACELOGD(...) (void)0 +#endif + +// Allow custom memory allocators +#ifndef RL_MALLOC + #define RL_MALLOC(sz) malloc(sz) +#endif +#ifndef RL_CALLOC + #define RL_CALLOC(n,sz) calloc(n,sz) +#endif +#ifndef RL_REALLOC + #define RL_REALLOC(n,sz) realloc(n,sz) +#endif +#ifndef RL_FREE + #define RL_FREE(p) free(p) +#endif + +// Security check in case no GRAPHICS_API_OPENGL_* defined +#if !defined(GRAPHICS_API_OPENGL_11) && \ + !defined(GRAPHICS_API_OPENGL_21) && \ + !defined(GRAPHICS_API_OPENGL_33) && \ + !defined(GRAPHICS_API_OPENGL_43) && \ + !defined(GRAPHICS_API_OPENGL_ES2) + #define GRAPHICS_API_OPENGL_33 +#endif + +// Security check in case multiple GRAPHICS_API_OPENGL_* defined +#if defined(GRAPHICS_API_OPENGL_11) + #if defined(GRAPHICS_API_OPENGL_21) + #undef GRAPHICS_API_OPENGL_21 + #endif + #if defined(GRAPHICS_API_OPENGL_33) + #undef GRAPHICS_API_OPENGL_33 + #endif + #if defined(GRAPHICS_API_OPENGL_43) + #undef GRAPHICS_API_OPENGL_43 + #endif + #if defined(GRAPHICS_API_OPENGL_ES2) + #undef GRAPHICS_API_OPENGL_ES2 + #endif +#endif + +// OpenGL 2.1 uses most of OpenGL 3.3 Core functionality +// WARNING: Specific parts are checked with #if defines +#if defined(GRAPHICS_API_OPENGL_21) + #define GRAPHICS_API_OPENGL_33 +#endif + +// OpenGL 4.3 uses OpenGL 3.3 Core functionality +#if defined(GRAPHICS_API_OPENGL_43) + #define GRAPHICS_API_OPENGL_33 +#endif + +// Support framebuffer objects by default +// NOTE: Some driver implementation do not support it, despite they should +#define RLGL_RENDER_TEXTURES_HINT + +//---------------------------------------------------------------------------------- +// Defines and Macros +//---------------------------------------------------------------------------------- + +// Default internal render batch elements limits +#ifndef RL_DEFAULT_BATCH_BUFFER_ELEMENTS + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) + // This is the maximum amount of elements (quads) per batch + // NOTE: Be careful with text, every letter maps to a quad + #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 + #endif + #if defined(GRAPHICS_API_OPENGL_ES2) + // We reduce memory sizes for embedded systems (RPI and HTML5) + // NOTE: On HTML5 (emscripten) this is allocated on heap, + // by default it's only 16MB!...just take care... + #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 2048 + #endif +#endif +#ifndef RL_DEFAULT_BATCH_BUFFERS + #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering) +#endif +#ifndef RL_DEFAULT_BATCH_DRAWCALLS + #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture) +#endif +#ifndef RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS + #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture()) +#endif + +// Internal Matrix stack +#ifndef RL_MAX_MATRIX_STACK_SIZE + #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of Matrix stack +#endif + +// Shader limits +#ifndef RL_MAX_SHADER_LOCATIONS + #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported +#endif + +// Projection matrix culling +#ifndef RL_CULL_DISTANCE_NEAR + #define RL_CULL_DISTANCE_NEAR 0.01 // Default near cull distance +#endif +#ifndef RL_CULL_DISTANCE_FAR + #define RL_CULL_DISTANCE_FAR 1000.0 // Default far cull distance +#endif + +// Texture parameters (equivalent to OpenGL defines) +#define RL_TEXTURE_WRAP_S 0x2802 // GL_TEXTURE_WRAP_S +#define RL_TEXTURE_WRAP_T 0x2803 // GL_TEXTURE_WRAP_T +#define RL_TEXTURE_MAG_FILTER 0x2800 // GL_TEXTURE_MAG_FILTER +#define RL_TEXTURE_MIN_FILTER 0x2801 // GL_TEXTURE_MIN_FILTER + +#define RL_TEXTURE_FILTER_NEAREST 0x2600 // GL_NEAREST +#define RL_TEXTURE_FILTER_LINEAR 0x2601 // GL_LINEAR +#define RL_TEXTURE_FILTER_MIP_NEAREST 0x2700 // GL_NEAREST_MIPMAP_NEAREST +#define RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR 0x2702 // GL_NEAREST_MIPMAP_LINEAR +#define RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST 0x2701 // GL_LINEAR_MIPMAP_NEAREST +#define RL_TEXTURE_FILTER_MIP_LINEAR 0x2703 // GL_LINEAR_MIPMAP_LINEAR +#define RL_TEXTURE_FILTER_ANISOTROPIC 0x3000 // Anisotropic filter (custom identifier) + +#define RL_TEXTURE_WRAP_REPEAT 0x2901 // GL_REPEAT +#define RL_TEXTURE_WRAP_CLAMP 0x812F // GL_CLAMP_TO_EDGE +#define RL_TEXTURE_WRAP_MIRROR_REPEAT 0x8370 // GL_MIRRORED_REPEAT +#define RL_TEXTURE_WRAP_MIRROR_CLAMP 0x8742 // GL_MIRROR_CLAMP_EXT + +// Matrix modes (equivalent to OpenGL) +#define RL_MODELVIEW 0x1700 // GL_MODELVIEW +#define RL_PROJECTION 0x1701 // GL_PROJECTION +#define RL_TEXTURE 0x1702 // GL_TEXTURE + +// Primitive assembly draw modes +#define RL_LINES 0x0001 // GL_LINES +#define RL_TRIANGLES 0x0004 // GL_TRIANGLES +#define RL_QUADS 0x0007 // GL_QUADS + +// GL equivalent data types +#define RL_UNSIGNED_BYTE 0x1401 // GL_UNSIGNED_BYTE +#define RL_FLOAT 0x1406 // GL_FLOAT + +// Buffer usage hint +#define RL_STREAM_DRAW 0x88E0 // GL_STREAM_DRAW +#define RL_STREAM_READ 0x88E1 // GL_STREAM_READ +#define RL_STREAM_COPY 0x88E2 // GL_STREAM_COPY +#define RL_STATIC_DRAW 0x88E4 // GL_STATIC_DRAW +#define RL_STATIC_READ 0x88E5 // GL_STATIC_READ +#define RL_STATIC_COPY 0x88E6 // GL_STATIC_COPY +#define RL_DYNAMIC_DRAW 0x88E8 // GL_DYNAMIC_DRAW +#define RL_DYNAMIC_READ 0x88E9 // GL_DYNAMIC_READ +#define RL_DYNAMIC_COPY 0x88EA // GL_DYNAMIC_COPY + +// GL Shader type +#define RL_FRAGMENT_SHADER 0x8B30 // GL_FRAGMENT_SHADER +#define RL_VERTEX_SHADER 0x8B31 // GL_VERTEX_SHADER +#define RL_COMPUTE_SHADER 0x91B9 // GL_COMPUTE_SHADER + +//---------------------------------------------------------------------------------- +// Types and Structures Definition +//---------------------------------------------------------------------------------- +typedef enum { + OPENGL_11 = 1, + OPENGL_21, + OPENGL_33, + OPENGL_43, + OPENGL_ES_20 +} rlGlVersion; + +typedef enum { + RL_ATTACHMENT_COLOR_CHANNEL0 = 0, + RL_ATTACHMENT_COLOR_CHANNEL1, + RL_ATTACHMENT_COLOR_CHANNEL2, + RL_ATTACHMENT_COLOR_CHANNEL3, + RL_ATTACHMENT_COLOR_CHANNEL4, + RL_ATTACHMENT_COLOR_CHANNEL5, + RL_ATTACHMENT_COLOR_CHANNEL6, + RL_ATTACHMENT_COLOR_CHANNEL7, + RL_ATTACHMENT_DEPTH = 100, + RL_ATTACHMENT_STENCIL = 200, +} rlFramebufferAttachType; + +typedef enum { + RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_X, + RL_ATTACHMENT_CUBEMAP_POSITIVE_Y, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y, + RL_ATTACHMENT_CUBEMAP_POSITIVE_Z, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z, + RL_ATTACHMENT_TEXTURE2D = 100, + RL_ATTACHMENT_RENDERBUFFER = 200, +} rlFramebufferAttachTextureType; + +// Dynamic vertex buffers (position + texcoords + colors + indices arrays) +typedef struct rlVertexBuffer { + int elementCount; // Number of elements in the buffer (QUADS) + + 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) + 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) +#endif +#if defined(GRAPHICS_API_OPENGL_ES2) + 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) +} rlVertexBuffer; + +// Draw call type +// NOTE: Only texture changes register a new draw, other state-change-related elements are not +// used at this moment (vaoId, shaderId, matrices), raylib just forces a batch draw call if any +// of those state-change happens (this is done in core module) +typedef struct rlDrawCall { + int mode; // Drawing mode: LINES, TRIANGLES, QUADS + int vertexCount; // Number of vertex of the draw + int vertexAlignment; // Number of vertex required for index alignment (LINES, TRIANGLES) + //unsigned int vaoId; // Vertex array id to be used on the draw -> Using RLGL.currentBatch->vertexBuffer.vaoId + //unsigned int shaderId; // Shader id to be used on the draw -> Using RLGL.currentShaderId + unsigned int textureId; // Texture id to be used on the draw -> Use to create new draw call if changes + + //Matrix projection; // Projection matrix for this draw -> Using RLGL.projection by default + //Matrix modelview; // Modelview matrix for this draw -> Using RLGL.modelview by default +} rlDrawCall; + +// rlRenderBatch type +typedef struct rlRenderBatch { + int bufferCount; // Number of vertex buffers (multi-buffering support) + int currentBuffer; // Current buffer tracking in case of multi-buffering + rlVertexBuffer *vertexBuffer; // Dynamic buffer(s) for vertex data + + rlDrawCall *draws; // Draw calls array, depends on textureId + int drawCounter; // Draw calls counter + float currentDepth; // Current depth value for next draw +} rlRenderBatch; + +#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) + #include +#elif !defined(__cplusplus) && !defined(bool) && !defined(RL_BOOL_TYPE) + // Boolean type +typedef enum bool { false = 0, true = !false } bool; +#endif + +#if !defined(RL_MATRIX_TYPE) +// Matrix, 4x4 components, column major, OpenGL style, right handed +typedef struct Matrix { + float m0, m4, m8, m12; // Matrix first row (4 components) + float m1, m5, m9, m13; // Matrix second row (4 components) + float m2, m6, m10, m14; // Matrix third row (4 components) + float m3, m7, m11, m15; // Matrix fourth row (4 components) +} Matrix; +#define RL_MATRIX_TYPE +#endif + +// Trace log level +// NOTE: Organized by priority level +typedef enum { + RL_LOG_ALL = 0, // Display all logs + RL_LOG_TRACE, // Trace logging, intended for internal use only + RL_LOG_DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds + RL_LOG_INFO, // Info logging, used for program execution info + RL_LOG_WARNING, // Warning logging, used on recoverable failures + RL_LOG_ERROR, // Error logging, used on unrecoverable failures + RL_LOG_FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE) + RL_LOG_NONE // Disable logging +} rlTraceLogLevel; + +// Texture formats (support depends on OpenGL version) +typedef enum { + RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha) + RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels) + RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5, // 16 bpp + RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8, // 24 bpp + RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1, // 16 bpp (1 bit alpha) + RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4, // 16 bpp (4 bit alpha) + RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, // 32 bpp + 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_COMPRESSED_DXT1_RGB, // 4 bpp (no alpha) + RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha) + RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA, // 8 bpp + RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA, // 8 bpp + RL_PIXELFORMAT_COMPRESSED_ETC1_RGB, // 4 bpp + RL_PIXELFORMAT_COMPRESSED_ETC2_RGB, // 4 bpp + RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA, // 8 bpp + RL_PIXELFORMAT_COMPRESSED_PVRT_RGB, // 4 bpp + RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA, // 4 bpp + RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA, // 8 bpp + RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA // 2 bpp +} rlPixelFormat; + +// Texture parameters: filter mode +// NOTE 1: Filtering considers mipmaps if available in the texture +// NOTE 2: Filter is accordingly set for minification and magnification +typedef enum { + RL_TEXTURE_FILTER_POINT = 0, // No filter, just pixel approximation + RL_TEXTURE_FILTER_BILINEAR, // Linear filtering + RL_TEXTURE_FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps) + RL_TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x + RL_TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x + RL_TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x +} rlTextureFilter; + +// Color blending modes (pre-defined) +typedef enum { + RL_BLEND_ALPHA = 0, // Blend textures considering alpha (default) + RL_BLEND_ADDITIVE, // Blend textures adding colors + RL_BLEND_MULTIPLIED, // Blend textures multiplying colors + RL_BLEND_ADD_COLORS, // Blend textures adding colors (alternative) + RL_BLEND_SUBTRACT_COLORS, // Blend textures subtracting colors (alternative) + RL_BLEND_ALPHA_PREMULTIPLY, // Blend premultiplied textures considering alpha + RL_BLEND_CUSTOM // Blend textures using custom src/dst factors (use rlSetBlendFactors()) +} rlBlendMode; + +// Shader location point type +typedef enum { + RL_SHADER_LOC_VERTEX_POSITION = 0, // Shader location: vertex attribute: position + RL_SHADER_LOC_VERTEX_TEXCOORD01, // Shader location: vertex attribute: texcoord01 + RL_SHADER_LOC_VERTEX_TEXCOORD02, // Shader location: vertex attribute: texcoord02 + RL_SHADER_LOC_VERTEX_NORMAL, // Shader location: vertex attribute: normal + RL_SHADER_LOC_VERTEX_TANGENT, // Shader location: vertex attribute: tangent + RL_SHADER_LOC_VERTEX_COLOR, // Shader location: vertex attribute: color + RL_SHADER_LOC_MATRIX_MVP, // Shader location: matrix uniform: model-view-projection + RL_SHADER_LOC_MATRIX_VIEW, // Shader location: matrix uniform: view (camera transform) + RL_SHADER_LOC_MATRIX_PROJECTION, // Shader location: matrix uniform: projection + RL_SHADER_LOC_MATRIX_MODEL, // Shader location: matrix uniform: model (transform) + RL_SHADER_LOC_MATRIX_NORMAL, // Shader location: matrix uniform: normal + RL_SHADER_LOC_VECTOR_VIEW, // Shader location: vector uniform: view + RL_SHADER_LOC_COLOR_DIFFUSE, // Shader location: vector uniform: diffuse color + RL_SHADER_LOC_COLOR_SPECULAR, // Shader location: vector uniform: specular color + RL_SHADER_LOC_COLOR_AMBIENT, // Shader location: vector uniform: ambient color + RL_SHADER_LOC_MAP_ALBEDO, // Shader location: sampler2d texture: albedo (same as: RL_SHADER_LOC_MAP_DIFFUSE) + RL_SHADER_LOC_MAP_METALNESS, // Shader location: sampler2d texture: metalness (same as: RL_SHADER_LOC_MAP_SPECULAR) + RL_SHADER_LOC_MAP_NORMAL, // Shader location: sampler2d texture: normal + RL_SHADER_LOC_MAP_ROUGHNESS, // Shader location: sampler2d texture: roughness + RL_SHADER_LOC_MAP_OCCLUSION, // Shader location: sampler2d texture: occlusion + RL_SHADER_LOC_MAP_EMISSION, // Shader location: sampler2d texture: emission + RL_SHADER_LOC_MAP_HEIGHT, // Shader location: sampler2d texture: height + RL_SHADER_LOC_MAP_CUBEMAP, // Shader location: samplerCube texture: cubemap + RL_SHADER_LOC_MAP_IRRADIANCE, // Shader location: samplerCube texture: irradiance + RL_SHADER_LOC_MAP_PREFILTER, // Shader location: samplerCube texture: prefilter + RL_SHADER_LOC_MAP_BRDF // Shader location: sampler2d texture: brdf +} rlShaderLocationIndex; + +#define RL_SHADER_LOC_MAP_DIFFUSE RL_SHADER_LOC_MAP_ALBEDO +#define RL_SHADER_LOC_MAP_SPECULAR RL_SHADER_LOC_MAP_METALNESS + +// Shader uniform data type +typedef enum { + RL_SHADER_UNIFORM_FLOAT = 0, // Shader uniform type: float + RL_SHADER_UNIFORM_VEC2, // Shader uniform type: vec2 (2 float) + RL_SHADER_UNIFORM_VEC3, // Shader uniform type: vec3 (3 float) + RL_SHADER_UNIFORM_VEC4, // Shader uniform type: vec4 (4 float) + RL_SHADER_UNIFORM_INT, // Shader uniform type: int + 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_SAMPLER2D // Shader uniform type: sampler2d +} rlShaderUniformDataType; + +// Shader attribute data types +typedef enum { + RL_SHADER_ATTRIB_FLOAT = 0, // Shader attribute type: float + RL_SHADER_ATTRIB_VEC2, // Shader attribute type: vec2 (2 float) + RL_SHADER_ATTRIB_VEC3, // Shader attribute type: vec3 (3 float) + RL_SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float) +} rlShaderAttributeDataType; + +//------------------------------------------------------------------------------------ +// Functions Declaration - Matrix operations +//------------------------------------------------------------------------------------ + +#if defined(__cplusplus) +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 lattest 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(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 + +//------------------------------------------------------------------------------------ +// 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 rlColor4f(float x, float y, float z, float w); // Define one vertex (color) - 4 float + +//------------------------------------------------------------------------------------ +// Functions Declaration - OpenGL style functions (common to 1.1, 3.3+, ES2) +// NOTE: This functions are used to completely abstract raylib code from OpenGL layer, +// some of them are direct wrappers over OpenGL calls, some others are custom +//------------------------------------------------------------------------------------ + +// Vertex buffers state +RLAPI bool rlEnableVertexArray(unsigned int vaoId); // Enable vertex array (VAO, if supported) +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 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 +#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 +#endif + +// Textures state +RLAPI void rlActiveTextureSlot(int slot); // Select and active a texture slot +RLAPI void rlEnableTexture(unsigned int id); // Enable texture +RLAPI void rlDisableTexture(void); // Disable texture +RLAPI void rlEnableTextureCubemap(unsigned int id); // Enable texture cubemap +RLAPI void rlDisableTextureCubemap(void); // Disable texture cubemap +RLAPI void rlTextureParameters(unsigned int id, int param, int value); // Set texture parameters (filter, wrap) + +// Shader state +RLAPI void rlEnableShader(unsigned int id); // Enable shader program +RLAPI void rlDisableShader(void); // Disable shader program + +// 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 void rlActiveDrawBuffers(int count); // Activate multiple draw color buffers + +// General render state +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 +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 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 rlSetLineWidth(float width); // Set the line drawing width +RLAPI float rlGetLineWidth(void); // Get the line drawing width +RLAPI void rlEnableSmoothLines(void); // Enable line aliasing +RLAPI void rlDisableSmoothLines(void); // Disable line aliasing +RLAPI void rlEnableStereoRender(void); // Enable stereo rendering +RLAPI void rlDisableStereoRender(void); // Disable stereo rendering +RLAPI bool rlIsStereoRenderEnabled(void); // Check if stereo render is enabled + +RLAPI void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a); // Clear color buffer with color +RLAPI void rlClearScreenBuffers(void); // Clear used screen buffers (color and depth) +RLAPI void rlCheckErrors(void); // Check and log OpenGL error codes +RLAPI void rlSetBlendMode(int mode); // Set blending mode +RLAPI void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation); // Set blending mode factor and equation (using OpenGL factors) + +//------------------------------------------------------------------------------------ +// Functions Declaration - rlgl functionality +//------------------------------------------------------------------------------------ +// rlgl initialization functions +RLAPI void rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states) +RLAPI void rlglClose(void); // De-inititialize rlgl (buffers, shaders, textures) +RLAPI void rlLoadExtensions(void *loader); // Load OpenGL extensions (loader function required) +RLAPI int rlGetVersion(void); // Get current OpenGL version +RLAPI void rlSetFramebufferWidth(int width); // Set current framebuffer width +RLAPI int rlGetFramebufferWidth(void); // Get default framebuffer width +RLAPI void rlSetFramebufferHeight(int height); // Set current framebuffer height +RLAPI int rlGetFramebufferHeight(void); // Get default framebuffer height + +RLAPI unsigned int rlGetTextureIdDefault(void); // Get default texture id +RLAPI unsigned int rlGetShaderIdDefault(void); // Get default shader id +RLAPI int *rlGetShaderLocsDefault(void); // Get default shader locations + +// Render batch management +// NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode +// but this render batch API is exposed in case of custom batches are required +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); + +// 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 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 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 bool rlFramebufferComplete(unsigned int id); // Verify framebuffer is complete +RLAPI void rlUnloadFramebuffer(unsigned int id); // Delete framebuffer from GPU + +// Shaders management +RLAPI unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode); // Load shader from code strings +RLAPI unsigned int rlCompileShader(const char *shaderCode, int type); // Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER) +RLAPI unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fShaderId); // Load custom shader program +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 rlSetUniformMatrix(int locIndex, Matrix mat); // Set shader value matrix +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 pilepine) + +// Shader buffer storage object management (ssbo) +RLAPI unsigned int rlLoadShaderBuffer(unsigned long long size, const void *data, int usageHint); // Load shader storage buffer object (SSBO) +RLAPI void rlUnloadShaderBuffer(unsigned int ssboId); // Unload shader storage buffer object (SSBO) +RLAPI void rlUpdateShaderBufferElements(unsigned int id, const void *data, unsigned long long dataSize, unsigned long long offset); // Update SSBO buffer data +RLAPI unsigned long long rlGetShaderBufferSize(unsigned int id); // Get SSBO buffer size +RLAPI void rlReadShaderBufferElements(unsigned int id, void *dest, unsigned long long count, unsigned long long offset); // Bind SSBO buffer +RLAPI void rlBindShaderBuffer(unsigned int id, unsigned int index); // Copy SSBO buffer data + +// Buffer management +RLAPI void rlCopyBuffersElements(unsigned int destId, unsigned int srcId, unsigned long long destOffset, unsigned long long srcOffset, unsigned long long count); // Copy SSBO buffer data +RLAPI void rlBindImageTexture(unsigned int id, unsigned int index, unsigned int format, int readonly); // Bind image texture + +// Matrix state management +RLAPI Matrix rlGetMatrixModelview(void); // Get internal modelview matrix +RLAPI Matrix rlGetMatrixProjection(void); // Get internal projection matrix +RLAPI Matrix rlGetMatrixTransform(void); // Get internal accumulated transform matrix +RLAPI Matrix rlGetMatrixProjectionStereo(int eye); // Get internal projection matrix for stereo render (selected eye) +RLAPI Matrix rlGetMatrixViewOffsetStereo(int eye); // Get internal view offset matrix for stereo render (selected eye) +RLAPI void rlSetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix) +RLAPI void rlSetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix) +RLAPI void rlSetMatrixProjectionStereo(Matrix right, Matrix left); // Set eyes projection matrices for stereo rendering +RLAPI void rlSetMatrixViewOffsetStereo(Matrix right, Matrix left); // Set eyes view offsets matrices for stereo rendering + +// Quick and dirty cube/quad buffers load->draw->unload +RLAPI void rlLoadDrawCube(void); // Load and draw a cube +RLAPI void rlLoadDrawQuad(void); // Load and draw a quad + +#if defined(__cplusplus) +} +#endif + +#endif // RLGL_H + +/*********************************************************************************** +* +* RLGL IMPLEMENTATION +* +************************************************************************************/ + +#if defined(RLGL_IMPLEMENTATION) + +#if defined(GRAPHICS_API_OPENGL_11) + #if defined(__APPLE__) + #include // OpenGL 1.1 library for OSX + #include // OpenGL extensions library + #else + // APIENTRY for OpenGL function pointer declarations is required + #if !defined(APIENTRY) + #if defined(_WIN32) + #define APIENTRY __stdcall + #else + #define APIENTRY + #endif + #endif + // WINGDIAPI definition. Some Windows OpenGL headers need it + #if !defined(WINGDIAPI) && defined(_WIN32) + #define WINGDIAPI __declspec(dllimport) + #endif + + #include // OpenGL 1.1 library + #endif +#endif + +#if defined(GRAPHICS_API_OPENGL_33) + #if defined(__APPLE__) + #include // OpenGL 3 library for OSX + #include // OpenGL 3 extensions library for OSX + #else + #define GLAD_MALLOC RL_MALLOC + #define GLAD_FREE RL_FREE + + #define GLAD_GL_IMPLEMENTATION + #include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers + #endif +#endif + +#if defined(GRAPHICS_API_OPENGL_ES2) + #define GL_GLEXT_PROTOTYPES + //#include // EGL library -> not required, platform layer + #include // OpenGL ES 2.0 library + #include // OpenGL ES 2.0 extensions library + + // 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) + 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); + #endif +#endif + +#include // Required for: malloc(), free() +#include // Required for: strcmp(), strlen() [Used in rlglInit(), on extensions loading] +#include // Required for: sqrtf(), sinf(), cosf(), floor(), log() + +//---------------------------------------------------------------------------------- +// Defines and Macros +//---------------------------------------------------------------------------------- +#ifndef PI + #define PI 3.14159265358979323846f +#endif +#ifndef DEG2RAD + #define DEG2RAD (PI/180.0f) +#endif +#ifndef RAD2DEG + #define RAD2DEG (180.0f/PI) +#endif + +#ifndef GL_SHADING_LANGUAGE_VERSION + #define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#endif + +#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT + #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT + #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT + #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#endif +#ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT + #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif +#ifndef GL_ETC1_RGB8_OES + #define GL_ETC1_RGB8_OES 0x8D64 +#endif +#ifndef GL_COMPRESSED_RGB8_ETC2 + #define GL_COMPRESSED_RGB8_ETC2 0x9274 +#endif +#ifndef GL_COMPRESSED_RGBA8_ETC2_EAC + #define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#endif +#ifndef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG + #define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#endif +#ifndef GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG + #define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#endif +#ifndef GL_COMPRESSED_RGBA_ASTC_4x4_KHR + #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93b0 +#endif +#ifndef GL_COMPRESSED_RGBA_ASTC_8x8_KHR + #define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93b7 +#endif + +#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT + #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif +#ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT + #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#endif + +#if defined(GRAPHICS_API_OPENGL_11) + #define GL_UNSIGNED_SHORT_5_6_5 0x8363 + #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 + #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#endif + +#if defined(GRAPHICS_API_OPENGL_21) + #define GL_LUMINANCE 0x1909 + #define GL_LUMINANCE_ALPHA 0x190A +#endif + +#if defined(GRAPHICS_API_OPENGL_ES2) + #define glClearDepth glClearDepthf + #define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER + #define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER +#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" // Binded by default to shader location: 0 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Binded by default to shader location: 1 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL + #define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Binded by default to shader location: 2 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR + #define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Binded by default to shader location: 3 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Binded by default to shader location: 4 +#endif +#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 + #define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Binded by default to shader location: 5 +#endif + +#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MVP + #define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix +#endif +#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW + #define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix +#endif +#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION + #define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix +#endif +#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL + #define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix +#endif +#ifndef RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL + #define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView)) +#endif +#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_SAMPLER2D_NAME_TEXTURE0 + #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0) +#endif +#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 + #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1) +#endif +#ifndef RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 + #define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2) +#endif + +//---------------------------------------------------------------------------------- +// Types and Structures Definition +//---------------------------------------------------------------------------------- +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +typedef struct rlglData { + rlRenderBatch *currentBatch; // Current render batch + rlRenderBatch defaultBatch; // Default internal render batch + + struct { + int vertexCounter; // Current active render batch vertex counter (generic, used for all batches) + float texcoordx, texcoordy; // Current active texture coordinate (added on glVertex*()) + float normalx, normaly, normalz; // Current active normal (added on glVertex*()) + unsigned char colorr, colorg, colorb, colora; // Current active color (added on glVertex*()) + + int currentMatrixMode; // Current matrix mode + Matrix *currentMatrix; // Current matrix pointer + Matrix modelview; // Default modelview matrix + Matrix projection; // Default projection matrix + Matrix transform; // Transform matrix to be used with rlTranslate, rlRotate, rlScale + bool transformRequired; // Require transform matrix application to current draw-call vertex (if required) + Matrix stack[RL_MAX_MATRIX_STACK_SIZE];// Matrix stack for push/pop + int stackCounter; // Matrix stack counter + + unsigned int defaultTextureId; // Default texture used on shapes/poly drawing (required by shader) + unsigned int activeTextureId[RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS]; // Active texture ids to be enabled on batch drawing (0 active by default) + unsigned int defaultVShaderId; // Default vertex shader id (used by default shader program) + unsigned int defaultFShaderId; // Default fragment shader id (used by default shader program) + unsigned int defaultShaderId; // Default shader program id, supports vertex color and diffuse texture + int *defaultShaderLocs; // Default shader locations pointer to be used on rendering + unsigned int currentShaderId; // Current shader id to be used on rendering (by default, defaultShaderId) + int *currentShaderLocs; // Current shader locations pointer to be used on rendering (by default, defaultShaderLocs) + + bool stereoRender; // Stereo rendering flag + Matrix projectionStereo[2]; // VR stereo rendering eyes projection matrices + Matrix viewOffsetStereo[2]; // VR stereo rendering eyes view offset matrices + + int currentBlendMode; // Blending mode active + int glBlendSrcFactor; // Blending source factor + int glBlendDstFactor; // Blending destination factor + int glBlendEquation; // Blending equation + + int framebufferWidth; // Current framebuffer width + int framebufferHeight; // Current framebuffer height + + } State; // Renderer state + struct { + bool vao; // VAO support (OpenGL ES2 could not support VAO extension) (GL_ARB_vertex_array_object) + bool instancing; // Instancing supported (GL_ANGLE_instanced_arrays, GL_EXT_draw_instanced + GL_EXT_instanced_arrays) + bool texNPOT; // NPOT textures full support (GL_ARB_texture_non_power_of_two, GL_OES_texture_npot) + bool texDepth; // Depth textures supported (GL_ARB_depth_texture, GL_WEBGL_depth_texture, GL_OES_depth_texture) + bool texFloat32; // float textures support (32 bit per channel) (GL_OES_texture_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) + bool texCompPVRT; // PVR texture compression support (GL_IMG_texture_compression_pvrtc) + bool texCompASTC; // ASTC texture compression support (GL_KHR_texture_compression_astc_hdr, GL_KHR_texture_compression_astc_ldr) + bool texMirrorClamp; // Clamp mirror wrap mode supported (GL_EXT_texture_mirror_clamp) + bool texAnisoFilter; // Anisotropic texture filtering support (GL_EXT_texture_filter_anisotropic) + bool computeShader; // Compute shaders support (GL_ARB_compute_shader) + bool ssbo; // Shader storage buffer object support (GL_ARB_shader_storage_buffer_object) + + float maxAnisotropyLevel; // Maximum anisotropy level supported (minimum is 2.0f) + int maxDepthBits; // Maximum bits for depth component + + } ExtSupported; // Extensions supported flags +} rlglData; + +typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions loader signature (same as GLADloadproc) + +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 + +//---------------------------------------------------------------------------------- +// Global Variables Definition +//---------------------------------------------------------------------------------- +#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) +// NOTE: VAO functionality is exposed through extensions (OES) +static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL; +static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL; +static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = NULL; + +// NOTE: Instancing functionality could also be available through extension +static PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstanced = NULL; +static PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstanced = NULL; +static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL; +#endif + +//---------------------------------------------------------------------------------- +// Module specific Functions Declaration +//---------------------------------------------------------------------------------- +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +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 +#endif // RLGL_SHOW_GL_DETAILS_INFO +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 +#if defined(GRAPHICS_API_OPENGL_11) +static int rlGenTextureMipmapsData(unsigned char *data, int baseWidth, int baseHeight); // Generate mipmaps data on CPU side +static unsigned char *rlGenNextMipmapData(unsigned char *srcData, int srcWidth, int srcHeight); // Generate next mipmap level on CPU side +#endif +static int rlGetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes (image or texture) +// Auxiliar matrix math functions +static Matrix rlMatrixIdentity(void); // Get identity matrix +static Matrix rlMatrixMultiply(Matrix left, Matrix right); // Multiply two matrices + +//---------------------------------------------------------------------------------- +// Module Functions Definition - Matrix operations +//---------------------------------------------------------------------------------- + +#if defined(GRAPHICS_API_OPENGL_11) +// Fallback to OpenGL 1.1 function calls +//--------------------------------------- +void rlMatrixMode(int mode) +{ + switch (mode) + { + case RL_PROJECTION: glMatrixMode(GL_PROJECTION); break; + case RL_MODELVIEW: glMatrixMode(GL_MODELVIEW); break; + case RL_TEXTURE: glMatrixMode(GL_TEXTURE); break; + default: break; + } +} + +void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar) +{ + glFrustum(left, right, bottom, top, znear, zfar); +} + +void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar) +{ + glOrtho(left, right, bottom, top, znear, zfar); +} + +void rlPushMatrix(void) { glPushMatrix(); } +void rlPopMatrix(void) { glPopMatrix(); } +void rlLoadIdentity(void) { glLoadIdentity(); } +void rlTranslatef(float x, float y, float z) { glTranslatef(x, y, z); } +void rlRotatef(float angle, float x, float y, float z) { glRotatef(angle, x, y, z); } +void rlScalef(float x, float y, float z) { glScalef(x, y, z); } +void rlMultMatrixf(float *matf) { glMultMatrixf(matf); } +#endif +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +// Choose the current matrix to be transformed +void rlMatrixMode(int mode) +{ + if (mode == RL_PROJECTION) RLGL.State.currentMatrix = &RLGL.State.projection; + else if (mode == RL_MODELVIEW) RLGL.State.currentMatrix = &RLGL.State.modelview; + //else if (mode == RL_TEXTURE) // Not supported + + RLGL.State.currentMatrixMode = mode; +} + +// Push the current matrix into RLGL.State.stack +void rlPushMatrix(void) +{ + if (RLGL.State.stackCounter >= RL_MAX_MATRIX_STACK_SIZE) TRACELOG(RL_LOG_ERROR, "RLGL: Matrix stack overflow (RL_MAX_MATRIX_STACK_SIZE)"); + + if (RLGL.State.currentMatrixMode == RL_MODELVIEW) + { + RLGL.State.transformRequired = true; + RLGL.State.currentMatrix = &RLGL.State.transform; + } + + RLGL.State.stack[RLGL.State.stackCounter] = *RLGL.State.currentMatrix; + RLGL.State.stackCounter++; +} + +// Pop lattest inserted matrix from RLGL.State.stack +void rlPopMatrix(void) +{ + if (RLGL.State.stackCounter > 0) + { + Matrix mat = RLGL.State.stack[RLGL.State.stackCounter - 1]; + *RLGL.State.currentMatrix = mat; + RLGL.State.stackCounter--; + } + + if ((RLGL.State.stackCounter == 0) && (RLGL.State.currentMatrixMode == RL_MODELVIEW)) + { + RLGL.State.currentMatrix = &RLGL.State.modelview; + RLGL.State.transformRequired = false; + } +} + +// Reset current matrix to identity matrix +void rlLoadIdentity(void) +{ + *RLGL.State.currentMatrix = rlMatrixIdentity(); +} + +// Multiply the current matrix by a translation matrix +void rlTranslatef(float x, float y, float z) +{ + Matrix matTranslation = { + 1.0f, 0.0f, 0.0f, x, + 0.0f, 1.0f, 0.0f, y, + 0.0f, 0.0f, 1.0f, z, + 0.0f, 0.0f, 0.0f, 1.0f + }; + + // NOTE: We transpose matrix with multiplication order + *RLGL.State.currentMatrix = rlMatrixMultiply(matTranslation, *RLGL.State.currentMatrix); +} + +// Multiply the current matrix by a rotation matrix +// NOTE: The provided angle must be in degrees +void rlRotatef(float angle, float x, float y, float z) +{ + Matrix matRotation = rlMatrixIdentity(); + + // Axis vector (x, y, z) normalization + float lengthSquared = x*x + y*y + z*z; + if ((lengthSquared != 1.0f) && (lengthSquared != 0.0f)) + { + float inverseLength = 1.0f/sqrtf(lengthSquared); + x *= inverseLength; + y *= inverseLength; + z *= inverseLength; + } + + // Rotation matrix generation + float sinres = sinf(DEG2RAD*angle); + float cosres = cosf(DEG2RAD*angle); + float t = 1.0f - cosres; + + matRotation.m0 = x*x*t + cosres; + matRotation.m1 = y*x*t + z*sinres; + matRotation.m2 = z*x*t - y*sinres; + matRotation.m3 = 0.0f; + + matRotation.m4 = x*y*t - z*sinres; + matRotation.m5 = y*y*t + cosres; + matRotation.m6 = z*y*t + x*sinres; + matRotation.m7 = 0.0f; + + matRotation.m8 = x*z*t + y*sinres; + matRotation.m9 = y*z*t - x*sinres; + matRotation.m10 = z*z*t + cosres; + matRotation.m11 = 0.0f; + + matRotation.m12 = 0.0f; + matRotation.m13 = 0.0f; + matRotation.m14 = 0.0f; + matRotation.m15 = 1.0f; + + // NOTE: We transpose matrix with multiplication order + *RLGL.State.currentMatrix = rlMatrixMultiply(matRotation, *RLGL.State.currentMatrix); +} + +// Multiply the current matrix by a scaling matrix +void rlScalef(float x, float y, float z) +{ + Matrix matScale = { + x, 0.0f, 0.0f, 0.0f, + 0.0f, y, 0.0f, 0.0f, + 0.0f, 0.0f, z, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }; + + // NOTE: We transpose matrix with multiplication order + *RLGL.State.currentMatrix = rlMatrixMultiply(matScale, *RLGL.State.currentMatrix); +} + +// Multiply the current matrix by another matrix +void rlMultMatrixf(float *matf) +{ + // Matrix creation from array + Matrix mat = { matf[0], matf[4], matf[8], matf[12], + matf[1], matf[5], matf[9], matf[13], + matf[2], matf[6], matf[10], matf[14], + matf[3], matf[7], matf[11], matf[15] }; + + *RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, mat); +} + +// Multiply the current matrix by a perspective matrix generated by parameters +void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar) +{ + Matrix matFrustum = { 0 }; + + float rl = (float)(right - left); + float tb = (float)(top - bottom); + float fn = (float)(zfar - znear); + + matFrustum.m0 = ((float) znear*2.0f)/rl; + matFrustum.m1 = 0.0f; + matFrustum.m2 = 0.0f; + matFrustum.m3 = 0.0f; + + matFrustum.m4 = 0.0f; + matFrustum.m5 = ((float) znear*2.0f)/tb; + matFrustum.m6 = 0.0f; + matFrustum.m7 = 0.0f; + + matFrustum.m8 = ((float)right + (float)left)/rl; + matFrustum.m9 = ((float)top + (float)bottom)/tb; + matFrustum.m10 = -((float)zfar + (float)znear)/fn; + matFrustum.m11 = -1.0f; + + matFrustum.m12 = 0.0f; + matFrustum.m13 = 0.0f; + matFrustum.m14 = -((float)zfar*(float)znear*2.0f)/fn; + matFrustum.m15 = 0.0f; + + *RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, matFrustum); +} + +// Multiply the current matrix by an orthographic matrix generated by parameters +void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar) +{ + // NOTE: If left-right and top-botton values are equal it could create a division by zero, + // response to it is platform/compiler dependant + Matrix matOrtho = { 0 }; + + float rl = (float)(right - left); + float tb = (float)(top - bottom); + float fn = (float)(zfar - znear); + + matOrtho.m0 = 2.0f/rl; + matOrtho.m1 = 0.0f; + matOrtho.m2 = 0.0f; + matOrtho.m3 = 0.0f; + matOrtho.m4 = 0.0f; + matOrtho.m5 = 2.0f/tb; + matOrtho.m6 = 0.0f; + matOrtho.m7 = 0.0f; + matOrtho.m8 = 0.0f; + matOrtho.m9 = 0.0f; + matOrtho.m10 = -2.0f/fn; + matOrtho.m11 = 0.0f; + matOrtho.m12 = -((float)left + (float)right)/rl; + matOrtho.m13 = -((float)top + (float)bottom)/tb; + matOrtho.m14 = -((float)zfar + (float)znear)/fn; + matOrtho.m15 = 1.0f; + + *RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, matOrtho); +} +#endif + +// Set the viewport area (transformation from normalized device coordinates to window coordinates) +// NOTE: We store current viewport dimensions +void rlViewport(int x, int y, int width, int height) +{ + glViewport(x, y, width, height); +} + +//---------------------------------------------------------------------------------- +// Module Functions Definition - Vertex level operations +//---------------------------------------------------------------------------------- +#if defined(GRAPHICS_API_OPENGL_11) +// Fallback to OpenGL 1.1 function calls +//--------------------------------------- +void rlBegin(int mode) +{ + switch (mode) + { + case RL_LINES: glBegin(GL_LINES); break; + case RL_TRIANGLES: glBegin(GL_TRIANGLES); break; + case RL_QUADS: glBegin(GL_QUADS); break; + default: break; + } +} + +void rlEnd() { 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); } +void rlTexCoord2f(float x, float y) { glTexCoord2f(x, y); } +void rlNormal3f(float x, float y, float z) { glNormal3f(x, y, z); } +void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { glColor4ub(r, g, b, a); } +void rlColor3f(float x, float y, float z) { glColor3f(x, y, z); } +void rlColor4f(float x, float y, float z, float w) { glColor4f(x, y, z, w); } +#endif +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +// Initialize drawing mode (how to organize vertex) +void rlBegin(int mode) +{ + // Draw mode can be RL_LINES, RL_TRIANGLES and RL_QUADS + // NOTE: In all three cases, vertex are accumulated over default internal vertex buffer + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode != mode) + { + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0) + { + // Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4, + // that way, following QUADS drawing will keep aligned with index processing + // It implies adding some extra alignment vertex at the end of the draw, + // those vertex are not processed but they are considered as an additional offset + // for the next set of vertex to be drawn + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4); + else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4))); + else RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = 0; + + if (!rlCheckRenderBatchLimit(RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment)) + { + RLGL.State.vertexCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment; + RLGL.currentBatch->drawCounter++; + } + } + + if (RLGL.currentBatch->drawCounter >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch); + + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = mode; + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount = 0; + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = RLGL.State.defaultTextureId; + } +} + +// Finish vertex providing +void rlEnd(void) +{ + // NOTE: Depth increment is dependant on rlOrtho(): z-near and z-far values, + // as well as depth buffer bit-depth (16bit or 24bit or 32bit) + // Correct increment formula would be: depthInc = (zfar - znear)/pow(2, bits) + RLGL.currentBatch->currentDepth += (1.0f/20000.0f); + + // Verify internal buffers limits + // NOTE: This check is combined with usage of rlCheckRenderBatchLimit() + if (RLGL.State.vertexCounter >= (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4 - 4)) + { + // WARNING: If we are between rlPushMatrix() and rlPopMatrix() and we need to force a rlDrawRenderBatch(), + // we need to call rlPopMatrix() before to recover *RLGL.State.currentMatrix (RLGL.State.modelview) for the next forced draw call! + // If we have multiple matrix pushed, it will require "RLGL.State.stackCounter" pops before launching the draw + for (int i = RLGL.State.stackCounter; i >= 0; i--) rlPopMatrix(); + rlDrawRenderBatch(RLGL.currentBatch); + } +} + +// Define one vertex (position) +// NOTE: Vertex position data is the basic information required for drawing +void rlVertex3f(float x, float y, float z) +{ + float tx = x; + float ty = y; + float tz = z; + + // Transform provided vector if required + if (RLGL.State.transformRequired) + { + tx = RLGL.State.transform.m0*x + RLGL.State.transform.m4*y + RLGL.State.transform.m8*z + RLGL.State.transform.m12; + ty = RLGL.State.transform.m1*x + RLGL.State.transform.m5*y + RLGL.State.transform.m9*z + RLGL.State.transform.m13; + tz = RLGL.State.transform.m2*x + RLGL.State.transform.m6*y + RLGL.State.transform.m10*z + RLGL.State.transform.m14; + } + + // Verify that current vertex buffer elements limit has not been reached + if (RLGL.State.vertexCounter < (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4)) + { + // Add vertices + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.State.vertexCounter] = tx; + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.State.vertexCounter + 1] = ty; + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.State.vertexCounter + 2] = tz; + + // Add current texcoord + 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 color + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter] = RLGL.State.colorr; + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter + 1] = RLGL.State.colorg; + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter + 2] = RLGL.State.colorb; + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter + 3] = RLGL.State.colora; + + RLGL.State.vertexCounter++; + + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount++; + } + else TRACELOG(RL_LOG_ERROR, "RLGL: Batch elements overflow"); +} + +// Define one vertex (position) +void rlVertex2f(float x, float y) +{ + rlVertex3f(x, y, RLGL.currentBatch->currentDepth); +} + +// Define one vertex (position) +void rlVertex2i(int x, int y) +{ + rlVertex3f((float)x, (float)y, RLGL.currentBatch->currentDepth); +} + +// Define one vertex (texture coordinate) +// NOTE: Texture coordinates are limited to QUADS only +void rlTexCoord2f(float x, float y) +{ + RLGL.State.texcoordx = x; + RLGL.State.texcoordy = y; +} + +// Define one vertex (normal) +// 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; +} + +// Define one vertex (color) +void rlColor4ub(unsigned char x, unsigned char y, unsigned char z, unsigned char w) +{ + RLGL.State.colorr = x; + RLGL.State.colorg = y; + RLGL.State.colorb = z; + RLGL.State.colora = w; +} + +// Define one vertex (color) +void rlColor4f(float r, float g, float b, float a) +{ + rlColor4ub((unsigned char)(r*255), (unsigned char)(g*255), (unsigned char)(b*255), (unsigned char)(a*255)); +} + +// Define one vertex (color) +void rlColor3f(float x, float y, float z) +{ + rlColor4ub((unsigned char)(x*255), (unsigned char)(y*255), (unsigned char)(z*255), 255); +} + +#endif + +//-------------------------------------------------------------------------------------- +// Module Functions Definition - OpenGL style functions (common to 1.1, 3.3+, ES2) +//-------------------------------------------------------------------------------------- + +// Set current texture to use +void rlSetTexture(unsigned int id) +{ + if (id == 0) + { +#if defined(GRAPHICS_API_OPENGL_11) + rlDisableTexture(); +#else + // NOTE: If quads batch limit is reached, we force a draw call and next batch starts + if (RLGL.State.vertexCounter >= + RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4) + { + rlDrawRenderBatch(RLGL.currentBatch); + } +#endif + } + else + { +#if defined(GRAPHICS_API_OPENGL_11) + rlEnableTexture(id); +#else + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId != id) + { + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0) + { + // Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4, + // that way, following QUADS drawing will keep aligned with index processing + // It implies adding some extra alignment vertex at the end of the draw, + // those vertex are not processed but they are considered as an additional offset + // for the next set of vertex to be drawn + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4); + else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4))); + else RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = 0; + + if (!rlCheckRenderBatchLimit(RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment)) + { + RLGL.State.vertexCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment; + + RLGL.currentBatch->drawCounter++; + } + } + + if (RLGL.currentBatch->drawCounter >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch); + + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = id; + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount = 0; + } +#endif + } +} + +// Select and active a texture slot +void rlActiveTextureSlot(int slot) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glActiveTexture(GL_TEXTURE0 + slot); +#endif +} + +// Enable texture +void rlEnableTexture(unsigned int id) +{ +#if defined(GRAPHICS_API_OPENGL_11) + glEnable(GL_TEXTURE_2D); +#endif + glBindTexture(GL_TEXTURE_2D, id); +} + +// Disable texture +void rlDisableTexture(void) +{ +#if defined(GRAPHICS_API_OPENGL_11) + glDisable(GL_TEXTURE_2D); +#endif + glBindTexture(GL_TEXTURE_2D, 0); +} + +// Enable texture cubemap +void rlEnableTextureCubemap(unsigned int id) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glBindTexture(GL_TEXTURE_CUBE_MAP, id); +#endif +} + +// Disable texture cubemap +void rlDisableTextureCubemap(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glBindTexture(GL_TEXTURE_CUBE_MAP, 0); +#endif +} + +// Set texture parameters (wrap mode/filter mode) +void rlTextureParameters(unsigned int id, int param, int value) +{ + glBindTexture(GL_TEXTURE_2D, id); + +#if !defined(GRAPHICS_API_OPENGL_11) + // Reset anisotropy filter, in case it was set + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f); +#endif + + switch (param) + { + case RL_TEXTURE_WRAP_S: + case RL_TEXTURE_WRAP_T: + { + if (value == RL_TEXTURE_WRAP_MIRROR_CLAMP) + { +#if !defined(GRAPHICS_API_OPENGL_11) + if (RLGL.ExtSupported.texMirrorClamp) glTexParameteri(GL_TEXTURE_2D, param, value); + else TRACELOG(RL_LOG_WARNING, "GL: Clamp mirror wrap mode not supported (GL_MIRROR_CLAMP_EXT)"); +#endif + } + else glTexParameteri(GL_TEXTURE_2D, param, value); + + } break; + case RL_TEXTURE_MAG_FILTER: + case RL_TEXTURE_MIN_FILTER: glTexParameteri(GL_TEXTURE_2D, param, value); break; + case RL_TEXTURE_FILTER_ANISOTROPIC: + { +#if !defined(GRAPHICS_API_OPENGL_11) + if (value <= RLGL.ExtSupported.maxAnisotropyLevel) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value); + else if (RLGL.ExtSupported.maxAnisotropyLevel > 0.0f) + { + TRACELOG(RL_LOG_WARNING, "GL: Maximum anisotropic filter level supported is %iX", id, (int)RLGL.ExtSupported.maxAnisotropyLevel); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value); + } + else TRACELOG(RL_LOG_WARNING, "GL: Anisotropic filtering not supported"); +#endif + } break; + default: break; + } + + glBindTexture(GL_TEXTURE_2D, 0); +} + +// Enable shader program +void rlEnableShader(unsigned int id) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) + glUseProgram(id); +#endif +} + +// Disable shader program +void rlDisableShader(void) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) + glUseProgram(0); +#endif +} + +// Enable rendering to texture (fbo) +void rlEnableFramebuffer(unsigned int id) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(RLGL_RENDER_TEXTURES_HINT) + glBindFramebuffer(GL_FRAMEBUFFER, id); +#endif +} + +// Disable rendering to texture +void rlDisableFramebuffer(void) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(RLGL_RENDER_TEXTURES_HINT) + glBindFramebuffer(GL_FRAMEBUFFER, 0); +#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)) + // 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; + //glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers); + + if (count > 0) + { + if (count > 8) TRACELOG(LOG_WARNING, "GL: Max color buffers limited to 8"); + else + { + unsigned int buffers[8] = { + GL_COLOR_ATTACHMENT0, + GL_COLOR_ATTACHMENT1, + GL_COLOR_ATTACHMENT2, + GL_COLOR_ATTACHMENT3, + GL_COLOR_ATTACHMENT4, + GL_COLOR_ATTACHMENT5, + GL_COLOR_ATTACHMENT6, + GL_COLOR_ATTACHMENT7, + }; + + glDrawBuffers(count, buffers); + } + } + else TRACELOG(LOG_WARNING, "GL: One color buffer active by default"); +#endif +} + +//---------------------------------------------------------------------------------- +// General render state configuration +//---------------------------------------------------------------------------------- + +// Enable color blending +void rlEnableColorBlend(void) { glEnable(GL_BLEND); } + +// Disable color blending +void rlDisableColorBlend(void) { glDisable(GL_BLEND); } + +// Enable depth test +void rlEnableDepthTest(void) { glEnable(GL_DEPTH_TEST); } + +// Disable depth test +void rlDisableDepthTest(void) { glDisable(GL_DEPTH_TEST); } + +// Enable depth write +void rlEnableDepthMask(void) { glDepthMask(GL_TRUE); } + +// Disable depth write +void rlDisableDepthMask(void) { glDepthMask(GL_FALSE); } + +// Enable backface culling +void rlEnableBackfaceCulling(void) { glEnable(GL_CULL_FACE); } + +// Disable backface culling +void rlDisableBackfaceCulling(void) { glDisable(GL_CULL_FACE); } + +// Enable scissor test +void rlEnableScissorTest(void) { glEnable(GL_SCISSOR_TEST); } + +// Disable scissor test +void rlDisableScissorTest(void) { glDisable(GL_SCISSOR_TEST); } + +// Scissor test +void rlScissor(int x, int y, int width, int height) { glScissor(x, y, width, height); } + +// Enable wire mode +void rlEnableWireMode(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_LINE); +#endif +} + +// Disable wire mode +void rlDisableWireMode(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_FILL); +#endif +} + +// Set the line drawing width +void rlSetLineWidth(float width) { glLineWidth(width); } + +// Get the line drawing width +float rlGetLineWidth(void) +{ + float width = 0; + glGetFloatv(GL_LINE_WIDTH, &width); + return width; +} + +// Enable line aliasing +void rlEnableSmoothLines(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_11) + glEnable(GL_LINE_SMOOTH); +#endif +} + +// Disable line aliasing +void rlDisableSmoothLines(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_11) + glDisable(GL_LINE_SMOOTH); +#endif +} + +// Enable stereo rendering +void rlEnableStereoRender(void) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) + RLGL.State.stereoRender = true; +#endif +} + +// Disable stereo rendering +void rlDisableStereoRender(void) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) + RLGL.State.stereoRender = false; +#endif +} + +// Check if stereo render is enabled +bool rlIsStereoRenderEnabled(void) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) + return RLGL.State.stereoRender; +#else + return false; +#endif +} + +// Clear color buffer with color +void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) +{ + // Color values clamp to 0.0f(0) and 1.0f(255) + float cr = (float)r/255; + float cg = (float)g/255; + float cb = (float)b/255; + float ca = (float)a/255; + + glClearColor(cr, cg, cb, ca); +} + +// Clear used screen buffers (color and depth) +void rlClearScreenBuffers(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear used buffers: Color and Depth (Depth is used for 3D) + //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // Stencil buffer not used... +} + +// Check and log OpenGL error codes +void rlCheckErrors() +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + int check = 1; + while (check) + { + const GLenum err = glGetError(); + switch (err) + { + case GL_NO_ERROR: check = 0; break; + case 0x0500: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_INVALID_ENUM"); break; + case 0x0501: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_INVALID_VALUE"); break; + case 0x0502: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_INVALID_OPERATION"); break; + case 0x0503: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_STACK_OVERFLOW"); break; + case 0x0504: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_STACK_UNDERFLOW"); break; + case 0x0505: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_OUT_OF_MEMORY"); break; + case 0x0506: TRACELOG(RL_LOG_WARNING, "GL: Error detected: GL_INVALID_FRAMEBUFFER_OPERATION"); break; + default: TRACELOG(RL_LOG_WARNING, "GL: Error detected: Unknown error code: %x", err); break; + } + } +#endif +} + +// Set blend mode +void rlSetBlendMode(int mode) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if (RLGL.State.currentBlendMode != mode) + { + rlDrawRenderBatch(RLGL.currentBatch); + + switch (mode) + { + case RL_BLEND_ALPHA: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); break; + case RL_BLEND_ADDITIVE: glBlendFunc(GL_SRC_ALPHA, GL_ONE); glBlendEquation(GL_FUNC_ADD); break; + case RL_BLEND_MULTIPLIED: glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); break; + case RL_BLEND_ADD_COLORS: glBlendFunc(GL_ONE, GL_ONE); glBlendEquation(GL_FUNC_ADD); break; + case RL_BLEND_SUBTRACT_COLORS: glBlendFunc(GL_ONE, GL_ONE); glBlendEquation(GL_FUNC_SUBTRACT); break; + case RL_BLEND_ALPHA_PREMULTIPLY: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); break; + case RL_BLEND_CUSTOM: + { + // NOTE: Using GL blend src/dst factors and GL equation configured with rlSetBlendFactors() + glBlendFunc(RLGL.State.glBlendSrcFactor, RLGL.State.glBlendDstFactor); glBlendEquation(RLGL.State.glBlendEquation); + } break; + default: break; + } + + RLGL.State.currentBlendMode = mode; + } +#endif +} + +// Set blending mode factor and equation +void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + RLGL.State.glBlendSrcFactor = glSrcFactor; + RLGL.State.glBlendDstFactor = glDstFactor; + RLGL.State.glBlendEquation = glEquation; +#endif +} + +//---------------------------------------------------------------------------------- +// Module Functions Definition - OpenGL Debug +//---------------------------------------------------------------------------------- +#if defined(RLGL_ENABLE_OPENGL_DEBUG_CONTEXT) && defined(GRAPHICS_API_OPENGL_43) +static void GLAPIENTRY rlDebugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam) +{ + // Ignore non-significant error/warning codes (NVidia drivers) + // NOTE: Here there are the details with a sample output: + // - #131169 - Framebuffer detailed info: The driver allocated storage for renderbuffer 2. (severity: low) + // - #131185 - Buffer detailed info: Buffer object 1 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_ENUM_88e4) + // will use VIDEO memory as the source for buffer object operations. (severity: low) + // - #131218 - Program/shader state performance warning: Vertex shader in program 7 is being recompiled based on GL state. (severity: medium) + // - #131204 - Texture state usage warning: The texture object (0) bound to texture image unit 0 does not have + // a defined base level and cannot be used for texture mapping. (severity: low) + if ((id == 131169) || (id == 131185) || (id == 131218) || (id == 131204)) return; + + const char *msgSource = NULL; + switch (source) + { + case GL_DEBUG_SOURCE_API: msgSource = "API"; break; + case GL_DEBUG_SOURCE_WINDOW_SYSTEM: msgSource = "WINDOW_SYSTEM"; break; + case GL_DEBUG_SOURCE_SHADER_COMPILER: msgSource = "SHADER_COMPILER"; break; + case GL_DEBUG_SOURCE_THIRD_PARTY: msgSource = "THIRD_PARTY"; break; + case GL_DEBUG_SOURCE_APPLICATION: msgSource = "APPLICATION"; break; + case GL_DEBUG_SOURCE_OTHER: msgSource = "OTHER"; break; + default: break; + } + + const char *msgType = NULL; + switch (type) + { + case GL_DEBUG_TYPE_ERROR: msgType = "ERROR"; break; + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: msgType = "DEPRECATED_BEHAVIOR"; break; + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: msgType = "UNDEFINED_BEHAVIOR"; break; + case GL_DEBUG_TYPE_PORTABILITY: msgType = "PORTABILITY"; break; + case GL_DEBUG_TYPE_PERFORMANCE: msgType = "PERFORMANCE"; break; + case GL_DEBUG_TYPE_MARKER: msgType = "MARKER"; break; + case GL_DEBUG_TYPE_PUSH_GROUP: msgType = "PUSH_GROUP"; break; + case GL_DEBUG_TYPE_POP_GROUP: msgType = "POP_GROUP"; break; + case GL_DEBUG_TYPE_OTHER: msgType = "OTHER"; break; + default: break; + } + + const char *msgSeverity = "DEFAULT"; + switch (severity) + { + case GL_DEBUG_SEVERITY_LOW: msgSeverity = "LOW"; break; + case GL_DEBUG_SEVERITY_MEDIUM: msgSeverity = "MEDIUM"; break; + case GL_DEBUG_SEVERITY_HIGH: msgSeverity = "HIGH"; break; + case GL_DEBUG_SEVERITY_NOTIFICATION: msgSeverity = "NOTIFICATION"; break; + default: break; + } + + TRACELOG(LOG_WARNING, "GL: OpenGL debug message: %s", message); + TRACELOG(LOG_WARNING, " > Type: %s", msgType); + TRACELOG(LOG_WARNING, " > Source = %s", msgSource); + TRACELOG(LOG_WARNING, " > Severity = %s", msgSeverity); +} +#endif + +//---------------------------------------------------------------------------------- +// Module Functions Definition - rlgl functionality +//---------------------------------------------------------------------------------- + +// Initialize rlgl: OpenGL extensions, default buffers/shaders/textures, OpenGL states +void rlglInit(int width, int height) +{ + // Enable OpenGL debug context if required +#if defined(RLGL_ENABLE_OPENGL_DEBUG_CONTEXT) && defined(GRAPHICS_API_OPENGL_43) + 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 + + // Debug context options: + // - GL_DEBUG_OUTPUT - Faster version but not useful for breakpoints + // - GL_DEBUG_OUTPUT_SYNCHRONUS - Callback is in sync with errors, so a breakpoint can be placed on the callback in order to get a stacktrace for the GL error + glEnable(GL_DEBUG_OUTPUT); + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); + } +#endif + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // Init default white texture + unsigned char pixels[4] = { 255, 255, 255, 255 }; // 1 pixel RGBA (4 bytes) + RLGL.State.defaultTextureId = rlLoadTexture(pixels, 1, 1, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1); + + if (RLGL.State.defaultTextureId != 0) TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Default texture loaded successfully", RLGL.State.defaultTextureId); + else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to load default texture"); + + // Init default Shader (customized for GL 3.3 and ES2) + // Loaded: RLGL.State.defaultShaderId + RLGL.State.defaultShaderLocs + rlLoadShaderDefault(); + RLGL.State.currentShaderId = RLGL.State.defaultShaderId; + RLGL.State.currentShaderLocs = RLGL.State.defaultShaderLocs; + + // Init default vertex arrays buffers + RLGL.defaultBatch = rlLoadRenderBatch(RL_DEFAULT_BATCH_BUFFERS, RL_DEFAULT_BATCH_BUFFER_ELEMENTS); + RLGL.currentBatch = &RLGL.defaultBatch; + + // Init stack matrices (emulating OpenGL 1.1) + for (int i = 0; i < RL_MAX_MATRIX_STACK_SIZE; i++) RLGL.State.stack[i] = rlMatrixIdentity(); + + // Init internal matrices + RLGL.State.transform = rlMatrixIdentity(); + RLGL.State.projection = rlMatrixIdentity(); + RLGL.State.modelview = rlMatrixIdentity(); + RLGL.State.currentMatrix = &RLGL.State.modelview; +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 + + // Initialize OpenGL default states + //---------------------------------------------------------- + // Init state: Depth test + glDepthFunc(GL_LEQUAL); // Type of depth testing to apply + glDisable(GL_DEPTH_TEST); // Disable depth testing for 2D (only used for 3D) + + // Init state: Blending mode + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Color blending function (how colors are mixed) + glEnable(GL_BLEND); // Enable color blending (required to work with transparencies) + + // Init state: Culling + // NOTE: All shapes/models triangles are drawn CCW + glCullFace(GL_BACK); // Cull the back face (default) + glFrontFace(GL_CCW); // Front face are defined counter clockwise (default) + glEnable(GL_CULL_FACE); // Enable backface culling + + // Init state: Cubemap seamless +#if defined(GRAPHICS_API_OPENGL_33) + glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); // Seamless cubemaps (not supported on OpenGL ES 2.0) +#endif + +#if defined(GRAPHICS_API_OPENGL_11) + // Init state: Color hints (deprecated in OpenGL 3.0+) + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Improve quality of color and texture coordinate interpolation + glShadeModel(GL_SMOOTH); // Smooth shading between vertex (vertex colors interpolation) +#endif + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // Store screen size into global variables + RLGL.State.framebufferWidth = width; + RLGL.State.framebufferHeight = height; + + TRACELOG(RL_LOG_INFO, "RLGL: Default OpenGL state initialized successfully"); + //---------------------------------------------------------- +#endif + + // Init state: Color/Depth buffers clear + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set clear color (black) + glClearDepth(1.0f); // Set clear depth value (default) + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers (depth buffer required for 3D) +} + +// Vertex Buffer Object deinitialization (memory free) +void rlglClose(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + rlUnloadRenderBatch(RLGL.defaultBatch); + + rlUnloadShaderDefault(); // Unload default shader + + glDeleteTextures(1, &RLGL.State.defaultTextureId); // Unload default texture + TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Default texture unloaded successfully", RLGL.State.defaultTextureId); +#endif +} + +// Load OpenGL extensions +// NOTE: External loader function must be provided +void rlLoadExtensions(void *loader) +{ +#if defined(GRAPHICS_API_OPENGL_33) // Also defined for GRAPHICS_API_OPENGL_21 + // NOTE: glad is generated and contains only required OpenGL 3.3 Core extensions (and lower versions) + #if !defined(__APPLE__) + if (gladLoadGL((GLADloadfunc)loader) == 0) TRACELOG(RL_LOG_WARNING, "GLAD: Cannot load OpenGL extensions"); + else TRACELOG(RL_LOG_INFO, "GLAD: OpenGL extensions loaded successfully"); + #endif + + // Get number of supported extensions + GLint numExt = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &numExt); + TRACELOG(RL_LOG_INFO, "GL: Supported extensions count: %i", numExt); + +#if defined(RLGL_SHOW_GL_DETAILS_INFO) + // Get supported extensions list + // WARNING: glGetStringi() not available on OpenGL 2.1 + TRACELOG(RL_LOG_INFO, "GL: OpenGL extensions:"); + for (int i = 0; i < numExt; i++) TRACELOG(RL_LOG_INFO, " %s", glGetStringi(GL_EXTENSIONS, i)); +#endif + + // Register supported extensions flags + // OpenGL 3.3 extensions supported by default (core) + RLGL.ExtSupported.vao = true; + RLGL.ExtSupported.instancing = true; + RLGL.ExtSupported.texNPOT = true; + RLGL.ExtSupported.texFloat32 = true; + RLGL.ExtSupported.texDepth = true; + RLGL.ExtSupported.maxDepthBits = 32; + RLGL.ExtSupported.texAnisoFilter = true; + RLGL.ExtSupported.texMirrorClamp = true; + #if defined(GRAPHICS_API_OPENGL_43) + if (GLAD_GL_ARB_compute_shader) RLGL.ExtSupported.computeShader = true; + if (GLAD_GL_ARB_shader_storage_buffer_object) RLGL.ExtSupported.ssbo = true; + #endif + #if !defined(__APPLE__) + // NOTE: With GLAD, we can check if an extension is supported using the GLAD_GL_xxx booleans + if (GLAD_GL_EXT_texture_compression_s3tc) RLGL.ExtSupported.texCompDXT = true; // Texture compression: DXT + if (GLAD_GL_ARB_ES3_compatibility) RLGL.ExtSupported.texCompETC2 = true; // Texture compression: ETC2/EAC + #endif +#endif // GRAPHICS_API_OPENGL_33 + +#if defined(GRAPHICS_API_OPENGL_ES2) + // Get supported extensions list + GLint numExt = 0; + const char **extList = RL_MALLOC(512*sizeof(const char *)); // Allocate 512 strings pointers (2 KB) + const char *extensions = (const char *)glGetString(GL_EXTENSIONS); // One big const string + + // NOTE: We have to duplicate string because glGetString() returns a const string + int size = strlen(extensions) + 1; // Get extensions string size in bytes + char *extensionsDup = (char *)RL_CALLOC(size, sizeof(char)); + strcpy(extensionsDup, extensions); + extList[numExt] = extensionsDup; + + for (int i = 0; i < size; i++) + { + if (extensionsDup[i] == ' ') + { + extensionsDup[i] = '\0'; + numExt++; + extList[numExt] = &extensionsDup[i + 1]; + } + } + + TRACELOG(RL_LOG_INFO, "GL: Supported extensions count: %i", numExt); + +#if defined(RLGL_SHOW_GL_DETAILS_INFO) + TRACELOG(RL_LOG_INFO, "GL: OpenGL extensions:"); + for (int i = 0; i < numExt; i++) TRACELOG(RL_LOG_INFO, " %s", extList[i]); +#endif + + // Check required extensions + for (int i = 0; i < numExt; i++) + { + // Check VAO support + // NOTE: Only check on OpenGL ES, OpenGL 3.3 has VAO support as core feature + if (strcmp(extList[i], (const char *)"GL_OES_vertex_array_object") == 0) + { + // The extension is supported by our hardware and driver, try to get related functions pointers + // NOTE: emscripten does not support VAOs natively, it uses emulation and it reduces overall performance... + glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC)((rlglLoadProc)loader)("glGenVertexArraysOES"); + glBindVertexArray = (PFNGLBINDVERTEXARRAYOESPROC)((rlglLoadProc)loader)("glBindVertexArrayOES"); + glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)((rlglLoadProc)loader)("glDeleteVertexArraysOES"); + //glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)loader("glIsVertexArrayOES"); // NOTE: Fails in WebGL, omitted + + if ((glGenVertexArrays != NULL) && (glBindVertexArray != NULL) && (glDeleteVertexArrays != NULL)) RLGL.ExtSupported.vao = true; + } + + // Check instanced rendering support + if (strcmp(extList[i], (const char *)"GL_ANGLE_instanced_arrays") == 0) // Web ANGLE + { + glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawArraysInstancedANGLE"); + glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDEXTPROC)((rlglLoadProc)loader)("glDrawElementsInstancedANGLE"); + glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISOREXTPROC)((rlglLoadProc)loader)("glVertexAttribDivisorANGLE"); + + if ((glDrawArraysInstanced != NULL) && (glDrawElementsInstanced != NULL) && (glVertexAttribDivisor != NULL)) RLGL.ExtSupported.instancing = true; + } + else + { + if ((strcmp(extList[i], (const char *)"GL_EXT_draw_instanced") == 0) && // Standard EXT + (strcmp(extList[i], (const char *)"GL_EXT_instanced_arrays") == 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; + } + } + + // Check NPOT textures support + // NOTE: Only check on OpenGL ES, OpenGL 3.3 has NPOT textures full support as core feature + if (strcmp(extList[i], (const char *)"GL_OES_texture_npot") == 0) RLGL.ExtSupported.texNPOT = true; + + // Check texture float support + if (strcmp(extList[i], (const char *)"GL_OES_texture_float") == 0) RLGL.ExtSupported.texFloat32 = true; + + // Check depth texture support + if ((strcmp(extList[i], (const char *)"GL_OES_depth_texture") == 0) || + (strcmp(extList[i], (const char *)"GL_WEBGL_depth_texture") == 0)) RLGL.ExtSupported.texDepth = true; + + if (strcmp(extList[i], (const char *)"GL_OES_depth24") == 0) RLGL.ExtSupported.maxDepthBits = 24; + if (strcmp(extList[i], (const char *)"GL_OES_depth32") == 0) RLGL.ExtSupported.maxDepthBits = 32; + + // Check texture compression support: DXT + if ((strcmp(extList[i], (const char *)"GL_EXT_texture_compression_s3tc") == 0) || + (strcmp(extList[i], (const char *)"GL_WEBGL_compressed_texture_s3tc") == 0) || + (strcmp(extList[i], (const char *)"GL_WEBKIT_WEBGL_compressed_texture_s3tc") == 0)) RLGL.ExtSupported.texCompDXT = true; + + // Check texture compression support: ETC1 + if ((strcmp(extList[i], (const char *)"GL_OES_compressed_ETC1_RGB8_texture") == 0) || + (strcmp(extList[i], (const char *)"GL_WEBGL_compressed_texture_etc1") == 0)) RLGL.ExtSupported.texCompETC1 = true; + + // Check texture compression support: ETC2/EAC + if (strcmp(extList[i], (const char *)"GL_ARB_ES3_compatibility") == 0) RLGL.ExtSupported.texCompETC2 = true; + + // Check texture compression support: PVR + if (strcmp(extList[i], (const char *)"GL_IMG_texture_compression_pvrtc") == 0) RLGL.ExtSupported.texCompPVRT = true; + + // Check texture compression support: ASTC + if (strcmp(extList[i], (const char *)"GL_KHR_texture_compression_astc_hdr") == 0) RLGL.ExtSupported.texCompASTC = true; + + // Check anisotropic texture filter support + if (strcmp(extList[i], (const char *)"GL_EXT_texture_filter_anisotropic") == 0) RLGL.ExtSupported.texAnisoFilter = true; + + // Check clamp mirror wrap mode support + if (strcmp(extList[i], (const char *)"GL_EXT_texture_mirror_clamp") == 0) RLGL.ExtSupported.texMirrorClamp = true; + } + + // Free extensions pointers + RL_FREE(extList); + RL_FREE(extensionsDup); // Duplicated string must be deallocated +#endif // GRAPHICS_API_OPENGL_ES2 + + // Check OpenGL information and capabilities + //------------------------------------------------------------------------------ + // Show current OpenGL and GLSL version + TRACELOG(RL_LOG_INFO, "GL: OpenGL device information:"); + TRACELOG(RL_LOG_INFO, " > Vendor: %s", glGetString(GL_VENDOR)); + TRACELOG(RL_LOG_INFO, " > Renderer: %s", glGetString(GL_RENDERER)); + TRACELOG(RL_LOG_INFO, " > Version: %s", glGetString(GL_VERSION)); + TRACELOG(RL_LOG_INFO, " > GLSL: %s", glGetString(GL_SHADING_LANGUAGE_VERSION)); + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // NOTE: Anisotropy levels capability is an extension + #ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT + #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF + #endif + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &RLGL.ExtSupported.maxAnisotropyLevel); + +#if defined(RLGL_SHOW_GL_DETAILS_INFO) + // Show some OpenGL GPU capabilities + TRACELOG(RL_LOG_INFO, "GL: OpenGL capabilities:"); + GLint capability = 0; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &capability); + TRACELOG(RL_LOG_INFO, " GL_MAX_TEXTURE_SIZE: %i", capability); + glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &capability); + TRACELOG(RL_LOG_INFO, " GL_MAX_CUBE_MAP_TEXTURE_SIZE: %i", capability); + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &capability); + TRACELOG(RL_LOG_INFO, " GL_MAX_TEXTURE_IMAGE_UNITS: %i", capability); + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &capability); + TRACELOG(RL_LOG_INFO, " GL_MAX_VERTEX_ATTRIBS: %i", capability); + #if !defined(GRAPHICS_API_OPENGL_ES2) + glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &capability); + TRACELOG(RL_LOG_INFO, " GL_MAX_UNIFORM_BLOCK_SIZE: %i", capability); + glGetIntegerv(GL_MAX_DRAW_BUFFERS, &capability); + TRACELOG(RL_LOG_INFO, " GL_MAX_DRAW_BUFFERS: %i", capability); + if (RLGL.ExtSupported.texAnisoFilter) TRACELOG(RL_LOG_INFO, " GL_MAX_TEXTURE_MAX_ANISOTROPY: %.0f", RLGL.ExtSupported.maxAnisotropyLevel); + #endif + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &capability); + TRACELOG(RL_LOG_INFO, " GL_NUM_COMPRESSED_TEXTURE_FORMATS: %i", capability); + GLint *compFormats = (GLint *)RL_CALLOC(capability, sizeof(GLint)); + glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, compFormats); + for (int i = 0; i < capability; i++) TRACELOG(RL_LOG_INFO, " %s", rlGetCompressedFormatName(compFormats[i])); + RL_FREE(compFormats); + +#if defined(GRAPHICS_API_OPENGL_43) + glGetIntegerv(GL_MAX_VERTEX_ATTRIB_BINDINGS, &capability); + TRACELOG(RL_LOG_INFO, " GL_MAX_VERTEX_ATTRIB_BINDINGS: %i", capability); + glGetIntegerv(GL_MAX_UNIFORM_LOCATIONS, &capability); + TRACELOG(RL_LOG_INFO, " GL_MAX_UNIFORM_LOCATIONS: %i", capability); +#endif // GRAPHICS_API_OPENGL_43 +#else // RLGL_SHOW_GL_DETAILS_INFO + + // Show some basic info about GL supported features + #if defined(GRAPHICS_API_OPENGL_ES2) + if (RLGL.ExtSupported.vao) TRACELOG(RL_LOG_INFO, "GL: VAO extension detected, VAO functions loaded successfully"); + else TRACELOG(RL_LOG_WARNING, "GL: VAO extension not found, VAO not supported"); + if (RLGL.ExtSupported.texNPOT) TRACELOG(RL_LOG_INFO, "GL: NPOT textures extension detected, full NPOT textures supported"); + else TRACELOG(RL_LOG_WARNING, "GL: NPOT textures extension not found, limited NPOT support (no-mipmaps, no-repeat)"); + #endif + if (RLGL.ExtSupported.texCompDXT) TRACELOG(RL_LOG_INFO, "GL: DXT compressed textures supported"); + if (RLGL.ExtSupported.texCompETC1) TRACELOG(RL_LOG_INFO, "GL: ETC1 compressed textures supported"); + if (RLGL.ExtSupported.texCompETC2) TRACELOG(RL_LOG_INFO, "GL: ETC2/EAC compressed textures supported"); + if (RLGL.ExtSupported.texCompPVRT) TRACELOG(RL_LOG_INFO, "GL: PVRT compressed textures supported"); + if (RLGL.ExtSupported.texCompASTC) TRACELOG(RL_LOG_INFO, "GL: ASTC compressed textures supported"); + if (RLGL.ExtSupported.computeShader) TRACELOG(RL_LOG_INFO, "GL: Compute shaders supported"); + if (RLGL.ExtSupported.ssbo) TRACELOG(RL_LOG_INFO, "GL: Shader storage buffer objects supported"); +#endif // RLGL_SHOW_GL_DETAILS_INFO + +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 +} + +// Get current OpenGL version +int rlGetVersion(void) +{ + int glVersion = 0; +#if defined(GRAPHICS_API_OPENGL_11) + glVersion = OPENGL_11; +#endif +#if defined(GRAPHICS_API_OPENGL_21) + #if defined(__APPLE__) + glVersion = OPENGL_33; // NOTE: Force OpenGL 3.3 on OSX + #else + glVersion = OPENGL_21; + #endif +#elif defined(GRAPHICS_API_OPENGL_33) + glVersion = OPENGL_33; +#endif +#if defined(GRAPHICS_API_OPENGL_43) + glVersion = OPENGL_43; +#endif +#if defined(GRAPHICS_API_OPENGL_ES2) + glVersion = OPENGL_ES_20; +#endif + return glVersion; +} + +// Set current framebuffer width +void rlSetFramebufferWidth(int width) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + RLGL.State.framebufferWidth = width; +#endif +} + +// Set current framebuffer height +void rlSetFramebufferHeight(int height) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + RLGL.State.framebufferHeight = height; +#endif +} + +// Get default framebuffer width +int rlGetFramebufferWidth(void) +{ + int width = 0; +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + width = RLGL.State.framebufferWidth; +#endif + return width; +} + +// Get default framebuffer height +int rlGetFramebufferHeight(void) +{ + int height = 0; +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + height = RLGL.State.framebufferHeight; +#endif + return height; +} + +// Get default internal texture (white texture) +// NOTE: Default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8 +unsigned int rlGetTextureIdDefault(void) +{ + unsigned int id = 0; +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + id = RLGL.State.defaultTextureId; +#endif + return id; +} + +// Get default shader id +unsigned int rlGetShaderIdDefault(void) +{ + unsigned int id = 0; +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + id = RLGL.State.defaultShaderId; +#endif + return id; +} + +// Get default shader locs +int *rlGetShaderLocsDefault(void) +{ + int *locs = NULL; +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + locs = RLGL.State.defaultShaderLocs; +#endif + return locs; +} + +// Render batch management +//------------------------------------------------------------------------------------------------ +// Load render batch +rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements) +{ + rlRenderBatch batch = { 0 }; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // Initialize CPU (RAM) vertex buffers (position, texcoord, color data and indexes) + //-------------------------------------------------------------------------------------------- + batch.vertexBuffer = (rlVertexBuffer *)RL_MALLOC(numBuffers*sizeof(rlVertexBuffer)); + + for (int i = 0; i < numBuffers; i++) + { + batch.vertexBuffer[i].elementCount = 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].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) +#endif +#if defined(GRAPHICS_API_OPENGL_ES2) + batch.vertexBuffer[i].indices = (unsigned short *)RL_MALLOC(bufferElements*6*sizeof(unsigned short)); // 6 int by quad (indices) +#endif + + 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 < (4*4*bufferElements); j++) batch.vertexBuffer[i].colors[j] = 0; + + int k = 0; + + // Indices can be initialized right now + for (int j = 0; j < (6*bufferElements); j += 6) + { + batch.vertexBuffer[i].indices[j] = 4*k; + batch.vertexBuffer[i].indices[j + 1] = 4*k + 1; + batch.vertexBuffer[i].indices[j + 2] = 4*k + 2; + batch.vertexBuffer[i].indices[j + 3] = 4*k; + batch.vertexBuffer[i].indices[j + 4] = 4*k + 2; + batch.vertexBuffer[i].indices[j + 5] = 4*k + 3; + + k++; + } + + RLGL.State.vertexCounter = 0; + } + + TRACELOG(RL_LOG_INFO, "RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)"); + //-------------------------------------------------------------------------------------------- + + // Upload to GPU (VRAM) vertex data and initialize VAOs/VBOs + //-------------------------------------------------------------------------------------------- + for (int i = 0; i < numBuffers; i++) + { + if (RLGL.ExtSupported.vao) + { + // Initialize Quads VAO + glGenVertexArrays(1, &batch.vertexBuffer[i].vaoId); + glBindVertexArray(batch.vertexBuffer[i].vaoId); + } + + // Quads - Vertex buffers binding and attributes enable + // Vertex position buffer (shader-location = 0) + glGenBuffers(1, &batch.vertexBuffer[i].vboId[0]); + glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[0]); + glBufferData(GL_ARRAY_BUFFER, bufferElements*3*4*sizeof(float), batch.vertexBuffer[i].vertices, GL_DYNAMIC_DRAW); + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_POSITION]); + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_POSITION], 3, GL_FLOAT, 0, 0, 0); + + // Vertex texcoord buffer (shader-location = 1) + glGenBuffers(1, &batch.vertexBuffer[i].vboId[1]); + glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[1]); + glBufferData(GL_ARRAY_BUFFER, bufferElements*2*4*sizeof(float), batch.vertexBuffer[i].texcoords, GL_DYNAMIC_DRAW); + 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) + glGenBuffers(1, &batch.vertexBuffer[i].vboId[2]); + glBindBuffer(GL_ARRAY_BUFFER, batch.vertexBuffer[i].vboId[2]); + 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]); +#if defined(GRAPHICS_API_OPENGL_33) + glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufferElements*6*sizeof(int), batch.vertexBuffer[i].indices, GL_STATIC_DRAW); +#endif +#if defined(GRAPHICS_API_OPENGL_ES2) + glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufferElements*6*sizeof(short), batch.vertexBuffer[i].indices, GL_STATIC_DRAW); +#endif + } + + TRACELOG(RL_LOG_INFO, "RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)"); + + // Unbind the current VAO + if (RLGL.ExtSupported.vao) glBindVertexArray(0); + //-------------------------------------------------------------------------------------------- + + // Init draw calls tracking system + //-------------------------------------------------------------------------------------------- + batch.draws = (rlDrawCall *)RL_MALLOC(RL_DEFAULT_BATCH_DRAWCALLS*sizeof(rlDrawCall)); + + for (int i = 0; i < RL_DEFAULT_BATCH_DRAWCALLS; i++) + { + batch.draws[i].mode = RL_QUADS; + batch.draws[i].vertexCount = 0; + batch.draws[i].vertexAlignment = 0; + //batch.draws[i].vaoId = 0; + //batch.draws[i].shaderId = 0; + batch.draws[i].textureId = RLGL.State.defaultTextureId; + //batch.draws[i].RLGL.State.projection = rlMatrixIdentity(); + //batch.draws[i].RLGL.State.modelview = rlMatrixIdentity(); + } + + batch.bufferCount = numBuffers; // Record buffer count + batch.drawCounter = 1; // Reset draws counter + batch.currentDepth = -1.0f; // Reset depth value + //-------------------------------------------------------------------------------------------- +#endif + + return batch; +} + +// Unload default internal buffers vertex data from CPU and GPU +void rlUnloadRenderBatch(rlRenderBatch batch) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // Unbind everything + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + // Unload all vertex buffers data + for (int i = 0; i < batch.bufferCount; i++) + { + // Unbind VAO attribs data + if (RLGL.ExtSupported.vao) + { + glBindVertexArray(batch.vertexBuffer[i].vaoId); + glDisableVertexAttribArray(0); + glDisableVertexAttribArray(1); + glDisableVertexAttribArray(2); + glDisableVertexAttribArray(3); + glBindVertexArray(0); + } + + // Delete VBOs from GPU (VRAM) + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[0]); + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[1]); + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[2]); + glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[3]); + + // Delete VAOs from GPU (VRAM) + if (RLGL.ExtSupported.vao) glDeleteVertexArrays(1, &batch.vertexBuffer[i].vaoId); + + // Free vertex arrays memory from CPU (RAM) + RL_FREE(batch.vertexBuffer[i].vertices); + RL_FREE(batch.vertexBuffer[i].texcoords); + RL_FREE(batch.vertexBuffer[i].colors); + RL_FREE(batch.vertexBuffer[i].indices); + } + + // Unload arrays + RL_FREE(batch.vertexBuffer); + RL_FREE(batch.draws); +#endif +} + +// Draw render batch +// NOTE: We require a pointer to reset batch and increase current buffer (multi-buffer) +void rlDrawRenderBatch(rlRenderBatch *batch) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // 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) + if (RLGL.State.vertexCounter > 0) + { + // Activate elements VAO + if (RLGL.ExtSupported.vao) glBindVertexArray(batch->vertexBuffer[batch->currentBuffer].vaoId); + + // Vertex positions buffer + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[0]); + glBufferSubData(GL_ARRAY_BUFFER, 0, RLGL.State.vertexCounter*3*sizeof(float), batch->vertexBuffer[batch->currentBuffer].vertices); + //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].vertices, GL_DYNAMIC_DRAW); // Update all buffer + + // Texture coordinates buffer + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[1]); + 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 + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[2]); + 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(). + // 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. + + // Another option: map the buffer object into client's memory + // Probably this code could be moved somewhere else... + // batch->vertexBuffer[batch->currentBuffer].vertices = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); + // if (batch->vertexBuffer[batch->currentBuffer].vertices) + // { + // Update vertex data + // } + // glUnmapBuffer(GL_ARRAY_BUFFER); + + // Unbind the current VAO + if (RLGL.ExtSupported.vao) glBindVertexArray(0); + } + //------------------------------------------------------------------------------------------------------------ + + // Draw batch vertex buffers (considering VR stereo if required) + //------------------------------------------------------------------------------------------------------------ + Matrix matProjection = RLGL.State.projection; + Matrix matModelView = RLGL.State.modelview; + + int eyeCount = 1; + if (RLGL.State.stereoRender) eyeCount = 2; + + for (int eye = 0; eye < eyeCount; eye++) + { + if (eyeCount == 2) + { + // Setup current eye viewport (half screen width) + rlViewport(eye*RLGL.State.framebufferWidth/2, 0, RLGL.State.framebufferWidth/2, RLGL.State.framebufferHeight); + + // Set current eye view offset to modelview matrix + rlSetMatrixModelview(rlMatrixMultiply(matModelView, RLGL.State.viewOffsetStereo[eye])); + // Set current eye projection matrix + rlSetMatrixProjection(RLGL.State.projectionStereo[eye]); + } + + // Draw buffers + if (RLGL.State.vertexCounter > 0) + { + // Set current shader and upload current MVP matrix + glUseProgram(RLGL.State.currentShaderId); + + // 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); + + if (RLGL.ExtSupported.vao) glBindVertexArray(batch->vertexBuffer[batch->currentBuffer].vaoId); + else + { + // Bind vertex attrib: position (shader-location = 0) + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[0]); + glVertexAttribPointer(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_POSITION], 3, GL_FLOAT, 0, 0, 0); + glEnableVertexAttribArray(RLGL.State.currentShaderLocs[RL_SHADER_LOC_VERTEX_POSITION]); + + // Bind vertex attrib: texcoord (shader-location = 1) + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[1]); + 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) + glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[2]); + 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]); + } + + // Setup some default shader values + glUniform4f(RLGL.State.currentShaderLocs[RL_SHADER_LOC_COLOR_DIFFUSE], 1.0f, 1.0f, 1.0f, 1.0f); + glUniform1i(RLGL.State.currentShaderLocs[RL_SHADER_LOC_MAP_DIFFUSE], 0); // Active default sampler2D: texture0 + + // Activate additional sampler textures + // Those additional textures will be common for all draw calls of the batch + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) + { + if (RLGL.State.activeTextureId[i] > 0) + { + glActiveTexture(GL_TEXTURE0 + 1 + i); + glBindTexture(GL_TEXTURE_2D, RLGL.State.activeTextureId[i]); + } + } + + // Activate default sampler2D texture0 (one texture is always active for default batch shader) + // NOTE: Batch system accumulates calls by texture0 changes, additional textures are enabled for all the draw calls + glActiveTexture(GL_TEXTURE0); + + for (int i = 0, vertexOffset = 0; i < batch->drawCounter; i++) + { + // Bind current draw call texture, activated as GL_TEXTURE0 and binded to sampler2D texture0 by default + glBindTexture(GL_TEXTURE_2D, batch->draws[i].textureId); + + 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) + // 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) + glDrawElements(GL_TRIANGLES, batch->draws[i].vertexCount/4*6, GL_UNSIGNED_SHORT, (GLvoid *)(vertexOffset/4*6*sizeof(GLushort))); +#endif + } + + vertexOffset += (batch->draws[i].vertexCount + batch->draws[i].vertexAlignment); + } + + if (!RLGL.ExtSupported.vao) + { + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + } + + glBindTexture(GL_TEXTURE_2D, 0); // Unbind textures + } + + if (RLGL.ExtSupported.vao) glBindVertexArray(0); // Unbind VAO + + glUseProgram(0); // Unbind shader program + } + + // Restore viewport to default measures + if (eyeCount == 2) rlViewport(0, 0, RLGL.State.framebufferWidth, RLGL.State.framebufferHeight); + //------------------------------------------------------------------------------------------------------------ + + // Reset batch buffers + //------------------------------------------------------------------------------------------------------------ + // Reset vertex counter for next frame + RLGL.State.vertexCounter = 0; + + // Reset depth for next draw + batch->currentDepth = -1.0f; + + // Restore projection/modelview matrices + RLGL.State.projection = matProjection; + RLGL.State.modelview = matModelView; + + // Reset RLGL.currentBatch->draws array + for (int i = 0; i < RL_DEFAULT_BATCH_DRAWCALLS; i++) + { + batch->draws[i].mode = RL_QUADS; + batch->draws[i].vertexCount = 0; + batch->draws[i].textureId = RLGL.State.defaultTextureId; + } + + // Reset active texture units for next batch + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) RLGL.State.activeTextureId[i] = 0; + + // Reset draws counter to one draw for the batch + batch->drawCounter = 1; + //------------------------------------------------------------------------------------------------------------ + + // Change to next buffer in the list (in case of multi-buffering) + batch->currentBuffer++; + if (batch->currentBuffer >= batch->bufferCount) batch->currentBuffer = 0; +#endif +} + +// Set the active render batch for rlgl +void rlSetRenderBatchActive(rlRenderBatch *batch) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + rlDrawRenderBatch(RLGL.currentBatch); + + if (batch != NULL) RLGL.currentBatch = batch; + else RLGL.currentBatch = &RLGL.defaultBatch; +#endif +} + +// Update and draw internal render batch +void rlDrawRenderBatchActive(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside +#endif +} + +// Check internal buffer overflow for a given number of vertex +// and force a rlRenderBatch draw call if required +bool rlCheckRenderBatchLimit(int vCount) +{ + bool overflow = false; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if ((RLGL.State.vertexCounter + vCount) >= + (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4)) + { + int currentMode = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode; + int currentTexture = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId; + + overflow = true; + rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside + + // Restore state of last batch so we can continue adding vertices + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = currentMode; + RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = currentTexture; + } +#endif + + return overflow; +} + +// Textures data management +//----------------------------------------------------------------------------------------- +// Convert image data to OpenGL texture (returns OpenGL valid Id) +unsigned int rlLoadTexture(const void *data, int width, int height, int format, int mipmapCount) +{ + unsigned int id = 0; + + glBindTexture(GL_TEXTURE_2D, 0); // Free any old binding + + // Check texture format support by OpenGL 1.1 (compressed textures not supported) +#if defined(GRAPHICS_API_OPENGL_11) + if (format >= RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) + { + TRACELOG(RL_LOG_WARNING, "GL: OpenGL 1.1 does not support GPU compressed texture formats"); + return id; + } +#else + if ((!RLGL.ExtSupported.texCompDXT) && ((format == RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) || (format == RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA) || + (format == RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA) || (format == RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA))) + { + TRACELOG(RL_LOG_WARNING, "GL: DXT compressed texture format not supported"); + return id; + } +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if ((!RLGL.ExtSupported.texCompETC1) && (format == RL_PIXELFORMAT_COMPRESSED_ETC1_RGB)) + { + TRACELOG(RL_LOG_WARNING, "GL: ETC1 compressed texture format not supported"); + return id; + } + + if ((!RLGL.ExtSupported.texCompETC2) && ((format == RL_PIXELFORMAT_COMPRESSED_ETC2_RGB) || (format == RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA))) + { + TRACELOG(RL_LOG_WARNING, "GL: ETC2 compressed texture format not supported"); + return id; + } + + if ((!RLGL.ExtSupported.texCompPVRT) && ((format == RL_PIXELFORMAT_COMPRESSED_PVRT_RGB) || (format == RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA))) + { + TRACELOG(RL_LOG_WARNING, "GL: PVRT compressed texture format not supported"); + return id; + } + + if ((!RLGL.ExtSupported.texCompASTC) && ((format == RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA) || (format == RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA))) + { + TRACELOG(RL_LOG_WARNING, "GL: ASTC compressed texture format not supported"); + return id; + } +#endif +#endif // GRAPHICS_API_OPENGL_11 + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + glGenTextures(1, &id); // Generate texture id + + glBindTexture(GL_TEXTURE_2D, id); + + int mipWidth = width; + int mipHeight = height; + int mipOffset = 0; // Mipmap data offset + + // Load the different mipmap levels + for (int i = 0; i < mipmapCount; i++) + { + unsigned int mipSize = rlGetPixelDataSize(mipWidth, mipHeight, format); + + unsigned int glInternalFormat, glFormat, glType; + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); + + TRACELOGD("TEXTURE: Load mipmap level %i (%i x %i), size: %i, offset: %i", i, mipWidth, mipHeight, mipSize, mipOffset); + + if (glInternalFormat != -1) + { + if (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) glTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, glFormat, glType, (unsigned char *)data + mipOffset); +#if !defined(GRAPHICS_API_OPENGL_11) + else glCompressedTexImage2D(GL_TEXTURE_2D, i, glInternalFormat, mipWidth, mipHeight, 0, mipSize, (unsigned char *)data + mipOffset); +#endif + +#if defined(GRAPHICS_API_OPENGL_33) + if (format == RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) + { + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_ONE }; + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); + } + else if (format == RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) + { +#if defined(GRAPHICS_API_OPENGL_21) + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_ALPHA }; +#elif defined(GRAPHICS_API_OPENGL_33) + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_GREEN }; +#endif + glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); + } +#endif + } + + mipWidth /= 2; + mipHeight /= 2; + mipOffset += mipSize; + + // Security check for NPOT textures + if (mipWidth < 1) mipWidth = 1; + if (mipHeight < 1) mipHeight = 1; + } + + // Texture parameters configuration + // NOTE: glTexParameteri does NOT affect texture uploading, just the way it's used +#if defined(GRAPHICS_API_OPENGL_ES2) + // NOTE: OpenGL ES 2.0 with no GL_OES_texture_npot support (i.e. WebGL) has limited NPOT support, so CLAMP_TO_EDGE must be used + if (RLGL.ExtSupported.texNPOT) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // Set texture to repeat on x-axis + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Set texture to repeat on y-axis + } + else + { + // NOTE: If using negative texture coordinates (LoadOBJ()), it does not work! + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Set texture to clamp on x-axis + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Set texture to clamp on y-axis + } +#else + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // Set texture to repeat on x-axis + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Set texture to repeat on y-axis +#endif + + // Magnification and minification filters + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Alternative: GL_LINEAR + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // Alternative: GL_LINEAR + +#if defined(GRAPHICS_API_OPENGL_33) + if (mipmapCount > 1) + { + // 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); + } +#endif + + // At this point we have the texture loaded in GPU and texture parameters configured + + // NOTE: If mipmaps were not in data, they are not generated automatically + + // Unbind current texture + glBindTexture(GL_TEXTURE_2D, 0); + + if (id > 0) TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Texture loaded successfully (%ix%i | %s | %i mipmaps)", id, width, height, rlGetPixelFormatName(format), mipmapCount); + else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to load texture"); + + return id; +} + +// Load depth texture/renderbuffer (to be attached to fbo) +// WARNING: OpenGL ES 2.0 requires GL_OES_depth_texture/WEBGL_depth_texture extensions +unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer) +{ + unsigned int id = 0; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // In case depth textures not supported, we force renderbuffer usage + if (!RLGL.ExtSupported.texDepth) useRenderBuffer = true; + + // NOTE: We let the implementation to choose the best bit-depth + // 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 (RLGL.ExtSupported.maxDepthBits == 32) glInternalFormat = GL_DEPTH_COMPONENT32_OES; + else if (RLGL.ExtSupported.maxDepthBits == 24) glInternalFormat = GL_DEPTH_COMPONENT24_OES; + else glInternalFormat = GL_DEPTH_COMPONENT16; +#endif + + if (!useRenderBuffer && RLGL.ExtSupported.texDepth) + { + glGenTextures(1, &id); + glBindTexture(GL_TEXTURE_2D, id); + glTexImage2D(GL_TEXTURE_2D, 0, glInternalFormat, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + glBindTexture(GL_TEXTURE_2D, 0); + + TRACELOG(RL_LOG_INFO, "TEXTURE: Depth texture loaded successfully"); + } + else + { + // Create the renderbuffer that will serve as the depth attachment for the framebuffer + // NOTE: A renderbuffer is simpler than a texture and could offer better performance on embedded devices + glGenRenderbuffers(1, &id); + glBindRenderbuffer(GL_RENDERBUFFER, id); + glRenderbufferStorage(GL_RENDERBUFFER, glInternalFormat, width, height); + + glBindRenderbuffer(GL_RENDERBUFFER, 0); + + TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Depth renderbuffer loaded successfully (%i bits)", id, (RLGL.ExtSupported.maxDepthBits >= 24)? RLGL.ExtSupported.maxDepthBits : 16); + } +#endif + + return id; +} + +// 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 id = 0; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + unsigned int dataSize = rlGetPixelDataSize(size, size, format); + + glGenTextures(1, &id); + glBindTexture(GL_TEXTURE_CUBE_MAP, id); + + unsigned int glInternalFormat, glFormat, glType; + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); + + if (glInternalFormat != -1) + { + // Load cubemap faces + for (unsigned int i = 0; i < 6; i++) + { + 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); + } + 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 defined(GRAPHICS_API_OPENGL_33) + if (format == RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) + { + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_ONE }; + glTexParameteriv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); + } + else if (format == RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) + { +#if defined(GRAPHICS_API_OPENGL_21) + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_ALPHA }; +#elif defined(GRAPHICS_API_OPENGL_33) + GLint swizzleMask[] = { GL_RED, GL_RED, GL_RED, GL_GREEN }; +#endif + glTexParameteriv(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); + } +#endif + } + } + + // Set cubemap texture sampling parameters + 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); +#if defined(GRAPHICS_API_OPENGL_33) + glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); // Flag not supported on OpenGL ES 2.0 +#endif + + glBindTexture(GL_TEXTURE_CUBE_MAP, 0); +#endif + + if (id > 0) TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Cubemap texture loaded successfully (%ix%i)", id, size, size); + else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to load cubemap texture"); + + return id; +} + +// Update already loaded texture in GPU with new data +// NOTE: We don't know safely if internal texture format is the expected one... +void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data) +{ + glBindTexture(GL_TEXTURE_2D, id); + + unsigned int glInternalFormat, glFormat, glType; + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); + + if ((glInternalFormat != -1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) + { + glTexSubImage2D(GL_TEXTURE_2D, 0, offsetX, offsetY, width, height, glFormat, glType, data); + } + else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Failed to update for current texture format (%i)", id, format); +} + +// Get OpenGL internal formats and data type from raylib PixelFormat +void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType) +{ + *glInternalFormat = 0; + *glFormat = 0; + *glType = 0; + + switch (format) + { + #if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_21) || defined(GRAPHICS_API_OPENGL_ES2) + // NOTE: on OpenGL ES 2.0 (WebGL), internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA + case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: *glInternalFormat = GL_LUMINANCE; *glFormat = GL_LUMINANCE; *glType = GL_UNSIGNED_BYTE; break; + case RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: *glInternalFormat = GL_LUMINANCE_ALPHA; *glFormat = GL_LUMINANCE_ALPHA; *glType = GL_UNSIGNED_BYTE; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_UNSIGNED_SHORT_5_6_5; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: *glInternalFormat = GL_RGB; *glFormat = GL_RGB; *glType = GL_UNSIGNED_BYTE; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: *glInternalFormat = GL_RGBA; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_SHORT_5_5_5_1; break; + 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 + #endif + #elif defined(GRAPHICS_API_OPENGL_33) + case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: *glInternalFormat = GL_R8; *glFormat = GL_RED; *glType = GL_UNSIGNED_BYTE; break; + case RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: *glInternalFormat = GL_RG8; *glFormat = GL_RG; *glType = GL_UNSIGNED_BYTE; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: *glInternalFormat = GL_RGB565; *glFormat = GL_RGB; *glType = GL_UNSIGNED_SHORT_5_6_5; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: *glInternalFormat = GL_RGB8; *glFormat = GL_RGB; *glType = GL_UNSIGNED_BYTE; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: *glInternalFormat = GL_RGB5_A1; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_SHORT_5_5_5_1; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: *glInternalFormat = GL_RGBA4; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_SHORT_4_4_4_4; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: *glInternalFormat = GL_RGBA8; *glFormat = GL_RGBA; *glType = GL_UNSIGNED_BYTE; break; + 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; + #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; + case RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: if (RLGL.ExtSupported.texCompDXT) *glInternalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break; + case RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: if (RLGL.ExtSupported.texCompDXT) *glInternalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break; + case RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: if (RLGL.ExtSupported.texCompDXT) *glInternalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break; + case RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: if (RLGL.ExtSupported.texCompETC1) *glInternalFormat = GL_ETC1_RGB8_OES; break; // NOTE: Requires OpenGL ES 2.0 or OpenGL 4.3 + case RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: if (RLGL.ExtSupported.texCompETC2) *glInternalFormat = GL_COMPRESSED_RGB8_ETC2; break; // NOTE: Requires OpenGL ES 3.0 or OpenGL 4.3 + case RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: if (RLGL.ExtSupported.texCompETC2) *glInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; break; // NOTE: Requires OpenGL ES 3.0 or OpenGL 4.3 + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: if (RLGL.ExtSupported.texCompPVRT) *glInternalFormat = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; break; // NOTE: Requires PowerVR GPU + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: if (RLGL.ExtSupported.texCompPVRT) *glInternalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; break; // NOTE: Requires PowerVR GPU + case RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: if (RLGL.ExtSupported.texCompASTC) *glInternalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; break; // NOTE: Requires OpenGL ES 3.1 or OpenGL 4.3 + case RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: if (RLGL.ExtSupported.texCompASTC) *glInternalFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR; break; // NOTE: Requires OpenGL ES 3.1 or OpenGL 4.3 + #endif + default: TRACELOG(RL_LOG_WARNING, "TEXTURE: Current format not supported (%i)", format); break; + } +} + +// Unload texture from GPU memory +void rlUnloadTexture(unsigned int id) +{ + glDeleteTextures(1, &id); +} + +// Generate mipmap data for selected texture +void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps) +{ + glBindTexture(GL_TEXTURE_2D, id); + + // Check if texture is power-of-two (POT) + bool texIsPOT = false; + + if (((width > 0) && ((width & (width - 1)) == 0)) && + ((height > 0) && ((height & (height - 1)) == 0))) texIsPOT = true; + +#if defined(GRAPHICS_API_OPENGL_11) + if (texIsPOT) + { + // WARNING: Manual mipmap generation only works for RGBA 32bit textures! + if (format == RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) + { + // Retrieve texture data from VRAM + void *texData = rlReadTexturePixels(id, width, height, format); + + // NOTE: Texture data size is reallocated to fit mipmaps data + // NOTE: CPU mipmap generation only supports RGBA 32bit data + int mipmapCount = rlGenTextureMipmapsData(texData, width, height); + + int size = width*height*4; + int offset = size; + + int mipWidth = width/2; + int mipHeight = height/2; + + // Load the mipmaps + for (int level = 1; level < mipmapCount; level++) + { + glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, mipWidth, mipHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char *)texData + offset); + + size = mipWidth*mipHeight*4; + offset += size; + + mipWidth /= 2; + mipHeight /= 2; + } + + *mipmaps = mipmapCount + 1; + RL_FREE(texData); // Once mipmaps have been generated and data has been uploaded to GPU VRAM, we can discard RAM data + + TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Mipmaps generated manually on CPU side, total: %i", id, *mipmaps); + } + else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Failed to generate mipmaps for provided texture format", id); + } +#endif +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if ((texIsPOT) || (RLGL.ExtSupported.texNPOT)) + { + //glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE); // Hint for mipmaps generation algorithm: GL_FASTEST, GL_NICEST, GL_DONT_CARE + glGenerateMipmap(GL_TEXTURE_2D); // Generate mipmaps automatically + + #define MIN(a,b) (((a)<(b))? (a):(b)) + #define MAX(a,b) (((a)>(b))? (a):(b)) + + *mipmaps = 1 + (int)floor(log(MAX(width, height))/log(2)); + TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Mipmaps generated automatically, total: %i", id, *mipmaps); + } +#endif + else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Failed to generate mipmaps", id); + + glBindTexture(GL_TEXTURE_2D, 0); +} + + +// Read texture pixel data +void *rlReadTexturePixels(unsigned int id, int width, int height, int format) +{ + void *pixels = NULL; + +#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33) + glBindTexture(GL_TEXTURE_2D, id); + + // NOTE: Using texture id, we can retrieve some texture info (but not on OpenGL ES 2.0) + // Possible texture info: GL_TEXTURE_RED_SIZE, GL_TEXTURE_GREEN_SIZE, GL_TEXTURE_BLUE_SIZE, GL_TEXTURE_ALPHA_SIZE + //int width, height, format; + //glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); + //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. + // 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); + + unsigned int glInternalFormat, glFormat, glType; + rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType); + unsigned int size = rlGetPixelDataSize(width, height, format); + + if ((glInternalFormat != -1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB)) + { + pixels = RL_MALLOC(size); + glGetTexImage(GL_TEXTURE_2D, 0, glFormat, glType, pixels); + } + else TRACELOG(RL_LOG_WARNING, "TEXTURE: [ID %i] Data retrieval not suported for pixel format (%i)", id, format); + + glBindTexture(GL_TEXTURE_2D, 0); +#endif + +#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. + // 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); + + glBindFramebuffer(GL_FRAMEBUFFER, fboId); + glBindTexture(GL_TEXTURE_2D, 0); + + // Attach our texture to FBO + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id, 0); + + // We read data as RGBA because FBO texture is configured as RGBA, despite binding another texture format + pixels = (unsigned char *)RL_MALLOC(rlGetPixelDataSize(width, height, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)); + glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + // Clean up temporal fbo + rlUnloadFramebuffer(fboId); +#endif + + return pixels; +} + +// Read screen pixel data (color buffer) +unsigned char *rlReadScreenPixels(int width, int height) +{ + unsigned char *screenData = (unsigned char *)RL_CALLOC(width*height*4, sizeof(unsigned char)); + + // NOTE 1: glReadPixels returns image flipped vertically -> (0,0) is the bottom left corner of the framebuffer + // NOTE 2: We are getting alpha channel! Be careful, it can be transparent if not cleared properly! + glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, screenData); + + // Flip image vertically! + unsigned char *imgData = (unsigned char *)RL_MALLOC(width*height*4*sizeof(unsigned char)); + + for (int y = height - 1; y >= 0; y--) + { + for (int x = 0; x < (width*4); x++) + { + imgData[((height - 1) - y)*width*4 + x] = screenData[(y*width*4) + x]; // Flip line + + // Set alpha component value to 255 (no trasparent image retrieval) + // NOTE: Alpha value has already been applied to RGB in framebuffer, we don't need it! + if (((x + 1)%4) == 0) imgData[((height - 1) - y)*width*4 + x] = 255; + } + } + + RL_FREE(screenData); + + return imgData; // NOTE: image data should be freed +} + +// Framebuffer management (fbo) +//----------------------------------------------------------------------------------------- +// Load a framebuffer to be used for rendering +// NOTE: No textures attached +unsigned int rlLoadFramebuffer(int width, int height) +{ + unsigned int fboId = 0; + +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(RLGL_RENDER_TEXTURES_HINT) + glGenFramebuffers(1, &fboId); // Create the framebuffer object + glBindFramebuffer(GL_FRAMEBUFFER, 0); // Unbind any framebuffer +#endif + + return fboId; +} + +// Attach color buffer texture to an fbo (unloads previous attachment) +// NOTE: Attach type: 0-Color, 1-Depth renderbuffer, 2-Depth texture +void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType, int texType, int mipLevel) +{ +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(RLGL_RENDER_TEXTURES_HINT) + glBindFramebuffer(GL_FRAMEBUFFER, fboId); + + switch (attachType) + { + case RL_ATTACHMENT_COLOR_CHANNEL0: + case RL_ATTACHMENT_COLOR_CHANNEL1: + case RL_ATTACHMENT_COLOR_CHANNEL2: + case RL_ATTACHMENT_COLOR_CHANNEL3: + case RL_ATTACHMENT_COLOR_CHANNEL4: + case RL_ATTACHMENT_COLOR_CHANNEL5: + case RL_ATTACHMENT_COLOR_CHANNEL6: + case RL_ATTACHMENT_COLOR_CHANNEL7: + { + if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_TEXTURE_2D, texId, mipLevel); + else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_RENDERBUFFER, texId); + else if (texType >= RL_ATTACHMENT_CUBEMAP_POSITIVE_X) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + attachType, GL_TEXTURE_CUBE_MAP_POSITIVE_X + texType, texId, mipLevel); + + } break; + case RL_ATTACHMENT_DEPTH: + { + if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, texId, mipLevel); + else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, texId); + + } break; + case RL_ATTACHMENT_STENCIL: + { + if (texType == RL_ATTACHMENT_TEXTURE2D) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, texId, mipLevel); + else if (texType == RL_ATTACHMENT_RENDERBUFFER) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, texId); + + } break; + default: break; + } + + glBindFramebuffer(GL_FRAMEBUFFER, 0); +#endif +} + +// Verify render texture is complete +bool rlFramebufferComplete(unsigned int id) +{ + bool result = false; + +#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(RLGL_RENDER_TEXTURES_HINT) + glBindFramebuffer(GL_FRAMEBUFFER, id); + + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + + if (status != GL_FRAMEBUFFER_COMPLETE) + { + switch (status) + { + case GL_FRAMEBUFFER_UNSUPPORTED: TRACELOG(RL_LOG_WARNING, "FBO: [ID %i] Framebuffer is unsupported", id); break; + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: TRACELOG(RL_LOG_WARNING, "FBO: [ID %i] Framebuffer has incomplete attachment", id); break; +#if defined(GRAPHICS_API_OPENGL_ES2) + case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: TRACELOG(RL_LOG_WARNING, "FBO: [ID %i] Framebuffer has incomplete dimensions", id); break; +#endif + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: TRACELOG(RL_LOG_WARNING, "FBO: [ID %i] Framebuffer has a missing attachment", id); break; + default: break; + } + } + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + result = (status == GL_FRAMEBUFFER_COMPLETE); +#endif + + return result; +} + +// Unload framebuffer from GPU memory +// NOTE: All attached textures/cubemaps/renderbuffers are also deleted +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); + glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depthId); + + unsigned int depthIdU = (unsigned int)depthId; + if (depthType == GL_RENDERBUFFER) glDeleteRenderbuffers(1, &depthIdU); + else if (depthType == GL_RENDERBUFFER) 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. + + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glDeleteFramebuffers(1, &id); + + TRACELOG(RL_LOG_INFO, "FBO: [ID %i] Unloaded framebuffer from VRAM (GPU)", id); +#endif +} + +// Vertex data management +//----------------------------------------------------------------------------------------- +// Load a new attributes buffer +unsigned int rlLoadVertexBuffer(const void *buffer, int size, bool dynamic) +{ + unsigned int id = 0; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glGenBuffers(1, &id); + glBindBuffer(GL_ARRAY_BUFFER, id); + glBufferData(GL_ARRAY_BUFFER, size, buffer, dynamic? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); +#endif + + return id; +} + +// Load a new attributes element buffer +unsigned int rlLoadVertexBufferElement(const void *buffer, int size, bool dynamic) +{ + unsigned int id = 0; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glGenBuffers(1, &id); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, buffer, dynamic? GL_DYNAMIC_DRAW : GL_STATIC_DRAW); +#endif + + return id; +} + +// Enable vertex buffer (VBO) +void rlEnableVertexBuffer(unsigned int id) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glBindBuffer(GL_ARRAY_BUFFER, id); +#endif +} + +// Disable vertex buffer (VBO) +void rlDisableVertexBuffer(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glBindBuffer(GL_ARRAY_BUFFER, 0); +#endif +} + +// Enable vertex buffer element (VBO element) +void rlEnableVertexBufferElement(unsigned int id) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id); +#endif +} + +// Disable vertex buffer element (VBO element) +void rlDisableVertexBufferElement(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); +#endif +} + +// Update vertex buffer with new data +// NOTE: dataSize and offset must be provided in bytes +void rlUpdateVertexBuffer(unsigned int id, const void *data, int dataSize, int offset) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glBindBuffer(GL_ARRAY_BUFFER, id); + glBufferSubData(GL_ARRAY_BUFFER, offset, dataSize, data); +#endif +} + +// Update vertex buffer elements with new data +// NOTE: dataSize and offset must be provided in bytes +void rlUpdateVertexBufferElements(unsigned int id, const void *data, int dataSize, int offset) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id); + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, offset, dataSize, data); +#endif +} + +// Enable vertex array object (VAO) +bool rlEnableVertexArray(unsigned int vaoId) +{ + bool result = false; +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if (RLGL.ExtSupported.vao) + { + glBindVertexArray(vaoId); + result = true; + } +#endif + return result; +} + +// Disable vertex array object (VAO) +void rlDisableVertexArray(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if (RLGL.ExtSupported.vao) glBindVertexArray(0); +#endif +} + +// Enable vertex attribute index +void rlEnableVertexAttribute(unsigned int index) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glEnableVertexAttribArray(index); +#endif +} + +// Disable vertex attribute index +void rlDisableVertexAttribute(unsigned int index) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glDisableVertexAttribArray(index); +#endif +} + +// Draw vertex array +void rlDrawVertexArray(int offset, int count) +{ + glDrawArrays(GL_TRIANGLES, offset, 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); +} + +// 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); +#endif +} + +// Draw vertex array elements instanced +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); +#endif +} + +#if defined(GRAPHICS_API_OPENGL_11) +// Enable vertex state pointer +void rlEnableStatePointer(int vertexAttribType, void *buffer) +{ + if (buffer != NULL) glEnableClientState(vertexAttribType); + switch (vertexAttribType) + { + case GL_VERTEX_ARRAY: glVertexPointer(3, GL_FLOAT, 0, buffer); break; + case GL_TEXTURE_COORD_ARRAY: glTexCoordPointer(2, GL_FLOAT, 0, buffer); break; + case GL_NORMAL_ARRAY: if (buffer != NULL) glNormalPointer(GL_FLOAT, 0, buffer); break; + case GL_COLOR_ARRAY: if (buffer != NULL) glColorPointer(4, GL_UNSIGNED_BYTE, 0, buffer); break; + //case GL_INDEX_ARRAY: if (buffer != NULL) glIndexPointer(GL_SHORT, 0, buffer); break; // Indexed colors + default: break; + } +} + +// Disable vertex state pointer +void rlDisableStatePointer(int vertexAttribType) +{ + glDisableClientState(vertexAttribType); +} +#endif + +// Load vertex array object (VAO) +unsigned int rlLoadVertexArray(void) +{ + unsigned int vaoId = 0; +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if (RLGL.ExtSupported.vao) + { + glGenVertexArrays(1, &vaoId); + } +#endif + return vaoId; +} + +// Set vertex attribute +void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool normalized, int stride, const void *pointer) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glVertexAttribPointer(index, compSize, type, normalized, stride, pointer); +#endif +} + +// Set vertex attribute divisor +void rlSetVertexAttributeDivisor(unsigned int index, int divisor) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glVertexAttribDivisor(index, divisor); +#endif +} + +// Unload vertex array object (VAO) +void rlUnloadVertexArray(unsigned int vaoId) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if (RLGL.ExtSupported.vao) + { + glBindVertexArray(0); + glDeleteVertexArrays(1, &vaoId); + TRACELOG(RL_LOG_INFO, "VAO: [ID %i] Unloaded vertex array data from VRAM (GPU)", vaoId); + } +#endif +} + +// Unload vertex buffer (VBO) +void rlUnloadVertexBuffer(unsigned int vboId) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glDeleteBuffers(1, &vboId); + //TRACELOG(RL_LOG_INFO, "VBO: Unloaded vertex data from VRAM (GPU)"); +#endif +} + +// Shaders management +//----------------------------------------------------------------------------------------------- +// Load shader from code strings +// NOTE: If shader string is NULL, using default vertex/fragment shaders +unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode) +{ + unsigned int id = 0; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + unsigned int vertexShaderId = 0; + unsigned int fragmentShaderId = 0; + + // Compile vertex shader (if provided) + 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; + + // Compile fragment shader (if provided) + 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; + + // 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 + { + // One of or both shader are new, we need to compile a new shader program + id = rlLoadShaderProgram(vertexShaderId, fragmentShaderId); + + // We can detach and delete vertex/fragment shaders (if not default ones) + // NOTE: We detach shader before deletion to make sure memory is freed + if (vertexShaderId != RLGL.State.defaultVShaderId) + { + glDetachShader(id, vertexShaderId); + glDeleteShader(vertexShaderId); + } + if (fragmentShaderId != RLGL.State.defaultFShaderId) + { + glDetachShader(id, fragmentShaderId); + glDeleteShader(fragmentShaderId); + } + + // In case shader program loading failed, we assign default shader + if (id == 0) + { + // In case shader loading fails, we return the default shader + TRACELOG(RL_LOG_WARNING, "SHADER: Failed to load custom shader code, using default shader"); + id = RLGL.State.defaultShaderId; + } + /* + else + { + // Get available shader uniforms + // NOTE: This information is useful for debug... + int uniformCount = -1; + glGetProgramiv(id, GL_ACTIVE_UNIFORMS, &uniformCount); + + for (int i = 0; i < uniformCount; i++) + { + int namelen = -1; + int num = -1; + char name[256] = { 0 }; // Assume no variable names longer than 256 + GLenum type = GL_ZERO; + + // Get the name of the uniforms + glGetActiveUniform(id, i, sizeof(name) - 1, &namelen, &num, &type, name); + + name[namelen] = 0; + TRACELOGD("SHADER: [ID %i] Active uniform (%s) set at location: %i", id, name, glGetUniformLocation(id, name)); + } + } + */ + } +#endif + + return id; +} + +// Compile custom shader and return shader id +unsigned int rlCompileShader(const char *shaderCode, int type) +{ + unsigned int shader = 0; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + shader = glCreateShader(type); + glShaderSource(shader, 1, &shaderCode, NULL); + + GLint success = 0; + glCompileShader(shader); + glGetShaderiv(shader, GL_COMPILE_STATUS, &success); + + if (success == GL_FALSE) + { + switch (type) + { + case GL_VERTEX_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to compile vertex shader code", shader); break; + case GL_FRAGMENT_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to compile fragment shader code", shader); break; + //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; + #endif + default: break; + } + + int maxLength = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength); + + if (maxLength > 0) + { + int length = 0; + char *log = (char *)RL_CALLOC(maxLength, sizeof(char)); + glGetShaderInfoLog(shader, maxLength, &length, log); + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Compile error: %s", shader, log); + RL_FREE(log); + } + } + else + { + switch (type) + { + case GL_VERTEX_SHADER: TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Vertex shader compiled successfully", shader); break; + case GL_FRAGMENT_SHADER: TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Fragment shader compiled successfully", shader); break; + //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; + #endif + default: break; + } + } +#endif + + return shader; +} + +// Load custom shader strings and return program id +unsigned int rlLoadShaderProgram(unsigned int vShaderId, unsigned int fShaderId) +{ + unsigned int program = 0; + +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + GLint success = 0; + program = glCreateProgram(); + + glAttachShader(program, vShaderId); + glAttachShader(program, fShaderId); + + // NOTE: Default attribute shader locations must be binded 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); + + // NOTE: If some attrib name is no found on the shader, it locations becomes -1 + + glLinkProgram(program); + + // NOTE: All uniform variables are intitialised to 0 when a program links + + glGetProgramiv(program, GL_LINK_STATUS, &success); + + if (success == GL_FALSE) + { + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to link shader program", program); + + int maxLength = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength); + + if (maxLength > 0) + { + int length = 0; + char *log = (char *)RL_CALLOC(maxLength, sizeof(char)); + glGetProgramInfoLog(program, maxLength, &length, log); + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Link error: %s", program, log); + RL_FREE(log); + } + + glDeleteProgram(program); + + program = 0; + } + 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. + //GLint binarySize = 0; + //glGetProgramiv(id, GL_PROGRAM_BINARY_LENGTH, &binarySize); + + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Program shader loaded successfully", program); + } +#endif + return program; +} + +// Unload shader program +void rlUnloadShaderProgram(unsigned int id) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + glDeleteProgram(id); + + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Unloaded shader program data from VRAM (GPU)", id); +#endif +} + +// Get shader location uniform +int rlGetLocationUniform(unsigned int shaderId, const char *uniformName) +{ + int location = -1; +#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); +#endif + return location; +} + +// Get shader location attribute +int rlGetLocationAttrib(unsigned int shaderId, const char *attribName) +{ + int location = -1; +#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); +#endif + return location; +} + +// Set shader value uniform +void rlSetUniform(int locIndex, const void *value, int uniformType, int count) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + switch (uniformType) + { + case RL_SHADER_UNIFORM_FLOAT: glUniform1fv(locIndex, count, (float *)value); break; + case RL_SHADER_UNIFORM_VEC2: glUniform2fv(locIndex, count, (float *)value); break; + case RL_SHADER_UNIFORM_VEC3: glUniform3fv(locIndex, count, (float *)value); break; + case RL_SHADER_UNIFORM_VEC4: glUniform4fv(locIndex, count, (float *)value); break; + case RL_SHADER_UNIFORM_INT: glUniform1iv(locIndex, count, (int *)value); break; + 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; + 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"); + } +#endif +} + +// Set shader value attribute +void rlSetVertexAttributeDefault(int locIndex, const void *value, int attribType, int count) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + switch (attribType) + { + case RL_SHADER_ATTRIB_FLOAT: if (count == 1) glVertexAttrib1fv(locIndex, (float *)value); break; + case RL_SHADER_ATTRIB_VEC2: if (count == 2) glVertexAttrib2fv(locIndex, (float *)value); break; + case RL_SHADER_ATTRIB_VEC3: if (count == 3) glVertexAttrib3fv(locIndex, (float *)value); break; + case RL_SHADER_ATTRIB_VEC4: if (count == 4) glVertexAttrib4fv(locIndex, (float *)value); break; + default: TRACELOG(RL_LOG_WARNING, "SHADER: Failed to set attrib default value, data type not recognized"); + } +#endif +} + +// Set shader value uniform matrix +void rlSetUniformMatrix(int locIndex, Matrix mat) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + float matfloat[16] = { + mat.m0, mat.m1, mat.m2, mat.m3, + mat.m4, mat.m5, mat.m6, mat.m7, + mat.m8, mat.m9, mat.m10, mat.m11, + mat.m12, mat.m13, mat.m14, mat.m15 + }; + glUniformMatrix4fv(locIndex, 1, false, matfloat); +#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; + + // Register a new active texture for the internal batch system + // NOTE: Default texture is always activated as GL_TEXTURE0 + for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) + { + if (RLGL.State.activeTextureId[i] == 0) + { + glUniform1i(locIndex, 1 + i); // Activate new texture unit + RLGL.State.activeTextureId[i] = textureId; // Save texture id for binding on drawing + break; + } + } +#endif +} + +// Set shader currently active (id and locations) +void rlSetShader(unsigned int id, int *locs) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + if (RLGL.State.currentShaderId != id) + { + rlDrawRenderBatch(RLGL.currentBatch); + RLGL.State.currentShaderId = id; + RLGL.State.currentShaderLocs = locs; + } +#endif +} + +// Load compute shader program +unsigned int rlLoadComputeShaderProgram(unsigned int shaderId) +{ + unsigned int program = 0; + +#if defined(GRAPHICS_API_OPENGL_43) + GLint success = 0; + program = glCreateProgram(); + glAttachShader(program, shaderId); + glLinkProgram(program); + + // NOTE: All uniform variables are intitialised to 0 when a program links + + glGetProgramiv(program, GL_LINK_STATUS, &success); + + if (success == GL_FALSE) + { + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to link compute shader program", program); + + int maxLength = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength); + + if (maxLength > 0) + { + int length = 0; + char *log = (char *)RL_CALLOC(maxLength, sizeof(char)); + glGetProgramInfoLog(program, maxLength, &length, log); + TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Link error: %s", program, log); + RL_FREE(log); + } + + glDeleteProgram(program); + + program = 0; + } + 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. + //GLint binarySize = 0; + //glGetProgramiv(id, GL_PROGRAM_BINARY_LENGTH, &binarySize); + + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Compute shader program loaded successfully", program); + } +#endif + + return program; +} + +// Dispatch compute shader (equivalent to *draw* for graphics pilepine) +void rlComputeShaderDispatch(unsigned int groupX, unsigned int groupY, unsigned int groupZ) +{ +#if defined(GRAPHICS_API_OPENGL_43) + glDispatchCompute(groupX, groupY, groupZ); +#endif +} + +// Load shader storage buffer object (SSBO) +unsigned int rlLoadShaderBuffer(unsigned long long size, const void *data, int usageHint) +{ + unsigned int ssbo = 0; + +#if defined(GRAPHICS_API_OPENGL_43) + 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); + glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); +#endif + + return ssbo; +} + +// Unload shader storage buffer object (SSBO) +void rlUnloadShaderBuffer(unsigned int ssboId) +{ +#if defined(GRAPHICS_API_OPENGL_43) + glDeleteBuffers(1, &ssboId); +#endif +} + +// Update SSBO buffer data +void rlUpdateShaderBufferElements(unsigned int id, const void *data, unsigned long long dataSize, unsigned long long offset) +{ +#if defined(GRAPHICS_API_OPENGL_43) + glBindBuffer(GL_SHADER_STORAGE_BUFFER, id); + glBufferSubData(GL_SHADER_STORAGE_BUFFER, offset, dataSize, data); +#endif +} + +// Get SSBO buffer size +unsigned long long rlGetShaderBufferSize(unsigned int id) +{ + long long size = 0; + +#if defined(GRAPHICS_API_OPENGL_43) + glBindBuffer(GL_SHADER_STORAGE_BUFFER, id); + glGetInteger64v(GL_SHADER_STORAGE_BUFFER_SIZE, &size); +#endif + + return (size > 0)? size : 0; +} + +// Read SSBO buffer data +void rlReadShaderBufferElements(unsigned int id, void *dest, unsigned long long count, unsigned long long offset) +{ +#if defined(GRAPHICS_API_OPENGL_43) + glBindBuffer(GL_SHADER_STORAGE_BUFFER, id); + glGetBufferSubData(GL_SHADER_STORAGE_BUFFER, offset, count, dest); +#endif +} + +// Bind SSBO buffer +void rlBindShaderBuffer(unsigned int id, unsigned int index) +{ +#if defined(GRAPHICS_API_OPENGL_43) + glBindBufferBase(GL_SHADER_STORAGE_BUFFER, index, id); +#endif +} + +// Copy SSBO buffer data +void rlCopyBuffersElements(unsigned int destId, unsigned int srcId, unsigned long long destOffset, unsigned long long srcOffset, unsigned long long count) +{ +#if defined(GRAPHICS_API_OPENGL_43) + glBindBuffer(GL_COPY_READ_BUFFER, srcId); + glBindBuffer(GL_COPY_WRITE_BUFFER, destId); + glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, srcOffset, destOffset, count); +#endif +} + +// Bind image texture +void rlBindImageTexture(unsigned int id, unsigned int index, unsigned int format, int readonly) +{ +#if defined(GRAPHICS_API_OPENGL_43) + 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); +#endif +} + +// Matrix state management +//----------------------------------------------------------------------------------------- +// Get internal modelview matrix +Matrix rlGetMatrixModelview(void) +{ + Matrix matrix = rlMatrixIdentity(); +#if defined(GRAPHICS_API_OPENGL_11) + float mat[16]; + glGetFloatv(GL_MODELVIEW_MATRIX, mat); + matrix.m0 = mat[0]; + matrix.m1 = mat[1]; + matrix.m2 = mat[2]; + matrix.m3 = mat[3]; + matrix.m4 = mat[4]; + matrix.m5 = mat[5]; + matrix.m6 = mat[6]; + matrix.m7 = mat[7]; + matrix.m8 = mat[8]; + matrix.m9 = mat[9]; + matrix.m10 = mat[10]; + matrix.m11 = mat[11]; + matrix.m12 = mat[12]; + matrix.m13 = mat[13]; + matrix.m14 = mat[14]; + matrix.m15 = mat[15]; +#else + matrix = RLGL.State.modelview; +#endif + return matrix; +} + +// Get internal projection matrix +Matrix rlGetMatrixProjection(void) +{ +#if defined(GRAPHICS_API_OPENGL_11) + float mat[16]; + glGetFloatv(GL_PROJECTION_MATRIX,mat); + Matrix m; + m.m0 = mat[0]; + m.m1 = mat[1]; + m.m2 = mat[2]; + m.m3 = mat[3]; + m.m4 = mat[4]; + m.m5 = mat[5]; + m.m6 = mat[6]; + m.m7 = mat[7]; + m.m8 = mat[8]; + m.m9 = mat[9]; + m.m10 = mat[10]; + m.m11 = mat[11]; + m.m12 = mat[12]; + m.m13 = mat[13]; + m.m14 = mat[14]; + m.m15 = mat[15]; + return m; +#else + return RLGL.State.projection; +#endif +} + +// Get internal accumulated transform matrix +Matrix rlGetMatrixTransform(void) +{ + Matrix mat = rlMatrixIdentity(); +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + // TODO: Consider possible transform matrices in the RLGL.State.stack + // Is this the right order? or should we start with the first stored matrix instead of the last one? + //Matrix matStackTransform = rlMatrixIdentity(); + //for (int i = RLGL.State.stackCounter; i > 0; i--) matStackTransform = rlMatrixMultiply(RLGL.State.stack[i], matStackTransform); + mat = RLGL.State.transform; +#endif + return mat; +} + +// Get internal projection matrix for stereo render (selected eye) +RLAPI Matrix rlGetMatrixProjectionStereo(int eye) +{ + Matrix mat = rlMatrixIdentity(); +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + mat = RLGL.State.projectionStereo[eye]; +#endif + return mat; +} + +// Get internal view offset matrix for stereo render (selected eye) +RLAPI Matrix rlGetMatrixViewOffsetStereo(int eye) +{ + Matrix mat = rlMatrixIdentity(); +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + mat = RLGL.State.viewOffsetStereo[eye]; +#endif + return mat; +} + +// Set a custom modelview matrix (replaces internal modelview matrix) +void rlSetMatrixModelview(Matrix view) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + RLGL.State.modelview = view; +#endif +} + +// Set a custom projection matrix (replaces internal projection matrix) +void rlSetMatrixProjection(Matrix projection) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + RLGL.State.projection = projection; +#endif +} + +// Set eyes projection matrices for stereo rendering +void rlSetMatrixProjectionStereo(Matrix right, Matrix left) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + RLGL.State.projectionStereo[0] = right; + RLGL.State.projectionStereo[1] = left; +#endif +} + +// Set eyes view offsets matrices for stereo rendering +void rlSetMatrixViewOffsetStereo(Matrix right, Matrix left) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + RLGL.State.viewOffsetStereo[0] = right; + RLGL.State.viewOffsetStereo[1] = left; +#endif +} + +// Load and draw a quad in NDC +void rlLoadDrawQuad(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + unsigned int quadVAO = 0; + unsigned int quadVBO = 0; + + float vertices[] = { + // Positions Texcoords + -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, + -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, + 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, + 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, + }; + + // Gen VAO to contain VBO + glGenVertexArrays(1, &quadVAO); + glBindVertexArray(quadVAO); + + // Gen and fill vertex buffer (VBO) + glGenBuffers(1, &quadVBO); + glBindBuffer(GL_ARRAY_BUFFER, quadVBO); + 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 + + // Draw quad + glBindVertexArray(quadVAO); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glBindVertexArray(0); + + // Delete buffers (VBO and VAO) + glDeleteBuffers(1, &quadVBO); + glDeleteVertexArrays(1, &quadVAO); +#endif +} + +// Load and draw a cube in NDC +void rlLoadDrawCube(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + unsigned int cubeVAO = 0; + unsigned int cubeVBO = 0; + + float vertices[] = { + // Positions Normals Texcoords + -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, + 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, + 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, + -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, + -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, + -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, + 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, + -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, + -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, + -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, + -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, + -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, + -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, + -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, + 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, + 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, + 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, + 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, + 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, + -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, + 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, + 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, + 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, + -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, + -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, + -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, + 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, + -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, + -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f + }; + + // Gen VAO to contain VBO + glGenVertexArrays(1, &cubeVAO); + glBindVertexArray(cubeVAO); + + // Gen and fill vertex buffer (VBO) + glGenBuffers(1, &cubeVBO); + glBindBuffer(GL_ARRAY_BUFFER, cubeVBO); + glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); + + // 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 + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindVertexArray(0); + + // Draw cube + glBindVertexArray(cubeVAO); + glDrawArrays(GL_TRIANGLES, 0, 36); + glBindVertexArray(0); + + // Delete VBO and VAO + glDeleteBuffers(1, &cubeVBO); + glDeleteVertexArrays(1, &cubeVAO); +#endif +} + +// Get name string for pixel format +const char *rlGetPixelFormatName(unsigned int format) +{ + switch (format) + { + case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: return "GRAYSCALE"; break; // 8 bit per pixel (no alpha) + case RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: return "GRAY_ALPHA"; break; // 8*2 bpp (2 channels) + case RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: return "R5G6B5"; break; // 16 bpp + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: return "R8G8B8"; break; // 24 bpp + case RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: return "R5G5B5A1"; break; // 16 bpp (1 bit alpha) + case RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: return "R4G4B4A4"; break; // 16 bpp (4 bit alpha) + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: return "R8G8B8A8"; break; // 32 bpp + 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_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 + case RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: return "DXT5_RGBA"; break; // 8 bpp + case RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: return "ETC1_RGB"; break; // 4 bpp + case RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: return "ETC2_RGB"; break; // 4 bpp + case RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: return "ETC2_RGBA"; break; // 8 bpp + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: return "PVRT_RGB"; break; // 4 bpp + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: return "PVRT_RGBA"; break; // 4 bpp + case RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: return "ASTC_4x4_RGBA"; break; // 8 bpp + case RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: return "ASTC_8x8_RGBA"; break; // 2 bpp + default: return "UNKNOWN"; break; + } +} + +//---------------------------------------------------------------------------------- +// Module specific Functions Definition +//---------------------------------------------------------------------------------- +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +// Load default shader (just vertex positioning and texture coloring) +// NOTE: This shader program is used for internal buffers +// NOTE: Loaded: RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs +static void rlLoadShaderDefault(void) +{ + RLGL.State.defaultShaderLocs = (int *)RL_CALLOC(RL_MAX_SHADER_LOCATIONS, sizeof(int)); + + // NOTE: All locations must be reseted to -1 (no location) + for (int i = 0; i < RL_MAX_SHADER_LOCATIONS; i++) RLGL.State.defaultShaderLocs[i] = -1; + + // Vertex shader directly defined, no external file required + const char *defaultVShaderCode = +#if defined(GRAPHICS_API_OPENGL_21) + "#version 120 \n" + "attribute vec3 vertexPosition; \n" + "attribute vec2 vertexTexCoord; \n" + "attribute vec4 vertexColor; \n" + "varying vec2 fragTexCoord; \n" + "varying vec4 fragColor; \n" +#elif defined(GRAPHICS_API_OPENGL_33) + "#version 330 \n" + "in vec3 vertexPosition; \n" + "in vec2 vertexTexCoord; \n" + "in vec4 vertexColor; \n" + "out vec2 fragTexCoord; \n" + "out vec4 fragColor; \n" +#endif +#if defined(GRAPHICS_API_OPENGL_ES2) + "#version 100 \n" + "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" + " fragTexCoord = vertexTexCoord; \n" + " fragColor = vertexColor; \n" + " gl_Position = mvp*vec4(vertexPosition, 1.0); \n" + "} \n"; + + // Fragment shader directly defined, no external file required + const char *defaultFShaderCode = +#if defined(GRAPHICS_API_OPENGL_21) + "#version 120 \n" + "varying vec2 fragTexCoord; \n" + "varying vec4 fragColor; \n" + "uniform sampler2D texture0; \n" + "uniform vec4 colDiffuse; \n" + "void main() \n" + "{ \n" + " vec4 texelColor = texture2D(texture0, fragTexCoord); \n" + " gl_FragColor = texelColor*colDiffuse*fragColor; \n" + "} \n"; +#elif defined(GRAPHICS_API_OPENGL_33) + "#version 330 \n" + "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"; +#endif +#if defined(GRAPHICS_API_OPENGL_ES2) + "#version 100 \n" + "precision mediump float; \n" // Precision required for OpenGL ES2 (WebGL) + "varying vec2 fragTexCoord; \n" + "varying vec4 fragColor; \n" + "uniform sampler2D texture0; \n" + "uniform vec4 colDiffuse; \n" + "void main() \n" + "{ \n" + " vec4 texelColor = texture2D(texture0, fragTexCoord); \n" + " gl_FragColor = texelColor*colDiffuse*fragColor; \n" + "} \n"; +#endif + + // NOTE: Compiled vertex/fragment shaders are not deleted, + // they are kept for re-use as default shaders in case some shader loading fails + RLGL.State.defaultVShaderId = rlCompileShader(defaultVShaderCode, GL_VERTEX_SHADER); // Compile default vertex shader + RLGL.State.defaultFShaderId = rlCompileShader(defaultFShaderCode, GL_FRAGMENT_SHADER); // Compile default fragment shader + + RLGL.State.defaultShaderId = rlLoadShaderProgram(RLGL.State.defaultVShaderId, RLGL.State.defaultFShaderId); + + if (RLGL.State.defaultShaderId > 0) + { + 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"); + + // 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"); + } + else TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to load default shader", RLGL.State.defaultShaderId); +} + +// Unload default shader +// NOTE: Unloads: RLGL.State.defaultShaderId, RLGL.State.defaultShaderLocs +static void rlUnloadShaderDefault(void) +{ + glUseProgram(0); + + glDetachShader(RLGL.State.defaultShaderId, RLGL.State.defaultVShaderId); + glDetachShader(RLGL.State.defaultShaderId, RLGL.State.defaultFShaderId); + glDeleteShader(RLGL.State.defaultVShaderId); + glDeleteShader(RLGL.State.defaultFShaderId); + + glDeleteProgram(RLGL.State.defaultShaderId); + + RL_FREE(RLGL.State.defaultShaderLocs); + + TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Default shader unloaded successfully", RLGL.State.defaultShaderId); +} + +#if defined(RLGL_SHOW_GL_DETAILS_INFO) +// Get compressed format official GL identifier name +static char *rlGetCompressedFormatName(int format) +{ + switch (format) + { + // GL_EXT_texture_compression_s3tc + case 0x83F0: return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT"; break; + case 0x83F1: return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT"; break; + case 0x83F2: return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT"; break; + case 0x83F3: return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT"; break; + // GL_3DFX_texture_compression_FXT1 + case 0x86B0: return "GL_COMPRESSED_RGB_FXT1_3DFX"; break; + case 0x86B1: return "GL_COMPRESSED_RGBA_FXT1_3DFX"; break; + // GL_IMG_texture_compression_pvrtc + case 0x8C00: return "GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG"; break; + case 0x8C01: return "GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG"; break; + case 0x8C02: return "GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"; break; + case 0x8C03: return "GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"; break; + // GL_OES_compressed_ETC1_RGB8_texture + case 0x8D64: return "GL_ETC1_RGB8_OES"; break; + // GL_ARB_texture_compression_rgtc + case 0x8DBB: return "GL_COMPRESSED_RED_RGTC1"; break; + case 0x8DBC: return "GL_COMPRESSED_SIGNED_RED_RGTC1"; break; + case 0x8DBD: return "GL_COMPRESSED_RG_RGTC2"; break; + case 0x8DBE: return "GL_COMPRESSED_SIGNED_RG_RGTC2"; break; + // GL_ARB_texture_compression_bptc + case 0x8E8C: return "GL_COMPRESSED_RGBA_BPTC_UNORM_ARB"; break; + case 0x8E8D: return "GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB"; break; + case 0x8E8E: return "GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB"; break; + case 0x8E8F: return "GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB"; break; + // GL_ARB_ES3_compatibility + case 0x9274: return "GL_COMPRESSED_RGB8_ETC2"; break; + case 0x9275: return "GL_COMPRESSED_SRGB8_ETC2"; break; + case 0x9276: return "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"; break; + case 0x9277: return "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"; break; + case 0x9278: return "GL_COMPRESSED_RGBA8_ETC2_EAC"; break; + case 0x9279: return "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"; break; + case 0x9270: return "GL_COMPRESSED_R11_EAC"; break; + case 0x9271: return "GL_COMPRESSED_SIGNED_R11_EAC"; break; + case 0x9272: return "GL_COMPRESSED_RG11_EAC"; break; + case 0x9273: return "GL_COMPRESSED_SIGNED_RG11_EAC"; break; + // GL_KHR_texture_compression_astc_hdr + case 0x93B0: return "GL_COMPRESSED_RGBA_ASTC_4x4_KHR"; break; + case 0x93B1: return "GL_COMPRESSED_RGBA_ASTC_5x4_KHR"; break; + case 0x93B2: return "GL_COMPRESSED_RGBA_ASTC_5x5_KHR"; break; + case 0x93B3: return "GL_COMPRESSED_RGBA_ASTC_6x5_KHR"; break; + case 0x93B4: return "GL_COMPRESSED_RGBA_ASTC_6x6_KHR"; break; + case 0x93B5: return "GL_COMPRESSED_RGBA_ASTC_8x5_KHR"; break; + case 0x93B6: return "GL_COMPRESSED_RGBA_ASTC_8x6_KHR"; break; + case 0x93B7: return "GL_COMPRESSED_RGBA_ASTC_8x8_KHR"; break; + case 0x93B8: return "GL_COMPRESSED_RGBA_ASTC_10x5_KHR"; break; + case 0x93B9: return "GL_COMPRESSED_RGBA_ASTC_10x6_KHR"; break; + case 0x93BA: return "GL_COMPRESSED_RGBA_ASTC_10x8_KHR"; break; + case 0x93BB: return "GL_COMPRESSED_RGBA_ASTC_10x10_KHR"; break; + case 0x93BC: return "GL_COMPRESSED_RGBA_ASTC_12x10_KHR"; break; + case 0x93BD: return "GL_COMPRESSED_RGBA_ASTC_12x12_KHR"; break; + case 0x93D0: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR"; break; + case 0x93D1: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR"; break; + case 0x93D2: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR"; break; + case 0x93D3: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR"; break; + case 0x93D4: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR"; break; + case 0x93D5: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR"; break; + case 0x93D6: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR"; break; + case 0x93D7: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"; break; + case 0x93D8: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR"; break; + case 0x93D9: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR"; break; + case 0x93DA: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR"; break; + case 0x93DB: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR"; break; + case 0x93DC: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR"; break; + case 0x93DD: return "GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"; break; + default: return "GL_COMPRESSED_UNKNOWN"; break; + } +} +#endif // RLGL_SHOW_GL_DETAILS_INFO + +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 + +#if defined(GRAPHICS_API_OPENGL_11) +// Mipmaps data is generated after image data +// NOTE: Only works with RGBA (4 bytes) data! +static int rlGenTextureMipmapsData(unsigned char *data, int baseWidth, int baseHeight) +{ + int mipmapCount = 1; // Required mipmap levels count (including base level) + int width = baseWidth; + int height = baseHeight; + int size = baseWidth*baseHeight*4; // Size in bytes (will include mipmaps...), RGBA only + + // Count mipmap levels required + while ((width != 1) && (height != 1)) + { + width /= 2; + height /= 2; + + TRACELOGD("TEXTURE: Next mipmap size: %i x %i", width, height); + + mipmapCount++; + + size += (width*height*4); // Add mipmap size (in bytes) + } + + TRACELOGD("TEXTURE: Total mipmaps required: %i", mipmapCount); + TRACELOGD("TEXTURE: Total size of data required: %i", size); + + unsigned char *temp = RL_REALLOC(data, size); + + if (temp != NULL) data = temp; + else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to re-allocate required mipmaps memory"); + + width = baseWidth; + height = baseHeight; + size = (width*height*4); // RGBA: 4 bytes + + // Generate mipmaps + // NOTE: Every mipmap data is stored after data (RGBA - 4 bytes) + unsigned char *image = (unsigned char *)RL_MALLOC(width*height*4); + unsigned char *mipmap = NULL; + int offset = 0; + + for (int i = 0; i < size; i += 4) + { + image[i] = data[i]; + image[i + 1] = data[i + 1]; + image[i + 2] = data[i + 2]; + image[i + 3] = data[i + 3]; + } + + TRACELOGD("TEXTURE: Mipmap base size (%ix%i)", width, height); + + for (int mip = 1; mip < mipmapCount; mip++) + { + mipmap = rlGenNextMipmapData(image, width, height); + + offset += (width*height*4); // Size of last mipmap + + width /= 2; + height /= 2; + size = (width*height*4); // Mipmap size to store after offset + + // Add mipmap to data + for (int i = 0; i < size; i += 4) + { + data[offset + i] = mipmap[i]; + data[offset + i + 1] = mipmap[i + 1]; + data[offset + i + 2] = mipmap[i + 2]; + data[offset + i + 3] = mipmap[i + 3]; + } + + RL_FREE(image); + + image = mipmap; + mipmap = NULL; + } + + RL_FREE(mipmap); // free mipmap data + + return mipmapCount; +} + +// Manual mipmap generation (basic scaling algorithm) +static unsigned char *rlGenNextMipmapData(unsigned char *srcData, int srcWidth, int srcHeight) +{ + int x2 = 0; + int y2 = 0; + unsigned char prow[4] = { 0 }; + unsigned char pcol[4] = { 0 }; + + int width = srcWidth/2; + int height = srcHeight/2; + + unsigned char *mipmap = (unsigned char *)RL_MALLOC(width*height*4); + + // Scaling algorithm works perfectly (box-filter) + for (int y = 0; y < height; y++) + { + y2 = 2*y; + + for (int x = 0; x < width; x++) + { + x2 = 2*x; + + prow[0] = (srcData[(y2*srcWidth + x2)*4 + 0] + srcData[(y2*srcWidth + x2 + 1)*4 + 0])/2; + prow[1] = (srcData[(y2*srcWidth + x2)*4 + 1] + srcData[(y2*srcWidth + x2 + 1)*4 + 1])/2; + prow[2] = (srcData[(y2*srcWidth + x2)*4 + 2] + srcData[(y2*srcWidth + x2 + 1)*4 + 2])/2; + prow[3] = (srcData[(y2*srcWidth + x2)*4 + 3] + srcData[(y2*srcWidth + x2 + 1)*4 + 3])/2; + + pcol[0] = (srcData[((y2 + 1)*srcWidth + x2)*4 + 0] + srcData[((y2 + 1)*srcWidth + x2 + 1)*4 + 0])/2; + pcol[1] = (srcData[((y2 + 1)*srcWidth + x2)*4 + 1] + srcData[((y2 + 1)*srcWidth + x2 + 1)*4 + 1])/2; + pcol[2] = (srcData[((y2 + 1)*srcWidth + x2)*4 + 2] + srcData[((y2 + 1)*srcWidth + x2 + 1)*4 + 2])/2; + pcol[3] = (srcData[((y2 + 1)*srcWidth + x2)*4 + 3] + srcData[((y2 + 1)*srcWidth + x2 + 1)*4 + 3])/2; + + mipmap[(y*width + x)*4 + 0] = (prow[0] + pcol[0])/2; + mipmap[(y*width + x)*4 + 1] = (prow[1] + pcol[1])/2; + mipmap[(y*width + x)*4 + 2] = (prow[2] + pcol[2])/2; + mipmap[(y*width + x)*4 + 3] = (prow[3] + pcol[3])/2; + } + } + + TRACELOGD("TEXTURE: Mipmap generated successfully (%ix%i)", width, height); + + return mipmap; +} +#endif // GRAPHICS_API_OPENGL_11 + +// Get pixel data size in bytes (image or texture) +// NOTE: Size depends on pixel format +static int rlGetPixelDataSize(int width, int height, int format) +{ + int dataSize = 0; // Size in bytes + int bpp = 0; // Bits per pixel + + switch (format) + { + case RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: bpp = 8; break; + case RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: + case RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: + case RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: + case RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: bpp = 16; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: bpp = 32; break; + case RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: bpp = 24; break; + 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_COMPRESSED_DXT1_RGB: + case RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: + case RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: + case RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: + case RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: bpp = 4; break; + case RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: + case RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: + case RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: + case RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: bpp = 8; break; + case RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: bpp = 2; break; + default: break; + } + + dataSize = width*height*bpp/8; // Total data size in bytes + + // Most compressed formats works on 4x4 blocks, + // if texture is smaller, minimum dataSize is 8 or 16 + if ((width < 4) && (height < 4)) + { + if ((format >= RL_PIXELFORMAT_COMPRESSED_DXT1_RGB) && (format < RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA)) dataSize = 8; + else if ((format >= RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA) && (format < RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA)) dataSize = 16; + } + + return dataSize; +} + +// Auxiliar math functions + +// Get identity matrix +static Matrix rlMatrixIdentity(void) +{ + Matrix result = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }; + + return result; +} + +// Get two matrix multiplication +// NOTE: When multiplying matrices... the order matters! +static Matrix rlMatrixMultiply(Matrix left, Matrix right) +{ + Matrix result = { 0 }; + + result.m0 = left.m0*right.m0 + left.m1*right.m4 + left.m2*right.m8 + left.m3*right.m12; + result.m1 = left.m0*right.m1 + left.m1*right.m5 + left.m2*right.m9 + left.m3*right.m13; + result.m2 = left.m0*right.m2 + left.m1*right.m6 + left.m2*right.m10 + left.m3*right.m14; + result.m3 = left.m0*right.m3 + left.m1*right.m7 + left.m2*right.m11 + left.m3*right.m15; + result.m4 = left.m4*right.m0 + left.m5*right.m4 + left.m6*right.m8 + left.m7*right.m12; + result.m5 = left.m4*right.m1 + left.m5*right.m5 + left.m6*right.m9 + left.m7*right.m13; + result.m6 = left.m4*right.m2 + left.m5*right.m6 + left.m6*right.m10 + left.m7*right.m14; + result.m7 = left.m4*right.m3 + left.m5*right.m7 + left.m6*right.m11 + left.m7*right.m15; + result.m8 = left.m8*right.m0 + left.m9*right.m4 + left.m10*right.m8 + left.m11*right.m12; + result.m9 = left.m8*right.m1 + left.m9*right.m5 + left.m10*right.m9 + left.m11*right.m13; + result.m10 = left.m8*right.m2 + left.m9*right.m6 + left.m10*right.m10 + left.m11*right.m14; + result.m11 = left.m8*right.m3 + left.m9*right.m7 + left.m10*right.m11 + left.m11*right.m15; + result.m12 = left.m12*right.m0 + left.m13*right.m4 + left.m14*right.m8 + left.m15*right.m12; + result.m13 = left.m12*right.m1 + left.m13*right.m5 + left.m14*right.m9 + left.m15*right.m13; + result.m14 = left.m12*right.m2 + left.m13*right.m6 + left.m14*right.m10 + left.m15*right.m14; + result.m15 = left.m12*right.m3 + left.m13*right.m7 + left.m14*right.m11 + left.m15*right.m15; + + return result; +} + +#endif // RLGL_IMPLEMENTATION diff --git a/src/generated/node-raylib.cc b/src/generated/node-raylib.cc index 5dfedd0..ebf9421 100644 --- a/src/generated/node-raylib.cc +++ b/src/generated/node-raylib.cc @@ -5,11 +5,13 @@ #include #include #include "raylib.h" -#include "extras/easings.h" #include "raymath.h" +#include "../extras/reasings.h" +#include "../extras/rlgl.h" + #define RAYGUI_IMPLEMENTATION -#include "extras/raygui.h" +#include "../extras/raygui.h" using namespace Napi; @@ -43,6 +45,9 @@ inline Napi::Value ToValue(Napi::Env env, float value) { inline Napi::Value ToValue(Napi::Env env, void * value) { return Napi::Number::New(env, (int64_t) value); } +inline Napi::Value ToValue(Napi::Env env, unsigned long long value) { + return Napi::BigInt::New(env, (uint64_t) value); +} inline float floatFromValue(const Napi::CallbackInfo& info, int index) { return info[index].As().FloatValue(); @@ -62,6 +67,9 @@ inline unsigned char unsignedcharFromValue(const Napi::CallbackInfo& info, int i inline unsigned int unsignedintFromValue(const Napi::CallbackInfo& info, int index) { return info[index].As().Uint32Value(); } +inline unsigned long long unsignedlonglongFromValue(const Napi::CallbackInfo& info, int index) { + return (unsigned long long) info[index].As().Uint64Value(0); +} inline bool boolFromValue(const Napi::CallbackInfo& info, int index) { return info[index].As(); } @@ -329,26 +337,67 @@ inline Wave WaveFromValue(const Napi::CallbackInfo& info, int index) { inline AudioStream AudioStreamFromValue(const Napi::CallbackInfo& info, int index) { return { (rAudioBuffer *) pointerFromValue(info, index + 0), - unsignedintFromValue(info, index + 1), + (rAudioProcessor *) pointerFromValue(info, index + 1), unsignedintFromValue(info, index + 2), - unsignedintFromValue(info, index + 3) + unsignedintFromValue(info, index + 3), + unsignedintFromValue(info, index + 4) }; } inline Sound SoundFromValue(const Napi::CallbackInfo& info, int index) { return { AudioStreamFromValue(info, index + 0), - unsignedintFromValue(info, index + 4) + unsignedintFromValue(info, index + 5) }; } inline Music MusicFromValue(const Napi::CallbackInfo& info, int index) { return { AudioStreamFromValue(info, index + 0), - unsignedintFromValue(info, index + 4), - boolFromValue(info, index + 5), - intFromValue(info, index + 6), - (void *) pointerFromValue(info, index + 7) + unsignedintFromValue(info, index + 5), + boolFromValue(info, index + 6), + intFromValue(info, index + 7), + (void *) pointerFromValue(info, index + 8) + }; +} + +inline FilePathList FilePathListFromValue(const Napi::CallbackInfo& info, int index) { + return { + unsignedintFromValue(info, index + 0), + unsignedintFromValue(info, index + 1), + (char **) pointerFromValue(info, index + 2) + }; +} + +inline rlVertexBuffer rlVertexBufferFromValue(const Napi::CallbackInfo& info, int index) { + return { + intFromValue(info, index + 0), + (float *) pointerFromValue(info, index + 1), + (float *) pointerFromValue(info, index + 2), + (unsigned char *) pointerFromValue(info, index + 3), + (unsigned int *) pointerFromValue(info, index + 4), + unsignedintFromValue(info, index + 5), + (unsigned int) pointerFromValue(info, index + 6) + }; +} + +inline rlDrawCall rlDrawCallFromValue(const Napi::CallbackInfo& info, int index) { + return { + intFromValue(info, index + 0), + intFromValue(info, index + 1), + intFromValue(info, index + 2), + unsignedintFromValue(info, index + 3) + }; +} + +inline rlRenderBatch rlRenderBatchFromValue(const Napi::CallbackInfo& info, int index) { + return { + intFromValue(info, index + 0), + intFromValue(info, index + 1), + (rlVertexBuffer *) pointerFromValue(info, index + 2), + (rlDrawCall *) pointerFromValue(info, index + 3), + intFromValue(info, index + 4), + floatFromValue(info, index + 5) }; } // Convert structs to Napi::Objects for output to JS @@ -604,6 +653,7 @@ inline Napi::Value ToValue(Napi::Env env, Wave obj) { inline Napi::Value ToValue(Napi::Env env, AudioStream obj) { Napi::Object out = Napi::Object::New(env); out.Set("buffer", ToValue(env, obj.buffer)); + out.Set("processor", ToValue(env, obj.processor)); out.Set("sampleRate", ToValue(env, obj.sampleRate)); out.Set("sampleSize", ToValue(env, obj.sampleSize)); out.Set("channels", ToValue(env, obj.channels)); @@ -627,6 +677,46 @@ inline Napi::Value ToValue(Napi::Env env, Music obj) { return out; } +inline Napi::Value ToValue(Napi::Env env, FilePathList obj) { + Napi::Object out = Napi::Object::New(env); + out.Set("capacity", ToValue(env, obj.capacity)); + out.Set("count", ToValue(env, obj.count)); + out.Set("paths", ToValue(env, obj.paths)); + 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("indices", ToValue(env, obj.indices)); + out.Set("vaoId", ToValue(env, obj.vaoId)); + out.Set("vboId", ToValue(env, obj.vboId)); + return out; +} + +inline Napi::Value ToValue(Napi::Env env, rlDrawCall obj) { + Napi::Object out = Napi::Object::New(env); + out.Set("mode", ToValue(env, obj.mode)); + out.Set("vertexCount", ToValue(env, obj.vertexCount)); + out.Set("vertexAlignment", ToValue(env, obj.vertexAlignment)); + out.Set("textureId", ToValue(env, obj.textureId)); + return out; +} + +inline Napi::Value ToValue(Napi::Env env, rlRenderBatch obj) { + Napi::Object out = Napi::Object::New(env); + out.Set("bufferCount", ToValue(env, obj.bufferCount)); + out.Set("currentBuffer", ToValue(env, obj.currentBuffer)); + out.Set("vertexBuffer", ToValue(env, obj.vertexBuffer)); + out.Set("draws", ToValue(env, obj.draws)); + out.Set("drawCounter", ToValue(env, obj.drawCounter)); + out.Set("currentDepth", ToValue(env, obj.currentDepth)); + return out; +} + inline Texture2D Texture2DFromValue(const Napi::CallbackInfo& info, int index) { return (Texture2D) TextureFromValue(info, index); } @@ -735,6 +825,22 @@ Napi::Value BindGetScreenHeight(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGetRenderWidth(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetRenderWidth( + + ) + ); +} + +Napi::Value BindGetRenderHeight(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetRenderHeight( + + ) + ); +} + Napi::Value BindGetMonitorCount(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetMonitorCount( @@ -917,6 +1023,15 @@ 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( @@ -937,15 +1052,6 @@ Napi::Value BindGetWorldToScreen2D(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGetScreenToWorld2D(const Napi::CallbackInfo& info) { - return ToValue(info.Env(), - GetScreenToWorld2D( - Vector2FromValue(info, 0), - Camera2DFromValue(info, 2) - ) - ); -} - Napi::Value BindGetFPS(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetFPS( @@ -1015,6 +1121,16 @@ Napi::Value BindSaveFileData(const Napi::CallbackInfo& info) { ); } +Napi::Value BindExportDataAsCode(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ExportDataAsCode( + (const char *) stringFromValue(info, 0), + unsignedintFromValue(info, 1), + (const char *) stringFromValue(info, 2) + ) + ); +} + Napi::Value BindLoadFileText(const Napi::CallbackInfo& info) { return ToValue(info.Env(), LoadFileText( @@ -1057,6 +1173,14 @@ Napi::Value BindIsFileExtension(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGetFileLength(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetFileLength( + (const char *) stringFromValue(info, 0) + ) + ); +} + Napi::Value BindGetFileExtension(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetFileExtension( @@ -1105,11 +1229,10 @@ Napi::Value BindGetWorkingDirectory(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGetDirectoryFiles(const Napi::CallbackInfo& info) { +Napi::Value BindGetApplicationDirectory(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GetDirectoryFiles( - (const char *) stringFromValue(info, 0), - (int *) pointerFromValue(info, 1) + GetApplicationDirectory( + ) ); } @@ -1122,6 +1245,32 @@ Napi::Value BindChangeDirectory(const Napi::CallbackInfo& info) { ); } +Napi::Value BindIsPathFile(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + IsPathFile( + (const char *) stringFromValue(info, 0) + ) + ); +} + +Napi::Value BindLoadDirectoryFiles(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + LoadDirectoryFiles( + (const char *) stringFromValue(info, 0) + ) + ); +} + +Napi::Value BindLoadDirectoryFilesEx(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + LoadDirectoryFilesEx( + (const char *) stringFromValue(info, 0), + (const char *) stringFromValue(info, 1), + boolFromValue(info, 2) + ) + ); +} + Napi::Value BindIsFileDropped(const Napi::CallbackInfo& info) { return ToValue(info.Env(), IsFileDropped( @@ -1130,10 +1279,10 @@ Napi::Value BindIsFileDropped(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGetDroppedFiles(const Napi::CallbackInfo& info) { +Napi::Value BindLoadDroppedFiles(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - GetDroppedFiles( - (int *) pointerFromValue(info, 0) + LoadDroppedFiles( + ) ); } @@ -1149,7 +1298,7 @@ Napi::Value BindGetFileModTime(const Napi::CallbackInfo& info) { Napi::Value BindCompressData(const Napi::CallbackInfo& info) { return ToValue(info.Env(), CompressData( - (unsigned char *) pointerFromValue(info, 0), + (const unsigned char *) pointerFromValue(info, 0), intFromValue(info, 1), (int *) pointerFromValue(info, 2) ) @@ -1159,7 +1308,7 @@ Napi::Value BindCompressData(const Napi::CallbackInfo& info) { Napi::Value BindDecompressData(const Napi::CallbackInfo& info) { return ToValue(info.Env(), DecompressData( - (unsigned char *) pointerFromValue(info, 0), + (const unsigned char *) pointerFromValue(info, 0), intFromValue(info, 1), (int *) pointerFromValue(info, 2) ) @@ -1179,29 +1328,12 @@ Napi::Value BindEncodeDataBase64(const Napi::CallbackInfo& info) { Napi::Value BindDecodeDataBase64(const Napi::CallbackInfo& info) { return ToValue(info.Env(), DecodeDataBase64( - (unsigned char *) pointerFromValue(info, 0), + (const unsigned char *) pointerFromValue(info, 0), (int *) pointerFromValue(info, 1) ) ); } -Napi::Value BindSaveStorageValue(const Napi::CallbackInfo& info) { - return ToValue(info.Env(), - SaveStorageValue( - unsignedintFromValue(info, 0), - intFromValue(info, 1) - ) - ); -} - -Napi::Value BindLoadStorageValue(const Napi::CallbackInfo& info) { - return ToValue(info.Env(), - LoadStorageValue( - unsignedintFromValue(info, 0) - ) - ); -} - Napi::Value BindIsKeyPressed(const Napi::CallbackInfo& info) { return ToValue(info.Env(), IsKeyPressed( @@ -1407,6 +1539,14 @@ Napi::Value BindGetMouseWheelMove(const Napi::CallbackInfo& info) { ); } +Napi::Value BindGetMouseWheelMoveV(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + GetMouseWheelMoveV( + + ) + ); +} + Napi::Value BindGetTouchX(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetTouchX( @@ -2028,6 +2168,15 @@ Napi::Value BindGenImageFontAtlas(const Napi::CallbackInfo& info) { ); } +Napi::Value BindExportFontAsCode(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + ExportFontAsCode( + FontFromValue(info, 0), + (const char *) stringFromValue(info, 10) + ) + ); +} + Napi::Value BindMeasureText(const Napi::CallbackInfo& info) { return ToValue(info.Env(), MeasureText( @@ -2113,7 +2262,7 @@ Napi::Value BindCodepointToUTF8(const Napi::CallbackInfo& info) { Napi::Value BindTextCodepointsToUTF8(const Napi::CallbackInfo& info) { return ToValue(info.Env(), TextCodepointsToUTF8( - (int *) pointerFromValue(info, 0), + (const int *) pointerFromValue(info, 0), intFromValue(info, 1) ) ); @@ -2454,15 +2603,6 @@ Napi::Value BindGetRayCollisionBox(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGetRayCollisionModel(const Napi::CallbackInfo& info) { - return ToValue(info.Env(), - GetRayCollisionModel( - RayFromValue(info, 0), - ModelFromValue(info, 6) - ) - ); -} - Napi::Value BindGetRayCollisionMesh(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GetRayCollisionMesh( @@ -2600,7 +2740,7 @@ Napi::Value BindLoadMusicStreamFromMemory(const Napi::CallbackInfo& info) { return ToValue(info.Env(), LoadMusicStreamFromMemory( (const char *) stringFromValue(info, 0), - (unsigned char *) pointerFromValue(info, 1), + (const unsigned char *) pointerFromValue(info, 1), intFromValue(info, 2) ) ); @@ -3006,6 +3146,25 @@ Napi::Value BindRemap(const Napi::CallbackInfo& info) { ); } +Napi::Value BindWrap(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Wrap( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2) + ) + ); +} + +Napi::Value BindFloatEquals(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + FloatEquals( + floatFromValue(info, 0), + floatFromValue(info, 1) + ) + ); +} + Napi::Value BindVector2Zero(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector2Zero( @@ -3092,6 +3251,15 @@ Napi::Value BindVector2Distance(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector2DistanceSqr(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2DistanceSqr( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2) + ) + ); +} + Napi::Value BindVector2Angle(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector2Angle( @@ -3144,6 +3312,15 @@ Napi::Value BindVector2Normalize(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector2Transform(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2Transform( + Vector2FromValue(info, 0), + MatrixFromValue(info, 2) + ) + ); +} + Napi::Value BindVector2Lerp(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector2Lerp( @@ -3182,6 +3359,43 @@ Napi::Value BindVector2MoveTowards(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector2Invert(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2Invert( + Vector2FromValue(info, 0) + ) + ); +} + +Napi::Value BindVector2Clamp(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2Clamp( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2), + Vector2FromValue(info, 4) + ) + ); +} + +Napi::Value BindVector2ClampValue(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2ClampValue( + Vector2FromValue(info, 0), + floatFromValue(info, 2), + floatFromValue(info, 3) + ) + ); +} + +Napi::Value BindVector2Equals(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector2Equals( + Vector2FromValue(info, 0), + Vector2FromValue(info, 2) + ) + ); +} + Napi::Value BindVector3Zero(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector3Zero( @@ -3303,6 +3517,15 @@ Napi::Value BindVector3Distance(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector3DistanceSqr(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector3DistanceSqr( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3) + ) + ); +} + Napi::Value BindVector3Angle(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector3Angle( @@ -3355,6 +3578,16 @@ Napi::Value BindVector3RotateByQuaternion(const Napi::CallbackInfo& info) { ); } +Napi::Value BindVector3RotateByAxisAngle(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + Vector3RotateByAxisAngle( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3), + floatFromValue(info, 6) + ) + ); +} + Napi::Value BindVector3Lerp(const Napi::CallbackInfo& info) { return ToValue(info.Env(), Vector3Lerp( @@ -3413,42 +3646,81 @@ Napi::Value BindVector3Unproject(const Napi::CallbackInfo& info) { ); } -Napi::Value BindMatrixDeterminant(const Napi::CallbackInfo& info) { +Napi::Value BindVector3Invert(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixDeterminant( - MatrixFromValue(info, 0) + Vector3Invert( + Vector3FromValue(info, 0) ) ); } -Napi::Value BindMatrixTrace(const Napi::CallbackInfo& info) { +Napi::Value BindVector3Clamp(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixTrace( - MatrixFromValue(info, 0) + Vector3Clamp( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3), + Vector3FromValue(info, 6) ) ); } -Napi::Value BindMatrixTranspose(const Napi::CallbackInfo& info) { +Napi::Value BindVector3ClampValue(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixTranspose( - MatrixFromValue(info, 0) + Vector3ClampValue( + Vector3FromValue(info, 0), + floatFromValue(info, 3), + floatFromValue(info, 4) ) ); } -Napi::Value BindMatrixInvert(const Napi::CallbackInfo& info) { +Napi::Value BindVector3Equals(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixInvert( - MatrixFromValue(info, 0) + Vector3Equals( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3) ) ); } -Napi::Value BindMatrixNormalize(const Napi::CallbackInfo& info) { +Napi::Value BindVector3Refract(const Napi::CallbackInfo& info) { return ToValue(info.Env(), - MatrixNormalize( - MatrixFromValue(info, 0) + Vector3Refract( + Vector3FromValue(info, 0), + Vector3FromValue(info, 3), + floatFromValue(info, 6) + ) + ); +} + +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) ) ); } @@ -3790,6 +4062,15 @@ Napi::Value BindQuaternionTransform(const Napi::CallbackInfo& info) { ); } +Napi::Value BindQuaternionEquals(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + QuaternionEquals( + Vector4FromValue(info, 0), + Vector4FromValue(info, 1) + ) + ); +} + Napi::Value BindGuiIsLocked(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiIsLocked( @@ -3836,8 +4117,9 @@ Napi::Value BindGuiScrollPanel(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiScrollPanel( RectangleFromValue(info, 0), - RectangleFromValue(info, 4), - (Vector2 *) pointerFromValue(info, 8) + (const char *) stringFromValue(info, 4), + RectangleFromValue(info, 5), + (Vector2 *) pointerFromValue(info, 9) ) ); } @@ -3998,23 +4280,13 @@ Napi::Value BindGuiProgressBar(const Napi::CallbackInfo& info) { ); } -Napi::Value BindGuiScrollBar(const Napi::CallbackInfo& info) { - return ToValue(info.Env(), - GuiScrollBar( - RectangleFromValue(info, 0), - intFromValue(info, 4), - intFromValue(info, 5), - intFromValue(info, 6) - ) - ); -} - Napi::Value BindGuiGrid(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiGrid( RectangleFromValue(info, 0), - floatFromValue(info, 4), - intFromValue(info, 5) + (const char *) stringFromValue(info, 4), + floatFromValue(info, 5), + intFromValue(info, 6) ) ); } @@ -4061,7 +4333,9 @@ Napi::Value BindGuiTextInputBox(const Napi::CallbackInfo& info) { (const char *) stringFromValue(info, 4), (const char *) stringFromValue(info, 5), (const char *) stringFromValue(info, 6), - (char *) pointerFromValue(info, 7) + (char *) pointerFromValue(info, 7), + intFromValue(info, 8), + (int *) pointerFromValue(info, 9) ) ); } @@ -4070,7 +4344,8 @@ Napi::Value BindGuiColorPicker(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiColorPicker( RectangleFromValue(info, 0), - ColorFromValue(info, 4) + (const char *) stringFromValue(info, 4), + ColorFromValue(info, 5) ) ); } @@ -4079,7 +4354,8 @@ Napi::Value BindGuiColorPanel(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiColorPanel( RectangleFromValue(info, 0), - ColorFromValue(info, 4) + (const char *) stringFromValue(info, 4), + ColorFromValue(info, 5) ) ); } @@ -4088,7 +4364,8 @@ Napi::Value BindGuiColorBarAlpha(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiColorBarAlpha( RectangleFromValue(info, 0), - floatFromValue(info, 4) + (const char *) stringFromValue(info, 4), + floatFromValue(info, 5) ) ); } @@ -4097,7 +4374,8 @@ Napi::Value BindGuiColorBarHue(const Napi::CallbackInfo& info) { return ToValue(info.Env(), GuiColorBarHue( RectangleFromValue(info, 0), - floatFromValue(info, 4) + (const char *) stringFromValue(info, 4), + floatFromValue(info, 5) ) ); } @@ -4137,174 +4415,497 @@ Napi::Value BindGuiCheckIconPixel(const Napi::CallbackInfo& info) { ); } -void BindInitWindow(const Napi::CallbackInfo& info) { - InitWindow( - intFromValue(info, 0), - intFromValue(info, 1), - (const char *) stringFromValue(info, 2) +Napi::Value BindrlEnableVertexArray(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlEnableVertexArray( + unsignedintFromValue(info, 0) + ) ); } -void BindCloseWindow(const Napi::CallbackInfo& info) { - CloseWindow( - +Napi::Value BindrlGetLineWidth(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetLineWidth( + + ) ); } -void BindSetWindowState(const Napi::CallbackInfo& info) { - SetWindowState( - unsignedintFromValue(info, 0) +Napi::Value BindrlIsStereoRenderEnabled(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlIsStereoRenderEnabled( + + ) ); } -void BindClearWindowState(const Napi::CallbackInfo& info) { - ClearWindowState( - unsignedintFromValue(info, 0) +Napi::Value BindrlGetVersion(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetVersion( + + ) ); } -void BindToggleFullscreen(const Napi::CallbackInfo& info) { - ToggleFullscreen( - +Napi::Value BindrlGetFramebufferWidth(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetFramebufferWidth( + + ) ); } -void BindMaximizeWindow(const Napi::CallbackInfo& info) { - MaximizeWindow( - +Napi::Value BindrlGetFramebufferHeight(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetFramebufferHeight( + + ) ); } -void BindMinimizeWindow(const Napi::CallbackInfo& info) { - MinimizeWindow( - +Napi::Value BindrlGetTextureIdDefault(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetTextureIdDefault( + + ) ); } -void BindRestoreWindow(const Napi::CallbackInfo& info) { - RestoreWindow( - +Napi::Value BindrlGetShaderIdDefault(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetShaderIdDefault( + + ) ); } -void BindSetWindowIcon(const Napi::CallbackInfo& info) { - SetWindowIcon( - ImageFromValue(info, 0) +Napi::Value BindrlGetShaderLocsDefault(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetShaderLocsDefault( + + ) ); } -void BindSetWindowTitle(const Napi::CallbackInfo& info) { - SetWindowTitle( - (const char *) stringFromValue(info, 0) +Napi::Value BindrlLoadRenderBatch(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadRenderBatch( + intFromValue(info, 0), + intFromValue(info, 1) + ) ); } -void BindSetWindowPosition(const Napi::CallbackInfo& info) { - SetWindowPosition( - intFromValue(info, 0), - intFromValue(info, 1) +Napi::Value BindrlCheckRenderBatchLimit(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlCheckRenderBatchLimit( + intFromValue(info, 0) + ) ); } -void BindSetWindowMonitor(const Napi::CallbackInfo& info) { - SetWindowMonitor( - intFromValue(info, 0) +Napi::Value BindrlLoadVertexArray(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadVertexArray( + + ) ); } -void BindSetWindowMinSize(const Napi::CallbackInfo& info) { - SetWindowMinSize( - intFromValue(info, 0), - intFromValue(info, 1) +Napi::Value BindrlLoadVertexBuffer(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadVertexBuffer( + (const void *) pointerFromValue(info, 0), + intFromValue(info, 1), + boolFromValue(info, 2) + ) ); } -void BindSetWindowSize(const Napi::CallbackInfo& info) { - SetWindowSize( - intFromValue(info, 0), - intFromValue(info, 1) +Napi::Value BindrlLoadVertexBufferElement(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadVertexBufferElement( + (const void *) pointerFromValue(info, 0), + intFromValue(info, 1), + boolFromValue(info, 2) + ) ); } -void BindSetClipboardText(const Napi::CallbackInfo& info) { - SetClipboardText( - (const char *) stringFromValue(info, 0) +Napi::Value BindrlLoadTexture(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadTexture( + (const void *) pointerFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3), + intFromValue(info, 4) + ) ); } -void BindSwapScreenBuffer(const Napi::CallbackInfo& info) { - SwapScreenBuffer( - +Napi::Value BindrlLoadTextureDepth(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadTextureDepth( + intFromValue(info, 0), + intFromValue(info, 1), + boolFromValue(info, 2) + ) ); } -void BindPollInputEvents(const Napi::CallbackInfo& info) { - PollInputEvents( - +Napi::Value BindrlLoadTextureCubemap(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadTextureCubemap( + (const void *) pointerFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2) + ) ); } -void BindWaitTime(const Napi::CallbackInfo& info) { - WaitTime( - floatFromValue(info, 0) +Napi::Value BindrlGetPixelFormatName(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetPixelFormatName( + unsignedintFromValue(info, 0) + ) ); } -void BindShowCursor(const Napi::CallbackInfo& info) { - ShowCursor( - +Napi::Value BindrlReadTexturePixels(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlReadTexturePixels( + unsignedintFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3) + ) ); } -void BindHideCursor(const Napi::CallbackInfo& info) { - HideCursor( - +Napi::Value BindrlReadScreenPixels(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlReadScreenPixels( + intFromValue(info, 0), + intFromValue(info, 1) + ) ); } -void BindEnableCursor(const Napi::CallbackInfo& info) { - EnableCursor( - +Napi::Value BindrlLoadFramebuffer(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadFramebuffer( + intFromValue(info, 0), + intFromValue(info, 1) + ) ); } -void BindDisableCursor(const Napi::CallbackInfo& info) { - DisableCursor( - +Napi::Value BindrlFramebufferComplete(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlFramebufferComplete( + unsignedintFromValue(info, 0) + ) ); } -void BindClearBackground(const Napi::CallbackInfo& info) { - ClearBackground( - ColorFromValue(info, 0) +Napi::Value BindrlLoadShaderCode(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadShaderCode( + (const char *) stringFromValue(info, 0), + (const char *) stringFromValue(info, 1) + ) ); } -void BindBeginDrawing(const Napi::CallbackInfo& info) { - BeginDrawing( - +Napi::Value BindrlCompileShader(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlCompileShader( + (const char *) stringFromValue(info, 0), + intFromValue(info, 1) + ) ); } -void BindEndDrawing(const Napi::CallbackInfo& info) { - EndDrawing( - +Napi::Value BindrlLoadShaderProgram(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadShaderProgram( + unsignedintFromValue(info, 0), + unsignedintFromValue(info, 1) + ) ); } -void BindBeginMode2D(const Napi::CallbackInfo& info) { - BeginMode2D( - Camera2DFromValue(info, 0) +Napi::Value BindrlGetLocationUniform(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetLocationUniform( + unsignedintFromValue(info, 0), + (const char *) stringFromValue(info, 1) + ) ); } -void BindEndMode2D(const Napi::CallbackInfo& info) { - EndMode2D( - +Napi::Value BindrlGetLocationAttrib(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetLocationAttrib( + unsignedintFromValue(info, 0), + (const char *) stringFromValue(info, 1) + ) ); } -void BindBeginMode3D(const Napi::CallbackInfo& info) { +Napi::Value BindrlLoadComputeShaderProgram(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadComputeShaderProgram( + unsignedintFromValue(info, 0) + ) + ); +} + +Napi::Value BindrlLoadShaderBuffer(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlLoadShaderBuffer( + unsignedlonglongFromValue(info, 0), + (const void *) pointerFromValue(info, 1), + intFromValue(info, 2) + ) + ); +} + +Napi::Value BindrlGetShaderBufferSize(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetShaderBufferSize( + unsignedintFromValue(info, 0) + ) + ); +} + +Napi::Value BindrlGetMatrixModelview(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetMatrixModelview( + + ) + ); +} + +Napi::Value BindrlGetMatrixProjection(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetMatrixProjection( + + ) + ); +} + +Napi::Value BindrlGetMatrixTransform(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetMatrixTransform( + + ) + ); +} + +Napi::Value BindrlGetMatrixProjectionStereo(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetMatrixProjectionStereo( + intFromValue(info, 0) + ) + ); +} + +Napi::Value BindrlGetMatrixViewOffsetStereo(const Napi::CallbackInfo& info) { + return ToValue(info.Env(), + rlGetMatrixViewOffsetStereo( + intFromValue(info, 0) + ) + ); +} + +void BindInitWindow(const Napi::CallbackInfo& info) { + InitWindow( + intFromValue(info, 0), + intFromValue(info, 1), + (const char *) stringFromValue(info, 2) + ); +} + +void BindCloseWindow(const Napi::CallbackInfo& info) { + CloseWindow( + + ); +} + +void BindSetWindowState(const Napi::CallbackInfo& info) { + SetWindowState( + unsignedintFromValue(info, 0) + ); +} + +void BindClearWindowState(const Napi::CallbackInfo& info) { + ClearWindowState( + unsignedintFromValue(info, 0) + ); +} + +void BindToggleFullscreen(const Napi::CallbackInfo& info) { + ToggleFullscreen( + + ); +} + +void BindMaximizeWindow(const Napi::CallbackInfo& info) { + MaximizeWindow( + + ); +} + +void BindMinimizeWindow(const Napi::CallbackInfo& info) { + MinimizeWindow( + + ); +} + +void BindRestoreWindow(const Napi::CallbackInfo& info) { + RestoreWindow( + + ); +} + +void BindSetWindowIcon(const Napi::CallbackInfo& info) { + SetWindowIcon( + ImageFromValue(info, 0) + ); +} + +void BindSetWindowTitle(const Napi::CallbackInfo& info) { + SetWindowTitle( + (const char *) stringFromValue(info, 0) + ); +} + +void BindSetWindowPosition(const Napi::CallbackInfo& info) { + SetWindowPosition( + intFromValue(info, 0), + intFromValue(info, 1) + ); +} + +void BindSetWindowMonitor(const Napi::CallbackInfo& info) { + SetWindowMonitor( + intFromValue(info, 0) + ); +} + +void BindSetWindowMinSize(const Napi::CallbackInfo& info) { + SetWindowMinSize( + intFromValue(info, 0), + intFromValue(info, 1) + ); +} + +void BindSetWindowSize(const Napi::CallbackInfo& info) { + SetWindowSize( + intFromValue(info, 0), + intFromValue(info, 1) + ); +} + +void BindSetWindowOpacity(const Napi::CallbackInfo& info) { + SetWindowOpacity( + floatFromValue(info, 0) + ); +} + +void BindSetClipboardText(const Napi::CallbackInfo& info) { + SetClipboardText( + (const char *) stringFromValue(info, 0) + ); +} + +void BindEnableEventWaiting(const Napi::CallbackInfo& info) { + EnableEventWaiting( + + ); +} + +void BindDisableEventWaiting(const Napi::CallbackInfo& info) { + DisableEventWaiting( + + ); +} + +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( + + ); +} + +void BindHideCursor(const Napi::CallbackInfo& info) { + HideCursor( + + ); +} + +void BindEnableCursor(const Napi::CallbackInfo& info) { + EnableCursor( + + ); +} + +void BindDisableCursor(const Napi::CallbackInfo& info) { + DisableCursor( + + ); +} + +void BindClearBackground(const Napi::CallbackInfo& info) { + ClearBackground( + ColorFromValue(info, 0) + ); +} + +void BindBeginDrawing(const Napi::CallbackInfo& info) { + BeginDrawing( + + ); +} + +void BindEndDrawing(const Napi::CallbackInfo& info) { + EndDrawing( + + ); +} + +void BindBeginMode2D(const Napi::CallbackInfo& info) { + BeginMode2D( + Camera2DFromValue(info, 0) + ); +} + +void BindEndMode2D(const Napi::CallbackInfo& info) { + EndMode2D( + + ); +} + +void BindBeginMode3D(const Napi::CallbackInfo& info) { BeginMode3D( Camera3DFromValue(info, 0) ); @@ -4431,6 +5032,12 @@ 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) @@ -4443,21 +5050,15 @@ void BindUnloadFileText(const Napi::CallbackInfo& info) { ); } -void BindClearDirectoryFiles(const Napi::CallbackInfo& info) { - ClearDirectoryFiles( - - ); -} - -void BindClearDroppedFiles(const Napi::CallbackInfo& info) { - ClearDroppedFiles( - +void BindUnloadDirectoryFiles(const Napi::CallbackInfo& info) { + UnloadDirectoryFiles( + FilePathListFromValue(info, 0) ); } -void BindOpenURL(const Napi::CallbackInfo& info) { - OpenURL( - (const char *) stringFromValue(info, 0) +void BindUnloadDroppedFiles(const Napi::CallbackInfo& info) { + UnloadDroppedFiles( + FilePathListFromValue(info, 0) ); } @@ -5115,6 +5716,18 @@ void BindDrawTextCodepoint(const Napi::CallbackInfo& info) { ); } +void BindDrawTextCodepoints(const Napi::CallbackInfo& info) { + DrawTextCodepoints( + FontFromValue(info, 0), + (const int *) pointerFromValue(info, 10), + intFromValue(info, 11), + Vector2FromValue(info, 12), + floatFromValue(info, 14), + floatFromValue(info, 15), + ColorFromValue(info, 16) + ); +} + void BindUnloadCodepoints(const Napi::CallbackInfo& info) { UnloadCodepoints( (int *) pointerFromValue(info, 0) @@ -5422,7 +6035,7 @@ void BindUpdateMeshBuffer(const Napi::CallbackInfo& info) { UpdateMeshBuffer( MeshFromValue(info, 0), intFromValue(info, 15), - (void *) pointerFromValue(info, 16), + (const void *) pointerFromValue(info, 16), intFromValue(info, 17), intFromValue(info, 18) ); @@ -5450,7 +6063,7 @@ void BindUnloadModelAnimation(const Napi::CallbackInfo& info) { void BindUnloadModelAnimations(const Napi::CallbackInfo& info) { UnloadModelAnimations( - (ModelAnimation*) pointerFromValue(info, 0), + (ModelAnimation *) pointerFromValue(info, 0), unsignedintFromValue(info, 1) ); } @@ -5476,8 +6089,8 @@ void BindSetMasterVolume(const Napi::CallbackInfo& info) { void BindUpdateSound(const Napi::CallbackInfo& info) { UpdateSound( SoundFromValue(info, 0), - (const void *) pointerFromValue(info, 5), - intFromValue(info, 6) + (const void *) pointerFromValue(info, 6), + intFromValue(info, 7) ); } @@ -5517,301 +6130,1081 @@ void BindResumeSound(const Napi::CallbackInfo& info) { ); } -void BindPlaySoundMulti(const Napi::CallbackInfo& info) { - PlaySoundMulti( - SoundFromValue(info, 0) +void BindPlaySoundMulti(const Napi::CallbackInfo& info) { + PlaySoundMulti( + SoundFromValue(info, 0) + ); +} + +void BindStopSoundMulti(const Napi::CallbackInfo& info) { + StopSoundMulti( + + ); +} + +void BindSetSoundVolume(const Napi::CallbackInfo& info) { + SetSoundVolume( + SoundFromValue(info, 0), + floatFromValue(info, 6) + ); +} + +void BindSetSoundPitch(const Napi::CallbackInfo& info) { + SetSoundPitch( + SoundFromValue(info, 0), + floatFromValue(info, 6) + ); +} + +void BindSetSoundPan(const Napi::CallbackInfo& info) { + SetSoundPan( + SoundFromValue(info, 0), + floatFromValue(info, 6) + ); +} + +void BindUnloadWaveSamples(const Napi::CallbackInfo& info) { + UnloadWaveSamples( + (float *) pointerFromValue(info, 0) + ); +} + +void BindUnloadMusicStream(const Napi::CallbackInfo& info) { + UnloadMusicStream( + MusicFromValue(info, 0) + ); +} + +void BindPlayMusicStream(const Napi::CallbackInfo& info) { + PlayMusicStream( + MusicFromValue(info, 0) + ); +} + +void BindUpdateMusicStream(const Napi::CallbackInfo& info) { + UpdateMusicStream( + MusicFromValue(info, 0) + ); +} + +void BindStopMusicStream(const Napi::CallbackInfo& info) { + StopMusicStream( + MusicFromValue(info, 0) + ); +} + +void BindPauseMusicStream(const Napi::CallbackInfo& info) { + PauseMusicStream( + MusicFromValue(info, 0) + ); +} + +void BindResumeMusicStream(const Napi::CallbackInfo& info) { + ResumeMusicStream( + MusicFromValue(info, 0) + ); +} + +void BindSeekMusicStream(const Napi::CallbackInfo& info) { + SeekMusicStream( + MusicFromValue(info, 0), + floatFromValue(info, 9) + ); +} + +void BindSetMusicVolume(const Napi::CallbackInfo& info) { + SetMusicVolume( + MusicFromValue(info, 0), + floatFromValue(info, 9) + ); +} + +void BindSetMusicPitch(const Napi::CallbackInfo& info) { + SetMusicPitch( + MusicFromValue(info, 0), + floatFromValue(info, 9) + ); +} + +void BindSetMusicPan(const Napi::CallbackInfo& info) { + SetMusicPan( + MusicFromValue(info, 0), + floatFromValue(info, 9) + ); +} + +void BindUnloadAudioStream(const Napi::CallbackInfo& info) { + UnloadAudioStream( + AudioStreamFromValue(info, 0) + ); +} + +void BindUpdateAudioStream(const Napi::CallbackInfo& info) { + UpdateAudioStream( + AudioStreamFromValue(info, 0), + (const void *) pointerFromValue(info, 5), + intFromValue(info, 6) + ); +} + +void BindPlayAudioStream(const Napi::CallbackInfo& info) { + PlayAudioStream( + AudioStreamFromValue(info, 0) + ); +} + +void BindPauseAudioStream(const Napi::CallbackInfo& info) { + PauseAudioStream( + AudioStreamFromValue(info, 0) + ); +} + +void BindResumeAudioStream(const Napi::CallbackInfo& info) { + ResumeAudioStream( + AudioStreamFromValue(info, 0) + ); +} + +void BindStopAudioStream(const Napi::CallbackInfo& info) { + StopAudioStream( + AudioStreamFromValue(info, 0) + ); +} + +void BindSetAudioStreamVolume(const Napi::CallbackInfo& info) { + SetAudioStreamVolume( + AudioStreamFromValue(info, 0), + floatFromValue(info, 5) + ); +} + +void BindSetAudioStreamPitch(const Napi::CallbackInfo& info) { + SetAudioStreamPitch( + AudioStreamFromValue(info, 0), + floatFromValue(info, 5) + ); +} + +void BindSetAudioStreamPan(const Napi::CallbackInfo& info) { + SetAudioStreamPan( + AudioStreamFromValue(info, 0), + floatFromValue(info, 5) + ); +} + +void BindSetAudioStreamBufferSizeDefault(const Napi::CallbackInfo& info) { + SetAudioStreamBufferSizeDefault( + intFromValue(info, 0) + ); +} + +void BindVector3OrthoNormalize(const Napi::CallbackInfo& info) { + Vector3OrthoNormalize( + (Vector3 *) pointerFromValue(info, 0), + (Vector3 *) pointerFromValue(info, 1) + ); +} + +void BindQuaternionToAxisAngle(const Napi::CallbackInfo& info) { + QuaternionToAxisAngle( + Vector4FromValue(info, 0), + (Vector3 *) pointerFromValue(info, 1), + (float *) pointerFromValue(info, 2) + ); +} + +void BindGuiEnable(const Napi::CallbackInfo& info) { + GuiEnable( + + ); +} + +void BindGuiDisable(const Napi::CallbackInfo& info) { + GuiDisable( + + ); +} + +void BindGuiLock(const Napi::CallbackInfo& info) { + GuiLock( + + ); +} + +void BindGuiUnlock(const Napi::CallbackInfo& info) { + GuiUnlock( + + ); +} + +void BindGuiFade(const Napi::CallbackInfo& info) { + GuiFade( + floatFromValue(info, 0) + ); +} + +void BindGuiSetState(const Napi::CallbackInfo& info) { + GuiSetState( + intFromValue(info, 0) + ); +} + +void BindGuiSetFont(const Napi::CallbackInfo& info) { + GuiSetFont( + FontFromValue(info, 0) + ); +} + +void BindGuiSetStyle(const Napi::CallbackInfo& info) { + GuiSetStyle( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2) + ); +} + +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) + ); +} + +void BindGuiLoadStyleDefault(const Napi::CallbackInfo& info) { + GuiLoadStyleDefault( + + ); +} + +void BindGuiDrawIcon(const Napi::CallbackInfo& info) { + GuiDrawIcon( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3), + ColorFromValue(info, 4) + ); +} + +void BindGuiSetIconData(const Napi::CallbackInfo& info) { + GuiSetIconData( + intFromValue(info, 0), + (unsigned int *) pointerFromValue(info, 1) + ); +} + +void BindGuiSetIconScale(const Napi::CallbackInfo& info) { + GuiSetIconScale( + unsignedintFromValue(info, 0) + ); +} + +void BindGuiSetIconPixel(const Napi::CallbackInfo& info) { + GuiSetIconPixel( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2) + ); +} + +void BindGuiClearIconPixel(const Napi::CallbackInfo& info) { + GuiClearIconPixel( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2) + ); +} + +void BindrlMatrixMode(const Napi::CallbackInfo& info) { + rlMatrixMode( + intFromValue(info, 0) + ); +} + +void BindrlPushMatrix(const Napi::CallbackInfo& info) { + rlPushMatrix( + + ); +} + +void BindrlPopMatrix(const Napi::CallbackInfo& info) { + rlPopMatrix( + + ); +} + +void BindrlLoadIdentity(const Napi::CallbackInfo& info) { + rlLoadIdentity( + + ); +} + +void BindrlTranslatef(const Napi::CallbackInfo& info) { + rlTranslatef( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2) + ); +} + +void BindrlRotatef(const Napi::CallbackInfo& info) { + rlRotatef( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2), + floatFromValue(info, 3) + ); +} + +void BindrlScalef(const Napi::CallbackInfo& info) { + rlScalef( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2) + ); +} + +void BindrlMultMatrixf(const Napi::CallbackInfo& info) { + rlMultMatrixf( + (float *) pointerFromValue(info, 0) + ); +} + +void BindrlFrustum(const Napi::CallbackInfo& info) { + rlFrustum( + doubleFromValue(info, 0), + doubleFromValue(info, 1), + doubleFromValue(info, 2), + doubleFromValue(info, 3), + doubleFromValue(info, 4), + doubleFromValue(info, 5) + ); +} + +void BindrlOrtho(const Napi::CallbackInfo& info) { + rlOrtho( + doubleFromValue(info, 0), + doubleFromValue(info, 1), + doubleFromValue(info, 2), + doubleFromValue(info, 3), + doubleFromValue(info, 4), + doubleFromValue(info, 5) + ); +} + +void BindrlViewport(const Napi::CallbackInfo& info) { + rlViewport( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3) + ); +} + +void BindrlBegin(const Napi::CallbackInfo& info) { + rlBegin( + intFromValue(info, 0) + ); +} + +void BindrlEnd(const Napi::CallbackInfo& info) { + rlEnd( + + ); +} + +void BindrlVertex2i(const Napi::CallbackInfo& info) { + rlVertex2i( + intFromValue(info, 0), + intFromValue(info, 1) + ); +} + +void BindrlVertex2f(const Napi::CallbackInfo& info) { + rlVertex2f( + floatFromValue(info, 0), + floatFromValue(info, 1) + ); +} + +void BindrlVertex3f(const Napi::CallbackInfo& info) { + rlVertex3f( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2) + ); +} + +void BindrlTexCoord2f(const Napi::CallbackInfo& info) { + rlTexCoord2f( + floatFromValue(info, 0), + floatFromValue(info, 1) + ); +} + +void BindrlNormal3f(const Napi::CallbackInfo& info) { + rlNormal3f( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2) + ); +} + +void BindrlColor4ub(const Napi::CallbackInfo& info) { + rlColor4ub( + unsignedcharFromValue(info, 0), + unsignedcharFromValue(info, 1), + unsignedcharFromValue(info, 2), + unsignedcharFromValue(info, 3) + ); +} + +void BindrlColor3f(const Napi::CallbackInfo& info) { + rlColor3f( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2) + ); +} + +void BindrlColor4f(const Napi::CallbackInfo& info) { + rlColor4f( + floatFromValue(info, 0), + floatFromValue(info, 1), + floatFromValue(info, 2), + floatFromValue(info, 3) + ); +} + +void BindrlDisableVertexArray(const Napi::CallbackInfo& info) { + rlDisableVertexArray( + + ); +} + +void BindrlEnableVertexBuffer(const Napi::CallbackInfo& info) { + rlEnableVertexBuffer( + unsignedintFromValue(info, 0) + ); +} + +void BindrlDisableVertexBuffer(const Napi::CallbackInfo& info) { + rlDisableVertexBuffer( + + ); +} + +void BindrlEnableVertexBufferElement(const Napi::CallbackInfo& info) { + rlEnableVertexBufferElement( + unsignedintFromValue(info, 0) + ); +} + +void BindrlDisableVertexBufferElement(const Napi::CallbackInfo& info) { + rlDisableVertexBufferElement( + + ); +} + +void BindrlEnableVertexAttribute(const Napi::CallbackInfo& info) { + rlEnableVertexAttribute( + unsignedintFromValue(info, 0) + ); +} + +void BindrlDisableVertexAttribute(const Napi::CallbackInfo& info) { + rlDisableVertexAttribute( + unsignedintFromValue(info, 0) + ); +} + +void BindrlActiveTextureSlot(const Napi::CallbackInfo& info) { + rlActiveTextureSlot( + intFromValue(info, 0) + ); +} + +void BindrlEnableTexture(const Napi::CallbackInfo& info) { + rlEnableTexture( + unsignedintFromValue(info, 0) + ); +} + +void BindrlDisableTexture(const Napi::CallbackInfo& info) { + rlDisableTexture( + + ); +} + +void BindrlEnableTextureCubemap(const Napi::CallbackInfo& info) { + rlEnableTextureCubemap( + unsignedintFromValue(info, 0) + ); +} + +void BindrlDisableTextureCubemap(const Napi::CallbackInfo& info) { + rlDisableTextureCubemap( + + ); +} + +void BindrlTextureParameters(const Napi::CallbackInfo& info) { + rlTextureParameters( + unsignedintFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2) + ); +} + +void BindrlEnableShader(const Napi::CallbackInfo& info) { + rlEnableShader( + unsignedintFromValue(info, 0) + ); +} + +void BindrlDisableShader(const Napi::CallbackInfo& info) { + rlDisableShader( + + ); +} + +void BindrlEnableFramebuffer(const Napi::CallbackInfo& info) { + rlEnableFramebuffer( + unsignedintFromValue(info, 0) + ); +} + +void BindrlDisableFramebuffer(const Napi::CallbackInfo& info) { + rlDisableFramebuffer( + + ); +} + +void BindrlActiveDrawBuffers(const Napi::CallbackInfo& info) { + rlActiveDrawBuffers( + intFromValue(info, 0) + ); +} + +void BindrlEnableColorBlend(const Napi::CallbackInfo& info) { + rlEnableColorBlend( + + ); +} + +void BindrlDisableColorBlend(const Napi::CallbackInfo& info) { + rlDisableColorBlend( + + ); +} + +void BindrlEnableDepthTest(const Napi::CallbackInfo& info) { + rlEnableDepthTest( + + ); +} + +void BindrlDisableDepthTest(const Napi::CallbackInfo& info) { + rlDisableDepthTest( + + ); +} + +void BindrlEnableDepthMask(const Napi::CallbackInfo& info) { + rlEnableDepthMask( + + ); +} + +void BindrlDisableDepthMask(const Napi::CallbackInfo& info) { + rlDisableDepthMask( + + ); +} + +void BindrlEnableBackfaceCulling(const Napi::CallbackInfo& info) { + rlEnableBackfaceCulling( + + ); +} + +void BindrlDisableBackfaceCulling(const Napi::CallbackInfo& info) { + rlDisableBackfaceCulling( + + ); +} + +void BindrlEnableScissorTest(const Napi::CallbackInfo& info) { + rlEnableScissorTest( + + ); +} + +void BindrlDisableScissorTest(const Napi::CallbackInfo& info) { + rlDisableScissorTest( + + ); +} + +void BindrlScissor(const Napi::CallbackInfo& info) { + rlScissor( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3) + ); +} + +void BindrlEnableWireMode(const Napi::CallbackInfo& info) { + rlEnableWireMode( + + ); +} + +void BindrlDisableWireMode(const Napi::CallbackInfo& info) { + rlDisableWireMode( + + ); +} + +void BindrlSetLineWidth(const Napi::CallbackInfo& info) { + rlSetLineWidth( + floatFromValue(info, 0) + ); +} + +void BindrlEnableSmoothLines(const Napi::CallbackInfo& info) { + rlEnableSmoothLines( + + ); +} + +void BindrlDisableSmoothLines(const Napi::CallbackInfo& info) { + rlDisableSmoothLines( + + ); +} + +void BindrlEnableStereoRender(const Napi::CallbackInfo& info) { + rlEnableStereoRender( + + ); +} + +void BindrlDisableStereoRender(const Napi::CallbackInfo& info) { + rlDisableStereoRender( + + ); +} + +void BindrlClearColor(const Napi::CallbackInfo& info) { + rlClearColor( + unsignedcharFromValue(info, 0), + unsignedcharFromValue(info, 1), + unsignedcharFromValue(info, 2), + unsignedcharFromValue(info, 3) + ); +} + +void BindrlClearScreenBuffers(const Napi::CallbackInfo& info) { + rlClearScreenBuffers( + + ); +} + +void BindrlCheckErrors(const Napi::CallbackInfo& info) { + rlCheckErrors( + + ); +} + +void BindrlSetBlendMode(const Napi::CallbackInfo& info) { + rlSetBlendMode( + intFromValue(info, 0) + ); +} + +void BindrlSetBlendFactors(const Napi::CallbackInfo& info) { + rlSetBlendFactors( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2) + ); +} + +void BindrlglInit(const Napi::CallbackInfo& info) { + rlglInit( + intFromValue(info, 0), + intFromValue(info, 1) ); } -void BindStopSoundMulti(const Napi::CallbackInfo& info) { - StopSoundMulti( +void BindrlglClose(const Napi::CallbackInfo& info) { + rlglClose( ); } -void BindSetSoundVolume(const Napi::CallbackInfo& info) { - SetSoundVolume( - SoundFromValue(info, 0), - floatFromValue(info, 5) +void BindrlLoadExtensions(const Napi::CallbackInfo& info) { + rlLoadExtensions( + (void *) pointerFromValue(info, 0) ); } -void BindSetSoundPitch(const Napi::CallbackInfo& info) { - SetSoundPitch( - SoundFromValue(info, 0), - floatFromValue(info, 5) +void BindrlSetFramebufferWidth(const Napi::CallbackInfo& info) { + rlSetFramebufferWidth( + intFromValue(info, 0) ); } -void BindUnloadWaveSamples(const Napi::CallbackInfo& info) { - UnloadWaveSamples( - (float *) pointerFromValue(info, 0) +void BindrlSetFramebufferHeight(const Napi::CallbackInfo& info) { + rlSetFramebufferHeight( + intFromValue(info, 0) ); } -void BindUnloadMusicStream(const Napi::CallbackInfo& info) { - UnloadMusicStream( - MusicFromValue(info, 0) +void BindrlUnloadRenderBatch(const Napi::CallbackInfo& info) { + rlUnloadRenderBatch( + rlRenderBatchFromValue(info, 0) ); } -void BindPlayMusicStream(const Napi::CallbackInfo& info) { - PlayMusicStream( - MusicFromValue(info, 0) +void BindrlDrawRenderBatch(const Napi::CallbackInfo& info) { + rlDrawRenderBatch( + (rlRenderBatch *) pointerFromValue(info, 0) ); } -void BindUpdateMusicStream(const Napi::CallbackInfo& info) { - UpdateMusicStream( - MusicFromValue(info, 0) +void BindrlSetRenderBatchActive(const Napi::CallbackInfo& info) { + rlSetRenderBatchActive( + (rlRenderBatch *) pointerFromValue(info, 0) ); } -void BindStopMusicStream(const Napi::CallbackInfo& info) { - StopMusicStream( - MusicFromValue(info, 0) +void BindrlDrawRenderBatchActive(const Napi::CallbackInfo& info) { + rlDrawRenderBatchActive( + ); } -void BindPauseMusicStream(const Napi::CallbackInfo& info) { - PauseMusicStream( - MusicFromValue(info, 0) +void BindrlSetTexture(const Napi::CallbackInfo& info) { + rlSetTexture( + unsignedintFromValue(info, 0) ); } -void BindResumeMusicStream(const Napi::CallbackInfo& info) { - ResumeMusicStream( - MusicFromValue(info, 0) +void BindrlUpdateVertexBuffer(const Napi::CallbackInfo& info) { + rlUpdateVertexBuffer( + unsignedintFromValue(info, 0), + (const void *) pointerFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3) ); } -void BindSeekMusicStream(const Napi::CallbackInfo& info) { - SeekMusicStream( - MusicFromValue(info, 0), - floatFromValue(info, 8) +void BindrlUpdateVertexBufferElements(const Napi::CallbackInfo& info) { + rlUpdateVertexBufferElements( + unsignedintFromValue(info, 0), + (const void *) pointerFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3) ); } -void BindSetMusicVolume(const Napi::CallbackInfo& info) { - SetMusicVolume( - MusicFromValue(info, 0), - floatFromValue(info, 8) +void BindrlUnloadVertexArray(const Napi::CallbackInfo& info) { + rlUnloadVertexArray( + unsignedintFromValue(info, 0) ); } -void BindSetMusicPitch(const Napi::CallbackInfo& info) { - SetMusicPitch( - MusicFromValue(info, 0), - floatFromValue(info, 8) +void BindrlUnloadVertexBuffer(const Napi::CallbackInfo& info) { + rlUnloadVertexBuffer( + unsignedintFromValue(info, 0) ); } -void BindUnloadAudioStream(const Napi::CallbackInfo& info) { - UnloadAudioStream( - AudioStreamFromValue(info, 0) +void BindrlSetVertexAttribute(const Napi::CallbackInfo& info) { + rlSetVertexAttribute( + unsignedintFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + boolFromValue(info, 3), + intFromValue(info, 4), + (const void *) pointerFromValue(info, 5) ); } -void BindUpdateAudioStream(const Napi::CallbackInfo& info) { - UpdateAudioStream( - AudioStreamFromValue(info, 0), - (const void *) pointerFromValue(info, 4), - intFromValue(info, 5) +void BindrlSetVertexAttributeDivisor(const Napi::CallbackInfo& info) { + rlSetVertexAttributeDivisor( + unsignedintFromValue(info, 0), + intFromValue(info, 1) ); } -void BindPlayAudioStream(const Napi::CallbackInfo& info) { - PlayAudioStream( - AudioStreamFromValue(info, 0) +void BindrlSetVertexAttributeDefault(const Napi::CallbackInfo& info) { + rlSetVertexAttributeDefault( + intFromValue(info, 0), + (const void *) pointerFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3) ); } -void BindPauseAudioStream(const Napi::CallbackInfo& info) { - PauseAudioStream( - AudioStreamFromValue(info, 0) +void BindrlDrawVertexArray(const Napi::CallbackInfo& info) { + rlDrawVertexArray( + intFromValue(info, 0), + intFromValue(info, 1) ); } -void BindResumeAudioStream(const Napi::CallbackInfo& info) { - ResumeAudioStream( - AudioStreamFromValue(info, 0) +void BindrlDrawVertexArrayElements(const Napi::CallbackInfo& info) { + rlDrawVertexArrayElements( + intFromValue(info, 0), + intFromValue(info, 1), + (const void *) pointerFromValue(info, 2) ); } -void BindStopAudioStream(const Napi::CallbackInfo& info) { - StopAudioStream( - AudioStreamFromValue(info, 0) +void BindrlDrawVertexArrayInstanced(const Napi::CallbackInfo& info) { + rlDrawVertexArrayInstanced( + intFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2) ); } -void BindSetAudioStreamVolume(const Napi::CallbackInfo& info) { - SetAudioStreamVolume( - AudioStreamFromValue(info, 0), - floatFromValue(info, 4) +void BindrlDrawVertexArrayElementsInstanced(const Napi::CallbackInfo& info) { + rlDrawVertexArrayElementsInstanced( + intFromValue(info, 0), + intFromValue(info, 1), + (const void *) pointerFromValue(info, 2), + intFromValue(info, 3) ); } -void BindSetAudioStreamPitch(const Napi::CallbackInfo& info) { - SetAudioStreamPitch( - AudioStreamFromValue(info, 0), - floatFromValue(info, 4) +void BindrlUpdateTexture(const Napi::CallbackInfo& info) { + rlUpdateTexture( + unsignedintFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3), + intFromValue(info, 4), + intFromValue(info, 5), + (const void *) pointerFromValue(info, 6) ); } -void BindSetAudioStreamBufferSizeDefault(const Napi::CallbackInfo& info) { - SetAudioStreamBufferSizeDefault( - intFromValue(info, 0) +void BindrlGetGlTextureFormats(const Napi::CallbackInfo& info) { + rlGetGlTextureFormats( + intFromValue(info, 0), + (unsigned int *) pointerFromValue(info, 1), + (unsigned int *) pointerFromValue(info, 2), + (unsigned int *) pointerFromValue(info, 3) ); } -void BindVector3OrthoNormalize(const Napi::CallbackInfo& info) { - Vector3OrthoNormalize( - (Vector3 *) pointerFromValue(info, 0), - (Vector3 *) pointerFromValue(info, 1) +void BindrlUnloadTexture(const Napi::CallbackInfo& info) { + rlUnloadTexture( + unsignedintFromValue(info, 0) ); } -void BindQuaternionToAxisAngle(const Napi::CallbackInfo& info) { - QuaternionToAxisAngle( - Vector4FromValue(info, 0), - (Vector3 *) pointerFromValue(info, 1), - (float *) pointerFromValue(info, 2) +void BindrlGenTextureMipmaps(const Napi::CallbackInfo& info) { + rlGenTextureMipmaps( + unsignedintFromValue(info, 0), + intFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3), + (int *) pointerFromValue(info, 4) ); } -void BindGuiEnable(const Napi::CallbackInfo& info) { - GuiEnable( - +void BindrlFramebufferAttach(const Napi::CallbackInfo& info) { + rlFramebufferAttach( + unsignedintFromValue(info, 0), + unsignedintFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3), + intFromValue(info, 4) ); } -void BindGuiDisable(const Napi::CallbackInfo& info) { - GuiDisable( - +void BindrlUnloadFramebuffer(const Napi::CallbackInfo& info) { + rlUnloadFramebuffer( + unsignedintFromValue(info, 0) ); } -void BindGuiLock(const Napi::CallbackInfo& info) { - GuiLock( - +void BindrlUnloadShaderProgram(const Napi::CallbackInfo& info) { + rlUnloadShaderProgram( + unsignedintFromValue(info, 0) ); } -void BindGuiUnlock(const Napi::CallbackInfo& info) { - GuiUnlock( - +void BindrlSetUniform(const Napi::CallbackInfo& info) { + rlSetUniform( + intFromValue(info, 0), + (const void *) pointerFromValue(info, 1), + intFromValue(info, 2), + intFromValue(info, 3) ); } -void BindGuiFade(const Napi::CallbackInfo& info) { - GuiFade( - floatFromValue(info, 0) +void BindrlSetUniformMatrix(const Napi::CallbackInfo& info) { + rlSetUniformMatrix( + intFromValue(info, 0), + MatrixFromValue(info, 1) ); } -void BindGuiSetState(const Napi::CallbackInfo& info) { - GuiSetState( - intFromValue(info, 0) +void BindrlSetUniformSampler(const Napi::CallbackInfo& info) { + rlSetUniformSampler( + intFromValue(info, 0), + unsignedintFromValue(info, 1) ); } -void BindGuiSetFont(const Napi::CallbackInfo& info) { - GuiSetFont( - FontFromValue(info, 0) +void BindrlSetShader(const Napi::CallbackInfo& info) { + rlSetShader( + unsignedintFromValue(info, 0), + (int *) pointerFromValue(info, 1) ); } -void BindGuiSetStyle(const Napi::CallbackInfo& info) { - GuiSetStyle( - intFromValue(info, 0), - intFromValue(info, 1), - intFromValue(info, 2) +void BindrlComputeShaderDispatch(const Napi::CallbackInfo& info) { + rlComputeShaderDispatch( + unsignedintFromValue(info, 0), + unsignedintFromValue(info, 1), + unsignedintFromValue(info, 2) ); } -void BindGuiGroupBox(const Napi::CallbackInfo& info) { - GuiGroupBox( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) +void BindrlUnloadShaderBuffer(const Napi::CallbackInfo& info) { + rlUnloadShaderBuffer( + unsignedintFromValue(info, 0) ); } -void BindGuiLine(const Napi::CallbackInfo& info) { - GuiLine( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) +void BindrlUpdateShaderBufferElements(const Napi::CallbackInfo& info) { + rlUpdateShaderBufferElements( + unsignedintFromValue(info, 0), + (const void *) pointerFromValue(info, 1), + unsignedlonglongFromValue(info, 2), + unsignedlonglongFromValue(info, 3) ); } -void BindGuiPanel(const Napi::CallbackInfo& info) { - GuiPanel( - RectangleFromValue(info, 0) +void BindrlReadShaderBufferElements(const Napi::CallbackInfo& info) { + rlReadShaderBufferElements( + unsignedintFromValue(info, 0), + (void *) pointerFromValue(info, 1), + unsignedlonglongFromValue(info, 2), + unsignedlonglongFromValue(info, 3) ); } -void BindGuiLabel(const Napi::CallbackInfo& info) { - GuiLabel( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) +void BindrlBindShaderBuffer(const Napi::CallbackInfo& info) { + rlBindShaderBuffer( + unsignedintFromValue(info, 0), + unsignedintFromValue(info, 1) ); } -void BindGuiStatusBar(const Napi::CallbackInfo& info) { - GuiStatusBar( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) +void BindrlCopyBuffersElements(const Napi::CallbackInfo& info) { + rlCopyBuffersElements( + unsignedintFromValue(info, 0), + unsignedintFromValue(info, 1), + unsignedlonglongFromValue(info, 2), + unsignedlonglongFromValue(info, 3), + unsignedlonglongFromValue(info, 4) ); } -void BindGuiDummyRec(const Napi::CallbackInfo& info) { - GuiDummyRec( - RectangleFromValue(info, 0), - (const char *) stringFromValue(info, 4) +void BindrlBindImageTexture(const Napi::CallbackInfo& info) { + rlBindImageTexture( + unsignedintFromValue(info, 0), + unsignedintFromValue(info, 1), + unsignedintFromValue(info, 2), + intFromValue(info, 3) ); } -void BindGuiLoadStyle(const Napi::CallbackInfo& info) { - GuiLoadStyle( - (const char *) stringFromValue(info, 0) +void BindrlSetMatrixProjection(const Napi::CallbackInfo& info) { + rlSetMatrixProjection( + MatrixFromValue(info, 0) ); } -void BindGuiLoadStyleDefault(const Napi::CallbackInfo& info) { - GuiLoadStyleDefault( - +void BindrlSetMatrixModelview(const Napi::CallbackInfo& info) { + rlSetMatrixModelview( + MatrixFromValue(info, 0) ); } -void BindGuiDrawIcon(const Napi::CallbackInfo& info) { - GuiDrawIcon( - intFromValue(info, 0), - intFromValue(info, 1), - intFromValue(info, 2), - intFromValue(info, 3), - ColorFromValue(info, 4) +void BindrlSetMatrixProjectionStereo(const Napi::CallbackInfo& info) { + rlSetMatrixProjectionStereo( + MatrixFromValue(info, 0), + MatrixFromValue(info, 16) ); } -void BindGuiSetIconData(const Napi::CallbackInfo& info) { - GuiSetIconData( - intFromValue(info, 0), - (unsigned int *) pointerFromValue(info, 1) +void BindrlSetMatrixViewOffsetStereo(const Napi::CallbackInfo& info) { + rlSetMatrixViewOffsetStereo( + MatrixFromValue(info, 0), + MatrixFromValue(info, 16) ); } -void BindGuiSetIconPixel(const Napi::CallbackInfo& info) { - GuiSetIconPixel( - intFromValue(info, 0), - intFromValue(info, 1), - intFromValue(info, 2) +void BindrlLoadDrawCube(const Napi::CallbackInfo& info) { + rlLoadDrawCube( + ); } -void BindGuiClearIconPixel(const Napi::CallbackInfo& info) { - GuiClearIconPixel( - intFromValue(info, 0), - intFromValue(info, 1), - intFromValue(info, 2) +void BindrlLoadDrawQuad(const Napi::CallbackInfo& info) { + rlLoadDrawQuad( + ); } // By-Reference function bindings @@ -6193,15 +7586,6 @@ Napi::Value BindGenMeshTangents(const Napi::CallbackInfo& info) { return ToValue(info.Env(), obj); } -Napi::Value BindGenMeshBinormals(const Napi::CallbackInfo& info) { - Mesh obj = MeshFromValue(info, 0); - GenMeshBinormals( - &obj - - ); - return ToValue(info.Env(), obj); -} - Napi::Value BindSetModelMeshMaterial(const Napi::CallbackInfo& info) { Model obj = ModelFromValue(info, 0); SetModelMeshMaterial( @@ -6211,21 +7595,21 @@ Napi::Value BindSetModelMeshMaterial(const Napi::CallbackInfo& info) { return ToValue(info.Env(), obj); } -Napi::Value BindWaveFormat(const Napi::CallbackInfo& info) { +Napi::Value BindWaveCrop(const Napi::CallbackInfo& info) { Wave obj = WaveFromValue(info, 0); - WaveFormat( + WaveCrop( &obj, intFromValue(info, 5), - intFromValue(info, 6), - intFromValue(info, 7) + intFromValue(info, 6) ); return ToValue(info.Env(), obj); } -Napi::Value BindWaveCrop(const Napi::CallbackInfo& info) { +Napi::Value BindWaveFormat(const Napi::CallbackInfo& info) { Wave obj = WaveFromValue(info, 0); - WaveCrop( + WaveFormat( &obj, intFromValue(info, 5), - intFromValue(info, 6) + intFromValue(info, 6), + intFromValue(info, 7) ); return ToValue(info.Env(), obj); } @@ -6312,9 +7696,12 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindSetWindowMonitor", Napi::Function::New(env, BindSetWindowMonitor)); exports.Set("BindSetWindowMinSize", Napi::Function::New(env, BindSetWindowMinSize)); exports.Set("BindSetWindowSize", Napi::Function::New(env, BindSetWindowSize)); + exports.Set("BindSetWindowOpacity", Napi::Function::New(env, BindSetWindowOpacity)); exports.Set("BindGetWindowHandle", Napi::Function::New(env, BindGetWindowHandle)); exports.Set("BindGetScreenWidth", Napi::Function::New(env, BindGetScreenWidth)); exports.Set("BindGetScreenHeight", Napi::Function::New(env, BindGetScreenHeight)); + exports.Set("BindGetRenderWidth", Napi::Function::New(env, BindGetRenderWidth)); + exports.Set("BindGetRenderHeight", Napi::Function::New(env, BindGetRenderHeight)); exports.Set("BindGetMonitorCount", Napi::Function::New(env, BindGetMonitorCount)); exports.Set("BindGetCurrentMonitor", Napi::Function::New(env, BindGetCurrentMonitor)); exports.Set("BindGetMonitorPosition", Napi::Function::New(env, BindGetMonitorPosition)); @@ -6328,6 +7715,8 @@ 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("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)); @@ -6364,9 +7753,9 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGetCameraMatrix", Napi::Function::New(env, BindGetCameraMatrix)); exports.Set("BindGetCameraMatrix2D", Napi::Function::New(env, BindGetCameraMatrix2D)); 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("BindSetTargetFPS", Napi::Function::New(env, BindSetTargetFPS)); exports.Set("BindGetFPS", Napi::Function::New(env, BindGetFPS)); exports.Set("BindGetFrameTime", Napi::Function::New(env, BindGetFrameTime)); @@ -6379,35 +7768,38 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { 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)); + exports.Set("BindExportDataAsCode", Napi::Function::New(env, BindExportDataAsCode)); exports.Set("BindLoadFileText", Napi::Function::New(env, BindLoadFileText)); exports.Set("BindUnloadFileText", Napi::Function::New(env, BindUnloadFileText)); exports.Set("BindSaveFileText", Napi::Function::New(env, BindSaveFileText)); exports.Set("BindFileExists", Napi::Function::New(env, BindFileExists)); exports.Set("BindDirectoryExists", Napi::Function::New(env, BindDirectoryExists)); exports.Set("BindIsFileExtension", Napi::Function::New(env, BindIsFileExtension)); + exports.Set("BindGetFileLength", Napi::Function::New(env, BindGetFileLength)); exports.Set("BindGetFileExtension", Napi::Function::New(env, BindGetFileExtension)); exports.Set("BindGetFileName", Napi::Function::New(env, BindGetFileName)); exports.Set("BindGetFileNameWithoutExt", Napi::Function::New(env, BindGetFileNameWithoutExt)); exports.Set("BindGetDirectoryPath", Napi::Function::New(env, BindGetDirectoryPath)); exports.Set("BindGetPrevDirectoryPath", Napi::Function::New(env, BindGetPrevDirectoryPath)); exports.Set("BindGetWorkingDirectory", Napi::Function::New(env, BindGetWorkingDirectory)); - exports.Set("BindGetDirectoryFiles", Napi::Function::New(env, BindGetDirectoryFiles)); - exports.Set("BindClearDirectoryFiles", Napi::Function::New(env, BindClearDirectoryFiles)); + exports.Set("BindGetApplicationDirectory", Napi::Function::New(env, BindGetApplicationDirectory)); exports.Set("BindChangeDirectory", Napi::Function::New(env, BindChangeDirectory)); + exports.Set("BindIsPathFile", Napi::Function::New(env, BindIsPathFile)); + exports.Set("BindLoadDirectoryFiles", Napi::Function::New(env, BindLoadDirectoryFiles)); + exports.Set("BindLoadDirectoryFilesEx", Napi::Function::New(env, BindLoadDirectoryFilesEx)); + exports.Set("BindUnloadDirectoryFiles", Napi::Function::New(env, BindUnloadDirectoryFiles)); exports.Set("BindIsFileDropped", Napi::Function::New(env, BindIsFileDropped)); - exports.Set("BindGetDroppedFiles", Napi::Function::New(env, BindGetDroppedFiles)); - exports.Set("BindClearDroppedFiles", Napi::Function::New(env, BindClearDroppedFiles)); + exports.Set("BindLoadDroppedFiles", Napi::Function::New(env, BindLoadDroppedFiles)); + exports.Set("BindUnloadDroppedFiles", Napi::Function::New(env, BindUnloadDroppedFiles)); exports.Set("BindGetFileModTime", Napi::Function::New(env, BindGetFileModTime)); exports.Set("BindCompressData", Napi::Function::New(env, BindCompressData)); 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("BindSaveStorageValue", Napi::Function::New(env, BindSaveStorageValue)); - exports.Set("BindLoadStorageValue", Napi::Function::New(env, BindLoadStorageValue)); - exports.Set("BindOpenURL", Napi::Function::New(env, BindOpenURL)); exports.Set("BindIsKeyPressed", Napi::Function::New(env, BindIsKeyPressed)); exports.Set("BindIsKeyDown", Napi::Function::New(env, BindIsKeyDown)); exports.Set("BindIsKeyReleased", Napi::Function::New(env, BindIsKeyReleased)); @@ -6437,6 +7829,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindSetMouseOffset", Napi::Function::New(env, BindSetMouseOffset)); exports.Set("BindSetMouseScale", Napi::Function::New(env, BindSetMouseScale)); exports.Set("BindGetMouseWheelMove", Napi::Function::New(env, BindGetMouseWheelMove)); + exports.Set("BindGetMouseWheelMoveV", Napi::Function::New(env, BindGetMouseWheelMoveV)); exports.Set("BindSetMouseCursor", Napi::Function::New(env, BindSetMouseCursor)); exports.Set("BindGetTouchX", Napi::Function::New(env, BindGetTouchX)); exports.Set("BindGetTouchY", Napi::Function::New(env, BindGetTouchY)); @@ -6607,11 +8000,13 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGenImageFontAtlas", Napi::Function::New(env, BindGenImageFontAtlas)); exports.Set("BindUnloadFontData", Napi::Function::New(env, BindUnloadFontData)); exports.Set("BindUnloadFont", Napi::Function::New(env, BindUnloadFont)); + exports.Set("BindExportFontAsCode", Napi::Function::New(env, BindExportFontAsCode)); exports.Set("BindDrawFPS", Napi::Function::New(env, BindDrawFPS)); exports.Set("BindDrawText", Napi::Function::New(env, BindDrawText)); exports.Set("BindDrawTextEx", Napi::Function::New(env, BindDrawTextEx)); 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("BindMeasureText", Napi::Function::New(env, BindMeasureText)); exports.Set("BindMeasureTextEx", Napi::Function::New(env, BindMeasureTextEx)); exports.Set("BindGetGlyphIndex", Napi::Function::New(env, BindGetGlyphIndex)); @@ -6677,7 +8072,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { 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("BindGenMeshBinormals", Napi::Function::New(env, BindGenMeshBinormals)); exports.Set("BindGenMeshPoly", Napi::Function::New(env, BindGenMeshPoly)); exports.Set("BindGenMeshPlane", Napi::Function::New(env, BindGenMeshPlane)); exports.Set("BindGenMeshCube", Napi::Function::New(env, BindGenMeshCube)); @@ -6700,7 +8094,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindCheckCollisionBoxSphere", Napi::Function::New(env, BindCheckCollisionBoxSphere)); exports.Set("BindGetRayCollisionSphere", Napi::Function::New(env, BindGetRayCollisionSphere)); exports.Set("BindGetRayCollisionBox", Napi::Function::New(env, BindGetRayCollisionBox)); - exports.Set("BindGetRayCollisionModel", Napi::Function::New(env, BindGetRayCollisionModel)); exports.Set("BindGetRayCollisionMesh", Napi::Function::New(env, BindGetRayCollisionMesh)); exports.Set("BindGetRayCollisionTriangle", Napi::Function::New(env, BindGetRayCollisionTriangle)); exports.Set("BindGetRayCollisionQuad", Napi::Function::New(env, BindGetRayCollisionQuad)); @@ -6727,9 +8120,10 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindIsSoundPlaying", Napi::Function::New(env, BindIsSoundPlaying)); exports.Set("BindSetSoundVolume", Napi::Function::New(env, BindSetSoundVolume)); exports.Set("BindSetSoundPitch", Napi::Function::New(env, BindSetSoundPitch)); - exports.Set("BindWaveFormat", Napi::Function::New(env, BindWaveFormat)); + exports.Set("BindSetSoundPan", Napi::Function::New(env, BindSetSoundPan)); exports.Set("BindWaveCopy", Napi::Function::New(env, BindWaveCopy)); exports.Set("BindWaveCrop", Napi::Function::New(env, BindWaveCrop)); + exports.Set("BindWaveFormat", Napi::Function::New(env, BindWaveFormat)); exports.Set("BindLoadWaveSamples", Napi::Function::New(env, BindLoadWaveSamples)); exports.Set("BindUnloadWaveSamples", Napi::Function::New(env, BindUnloadWaveSamples)); exports.Set("BindLoadMusicStream", Napi::Function::New(env, BindLoadMusicStream)); @@ -6744,6 +8138,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindSeekMusicStream", Napi::Function::New(env, BindSeekMusicStream)); exports.Set("BindSetMusicVolume", Napi::Function::New(env, BindSetMusicVolume)); exports.Set("BindSetMusicPitch", Napi::Function::New(env, BindSetMusicPitch)); + exports.Set("BindSetMusicPan", Napi::Function::New(env, BindSetMusicPan)); exports.Set("BindGetMusicTimeLength", Napi::Function::New(env, BindGetMusicTimeLength)); exports.Set("BindGetMusicTimePlayed", Napi::Function::New(env, BindGetMusicTimePlayed)); exports.Set("BindLoadAudioStream", Napi::Function::New(env, BindLoadAudioStream)); @@ -6757,6 +8152,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindStopAudioStream", Napi::Function::New(env, BindStopAudioStream)); exports.Set("BindSetAudioStreamVolume", Napi::Function::New(env, BindSetAudioStreamVolume)); exports.Set("BindSetAudioStreamPitch", Napi::Function::New(env, BindSetAudioStreamPitch)); + exports.Set("BindSetAudioStreamPan", Napi::Function::New(env, BindSetAudioStreamPan)); exports.Set("BindSetAudioStreamBufferSizeDefault", Napi::Function::New(env, BindSetAudioStreamBufferSizeDefault)); exports.Set("BindEaseLinearNone", Napi::Function::New(env, BindEaseLinearNone)); exports.Set("BindEaseLinearIn", Napi::Function::New(env, BindEaseLinearIn)); @@ -6790,6 +8186,8 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindLerp", Napi::Function::New(env, BindLerp)); exports.Set("BindNormalize", Napi::Function::New(env, BindNormalize)); exports.Set("BindRemap", Napi::Function::New(env, BindRemap)); + exports.Set("BindWrap", Napi::Function::New(env, BindWrap)); + exports.Set("BindFloatEquals", Napi::Function::New(env, BindFloatEquals)); exports.Set("BindVector2Zero", Napi::Function::New(env, BindVector2Zero)); exports.Set("BindVector2One", Napi::Function::New(env, BindVector2One)); exports.Set("BindVector2Add", Napi::Function::New(env, BindVector2Add)); @@ -6800,16 +8198,22 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindVector2LengthSqr", Napi::Function::New(env, BindVector2LengthSqr)); exports.Set("BindVector2DotProduct", Napi::Function::New(env, BindVector2DotProduct)); exports.Set("BindVector2Distance", Napi::Function::New(env, BindVector2Distance)); + exports.Set("BindVector2DistanceSqr", Napi::Function::New(env, BindVector2DistanceSqr)); exports.Set("BindVector2Angle", Napi::Function::New(env, BindVector2Angle)); exports.Set("BindVector2Scale", Napi::Function::New(env, BindVector2Scale)); exports.Set("BindVector2Multiply", Napi::Function::New(env, BindVector2Multiply)); exports.Set("BindVector2Negate", Napi::Function::New(env, BindVector2Negate)); exports.Set("BindVector2Divide", Napi::Function::New(env, BindVector2Divide)); exports.Set("BindVector2Normalize", Napi::Function::New(env, BindVector2Normalize)); + 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("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("BindVector3Zero", Napi::Function::New(env, BindVector3Zero)); exports.Set("BindVector3One", Napi::Function::New(env, BindVector3One)); exports.Set("BindVector3Add", Napi::Function::New(env, BindVector3Add)); @@ -6824,6 +8228,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindVector3LengthSqr", Napi::Function::New(env, BindVector3LengthSqr)); exports.Set("BindVector3DotProduct", Napi::Function::New(env, BindVector3DotProduct)); exports.Set("BindVector3Distance", Napi::Function::New(env, BindVector3Distance)); + exports.Set("BindVector3DistanceSqr", Napi::Function::New(env, BindVector3DistanceSqr)); exports.Set("BindVector3Angle", Napi::Function::New(env, BindVector3Angle)); exports.Set("BindVector3Negate", Napi::Function::New(env, BindVector3Negate)); exports.Set("BindVector3Divide", Napi::Function::New(env, BindVector3Divide)); @@ -6831,17 +8236,22 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { 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("BindVector3Lerp", Napi::Function::New(env, BindVector3Lerp)); exports.Set("BindVector3Reflect", Napi::Function::New(env, BindVector3Reflect)); exports.Set("BindVector3Min", Napi::Function::New(env, BindVector3Min)); exports.Set("BindVector3Max", Napi::Function::New(env, BindVector3Max)); exports.Set("BindVector3Barycenter", Napi::Function::New(env, BindVector3Barycenter)); exports.Set("BindVector3Unproject", Napi::Function::New(env, BindVector3Unproject)); + exports.Set("BindVector3Invert", Napi::Function::New(env, BindVector3Invert)); + exports.Set("BindVector3Clamp", Napi::Function::New(env, BindVector3Clamp)); + 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("BindMatrixDeterminant", Napi::Function::New(env, BindMatrixDeterminant)); exports.Set("BindMatrixTrace", Napi::Function::New(env, BindMatrixTrace)); exports.Set("BindMatrixTranspose", Napi::Function::New(env, BindMatrixTranspose)); exports.Set("BindMatrixInvert", Napi::Function::New(env, BindMatrixInvert)); - exports.Set("BindMatrixNormalize", Napi::Function::New(env, BindMatrixNormalize)); exports.Set("BindMatrixIdentity", Napi::Function::New(env, BindMatrixIdentity)); exports.Set("BindMatrixAdd", Napi::Function::New(env, BindMatrixAdd)); exports.Set("BindMatrixSubtract", Napi::Function::New(env, BindMatrixSubtract)); @@ -6880,6 +8290,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindQuaternionFromEuler", Napi::Function::New(env, BindQuaternionFromEuler)); 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("BindGuiEnable", Napi::Function::New(env, BindGuiEnable)); exports.Set("BindGuiDisable", Napi::Function::New(env, BindGuiDisable)); exports.Set("BindGuiLock", Napi::Function::New(env, BindGuiLock)); @@ -6914,7 +8325,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGuiProgressBar", Napi::Function::New(env, BindGuiProgressBar)); exports.Set("BindGuiStatusBar", Napi::Function::New(env, BindGuiStatusBar)); exports.Set("BindGuiDummyRec", Napi::Function::New(env, BindGuiDummyRec)); - exports.Set("BindGuiScrollBar", Napi::Function::New(env, BindGuiScrollBar)); exports.Set("BindGuiGrid", Napi::Function::New(env, BindGuiGrid)); exports.Set("BindGuiListView", Napi::Function::New(env, BindGuiListView)); exports.Set("BindGuiListViewEx", Napi::Function::New(env, BindGuiListViewEx)); @@ -6931,9 +8341,152 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) { exports.Set("BindGuiGetIcons", Napi::Function::New(env, BindGuiGetIcons)); exports.Set("BindGuiGetIconData", Napi::Function::New(env, BindGuiGetIconData)); exports.Set("BindGuiSetIconData", Napi::Function::New(env, BindGuiSetIconData)); + exports.Set("BindGuiSetIconScale", Napi::Function::New(env, BindGuiSetIconScale)); exports.Set("BindGuiSetIconPixel", Napi::Function::New(env, BindGuiSetIconPixel)); exports.Set("BindGuiClearIconPixel", Napi::Function::New(env, BindGuiClearIconPixel)); exports.Set("BindGuiCheckIconPixel", Napi::Function::New(env, BindGuiCheckIconPixel)); + exports.Set("BindrlMatrixMode", Napi::Function::New(env, BindrlMatrixMode)); + exports.Set("BindrlPushMatrix", Napi::Function::New(env, BindrlPushMatrix)); + exports.Set("BindrlPopMatrix", Napi::Function::New(env, BindrlPopMatrix)); + exports.Set("BindrlLoadIdentity", Napi::Function::New(env, BindrlLoadIdentity)); + exports.Set("BindrlTranslatef", Napi::Function::New(env, BindrlTranslatef)); + exports.Set("BindrlRotatef", Napi::Function::New(env, BindrlRotatef)); + exports.Set("BindrlScalef", Napi::Function::New(env, BindrlScalef)); + exports.Set("BindrlMultMatrixf", Napi::Function::New(env, BindrlMultMatrixf)); + 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("BindrlBegin", Napi::Function::New(env, BindrlBegin)); + exports.Set("BindrlEnd", Napi::Function::New(env, BindrlEnd)); + exports.Set("BindrlVertex2i", Napi::Function::New(env, BindrlVertex2i)); + exports.Set("BindrlVertex2f", Napi::Function::New(env, BindrlVertex2f)); + exports.Set("BindrlVertex3f", Napi::Function::New(env, BindrlVertex3f)); + exports.Set("BindrlTexCoord2f", Napi::Function::New(env, BindrlTexCoord2f)); + exports.Set("BindrlNormal3f", Napi::Function::New(env, BindrlNormal3f)); + exports.Set("BindrlColor4ub", Napi::Function::New(env, BindrlColor4ub)); + exports.Set("BindrlColor3f", Napi::Function::New(env, BindrlColor3f)); + exports.Set("BindrlColor4f", Napi::Function::New(env, BindrlColor4f)); + exports.Set("BindrlEnableVertexArray", Napi::Function::New(env, BindrlEnableVertexArray)); + exports.Set("BindrlDisableVertexArray", Napi::Function::New(env, BindrlDisableVertexArray)); + exports.Set("BindrlEnableVertexBuffer", Napi::Function::New(env, BindrlEnableVertexBuffer)); + exports.Set("BindrlDisableVertexBuffer", Napi::Function::New(env, BindrlDisableVertexBuffer)); + exports.Set("BindrlEnableVertexBufferElement", Napi::Function::New(env, BindrlEnableVertexBufferElement)); + exports.Set("BindrlDisableVertexBufferElement", Napi::Function::New(env, BindrlDisableVertexBufferElement)); + exports.Set("BindrlEnableVertexAttribute", Napi::Function::New(env, BindrlEnableVertexAttribute)); + exports.Set("BindrlDisableVertexAttribute", Napi::Function::New(env, BindrlDisableVertexAttribute)); + exports.Set("BindrlActiveTextureSlot", Napi::Function::New(env, BindrlActiveTextureSlot)); + exports.Set("BindrlEnableTexture", Napi::Function::New(env, BindrlEnableTexture)); + exports.Set("BindrlDisableTexture", Napi::Function::New(env, BindrlDisableTexture)); + exports.Set("BindrlEnableTextureCubemap", Napi::Function::New(env, BindrlEnableTextureCubemap)); + exports.Set("BindrlDisableTextureCubemap", Napi::Function::New(env, BindrlDisableTextureCubemap)); + exports.Set("BindrlTextureParameters", Napi::Function::New(env, BindrlTextureParameters)); + exports.Set("BindrlEnableShader", Napi::Function::New(env, BindrlEnableShader)); + 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("BindrlActiveDrawBuffers", Napi::Function::New(env, BindrlActiveDrawBuffers)); + exports.Set("BindrlEnableColorBlend", Napi::Function::New(env, BindrlEnableColorBlend)); + exports.Set("BindrlDisableColorBlend", Napi::Function::New(env, BindrlDisableColorBlend)); + exports.Set("BindrlEnableDepthTest", Napi::Function::New(env, BindrlEnableDepthTest)); + exports.Set("BindrlDisableDepthTest", Napi::Function::New(env, BindrlDisableDepthTest)); + exports.Set("BindrlEnableDepthMask", Napi::Function::New(env, BindrlEnableDepthMask)); + 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("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("BindrlDisableWireMode", Napi::Function::New(env, BindrlDisableWireMode)); + exports.Set("BindrlSetLineWidth", Napi::Function::New(env, BindrlSetLineWidth)); + exports.Set("BindrlGetLineWidth", Napi::Function::New(env, BindrlGetLineWidth)); + exports.Set("BindrlEnableSmoothLines", Napi::Function::New(env, BindrlEnableSmoothLines)); + exports.Set("BindrlDisableSmoothLines", Napi::Function::New(env, BindrlDisableSmoothLines)); + exports.Set("BindrlEnableStereoRender", Napi::Function::New(env, BindrlEnableStereoRender)); + exports.Set("BindrlDisableStereoRender", Napi::Function::New(env, BindrlDisableStereoRender)); + exports.Set("BindrlIsStereoRenderEnabled", Napi::Function::New(env, BindrlIsStereoRenderEnabled)); + exports.Set("BindrlClearColor", Napi::Function::New(env, BindrlClearColor)); + exports.Set("BindrlClearScreenBuffers", Napi::Function::New(env, BindrlClearScreenBuffers)); + exports.Set("BindrlCheckErrors", Napi::Function::New(env, BindrlCheckErrors)); + exports.Set("BindrlSetBlendMode", Napi::Function::New(env, BindrlSetBlendMode)); + exports.Set("BindrlSetBlendFactors", Napi::Function::New(env, BindrlSetBlendFactors)); + exports.Set("BindrlglInit", Napi::Function::New(env, BindrlglInit)); + exports.Set("BindrlglClose", Napi::Function::New(env, BindrlglClose)); + exports.Set("BindrlLoadExtensions", Napi::Function::New(env, BindrlLoadExtensions)); + exports.Set("BindrlGetVersion", Napi::Function::New(env, BindrlGetVersion)); + exports.Set("BindrlSetFramebufferWidth", Napi::Function::New(env, BindrlSetFramebufferWidth)); + exports.Set("BindrlGetFramebufferWidth", Napi::Function::New(env, BindrlGetFramebufferWidth)); + exports.Set("BindrlSetFramebufferHeight", Napi::Function::New(env, BindrlSetFramebufferHeight)); + exports.Set("BindrlGetFramebufferHeight", Napi::Function::New(env, BindrlGetFramebufferHeight)); + exports.Set("BindrlGetTextureIdDefault", Napi::Function::New(env, BindrlGetTextureIdDefault)); + exports.Set("BindrlGetShaderIdDefault", Napi::Function::New(env, BindrlGetShaderIdDefault)); + exports.Set("BindrlGetShaderLocsDefault", Napi::Function::New(env, BindrlGetShaderLocsDefault)); + exports.Set("BindrlLoadRenderBatch", Napi::Function::New(env, BindrlLoadRenderBatch)); + exports.Set("BindrlUnloadRenderBatch", Napi::Function::New(env, BindrlUnloadRenderBatch)); + exports.Set("BindrlDrawRenderBatch", Napi::Function::New(env, BindrlDrawRenderBatch)); + exports.Set("BindrlSetRenderBatchActive", Napi::Function::New(env, BindrlSetRenderBatchActive)); + exports.Set("BindrlDrawRenderBatchActive", Napi::Function::New(env, BindrlDrawRenderBatchActive)); + exports.Set("BindrlCheckRenderBatchLimit", Napi::Function::New(env, BindrlCheckRenderBatchLimit)); + exports.Set("BindrlSetTexture", Napi::Function::New(env, BindrlSetTexture)); + exports.Set("BindrlLoadVertexArray", Napi::Function::New(env, BindrlLoadVertexArray)); + exports.Set("BindrlLoadVertexBuffer", Napi::Function::New(env, BindrlLoadVertexBuffer)); + exports.Set("BindrlLoadVertexBufferElement", Napi::Function::New(env, BindrlLoadVertexBufferElement)); + exports.Set("BindrlUpdateVertexBuffer", Napi::Function::New(env, BindrlUpdateVertexBuffer)); + exports.Set("BindrlUpdateVertexBufferElements", Napi::Function::New(env, BindrlUpdateVertexBufferElements)); + exports.Set("BindrlUnloadVertexArray", Napi::Function::New(env, BindrlUnloadVertexArray)); + exports.Set("BindrlUnloadVertexBuffer", Napi::Function::New(env, BindrlUnloadVertexBuffer)); + exports.Set("BindrlSetVertexAttribute", Napi::Function::New(env, BindrlSetVertexAttribute)); + exports.Set("BindrlSetVertexAttributeDivisor", Napi::Function::New(env, BindrlSetVertexAttributeDivisor)); + exports.Set("BindrlSetVertexAttributeDefault", Napi::Function::New(env, BindrlSetVertexAttributeDefault)); + exports.Set("BindrlDrawVertexArray", Napi::Function::New(env, BindrlDrawVertexArray)); + exports.Set("BindrlDrawVertexArrayElements", Napi::Function::New(env, BindrlDrawVertexArrayElements)); + exports.Set("BindrlDrawVertexArrayInstanced", Napi::Function::New(env, BindrlDrawVertexArrayInstanced)); + exports.Set("BindrlDrawVertexArrayElementsInstanced", Napi::Function::New(env, BindrlDrawVertexArrayElementsInstanced)); + exports.Set("BindrlLoadTexture", Napi::Function::New(env, BindrlLoadTexture)); + exports.Set("BindrlLoadTextureDepth", Napi::Function::New(env, BindrlLoadTextureDepth)); + exports.Set("BindrlLoadTextureCubemap", Napi::Function::New(env, BindrlLoadTextureCubemap)); + exports.Set("BindrlUpdateTexture", Napi::Function::New(env, BindrlUpdateTexture)); + exports.Set("BindrlGetGlTextureFormats", Napi::Function::New(env, BindrlGetGlTextureFormats)); + exports.Set("BindrlGetPixelFormatName", Napi::Function::New(env, BindrlGetPixelFormatName)); + exports.Set("BindrlUnloadTexture", Napi::Function::New(env, BindrlUnloadTexture)); + exports.Set("BindrlGenTextureMipmaps", Napi::Function::New(env, BindrlGenTextureMipmaps)); + exports.Set("BindrlReadTexturePixels", Napi::Function::New(env, BindrlReadTexturePixels)); + exports.Set("BindrlReadScreenPixels", Napi::Function::New(env, BindrlReadScreenPixels)); + exports.Set("BindrlLoadFramebuffer", Napi::Function::New(env, BindrlLoadFramebuffer)); + exports.Set("BindrlFramebufferAttach", Napi::Function::New(env, BindrlFramebufferAttach)); + exports.Set("BindrlFramebufferComplete", Napi::Function::New(env, BindrlFramebufferComplete)); + exports.Set("BindrlUnloadFramebuffer", Napi::Function::New(env, BindrlUnloadFramebuffer)); + exports.Set("BindrlLoadShaderCode", Napi::Function::New(env, BindrlLoadShaderCode)); + exports.Set("BindrlCompileShader", Napi::Function::New(env, BindrlCompileShader)); + exports.Set("BindrlLoadShaderProgram", Napi::Function::New(env, BindrlLoadShaderProgram)); + exports.Set("BindrlUnloadShaderProgram", Napi::Function::New(env, BindrlUnloadShaderProgram)); + exports.Set("BindrlGetLocationUniform", Napi::Function::New(env, BindrlGetLocationUniform)); + 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("BindrlSetUniformSampler", Napi::Function::New(env, BindrlSetUniformSampler)); + exports.Set("BindrlSetShader", Napi::Function::New(env, BindrlSetShader)); + exports.Set("BindrlLoadComputeShaderProgram", Napi::Function::New(env, BindrlLoadComputeShaderProgram)); + exports.Set("BindrlComputeShaderDispatch", Napi::Function::New(env, BindrlComputeShaderDispatch)); + exports.Set("BindrlLoadShaderBuffer", Napi::Function::New(env, BindrlLoadShaderBuffer)); + exports.Set("BindrlUnloadShaderBuffer", Napi::Function::New(env, BindrlUnloadShaderBuffer)); + exports.Set("BindrlUpdateShaderBufferElements", Napi::Function::New(env, BindrlUpdateShaderBufferElements)); + exports.Set("BindrlGetShaderBufferSize", Napi::Function::New(env, BindrlGetShaderBufferSize)); + exports.Set("BindrlReadShaderBufferElements", Napi::Function::New(env, BindrlReadShaderBufferElements)); + exports.Set("BindrlBindShaderBuffer", Napi::Function::New(env, BindrlBindShaderBuffer)); + exports.Set("BindrlCopyBuffersElements", Napi::Function::New(env, BindrlCopyBuffersElements)); + exports.Set("BindrlBindImageTexture", Napi::Function::New(env, BindrlBindImageTexture)); + exports.Set("BindrlGetMatrixModelview", Napi::Function::New(env, BindrlGetMatrixModelview)); + exports.Set("BindrlGetMatrixProjection", Napi::Function::New(env, BindrlGetMatrixProjection)); + exports.Set("BindrlGetMatrixTransform", Napi::Function::New(env, BindrlGetMatrixTransform)); + exports.Set("BindrlGetMatrixProjectionStereo", Napi::Function::New(env, BindrlGetMatrixProjectionStereo)); + exports.Set("BindrlGetMatrixViewOffsetStereo", Napi::Function::New(env, BindrlGetMatrixViewOffsetStereo)); + exports.Set("BindrlSetMatrixProjection", Napi::Function::New(env, BindrlSetMatrixProjection)); + exports.Set("BindrlSetMatrixModelview", Napi::Function::New(env, BindrlSetMatrixModelview)); + exports.Set("BindrlSetMatrixProjectionStereo", Napi::Function::New(env, BindrlSetMatrixProjectionStereo)); + exports.Set("BindrlSetMatrixViewOffsetStereo", Napi::Function::New(env, BindrlSetMatrixViewOffsetStereo)); + exports.Set("BindrlLoadDrawCube", Napi::Function::New(env, BindrlLoadDrawCube)); + exports.Set("BindrlLoadDrawQuad", Napi::Function::New(env, BindrlLoadDrawQuad)); exports.Set("BindSetShaderFloat", Napi::Function::New(env, BindSetShaderFloat)); exports.Set("BindSetShaderInt", Napi::Function::New(env, BindSetShaderInt)); diff --git a/src/generated/node-raylib.d.ts b/src/generated/node-raylib.d.ts index 675df3c..22878c0 100644 --- a/src/generated/node-raylib.d.ts +++ b/src/generated/node-raylib.d.ts @@ -2,406 +2,460 @@ declare module "raylib" { /** Vector2, 2 components */ export interface Vector2 { - /** Vector x component */ + /** Vector x component. (float) */ x: number - /** Vector y component */ + /** Vector y component. (float) */ y: number } /** Vector3, 3 components */ export interface Vector3 { - /** Vector x component */ + /** Vector x component. (float) */ x: number - /** Vector y component */ + /** Vector y component. (float) */ y: number - /** Vector z component */ + /** Vector z component. (float) */ z: number } /** Vector4, 4 components */ export interface Vector4 { - /** Vector x component */ + /** Vector x component. (float) */ x: number - /** Vector y component */ + /** Vector y component. (float) */ y: number - /** Vector z component */ + /** Vector z component. (float) */ z: number - /** Vector w component */ + /** Vector w component. (float) */ w: number } /** Matrix, 4x4 components, column major, OpenGL style, right handed */ export interface Matrix { - /** Matrix first row (4 components) */ + /** Matrix first row (4 components). (float) */ m0: number - /** Matrix first row (4 components) */ + /** Matrix first row (4 components). (float) */ m4: number - /** Matrix first row (4 components) */ + /** Matrix first row (4 components). (float) */ m8: number - /** Matrix first row (4 components) */ + /** Matrix first row (4 components). (float) */ m12: number - /** Matrix second row (4 components) */ + /** Matrix second row (4 components). (float) */ m1: number - /** Matrix second row (4 components) */ + /** Matrix second row (4 components). (float) */ m5: number - /** Matrix second row (4 components) */ + /** Matrix second row (4 components). (float) */ m9: number - /** Matrix second row (4 components) */ + /** Matrix second row (4 components). (float) */ m13: number - /** Matrix third row (4 components) */ + /** Matrix third row (4 components). (float) */ m2: number - /** Matrix third row (4 components) */ + /** Matrix third row (4 components). (float) */ m6: number - /** Matrix third row (4 components) */ + /** Matrix third row (4 components). (float) */ m10: number - /** Matrix third row (4 components) */ + /** Matrix third row (4 components). (float) */ m14: number - /** Matrix fourth row (4 components) */ + /** Matrix fourth row (4 components). (float) */ m3: number - /** Matrix fourth row (4 components) */ + /** Matrix fourth row (4 components). (float) */ m7: number - /** Matrix fourth row (4 components) */ + /** Matrix fourth row (4 components). (float) */ m11: number - /** Matrix fourth row (4 components) */ + /** Matrix fourth row (4 components). (float) */ m15: number } /** Color, 4 components, R8G8B8A8 (32bit) */ export interface Color { - /** Color red value */ + /** Color red value. (unsigned char) */ r: number - /** Color green value */ + /** Color green value. (unsigned char) */ g: number - /** Color blue value */ + /** Color blue value. (unsigned char) */ b: number - /** Color alpha value */ + /** Color alpha value. (unsigned char) */ a: number } /** Rectangle, 4 components */ export interface Rectangle { - /** Rectangle top-left corner position x */ + /** Rectangle top-left corner position x. (float) */ x: number - /** Rectangle top-left corner position y */ + /** Rectangle top-left corner position y. (float) */ y: number - /** Rectangle width */ + /** Rectangle width. (float) */ width: number - /** Rectangle height */ + /** Rectangle height. (float) */ height: number } /** Image, pixel data stored in CPU memory (RAM) */ export interface Image { - /** Image raw data */ + /** Image raw data. (void *) */ data: number - /** Image base width */ + /** Image base width. (int) */ width: number - /** Image base height */ + /** Image base height. (int) */ height: number - /** Mipmap levels, 1 by default */ + /** Mipmap levels, 1 by default. (int) */ mipmaps: number - /** Data format (PixelFormat type) */ + /** Data format (PixelFormat type). (int) */ format: number } /** Texture, tex data stored in GPU memory (VRAM) */ export interface Texture { - /** OpenGL texture id */ + /** OpenGL texture id. (unsigned int) */ id: number - /** Texture base width */ + /** Texture base width. (int) */ width: number - /** Texture base height */ + /** Texture base height. (int) */ height: number - /** Mipmap levels, 1 by default */ + /** Mipmap levels, 1 by default. (int) */ mipmaps: number - /** Data format (PixelFormat type) */ + /** Data format (PixelFormat type). (int) */ format: number } /** RenderTexture, fbo for texture rendering */ export interface RenderTexture { - /** OpenGL framebuffer object id */ + /** OpenGL framebuffer object id. (unsigned int) */ id: number - /** Color buffer attachment texture */ + /** Color buffer attachment texture. (Texture) */ texture: Texture - /** Depth buffer attachment texture */ + /** Depth buffer attachment texture. (Texture) */ depth: Texture } /** NPatchInfo, n-patch layout info */ export interface NPatchInfo { - /** Texture source rectangle */ + /** Texture source rectangle. (Rectangle) */ source: Rectangle - /** Left border offset */ + /** Left border offset. (int) */ left: number - /** Top border offset */ + /** Top border offset. (int) */ top: number - /** Right border offset */ + /** Right border offset. (int) */ right: number - /** Bottom border offset */ + /** Bottom border offset. (int) */ bottom: number - /** Layout of the n-patch: 3x3, 1x3 or 3x1 */ + /** Layout of the n-patch: 3x3, 1x3 or 3x1. (int) */ layout: number } /** GlyphInfo, font characters glyphs info */ export interface GlyphInfo { - /** Character value (Unicode) */ + /** Character value (Unicode). (int) */ value: number - /** Character offset X when drawing */ + /** Character offset X when drawing. (int) */ offsetX: number - /** Character offset Y when drawing */ + /** Character offset Y when drawing. (int) */ offsetY: number - /** Character advance position X */ + /** Character advance position X. (int) */ advanceX: number - /** Character image data */ + /** Character image data. (Image) */ image: Image } /** Font, font texture and GlyphInfo array data */ export interface Font { - /** Base size (default chars height) */ + /** Base size (default chars height). (int) */ baseSize: number - /** Number of glyph characters */ + /** Number of glyph characters. (int) */ glyphCount: number - /** Padding around the glyph characters */ + /** Padding around the glyph characters. (int) */ glyphPadding: number - /** Texture atlas containing the glyphs */ + /** Texture atlas containing the glyphs. (Texture) */ texture: Texture - /** Rectangles in texture for the glyphs */ + /** Rectangles in texture for the glyphs. (Rectangle *) */ recs: number - /** Glyphs info data */ + /** Glyphs info data. (GlyphInfo *) */ glyphs: number } /** Camera, defines position/orientation in 3d space */ export interface Camera3D { - /** Camera position */ + /** Camera position. (Vector3) */ position: Vector3 - /** Camera target it looks-at */ + /** Camera target it looks-at. (Vector3) */ target: Vector3 - /** Camera up vector (rotation over its axis) */ + /** Camera up vector (rotation over its axis). (Vector3) */ up: Vector3 - /** Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic */ + /** Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic. (float) */ fovy: number - /** Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC */ + /** Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC. (int) */ projection: number } /** Camera2D, defines position/orientation in 2d space */ export interface Camera2D { - /** Camera offset (displacement from target) */ + /** Camera offset (displacement from target). (Vector2) */ offset: Vector2 - /** Camera target (rotation and zoom origin) */ + /** Camera target (rotation and zoom origin). (Vector2) */ target: Vector2 - /** Camera rotation in degrees */ + /** Camera rotation in degrees. (float) */ rotation: number - /** Camera zoom (scaling), should be 1.0f by default */ + /** Camera zoom (scaling), should be 1.0f by default. (float) */ zoom: number } /** Mesh, vertex data and vao/vbo */ export interface Mesh { - /** Number of vertices stored in arrays */ + /** Number of vertices stored in arrays. (int) */ vertexCount: number - /** Number of triangles stored (indexed or not) */ + /** Number of triangles stored (indexed or not). (int) */ triangleCount: number - /** Vertex position (XYZ - 3 components per vertex) (shader-location = 0) */ + /** Vertex position (XYZ - 3 components per vertex) (shader-location = 0). (float *) */ vertices: number - /** Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) */ + /** Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1). (float *) */ texcoords: number - /** Vertex second texture coordinates (useful for lightmaps) (shader-location = 5) */ + /** Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5). (float *) */ texcoords2: number - /** Vertex normals (XYZ - 3 components per vertex) (shader-location = 2) */ + /** Vertex normals (XYZ - 3 components per vertex) (shader-location = 2). (float *) */ normals: number - /** Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4) */ + /** Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4). (float *) */ tangents: number - /** Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) */ + /** Vertex colors (RGBA - 4 components per vertex) (shader-location = 3). (unsigned char *) */ colors: Buffer - /** Vertex indices (in case vertex data comes indexed) */ + /** Vertex indices (in case vertex data comes indexed). (unsigned short *) */ indices: number - /** Animated vertex positions (after bones transformations) */ + /** Animated vertex positions (after bones transformations). (float *) */ animVertices: number - /** Animated normals (after bones transformations) */ + /** Animated normals (after bones transformations). (float *) */ animNormals: number - /** Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) */ + /** Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning). (unsigned char *) */ boneIds: Buffer - /** Vertex bone weight, up to 4 bones influence by vertex (skinning) */ + /** Vertex bone weight, up to 4 bones influence by vertex (skinning). (float *) */ boneWeights: number - /** OpenGL Vertex Array Object id */ + /** OpenGL Vertex Array Object id. (unsigned int) */ vaoId: number - /** OpenGL Vertex Buffer Objects id (default vertex data) */ + /** OpenGL Vertex Buffer Objects id (default vertex data). (unsigned int *) */ vboId: number } /** Shader */ export interface Shader { - /** Shader program id */ + /** Shader program id. (unsigned int) */ id: number - /** Shader locations array (RL_MAX_SHADER_LOCATIONS) */ + /** Shader locations array (RL_MAX_SHADER_LOCATIONS). (int *) */ locs: number } /** MaterialMap */ export interface MaterialMap { - /** Material map texture */ + /** Material map texture. (Texture) */ texture: Texture - /** Material map color */ + /** Material map color. (Color) */ color: Color - /** Material map value */ + /** Material map value. (float) */ value: number } /** Material, includes shader and maps */ export interface Material { - /** Material shader */ + /** Material shader. (Shader) */ shader: Shader - /** Material maps array (MAX_MATERIAL_MAPS) */ + /** Material maps array (MAX_MATERIAL_MAPS). (MaterialMap *) */ maps: number - /** Material generic parameters (if required) */ - params: float[4] + /** Material generic parameters (if required). (float[4]) */ + params: number } /** Transform, vectex transformation data */ export interface Transform { - /** Translation */ + /** Translation. (Vector3) */ translation: Vector3 - /** Rotation */ + /** Rotation. (Vector4) */ rotation: Vector4 - /** Scale */ + /** Scale. (Vector3) */ scale: Vector3 } /** Bone, skeletal animation bone */ export interface BoneInfo { - /** Bone name */ + /** Bone name. (char) */ name: string - /** Bone parent */ + /** Bone parent. (char) */ parent: string } /** Model, meshes, materials and animation data */ export interface Model { - /** Local transform matrix */ + /** Local transform matrix. (Matrix) */ transform: Matrix - /** Number of meshes */ + /** Number of meshes. (int) */ meshCount: number - /** Number of materials */ + /** Number of materials. (int) */ materialCount: number - /** Meshes array */ + /** Meshes array. (Mesh *) */ meshes: number - /** Materials array */ + /** Materials array. (Material *) */ materials: number - /** Mesh material number */ + /** Mesh material number. (int *) */ meshMaterial: number - /** Number of bones */ + /** Number of bones. (int) */ boneCount: number - /** Bones information (skeleton) */ + /** Bones information (skeleton). (BoneInfo *) */ bones: number - /** Bones base transformation (pose) */ + /** Bones base transformation (pose). (Transform *) */ bindPose: number } /** ModelAnimation */ export interface ModelAnimation { - /** Number of bones */ + /** Number of bones. (int) */ boneCount: number - /** Number of animation frames */ + /** Number of animation frames. (int) */ frameCount: number - /** Bones information (skeleton) */ + /** Bones information (skeleton). (BoneInfo *) */ bones: number - /** Poses array by frame */ + /** Poses array by frame. (Transform **) */ framePoses: number } /** Ray, ray for raycasting */ export interface Ray { - /** Ray position (origin) */ + /** Ray position (origin). (Vector3) */ position: Vector3 - /** Ray direction */ + /** Ray direction. (Vector3) */ direction: Vector3 } /** RayCollision, ray hit information */ export interface RayCollision { - /** Did the ray hit something? */ + /** Did the ray hit something?. (bool) */ hit: boolean - /** Distance to nearest hit */ + /** Distance to nearest hit. (float) */ distance: number - /** Point of nearest hit */ + /** Point of nearest hit. (Vector3) */ point: Vector3 - /** Surface normal of hit */ + /** Surface normal of hit. (Vector3) */ normal: Vector3 } /** BoundingBox */ export interface BoundingBox { - /** Minimum vertex box-corner */ + /** Minimum vertex box-corner. (Vector3) */ min: Vector3 - /** Maximum vertex box-corner */ + /** Maximum vertex box-corner. (Vector3) */ max: Vector3 } /** Wave, audio wave data */ export interface Wave { - /** Total number of frames (considering channels) */ + /** Total number of frames (considering channels). (unsigned int) */ frameCount: number - /** Frequency (samples per second) */ + /** Frequency (samples per second). (unsigned int) */ sampleRate: number - /** Bit depth (bits per sample): 8, 16, 32 (24 not supported) */ + /** Bit depth (bits per sample): 8, 16, 32 (24 not supported). (unsigned int) */ sampleSize: number - /** Number of channels (1-mono, 2-stereo, ...) */ + /** Number of channels (1-mono, 2-stereo, ...). (unsigned int) */ channels: number - /** Buffer data pointer */ + /** Buffer data pointer. (void *) */ data: number } /** AudioStream, custom audio stream */ export interface AudioStream { - /** Pointer to internal data used by the audio system */ + /** Pointer to internal data used by the audio system. (rAudioBuffer *) */ buffer: number - /** Frequency (samples per second) */ + /** Pointer to internal data processor, useful for audio effects. (rAudioProcessor *) */ + processor: number + /** Frequency (samples per second). (unsigned int) */ sampleRate: number - /** Bit depth (bits per sample): 8, 16, 32 (24 not supported) */ + /** Bit depth (bits per sample): 8, 16, 32 (24 not supported). (unsigned int) */ sampleSize: number - /** Number of channels (1-mono, 2-stereo, ...) */ + /** Number of channels (1-mono, 2-stereo, ...). (unsigned int) */ channels: number } /** Sound */ export interface Sound { - /** Audio stream */ + /** Audio stream. (AudioStream) */ stream: AudioStream - /** Total number of frames (considering channels) */ + /** Total number of frames (considering channels). (unsigned int) */ frameCount: number } /** Music, audio stream, anything longer than ~10 seconds should be streamed */ export interface Music { - /** Audio stream */ + /** Audio stream. (AudioStream) */ stream: AudioStream - /** Total number of frames (considering channels) */ + /** Total number of frames (considering channels). (unsigned int) */ frameCount: number - /** Music looping enable */ + /** Music looping enable. (bool) */ looping: boolean - /** Type of music context (audio filetype) */ + /** Type of music context (audio filetype). (int) */ ctxType: number - /** Audio context data, depends on type */ + /** Audio context data, depends on type. (void *) */ ctxData: number } /** VrDeviceInfo, Head-Mounted-Display device parameters */ export interface VrDeviceInfo { - /** Horizontal resolution in pixels */ + /** Horizontal resolution in pixels. (int) */ hResolution: number - /** Vertical resolution in pixels */ + /** Vertical resolution in pixels. (int) */ vResolution: number - /** Horizontal size in meters */ + /** Horizontal size in meters. (float) */ hScreenSize: number - /** Vertical size in meters */ + /** Vertical size in meters. (float) */ vScreenSize: number - /** Screen center in meters */ + /** Screen center in meters. (float) */ vScreenCenter: number - /** Distance between eye and display in meters */ + /** Distance between eye and display in meters. (float) */ eyeToScreenDistance: number - /** Lens separation distance in meters */ + /** Lens separation distance in meters. (float) */ lensSeparationDistance: number - /** IPD (distance between pupils) in meters */ + /** IPD (distance between pupils) in meters. (float) */ interpupillaryDistance: number - /** Lens distortion constant parameters */ - lensDistortionValues: float[4] - /** Chromatic aberration correction parameters */ - chromaAbCorrection: float[4] + /** Lens distortion constant parameters. (float[4]) */ + lensDistortionValues: number + /** Chromatic aberration correction parameters. (float[4]) */ + chromaAbCorrection: number } /** VrStereoConfig, VR stereo rendering configuration for simulator */ export interface VrStereoConfig { - /** VR projection matrices (per eye) */ - projection: Matrix[2] - /** VR view offset matrices (per eye) */ - viewOffset: Matrix[2] - /** VR left lens center */ - leftLensCenter: float[2] - /** VR right lens center */ - rightLensCenter: float[2] - /** VR left screen center */ - leftScreenCenter: float[2] - /** VR right screen center */ - rightScreenCenter: float[2] - /** VR distortion scale */ - scale: float[2] - /** VR distortion scale in */ - scaleIn: float[2] + /** VR projection matrices (per eye). (Matrix[2]) */ + projection: number + /** VR view offset matrices (per eye). (Matrix[2]) */ + viewOffset: number + /** VR left lens center. (float[2]) */ + leftLensCenter: number + /** VR right lens center. (float[2]) */ + rightLensCenter: number + /** VR left screen center. (float[2]) */ + leftScreenCenter: number + /** VR right screen center. (float[2]) */ + rightScreenCenter: number + /** VR distortion scale. (float[2]) */ + scale: number + /** VR distortion scale in. (float[2]) */ + scaleIn: number + } + /** File path list */ + export interface FilePathList { + /** Filepaths max entries. (unsigned int) */ + capacity: number + /** Filepaths entries count. (unsigned int) */ + count: number + /** Filepaths entries. (char **) */ + paths: number + } + /** Dynamic vertex buffers (position + texcoords + colors + indices arrays) */ + export interface rlVertexBuffer { + /** Number of elements in the buffer (QUADS). (int) */ + elementCount: number + /** Vertex position (XYZ - 3 components per vertex) (shader-location = 0). (float *) */ + 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 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]) */ + vboId: number + } + /** of those state-change happens (this is done in core module) */ + export interface rlDrawCall { + /** Drawing mode: LINES, TRIANGLES, QUADS. (int) */ + mode: number + /** Number of vertex of the draw. (int) */ + vertexCount: number + /** Number of vertex required for index alignment (LINES, TRIANGLES). (int) */ + vertexAlignment: number + /** Texture id to be used on the draw -> Use to create new draw call if changes. (unsigned int) */ + textureId: number + } + /** rlRenderBatch type */ + export interface rlRenderBatch { + /** Number of vertex buffers (multi-buffering support). (int) */ + bufferCount: number + /** Current buffer tracking in case of multi-buffering. (int) */ + currentBuffer: number + /** Dynamic buffer(s) for vertex data. (rlVertexBuffer *) */ + vertexBuffer: number + /** Draw calls array, depends on textureId. (rlDrawCall *) */ + draws: number + /** Draw calls counter. (int) */ + drawCounter: number + /** Current depth value for next draw. (float) */ + currentDepth: number } /** RenderTexture, fbo for texture rendering */ @@ -416,6 +470,8 @@ declare module "raylib" { /** Camera, defines position/orientation in 3d space */ export type Camera = Camera3D | Camera2D + /** Quaternion, same as Vector4 */ + export type Quaternion = Vector4 /** Initialize window and OpenGL context */ export function InitWindow(width: number, height: number, title: string): void @@ -449,7 +505,7 @@ declare module "raylib" { /** Check if one specific window flag is enabled */ export function IsWindowState(flag: number): boolean - /** Set window configuration state using flags */ + /** Set window configuration state using flags (only PLATFORM_DESKTOP) */ export function SetWindowState(flags: number): void /** Clear window configuration state flags */ @@ -485,6 +541,9 @@ declare module "raylib" { /** Set window dimensions */ export function SetWindowSize(width: number, height: number): void + /** Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) */ + export function SetWindowOpacity(opacity: number): void + /** Get native window handle */ export function GetWindowHandle(): number @@ -494,6 +553,12 @@ declare module "raylib" { /** Get current screen height */ export function GetScreenHeight(): number + /** Get current render width (it considers HiDPI) */ + export function GetRenderWidth(): number + + /** Get current render height (it considers HiDPI) */ + export function GetRenderHeight(): number + /** Get number of connected monitors */ export function GetMonitorCount(): number @@ -503,10 +568,10 @@ declare module "raylib" { /** Get specified monitor position */ export function GetMonitorPosition(monitor: number): Vector2 - /** Get specified monitor width (max available by monitor) */ + /** Get specified monitor width (current video mode used by monitor) */ export function GetMonitorWidth(monitor: number): number - /** Get specified monitor height (max available by monitor) */ + /** Get specified monitor height (current video mode used by monitor) */ export function GetMonitorHeight(monitor: number): number /** Get specified monitor physical width in millimetres */ @@ -533,14 +598,20 @@ declare module "raylib" { /** Get clipboard text content */ export function GetClipboardText(): string + /** 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 milliseconds (halt program execution) */ - export function WaitTime(ms: number): void + /** Wait for some time (halt program execution) */ + export function WaitTime(seconds: number): void /** Shows cursor */ export function ShowCursor(): void @@ -641,15 +712,15 @@ declare module "raylib" { /** 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 - /** Set target FPS (maximum) */ export function SetTargetFPS(fps: number): void @@ -686,6 +757,9 @@ 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 @@ -695,6 +769,9 @@ declare module "raylib" { /** Save data to file from byte array (write), returns true on success */ export function SaveFileData(fileName: string, data: number, bytesToWrite: number): boolean + /** Export data to code (.h), returns true on success */ + export function ExportDataAsCode(data: string, size: number, fileName: string): boolean + /** Load text data from file (read), returns a '\0' terminated string */ export function LoadFileText(fileName: string): string @@ -713,6 +790,9 @@ declare module "raylib" { /** Check file extension (including point: .png, .wav) */ export function IsFileExtension(fileName: string, ext: string): boolean + /** Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) */ + export function GetFileLength(fileName: string): number + /** Get pointer to extension for a filename string (includes dot: '.png') */ export function GetFileExtension(fileName: string): string @@ -731,47 +811,47 @@ declare module "raylib" { /** Get current working directory (uses static string) */ export function GetWorkingDirectory(): string - /** Get filenames in a directory path (memory should be freed) */ - export function GetDirectoryFiles(dirPath: string, count: number): number - - /** Clear directory files paths buffers (free memory) */ - export function ClearDirectoryFiles(): void + /** Get the directory if the running application (uses static string) */ + export function GetApplicationDirectory(): string /** 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 + + /** Load directory filepaths */ + export function LoadDirectoryFiles(dirPath: string): FilePathList + + /** Load directory filepaths with extension filtering and recursive directory scan */ + export function LoadDirectoryFilesEx(basePath: string, filter: string, scanSubdirs: boolean): FilePathList + + /** Unload filepaths */ + export function UnloadDirectoryFiles(files: FilePathList): void + /** Check if a file has been dropped into window */ export function IsFileDropped(): boolean - /** Get dropped files names (memory should be freed) */ - export function GetDroppedFiles(count: number): number + /** Load dropped filepaths */ + export function LoadDroppedFiles(): FilePathList - /** Clear dropped files paths buffer (free memory) */ - export function ClearDroppedFiles(): void + /** Unload dropped filepaths */ + export function UnloadDroppedFiles(files: FilePathList): void /** Get file modification time (last write time) */ export function GetFileModTime(fileName: string): number - /** Compress data (DEFLATE algorithm) */ - export function CompressData(data: Buffer, dataLength: number, compDataLength: number): Buffer - - /** Decompress data (DEFLATE algorithm) */ - export function DecompressData(compData: Buffer, compDataLength: number, dataLength: number): Buffer - - /** Encode data to Base64 string */ - export function EncodeDataBase64(data: Buffer, dataLength: number, outputLength: number): string - - /** Decode Base64 string data */ - export function DecodeDataBase64(data: Buffer, outputLength: number): Buffer + /** Compress data (DEFLATE algorithm), memory must be MemFree() */ + export function CompressData(data: Buffer, dataSize: number, compDataSize: number): Buffer - /** Save integer value to storage file (to defined position), returns true on success */ - export function SaveStorageValue(position: number, value: number): boolean + /** Decompress data (DEFLATE algorithm), memory must be MemFree() */ + export function DecompressData(compData: Buffer, compDataSize: number, dataSize: number): Buffer - /** Load integer value from storage file (from defined position) */ - export function LoadStorageValue(position: number): number + /** Encode data to Base64 string, memory must be MemFree() */ + export function EncodeDataBase64(data: Buffer, dataSize: number, outputSize: number): string - /** Open URL with default system browser (if available) */ - export function OpenURL(url: string): void + /** Decode Base64 string data, memory must be MemFree() */ + export function DecodeDataBase64(data: Buffer, outputSize: number): Buffer /** Check if a key has been pressed once */ export function IsKeyPressed(key: number): boolean @@ -857,9 +937,12 @@ declare module "raylib" { /** Set mouse scaling */ export function SetMouseScale(scaleX: number, scaleY: number): void - /** Get mouse wheel movement Y */ + /** Get mouse wheel movement for X or Y, whichever is larger */ export function GetMouseWheelMove(): number + /** Get mouse wheel movement for both X and Y */ + export function GetMouseWheelMoveV(): Vector2 + /** Set mouse cursor */ export function SetMouseCursor(cursor: number): void @@ -1349,7 +1432,7 @@ declare module "raylib" { /** Load font from file into GPU memory (VRAM) */ export function LoadFont(fileName: string): Font - /** Load font from file with extended parameters */ + /** 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 Image (XNA style) */ @@ -1367,9 +1450,12 @@ declare module "raylib" { /** Unload font chars info data (RAM) */ export function UnloadFontData(chars: number, glyphCount: number): void - /** Unload Font from GPU memory (VRAM) */ + /** Unload font from GPU memory (VRAM) */ export function UnloadFont(font: Font): void + /** Export font as code file, returns true on success */ + export function ExportFontAsCode(font: Font, fileName: string): boolean + /** Draw current FPS */ export function DrawFPS(posX: number, posY: number): void @@ -1385,6 +1471,9 @@ declare module "raylib" { /** Draw one character (codepoint) */ 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 + /** Measure string width for default font */ export function MeasureText(text: string, fontSize: number): number @@ -1580,9 +1669,6 @@ declare module "raylib" { /** Compute mesh tangents */ export function GenMeshTangents(mesh: Mesh): void - /** Compute mesh binormals */ - export function GenMeshBinormals(mesh: Mesh): void - /** Generate polygonal mesh */ export function GenMeshPoly(sides: number, radius: number): Mesh @@ -1649,9 +1735,6 @@ declare module "raylib" { /** Get collision info between ray and box */ export function GetRayCollisionBox(ray: Ray, box: BoundingBox): RayCollision - /** Get collision info between ray and model */ - export function GetRayCollisionModel(ray: Ray, model: Model): RayCollision - /** Get collision info between ray and mesh */ export function GetRayCollisionMesh(ray: Ray, mesh: Mesh, transform: Matrix): RayCollision @@ -1730,8 +1813,8 @@ declare module "raylib" { /** Set pitch for a sound (1.0 is base level) */ export function SetSoundPitch(sound: Sound, pitch: number): void - /** Convert wave data to desired format */ - export function WaveFormat(wave: Wave, sampleRate: number, sampleSize: number, channels: number): void + /** Set pan for a sound (0.5 is center) */ + export function SetSoundPan(sound: Sound, pan: number): void /** Copy a wave to a new wave */ export function WaveCopy(wave: Wave): Wave @@ -1739,7 +1822,10 @@ declare module "raylib" { /** Crop a wave to defined samples range */ export function WaveCrop(wave: Wave, initSample: number, finalSample: number): void - /** Load samples data from wave as a floats array */ + /** Convert wave data to desired format */ + export function WaveFormat(wave: Wave, sampleRate: number, sampleSize: number, channels: number): void + + /** Load samples data from wave as a 32bit float data array */ export function LoadWaveSamples(wave: Wave): number /** Unload samples data loaded with LoadWaveSamples() */ @@ -1781,6 +1867,9 @@ declare module "raylib" { /** Set pitch for a music (1.0 is base level) */ export function SetMusicPitch(music: Music, pitch: number): void + /** Set pan for a music (0.5 is center) */ + export function SetMusicPan(music: Music, pan: number): void + /** Get music time length (in seconds) */ export function GetMusicTimeLength(music: Music): number @@ -1820,91 +1909,94 @@ declare module "raylib" { /** Set pitch for audio stream (1.0 is base level) */ export function SetAudioStreamPitch(stream: AudioStream, pitch: number): void + /** Set pan for audio stream (0.5 is centered) */ + export function SetAudioStreamPan(stream: AudioStream, pan: number): void + /** Default size for new audio streams */ export function SetAudioStreamBufferSizeDefault(size: number): void - /** */ + /** Ease: Linear */ export function EaseLinearNone(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Linear In */ export function EaseLinearIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Linear Out */ export function EaseLinearOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Linear In Out */ export function EaseLinearInOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Sine In */ export function EaseSineIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Sine Out */ export function EaseSineOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Sine Out */ export function EaseSineInOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Circular In */ export function EaseCircIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Circular Out */ export function EaseCircOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Circular In Out */ export function EaseCircInOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Cubic In */ export function EaseCubicIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Cubic Out */ export function EaseCubicOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Cubic In Out */ export function EaseCubicInOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Quadratic In */ export function EaseQuadIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Quadratic Out */ export function EaseQuadOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Quadratic In Out */ export function EaseQuadInOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Exponential In */ export function EaseExpoIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Exponential Out */ export function EaseExpoOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Exponential In Out */ export function EaseExpoInOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Back In */ export function EaseBackIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Back Out */ export function EaseBackOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Back In Out */ export function EaseBackInOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Bounce Out */ export function EaseBounceOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Bounce In */ export function EaseBounceIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Bounce In Out */ export function EaseBounceInOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Elastic In */ export function EaseElasticIn(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Elastic Out */ export function EaseElasticOut(t: number, b: number, c: number, d: number): number - /** */ + /** Ease: Elastic In Out */ export function EaseElasticInOut(t: number, b: number, c: number, d: number): number /** */ @@ -1919,6 +2011,12 @@ declare module "raylib" { /** */ export function Remap(value: number, inputStart: number, inputEnd: number, outputStart: number, outputEnd: number): number + /** */ + export function Wrap(value: number, min: number, max: number): number + + /** */ + export function FloatEquals(x: number, y: number): number + /** */ export function Vector2Zero(): Vector2 @@ -1949,6 +2047,9 @@ declare module "raylib" { /** */ export function Vector2Distance(v1: Vector2, v2: Vector2): number + /** */ + export function Vector2DistanceSqr(v1: Vector2, v2: Vector2): number + /** */ export function Vector2Angle(v1: Vector2, v2: Vector2): number @@ -1967,6 +2068,9 @@ declare module "raylib" { /** */ export function Vector2Normalize(v: Vector2): Vector2 + /** */ + export function Vector2Transform(v: Vector2, mat: Matrix): Vector2 + /** */ export function Vector2Lerp(v1: Vector2, v2: Vector2, amount: number): Vector2 @@ -1979,6 +2083,18 @@ declare module "raylib" { /** */ export function Vector2MoveTowards(v: Vector2, target: Vector2, maxDistance: number): Vector2 + /** */ + export function Vector2Invert(v: Vector2): Vector2 + + /** */ + export function Vector2Clamp(v: Vector2, min: Vector2, max: Vector2): Vector2 + + /** */ + export function Vector2ClampValue(v: Vector2, min: number, max: number): Vector2 + + /** */ + export function Vector2Equals(p: Vector2, q: Vector2): number + /** */ export function Vector3Zero(): Vector3 @@ -2022,7 +2138,10 @@ declare module "raylib" { export function Vector3Distance(v1: Vector3, v2: Vector3): number /** */ - export function Vector3Angle(v1: Vector3, v2: Vector3): Vector2 + export function Vector3DistanceSqr(v1: Vector3, v2: Vector3): number + + /** */ + export function Vector3Angle(v1: Vector3, v2: Vector3): number /** */ export function Vector3Negate(v: Vector3): Vector3 @@ -2042,6 +2161,9 @@ declare module "raylib" { /** */ export function Vector3RotateByQuaternion(v: Vector3, q: Quaternion): Vector3 + /** */ + export function Vector3RotateByAxisAngle(v: Vector3, axis: Vector3, angle: number): Vector3 + /** */ export function Vector3Lerp(v1: Vector3, v2: Vector3, amount: number): Vector3 @@ -2060,6 +2182,21 @@ declare module "raylib" { /** */ export function Vector3Unproject(source: Vector3, projection: Matrix, view: Matrix): Vector3 + /** */ + export function Vector3Invert(v: Vector3): Vector3 + + /** */ + export function Vector3Clamp(v: Vector3, min: Vector3, max: Vector3): Vector3 + + /** */ + export function Vector3ClampValue(v: Vector3, min: number, max: number): Vector3 + + /** */ + export function Vector3Equals(p: Vector3, q: Vector3): number + + /** */ + export function Vector3Refract(v: Vector3, n: Vector3, r: number): Vector3 + /** */ export function MatrixDeterminant(mat: Matrix): number @@ -2072,9 +2209,6 @@ declare module "raylib" { /** */ export function MatrixInvert(mat: Matrix): Matrix - /** */ - export function MatrixNormalize(mat: Matrix): Matrix - /** */ export function MatrixIdentity(): Matrix @@ -2103,10 +2237,10 @@ declare module "raylib" { export function MatrixRotateZ(angle: number): Matrix /** */ - export function MatrixRotateXYZ(ang: Vector3): Matrix + export function MatrixRotateXYZ(angle: Vector3): Matrix /** */ - export function MatrixRotateZYX(ang: Vector3): Matrix + export function MatrixRotateZYX(angle: Vector3): Matrix /** */ export function MatrixScale(x: number, y: number, z: number): Matrix @@ -2189,6 +2323,9 @@ declare module "raylib" { /** */ export function QuaternionTransform(q: Quaternion, mat: Matrix): Quaternion + /** */ + export function QuaternionEquals(p: Quaternion, q: Quaternion): number + /** Enable gui controls (global state) */ export function GuiEnable(): void @@ -2235,10 +2372,10 @@ declare module "raylib" { export function GuiLine(bounds: Rectangle, text: string): void /** Panel control, useful to group controls */ - export function GuiPanel(bounds: Rectangle): void + export function GuiPanel(bounds: Rectangle, text: string): void /** Scroll Panel control */ - export function GuiScrollPanel(bounds: Rectangle, content: Rectangle, scroll: number): Rectangle + export function GuiScrollPanel(bounds: Rectangle, text: string, content: Rectangle, scroll: number): Rectangle /** Label control, shows text */ export function GuiLabel(bounds: Rectangle, text: string): void @@ -2291,11 +2428,8 @@ declare module "raylib" { /** Dummy control for placeholders */ export function GuiDummyRec(bounds: Rectangle, text: string): void - /** Scroll Bar control */ - export function GuiScrollBar(bounds: Rectangle, value: number, minValue: number, maxValue: number): number - - /** Grid control */ - export function GuiGrid(bounds: Rectangle, spacing: number, subdivs: number): Vector2 + /** Grid control, returns mouse cell position */ + export function GuiGrid(bounds: Rectangle, text: string, spacing: number, subdivs: number): Vector2 /** List View control, returns selected list item index */ export function GuiListView(bounds: Rectangle, text: string, scrollIndex: number, active: number): number @@ -2306,20 +2440,20 @@ declare module "raylib" { /** Message Box control, displays a message */ export function GuiMessageBox(bounds: Rectangle, title: string, message: string, buttons: string): number - /** Text Input Box control, ask for text */ - export function GuiTextInputBox(bounds: Rectangle, title: string, message: string, buttons: string, text: string): number + /** Text Input Box control, ask for text, supports secret */ + 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, color: Color): Color + export function GuiColorPicker(bounds: Rectangle, text: string, color: Color): Color /** Color Panel control */ - export function GuiColorPanel(bounds: Rectangle, color: Color): Color + export function GuiColorPanel(bounds: Rectangle, text: string, color: Color): Color /** Color Bar Alpha control */ - export function GuiColorBarAlpha(bounds: Rectangle, alpha: number): number + export function GuiColorBarAlpha(bounds: Rectangle, text: string, alpha: number): number /** Color Bar Hue control */ - export function GuiColorBarHue(bounds: Rectangle, value: number): number + export function GuiColorBarHue(bounds: Rectangle, text: string, value: number): number /** Load style file over global style variable (.rgs) */ export function GuiLoadStyle(fileName: string): void @@ -2342,6 +2476,9 @@ declare module "raylib" { /** Set icon bit data */ export function GuiSetIconData(iconId: number, data: number): void + /** Set icon scale (1 by default) */ + export function GuiSetIconScale(scale: number): void + /** Set icon pixel value */ export function GuiSetIconPixel(iconId: number, x: number, y: number): void @@ -2351,148 +2488,576 @@ declare module "raylib" { /** Check icon pixel value */ export function GuiCheckIconPixel(iconId: number, x: number, y: number): boolean - - /** Set shader uniform float */ - export function SetShaderFloat(shader: Shader, locIndex: number, value: number): void - /** Set shader uniform int */ - export function SetShaderInt(shader: Shader, locIndex: number, value: number): void - /** Set shader uniform Vec2 */ - export function SetShaderVec2(shader: Shader, locIndex: number, value: Vector2): void - /** Set shader uniform Vec3 */ - export function SetShaderVector3(shader: Shader, locIndex: number, value: Vector3): void - /** Set shader uniform Vec4 */ - export function SetShaderVector4(shader: Shader, locIndex: number, value: Vector4): void - - /** Set to try enabling V-Sync on GPU */ - export const FLAG_VSYNC_HINT = 64 - /** Set to run program in fullscreen */ - export const FLAG_FULLSCREEN_MODE = 2 - /** Set to allow resizable window */ - export const FLAG_WINDOW_RESIZABLE = 4 - /** Set to disable window decoration (frame and buttons) */ - export const FLAG_WINDOW_UNDECORATED = 8 - /** Set to hide window */ - export const FLAG_WINDOW_HIDDEN = 128 - /** Set to minimize window (iconify) */ - export const FLAG_WINDOW_MINIMIZED = 512 - /** Set to maximize window (expanded to monitor) */ - export const FLAG_WINDOW_MAXIMIZED = 1024 - /** Set to window non focused */ - export const FLAG_WINDOW_UNFOCUSED = 2048 - /** Set to window always on top */ - export const FLAG_WINDOW_TOPMOST = 4096 - /** Set to allow windows running while minimized */ - export const FLAG_WINDOW_ALWAYS_RUN = 256 - /** Set to allow transparent framebuffer */ - export const FLAG_WINDOW_TRANSPARENT = 16 - /** Set to support HighDPI */ - export const FLAG_WINDOW_HIGHDPI = 8192 - /** Set to try enabling MSAA 4X */ - export const FLAG_MSAA_4X_HINT = 32 - /** Set to try enabling interlaced video format (for V3D) */ - export const FLAG_INTERLACED_HINT = 65536 - /** Display all logs */ - export const LOG_ALL = 0 - /** Trace logging, intended for internal use only */ - export const LOG_TRACE = 1 - /** Debug logging, used for internal debugging, it should be disabled on release builds */ - export const LOG_DEBUG = 2 - /** Info logging, used for program execution info */ - export const LOG_INFO = 3 - /** Warning logging, used on recoverable failures */ - export const LOG_WARNING = 4 - /** Error logging, used on unrecoverable failures */ - export const LOG_ERROR = 5 - /** Fatal logging, used to abort program: exit(EXIT_FAILURE) */ - export const LOG_FATAL = 6 - /** Disable logging */ - export const LOG_NONE = 7 - /** Key: NULL, used for no key pressed */ - export const KEY_NULL = 0 - /** Key: ' */ - export const KEY_APOSTROPHE = 39 - /** Key: , */ - export const KEY_COMMA = 44 - /** Key: - */ - export const KEY_MINUS = 45 - /** Key: . */ - export const KEY_PERIOD = 46 - /** Key: / */ - export const KEY_SLASH = 47 - /** Key: 0 */ - export const KEY_ZERO = 48 - /** Key: 1 */ - export const KEY_ONE = 49 - /** Key: 2 */ - export const KEY_TWO = 50 - /** Key: 3 */ - export const KEY_THREE = 51 - /** Key: 4 */ - export const KEY_FOUR = 52 - /** Key: 5 */ - export const KEY_FIVE = 53 - /** Key: 6 */ - export const KEY_SIX = 54 - /** Key: 7 */ - export const KEY_SEVEN = 55 - /** Key: 8 */ - export const KEY_EIGHT = 56 - /** Key: 9 */ - export const KEY_NINE = 57 - /** Key: ; */ - export const KEY_SEMICOLON = 59 - /** Key: = */ - export const KEY_EQUAL = 61 - /** Key: A | a */ - export const KEY_A = 65 - /** Key: B | b */ - export const KEY_B = 66 - /** Key: C | c */ - export const KEY_C = 67 - /** Key: D | d */ - export const KEY_D = 68 - /** Key: E | e */ - export const KEY_E = 69 - /** Key: F | f */ - export const KEY_F = 70 - /** Key: G | g */ - export const KEY_G = 71 - /** Key: H | h */ - export const KEY_H = 72 - /** Key: I | i */ - export const KEY_I = 73 - /** Key: J | j */ - export const KEY_J = 74 - /** Key: K | k */ - export const KEY_K = 75 - /** Key: L | l */ - export const KEY_L = 76 - /** Key: M | m */ - export const KEY_M = 77 - /** Key: N | n */ - export const KEY_N = 78 - /** Key: O | o */ - export const KEY_O = 79 - /** Key: P | p */ - export const KEY_P = 80 - /** Key: Q | q */ - export const KEY_Q = 81 - /** Key: R | r */ - export const KEY_R = 82 - /** Key: S | s */ - export const KEY_S = 83 - /** Key: T | t */ - export const KEY_T = 84 - /** Key: U | u */ - export const KEY_U = 85 - /** Key: V | v */ - export const KEY_V = 86 - /** Key: W | w */ - export const KEY_W = 87 - /** Key: X | x */ - export const KEY_X = 88 - /** Key: Y | y */ - export const KEY_Y = 89 + /** Choose the current matrix to be transformed */ + export function rlMatrixMode(mode: number): void + + /** Push the current matrix to stack */ + export function rlPushMatrix(): void + + /** Pop lattest inserted matrix from stack */ + export function rlPopMatrix(): void + + /** Reset current matrix to identity matrix */ + export function rlLoadIdentity(): void + + /** Multiply the current matrix by a translation matrix */ + export function rlTranslatef(x: number, y: number, z: number): void + + /** Multiply the current matrix by a rotation matrix */ + export function rlRotatef(angle: number, x: number, y: number, z: number): void + + /** Multiply the current matrix by a scaling matrix */ + export function rlScalef(x: number, y: number, z: number): void + + /** Multiply the current matrix by another matrix */ + export function rlMultMatrixf(matf: number): void + + /** */ + export function rlFrustum(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): void + + /** */ + export function rlOrtho(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): void + + /** Set the viewport area */ + export function rlViewport(x: number, y: number, width: number, height: number): void + + /** Initialize drawing mode (how to organize vertex) */ + export function rlBegin(mode: number): void + + /** Finish vertex providing */ + export function rlEnd(): void + + /** Define one vertex (position) - 2 int */ + export function rlVertex2i(x: number, y: number): void + + /** Define one vertex (position) - 2 float */ + export function rlVertex2f(x: number, y: number): void + + /** Define one vertex (position) - 3 float */ + export function rlVertex3f(x: number, y: number, z: number): void + + /** Define one vertex (texture coordinate) - 2 float */ + export function rlTexCoord2f(x: number, y: number): void + + /** Define one vertex (normal) - 3 float */ + export function rlNormal3f(x: number, y: number, z: number): void + + /** Define one vertex (color) - 4 byte */ + export function rlColor4ub(r: number, g: number, b: number, a: number): void + + /** Define one vertex (color) - 3 float */ + export function rlColor3f(x: number, y: number, z: number): void + + /** Define one vertex (color) - 4 float */ + export function rlColor4f(x: number, y: number, z: number, w: number): void + + /** Enable vertex array (VAO, if supported) */ + export function rlEnableVertexArray(vaoId: number): boolean + + /** Disable vertex array (VAO, if supported) */ + export function rlDisableVertexArray(): void + + /** Enable vertex buffer (VBO) */ + export function rlEnableVertexBuffer(id: number): void + + /** Disable vertex buffer (VBO) */ + export function rlDisableVertexBuffer(): void + + /** Enable vertex buffer element (VBO element) */ + export function rlEnableVertexBufferElement(id: number): void + + /** Disable vertex buffer element (VBO element) */ + export function rlDisableVertexBufferElement(): void + + /** Enable vertex attribute index */ + export function rlEnableVertexAttribute(index: number): void + + /** Disable vertex attribute index */ + export function rlDisableVertexAttribute(index: number): void + + /** Select and active a texture slot */ + export function rlActiveTextureSlot(slot: number): void + + /** Enable texture */ + export function rlEnableTexture(id: number): void + + /** Disable texture */ + export function rlDisableTexture(): void + + /** Enable texture cubemap */ + export function rlEnableTextureCubemap(id: number): void + + /** Disable texture cubemap */ + export function rlDisableTextureCubemap(): void + + /** Set texture parameters (filter, wrap) */ + export function rlTextureParameters(id: number, param: number, value: number): void + + /** Enable shader program */ + export function rlEnableShader(id: number): void + + /** Disable shader program */ + export function rlDisableShader(): void + + /** Enable render texture (fbo) */ + export function rlEnableFramebuffer(id: number): void + + /** Disable render texture (fbo), return to default framebuffer */ + export function rlDisableFramebuffer(): void + + /** Activate multiple draw color buffers */ + export function rlActiveDrawBuffers(count: number): void + + /** Enable color blending */ + export function rlEnableColorBlend(): void + + /** Disable color blending */ + export function rlDisableColorBlend(): void + + /** Enable depth test */ + export function rlEnableDepthTest(): void + + /** Disable depth test */ + export function rlDisableDepthTest(): void + + /** Enable depth write */ + export function rlEnableDepthMask(): void + + /** Disable depth write */ + export function rlDisableDepthMask(): void + + /** Enable backface culling */ + export function rlEnableBackfaceCulling(): void + + /** Disable backface culling */ + export function rlDisableBackfaceCulling(): void + + /** Enable scissor test */ + export function rlEnableScissorTest(): void + + /** Disable scissor test */ + export function rlDisableScissorTest(): void + + /** Scissor test */ + export function rlScissor(x: number, y: number, width: number, height: number): void + + /** Enable wire mode */ + export function rlEnableWireMode(): void + + /** Disable wire mode */ + export function rlDisableWireMode(): void + + /** Set the line drawing width */ + export function rlSetLineWidth(width: number): void + + /** Get the line drawing width */ + export function rlGetLineWidth(): number + + /** Enable line aliasing */ + export function rlEnableSmoothLines(): void + + /** Disable line aliasing */ + export function rlDisableSmoothLines(): void + + /** Enable stereo rendering */ + export function rlEnableStereoRender(): void + + /** Disable stereo rendering */ + export function rlDisableStereoRender(): void + + /** Check if stereo render is enabled */ + export function rlIsStereoRenderEnabled(): boolean + + /** Clear color buffer with color */ + export function rlClearColor(r: number, g: number, b: number, a: number): void + + /** Clear used screen buffers (color and depth) */ + export function rlClearScreenBuffers(): void + + /** Check and log OpenGL error codes */ + export function rlCheckErrors(): void + + /** Set blending mode */ + export function rlSetBlendMode(mode: number): void + + /** Set blending mode factor and equation (using OpenGL factors) */ + export function rlSetBlendFactors(glSrcFactor: number, glDstFactor: number, glEquation: number): void + + /** Initialize rlgl (buffers, shaders, textures, states) */ + export function rlglInit(width: number, height: number): void + + /** De-inititialize rlgl (buffers, shaders, textures) */ + export function rlglClose(): void + + /** Load OpenGL extensions (loader function required) */ + export function rlLoadExtensions(loader: number): void + + /** Get current OpenGL version */ + export function rlGetVersion(): number + + /** Set current framebuffer width */ + export function rlSetFramebufferWidth(width: number): void + + /** Get default framebuffer width */ + export function rlGetFramebufferWidth(): number + + /** Set current framebuffer height */ + export function rlSetFramebufferHeight(height: number): void + + /** Get default framebuffer height */ + export function rlGetFramebufferHeight(): number + + /** Get default texture id */ + export function rlGetTextureIdDefault(): number + + /** Get default shader id */ + export function rlGetShaderIdDefault(): number + + /** Get default shader locations */ + export function rlGetShaderLocsDefault(): number + + /** Load a render batch system */ + export function rlLoadRenderBatch(numBuffers: number, bufferElements: number): rlRenderBatch + + /** Unload render batch system */ + export function rlUnloadRenderBatch(batch: rlRenderBatch): void + + /** Draw render batch data (Update->Draw->Reset) */ + export function rlDrawRenderBatch(batch: number): void + + /** Set the active render batch for rlgl (NULL for default internal) */ + export function rlSetRenderBatchActive(batch: number): void + + /** Update and draw internal render batch */ + export function rlDrawRenderBatchActive(): void + + /** Check internal buffer overflow for a given number of vertex */ + export function rlCheckRenderBatchLimit(vCount: number): boolean + + /** Set current texture for render batch and check buffers limits */ + export function rlSetTexture(id: number): void + + /** Load vertex array (vao) if supported */ + export function rlLoadVertexArray(): number + + /** Load a vertex buffer attribute */ + export function rlLoadVertexBuffer(buffer: number, size: number, dynamic: boolean): number + + /** Load a new attributes element buffer */ + export function rlLoadVertexBufferElement(buffer: number, size: number, dynamic: boolean): number + + /** Update GPU buffer with new data */ + export function rlUpdateVertexBuffer(bufferId: number, data: number, dataSize: number, offset: number): void + + /** Update vertex buffer elements with new data */ + export function rlUpdateVertexBufferElements(id: number, data: number, dataSize: number, offset: number): void + + /** */ + export function rlUnloadVertexArray(vaoId: number): void + + /** */ + export function rlUnloadVertexBuffer(vboId: number): void + + /** */ + export function rlSetVertexAttribute(index: number, compSize: number, type: number, normalized: boolean, stride: number, pointer: number): void + + /** */ + export function rlSetVertexAttributeDivisor(index: number, divisor: number): void + + /** Set vertex attribute default value */ + export function rlSetVertexAttributeDefault(locIndex: number, value: number, attribType: number, count: number): void + + /** */ + export function rlDrawVertexArray(offset: number, count: number): void + + /** */ + export function rlDrawVertexArrayElements(offset: number, count: number, buffer: number): void + + /** */ + export function rlDrawVertexArrayInstanced(offset: number, count: number, instances: number): void + + /** */ + export function rlDrawVertexArrayElementsInstanced(offset: number, count: number, buffer: number, instances: number): void + + /** Load texture in GPU */ + 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 + + /** Update GPU texture with new data */ + export function rlUpdateTexture(id: number, offsetX: number, offsetY: number, width: number, height: number, format: number, data: number): void + + /** Get OpenGL internal formats */ + export function rlGetGlTextureFormats(format: number, glInternalFormat: number, glFormat: number, glType: number): void + + /** Get name string for pixel format */ + export function rlGetPixelFormatName(format: number): string + + /** Unload texture from GPU memory */ + export function rlUnloadTexture(id: number): void + + /** Generate mipmap data for selected texture */ + export function rlGenTextureMipmaps(id: number, width: number, height: number, format: number, mipmaps: number): void + + /** Read texture pixel data */ + export function rlReadTexturePixels(id: number, width: number, height: number, format: number): number + + /** Read screen pixel data (color buffer) */ + export function rlReadScreenPixels(width: number, height: number): Buffer + + /** Load an empty framebuffer */ + export function rlLoadFramebuffer(width: number, height: number): number + + /** Attach texture/renderbuffer to a framebuffer */ + export function rlFramebufferAttach(fboId: number, texId: number, attachType: number, texType: number, mipLevel: number): void + + /** Verify framebuffer is complete */ + export function rlFramebufferComplete(id: number): boolean + + /** Delete framebuffer from GPU */ + export function rlUnloadFramebuffer(id: number): void + + /** Load shader from code strings */ + export function rlLoadShaderCode(vsCode: string, fsCode: string): number + + /** Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER) */ + export function rlCompileShader(shaderCode: string, type: number): number + + /** Load custom shader program */ + export function rlLoadShaderProgram(vShaderId: number, fShaderId: number): number + + /** Unload shader program */ + export function rlUnloadShaderProgram(id: number): void + + /** Get shader location uniform */ + export function rlGetLocationUniform(shaderId: number, uniformName: string): number + + /** Get shader location attribute */ + export function rlGetLocationAttrib(shaderId: number, attribName: string): number + + /** Set shader value uniform */ + export function rlSetUniform(locIndex: number, value: number, uniformType: number, count: number): void + + /** Set shader value matrix */ + export function rlSetUniformMatrix(locIndex: number, mat: Matrix): void + + /** Set shader value sampler */ + export function rlSetUniformSampler(locIndex: number, textureId: number): void + + /** Set shader currently active (id and locations) */ + export function rlSetShader(id: number, locs: number): void + + /** Load compute shader program */ + export function rlLoadComputeShaderProgram(shaderId: number): number + + /** Dispatch compute shader (equivalent to *draw* for graphics pilepine) */ + export function rlComputeShaderDispatch(groupX: number, groupY: number, groupZ: number): void + + /** Load shader storage buffer object (SSBO) */ + export function rlLoadShaderBuffer(size: BigInt, data: number, usageHint: number): number + + /** Unload shader storage buffer object (SSBO) */ + export function rlUnloadShaderBuffer(ssboId: number): void + + /** Update SSBO buffer data */ + export function rlUpdateShaderBufferElements(id: number, data: number, dataSize: BigInt, offset: BigInt): void + + /** Get SSBO buffer size */ + export function rlGetShaderBufferSize(id: number): BigInt + + /** Bind SSBO buffer */ + export function rlReadShaderBufferElements(id: number, dest: number, count: BigInt, offset: BigInt): void + + /** Copy SSBO buffer data */ + export function rlBindShaderBuffer(id: number, index: number): void + + /** Copy SSBO buffer data */ + export function rlCopyBuffersElements(destId: number, srcId: number, destOffset: BigInt, srcOffset: BigInt, count: BigInt): void + + /** Bind image texture */ + export function rlBindImageTexture(id: number, index: number, format: number, readonly: number): void + + /** Get internal modelview matrix */ + export function rlGetMatrixModelview(): Matrix + + /** Get internal projection matrix */ + export function rlGetMatrixProjection(): Matrix + + /** Get internal accumulated transform matrix */ + export function rlGetMatrixTransform(): Matrix + + /** Get internal projection matrix for stereo render (selected eye) */ + export function rlGetMatrixProjectionStereo(eye: number): Matrix + + /** Get internal view offset matrix for stereo render (selected eye) */ + export function rlGetMatrixViewOffsetStereo(eye: number): Matrix + + /** Set a custom projection matrix (replaces internal projection matrix) */ + export function rlSetMatrixProjection(proj: Matrix): void + + /** Set a custom modelview matrix (replaces internal modelview matrix) */ + export function rlSetMatrixModelview(view: Matrix): void + + /** Set eyes projection matrices for stereo rendering */ + export function rlSetMatrixProjectionStereo(right: Matrix, left: Matrix): void + + /** Set eyes view offsets matrices for stereo rendering */ + export function rlSetMatrixViewOffsetStereo(right: Matrix, left: Matrix): void + + /** Load and draw a cube */ + export function rlLoadDrawCube(): void + + /** Load and draw a quad */ + export function rlLoadDrawQuad(): void + + + /** Set shader uniform float */ + export function SetShaderFloat(shader: Shader, locIndex: number, value: number): void + /** Set shader uniform int */ + export function SetShaderInt(shader: Shader, locIndex: number, value: number): void + /** Set shader uniform Vec2 */ + export function SetShaderVec2(shader: Shader, locIndex: number, value: Vector2): void + /** Set shader uniform Vec3 */ + export function SetShaderVector3(shader: Shader, locIndex: number, value: Vector3): void + /** Set shader uniform Vec4 */ + export function SetShaderVector4(shader: Shader, locIndex: number, value: Vector4): void + + /** Set to try enabling V-Sync on GPU */ + export const FLAG_VSYNC_HINT = 64 + /** Set to run program in fullscreen */ + export const FLAG_FULLSCREEN_MODE = 2 + /** Set to allow resizable window */ + export const FLAG_WINDOW_RESIZABLE = 4 + /** Set to disable window decoration (frame and buttons) */ + export const FLAG_WINDOW_UNDECORATED = 8 + /** Set to hide window */ + export const FLAG_WINDOW_HIDDEN = 128 + /** Set to minimize window (iconify) */ + export const FLAG_WINDOW_MINIMIZED = 512 + /** Set to maximize window (expanded to monitor) */ + export const FLAG_WINDOW_MAXIMIZED = 1024 + /** Set to window non focused */ + export const FLAG_WINDOW_UNFOCUSED = 2048 + /** Set to window always on top */ + export const FLAG_WINDOW_TOPMOST = 4096 + /** Set to allow windows running while minimized */ + export const FLAG_WINDOW_ALWAYS_RUN = 256 + /** Set to allow transparent framebuffer */ + export const FLAG_WINDOW_TRANSPARENT = 16 + /** Set to support HighDPI */ + 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 try enabling MSAA 4X */ + export const FLAG_MSAA_4X_HINT = 32 + /** Set to try enabling interlaced video format (for V3D) */ + export const FLAG_INTERLACED_HINT = 65536 + /** Display all logs */ + export const LOG_ALL = 0 + /** Trace logging, intended for internal use only */ + export const LOG_TRACE = 1 + /** Debug logging, used for internal debugging, it should be disabled on release builds */ + export const LOG_DEBUG = 2 + /** Info logging, used for program execution info */ + export const LOG_INFO = 3 + /** Warning logging, used on recoverable failures */ + export const LOG_WARNING = 4 + /** Error logging, used on unrecoverable failures */ + export const LOG_ERROR = 5 + /** Fatal logging, used to abort program: exit(EXIT_FAILURE) */ + export const LOG_FATAL = 6 + /** Disable logging */ + export const LOG_NONE = 7 + /** Key: NULL, used for no key pressed */ + export const KEY_NULL = 0 + /** Key: ' */ + export const KEY_APOSTROPHE = 39 + /** Key: , */ + export const KEY_COMMA = 44 + /** Key: - */ + export const KEY_MINUS = 45 + /** Key: . */ + export const KEY_PERIOD = 46 + /** Key: / */ + export const KEY_SLASH = 47 + /** Key: 0 */ + export const KEY_ZERO = 48 + /** Key: 1 */ + export const KEY_ONE = 49 + /** Key: 2 */ + export const KEY_TWO = 50 + /** Key: 3 */ + export const KEY_THREE = 51 + /** Key: 4 */ + export const KEY_FOUR = 52 + /** Key: 5 */ + export const KEY_FIVE = 53 + /** Key: 6 */ + export const KEY_SIX = 54 + /** Key: 7 */ + export const KEY_SEVEN = 55 + /** Key: 8 */ + export const KEY_EIGHT = 56 + /** Key: 9 */ + export const KEY_NINE = 57 + /** Key: ; */ + export const KEY_SEMICOLON = 59 + /** Key: = */ + export const KEY_EQUAL = 61 + /** Key: A | a */ + export const KEY_A = 65 + /** Key: B | b */ + export const KEY_B = 66 + /** Key: C | c */ + export const KEY_C = 67 + /** Key: D | d */ + export const KEY_D = 68 + /** Key: E | e */ + export const KEY_E = 69 + /** Key: F | f */ + export const KEY_F = 70 + /** Key: G | g */ + export const KEY_G = 71 + /** Key: H | h */ + export const KEY_H = 72 + /** Key: I | i */ + export const KEY_I = 73 + /** Key: J | j */ + export const KEY_J = 74 + /** Key: K | k */ + export const KEY_K = 75 + /** Key: L | l */ + export const KEY_L = 76 + /** Key: M | m */ + export const KEY_M = 77 + /** Key: N | n */ + export const KEY_N = 78 + /** Key: O | o */ + export const KEY_O = 79 + /** Key: P | p */ + export const KEY_P = 80 + /** Key: Q | q */ + export const KEY_Q = 81 + /** Key: R | r */ + export const KEY_R = 82 + /** Key: S | s */ + export const KEY_S = 83 + /** Key: T | t */ + export const KEY_T = 84 + /** Key: U | u */ + export const KEY_U = 85 + /** Key: V | v */ + export const KEY_V = 86 + /** Key: W | w */ + export const KEY_W = 87 + /** Key: X | x */ + export const KEY_X = 88 + /** Key: Y | y */ + export const KEY_Y = 89 /** Key: Z | z */ export const KEY_Z = 90 /** Key: [ */ @@ -2853,7 +3418,7 @@ declare module "raylib" { export const PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 /** 2 bpp */ export const PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 - /** No filter, just pixel aproximation */ + /** No filter, just pixel approximation */ export const TEXTURE_FILTER_POINT = 0 /** Linear filtering */ export const TEXTURE_FILTER_BILINEAR = 1 @@ -2901,8 +3466,10 @@ declare module "raylib" { export const BLEND_ADD_COLORS = 3 /** Blend textures subtracting colors (alternative) */ export const BLEND_SUBTRACT_COLORS = 4 - /** Belnd textures using custom src/dst factors (use rlSetBlendMode()) */ - export const BLEND_CUSTOM = 5 + /** Blend premultiplied textures considering alpha */ + export const BLEND_ALPHA_PREMULTIPLY = 5 + /** Blend textures using custom src/dst factors (use rlSetBlendMode()) */ + export const BLEND_CUSTOM = 6 /** No gesture */ export const GESTURE_NONE = 0 /** Tap gesture */ @@ -2946,155 +3513,949 @@ declare module "raylib" { /** Npatch layout: 3x1 tiles */ export const NPATCH_THREE_PATCH_HORIZONTAL = 2 /** */ - export const GUI_STATE_NORMAL = 0 + export const STATE_NORMAL = 0 + /** */ + export const STATE_FOCUSED = 1 + /** */ + export const STATE_PRESSED = 2 + /** */ + export const STATE_DISABLED = 3 + /** */ + export const TEXT_ALIGN_LEFT = 0 + /** */ + export const TEXT_ALIGN_CENTER = 1 + /** */ + export const TEXT_ALIGN_RIGHT = 2 + /** */ + export const DEFAULT = 0 + /** Used also for: LABELBUTTON */ + export const LABEL = 1 + /** */ + export const BUTTON = 2 + /** Used also for: TOGGLEGROUP */ + export const TOGGLE = 3 + /** Used also for: SLIDERBAR */ + export const SLIDER = 4 + /** */ + export const PROGRESSBAR = 5 + /** */ + export const CHECKBOX = 6 + /** */ + export const COMBOBOX = 7 + /** */ + export const DROPDOWNBOX = 8 + /** Used also for: TEXTBOXMULTI */ + export const TEXTBOX = 9 + /** */ + export const VALUEBOX = 10 + /** Uses: BUTTON, VALUEBOX */ + export const SPINNER = 11 + /** */ + export const LISTVIEW = 12 + /** */ + export const COLORPICKER = 13 + /** */ + export const SCROLLBAR = 14 + /** */ + export const STATUSBAR = 15 + /** */ + export const BORDER_COLOR_NORMAL = 0 + /** */ + export const BASE_COLOR_NORMAL = 1 + /** */ + export const TEXT_COLOR_NORMAL = 2 + /** */ + export const BORDER_COLOR_FOCUSED = 3 + /** */ + export const BASE_COLOR_FOCUSED = 4 + /** */ + export const TEXT_COLOR_FOCUSED = 5 + /** */ + export const BORDER_COLOR_PRESSED = 6 + /** */ + export const BASE_COLOR_PRESSED = 7 + /** */ + export const TEXT_COLOR_PRESSED = 8 + /** */ + export const BORDER_COLOR_DISABLED = 9 + /** */ + export const BASE_COLOR_DISABLED = 10 + /** */ + export const TEXT_COLOR_DISABLED = 11 + /** */ + export const BORDER_WIDTH = 12 + /** */ + export const TEXT_PADDING = 13 + /** */ + export const TEXT_ALIGNMENT = 14 + /** */ + export const RESERVED = 15 + /** Text size (glyphs max height) */ + export const TEXT_SIZE = 16 + /** Text spacing between glyphs */ + export const TEXT_SPACING = 17 + /** Line control color */ + export const LINE_COLOR = 18 + /** Background color */ + export const BACKGROUND_COLOR = 19 + /** ToggleGroup separation between toggles */ + export const GROUP_PADDING = 16 + /** Slider size of internal bar */ + export const SLIDER_WIDTH = 16 + /** Slider/SliderBar internal bar padding */ + export const SLIDER_PADDING = 17 + /** ProgressBar internal padding */ + export const PROGRESS_PADDING = 16 + /** */ + export const ARROWS_SIZE = 16 + /** */ + export const ARROWS_VISIBLE = 17 + /** (SLIDERBAR, SLIDER_PADDING) */ + export const SCROLL_SLIDER_PADDING = 18 + /** */ + export const SCROLL_SLIDER_SIZE = 19 + /** */ + export const SCROLL_PADDING = 20 + /** */ + export const SCROLL_SPEED = 21 + /** CheckBox internal check padding */ + export const CHECK_PADDING = 16 + /** ComboBox right button width */ + export const COMBO_BUTTON_WIDTH = 16 + /** ComboBox button separation */ + export const COMBO_BUTTON_SPACING = 17 + /** DropdownBox arrow separation from border and items */ + 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 + /** Spinner left/right buttons width */ + export const SPIN_BUTTON_WIDTH = 16 + /** Spinner buttons separation */ + export const SPIN_BUTTON_SPACING = 17 + /** ListView items height */ + export const LIST_ITEMS_HEIGHT = 16 + /** ListView items separation */ + export const LIST_ITEMS_SPACING = 17 + /** ListView scrollbar size (usually width) */ + export const SCROLLBAR_WIDTH = 18 + /** ListView scrollbar side (0-left, 1-right) */ + export const SCROLLBAR_SIDE = 19 + /** */ + export const COLOR_SELECTOR_SIZE = 16 + /** ColorPicker right hue bar width */ + export const HUEBAR_WIDTH = 17 + /** ColorPicker right hue bar separation from panel */ + export const HUEBAR_PADDING = 18 + /** ColorPicker right hue bar selector height */ + export const HUEBAR_SELECTOR_HEIGHT = 19 + /** ColorPicker right hue bar selector overflow */ + export const HUEBAR_SELECTOR_OVERFLOW = 20 + /** */ + export const ICON_NONE = 0 + /** */ + export const ICON_FOLDER_FILE_OPEN = 1 + /** */ + export const ICON_FILE_SAVE_CLASSIC = 2 + /** */ + export const ICON_FOLDER_OPEN = 3 + /** */ + export const ICON_FOLDER_SAVE = 4 + /** */ + export const ICON_FILE_OPEN = 5 + /** */ + export const ICON_FILE_SAVE = 6 + /** */ + export const ICON_FILE_EXPORT = 7 + /** */ + export const ICON_FILE_ADD = 8 + /** */ + export const ICON_FILE_DELETE = 9 + /** */ + export const ICON_FILETYPE_TEXT = 10 + /** */ + export const ICON_FILETYPE_AUDIO = 11 + /** */ + export const ICON_FILETYPE_IMAGE = 12 + /** */ + export const ICON_FILETYPE_PLAY = 13 + /** */ + export const ICON_FILETYPE_VIDEO = 14 + /** */ + export const ICON_FILETYPE_INFO = 15 + /** */ + export const ICON_FILE_COPY = 16 + /** */ + export const ICON_FILE_CUT = 17 + /** */ + export const ICON_FILE_PASTE = 18 + /** */ + export const ICON_CURSOR_HAND = 19 + /** */ + export const ICON_CURSOR_POINTER = 20 + /** */ + export const ICON_CURSOR_CLASSIC = 21 + /** */ + export const ICON_PENCIL = 22 + /** */ + export const ICON_PENCIL_BIG = 23 + /** */ + export const ICON_BRUSH_CLASSIC = 24 + /** */ + export const ICON_BRUSH_PAINTER = 25 + /** */ + export const ICON_WATER_DROP = 26 + /** */ + export const ICON_COLOR_PICKER = 27 + /** */ + export const ICON_RUBBER = 28 + /** */ + export const ICON_COLOR_BUCKET = 29 + /** */ + export const ICON_TEXT_T = 30 + /** */ + export const ICON_TEXT_A = 31 + /** */ + export const ICON_SCALE = 32 + /** */ + export const ICON_RESIZE = 33 + /** */ + export const ICON_FILTER_POINT = 34 + /** */ + export const ICON_FILTER_BILINEAR = 35 + /** */ + export const ICON_CROP = 36 + /** */ + export const ICON_CROP_ALPHA = 37 + /** */ + export const ICON_SQUARE_TOGGLE = 38 + /** */ + export const ICON_SYMMETRY = 39 + /** */ + export const ICON_SYMMETRY_HORIZONTAL = 40 + /** */ + export const ICON_SYMMETRY_VERTICAL = 41 + /** */ + export const ICON_LENS = 42 + /** */ + export const ICON_LENS_BIG = 43 + /** */ + export const ICON_EYE_ON = 44 + /** */ + export const ICON_EYE_OFF = 45 + /** */ + export const ICON_FILTER_TOP = 46 + /** */ + export const ICON_FILTER = 47 + /** */ + export const ICON_TARGET_POINT = 48 + /** */ + export const ICON_TARGET_SMALL = 49 + /** */ + export const ICON_TARGET_BIG = 50 + /** */ + export const ICON_TARGET_MOVE = 51 + /** */ + export const ICON_CURSOR_MOVE = 52 + /** */ + export const ICON_CURSOR_SCALE = 53 + /** */ + export const ICON_CURSOR_SCALE_RIGHT = 54 + /** */ + export const ICON_CURSOR_SCALE_LEFT = 55 + /** */ + export const ICON_UNDO = 56 + /** */ + export const ICON_REDO = 57 + /** */ + export const ICON_REREDO = 58 + /** */ + export const ICON_MUTATE = 59 + /** */ + export const ICON_ROTATE = 60 + /** */ + export const ICON_REPEAT = 61 + /** */ + export const ICON_SHUFFLE = 62 + /** */ + export const ICON_EMPTYBOX = 63 + /** */ + export const ICON_TARGET = 64 + /** */ + export const ICON_TARGET_SMALL_FILL = 65 + /** */ + export const ICON_TARGET_BIG_FILL = 66 + /** */ + export const ICON_TARGET_MOVE_FILL = 67 + /** */ + export const ICON_CURSOR_MOVE_FILL = 68 + /** */ + export const ICON_CURSOR_SCALE_FILL = 69 + /** */ + export const ICON_CURSOR_SCALE_RIGHT_FILL = 70 + /** */ + export const ICON_CURSOR_SCALE_LEFT_FILL = 71 + /** */ + export const ICON_UNDO_FILL = 72 + /** */ + export const ICON_REDO_FILL = 73 + /** */ + export const ICON_REREDO_FILL = 74 + /** */ + export const ICON_MUTATE_FILL = 75 + /** */ + export const ICON_ROTATE_FILL = 76 + /** */ + export const ICON_REPEAT_FILL = 77 + /** */ + export const ICON_SHUFFLE_FILL = 78 + /** */ + export const ICON_EMPTYBOX_SMALL = 79 + /** */ + export const ICON_BOX = 80 + /** */ + export const ICON_BOX_TOP = 81 + /** */ + export const ICON_BOX_TOP_RIGHT = 82 + /** */ + export const ICON_BOX_RIGHT = 83 + /** */ + export const ICON_BOX_BOTTOM_RIGHT = 84 + /** */ + export const ICON_BOX_BOTTOM = 85 + /** */ + export const ICON_BOX_BOTTOM_LEFT = 86 + /** */ + export const ICON_BOX_LEFT = 87 + /** */ + export const ICON_BOX_TOP_LEFT = 88 + /** */ + export const ICON_BOX_CENTER = 89 + /** */ + export const ICON_BOX_CIRCLE_MASK = 90 + /** */ + export const ICON_POT = 91 + /** */ + export const ICON_ALPHA_MULTIPLY = 92 + /** */ + export const ICON_ALPHA_CLEAR = 93 + /** */ + export const ICON_DITHERING = 94 + /** */ + export const ICON_MIPMAPS = 95 + /** */ + export const ICON_BOX_GRID = 96 /** */ - export const GUI_STATE_FOCUSED = 1 + export const ICON_GRID = 97 /** */ - export const GUI_STATE_PRESSED = 2 + export const ICON_BOX_CORNERS_SMALL = 98 /** */ - export const GUI_STATE_DISABLED = 3 + export const ICON_BOX_CORNERS_BIG = 99 /** */ - export const GUI_TEXT_ALIGN_LEFT = 0 + export const ICON_FOUR_BOXES = 100 /** */ - export const GUI_TEXT_ALIGN_CENTER = 1 + export const ICON_GRID_FILL = 101 /** */ - export const GUI_TEXT_ALIGN_RIGHT = 2 - /** Generic control -> populates to all controls when set */ - export const DEFAULT = 0 - /** Used also for: LABELBUTTON */ - export const LABEL = 1 + export const ICON_BOX_MULTISIZE = 102 /** */ - export const BUTTON = 2 - /** Used also for: TOGGLEGROUP */ - export const TOGGLE = 3 - /** Used also for: SLIDERBAR */ - export const SLIDER = 4 + export const ICON_ZOOM_SMALL = 103 /** */ - export const PROGRESSBAR = 5 + export const ICON_ZOOM_MEDIUM = 104 /** */ - export const CHECKBOX = 6 + export const ICON_ZOOM_BIG = 105 /** */ - export const COMBOBOX = 7 + export const ICON_ZOOM_ALL = 106 /** */ - export const DROPDOWNBOX = 8 - /** Used also for: TEXTBOXMULTI */ - export const TEXTBOX = 9 + export const ICON_ZOOM_CENTER = 107 /** */ - export const VALUEBOX = 10 + export const ICON_BOX_DOTS_SMALL = 108 /** */ - export const SPINNER = 11 + export const ICON_BOX_DOTS_BIG = 109 /** */ - export const LISTVIEW = 12 + export const ICON_BOX_CONCENTRIC = 110 /** */ - export const COLORPICKER = 13 + export const ICON_BOX_GRID_BIG = 111 /** */ - export const SCROLLBAR = 14 + export const ICON_OK_TICK = 112 /** */ - export const STATUSBAR = 15 + export const ICON_CROSS = 113 /** */ - export const BORDER_COLOR_NORMAL = 0 + export const ICON_ARROW_LEFT = 114 /** */ - export const BASE_COLOR_NORMAL = 1 + export const ICON_ARROW_RIGHT = 115 /** */ - export const TEXT_COLOR_NORMAL = 2 + export const ICON_ARROW_DOWN = 116 /** */ - export const BORDER_COLOR_FOCUSED = 3 + export const ICON_ARROW_UP = 117 /** */ - export const BASE_COLOR_FOCUSED = 4 + export const ICON_ARROW_LEFT_FILL = 118 /** */ - export const TEXT_COLOR_FOCUSED = 5 + export const ICON_ARROW_RIGHT_FILL = 119 /** */ - export const BORDER_COLOR_PRESSED = 6 + export const ICON_ARROW_DOWN_FILL = 120 /** */ - export const BASE_COLOR_PRESSED = 7 + export const ICON_ARROW_UP_FILL = 121 /** */ - export const TEXT_COLOR_PRESSED = 8 + export const ICON_AUDIO = 122 /** */ - export const BORDER_COLOR_DISABLED = 9 + export const ICON_FX = 123 /** */ - export const BASE_COLOR_DISABLED = 10 + export const ICON_WAVE = 124 /** */ - export const TEXT_COLOR_DISABLED = 11 + export const ICON_WAVE_SINUS = 125 /** */ - export const BORDER_WIDTH = 12 + export const ICON_WAVE_SQUARE = 126 /** */ - export const TEXT_PADDING = 13 + export const ICON_WAVE_TRIANGULAR = 127 /** */ - export const TEXT_ALIGNMENT = 14 + export const ICON_CROSS_SMALL = 128 /** */ - export const RESERVED = 15 + export const ICON_PLAYER_PREVIOUS = 129 /** */ - export const TEXT_SIZE = 16 + export const ICON_PLAYER_PLAY_BACK = 130 /** */ - export const TEXT_SPACING = 17 + export const ICON_PLAYER_PLAY = 131 /** */ - export const LINE_COLOR = 18 + export const ICON_PLAYER_PAUSE = 132 /** */ - export const BACKGROUND_COLOR = 19 + export const ICON_PLAYER_STOP = 133 /** */ - export const GROUP_PADDING = 16 + export const ICON_PLAYER_NEXT = 134 /** */ - export const SLIDER_WIDTH = 16 + export const ICON_PLAYER_RECORD = 135 /** */ - export const SLIDER_PADDING = 17 + export const ICON_MAGNET = 136 /** */ - export const PROGRESS_PADDING = 16 + export const ICON_LOCK_CLOSE = 137 /** */ - export const CHECK_PADDING = 16 + export const ICON_LOCK_OPEN = 138 /** */ - export const COMBO_BUTTON_WIDTH = 16 + export const ICON_CLOCK = 139 /** */ - export const COMBO_BUTTON_PADDING = 17 + export const ICON_TOOLS = 140 /** */ - export const ARROW_PADDING = 16 + export const ICON_GEAR = 141 /** */ - export const DROPDOWN_ITEMS_PADDING = 17 + export const ICON_GEAR_BIG = 142 /** */ - export const TEXT_INNER_PADDING = 16 + export const ICON_BIN = 143 /** */ - export const TEXT_LINES_PADDING = 17 + export const ICON_HAND_POINTER = 144 /** */ - export const COLOR_SELECTED_FG = 18 + export const ICON_LASER = 145 /** */ - export const COLOR_SELECTED_BG = 19 + export const ICON_COIN = 146 /** */ - export const SPIN_BUTTON_WIDTH = 16 + export const ICON_EXPLOSION = 147 /** */ - export const SPIN_BUTTON_PADDING = 17 + export const ICON_1UP = 148 /** */ - export const ARROWS_SIZE = 16 + export const ICON_PLAYER = 149 /** */ - export const ARROWS_VISIBLE = 17 + export const ICON_PLAYER_JUMP = 150 /** */ - export const SCROLL_SLIDER_PADDING = 18 + export const ICON_KEY = 151 /** */ - export const SCROLL_SLIDER_SIZE = 19 + export const ICON_DEMON = 152 /** */ - export const SCROLL_PADDING = 20 + export const ICON_TEXT_POPUP = 153 /** */ - export const SCROLL_SPEED = 21 + export const ICON_GEAR_EX = 154 /** */ - export const SCROLLBAR_LEFT_SIDE = 0 + export const ICON_CRACK = 155 /** */ - export const SCROLLBAR_RIGHT_SIDE = 1 + export const ICON_CRACK_POINTS = 156 /** */ - export const LIST_ITEMS_HEIGHT = 16 + export const ICON_STAR = 157 /** */ - export const LIST_ITEMS_PADDING = 17 + export const ICON_DOOR = 158 /** */ - export const SCROLLBAR_WIDTH = 18 + export const ICON_EXIT = 159 /** */ - export const SCROLLBAR_SIDE = 19 + export const ICON_MODE_2D = 160 /** */ - export const COLOR_SELECTOR_SIZE = 16 - /** Right hue bar width */ - export const HUEBAR_WIDTH = 17 - /** Right hue bar separation from panel */ - export const HUEBAR_PADDING = 18 - /** Right hue bar selector height */ - export const HUEBAR_SELECTOR_HEIGHT = 19 - /** Right hue bar selector overflow */ - export const HUEBAR_SELECTOR_OVERFLOW = 20 + export const ICON_MODE_3D = 161 + /** */ + export const ICON_CUBE = 162 + /** */ + export const ICON_CUBE_FACE_TOP = 163 + /** */ + export const ICON_CUBE_FACE_LEFT = 164 + /** */ + export const ICON_CUBE_FACE_FRONT = 165 + /** */ + export const ICON_CUBE_FACE_BOTTOM = 166 + /** */ + export const ICON_CUBE_FACE_RIGHT = 167 + /** */ + export const ICON_CUBE_FACE_BACK = 168 + /** */ + export const ICON_CAMERA = 169 + /** */ + export const ICON_SPECIAL = 170 + /** */ + export const ICON_LINK_NET = 171 + /** */ + export const ICON_LINK_BOXES = 172 + /** */ + export const ICON_LINK_MULTI = 173 + /** */ + export const ICON_LINK = 174 + /** */ + export const ICON_LINK_BROKE = 175 + /** */ + export const ICON_TEXT_NOTES = 176 + /** */ + export const ICON_NOTEBOOK = 177 + /** */ + export const ICON_SUITCASE = 178 + /** */ + export const ICON_SUITCASE_ZIP = 179 + /** */ + export const ICON_MAILBOX = 180 + /** */ + export const ICON_MONITOR = 181 + /** */ + export const ICON_PRINTER = 182 + /** */ + export const ICON_PHOTO_CAMERA = 183 + /** */ + export const ICON_PHOTO_CAMERA_FLASH = 184 + /** */ + export const ICON_HOUSE = 185 + /** */ + export const ICON_HEART = 186 + /** */ + export const ICON_CORNER = 187 + /** */ + export const ICON_VERTICAL_BARS = 188 + /** */ + export const ICON_VERTICAL_BARS_FILL = 189 + /** */ + export const ICON_LIFE_BARS = 190 + /** */ + export const ICON_INFO = 191 + /** */ + export const ICON_CROSSLINE = 192 + /** */ + export const ICON_HELP = 193 + /** */ + export const ICON_FILETYPE_ALPHA = 194 + /** */ + export const ICON_FILETYPE_HOME = 195 + /** */ + export const ICON_LAYERS_VISIBLE = 196 + /** */ + export const ICON_LAYERS = 197 + /** */ + export const ICON_WINDOW = 198 + /** */ + export const ICON_HIDPI = 199 + /** */ + export const ICON_FILETYPE_BINARY = 200 + /** */ + export const ICON_HEX = 201 + /** */ + export const ICON_SHIELD = 202 + /** */ + export const ICON_FILE_NEW = 203 + /** */ + export const ICON_FOLDER_ADD = 204 + /** */ + export const ICON_ALARM = 205 + /** */ + export const ICON_206 = 206 + /** */ + export const ICON_207 = 207 + /** */ + export const ICON_208 = 208 + /** */ + export const ICON_209 = 209 + /** */ + export const ICON_210 = 210 + /** */ + export const ICON_211 = 211 + /** */ + export const ICON_212 = 212 + /** */ + export const ICON_213 = 213 + /** */ + export const ICON_214 = 214 + /** */ + export const ICON_215 = 215 + /** */ + export const ICON_216 = 216 + /** */ + export const ICON_217 = 217 + /** */ + export const ICON_218 = 218 + /** */ + export const ICON_219 = 219 + /** */ + export const ICON_220 = 220 + /** */ + export const ICON_221 = 221 + /** */ + export const ICON_222 = 222 + /** */ + export const ICON_223 = 223 + /** */ + export const ICON_224 = 224 + /** */ + export const ICON_225 = 225 + /** */ + export const ICON_226 = 226 + /** */ + export const ICON_227 = 227 + /** */ + export const ICON_228 = 228 + /** */ + export const ICON_229 = 229 + /** */ + export const ICON_230 = 230 + /** */ + export const ICON_231 = 231 + /** */ + export const ICON_232 = 232 + /** */ + export const ICON_233 = 233 + /** */ + export const ICON_234 = 234 + /** */ + export const ICON_235 = 235 + /** */ + export const ICON_236 = 236 + /** */ + export const ICON_237 = 237 + /** */ + export const ICON_238 = 238 + /** */ + export const ICON_239 = 239 + /** */ + export const ICON_240 = 240 + /** */ + export const ICON_241 = 241 + /** */ + export const ICON_242 = 242 + /** */ + export const ICON_243 = 243 + /** */ + export const ICON_244 = 244 + /** */ + export const ICON_245 = 245 + /** */ + export const ICON_246 = 246 + /** */ + export const ICON_247 = 247 + /** */ + export const ICON_248 = 248 + /** */ + export const ICON_249 = 249 + /** */ + export const ICON_250 = 250 + /** */ + export const ICON_251 = 251 + /** */ + export const ICON_252 = 252 + /** */ + export const ICON_253 = 253 + /** */ + export const ICON_254 = 254 + /** */ + export const ICON_255 = 255 + /** */ + export const OPENGL_11 = 1 + /** */ + export const OPENGL_21 = 2 + /** */ + export const OPENGL_33 = 3 + /** */ + export const OPENGL_43 = 4 + /** */ + export const OPENGL_ES_20 = 5 + /** */ + export const RL_ATTACHMENT_COLOR_CHANNEL0 = 0 + /** */ + export const RL_ATTACHMENT_COLOR_CHANNEL1 = 1 + /** */ + export const RL_ATTACHMENT_COLOR_CHANNEL2 = 2 + /** */ + export const RL_ATTACHMENT_COLOR_CHANNEL3 = 3 + /** */ + export const RL_ATTACHMENT_COLOR_CHANNEL4 = 4 + /** */ + export const RL_ATTACHMENT_COLOR_CHANNEL5 = 5 + /** */ + export const RL_ATTACHMENT_COLOR_CHANNEL6 = 6 + /** */ + export const RL_ATTACHMENT_COLOR_CHANNEL7 = 7 + /** */ + export const RL_ATTACHMENT_DEPTH = 100 + /** */ + export const RL_ATTACHMENT_STENCIL = 200 + /** */ + export const RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0 + /** */ + export const RL_ATTACHMENT_CUBEMAP_NEGATIVE_X = 1 + /** */ + export const RL_ATTACHMENT_CUBEMAP_POSITIVE_Y = 2 + /** */ + export const RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y = 3 + /** */ + export const RL_ATTACHMENT_CUBEMAP_POSITIVE_Z = 4 + /** */ + export const RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z = 5 + /** */ + export const RL_ATTACHMENT_TEXTURE2D = 100 + /** */ + export const RL_ATTACHMENT_RENDERBUFFER = 200 + /** Display all logs */ + export const RL_LOG_ALL = 0 + /** Trace logging, intended for internal use only */ + export const RL_LOG_TRACE = 1 + /** Debug logging, used for internal debugging, it should be disabled on release builds */ + export const RL_LOG_DEBUG = 2 + /** Info logging, used for program execution info */ + export const RL_LOG_INFO = 3 + /** Warning logging, used on recoverable failures */ + export const RL_LOG_WARNING = 4 + /** Error logging, used on unrecoverable failures */ + export const RL_LOG_ERROR = 5 + /** Fatal logging, used to abort program: exit(EXIT_FAILURE) */ + export const RL_LOG_FATAL = 6 + /** Disable logging */ + export const RL_LOG_NONE = 7 + /** 8 bit per pixel (no alpha) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1 + /** 8*2 bpp (2 channels) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2 + /** 16 bpp */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3 + /** 24 bpp */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4 + /** 16 bpp (1 bit alpha) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5 + /** 16 bpp (4 bit alpha) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6 + /** 32 bpp */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7 + /** 32 bpp (1 channel - float) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R32 = 8 + /** 32*3 bpp (3 channels - float) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 + /** 32*4 bpp (4 channels - float) */ + export const RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 + /** 4 bpp (no alpha) */ + export const RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 + /** 4 bpp (1 bit alpha) */ + export const RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 + /** 8 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 + /** 8 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 + /** 4 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 + /** 4 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 + /** 8 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 + /** 4 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 + /** 4 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 + /** 8 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 + /** 2 bpp */ + export const RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 + /** No filter, just pixel approximation */ + export const RL_TEXTURE_FILTER_POINT = 0 + /** Linear filtering */ + export const RL_TEXTURE_FILTER_BILINEAR = 1 + /** Trilinear filtering (linear with mipmaps) */ + export const RL_TEXTURE_FILTER_TRILINEAR = 2 + /** Anisotropic filtering 4x */ + export const RL_TEXTURE_FILTER_ANISOTROPIC_4X = 3 + /** Anisotropic filtering 8x */ + export const RL_TEXTURE_FILTER_ANISOTROPIC_8X = 4 + /** Anisotropic filtering 16x */ + export const RL_TEXTURE_FILTER_ANISOTROPIC_16X = 5 + /** Blend textures considering alpha (default) */ + export const RL_BLEND_ALPHA = 0 + /** Blend textures adding colors */ + export const RL_BLEND_ADDITIVE = 1 + /** Blend textures multiplying colors */ + export const RL_BLEND_MULTIPLIED = 2 + /** Blend textures adding colors (alternative) */ + export const RL_BLEND_ADD_COLORS = 3 + /** Blend textures subtracting colors (alternative) */ + export const RL_BLEND_SUBTRACT_COLORS = 4 + /** Blend premultiplied textures considering alpha */ + export const RL_BLEND_ALPHA_PREMULTIPLY = 5 + /** Blend textures using custom src/dst factors (use rlSetBlendFactors()) */ + export const RL_BLEND_CUSTOM = 6 + /** Shader location: vertex attribute: position */ + export const RL_SHADER_LOC_VERTEX_POSITION = 0 + /** Shader location: vertex attribute: texcoord01 */ + export const RL_SHADER_LOC_VERTEX_TEXCOORD01 = 1 + /** Shader location: vertex attribute: texcoord02 */ + export const RL_SHADER_LOC_VERTEX_TEXCOORD02 = 2 + /** Shader location: vertex attribute: normal */ + export const RL_SHADER_LOC_VERTEX_NORMAL = 3 + /** Shader location: vertex attribute: tangent */ + export const RL_SHADER_LOC_VERTEX_TANGENT = 4 + /** Shader location: vertex attribute: color */ + export const RL_SHADER_LOC_VERTEX_COLOR = 5 + /** Shader location: matrix uniform: model-view-projection */ + export const RL_SHADER_LOC_MATRIX_MVP = 6 + /** Shader location: matrix uniform: view (camera transform) */ + export const RL_SHADER_LOC_MATRIX_VIEW = 7 + /** Shader location: matrix uniform: projection */ + export const RL_SHADER_LOC_MATRIX_PROJECTION = 8 + /** Shader location: matrix uniform: model (transform) */ + export const RL_SHADER_LOC_MATRIX_MODEL = 9 + /** Shader location: matrix uniform: normal */ + export const RL_SHADER_LOC_MATRIX_NORMAL = 10 + /** Shader location: vector uniform: view */ + export const RL_SHADER_LOC_VECTOR_VIEW = 11 + /** Shader location: vector uniform: diffuse color */ + export const RL_SHADER_LOC_COLOR_DIFFUSE = 12 + /** Shader location: vector uniform: specular color */ + export const RL_SHADER_LOC_COLOR_SPECULAR = 13 + /** Shader location: vector uniform: ambient color */ + export const RL_SHADER_LOC_COLOR_AMBIENT = 14 + /** Shader location: sampler2d texture: albedo (same as: RL_SHADER_LOC_MAP_DIFFUSE) */ + export const RL_SHADER_LOC_MAP_ALBEDO = 15 + /** Shader location: sampler2d texture: metalness (same as: RL_SHADER_LOC_MAP_SPECULAR) */ + export const RL_SHADER_LOC_MAP_METALNESS = 16 + /** Shader location: sampler2d texture: normal */ + export const RL_SHADER_LOC_MAP_NORMAL = 17 + /** Shader location: sampler2d texture: roughness */ + export const RL_SHADER_LOC_MAP_ROUGHNESS = 18 + /** Shader location: sampler2d texture: occlusion */ + export const RL_SHADER_LOC_MAP_OCCLUSION = 19 + /** Shader location: sampler2d texture: emission */ + export const RL_SHADER_LOC_MAP_EMISSION = 20 + /** Shader location: sampler2d texture: height */ + export const RL_SHADER_LOC_MAP_HEIGHT = 21 + /** Shader location: samplerCube texture: cubemap */ + export const RL_SHADER_LOC_MAP_CUBEMAP = 22 + /** Shader location: samplerCube texture: irradiance */ + export const RL_SHADER_LOC_MAP_IRRADIANCE = 23 + /** Shader location: samplerCube texture: prefilter */ + export const RL_SHADER_LOC_MAP_PREFILTER = 24 + /** Shader location: sampler2d texture: brdf */ + export const RL_SHADER_LOC_MAP_BRDF = 25 + /** Shader uniform type: float */ + export const RL_SHADER_UNIFORM_FLOAT = 0 + /** Shader uniform type: vec2 (2 float) */ + export const RL_SHADER_UNIFORM_VEC2 = 1 + /** Shader uniform type: vec3 (3 float) */ + export const RL_SHADER_UNIFORM_VEC3 = 2 + /** Shader uniform type: vec4 (4 float) */ + export const RL_SHADER_UNIFORM_VEC4 = 3 + /** Shader uniform type: int */ + export const RL_SHADER_UNIFORM_INT = 4 + /** Shader uniform type: ivec2 (2 int) */ + export const RL_SHADER_UNIFORM_IVEC2 = 5 + /** Shader uniform type: ivec3 (3 int) */ + export const RL_SHADER_UNIFORM_IVEC3 = 6 + /** Shader uniform type: ivec4 (4 int) */ + export const RL_SHADER_UNIFORM_IVEC4 = 7 + /** Shader uniform type: sampler2d */ + export const RL_SHADER_UNIFORM_SAMPLER2D = 8 + /** Shader attribute type: float */ + export const RL_SHADER_ATTRIB_FLOAT = 0 + /** Shader attribute type: vec2 (2 float) */ + export const RL_SHADER_ATTRIB_VEC2 = 1 + /** Shader attribute type: vec3 (3 float) */ + export const RL_SHADER_ATTRIB_VEC3 = 2 + /** Shader attribute type: vec4 (4 float) */ + export const RL_SHADER_ATTRIB_VEC4 = 3 + /** */ + export const RL_DEFAULT_BATCH_BUFFER_ELEMENTS = 8192 + /** Default number of batch buffers (multi-buffering) */ + export const RL_DEFAULT_BATCH_BUFFERS = 1 + /** Default number of batch draw calls (by state changes: mode, texture) */ + export const RL_DEFAULT_BATCH_DRAWCALLS = 256 + /** Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture()) */ + export const RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS = 4 + /** Maximum size of Matrix stack */ + export const RL_MAX_MATRIX_STACK_SIZE = 32 + /** Maximum number of shader locations supported */ + export const RL_MAX_SHADER_LOCATIONS = 32 + /** GL_TEXTURE_WRAP_S */ + export const RL_TEXTURE_WRAP_S = 10242 + /** GL_TEXTURE_WRAP_T */ + export const RL_TEXTURE_WRAP_T = 10243 + /** GL_TEXTURE_MAG_FILTER */ + export const RL_TEXTURE_MAG_FILTER = 10240 + /** GL_TEXTURE_MIN_FILTER */ + export const RL_TEXTURE_MIN_FILTER = 10241 + /** GL_NEAREST */ + export const RL_TEXTURE_FILTER_NEAREST = 9728 + /** GL_LINEAR */ + export const RL_TEXTURE_FILTER_LINEAR = 9729 + /** GL_NEAREST_MIPMAP_NEAREST */ + export const RL_TEXTURE_FILTER_MIP_NEAREST = 9984 + /** GL_NEAREST_MIPMAP_LINEAR */ + export const RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR = 9986 + /** GL_LINEAR_MIPMAP_NEAREST */ + export const RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST = 9985 + /** GL_LINEAR_MIPMAP_LINEAR */ + export const RL_TEXTURE_FILTER_MIP_LINEAR = 9987 + /** Anisotropic filter (custom identifier) */ + export const RL_TEXTURE_FILTER_ANISOTROPIC = 12288 + /** GL_REPEAT */ + export const RL_TEXTURE_WRAP_REPEAT = 10497 + /** GL_CLAMP_TO_EDGE */ + export const RL_TEXTURE_WRAP_CLAMP = 33071 + /** GL_MIRRORED_REPEAT */ + export const RL_TEXTURE_WRAP_MIRROR_REPEAT = 33648 + /** GL_MIRROR_CLAMP_EXT */ + export const RL_TEXTURE_WRAP_MIRROR_CLAMP = 34626 + /** GL_MODELVIEW */ + export const RL_MODELVIEW = 5888 + /** GL_PROJECTION */ + export const RL_PROJECTION = 5889 + /** GL_TEXTURE */ + export const RL_TEXTURE = 5890 + /** GL_LINES */ + export const RL_LINES = 1 + /** GL_TRIANGLES */ + export const RL_TRIANGLES = 4 + /** GL_QUADS */ + export const RL_QUADS = 7 + /** GL_UNSIGNED_BYTE */ + export const RL_UNSIGNED_BYTE = 5121 + /** GL_FLOAT */ + export const RL_FLOAT = 5126 + /** GL_STREAM_DRAW */ + export const RL_STREAM_DRAW = 35040 + /** GL_STREAM_READ */ + export const RL_STREAM_READ = 35041 + /** GL_STREAM_COPY */ + export const RL_STREAM_COPY = 35042 + /** GL_STATIC_DRAW */ + export const RL_STATIC_DRAW = 35044 + /** GL_STATIC_READ */ + export const RL_STATIC_READ = 35045 + /** GL_STATIC_COPY */ + export const RL_STATIC_COPY = 35046 + /** GL_DYNAMIC_DRAW */ + export const RL_DYNAMIC_DRAW = 35048 + /** GL_DYNAMIC_READ */ + export const RL_DYNAMIC_READ = 35049 + /** GL_DYNAMIC_COPY */ + export const RL_DYNAMIC_COPY = 35050 + /** GL_FRAGMENT_SHADER */ + export const RL_FRAGMENT_SHADER = 35632 + /** GL_VERTEX_SHADER */ + export const RL_VERTEX_SHADER = 35633 + /** GL_COMPUTE_SHADER */ + export const RL_COMPUTE_SHADER = 37305 export const LIGHTGRAY: { r: 200, g: 200, b: 200, a: 255 } export const GRAY: { r: 130, g: 130, b: 130, a: 255 } diff --git a/src/generated/node-raylib.js b/src/generated/node-raylib.js index 5b2d816..6d497f7 100644 --- a/src/generated/node-raylib.js +++ b/src/generated/node-raylib.js @@ -134,7 +134,7 @@ function IsWindowState(flag) { raylib.IsWindowState = IsWindowState /** - * Set window configuration state using flags + * Set window configuration state using flags (only PLATFORM_DESKTOP) * * @param {number} flags * @@ -295,6 +295,20 @@ function SetWindowSize(width, height) { } raylib.SetWindowSize = SetWindowSize +/** + * Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP) + * + * @param {number} opacity + * + * @return {undefined} + */ +function SetWindowOpacity(opacity) { + return r.BindSetWindowOpacity( + opacity + ) +} +raylib.SetWindowOpacity = SetWindowOpacity + /** * Get native window handle * @@ -325,6 +339,26 @@ function GetScreenHeight() { } raylib.GetScreenHeight = GetScreenHeight +/** + * Get current render width (it considers HiDPI) + * + * @return {number} The resulting int. + */ +function GetRenderWidth() { + return r.BindGetRenderWidth() +} +raylib.GetRenderWidth = GetRenderWidth + +/** + * Get current render height (it considers HiDPI) + * + * @return {number} The resulting int. + */ +function GetRenderHeight() { + return r.BindGetRenderHeight() +} +raylib.GetRenderHeight = GetRenderHeight + /** * Get number of connected monitors * @@ -360,7 +394,7 @@ function GetMonitorPosition(monitor) { raylib.GetMonitorPosition = GetMonitorPosition /** - * Get specified monitor width (max available by monitor) + * Get specified monitor width (current video mode used by monitor) * * @param {number} monitor * @@ -374,7 +408,7 @@ function GetMonitorWidth(monitor) { raylib.GetMonitorWidth = GetMonitorWidth /** - * Get specified monitor height (max available by monitor) + * Get specified monitor height (current video mode used by monitor) * * @param {number} monitor * @@ -487,6 +521,26 @@ function GetClipboardText() { } raylib.GetClipboardText = GetClipboardText +/** + * Enable waiting for events on EndDrawing(), no automatic event polling + * + * @return {undefined} + */ +function EnableEventWaiting() { + return r.BindEnableEventWaiting() +} +raylib.EnableEventWaiting = EnableEventWaiting + +/** + * Disable waiting for events on EndDrawing(), automatic events polling + * + * @return {undefined} + */ +function DisableEventWaiting() { + return r.BindDisableEventWaiting() +} +raylib.DisableEventWaiting = DisableEventWaiting + /** * Swap back buffer with front buffer (screen drawing) * @@ -508,15 +562,15 @@ function PollInputEvents() { raylib.PollInputEvents = PollInputEvents /** - * Wait for some milliseconds (halt program execution) + * Wait for some time (halt program execution) * - * @param {number} ms + * @param {number} seconds * * @return {undefined} */ -function WaitTime(ms) { +function WaitTime(seconds) { return r.BindWaitTime( - ms + seconds ) } raylib.WaitTime = WaitTime @@ -1040,6 +1094,28 @@ function GetWorldToScreen(position, camera) { } raylib.GetWorldToScreen = GetWorldToScreen +/** + * Get the world space position for a 2d camera screen space position + * + * @param {Vector2} position + * @param {Camera2D} camera + * + * @return {Vector2} The resulting Vector2. + */ +function GetScreenToWorld2D(position, camera) { + return r.BindGetScreenToWorld2D( + position.x, + position.y, + camera.offset.x, + camera.offset.y, + camera.target.x, + camera.target.y, + camera.rotation, + camera.zoom + ) +} +raylib.GetScreenToWorld2D = GetScreenToWorld2D + /** * Get size position for a 3d world space position * @@ -1094,28 +1170,6 @@ function GetWorldToScreen2D(position, camera) { } raylib.GetWorldToScreen2D = GetWorldToScreen2D -/** - * Get the world space position for a 2d camera screen space position - * - * @param {Vector2} position - * @param {Camera2D} camera - * - * @return {Vector2} The resulting Vector2. - */ -function GetScreenToWorld2D(position, camera) { - return r.BindGetScreenToWorld2D( - position.x, - position.y, - camera.offset.x, - camera.offset.y, - camera.target.x, - camera.target.y, - camera.rotation, - camera.zoom - ) -} -raylib.GetScreenToWorld2D = GetScreenToWorld2D - /** * Set target FPS (maximum) * @@ -1276,6 +1330,20 @@ function MemFree(ptr) { } raylib.MemFree = MemFree +/** + * Open URL with default system browser (if available) + * + * @param {string} url + * + * @return {undefined} + */ +function OpenURL(url) { + return r.BindOpenURL( + url + ) +} +raylib.OpenURL = OpenURL + /** * Load file data as byte array (read) * @@ -1324,6 +1392,24 @@ function SaveFileData(fileName, data, bytesToWrite) { } raylib.SaveFileData = SaveFileData +/** + * Export data to code (.h), returns true on success + * + * @param {string} data + * @param {number} size + * @param {string} fileName + * + * @return {boolean} The resulting bool. + */ +function ExportDataAsCode(data, size, fileName) { + return r.BindExportDataAsCode( + data, + size, + fileName + ) +} +raylib.ExportDataAsCode = ExportDataAsCode + /** * Load text data from file (read), returns a '\0' terminated string * @@ -1412,6 +1498,20 @@ function IsFileExtension(fileName, ext) { } raylib.IsFileExtension = IsFileExtension +/** + * Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h) + * + * @param {string} fileName + * + * @return {number} The resulting int. + */ +function GetFileLength(fileName) { + return r.BindGetFileLength( + fileName + ) +} +raylib.GetFileLength = GetFileLength + /** * Get pointer to extension for a filename string (includes dot: '.png') * @@ -1493,44 +1593,90 @@ function GetWorkingDirectory() { raylib.GetWorkingDirectory = GetWorkingDirectory /** - * Get filenames in a directory path (memory should be freed) + * Get the directory if the running application (uses static string) + * + * @return {string} The resulting const char *. + */ +function GetApplicationDirectory() { + return r.BindGetApplicationDirectory() +} +raylib.GetApplicationDirectory = GetApplicationDirectory + +/** + * Change working directory, return true on success + * + * @param {string} dir + * + * @return {boolean} The resulting bool. + */ +function ChangeDirectory(dir) { + return r.BindChangeDirectory( + dir + ) +} +raylib.ChangeDirectory = ChangeDirectory + +/** + * Check if a given path is a file or a directory + * + * @param {string} path + * + * @return {boolean} The resulting bool. + */ +function IsPathFile(path) { + return r.BindIsPathFile( + path + ) +} +raylib.IsPathFile = IsPathFile + +/** + * Load directory filepaths * * @param {string} dirPath - * @param {number} count * - * @return {number} The resulting char **. + * @return {FilePathList} The resulting FilePathList. */ -function GetDirectoryFiles(dirPath, count) { - return r.BindGetDirectoryFiles( - dirPath, - count +function LoadDirectoryFiles(dirPath) { + return r.BindLoadDirectoryFiles( + dirPath ) } -raylib.GetDirectoryFiles = GetDirectoryFiles +raylib.LoadDirectoryFiles = LoadDirectoryFiles /** - * Clear directory files paths buffers (free memory) + * Load directory filepaths with extension filtering and recursive directory scan * - * @return {undefined} + * @param {string} basePath + * @param {string} filter + * @param {boolean} scanSubdirs + * + * @return {FilePathList} The resulting FilePathList. */ -function ClearDirectoryFiles() { - return r.BindClearDirectoryFiles() +function LoadDirectoryFilesEx(basePath, filter, scanSubdirs) { + return r.BindLoadDirectoryFilesEx( + basePath, + filter, + scanSubdirs + ) } -raylib.ClearDirectoryFiles = ClearDirectoryFiles +raylib.LoadDirectoryFilesEx = LoadDirectoryFilesEx /** - * Change working directory, return true on success + * Unload filepaths * - * @param {string} dir + * @param {FilePathList} files * - * @return {boolean} The resulting bool. + * @return {undefined} */ -function ChangeDirectory(dir) { - return r.BindChangeDirectory( - dir +function UnloadDirectoryFiles(files) { + return r.BindUnloadDirectoryFiles( + files.capacity, + files.count, + files.paths ) } -raylib.ChangeDirectory = ChangeDirectory +raylib.UnloadDirectoryFiles = UnloadDirectoryFiles /** * Check if a file has been dropped into window @@ -1543,28 +1689,30 @@ function IsFileDropped() { raylib.IsFileDropped = IsFileDropped /** - * Get dropped files names (memory should be freed) - * - * @param {number} count + * Load dropped filepaths * - * @return {number} The resulting char **. + * @return {FilePathList} The resulting FilePathList. */ -function GetDroppedFiles(count) { - return r.BindGetDroppedFiles( - count - ) +function LoadDroppedFiles() { + return r.BindLoadDroppedFiles() } -raylib.GetDroppedFiles = GetDroppedFiles +raylib.LoadDroppedFiles = LoadDroppedFiles /** - * Clear dropped files paths buffer (free memory) + * Unload dropped filepaths + * + * @param {FilePathList} files * * @return {undefined} */ -function ClearDroppedFiles() { - return r.BindClearDroppedFiles() +function UnloadDroppedFiles(files) { + return r.BindUnloadDroppedFiles( + files.capacity, + files.count, + files.paths + ) } -raylib.ClearDroppedFiles = ClearDroppedFiles +raylib.UnloadDroppedFiles = UnloadDroppedFiles /** * Get file modification time (last write time) @@ -1581,119 +1729,75 @@ function GetFileModTime(fileName) { raylib.GetFileModTime = GetFileModTime /** - * Compress data (DEFLATE algorithm) + * Compress data (DEFLATE algorithm), memory must be MemFree() * * @param {Buffer} data - * @param {number} dataLength - * @param {number} compDataLength + * @param {number} dataSize + * @param {number} compDataSize * * @return {Buffer} The resulting unsigned char *. */ -function CompressData(data, dataLength, compDataLength) { +function CompressData(data, dataSize, compDataSize) { return r.BindCompressData( data, - dataLength, - compDataLength + dataSize, + compDataSize ) } raylib.CompressData = CompressData /** - * Decompress data (DEFLATE algorithm) + * Decompress data (DEFLATE algorithm), memory must be MemFree() * * @param {Buffer} compData - * @param {number} compDataLength - * @param {number} dataLength + * @param {number} compDataSize + * @param {number} dataSize * * @return {Buffer} The resulting unsigned char *. */ -function DecompressData(compData, compDataLength, dataLength) { +function DecompressData(compData, compDataSize, dataSize) { return r.BindDecompressData( compData, - compDataLength, - dataLength + compDataSize, + dataSize ) } raylib.DecompressData = DecompressData /** - * Encode data to Base64 string + * Encode data to Base64 string, memory must be MemFree() * * @param {Buffer} data - * @param {number} dataLength - * @param {number} outputLength + * @param {number} dataSize + * @param {number} outputSize * * @return {string} The resulting char *. */ -function EncodeDataBase64(data, dataLength, outputLength) { +function EncodeDataBase64(data, dataSize, outputSize) { return r.BindEncodeDataBase64( data, - dataLength, - outputLength + dataSize, + outputSize ) } raylib.EncodeDataBase64 = EncodeDataBase64 /** - * Decode Base64 string data + * Decode Base64 string data, memory must be MemFree() * * @param {Buffer} data - * @param {number} outputLength + * @param {number} outputSize * * @return {Buffer} The resulting unsigned char *. */ -function DecodeDataBase64(data, outputLength) { +function DecodeDataBase64(data, outputSize) { return r.BindDecodeDataBase64( data, - outputLength + outputSize ) } raylib.DecodeDataBase64 = DecodeDataBase64 -/** - * Save integer value to storage file (to defined position), returns true on success - * - * @param {number} position - * @param {number} value - * - * @return {boolean} The resulting bool. - */ -function SaveStorageValue(position, value) { - return r.BindSaveStorageValue( - position, - value - ) -} -raylib.SaveStorageValue = SaveStorageValue - -/** - * Load integer value from storage file (from defined position) - * - * @param {number} position - * - * @return {number} The resulting int. - */ -function LoadStorageValue(position) { - return r.BindLoadStorageValue( - position - ) -} -raylib.LoadStorageValue = LoadStorageValue - -/** - * Open URL with default system browser (if available) - * - * @param {string} url - * - * @return {undefined} - */ -function OpenURL(url) { - return r.BindOpenURL( - url - ) -} -raylib.OpenURL = OpenURL - /** * Check if a key has been pressed once * @@ -2075,7 +2179,7 @@ function SetMouseScale(scaleX, scaleY) { raylib.SetMouseScale = SetMouseScale /** - * Get mouse wheel movement Y + * Get mouse wheel movement for X or Y, whichever is larger * * @return {number} The resulting float. */ @@ -2084,6 +2188,16 @@ function GetMouseWheelMove() { } raylib.GetMouseWheelMove = GetMouseWheelMove +/** + * Get mouse wheel movement for both X and Y + * + * @return {Vector2} The resulting Vector2. + */ +function GetMouseWheelMoveV() { + return r.BindGetMouseWheelMoveV() +} +raylib.GetMouseWheelMoveV = GetMouseWheelMoveV + /** * Set mouse cursor * @@ -4782,7 +4896,7 @@ function LoadFont(fileName) { raylib.LoadFont = LoadFont /** - * Load font from file with extended parameters + * Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set * * @param {string} fileName * @param {number} fontSize @@ -4915,7 +5029,7 @@ function UnloadFontData(chars, glyphCount) { raylib.UnloadFontData = UnloadFontData /** - * Unload Font from GPU memory (VRAM) + * Unload font from GPU memory (VRAM) * * @param {Font} font * @@ -4937,6 +5051,31 @@ function UnloadFont(font) { } raylib.UnloadFont = UnloadFont +/** + * Export font as code file, returns true on success + * + * @param {Font} font + * @param {string} fileName + * + * @return {boolean} The resulting bool. + */ +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.ExportFontAsCode = ExportFontAsCode + /** * Draw current FPS * @@ -5093,33 +5232,72 @@ function DrawTextCodepoint(font, codepoint, position, fontSize, tint) { raylib.DrawTextCodepoint = DrawTextCodepoint /** - * Measure string width for default font - * - * @param {string} text - * @param {number} fontSize - * - * @return {number} The resulting int. - */ -function MeasureText(text, fontSize) { - return r.BindMeasureText( - text, - fontSize - ) -} -raylib.MeasureText = MeasureText - -/** - * Measure string size for Font + * Draw multiple character (codepoint) * * @param {Font} font - * @param {string} text + * @param {number} codepoints + * @param {number} count + * @param {Vector2} position * @param {number} fontSize * @param {number} spacing + * @param {Color} tint * - * @return {Vector2} The resulting Vector2. + * @return {undefined} */ -function MeasureTextEx(font, text, fontSize, spacing) { - return r.BindMeasureTextEx( +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, + tint.r, + tint.g, + tint.b, + tint.a + ) +} +raylib.DrawTextCodepoints = DrawTextCodepoints + +/** + * Measure string width for default font + * + * @param {string} text + * @param {number} fontSize + * + * @return {number} The resulting int. + */ +function MeasureText(text, fontSize) { + return r.BindMeasureText( + text, + fontSize + ) +} +raylib.MeasureText = MeasureText + +/** + * Measure string size for Font + * + * @param {Font} font + * @param {string} text + * @param {number} fontSize + * @param {number} spacing + * + * @return {Vector2} The resulting Vector2. + */ +function MeasureTextEx(font, text, fontSize, spacing) { + return r.BindMeasureTextEx( font.baseSize, font.glyphCount, font.glyphPadding, @@ -7213,50 +7391,6 @@ function GetRayCollisionBox(ray, box) { } raylib.GetRayCollisionBox = GetRayCollisionBox -/** - * Get collision info between ray and model - * - * @param {Ray} ray - * @param {Model} model - * - * @return {RayCollision} The resulting RayCollision. - */ -function GetRayCollisionModel(ray, model) { - return r.BindGetRayCollisionModel( - ray.position.x, - ray.position.y, - ray.position.z, - ray.direction.x, - ray.direction.y, - ray.direction.z, - 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.GetRayCollisionModel = GetRayCollisionModel - /** * Get collision info between ray and mesh * @@ -7495,6 +7629,7 @@ raylib.LoadSoundFromWave = LoadSoundFromWave function UpdateSound(sound, data, sampleCount) { return r.BindUpdateSound( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7533,6 +7668,7 @@ raylib.UnloadWave = UnloadWave function UnloadSound(sound) { return r.BindUnloadSound( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7591,6 +7727,7 @@ raylib.ExportWaveAsCode = ExportWaveAsCode function PlaySound(sound) { return r.BindPlaySound( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7609,6 +7746,7 @@ raylib.PlaySound = PlaySound function StopSound(sound) { return r.BindStopSound( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7627,6 +7765,7 @@ raylib.StopSound = StopSound function PauseSound(sound) { return r.BindPauseSound( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7645,6 +7784,7 @@ raylib.PauseSound = PauseSound function ResumeSound(sound) { return r.BindResumeSound( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7663,6 +7803,7 @@ raylib.ResumeSound = ResumeSound function PlaySoundMulti(sound) { return r.BindPlaySoundMulti( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7701,6 +7842,7 @@ raylib.GetSoundsPlaying = GetSoundsPlaying function IsSoundPlaying(sound) { return r.BindIsSoundPlaying( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7720,6 +7862,7 @@ raylib.IsSoundPlaying = IsSoundPlaying function SetSoundVolume(sound, volume) { return r.BindSetSoundVolume( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7740,6 +7883,7 @@ raylib.SetSoundVolume = SetSoundVolume function SetSoundPitch(sound, pitch) { return r.BindSetSoundPitch( sound.stream.buffer, + sound.stream.processor, sound.stream.sampleRate, sound.stream.sampleSize, sound.stream.channels, @@ -7749,6 +7893,27 @@ function SetSoundPitch(sound, pitch) { } raylib.SetSoundPitch = SetSoundPitch +/** + * Set pan for a sound (0.5 is center) + * + * @param {Sound} sound + * @param {number} pan + * + * @return {undefined} + */ +function SetSoundPan(sound, pan) { + return r.BindSetSoundPan( + sound.stream.buffer, + sound.stream.processor, + sound.stream.sampleRate, + sound.stream.sampleSize, + sound.stream.channels, + sound.frameCount, + pan + ) +} +raylib.SetSoundPan = SetSoundPan + /** * Copy a wave to a new wave * @@ -7768,7 +7933,7 @@ function WaveCopy(wave) { raylib.WaveCopy = WaveCopy /** - * Load samples data from wave as a floats array + * Load samples data from wave as a 32bit float data array * * @param {Wave} wave * @@ -7841,6 +8006,7 @@ raylib.LoadMusicStreamFromMemory = LoadMusicStreamFromMemory function UnloadMusicStream(music) { return r.BindUnloadMusicStream( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -7862,6 +8028,7 @@ raylib.UnloadMusicStream = UnloadMusicStream function PlayMusicStream(music) { return r.BindPlayMusicStream( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -7883,6 +8050,7 @@ raylib.PlayMusicStream = PlayMusicStream function IsMusicStreamPlaying(music) { return r.BindIsMusicStreamPlaying( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -7904,6 +8072,7 @@ raylib.IsMusicStreamPlaying = IsMusicStreamPlaying function UpdateMusicStream(music) { return r.BindUpdateMusicStream( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -7925,6 +8094,7 @@ raylib.UpdateMusicStream = UpdateMusicStream function StopMusicStream(music) { return r.BindStopMusicStream( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -7946,6 +8116,7 @@ raylib.StopMusicStream = StopMusicStream function PauseMusicStream(music) { return r.BindPauseMusicStream( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -7967,6 +8138,7 @@ raylib.PauseMusicStream = PauseMusicStream function ResumeMusicStream(music) { return r.BindResumeMusicStream( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -7989,6 +8161,7 @@ raylib.ResumeMusicStream = ResumeMusicStream function SeekMusicStream(music, position) { return r.BindSeekMusicStream( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -8012,6 +8185,7 @@ raylib.SeekMusicStream = SeekMusicStream function SetMusicVolume(music, volume) { return r.BindSetMusicVolume( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -8035,6 +8209,7 @@ raylib.SetMusicVolume = SetMusicVolume function SetMusicPitch(music, pitch) { return r.BindSetMusicPitch( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -8047,6 +8222,30 @@ function SetMusicPitch(music, pitch) { } raylib.SetMusicPitch = SetMusicPitch +/** + * Set pan for a music (0.5 is center) + * + * @param {Music} music + * @param {number} pan + * + * @return {undefined} + */ +function SetMusicPan(music, pan) { + return r.BindSetMusicPan( + music.stream.buffer, + music.stream.processor, + music.stream.sampleRate, + music.stream.sampleSize, + music.stream.channels, + music.frameCount, + music.looping, + music.ctxType, + music.ctxData, + pan + ) +} +raylib.SetMusicPan = SetMusicPan + /** * Get music time length (in seconds) * @@ -8057,6 +8256,7 @@ raylib.SetMusicPitch = SetMusicPitch function GetMusicTimeLength(music) { return r.BindGetMusicTimeLength( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -8078,6 +8278,7 @@ raylib.GetMusicTimeLength = GetMusicTimeLength function GetMusicTimePlayed(music) { return r.BindGetMusicTimePlayed( music.stream.buffer, + music.stream.processor, music.stream.sampleRate, music.stream.sampleSize, music.stream.channels, @@ -8117,6 +8318,7 @@ raylib.LoadAudioStream = LoadAudioStream function UnloadAudioStream(stream) { return r.BindUnloadAudioStream( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels @@ -8136,6 +8338,7 @@ raylib.UnloadAudioStream = UnloadAudioStream function UpdateAudioStream(stream, data, frameCount) { return r.BindUpdateAudioStream( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels, @@ -8155,6 +8358,7 @@ raylib.UpdateAudioStream = UpdateAudioStream function IsAudioStreamProcessed(stream) { return r.BindIsAudioStreamProcessed( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels @@ -8172,6 +8376,7 @@ raylib.IsAudioStreamProcessed = IsAudioStreamProcessed function PlayAudioStream(stream) { return r.BindPlayAudioStream( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels @@ -8189,6 +8394,7 @@ raylib.PlayAudioStream = PlayAudioStream function PauseAudioStream(stream) { return r.BindPauseAudioStream( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels @@ -8206,6 +8412,7 @@ raylib.PauseAudioStream = PauseAudioStream function ResumeAudioStream(stream) { return r.BindResumeAudioStream( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels @@ -8223,6 +8430,7 @@ raylib.ResumeAudioStream = ResumeAudioStream function IsAudioStreamPlaying(stream) { return r.BindIsAudioStreamPlaying( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels @@ -8240,6 +8448,7 @@ raylib.IsAudioStreamPlaying = IsAudioStreamPlaying function StopAudioStream(stream) { return r.BindStopAudioStream( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels @@ -8258,6 +8467,7 @@ raylib.StopAudioStream = StopAudioStream function SetAudioStreamVolume(stream, volume) { return r.BindSetAudioStreamVolume( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels, @@ -8277,6 +8487,7 @@ raylib.SetAudioStreamVolume = SetAudioStreamVolume function SetAudioStreamPitch(stream, pitch) { return r.BindSetAudioStreamPitch( stream.buffer, + stream.processor, stream.sampleRate, stream.sampleSize, stream.channels, @@ -8285,6 +8496,26 @@ function SetAudioStreamPitch(stream, pitch) { } raylib.SetAudioStreamPitch = SetAudioStreamPitch +/** + * Set pan for audio stream (0.5 is centered) + * + * @param {AudioStream} stream + * @param {number} pan + * + * @return {undefined} + */ +function SetAudioStreamPan(stream, pan) { + return r.BindSetAudioStreamPan( + stream.buffer, + stream.processor, + stream.sampleRate, + stream.sampleSize, + stream.channels, + pan + ) +} +raylib.SetAudioStreamPan = SetAudioStreamPan + /** * Default size for new audio streams * @@ -8299,6 +8530,16 @@ function SetAudioStreamBufferSizeDefault(size) { } raylib.SetAudioStreamBufferSizeDefault = SetAudioStreamBufferSizeDefault +/** + * Ease: Linear + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseLinearNone(t, b, c, d) { return r.BindEaseLinearNone( t, @@ -8309,6 +8550,16 @@ function EaseLinearNone(t, b, c, d) { } raylib.EaseLinearNone = EaseLinearNone +/** + * Ease: Linear In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseLinearIn(t, b, c, d) { return r.BindEaseLinearIn( t, @@ -8319,6 +8570,16 @@ function EaseLinearIn(t, b, c, d) { } raylib.EaseLinearIn = EaseLinearIn +/** + * Ease: Linear Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseLinearOut(t, b, c, d) { return r.BindEaseLinearOut( t, @@ -8329,6 +8590,16 @@ function EaseLinearOut(t, b, c, d) { } raylib.EaseLinearOut = EaseLinearOut +/** + * Ease: Linear In Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseLinearInOut(t, b, c, d) { return r.BindEaseLinearInOut( t, @@ -8339,6 +8610,16 @@ function EaseLinearInOut(t, b, c, d) { } raylib.EaseLinearInOut = EaseLinearInOut +/** + * Ease: Sine In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseSineIn(t, b, c, d) { return r.BindEaseSineIn( t, @@ -8349,6 +8630,16 @@ function EaseSineIn(t, b, c, d) { } 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, @@ -8359,6 +8650,16 @@ function EaseSineOut(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, @@ -8369,6 +8670,16 @@ function EaseSineInOut(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, @@ -8379,6 +8690,16 @@ function EaseCircIn(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, @@ -8389,6 +8710,16 @@ function EaseCircOut(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, @@ -8399,6 +8730,16 @@ function EaseCircInOut(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, @@ -8409,6 +8750,16 @@ function EaseCubicIn(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, @@ -8419,6 +8770,16 @@ function EaseCubicOut(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, @@ -8429,6 +8790,16 @@ function EaseCubicInOut(t, b, c, d) { } raylib.EaseCubicInOut = EaseCubicInOut +/** + * Ease: Quadratic In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseQuadIn(t, b, c, d) { return r.BindEaseQuadIn( t, @@ -8439,6 +8810,16 @@ function EaseQuadIn(t, b, c, d) { } raylib.EaseQuadIn = EaseQuadIn +/** + * Ease: Quadratic Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseQuadOut(t, b, c, d) { return r.BindEaseQuadOut( t, @@ -8449,6 +8830,16 @@ function EaseQuadOut(t, b, c, d) { } raylib.EaseQuadOut = EaseQuadOut +/** + * Ease: Quadratic In Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseQuadInOut(t, b, c, d) { return r.BindEaseQuadInOut( t, @@ -8459,6 +8850,16 @@ function EaseQuadInOut(t, b, c, d) { } raylib.EaseQuadInOut = EaseQuadInOut +/** + * Ease: Exponential In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseExpoIn(t, b, c, d) { return r.BindEaseExpoIn( t, @@ -8469,6 +8870,16 @@ function EaseExpoIn(t, b, c, d) { } raylib.EaseExpoIn = EaseExpoIn +/** + * Ease: Exponential Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseExpoOut(t, b, c, d) { return r.BindEaseExpoOut( t, @@ -8479,6 +8890,16 @@ function EaseExpoOut(t, b, c, d) { } raylib.EaseExpoOut = EaseExpoOut +/** + * Ease: Exponential In Out + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseExpoInOut(t, b, c, d) { return r.BindEaseExpoInOut( t, @@ -8489,6 +8910,16 @@ function EaseExpoInOut(t, b, c, d) { } raylib.EaseExpoInOut = EaseExpoInOut +/** + * Ease: Back In + * + * @param {number} t + * @param {number} b + * @param {number} c + * @param {number} d + * + * @return {number} The resulting float. + */ function EaseBackIn(t, b, c, d) { return r.BindEaseBackIn( t, @@ -8499,6 +8930,16 @@ function EaseBackIn(t, b, c, d) { } raylib.EaseBackIn = EaseBackIn +/** + * 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, @@ -8509,6 +8950,16 @@ function EaseBackOut(t, b, c, d) { } raylib.EaseBackOut = EaseBackOut +/** + * 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, @@ -8519,6 +8970,16 @@ function EaseBackInOut(t, b, c, d) { } raylib.EaseBackInOut = EaseBackInOut +/** + * 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, @@ -8529,6 +8990,16 @@ function EaseBounceOut(t, b, c, d) { } raylib.EaseBounceOut = EaseBounceOut +/** + * 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, @@ -8539,7 +9010,17 @@ function EaseBounceIn(t, b, c, d) { } raylib.EaseBounceIn = EaseBounceIn -function EaseBounceInOut(t, b, c, d) { +/** + * 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, @@ -8549,6 +9030,16 @@ function EaseBounceInOut(t, b, c, d) { } raylib.EaseBounceInOut = EaseBounceInOut +/** + * 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, @@ -8559,6 +9050,16 @@ function EaseElasticIn(t, b, c, d) { } raylib.EaseElasticIn = EaseElasticIn +/** + * 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, @@ -8569,6 +9070,16 @@ function EaseElasticOut(t, b, c, d) { } raylib.EaseElasticOut = EaseElasticOut +/** + * 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, @@ -8617,6 +9128,23 @@ function Remap(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() } @@ -8701,6 +9229,16 @@ function Vector2Distance(v1, v2) { } 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, @@ -8756,6 +9294,30 @@ function Vector2Normalize(v) { } raylib.Vector2Normalize = Vector2Normalize +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.Vector2Transform = Vector2Transform + function Vector2Lerp(v1, v2, amount) { return r.BindVector2Lerp( v1.x, @@ -8797,6 +9359,46 @@ function Vector2MoveTowards(v, target, maxDistance) { } raylib.Vector2MoveTowards = Vector2MoveTowards +function Vector2Invert(v) { + return r.BindVector2Invert( + v.x, + v.y + ) +} +raylib.Vector2Invert = Vector2Invert + +function Vector2Clamp(v, min, max) { + return r.BindVector2Clamp( + v.x, + v.y, + min.x, + min.y, + max.x, + max.y + ) +} +raylib.Vector2Clamp = Vector2Clamp + +function Vector2ClampValue(v, min, max) { + return r.BindVector2ClampValue( + v.x, + v.y, + min, + max + ) +} +raylib.Vector2ClampValue = Vector2ClampValue + +function Vector2Equals(p, q) { + return r.BindVector2Equals( + p.x, + p.y, + q.x, + q.y + ) +} +raylib.Vector2Equals = Vector2Equals + function Vector3Zero() { return r.BindVector3Zero() } @@ -8932,6 +9534,18 @@ function Vector3Distance(v1, v2) { } raylib.Vector3Distance = Vector3Distance +function Vector3DistanceSqr(v1, v2) { + return r.BindVector3DistanceSqr( + v1.x, + v1.y, + v1.z, + v2.x, + v2.y, + v2.z + ) +} +raylib.Vector3DistanceSqr = Vector3DistanceSqr + function Vector3Angle(v1, v2) { return r.BindVector3Angle( v1.x, @@ -9017,6 +9631,19 @@ function Vector3RotateByQuaternion(v, 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 Vector3Lerp(v1, v2, amount) { return r.BindVector3Lerp( v1.x, @@ -9125,6 +9752,66 @@ function Vector3Unproject(source, projection, view) { } raylib.Vector3Unproject = Vector3Unproject +function Vector3Invert(v) { + return r.BindVector3Invert( + v.x, + v.y, + v.z + ) +} +raylib.Vector3Invert = Vector3Invert + +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.z + ) +} +raylib.Vector3Clamp = Vector3Clamp + +function Vector3ClampValue(v, min, max) { + return r.BindVector3ClampValue( + v.x, + v.y, + v.z, + min, + max + ) +} +raylib.Vector3ClampValue = Vector3ClampValue + +function Vector3Equals(p, q) { + return r.BindVector3Equals( + p.x, + p.y, + p.z, + 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 + ) +} +raylib.Vector3Refract = Vector3Refract + function MatrixDeterminant(mat) { return r.BindMatrixDeterminant( mat.m0, @@ -9213,28 +9900,6 @@ function MatrixInvert(mat) { } raylib.MatrixInvert = MatrixInvert -function MatrixNormalize(mat) { - return r.BindMatrixNormalize( - 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.MatrixNormalize = MatrixNormalize - function MatrixIdentity() { return r.BindMatrixIdentity() } @@ -9394,20 +10059,20 @@ function MatrixRotateZ(angle) { } raylib.MatrixRotateZ = MatrixRotateZ -function MatrixRotateXYZ(ang) { +function MatrixRotateXYZ(angle) { return r.BindMatrixRotateXYZ( - ang.x, - ang.y, - ang.z + angle.x, + angle.y, + angle.z ) } raylib.MatrixRotateXYZ = MatrixRotateXYZ -function MatrixRotateZYX(ang) { +function MatrixRotateZYX(angle) { return r.BindMatrixRotateZYX( - ang.x, - ang.y, - ang.z + angle.x, + angle.y, + angle.z ) } raylib.MatrixRotateZYX = MatrixRotateZYX @@ -9678,6 +10343,14 @@ function QuaternionTransform(q, mat) { } raylib.QuaternionTransform = QuaternionTransform +function QuaternionEquals(p, q) { + return r.BindQuaternionEquals( + p, + q + ) +} +raylib.QuaternionEquals = QuaternionEquals + /** * Enable gui controls (global state) * @@ -9894,15 +10567,17 @@ raylib.GuiLine = GuiLine * Panel control, useful to group controls * * @param {Rectangle} bounds + * @param {string} text * * @return {undefined} */ -function GuiPanel(bounds) { +function GuiPanel(bounds, text) { return r.BindGuiPanel( bounds.x, bounds.y, bounds.width, - bounds.height + bounds.height, + text ) } raylib.GuiPanel = GuiPanel @@ -9911,17 +10586,19 @@ raylib.GuiPanel = GuiPanel * Scroll Panel control * * @param {Rectangle} bounds + * @param {string} text * @param {Rectangle} content * @param {number} scroll * * @return {Rectangle} The resulting Rectangle. */ -function GuiScrollPanel(bounds, content, scroll) { +function GuiScrollPanel(bounds, text, content, scroll) { return r.BindGuiScrollPanel( bounds.x, bounds.y, bounds.width, bounds.height, + text, content.x, content.y, content.width, @@ -10315,43 +10992,22 @@ function GuiDummyRec(bounds, text) { raylib.GuiDummyRec = GuiDummyRec /** - * Scroll Bar control - * - * @param {Rectangle} bounds - * @param {number} value - * @param {number} minValue - * @param {number} maxValue - * - * @return {number} The resulting int. - */ -function GuiScrollBar(bounds, value, minValue, maxValue) { - return r.BindGuiScrollBar( - bounds.x, - bounds.y, - bounds.width, - bounds.height, - value, - minValue, - maxValue - ) -} -raylib.GuiScrollBar = GuiScrollBar - -/** - * Grid control + * Grid control, returns mouse cell position * * @param {Rectangle} bounds + * @param {string} text * @param {number} spacing * @param {number} subdivs * * @return {Vector2} The resulting Vector2. */ -function GuiGrid(bounds, spacing, subdivs) { +function GuiGrid(bounds, text, spacing, subdivs) { return r.BindGuiGrid( bounds.x, bounds.y, bounds.width, bounds.height, + text, spacing, subdivs ) @@ -10432,17 +11088,19 @@ function GuiMessageBox(bounds, title, message, buttons) { raylib.GuiMessageBox = GuiMessageBox /** - * Text Input Box control, ask for text + * Text Input Box control, ask for text, supports secret * * @param {Rectangle} bounds * @param {string} title * @param {string} message * @param {string} buttons * @param {string} text + * @param {number} textMaxSize + * @param {number} secretViewActive * * @return {number} The resulting int. */ -function GuiTextInputBox(bounds, title, message, buttons, text) { +function GuiTextInputBox(bounds, title, message, buttons, text, textMaxSize, secretViewActive) { return r.BindGuiTextInputBox( bounds.x, bounds.y, @@ -10451,7 +11109,9 @@ function GuiTextInputBox(bounds, title, message, buttons, text) { title, message, buttons, - text + text, + textMaxSize, + secretViewActive ) } raylib.GuiTextInputBox = GuiTextInputBox @@ -10460,16 +11120,18 @@ raylib.GuiTextInputBox = GuiTextInputBox * Color Picker control (multiple color controls) * * @param {Rectangle} bounds + * @param {string} text * @param {Color} color * * @return {Color} The resulting Color. */ -function GuiColorPicker(bounds, color) { +function GuiColorPicker(bounds, text, color) { return r.BindGuiColorPicker( bounds.x, bounds.y, bounds.width, bounds.height, + text, color.r, color.g, color.b, @@ -10482,16 +11144,18 @@ raylib.GuiColorPicker = GuiColorPicker * Color Panel control * * @param {Rectangle} bounds + * @param {string} text * @param {Color} color * * @return {Color} The resulting Color. */ -function GuiColorPanel(bounds, color) { +function GuiColorPanel(bounds, text, color) { return r.BindGuiColorPanel( bounds.x, bounds.y, bounds.width, bounds.height, + text, color.r, color.g, color.b, @@ -10504,16 +11168,18 @@ raylib.GuiColorPanel = GuiColorPanel * Color Bar Alpha control * * @param {Rectangle} bounds + * @param {string} text * @param {number} alpha * * @return {number} The resulting float. */ -function GuiColorBarAlpha(bounds, alpha) { +function GuiColorBarAlpha(bounds, text, alpha) { return r.BindGuiColorBarAlpha( bounds.x, bounds.y, bounds.width, bounds.height, + text, alpha ) } @@ -10523,16 +11189,18 @@ raylib.GuiColorBarAlpha = GuiColorBarAlpha * Color Bar Hue control * * @param {Rectangle} bounds + * @param {string} text * @param {number} value * * @return {number} The resulting float. */ -function GuiColorBarHue(bounds, value) { +function GuiColorBarHue(bounds, text, value) { return r.BindGuiColorBarHue( bounds.x, bounds.y, bounds.width, bounds.height, + text, value ) } @@ -10632,6 +11300,20 @@ function GuiSetIconData(iconId, data) { } raylib.GuiSetIconData = GuiSetIconData +/** + * Set icon scale (1 by default) + * + * @param {number} scale + * + * @return {undefined} + */ +function GuiSetIconScale(scale) { + return r.BindGuiSetIconScale( + scale + ) +} +raylib.GuiSetIconScale = GuiSetIconScale + /** * Set icon pixel value * @@ -10687,4141 +11369,9394 @@ function GuiCheckIconPixel(iconId, x, y) { raylib.GuiCheckIconPixel = GuiCheckIconPixel /** - * Update camera position for selected mode + * Choose the current matrix to be transformed * - * @param {Camera} camera + * @param {number} mode * * @return {undefined} */ -function UpdateCamera(camera) { - const obj = r.BindUpdateCamera( - camera.position.x, - camera.position.y, - camera.position.z, - camera.target.x, - camera.target.y, - camera.target.z, - camera.up.x, - camera.up.y, - camera.up.z, - camera.fovy, - camera.projection +function rlMatrixMode(mode) { + return r.BindrlMatrixMode( + mode ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - camera[key] = obj[key] - } - } } -raylib.UpdateCamera = UpdateCamera +raylib.rlMatrixMode = rlMatrixMode /** - * Convert image data to desired format - * - * @param {Image} image - * @param {number} newFormat + * Push the current matrix to stack * * @return {undefined} */ -function ImageFormat(image, newFormat) { - const obj = r.BindImageFormat( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - newFormat - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } +function rlPushMatrix() { + return r.BindrlPushMatrix() } -raylib.ImageFormat = ImageFormat +raylib.rlPushMatrix = rlPushMatrix /** - * Convert image to POT (power-of-two) + * Pop lattest inserted matrix from stack * - * @param {Image} image - * @param {Color} fill + * @return {undefined} + */ +function rlPopMatrix() { + return r.BindrlPopMatrix() +} +raylib.rlPopMatrix = rlPopMatrix + +/** + * Reset current matrix to identity matrix * * @return {undefined} */ -function ImageToPOT(image, fill) { - const obj = r.BindImageToPOT( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - fill.r, - fill.g, - fill.b, - fill.a - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } +function rlLoadIdentity() { + return r.BindrlLoadIdentity() } -raylib.ImageToPOT = ImageToPOT +raylib.rlLoadIdentity = rlLoadIdentity /** - * Crop an image to a defined rectangle + * Multiply the current matrix by a translation matrix * - * @param {Image} image - * @param {Rectangle} crop + * @param {number} x + * @param {number} y + * @param {number} z * * @return {undefined} */ -function ImageCrop(image, crop) { - const obj = r.BindImageCrop( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - crop.x, - crop.y, - crop.width, - crop.height +function rlTranslatef(x, y, z) { + return r.BindrlTranslatef( + x, + y, + z ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageCrop = ImageCrop +raylib.rlTranslatef = rlTranslatef /** - * Crop image depending on alpha value + * Multiply the current matrix by a rotation matrix * - * @param {Image} image - * @param {number} threshold + * @param {number} angle + * @param {number} x + * @param {number} y + * @param {number} z * * @return {undefined} */ -function ImageAlphaCrop(image, threshold) { - const obj = r.BindImageAlphaCrop( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - threshold +function rlRotatef(angle, x, y, z) { + return r.BindrlRotatef( + angle, + x, + y, + z ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageAlphaCrop = ImageAlphaCrop +raylib.rlRotatef = rlRotatef /** - * Clear alpha channel to desired color + * Multiply the current matrix by a scaling matrix * - * @param {Image} image - * @param {Color} color - * @param {number} threshold + * @param {number} x + * @param {number} y + * @param {number} z * * @return {undefined} */ -function ImageAlphaClear(image, color, threshold) { - const obj = r.BindImageAlphaClear( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - color.r, - color.g, - color.b, - color.a, - threshold +function rlScalef(x, y, z) { + return r.BindrlScalef( + x, + y, + z ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageAlphaClear = ImageAlphaClear +raylib.rlScalef = rlScalef /** - * Apply alpha mask to image + * Multiply the current matrix by another matrix * - * @param {Image} image - * @param {Image} alphaMask + * @param {number} matf * * @return {undefined} */ -function ImageAlphaMask(image, alphaMask) { - const obj = r.BindImageAlphaMask( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - alphaMask.data, - alphaMask.width, - alphaMask.height, - alphaMask.mipmaps, - alphaMask.format +function rlMultMatrixf(matf) { + return r.BindrlMultMatrixf( + matf ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageAlphaMask = ImageAlphaMask +raylib.rlMultMatrixf = rlMultMatrixf + +function rlFrustum(left, right, bottom, top, znear, zfar) { + return r.BindrlFrustum( + left, + right, + bottom, + top, + znear, + zfar + ) +} +raylib.rlFrustum = rlFrustum + +function rlOrtho(left, right, bottom, top, znear, zfar) { + return r.BindrlOrtho( + left, + right, + bottom, + top, + znear, + zfar + ) +} +raylib.rlOrtho = rlOrtho /** - * Premultiply alpha channel + * Set the viewport area * - * @param {Image} image + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height * * @return {undefined} */ -function ImageAlphaPremultiply(image) { - const obj = r.BindImageAlphaPremultiply( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function rlViewport(x, y, width, height) { + return r.BindrlViewport( + x, + y, + width, + height ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageAlphaPremultiply = ImageAlphaPremultiply +raylib.rlViewport = rlViewport /** - * Resize image (Bicubic scaling algorithm) + * Initialize drawing mode (how to organize vertex) * - * @param {Image} image - * @param {number} newWidth - * @param {number} newHeight + * @param {number} mode * * @return {undefined} */ -function ImageResize(image, newWidth, newHeight) { - const obj = r.BindImageResize( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - newWidth, - newHeight +function rlBegin(mode) { + return r.BindrlBegin( + mode ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageResize = ImageResize +raylib.rlBegin = rlBegin /** - * Resize image (Nearest-Neighbor scaling algorithm) + * Finish vertex providing * - * @param {Image} image - * @param {number} newWidth - * @param {number} newHeight + * @return {undefined} + */ +function rlEnd() { + return r.BindrlEnd() +} +raylib.rlEnd = rlEnd + +/** + * Define one vertex (position) - 2 int + * + * @param {number} x + * @param {number} y * * @return {undefined} */ -function ImageResizeNN(image, newWidth, newHeight) { - const obj = r.BindImageResizeNN( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - newWidth, - newHeight +function rlVertex2i(x, y) { + return r.BindrlVertex2i( + x, + y ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageResizeNN = ImageResizeNN +raylib.rlVertex2i = rlVertex2i /** - * Resize canvas and fill with color + * Define one vertex (position) - 2 float * - * @param {Image} image - * @param {number} newWidth - * @param {number} newHeight - * @param {number} offsetX - * @param {number} offsetY - * @param {Color} fill + * @param {number} x + * @param {number} y * * @return {undefined} */ -function ImageResizeCanvas(image, newWidth, newHeight, offsetX, offsetY, fill) { - const obj = r.BindImageResizeCanvas( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - newWidth, - newHeight, - offsetX, - offsetY, - fill.r, - fill.g, - fill.b, - fill.a +function rlVertex2f(x, y) { + return r.BindrlVertex2f( + x, + y ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageResizeCanvas = ImageResizeCanvas +raylib.rlVertex2f = rlVertex2f /** - * Compute all mipmap levels for a provided image + * Define one vertex (position) - 3 float * - * @param {Image} image + * @param {number} x + * @param {number} y + * @param {number} z * * @return {undefined} */ -function ImageMipmaps(image) { - const obj = r.BindImageMipmaps( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function rlVertex3f(x, y, z) { + return r.BindrlVertex3f( + x, + y, + z ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageMipmaps = ImageMipmaps +raylib.rlVertex3f = rlVertex3f /** - * Dither image data to 16bpp or lower (Floyd-Steinberg dithering) + * Define one vertex (texture coordinate) - 2 float * - * @param {Image} image - * @param {number} rBpp - * @param {number} gBpp - * @param {number} bBpp - * @param {number} aBpp + * @param {number} x + * @param {number} y * * @return {undefined} */ -function ImageDither(image, rBpp, gBpp, bBpp, aBpp) { - const obj = r.BindImageDither( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - rBpp, - gBpp, - bBpp, - aBpp +function rlTexCoord2f(x, y) { + return r.BindrlTexCoord2f( + x, + y ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageDither = ImageDither +raylib.rlTexCoord2f = rlTexCoord2f /** - * Flip image vertically + * Define one vertex (normal) - 3 float * - * @param {Image} image + * @param {number} x + * @param {number} y + * @param {number} z * * @return {undefined} */ -function ImageFlipVertical(image) { - const obj = r.BindImageFlipVertical( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function rlNormal3f(x, y, z) { + return r.BindrlNormal3f( + x, + y, + z ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageFlipVertical = ImageFlipVertical +raylib.rlNormal3f = rlNormal3f /** - * Flip image horizontally + * Define one vertex (color) - 4 byte * - * @param {Image} image + * @param {number} r + * @param {number} g + * @param {number} b + * @param {number} a * * @return {undefined} */ -function ImageFlipHorizontal(image) { - const obj = r.BindImageFlipHorizontal( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function rlColor4ub(r, g, b, a) { + return r.BindrlColor4ub( + r, + g, + b, + a ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageFlipHorizontal = ImageFlipHorizontal +raylib.rlColor4ub = rlColor4ub /** - * Rotate image clockwise 90deg + * Define one vertex (color) - 3 float * - * @param {Image} image + * @param {number} x + * @param {number} y + * @param {number} z * * @return {undefined} */ -function ImageRotateCW(image) { - const obj = r.BindImageRotateCW( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function rlColor3f(x, y, z) { + return r.BindrlColor3f( + x, + y, + z ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageRotateCW = ImageRotateCW +raylib.rlColor3f = rlColor3f /** - * Rotate image counter-clockwise 90deg + * Define one vertex (color) - 4 float * - * @param {Image} image + * @param {number} x + * @param {number} y + * @param {number} z + * @param {number} w * * @return {undefined} */ -function ImageRotateCCW(image) { - const obj = r.BindImageRotateCCW( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function rlColor4f(x, y, z, w) { + return r.BindrlColor4f( + x, + y, + z, + w ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageRotateCCW = ImageRotateCCW +raylib.rlColor4f = rlColor4f /** - * Modify image color: tint + * Enable vertex array (VAO, if supported) * - * @param {Image} image - * @param {Color} color + * @param {number} vaoId * - * @return {undefined} + * @return {boolean} The resulting bool. */ -function ImageColorTint(image, color) { - const obj = r.BindImageColorTint( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - color.r, - color.g, - color.b, - color.a +function rlEnableVertexArray(vaoId) { + return r.BindrlEnableVertexArray( + vaoId ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageColorTint = ImageColorTint +raylib.rlEnableVertexArray = rlEnableVertexArray /** - * Modify image color: invert + * Disable vertex array (VAO, if supported) * - * @param {Image} image + * @return {undefined} + */ +function rlDisableVertexArray() { + return r.BindrlDisableVertexArray() +} +raylib.rlDisableVertexArray = rlDisableVertexArray + +/** + * Enable vertex buffer (VBO) + * + * @param {number} id * * @return {undefined} */ -function ImageColorInvert(image) { - const obj = r.BindImageColorInvert( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function rlEnableVertexBuffer(id) { + return r.BindrlEnableVertexBuffer( + id ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageColorInvert = ImageColorInvert +raylib.rlEnableVertexBuffer = rlEnableVertexBuffer /** - * Modify image color: grayscale + * Disable vertex buffer (VBO) * - * @param {Image} image + * @return {undefined} + */ +function rlDisableVertexBuffer() { + return r.BindrlDisableVertexBuffer() +} +raylib.rlDisableVertexBuffer = rlDisableVertexBuffer + +/** + * Enable vertex buffer element (VBO element) + * + * @param {number} id * * @return {undefined} */ -function ImageColorGrayscale(image) { - const obj = r.BindImageColorGrayscale( - image.data, - image.width, - image.height, - image.mipmaps, - image.format +function rlEnableVertexBufferElement(id) { + return r.BindrlEnableVertexBufferElement( + id ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageColorGrayscale = ImageColorGrayscale +raylib.rlEnableVertexBufferElement = rlEnableVertexBufferElement /** - * Modify image color: contrast (-100 to 100) + * Disable vertex buffer element (VBO element) * - * @param {Image} image - * @param {number} contrast + * @return {undefined} + */ +function rlDisableVertexBufferElement() { + return r.BindrlDisableVertexBufferElement() +} +raylib.rlDisableVertexBufferElement = rlDisableVertexBufferElement + +/** + * Enable vertex attribute index + * + * @param {number} index * * @return {undefined} */ -function ImageColorContrast(image, contrast) { - const obj = r.BindImageColorContrast( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - contrast +function rlEnableVertexAttribute(index) { + return r.BindrlEnableVertexAttribute( + index ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageColorContrast = ImageColorContrast +raylib.rlEnableVertexAttribute = rlEnableVertexAttribute /** - * Modify image color: brightness (-255 to 255) + * Disable vertex attribute index * - * @param {Image} image - * @param {number} brightness + * @param {number} index * * @return {undefined} */ -function ImageColorBrightness(image, brightness) { - const obj = r.BindImageColorBrightness( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - brightness +function rlDisableVertexAttribute(index) { + return r.BindrlDisableVertexAttribute( + index ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageColorBrightness = ImageColorBrightness +raylib.rlDisableVertexAttribute = rlDisableVertexAttribute /** - * Modify image color: replace color + * Select and active a texture slot * - * @param {Image} image - * @param {Color} color - * @param {Color} replace + * @param {number} slot * * @return {undefined} */ -function ImageColorReplace(image, color, replace) { - const obj = r.BindImageColorReplace( - image.data, - image.width, - image.height, - image.mipmaps, - image.format, - color.r, - color.g, - color.b, - color.a, - replace.r, - replace.g, - replace.b, - replace.a +function rlActiveTextureSlot(slot) { + return r.BindrlActiveTextureSlot( + slot ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - image[key] = obj[key] - } - } } -raylib.ImageColorReplace = ImageColorReplace +raylib.rlActiveTextureSlot = rlActiveTextureSlot /** - * Clear image background with given color + * Enable texture * - * @param {Image} dst - * @param {Color} color + * @param {number} id * * @return {undefined} */ -function ImageClearBackground(dst, color) { - const obj = r.BindImageClearBackground( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - color.r, - color.g, - color.b, - color.a +function rlEnableTexture(id) { + return r.BindrlEnableTexture( + id ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } } -raylib.ImageClearBackground = ImageClearBackground +raylib.rlEnableTexture = rlEnableTexture /** - * Draw pixel within an image - * - * @param {Image} dst - * @param {number} posX - * @param {number} posY - * @param {Color} color + * Disable texture * * @return {undefined} */ -function ImageDrawPixel(dst, posX, posY, color) { - const obj = r.BindImageDrawPixel( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - posX, - posY, - color.r, - color.g, - color.b, - color.a - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } +function rlDisableTexture() { + return r.BindrlDisableTexture() } -raylib.ImageDrawPixel = ImageDrawPixel +raylib.rlDisableTexture = rlDisableTexture /** - * Draw pixel within an image (Vector version) + * Enable texture cubemap * - * @param {Image} dst - * @param {Vector2} position - * @param {Color} color + * @param {number} id * * @return {undefined} */ -function ImageDrawPixelV(dst, position, color) { - const obj = r.BindImageDrawPixelV( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - position.x, - position.y, - color.r, - color.g, - color.b, - color.a +function rlEnableTextureCubemap(id) { + return r.BindrlEnableTextureCubemap( + id ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } } -raylib.ImageDrawPixelV = ImageDrawPixelV +raylib.rlEnableTextureCubemap = rlEnableTextureCubemap /** - * Draw line within an image - * - * @param {Image} dst - * @param {number} startPosX - * @param {number} startPosY - * @param {number} endPosX - * @param {number} endPosY - * @param {Color} color + * Disable texture cubemap * * @return {undefined} */ -function ImageDrawLine(dst, startPosX, startPosY, endPosX, endPosY, color) { - const obj = r.BindImageDrawLine( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - startPosX, - startPosY, - endPosX, - endPosY, - color.r, - color.g, - color.b, - color.a - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } +function rlDisableTextureCubemap() { + return r.BindrlDisableTextureCubemap() } -raylib.ImageDrawLine = ImageDrawLine +raylib.rlDisableTextureCubemap = rlDisableTextureCubemap /** - * Draw line within an image (Vector version) + * Set texture parameters (filter, wrap) * - * @param {Image} dst - * @param {Vector2} start - * @param {Vector2} end - * @param {Color} color + * @param {number} id + * @param {number} param + * @param {number} value * * @return {undefined} */ -function ImageDrawLineV(dst, start, end, color) { - const obj = r.BindImageDrawLineV( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - start.x, - start.y, - end.x, - end.y, - color.r, - color.g, - color.b, - color.a +function rlTextureParameters(id, param, value) { + return r.BindrlTextureParameters( + id, + param, + value ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } } -raylib.ImageDrawLineV = ImageDrawLineV +raylib.rlTextureParameters = rlTextureParameters /** - * Draw circle within an image + * Enable shader program * - * @param {Image} dst - * @param {number} centerX - * @param {number} centerY - * @param {number} radius - * @param {Color} color + * @param {number} id * * @return {undefined} */ -function ImageDrawCircle(dst, centerX, centerY, radius, color) { - const obj = r.BindImageDrawCircle( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - centerX, - centerY, - radius, - color.r, - color.g, - color.b, - color.a +function rlEnableShader(id) { + return r.BindrlEnableShader( + id ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } } -raylib.ImageDrawCircle = ImageDrawCircle +raylib.rlEnableShader = rlEnableShader /** - * Draw circle within an image (Vector version) - * - * @param {Image} dst - * @param {Vector2} center - * @param {number} radius - * @param {Color} color + * Disable shader program * * @return {undefined} */ -function ImageDrawCircleV(dst, center, radius, color) { - const obj = r.BindImageDrawCircleV( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - center.x, - center.y, - radius, - color.r, - color.g, - color.b, - color.a - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } +function rlDisableShader() { + return r.BindrlDisableShader() } -raylib.ImageDrawCircleV = ImageDrawCircleV +raylib.rlDisableShader = rlDisableShader /** - * Draw rectangle within an image + * Enable render texture (fbo) * - * @param {Image} dst - * @param {number} posX - * @param {number} posY - * @param {number} width - * @param {number} height - * @param {Color} color + * @param {number} id * * @return {undefined} */ -function ImageDrawRectangle(dst, posX, posY, width, height, color) { - const obj = r.BindImageDrawRectangle( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - posX, - posY, - width, - height, - color.r, - color.g, - color.b, - color.a +function rlEnableFramebuffer(id) { + return r.BindrlEnableFramebuffer( + id ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } } -raylib.ImageDrawRectangle = ImageDrawRectangle +raylib.rlEnableFramebuffer = rlEnableFramebuffer /** - * Draw rectangle within an image (Vector version) + * Disable render texture (fbo), return to default framebuffer * - * @param {Image} dst - * @param {Vector2} position - * @param {Vector2} size - * @param {Color} color + * @return {undefined} + */ +function rlDisableFramebuffer() { + return r.BindrlDisableFramebuffer() +} +raylib.rlDisableFramebuffer = rlDisableFramebuffer + +/** + * Activate multiple draw color buffers + * + * @param {number} count * * @return {undefined} */ -function ImageDrawRectangleV(dst, position, size, color) { - const obj = r.BindImageDrawRectangleV( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - position.x, - position.y, - size.x, - size.y, - color.r, - color.g, - color.b, - color.a +function rlActiveDrawBuffers(count) { + return r.BindrlActiveDrawBuffers( + count ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } } -raylib.ImageDrawRectangleV = ImageDrawRectangleV +raylib.rlActiveDrawBuffers = rlActiveDrawBuffers /** - * Draw rectangle within an image + * Enable color blending * - * @param {Image} dst - * @param {Rectangle} rec - * @param {Color} color + * @return {undefined} + */ +function rlEnableColorBlend() { + return r.BindrlEnableColorBlend() +} +raylib.rlEnableColorBlend = rlEnableColorBlend + +/** + * Disable color blending * * @return {undefined} */ -function ImageDrawRectangleRec(dst, rec, color) { - const obj = r.BindImageDrawRectangleRec( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - rec.x, - rec.y, - rec.width, - rec.height, - color.r, - color.g, - color.b, - color.a - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } +function rlDisableColorBlend() { + return r.BindrlDisableColorBlend() } -raylib.ImageDrawRectangleRec = ImageDrawRectangleRec +raylib.rlDisableColorBlend = rlDisableColorBlend /** - * Draw rectangle lines within an image + * Enable depth test * - * @param {Image} dst - * @param {Rectangle} rec - * @param {number} thick - * @param {Color} color + * @return {undefined} + */ +function rlEnableDepthTest() { + return r.BindrlEnableDepthTest() +} +raylib.rlEnableDepthTest = rlEnableDepthTest + +/** + * Disable depth test * * @return {undefined} */ -function ImageDrawRectangleLines(dst, rec, thick, color) { - const obj = r.BindImageDrawRectangleLines( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - rec.x, - rec.y, - rec.width, - rec.height, - thick, - color.r, - color.g, - color.b, - color.a - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } +function rlDisableDepthTest() { + return r.BindrlDisableDepthTest() } -raylib.ImageDrawRectangleLines = ImageDrawRectangleLines +raylib.rlDisableDepthTest = rlDisableDepthTest /** - * Draw a source image within a destination image (tint applied to source) - * - * @param {Image} dst - * @param {Image} src - * @param {Rectangle} srcRec - * @param {Rectangle} dstRec - * @param {Color} tint + * Enable depth write * * @return {undefined} */ -function ImageDraw(dst, src, srcRec, dstRec, tint) { - const obj = r.BindImageDraw( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - src.data, - src.width, - src.height, - src.mipmaps, - src.format, - srcRec.x, - srcRec.y, - srcRec.width, - srcRec.height, - dstRec.x, - dstRec.y, - dstRec.width, - dstRec.height, - tint.r, - tint.g, - tint.b, - tint.a - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } +function rlEnableDepthMask() { + return r.BindrlEnableDepthMask() } -raylib.ImageDraw = ImageDraw +raylib.rlEnableDepthMask = rlEnableDepthMask /** - * Draw text (using default font) within an image (destination) - * - * @param {Image} dst - * @param {string} text - * @param {number} posX - * @param {number} posY - * @param {number} fontSize - * @param {Color} color + * Disable depth write * * @return {undefined} */ -function ImageDrawText(dst, text, posX, posY, fontSize, color) { - const obj = r.BindImageDrawText( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - text, - posX, - posY, - fontSize, - color.r, - color.g, - color.b, - color.a - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } +function rlDisableDepthMask() { + return r.BindrlDisableDepthMask() } -raylib.ImageDrawText = ImageDrawText +raylib.rlDisableDepthMask = rlDisableDepthMask /** - * Draw text (custom sprite font) within an image (destination) + * Enable backface culling * - * @param {Image} dst - * @param {Font} font - * @param {string} text - * @param {Vector2} position - * @param {number} fontSize - * @param {number} spacing - * @param {Color} tint + * @return {undefined} + */ +function rlEnableBackfaceCulling() { + return r.BindrlEnableBackfaceCulling() +} +raylib.rlEnableBackfaceCulling = rlEnableBackfaceCulling + +/** + * Disable backface culling * * @return {undefined} */ -function ImageDrawTextEx(dst, font, text, position, fontSize, spacing, tint) { - const obj = r.BindImageDrawTextEx( - dst.data, - dst.width, - dst.height, - dst.mipmaps, - dst.format, - 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 - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - dst[key] = obj[key] - } - } +function rlDisableBackfaceCulling() { + return r.BindrlDisableBackfaceCulling() } -raylib.ImageDrawTextEx = ImageDrawTextEx +raylib.rlDisableBackfaceCulling = rlDisableBackfaceCulling /** - * Generate GPU mipmaps for a texture + * Enable scissor test * - * @param {Texture2D} texture + * @return {undefined} + */ +function rlEnableScissorTest() { + return r.BindrlEnableScissorTest() +} +raylib.rlEnableScissorTest = rlEnableScissorTest + +/** + * Disable scissor test * * @return {undefined} */ -function GenTextureMipmaps(texture) { - const obj = r.BindGenTextureMipmaps( - texture.id, - texture.width, - texture.height, - texture.mipmaps, - texture.format - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - texture[key] = obj[key] - } - } +function rlDisableScissorTest() { + return r.BindrlDisableScissorTest() } -raylib.GenTextureMipmaps = GenTextureMipmaps +raylib.rlDisableScissorTest = rlDisableScissorTest /** - * Upload mesh vertex data in GPU and provide VAO/VBO ids + * Scissor test * - * @param {Mesh} mesh - * @param {boolean} dynamic + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height * * @return {undefined} */ -function UploadMesh(mesh, dynamic) { - const obj = r.BindUploadMesh( - 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, - dynamic +function rlScissor(x, y, width, height) { + return r.BindrlScissor( + x, + y, + width, + height ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - mesh[key] = obj[key] - } - } } -raylib.UploadMesh = UploadMesh +raylib.rlScissor = rlScissor /** - * Compute mesh tangents + * Enable wire mode * - * @param {Mesh} mesh + * @return {undefined} + */ +function rlEnableWireMode() { + return r.BindrlEnableWireMode() +} +raylib.rlEnableWireMode = rlEnableWireMode + +/** + * Disable wire mode * * @return {undefined} */ -function GenMeshTangents(mesh) { - const obj = r.BindGenMeshTangents( - 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 - ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - mesh[key] = obj[key] - } - } +function rlDisableWireMode() { + return r.BindrlDisableWireMode() } -raylib.GenMeshTangents = GenMeshTangents +raylib.rlDisableWireMode = rlDisableWireMode /** - * Compute mesh binormals + * Set the line drawing width * - * @param {Mesh} mesh + * @param {number} width * * @return {undefined} */ -function GenMeshBinormals(mesh) { - const obj = r.BindGenMeshBinormals( - 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 rlSetLineWidth(width) { + return r.BindrlSetLineWidth( + width ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - mesh[key] = obj[key] - } - } } -raylib.GenMeshBinormals = GenMeshBinormals +raylib.rlSetLineWidth = rlSetLineWidth /** - * Set material for a mesh + * Get the line drawing width * - * @param {Model} model - * @param {number} meshId - * @param {number} materialId + * @return {number} The resulting float. + */ +function rlGetLineWidth() { + return r.BindrlGetLineWidth() +} +raylib.rlGetLineWidth = rlGetLineWidth + +/** + * Enable line aliasing * * @return {undefined} */ -function SetModelMeshMaterial(model, meshId, materialId) { - const obj = r.BindSetModelMeshMaterial( - 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, - meshId, - materialId +function rlEnableSmoothLines() { + return r.BindrlEnableSmoothLines() +} +raylib.rlEnableSmoothLines = rlEnableSmoothLines + +/** + * Disable line aliasing + * + * @return {undefined} + */ +function rlDisableSmoothLines() { + return r.BindrlDisableSmoothLines() +} +raylib.rlDisableSmoothLines = rlDisableSmoothLines + +/** + * Enable stereo rendering + * + * @return {undefined} + */ +function rlEnableStereoRender() { + return r.BindrlEnableStereoRender() +} +raylib.rlEnableStereoRender = rlEnableStereoRender + +/** + * Disable stereo rendering + * + * @return {undefined} + */ +function rlDisableStereoRender() { + return r.BindrlDisableStereoRender() +} +raylib.rlDisableStereoRender = rlDisableStereoRender + +/** + * Check if stereo render is enabled + * + * @return {boolean} The resulting bool. + */ +function rlIsStereoRenderEnabled() { + return r.BindrlIsStereoRenderEnabled() +} +raylib.rlIsStereoRenderEnabled = rlIsStereoRenderEnabled + +/** + * Clear color buffer with color + * + * @param {number} r + * @param {number} g + * @param {number} b + * @param {number} a + * + * @return {undefined} + */ +function rlClearColor(r, g, b, a) { + return r.BindrlClearColor( + r, + g, + b, + a ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - model[key] = obj[key] - } - } } -raylib.SetModelMeshMaterial = SetModelMeshMaterial +raylib.rlClearColor = rlClearColor /** - * Convert wave data to desired format + * Clear used screen buffers (color and depth) * - * @param {Wave} wave - * @param {number} sampleRate - * @param {number} sampleSize - * @param {number} channels + * @return {undefined} + */ +function rlClearScreenBuffers() { + return r.BindrlClearScreenBuffers() +} +raylib.rlClearScreenBuffers = rlClearScreenBuffers + +/** + * Check and log OpenGL error codes * * @return {undefined} */ -function WaveFormat(wave, sampleRate, sampleSize, channels) { - const obj = r.BindWaveFormat( - wave.frameCount, - wave.sampleRate, - wave.sampleSize, - wave.channels, - wave.data, - sampleRate, - sampleSize, - channels +function rlCheckErrors() { + return r.BindrlCheckErrors() +} +raylib.rlCheckErrors = rlCheckErrors + +/** + * Set blending mode + * + * @param {number} mode + * + * @return {undefined} + */ +function rlSetBlendMode(mode) { + return r.BindrlSetBlendMode( + mode ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - wave[key] = obj[key] - } - } } -raylib.WaveFormat = WaveFormat +raylib.rlSetBlendMode = rlSetBlendMode /** - * Crop a wave to defined samples range + * Set blending mode factor and equation (using OpenGL factors) * - * @param {Wave} wave - * @param {number} initSample - * @param {number} finalSample + * @param {number} glSrcFactor + * @param {number} glDstFactor + * @param {number} glEquation * * @return {undefined} */ -function WaveCrop(wave, initSample, finalSample) { - const obj = r.BindWaveCrop( - wave.frameCount, - wave.sampleRate, - wave.sampleSize, - wave.channels, - wave.data, - initSample, - finalSample +function rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation) { + return r.BindrlSetBlendFactors( + glSrcFactor, + glDstFactor, + glEquation ) - if (typeof obj !== 'undefined') { - for (const key in obj) { - wave[key] = obj[key] - } - } } -raylib.WaveCrop = WaveCrop +raylib.rlSetBlendFactors = rlSetBlendFactors + +/** + * Initialize rlgl (buffers, shaders, textures, states) + * + * @param {number} width + * @param {number} height + * + * @return {undefined} + */ +function rlglInit(width, height) { + return r.BindrlglInit( + width, + height + ) +} +raylib.rlglInit = rlglInit + +/** + * De-inititialize rlgl (buffers, shaders, textures) + * + * @return {undefined} + */ +function rlglClose() { + return r.BindrlglClose() +} +raylib.rlglClose = rlglClose + +/** + * Load OpenGL extensions (loader function required) + * + * @param {number} loader + * + * @return {undefined} + */ +function rlLoadExtensions(loader) { + return r.BindrlLoadExtensions( + loader + ) +} +raylib.rlLoadExtensions = rlLoadExtensions + +/** + * Get current OpenGL version + * + * @return {number} The resulting int. + */ +function rlGetVersion() { + return r.BindrlGetVersion() +} +raylib.rlGetVersion = rlGetVersion + +/** + * Set current framebuffer width + * + * @param {number} width + * + * @return {undefined} + */ +function rlSetFramebufferWidth(width) { + return r.BindrlSetFramebufferWidth( + width + ) +} +raylib.rlSetFramebufferWidth = rlSetFramebufferWidth + +/** + * Get default framebuffer width + * + * @return {number} The resulting int. + */ +function rlGetFramebufferWidth() { + return r.BindrlGetFramebufferWidth() +} +raylib.rlGetFramebufferWidth = rlGetFramebufferWidth + +/** + * Set current framebuffer height + * + * @param {number} height + * + * @return {undefined} + */ +function rlSetFramebufferHeight(height) { + return r.BindrlSetFramebufferHeight( + height + ) +} +raylib.rlSetFramebufferHeight = rlSetFramebufferHeight + +/** + * Get default framebuffer height + * + * @return {number} The resulting int. + */ +function rlGetFramebufferHeight() { + return r.BindrlGetFramebufferHeight() +} +raylib.rlGetFramebufferHeight = rlGetFramebufferHeight + +/** + * Get default texture id + * + * @return {number} The resulting unsigned int. + */ +function rlGetTextureIdDefault() { + return r.BindrlGetTextureIdDefault() +} +raylib.rlGetTextureIdDefault = rlGetTextureIdDefault + +/** + * Get default shader id + * + * @return {number} The resulting unsigned int. + */ +function rlGetShaderIdDefault() { + return r.BindrlGetShaderIdDefault() +} +raylib.rlGetShaderIdDefault = rlGetShaderIdDefault + +/** + * Get default shader locations + * + * @return {number} The resulting int *. + */ +function rlGetShaderLocsDefault() { + return r.BindrlGetShaderLocsDefault() +} +raylib.rlGetShaderLocsDefault = rlGetShaderLocsDefault + +/** + * Load a render batch system + * + * @param {number} numBuffers + * @param {number} bufferElements + * + * @return {rlRenderBatch} The resulting rlRenderBatch. + */ +function rlLoadRenderBatch(numBuffers, bufferElements) { + return r.BindrlLoadRenderBatch( + numBuffers, + bufferElements + ) +} +raylib.rlLoadRenderBatch = rlLoadRenderBatch + +/** + * Unload render batch system + * + * @param {rlRenderBatch} batch + * + * @return {undefined} + */ +function rlUnloadRenderBatch(batch) { + return r.BindrlUnloadRenderBatch( + batch.bufferCount, + batch.currentBuffer, + batch.vertexBuffer, + batch.draws, + batch.drawCounter, + batch.currentDepth + ) +} +raylib.rlUnloadRenderBatch = rlUnloadRenderBatch + +/** + * Draw render batch data (Update->Draw->Reset) + * + * @param {number} batch + * + * @return {undefined} + */ +function rlDrawRenderBatch(batch) { + return r.BindrlDrawRenderBatch( + batch + ) +} +raylib.rlDrawRenderBatch = rlDrawRenderBatch + +/** + * Set the active render batch for rlgl (NULL for default internal) + * + * @param {number} batch + * + * @return {undefined} + */ +function rlSetRenderBatchActive(batch) { + return r.BindrlSetRenderBatchActive( + batch + ) +} +raylib.rlSetRenderBatchActive = rlSetRenderBatchActive + +/** + * Update and draw internal render batch + * + * @return {undefined} + */ +function rlDrawRenderBatchActive() { + return r.BindrlDrawRenderBatchActive() +} +raylib.rlDrawRenderBatchActive = rlDrawRenderBatchActive + +/** + * Check internal buffer overflow for a given number of vertex + * + * @param {number} vCount + * + * @return {boolean} The resulting bool. + */ +function rlCheckRenderBatchLimit(vCount) { + return r.BindrlCheckRenderBatchLimit( + vCount + ) +} +raylib.rlCheckRenderBatchLimit = rlCheckRenderBatchLimit + +/** + * Set current texture for render batch and check buffers limits + * + * @param {number} id + * + * @return {undefined} + */ +function rlSetTexture(id) { + return r.BindrlSetTexture( + id + ) +} +raylib.rlSetTexture = rlSetTexture + +/** + * Load vertex array (vao) if supported + * + * @return {number} The resulting unsigned int. + */ +function rlLoadVertexArray() { + return r.BindrlLoadVertexArray() +} +raylib.rlLoadVertexArray = rlLoadVertexArray + +/** + * Load a vertex buffer attribute + * + * @param {number} buffer + * @param {number} size + * @param {boolean} dynamic + * + * @return {number} The resulting unsigned int. + */ +function rlLoadVertexBuffer(buffer, size, dynamic) { + return r.BindrlLoadVertexBuffer( + buffer, + size, + dynamic + ) +} +raylib.rlLoadVertexBuffer = rlLoadVertexBuffer + +/** + * Load a new attributes element buffer + * + * @param {number} buffer + * @param {number} size + * @param {boolean} dynamic + * + * @return {number} The resulting unsigned int. + */ +function rlLoadVertexBufferElement(buffer, size, dynamic) { + return r.BindrlLoadVertexBufferElement( + buffer, + size, + dynamic + ) +} +raylib.rlLoadVertexBufferElement = rlLoadVertexBufferElement + +/** + * Update GPU buffer with new data + * + * @param {number} bufferId + * @param {number} data + * @param {number} dataSize + * @param {number} offset + * + * @return {undefined} + */ +function rlUpdateVertexBuffer(bufferId, data, dataSize, offset) { + return r.BindrlUpdateVertexBuffer( + bufferId, + data, + dataSize, + offset + ) +} +raylib.rlUpdateVertexBuffer = rlUpdateVertexBuffer + +/** + * Update vertex buffer elements with new data + * + * @param {number} id + * @param {number} data + * @param {number} dataSize + * @param {number} offset + * + * @return {undefined} + */ +function rlUpdateVertexBufferElements(id, data, dataSize, offset) { + return r.BindrlUpdateVertexBufferElements( + id, + data, + dataSize, + offset + ) +} +raylib.rlUpdateVertexBufferElements = rlUpdateVertexBufferElements + +function rlUnloadVertexArray(vaoId) { + return r.BindrlUnloadVertexArray( + vaoId + ) +} +raylib.rlUnloadVertexArray = rlUnloadVertexArray + +function rlUnloadVertexBuffer(vboId) { + return r.BindrlUnloadVertexBuffer( + vboId + ) +} +raylib.rlUnloadVertexBuffer = rlUnloadVertexBuffer + +function rlSetVertexAttribute(index, compSize, type, normalized, stride, pointer) { + return r.BindrlSetVertexAttribute( + index, + compSize, + type, + normalized, + stride, + pointer + ) +} +raylib.rlSetVertexAttribute = rlSetVertexAttribute + +function rlSetVertexAttributeDivisor(index, divisor) { + return r.BindrlSetVertexAttributeDivisor( + index, + divisor + ) +} +raylib.rlSetVertexAttributeDivisor = rlSetVertexAttributeDivisor + +/** + * Set vertex attribute default value + * + * @param {number} locIndex + * @param {number} value + * @param {number} attribType + * @param {number} count + * + * @return {undefined} + */ +function rlSetVertexAttributeDefault(locIndex, value, attribType, count) { + return r.BindrlSetVertexAttributeDefault( + locIndex, + value, + attribType, + count + ) +} +raylib.rlSetVertexAttributeDefault = rlSetVertexAttributeDefault + +function rlDrawVertexArray(offset, count) { + return r.BindrlDrawVertexArray( + offset, + count + ) +} +raylib.rlDrawVertexArray = rlDrawVertexArray + +function rlDrawVertexArrayElements(offset, count, buffer) { + return r.BindrlDrawVertexArrayElements( + offset, + count, + buffer + ) +} +raylib.rlDrawVertexArrayElements = rlDrawVertexArrayElements + +function rlDrawVertexArrayInstanced(offset, count, instances) { + return r.BindrlDrawVertexArrayInstanced( + offset, + count, + instances + ) +} +raylib.rlDrawVertexArrayInstanced = rlDrawVertexArrayInstanced + +function rlDrawVertexArrayElementsInstanced(offset, count, buffer, instances) { + return r.BindrlDrawVertexArrayElementsInstanced( + offset, + count, + buffer, + instances + ) +} +raylib.rlDrawVertexArrayElementsInstanced = rlDrawVertexArrayElementsInstanced + +/** + * Load texture in GPU + * + * @param {number} data + * @param {number} width + * @param {number} height + * @param {number} format + * @param {number} mipmapCount + * + * @return {number} The resulting unsigned int. + */ +function rlLoadTexture(data, width, height, format, mipmapCount) { + return r.BindrlLoadTexture( + data, + width, + height, + format, + mipmapCount + ) +} +raylib.rlLoadTexture = rlLoadTexture + +/** + * Load depth texture/renderbuffer (to be attached to fbo) + * + * @param {number} width + * @param {number} height + * @param {boolean} useRenderBuffer + * + * @return {number} The resulting unsigned int. + */ +function rlLoadTextureDepth(width, height, useRenderBuffer) { + return r.BindrlLoadTextureDepth( + width, + height, + useRenderBuffer + ) +} +raylib.rlLoadTextureDepth = rlLoadTextureDepth + +/** + * Load texture cubemap + * + * @param {number} data + * @param {number} size + * @param {number} format + * + * @return {number} The resulting unsigned int. + */ +function rlLoadTextureCubemap(data, size, format) { + return r.BindrlLoadTextureCubemap( + data, + size, + format + ) +} +raylib.rlLoadTextureCubemap = rlLoadTextureCubemap + +/** + * Update GPU texture with new data + * + * @param {number} id + * @param {number} offsetX + * @param {number} offsetY + * @param {number} width + * @param {number} height + * @param {number} format + * @param {number} data + * + * @return {undefined} + */ +function rlUpdateTexture(id, offsetX, offsetY, width, height, format, data) { + return r.BindrlUpdateTexture( + id, + offsetX, + offsetY, + width, + height, + format, + data + ) +} +raylib.rlUpdateTexture = rlUpdateTexture + +/** + * Get OpenGL internal formats + * + * @param {number} format + * @param {number} glInternalFormat + * @param {number} glFormat + * @param {number} glType + * + * @return {undefined} + */ +function rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType) { + return r.BindrlGetGlTextureFormats( + format, + glInternalFormat, + glFormat, + glType + ) +} +raylib.rlGetGlTextureFormats = rlGetGlTextureFormats + +/** + * Get name string for pixel format + * + * @param {number} format + * + * @return {string} The resulting const char *. + */ +function rlGetPixelFormatName(format) { + return r.BindrlGetPixelFormatName( + format + ) +} +raylib.rlGetPixelFormatName = rlGetPixelFormatName + +/** + * Unload texture from GPU memory + * + * @param {number} id + * + * @return {undefined} + */ +function rlUnloadTexture(id) { + return r.BindrlUnloadTexture( + id + ) +} +raylib.rlUnloadTexture = rlUnloadTexture + +/** + * Generate mipmap data for selected texture + * + * @param {number} id + * @param {number} width + * @param {number} height + * @param {number} format + * @param {number} mipmaps + * + * @return {undefined} + */ +function rlGenTextureMipmaps(id, width, height, format, mipmaps) { + return r.BindrlGenTextureMipmaps( + id, + width, + height, + format, + mipmaps + ) +} +raylib.rlGenTextureMipmaps = rlGenTextureMipmaps + +/** + * Read texture pixel data + * + * @param {number} id + * @param {number} width + * @param {number} height + * @param {number} format + * + * @return {number} The resulting void *. + */ +function rlReadTexturePixels(id, width, height, format) { + return r.BindrlReadTexturePixels( + id, + width, + height, + format + ) +} +raylib.rlReadTexturePixels = rlReadTexturePixels + +/** + * Read screen pixel data (color buffer) + * + * @param {number} width + * @param {number} height + * + * @return {Buffer} The resulting unsigned char *. + */ +function rlReadScreenPixels(width, height) { + return r.BindrlReadScreenPixels( + width, + height + ) +} +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 + ) +} +raylib.rlLoadFramebuffer = rlLoadFramebuffer + +/** + * Attach texture/renderbuffer to a framebuffer + * + * @param {number} fboId + * @param {number} texId + * @param {number} attachType + * @param {number} texType + * @param {number} mipLevel + * + * @return {undefined} + */ +function rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel) { + return r.BindrlFramebufferAttach( + fboId, + texId, + attachType, + texType, + mipLevel + ) +} +raylib.rlFramebufferAttach = rlFramebufferAttach + +/** + * Verify framebuffer is complete + * + * @param {number} id + * + * @return {boolean} The resulting bool. + */ +function rlFramebufferComplete(id) { + return r.BindrlFramebufferComplete( + id + ) +} +raylib.rlFramebufferComplete = rlFramebufferComplete + +/** + * Delete framebuffer from GPU + * + * @param {number} id + * + * @return {undefined} + */ +function rlUnloadFramebuffer(id) { + return r.BindrlUnloadFramebuffer( + id + ) +} +raylib.rlUnloadFramebuffer = rlUnloadFramebuffer + +/** + * Load shader from code strings + * + * @param {string} vsCode + * @param {string} fsCode + * + * @return {number} The resulting unsigned int. + */ +function rlLoadShaderCode(vsCode, fsCode) { + return r.BindrlLoadShaderCode( + vsCode, + fsCode + ) +} +raylib.rlLoadShaderCode = rlLoadShaderCode + +/** + * Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER) + * + * @param {string} shaderCode + * @param {number} type + * + * @return {number} The resulting unsigned int. + */ +function rlCompileShader(shaderCode, type) { + return r.BindrlCompileShader( + shaderCode, + type + ) +} +raylib.rlCompileShader = rlCompileShader + +/** + * Load custom shader program + * + * @param {number} vShaderId + * @param {number} fShaderId + * + * @return {number} The resulting unsigned int. + */ +function rlLoadShaderProgram(vShaderId, fShaderId) { + return r.BindrlLoadShaderProgram( + vShaderId, + fShaderId + ) +} +raylib.rlLoadShaderProgram = rlLoadShaderProgram + +/** + * Unload shader program + * + * @param {number} id + * + * @return {undefined} + */ +function rlUnloadShaderProgram(id) { + return r.BindrlUnloadShaderProgram( + id + ) +} +raylib.rlUnloadShaderProgram = rlUnloadShaderProgram + +/** + * Get shader location uniform + * + * @param {number} shaderId + * @param {string} uniformName + * + * @return {number} The resulting int. + */ +function rlGetLocationUniform(shaderId, uniformName) { + return r.BindrlGetLocationUniform( + shaderId, + uniformName + ) +} +raylib.rlGetLocationUniform = rlGetLocationUniform + +/** + * Get shader location attribute + * + * @param {number} shaderId + * @param {string} attribName + * + * @return {number} The resulting int. + */ +function rlGetLocationAttrib(shaderId, attribName) { + return r.BindrlGetLocationAttrib( + shaderId, + attribName + ) +} +raylib.rlGetLocationAttrib = rlGetLocationAttrib + +/** + * Set shader value uniform + * + * @param {number} locIndex + * @param {number} value + * @param {number} uniformType + * @param {number} count + * + * @return {undefined} + */ +function rlSetUniform(locIndex, value, uniformType, count) { + return r.BindrlSetUniform( + locIndex, + value, + uniformType, + count + ) +} +raylib.rlSetUniform = rlSetUniform + +/** + * Set shader value matrix + * + * @param {number} locIndex + * @param {Matrix} mat + * + * @return {undefined} + */ +function rlSetUniformMatrix(locIndex, mat) { + return r.BindrlSetUniformMatrix( + locIndex, + 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.rlSetUniformMatrix = rlSetUniformMatrix + +/** + * Set shader value sampler + * + * @param {number} locIndex + * @param {number} textureId + * + * @return {undefined} + */ +function rlSetUniformSampler(locIndex, textureId) { + return r.BindrlSetUniformSampler( + locIndex, + textureId + ) +} +raylib.rlSetUniformSampler = rlSetUniformSampler + +/** + * Set shader currently active (id and locations) + * + * @param {number} id + * @param {number} locs + * + * @return {undefined} + */ +function rlSetShader(id, locs) { + return r.BindrlSetShader( + id, + locs + ) +} +raylib.rlSetShader = rlSetShader + +/** + * Load compute shader program + * + * @param {number} shaderId + * + * @return {number} The resulting unsigned int. + */ +function rlLoadComputeShaderProgram(shaderId) { + return r.BindrlLoadComputeShaderProgram( + shaderId + ) +} +raylib.rlLoadComputeShaderProgram = rlLoadComputeShaderProgram + +/** + * Dispatch compute shader (equivalent to *draw* for graphics pilepine) + * + * @param {number} groupX + * @param {number} groupY + * @param {number} groupZ + * + * @return {undefined} + */ +function rlComputeShaderDispatch(groupX, groupY, groupZ) { + return r.BindrlComputeShaderDispatch( + groupX, + groupY, + groupZ + ) +} +raylib.rlComputeShaderDispatch = rlComputeShaderDispatch + +/** + * Load shader storage buffer object (SSBO) + * + * @param {BigInt} size + * @param {number} data + * @param {number} usageHint + * + * @return {number} The resulting unsigned int. + */ +function rlLoadShaderBuffer(size, data, usageHint) { + return r.BindrlLoadShaderBuffer( + size, + data, + usageHint + ) +} +raylib.rlLoadShaderBuffer = rlLoadShaderBuffer + +/** + * Unload shader storage buffer object (SSBO) + * + * @param {number} ssboId + * + * @return {undefined} + */ +function rlUnloadShaderBuffer(ssboId) { + return r.BindrlUnloadShaderBuffer( + ssboId + ) +} +raylib.rlUnloadShaderBuffer = rlUnloadShaderBuffer + +/** + * Update SSBO buffer data + * + * @param {number} id + * @param {number} data + * @param {BigInt} dataSize + * @param {BigInt} offset + * + * @return {undefined} + */ +function rlUpdateShaderBufferElements(id, data, dataSize, offset) { + return r.BindrlUpdateShaderBufferElements( + id, + data, + dataSize, + offset + ) +} +raylib.rlUpdateShaderBufferElements = rlUpdateShaderBufferElements + +/** + * Get SSBO buffer size + * + * @param {number} id + * + * @return {BigInt} The resulting unsigned long long. + */ +function rlGetShaderBufferSize(id) { + return r.BindrlGetShaderBufferSize( + id + ) +} +raylib.rlGetShaderBufferSize = rlGetShaderBufferSize + +/** + * Bind SSBO buffer + * + * @param {number} id + * @param {number} dest + * @param {BigInt} count + * @param {BigInt} offset + * + * @return {undefined} + */ +function rlReadShaderBufferElements(id, dest, count, offset) { + return r.BindrlReadShaderBufferElements( + id, + dest, + count, + offset + ) +} +raylib.rlReadShaderBufferElements = rlReadShaderBufferElements + +/** + * Copy SSBO buffer data + * + * @param {number} id + * @param {number} index + * + * @return {undefined} + */ +function rlBindShaderBuffer(id, index) { + return r.BindrlBindShaderBuffer( + id, + index + ) +} +raylib.rlBindShaderBuffer = rlBindShaderBuffer + +/** + * Copy SSBO buffer data + * + * @param {number} destId + * @param {number} srcId + * @param {BigInt} destOffset + * @param {BigInt} srcOffset + * @param {BigInt} count + * + * @return {undefined} + */ +function rlCopyBuffersElements(destId, srcId, destOffset, srcOffset, count) { + return r.BindrlCopyBuffersElements( + destId, + srcId, + destOffset, + srcOffset, + count + ) +} +raylib.rlCopyBuffersElements = rlCopyBuffersElements + +/** + * Bind image texture + * + * @param {number} id + * @param {number} index + * @param {number} format + * @param {number} readonly + * + * @return {undefined} + */ +function rlBindImageTexture(id, index, format, readonly) { + return r.BindrlBindImageTexture( + id, + index, + format, + readonly + ) +} +raylib.rlBindImageTexture = rlBindImageTexture + +/** + * Get internal modelview matrix + * + * @return {Matrix} The resulting Matrix. + */ +function rlGetMatrixModelview() { + return r.BindrlGetMatrixModelview() +} +raylib.rlGetMatrixModelview = rlGetMatrixModelview + +/** + * Get internal projection matrix + * + * @return {Matrix} The resulting Matrix. + */ +function rlGetMatrixProjection() { + return r.BindrlGetMatrixProjection() +} +raylib.rlGetMatrixProjection = rlGetMatrixProjection + +/** + * Get internal accumulated transform matrix + * + * @return {Matrix} The resulting Matrix. + */ +function rlGetMatrixTransform() { + return r.BindrlGetMatrixTransform() +} +raylib.rlGetMatrixTransform = rlGetMatrixTransform + +/** + * Get internal projection matrix for stereo render (selected eye) + * + * @param {number} eye + * + * @return {Matrix} The resulting Matrix. + */ +function rlGetMatrixProjectionStereo(eye) { + return r.BindrlGetMatrixProjectionStereo( + eye + ) +} +raylib.rlGetMatrixProjectionStereo = rlGetMatrixProjectionStereo + +/** + * Get internal view offset matrix for stereo render (selected eye) + * + * @param {number} eye + * + * @return {Matrix} The resulting Matrix. + */ +function rlGetMatrixViewOffsetStereo(eye) { + return r.BindrlGetMatrixViewOffsetStereo( + eye + ) +} +raylib.rlGetMatrixViewOffsetStereo = rlGetMatrixViewOffsetStereo + +/** + * Set a custom projection matrix (replaces internal projection matrix) + * + * @param {Matrix} proj + * + * @return {undefined} + */ +function rlSetMatrixProjection(proj) { + return r.BindrlSetMatrixProjection( + proj.m0, + proj.m4, + proj.m8, + proj.m12, + proj.m1, + proj.m5, + proj.m9, + proj.m13, + proj.m2, + proj.m6, + proj.m10, + proj.m14, + proj.m3, + proj.m7, + proj.m11, + proj.m15 + ) +} +raylib.rlSetMatrixProjection = rlSetMatrixProjection + +/** + * Set a custom modelview matrix (replaces internal modelview matrix) + * + * @param {Matrix} view + * + * @return {undefined} + */ +function rlSetMatrixModelview(view) { + return r.BindrlSetMatrixModelview( + 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.rlSetMatrixModelview = rlSetMatrixModelview + +/** + * Set eyes projection matrices for stereo rendering + * + * @param {Matrix} right + * @param {Matrix} left + * + * @return {undefined} + */ +function rlSetMatrixProjectionStereo(right, left) { + return r.BindrlSetMatrixProjectionStereo( + right.m0, + right.m4, + right.m8, + right.m12, + right.m1, + right.m5, + right.m9, + right.m13, + right.m2, + right.m6, + right.m10, + right.m14, + right.m3, + right.m7, + right.m11, + right.m15, + left.m0, + left.m4, + left.m8, + left.m12, + left.m1, + left.m5, + left.m9, + left.m13, + left.m2, + left.m6, + left.m10, + left.m14, + left.m3, + left.m7, + left.m11, + left.m15 + ) +} +raylib.rlSetMatrixProjectionStereo = rlSetMatrixProjectionStereo + +/** + * Set eyes view offsets matrices for stereo rendering + * + * @param {Matrix} right + * @param {Matrix} left + * + * @return {undefined} + */ +function rlSetMatrixViewOffsetStereo(right, left) { + return r.BindrlSetMatrixViewOffsetStereo( + right.m0, + right.m4, + right.m8, + right.m12, + right.m1, + right.m5, + right.m9, + right.m13, + right.m2, + right.m6, + right.m10, + right.m14, + right.m3, + right.m7, + right.m11, + right.m15, + left.m0, + left.m4, + left.m8, + left.m12, + left.m1, + left.m5, + left.m9, + left.m13, + left.m2, + left.m6, + left.m10, + left.m14, + left.m3, + left.m7, + left.m11, + left.m15 + ) +} +raylib.rlSetMatrixViewOffsetStereo = rlSetMatrixViewOffsetStereo + +/** + * Load and draw a cube + * + * @return {undefined} + */ +function rlLoadDrawCube() { + return r.BindrlLoadDrawCube() +} +raylib.rlLoadDrawCube = rlLoadDrawCube + +/** + * Load and draw a quad + * + * @return {undefined} + */ +function rlLoadDrawQuad() { + return r.BindrlLoadDrawQuad() +} +raylib.rlLoadDrawQuad = rlLoadDrawQuad + +/** + * Update camera position for selected mode + * + * @param {Camera} camera + * + * @return {undefined} + */ +function UpdateCamera(camera) { + const obj = r.BindUpdateCamera( + camera.position.x, + camera.position.y, + camera.position.z, + camera.target.x, + camera.target.y, + camera.target.z, + camera.up.x, + camera.up.y, + camera.up.z, + camera.fovy, + camera.projection + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + camera[key] = obj[key] + } + } +} +raylib.UpdateCamera = UpdateCamera + +/** + * Convert image data to desired format + * + * @param {Image} image + * @param {number} newFormat + * + * @return {undefined} + */ +function ImageFormat(image, newFormat) { + const obj = r.BindImageFormat( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + newFormat + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageFormat = ImageFormat + +/** + * Convert image to POT (power-of-two) + * + * @param {Image} image + * @param {Color} fill + * + * @return {undefined} + */ +function ImageToPOT(image, fill) { + const obj = r.BindImageToPOT( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + fill.r, + fill.g, + fill.b, + fill.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageToPOT = ImageToPOT + +/** + * Crop an image to a defined rectangle + * + * @param {Image} image + * @param {Rectangle} crop + * + * @return {undefined} + */ +function ImageCrop(image, crop) { + const obj = r.BindImageCrop( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + crop.x, + crop.y, + crop.width, + crop.height + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageCrop = ImageCrop + +/** + * Crop image depending on alpha value + * + * @param {Image} image + * @param {number} threshold + * + * @return {undefined} + */ +function ImageAlphaCrop(image, threshold) { + const obj = r.BindImageAlphaCrop( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + threshold + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageAlphaCrop = ImageAlphaCrop + +/** + * Clear alpha channel to desired color + * + * @param {Image} image + * @param {Color} color + * @param {number} threshold + * + * @return {undefined} + */ +function ImageAlphaClear(image, color, threshold) { + const obj = r.BindImageAlphaClear( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + color.r, + color.g, + color.b, + color.a, + threshold + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageAlphaClear = ImageAlphaClear + +/** + * Apply alpha mask to image + * + * @param {Image} image + * @param {Image} alphaMask + * + * @return {undefined} + */ +function ImageAlphaMask(image, alphaMask) { + const obj = r.BindImageAlphaMask( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + alphaMask.data, + alphaMask.width, + alphaMask.height, + alphaMask.mipmaps, + alphaMask.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageAlphaMask = ImageAlphaMask + +/** + * Premultiply alpha channel + * + * @param {Image} image + * + * @return {undefined} + */ +function ImageAlphaPremultiply(image) { + const obj = r.BindImageAlphaPremultiply( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageAlphaPremultiply = ImageAlphaPremultiply + +/** + * Resize image (Bicubic scaling algorithm) + * + * @param {Image} image + * @param {number} newWidth + * @param {number} newHeight + * + * @return {undefined} + */ +function ImageResize(image, newWidth, newHeight) { + const obj = r.BindImageResize( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + newWidth, + newHeight + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageResize = ImageResize + +/** + * Resize image (Nearest-Neighbor scaling algorithm) + * + * @param {Image} image + * @param {number} newWidth + * @param {number} newHeight + * + * @return {undefined} + */ +function ImageResizeNN(image, newWidth, newHeight) { + const obj = r.BindImageResizeNN( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + newWidth, + newHeight + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageResizeNN = ImageResizeNN + +/** + * Resize canvas and fill with color + * + * @param {Image} image + * @param {number} newWidth + * @param {number} newHeight + * @param {number} offsetX + * @param {number} offsetY + * @param {Color} fill + * + * @return {undefined} + */ +function ImageResizeCanvas(image, newWidth, newHeight, offsetX, offsetY, fill) { + const obj = r.BindImageResizeCanvas( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + newWidth, + newHeight, + offsetX, + offsetY, + fill.r, + fill.g, + fill.b, + fill.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageResizeCanvas = ImageResizeCanvas + +/** + * Compute all mipmap levels for a provided image + * + * @param {Image} image + * + * @return {undefined} + */ +function ImageMipmaps(image) { + const obj = r.BindImageMipmaps( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageMipmaps = ImageMipmaps + +/** + * Dither image data to 16bpp or lower (Floyd-Steinberg dithering) + * + * @param {Image} image + * @param {number} rBpp + * @param {number} gBpp + * @param {number} bBpp + * @param {number} aBpp + * + * @return {undefined} + */ +function ImageDither(image, rBpp, gBpp, bBpp, aBpp) { + const obj = r.BindImageDither( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + rBpp, + gBpp, + bBpp, + aBpp + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageDither = ImageDither + +/** + * Flip image vertically + * + * @param {Image} image + * + * @return {undefined} + */ +function ImageFlipVertical(image) { + const obj = r.BindImageFlipVertical( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageFlipVertical = ImageFlipVertical + +/** + * Flip image horizontally + * + * @param {Image} image + * + * @return {undefined} + */ +function ImageFlipHorizontal(image) { + const obj = r.BindImageFlipHorizontal( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageFlipHorizontal = ImageFlipHorizontal + +/** + * Rotate image clockwise 90deg + * + * @param {Image} image + * + * @return {undefined} + */ +function ImageRotateCW(image) { + const obj = r.BindImageRotateCW( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageRotateCW = ImageRotateCW + +/** + * Rotate image counter-clockwise 90deg + * + * @param {Image} image + * + * @return {undefined} + */ +function ImageRotateCCW(image) { + const obj = r.BindImageRotateCCW( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageRotateCCW = ImageRotateCCW + +/** + * Modify image color: tint + * + * @param {Image} image + * @param {Color} color + * + * @return {undefined} + */ +function ImageColorTint(image, color) { + const obj = r.BindImageColorTint( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageColorTint = ImageColorTint + +/** + * Modify image color: invert + * + * @param {Image} image + * + * @return {undefined} + */ +function ImageColorInvert(image) { + const obj = r.BindImageColorInvert( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageColorInvert = ImageColorInvert + +/** + * Modify image color: grayscale + * + * @param {Image} image + * + * @return {undefined} + */ +function ImageColorGrayscale(image) { + const obj = r.BindImageColorGrayscale( + image.data, + image.width, + image.height, + image.mipmaps, + image.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageColorGrayscale = ImageColorGrayscale + +/** + * Modify image color: contrast (-100 to 100) + * + * @param {Image} image + * @param {number} contrast + * + * @return {undefined} + */ +function ImageColorContrast(image, contrast) { + const obj = r.BindImageColorContrast( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + contrast + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageColorContrast = ImageColorContrast + +/** + * Modify image color: brightness (-255 to 255) + * + * @param {Image} image + * @param {number} brightness + * + * @return {undefined} + */ +function ImageColorBrightness(image, brightness) { + const obj = r.BindImageColorBrightness( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + brightness + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageColorBrightness = ImageColorBrightness + +/** + * Modify image color: replace color + * + * @param {Image} image + * @param {Color} color + * @param {Color} replace + * + * @return {undefined} + */ +function ImageColorReplace(image, color, replace) { + const obj = r.BindImageColorReplace( + image.data, + image.width, + image.height, + image.mipmaps, + image.format, + color.r, + color.g, + color.b, + color.a, + replace.r, + replace.g, + replace.b, + replace.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + image[key] = obj[key] + } + } +} +raylib.ImageColorReplace = ImageColorReplace + +/** + * Clear image background with given color + * + * @param {Image} dst + * @param {Color} color + * + * @return {undefined} + */ +function ImageClearBackground(dst, color) { + const obj = r.BindImageClearBackground( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageClearBackground = ImageClearBackground + +/** + * Draw pixel within an image + * + * @param {Image} dst + * @param {number} posX + * @param {number} posY + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawPixel(dst, posX, posY, color) { + const obj = r.BindImageDrawPixel( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + posX, + posY, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawPixel = ImageDrawPixel + +/** + * Draw pixel within an image (Vector version) + * + * @param {Image} dst + * @param {Vector2} position + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawPixelV(dst, position, color) { + const obj = r.BindImageDrawPixelV( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + position.x, + position.y, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawPixelV = ImageDrawPixelV + +/** + * Draw line within an image + * + * @param {Image} dst + * @param {number} startPosX + * @param {number} startPosY + * @param {number} endPosX + * @param {number} endPosY + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawLine(dst, startPosX, startPosY, endPosX, endPosY, color) { + const obj = r.BindImageDrawLine( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + startPosX, + startPosY, + endPosX, + endPosY, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawLine = ImageDrawLine + +/** + * Draw line within an image (Vector version) + * + * @param {Image} dst + * @param {Vector2} start + * @param {Vector2} end + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawLineV(dst, start, end, color) { + const obj = r.BindImageDrawLineV( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + start.x, + start.y, + end.x, + end.y, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawLineV = ImageDrawLineV + +/** + * Draw circle within an image + * + * @param {Image} dst + * @param {number} centerX + * @param {number} centerY + * @param {number} radius + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawCircle(dst, centerX, centerY, radius, color) { + const obj = r.BindImageDrawCircle( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + centerX, + centerY, + radius, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawCircle = ImageDrawCircle + +/** + * Draw circle within an image (Vector version) + * + * @param {Image} dst + * @param {Vector2} center + * @param {number} radius + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawCircleV(dst, center, radius, color) { + const obj = r.BindImageDrawCircleV( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + center.x, + center.y, + radius, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawCircleV = ImageDrawCircleV + +/** + * Draw rectangle within an image + * + * @param {Image} dst + * @param {number} posX + * @param {number} posY + * @param {number} width + * @param {number} height + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawRectangle(dst, posX, posY, width, height, color) { + const obj = r.BindImageDrawRectangle( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + posX, + posY, + width, + height, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawRectangle = ImageDrawRectangle + +/** + * Draw rectangle within an image (Vector version) + * + * @param {Image} dst + * @param {Vector2} position + * @param {Vector2} size + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawRectangleV(dst, position, size, color) { + const obj = r.BindImageDrawRectangleV( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + position.x, + position.y, + size.x, + size.y, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawRectangleV = ImageDrawRectangleV + +/** + * Draw rectangle within an image + * + * @param {Image} dst + * @param {Rectangle} rec + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawRectangleRec(dst, rec, color) { + const obj = r.BindImageDrawRectangleRec( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + rec.x, + rec.y, + rec.width, + rec.height, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawRectangleRec = ImageDrawRectangleRec + +/** + * Draw rectangle lines within an image + * + * @param {Image} dst + * @param {Rectangle} rec + * @param {number} thick + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawRectangleLines(dst, rec, thick, color) { + const obj = r.BindImageDrawRectangleLines( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + rec.x, + rec.y, + rec.width, + rec.height, + thick, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawRectangleLines = ImageDrawRectangleLines + +/** + * Draw a source image within a destination image (tint applied to source) + * + * @param {Image} dst + * @param {Image} src + * @param {Rectangle} srcRec + * @param {Rectangle} dstRec + * @param {Color} tint + * + * @return {undefined} + */ +function ImageDraw(dst, src, srcRec, dstRec, tint) { + const obj = r.BindImageDraw( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + src.data, + src.width, + src.height, + src.mipmaps, + src.format, + srcRec.x, + srcRec.y, + srcRec.width, + srcRec.height, + dstRec.x, + dstRec.y, + dstRec.width, + dstRec.height, + tint.r, + tint.g, + tint.b, + tint.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDraw = ImageDraw + +/** + * Draw text (using default font) within an image (destination) + * + * @param {Image} dst + * @param {string} text + * @param {number} posX + * @param {number} posY + * @param {number} fontSize + * @param {Color} color + * + * @return {undefined} + */ +function ImageDrawText(dst, text, posX, posY, fontSize, color) { + const obj = r.BindImageDrawText( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + text, + posX, + posY, + fontSize, + color.r, + color.g, + color.b, + color.a + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawText = ImageDrawText + +/** + * Draw text (custom sprite font) within an image (destination) + * + * @param {Image} dst + * @param {Font} font + * @param {string} text + * @param {Vector2} position + * @param {number} fontSize + * @param {number} spacing + * @param {Color} tint + * + * @return {undefined} + */ +function ImageDrawTextEx(dst, font, text, position, fontSize, spacing, tint) { + const obj = r.BindImageDrawTextEx( + dst.data, + dst.width, + dst.height, + dst.mipmaps, + dst.format, + 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 + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + dst[key] = obj[key] + } + } +} +raylib.ImageDrawTextEx = ImageDrawTextEx + +/** + * Generate GPU mipmaps for a texture + * + * @param {Texture2D} texture + * + * @return {undefined} + */ +function GenTextureMipmaps(texture) { + const obj = r.BindGenTextureMipmaps( + texture.id, + texture.width, + texture.height, + texture.mipmaps, + texture.format + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + texture[key] = obj[key] + } + } +} +raylib.GenTextureMipmaps = GenTextureMipmaps + +/** + * Upload mesh vertex data in GPU and provide VAO/VBO ids + * + * @param {Mesh} mesh + * @param {boolean} dynamic + * + * @return {undefined} + */ +function UploadMesh(mesh, dynamic) { + const obj = r.BindUploadMesh( + 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, + dynamic + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + mesh[key] = obj[key] + } + } +} +raylib.UploadMesh = UploadMesh + +/** + * Compute mesh tangents + * + * @param {Mesh} mesh + * + * @return {undefined} + */ +function GenMeshTangents(mesh) { + const obj = r.BindGenMeshTangents( + 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 + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + mesh[key] = obj[key] + } + } +} +raylib.GenMeshTangents = GenMeshTangents + +/** + * Set material for a mesh + * + * @param {Model} model + * @param {number} meshId + * @param {number} materialId + * + * @return {undefined} + */ +function SetModelMeshMaterial(model, meshId, materialId) { + const obj = r.BindSetModelMeshMaterial( + 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, + meshId, + materialId + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + model[key] = obj[key] + } + } +} +raylib.SetModelMeshMaterial = SetModelMeshMaterial + +/** + * Crop a wave to defined samples range + * + * @param {Wave} wave + * @param {number} initSample + * @param {number} finalSample + * + * @return {undefined} + */ +function WaveCrop(wave, initSample, finalSample) { + const obj = r.BindWaveCrop( + wave.frameCount, + wave.sampleRate, + wave.sampleSize, + wave.channels, + wave.data, + initSample, + finalSample + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + wave[key] = obj[key] + } + } +} +raylib.WaveCrop = WaveCrop + +/** + * Convert wave data to desired format + * + * @param {Wave} wave + * @param {number} sampleRate + * @param {number} sampleSize + * @param {number} channels + * + * @return {undefined} + */ +function WaveFormat(wave, sampleRate, sampleSize, channels) { + const obj = r.BindWaveFormat( + wave.frameCount, + wave.sampleRate, + wave.sampleSize, + wave.channels, + wave.data, + sampleRate, + sampleSize, + channels + ) + if (typeof obj !== 'undefined') { + for (const key in obj) { + wave[key] = obj[key] + } + } +} +raylib.WaveFormat = WaveFormat + +/** + * Color, 4 components, R8G8B8A8 (32bit) + * + * @param {number} r - Color red value + * @param {number} g - Color green value + * @param {number} b - Color blue value + * @param {number} a - Color alpha value + * + * @return {Color} The new Color. + */ +function Color(r,g,b,a) { + return {r,g,b,a} +} +raylib.Color = Color + +/** + * Vector2, 2 components + * + * @param {number} x - Vector x component + * @param {number} y - Vector y component + * + * @return {Vector2} The new Vector2. + */ +function Vector2(x,y) { + return {x,y} +} +raylib.Vector2 = Vector2 + +/** + * Vector3, 3 components + * + * @param {number} x - Vector x component + * @param {number} y - Vector y component + * @param {number} z - Vector z component + * + * @return {Vector3} The new Vector3. + */ +function Vector3(x,y,z) { + return {x,y,z} +} +raylib.Vector3 = Vector3 + +/** + * Vector4, 4 components + * + * @param {number} x - Vector x component + * @param {number} y - Vector y component + * @param {number} z - Vector z component + * @param {number} w - Vector w component + * + * @return {Vector4} The new Vector4. + */ +function Vector4(x,y,z,w) { + return {x,y,z,w} +} +raylib.Vector4 = Vector4 + +/** + * Rectangle, 4 components + * + * @param {number} x - Rectangle top-left corner position x + * @param {number} y - Rectangle top-left corner position y + * @param {number} width - Rectangle width + * @param {number} height - Rectangle height + * + * @return {Rectangle} The new Rectangle. + */ +function Rectangle(x,y,width,height) { + return {x,y,width,height} +} +raylib.Rectangle = Rectangle + +/** + * Camera2D, defines position/orientation in 2d space + * + * @param {Vector2} offset - Camera offset (displacement from target) + * @param {Vector2} target - Camera target (rotation and zoom origin) + * @param {number} rotation - Camera rotation in degrees + * @param {number} zoom - Camera zoom (scaling), should be 1.0f by default + * + * @return {Camera2D} The new Camera2D. + */ +function Camera2D(offset,target,rotation,zoom) { + return {offset,target,rotation,zoom} +} +raylib.Camera2D = Camera2D + +/** + * Camera, defines position/orientation in 3d space + * + * @param {Vector3} position - Camera position + * @param {Vector3} target - Camera target it looks-at + * @param {Vector3} up - Camera up vector (rotation over its axis) + * @param {number} fovy - Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic + * @param {number} projection - Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC + * + * @return {Camera3D} The new Camera3D. + */ +function Camera3D(position,target,up,fovy,projection) { + return {position,target,up,fovy,projection} +} +raylib.Camera3D = Camera3D +raylib.Camera = raylib.Camera3D + +// WRAPPED TYPED SHADER FUNCTIONS + +/** + * Set shader uniform value float + * + * @param {Shader} shader + * @param {number} locIndex + * @param {number} value + * + * @returns {undefined} + */ +function SetShaderFloat(shader, locIndex, value) { + return r.BindSetShaderFloat( + shader.id, + shader.locs, + locIndex, + value + ) +} +raylib.SetShaderFloat = SetShaderFloat + +/** + * Set shader uniform value float + * + * @param {Shader} shader + * @param {number} locIndex + * @param {number} value + * + * @returns {undefined} + */ +function SetShaderInt(shader, locIndex, value) { + return r.BindSetShaderInt( + shader.id, + shader.locs, + locIndex, + value + ) +} +raylib.SetShaderInt = SetShaderInt + +/** + * Set shader uniform value vector2 + * + * @param {Shader} shader + * @param {number} locIndex + * @param {Vector2} value + * + * @returns {undefined} + */ +function SetShaderVec2(shader, locIndex, value) { + return r.BindSetShaderVec2( + shader.id, + shader.locs, + locIndex, + value.x, + value.y + ) +} +raylib.SetShaderVec2 = SetShaderVec2 + +/** + * Set shader uniform value vector3 + * + * @param {Shader} shader + * @param {number} locIndex + * @param {Vector3} value + * + * @returns {undefined} + */ +function SetShaderVec3(shader, locIndex, value) { + return r.BindSetShaderVec3( + shader.id, + shader.locs, + locIndex, + value.x, + value.y, + value.z + ) +} +raylib.SetShaderVec3 = SetShaderVec3 + +/** + * Set shader uniform value vector4 + * + * @param {Shader} shader + * @param {number} locIndex + * @param {Vector4} value + * + * @returns {undefined} + */ +function SetShaderVec4(shader, locIndex, value) { + return r.BindSetShaderVec4( + shader.id, + shader.locs, + locIndex, + value.x, + value.y, + value.z, + value.w + ) +} +raylib.SetShaderVec4 = SetShaderVec4 + +/** + * Set to try enabling V-Sync on GPU + * + * @type {number} + * @constant + */ +raylib.FLAG_VSYNC_HINT = 64 + +/** + * Set to run program in fullscreen + * + * @type {number} + * @constant + */ +raylib.FLAG_FULLSCREEN_MODE = 2 + +/** + * Set to allow resizable window + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_RESIZABLE = 4 + +/** + * Set to disable window decoration (frame and buttons) + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_UNDECORATED = 8 + +/** + * Set to hide window + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_HIDDEN = 128 + +/** + * Set to minimize window (iconify) + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_MINIMIZED = 512 + +/** + * Set to maximize window (expanded to monitor) + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_MAXIMIZED = 1024 + +/** + * Set to window non focused + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_UNFOCUSED = 2048 + +/** + * Set to window always on top + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_TOPMOST = 4096 + +/** + * Set to allow windows running while minimized + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_ALWAYS_RUN = 256 + +/** + * Set to allow transparent framebuffer + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_TRANSPARENT = 16 + +/** + * Set to support HighDPI + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_HIGHDPI = 8192 + +/** + * Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED + * + * @type {number} + * @constant + */ +raylib.FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384 + +/** + * Set to try enabling MSAA 4X + * + * @type {number} + * @constant + */ +raylib.FLAG_MSAA_4X_HINT = 32 + +/** + * Set to try enabling interlaced video format (for V3D) + * + * @type {number} + * @constant + */ +raylib.FLAG_INTERLACED_HINT = 65536 + +/** + * Display all logs + * + * @type {number} + * @constant + */ +raylib.LOG_ALL = 0 + +/** + * Trace logging, intended for internal use only + * + * @type {number} + * @constant + */ +raylib.LOG_TRACE = 1 + +/** + * Debug logging, used for internal debugging, it should be disabled on release builds + * + * @type {number} + * @constant + */ +raylib.LOG_DEBUG = 2 + +/** + * Info logging, used for program execution info + * + * @type {number} + * @constant + */ +raylib.LOG_INFO = 3 + +/** + * Warning logging, used on recoverable failures + * + * @type {number} + * @constant + */ +raylib.LOG_WARNING = 4 + +/** + * Error logging, used on unrecoverable failures + * + * @type {number} + * @constant + */ +raylib.LOG_ERROR = 5 + +/** + * Fatal logging, used to abort program: exit(EXIT_FAILURE) + * + * @type {number} + * @constant + */ +raylib.LOG_FATAL = 6 + +/** + * Disable logging + * + * @type {number} + * @constant + */ +raylib.LOG_NONE = 7 + +/** + * Key: NULL, used for no key pressed + * + * @type {number} + * @constant + */ +raylib.KEY_NULL = 0 + +/** + * Key: ' + * + * @type {number} + * @constant + */ +raylib.KEY_APOSTROPHE = 39 + +/** + * Key: , + * + * @type {number} + * @constant + */ +raylib.KEY_COMMA = 44 + +/** + * Key: - + * + * @type {number} + * @constant + */ +raylib.KEY_MINUS = 45 + +/** + * Key: . + * + * @type {number} + * @constant + */ +raylib.KEY_PERIOD = 46 + +/** + * Key: / + * + * @type {number} + * @constant + */ +raylib.KEY_SLASH = 47 + +/** + * Key: 0 + * + * @type {number} + * @constant + */ +raylib.KEY_ZERO = 48 + +/** + * Key: 1 + * + * @type {number} + * @constant + */ +raylib.KEY_ONE = 49 + +/** + * Key: 2 + * + * @type {number} + * @constant + */ +raylib.KEY_TWO = 50 + +/** + * Key: 3 + * + * @type {number} + * @constant + */ +raylib.KEY_THREE = 51 + +/** + * Key: 4 + * + * @type {number} + * @constant + */ +raylib.KEY_FOUR = 52 + +/** + * Key: 5 + * + * @type {number} + * @constant + */ +raylib.KEY_FIVE = 53 + +/** + * Key: 6 + * + * @type {number} + * @constant + */ +raylib.KEY_SIX = 54 + +/** + * Key: 7 + * + * @type {number} + * @constant + */ +raylib.KEY_SEVEN = 55 + +/** + * Key: 8 + * + * @type {number} + * @constant + */ +raylib.KEY_EIGHT = 56 + +/** + * Key: 9 + * + * @type {number} + * @constant + */ +raylib.KEY_NINE = 57 + +/** + * Key: ; + * + * @type {number} + * @constant + */ +raylib.KEY_SEMICOLON = 59 + +/** + * Key: = + * + * @type {number} + * @constant + */ +raylib.KEY_EQUAL = 61 + +/** + * Key: A | a + * + * @type {number} + * @constant + */ +raylib.KEY_A = 65 + +/** + * Key: B | b + * + * @type {number} + * @constant + */ +raylib.KEY_B = 66 + +/** + * Key: C | c + * + * @type {number} + * @constant + */ +raylib.KEY_C = 67 + +/** + * Key: D | d + * + * @type {number} + * @constant + */ +raylib.KEY_D = 68 + +/** + * Key: E | e + * + * @type {number} + * @constant + */ +raylib.KEY_E = 69 + +/** + * Key: F | f + * + * @type {number} + * @constant + */ +raylib.KEY_F = 70 + +/** + * Key: G | g + * + * @type {number} + * @constant + */ +raylib.KEY_G = 71 + +/** + * Key: H | h + * + * @type {number} + * @constant + */ +raylib.KEY_H = 72 + +/** + * Key: I | i + * + * @type {number} + * @constant + */ +raylib.KEY_I = 73 + +/** + * Key: J | j + * + * @type {number} + * @constant + */ +raylib.KEY_J = 74 + +/** + * Key: K | k + * + * @type {number} + * @constant + */ +raylib.KEY_K = 75 + +/** + * Key: L | l + * + * @type {number} + * @constant + */ +raylib.KEY_L = 76 + +/** + * Key: M | m + * + * @type {number} + * @constant + */ +raylib.KEY_M = 77 + +/** + * Key: N | n + * + * @type {number} + * @constant + */ +raylib.KEY_N = 78 + +/** + * Key: O | o + * + * @type {number} + * @constant + */ +raylib.KEY_O = 79 + +/** + * Key: P | p + * + * @type {number} + * @constant + */ +raylib.KEY_P = 80 + +/** + * Key: Q | q + * + * @type {number} + * @constant + */ +raylib.KEY_Q = 81 + +/** + * Key: R | r + * + * @type {number} + * @constant + */ +raylib.KEY_R = 82 + +/** + * Key: S | s + * + * @type {number} + * @constant + */ +raylib.KEY_S = 83 + +/** + * Key: T | t + * + * @type {number} + * @constant + */ +raylib.KEY_T = 84 + +/** + * Key: U | u + * + * @type {number} + * @constant + */ +raylib.KEY_U = 85 + +/** + * Key: V | v + * + * @type {number} + * @constant + */ +raylib.KEY_V = 86 + +/** + * Key: W | w + * + * @type {number} + * @constant + */ +raylib.KEY_W = 87 + +/** + * Key: X | x + * + * @type {number} + * @constant + */ +raylib.KEY_X = 88 + +/** + * Key: Y | y + * + * @type {number} + * @constant + */ +raylib.KEY_Y = 89 + +/** + * Key: Z | z + * + * @type {number} + * @constant + */ +raylib.KEY_Z = 90 + +/** + * Key: [ + * + * @type {number} + * @constant + */ +raylib.KEY_LEFT_BRACKET = 91 + +/** + * Key: '\' + * + * @type {number} + * @constant + */ +raylib.KEY_BACKSLASH = 92 + +/** + * Key: ] + * + * @type {number} + * @constant + */ +raylib.KEY_RIGHT_BRACKET = 93 + +/** + * Key: ` + * + * @type {number} + * @constant + */ +raylib.KEY_GRAVE = 96 + +/** + * Key: Space + * + * @type {number} + * @constant + */ +raylib.KEY_SPACE = 32 + +/** + * Key: Esc + * + * @type {number} + * @constant + */ +raylib.KEY_ESCAPE = 256 + +/** + * Key: Enter + * + * @type {number} + * @constant + */ +raylib.KEY_ENTER = 257 + +/** + * Key: Tab + * + * @type {number} + * @constant + */ +raylib.KEY_TAB = 258 + +/** + * Key: Backspace + * + * @type {number} + * @constant + */ +raylib.KEY_BACKSPACE = 259 + +/** + * Key: Ins + * + * @type {number} + * @constant + */ +raylib.KEY_INSERT = 260 + +/** + * Key: Del + * + * @type {number} + * @constant + */ +raylib.KEY_DELETE = 261 + +/** + * Key: Cursor right + * + * @type {number} + * @constant + */ +raylib.KEY_RIGHT = 262 + +/** + * Key: Cursor left + * + * @type {number} + * @constant + */ +raylib.KEY_LEFT = 263 + +/** + * Key: Cursor down + * + * @type {number} + * @constant + */ +raylib.KEY_DOWN = 264 + +/** + * Key: Cursor up + * + * @type {number} + * @constant + */ +raylib.KEY_UP = 265 + +/** + * Key: Page up + * + * @type {number} + * @constant + */ +raylib.KEY_PAGE_UP = 266 + +/** + * Key: Page down + * + * @type {number} + * @constant + */ +raylib.KEY_PAGE_DOWN = 267 + +/** + * Key: Home + * + * @type {number} + * @constant + */ +raylib.KEY_HOME = 268 + +/** + * Key: End + * + * @type {number} + * @constant + */ +raylib.KEY_END = 269 + +/** + * Key: Caps lock + * + * @type {number} + * @constant + */ +raylib.KEY_CAPS_LOCK = 280 + +/** + * Key: Scroll down + * + * @type {number} + * @constant + */ +raylib.KEY_SCROLL_LOCK = 281 + +/** + * Key: Num lock + * + * @type {number} + * @constant + */ +raylib.KEY_NUM_LOCK = 282 + +/** + * Key: Print screen + * + * @type {number} + * @constant + */ +raylib.KEY_PRINT_SCREEN = 283 + +/** + * Key: Pause + * + * @type {number} + * @constant + */ +raylib.KEY_PAUSE = 284 + +/** + * Key: F1 + * + * @type {number} + * @constant + */ +raylib.KEY_F1 = 290 + +/** + * Key: F2 + * + * @type {number} + * @constant + */ +raylib.KEY_F2 = 291 + +/** + * Key: F3 + * + * @type {number} + * @constant + */ +raylib.KEY_F3 = 292 + +/** + * Key: F4 + * + * @type {number} + * @constant + */ +raylib.KEY_F4 = 293 + +/** + * Key: F5 + * + * @type {number} + * @constant + */ +raylib.KEY_F5 = 294 + +/** + * Key: F6 + * + * @type {number} + * @constant + */ +raylib.KEY_F6 = 295 + +/** + * Key: F7 + * + * @type {number} + * @constant + */ +raylib.KEY_F7 = 296 + +/** + * Key: F8 + * + * @type {number} + * @constant + */ +raylib.KEY_F8 = 297 + +/** + * Key: F9 + * + * @type {number} + * @constant + */ +raylib.KEY_F9 = 298 + +/** + * Key: F10 + * + * @type {number} + * @constant + */ +raylib.KEY_F10 = 299 + +/** + * Key: F11 + * + * @type {number} + * @constant + */ +raylib.KEY_F11 = 300 + +/** + * Key: F12 + * + * @type {number} + * @constant + */ +raylib.KEY_F12 = 301 + +/** + * Key: Shift left + * + * @type {number} + * @constant + */ +raylib.KEY_LEFT_SHIFT = 340 + +/** + * Key: Control left + * + * @type {number} + * @constant + */ +raylib.KEY_LEFT_CONTROL = 341 + +/** + * Key: Alt left + * + * @type {number} + * @constant + */ +raylib.KEY_LEFT_ALT = 342 + +/** + * Key: Super left + * + * @type {number} + * @constant + */ +raylib.KEY_LEFT_SUPER = 343 + +/** + * Key: Shift right + * + * @type {number} + * @constant + */ +raylib.KEY_RIGHT_SHIFT = 344 + +/** + * Key: Control right + * + * @type {number} + * @constant + */ +raylib.KEY_RIGHT_CONTROL = 345 + +/** + * Key: Alt right + * + * @type {number} + * @constant + */ +raylib.KEY_RIGHT_ALT = 346 + +/** + * Key: Super right + * + * @type {number} + * @constant + */ +raylib.KEY_RIGHT_SUPER = 347 + +/** + * Key: KB menu + * + * @type {number} + * @constant + */ +raylib.KEY_KB_MENU = 348 + +/** + * Key: Keypad 0 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_0 = 320 + +/** + * Key: Keypad 1 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_1 = 321 + +/** + * Key: Keypad 2 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_2 = 322 + +/** + * Key: Keypad 3 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_3 = 323 + +/** + * Key: Keypad 4 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_4 = 324 + +/** + * Key: Keypad 5 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_5 = 325 + +/** + * Key: Keypad 6 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_6 = 326 + +/** + * Key: Keypad 7 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_7 = 327 + +/** + * Key: Keypad 8 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_8 = 328 + +/** + * Key: Keypad 9 + * + * @type {number} + * @constant + */ +raylib.KEY_KP_9 = 329 + +/** + * Key: Keypad . + * + * @type {number} + * @constant + */ +raylib.KEY_KP_DECIMAL = 330 + +/** + * Key: Keypad / + * + * @type {number} + * @constant + */ +raylib.KEY_KP_DIVIDE = 331 + +/** + * Key: Keypad * + * + * @type {number} + * @constant + */ +raylib.KEY_KP_MULTIPLY = 332 + +/** + * Key: Keypad - + * + * @type {number} + * @constant + */ +raylib.KEY_KP_SUBTRACT = 333 + +/** + * Key: Keypad + + * + * @type {number} + * @constant + */ +raylib.KEY_KP_ADD = 334 + +/** + * Key: Keypad Enter + * + * @type {number} + * @constant + */ +raylib.KEY_KP_ENTER = 335 + +/** + * Key: Keypad = + * + * @type {number} + * @constant + */ +raylib.KEY_KP_EQUAL = 336 + +/** + * Key: Android back button + * + * @type {number} + * @constant + */ +raylib.KEY_BACK = 4 + +/** + * Key: Android menu button + * + * @type {number} + * @constant + */ +raylib.KEY_MENU = 82 + +/** + * Key: Android volume up button + * + * @type {number} + * @constant + */ +raylib.KEY_VOLUME_UP = 24 + +/** + * Key: Android volume down button + * + * @type {number} + * @constant + */ +raylib.KEY_VOLUME_DOWN = 25 + +/** + * Mouse button left + * + * @type {number} + * @constant + */ +raylib.MOUSE_BUTTON_LEFT = 0 + +/** + * Mouse button right + * + * @type {number} + * @constant + */ +raylib.MOUSE_BUTTON_RIGHT = 1 + +/** + * Mouse button middle (pressed wheel) + * + * @type {number} + * @constant + */ +raylib.MOUSE_BUTTON_MIDDLE = 2 + +/** + * Mouse button side (advanced mouse device) + * + * @type {number} + * @constant + */ +raylib.MOUSE_BUTTON_SIDE = 3 + +/** + * Mouse button extra (advanced mouse device) + * + * @type {number} + * @constant + */ +raylib.MOUSE_BUTTON_EXTRA = 4 + +/** + * Mouse button fordward (advanced mouse device) + * + * @type {number} + * @constant + */ +raylib.MOUSE_BUTTON_FORWARD = 5 + +/** + * Mouse button back (advanced mouse device) + * + * @type {number} + * @constant + */ +raylib.MOUSE_BUTTON_BACK = 6 + +/** + * Default pointer shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_DEFAULT = 0 + +/** + * Arrow shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_ARROW = 1 + +/** + * Text writing cursor shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_IBEAM = 2 + +/** + * Cross shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_CROSSHAIR = 3 + +/** + * Pointing hand cursor + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_POINTING_HAND = 4 + +/** + * Horizontal resize/move arrow shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_RESIZE_EW = 5 + +/** + * Vertical resize/move arrow shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_RESIZE_NS = 6 + +/** + * Top-left to bottom-right diagonal resize/move arrow shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_RESIZE_NWSE = 7 + +/** + * The top-right to bottom-left diagonal resize/move arrow shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_RESIZE_NESW = 8 + +/** + * The omni-directional resize/move cursor shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_RESIZE_ALL = 9 + +/** + * The operation-not-allowed shape + * + * @type {number} + * @constant + */ +raylib.MOUSE_CURSOR_NOT_ALLOWED = 10 + +/** + * Unknown button, just for error checking + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_UNKNOWN = 0 + +/** + * Gamepad left DPAD up button + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_LEFT_FACE_UP = 1 + +/** + * Gamepad left DPAD right button + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2 + +/** + * Gamepad left DPAD down button + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3 + +/** + * Gamepad left DPAD left button + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4 + +/** + * Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_RIGHT_FACE_UP = 5 + +/** + * Gamepad right button right (i.e. PS3: Square, Xbox: X) + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6 + +/** + * Gamepad right button down (i.e. PS3: Cross, Xbox: A) + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7 + +/** + * Gamepad right button left (i.e. PS3: Circle, Xbox: B) + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8 + +/** + * Gamepad top/back trigger left (first), it could be a trailing button + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9 + +/** + * Gamepad top/back trigger left (second), it could be a trailing button + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10 + +/** + * Gamepad top/back trigger right (one), it could be a trailing button + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11 + +/** + * Gamepad top/back trigger right (second), it could be a trailing button + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12 + +/** + * Gamepad center buttons, left one (i.e. PS3: Select) + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_MIDDLE_LEFT = 13 + +/** + * Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX) + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_MIDDLE = 14 + +/** + * Gamepad center buttons, right one (i.e. PS3: Start) + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_MIDDLE_RIGHT = 15 + +/** + * Gamepad joystick pressed button left + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_LEFT_THUMB = 16 + +/** + * Gamepad joystick pressed button right + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_BUTTON_RIGHT_THUMB = 17 + +/** + * Gamepad left stick X axis + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_AXIS_LEFT_X = 0 + +/** + * Gamepad left stick Y axis + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_AXIS_LEFT_Y = 1 + +/** + * Gamepad right stick X axis + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_AXIS_RIGHT_X = 2 + +/** + * Gamepad right stick Y axis + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_AXIS_RIGHT_Y = 3 + +/** + * Gamepad back trigger left, pressure level: [1..-1] + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_AXIS_LEFT_TRIGGER = 4 + +/** + * Gamepad back trigger right, pressure level: [1..-1] + * + * @type {number} + * @constant + */ +raylib.GAMEPAD_AXIS_RIGHT_TRIGGER = 5 + +/** + * Albedo material (same as: MATERIAL_MAP_DIFFUSE) + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_ALBEDO = 0 + +/** + * Metalness material (same as: MATERIAL_MAP_SPECULAR) + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_METALNESS = 1 + +/** + * Normal material + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_NORMAL = 2 + +/** + * Roughness material + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_ROUGHNESS = 3 + +/** + * Ambient occlusion material + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_OCCLUSION = 4 + +/** + * Emission material + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_EMISSION = 5 + +/** + * Heightmap material + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_HEIGHT = 6 + +/** + * Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_CUBEMAP = 7 + +/** + * Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_IRRADIANCE = 8 + +/** + * Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_PREFILTER = 9 + +/** + * Brdf material + * + * @type {number} + * @constant + */ +raylib.MATERIAL_MAP_BRDF = 10 + +/** + * Shader location: vertex attribute: position + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_VERTEX_POSITION = 0 + +/** + * Shader location: vertex attribute: texcoord01 + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_VERTEX_TEXCOORD01 = 1 + +/** + * Shader location: vertex attribute: texcoord02 + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_VERTEX_TEXCOORD02 = 2 + +/** + * Shader location: vertex attribute: normal + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_VERTEX_NORMAL = 3 + +/** + * Shader location: vertex attribute: tangent + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_VERTEX_TANGENT = 4 + +/** + * Shader location: vertex attribute: color + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_VERTEX_COLOR = 5 + +/** + * Shader location: matrix uniform: model-view-projection + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MATRIX_MVP = 6 + +/** + * Shader location: matrix uniform: view (camera transform) + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MATRIX_VIEW = 7 + +/** + * Shader location: matrix uniform: projection + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MATRIX_PROJECTION = 8 + +/** + * Shader location: matrix uniform: model (transform) + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MATRIX_MODEL = 9 + +/** + * Shader location: matrix uniform: normal + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MATRIX_NORMAL = 10 + +/** + * Shader location: vector uniform: view + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_VECTOR_VIEW = 11 + +/** + * Shader location: vector uniform: diffuse color + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_COLOR_DIFFUSE = 12 + +/** + * Shader location: vector uniform: specular color + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_COLOR_SPECULAR = 13 + +/** + * Shader location: vector uniform: ambient color + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_COLOR_AMBIENT = 14 + +/** + * Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE) + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_ALBEDO = 15 + +/** + * Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR) + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_METALNESS = 16 + +/** + * Shader location: sampler2d texture: normal + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_NORMAL = 17 + +/** + * Shader location: sampler2d texture: roughness + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_ROUGHNESS = 18 + +/** + * Shader location: sampler2d texture: occlusion + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_OCCLUSION = 19 + +/** + * Shader location: sampler2d texture: emission + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_EMISSION = 20 + +/** + * Shader location: sampler2d texture: height + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_HEIGHT = 21 + +/** + * Shader location: samplerCube texture: cubemap + * + * @type {number} + * @constant + */ +raylib.SHADER_LOC_MAP_CUBEMAP = 22 + +/** + * 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 uniform type: float + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_FLOAT = 0 + +/** + * Shader uniform type: vec2 (2 float) + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_VEC2 = 1 + +/** + * Shader uniform type: vec3 (3 float) + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_VEC3 = 2 + +/** + * Shader uniform type: vec4 (4 float) + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_VEC4 = 3 + +/** + * Shader uniform type: int + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_INT = 4 + +/** + * Shader uniform type: ivec2 (2 int) + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_IVEC2 = 5 + +/** + * Shader uniform type: ivec3 (3 int) + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_IVEC3 = 6 + +/** + * Shader uniform type: ivec4 (4 int) + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_IVEC4 = 7 + +/** + * Shader uniform type: sampler2d + * + * @type {number} + * @constant + */ +raylib.SHADER_UNIFORM_SAMPLER2D = 8 + +/** + * Shader attribute type: float + * + * @type {number} + * @constant + */ +raylib.SHADER_ATTRIB_FLOAT = 0 + +/** + * Shader attribute type: vec2 (2 float) + * + * @type {number} + * @constant + */ +raylib.SHADER_ATTRIB_VEC2 = 1 + +/** + * Shader attribute type: vec3 (3 float) + * + * @type {number} + * @constant + */ +raylib.SHADER_ATTRIB_VEC3 = 2 + +/** + * Shader attribute type: vec4 (4 float) + * + * @type {number} + * @constant + */ +raylib.SHADER_ATTRIB_VEC4 = 3 + +/** + * 8 bit per pixel (no alpha) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1 + +/** + * 8*2 bpp (2 channels) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2 + +/** + * 16 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3 + +/** + * 24 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4 + +/** + * 16 bpp (1 bit alpha) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5 + +/** + * 16 bpp (4 bit alpha) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6 + +/** + * 32 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7 + +/** + * 32 bpp (1 channel - float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R32 = 8 + +/** + * 32*3 bpp (3 channels - float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 + +/** + * 32*4 bpp (4 channels - float) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 + +/** + * 4 bpp (no alpha) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 + +/** + * 4 bpp (1 bit alpha) + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 + +/** + * 8 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 + +/** + * 8 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 + +/** + * 4 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 + +/** + * 4 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 + +/** + * 8 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 + +/** + * 4 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 + +/** + * 4 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 + +/** + * 8 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 + +/** + * 2 bpp + * + * @type {number} + * @constant + */ +raylib.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 + +/** + * No filter, just pixel approximation + * + * @type {number} + * @constant + */ +raylib.TEXTURE_FILTER_POINT = 0 + +/** + * Linear filtering + * + * @type {number} + * @constant + */ +raylib.TEXTURE_FILTER_BILINEAR = 1 + +/** + * Trilinear filtering (linear with mipmaps) + * + * @type {number} + * @constant + */ +raylib.TEXTURE_FILTER_TRILINEAR = 2 + +/** + * Anisotropic filtering 4x + * + * @type {number} + * @constant + */ +raylib.TEXTURE_FILTER_ANISOTROPIC_4X = 3 + +/** + * Anisotropic filtering 8x + * + * @type {number} + * @constant + */ +raylib.TEXTURE_FILTER_ANISOTROPIC_8X = 4 + +/** + * Anisotropic filtering 16x + * + * @type {number} + * @constant + */ +raylib.TEXTURE_FILTER_ANISOTROPIC_16X = 5 + +/** + * Repeats texture in tiled mode + * + * @type {number} + * @constant + */ +raylib.TEXTURE_WRAP_REPEAT = 0 + +/** + * Clamps texture to edge pixel in tiled mode + * + * @type {number} + * @constant + */ +raylib.TEXTURE_WRAP_CLAMP = 1 + +/** + * Mirrors and repeats the texture in tiled mode + * + * @type {number} + * @constant + */ +raylib.TEXTURE_WRAP_MIRROR_REPEAT = 2 + +/** + * Mirrors and clamps to border the texture in tiled mode + * + * @type {number} + * @constant + */ +raylib.TEXTURE_WRAP_MIRROR_CLAMP = 3 + +/** + * Automatically detect layout type + * + * @type {number} + * @constant + */ +raylib.CUBEMAP_LAYOUT_AUTO_DETECT = 0 + +/** + * Layout is defined by a vertical line with faces + * + * @type {number} + * @constant + */ +raylib.CUBEMAP_LAYOUT_LINE_VERTICAL = 1 + +/** + * Layout is defined by an horizontal line with faces + * + * @type {number} + * @constant + */ +raylib.CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2 + +/** + * Layout is defined by a 3x4 cross with cubemap faces + * + * @type {number} + * @constant + */ +raylib.CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 + +/** + * Layout is defined by a 4x3 cross with cubemap faces + * + * @type {number} + * @constant + */ +raylib.CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 + +/** + * Layout is defined by a panorama image (equirectangular map) + * + * @type {number} + * @constant + */ +raylib.CUBEMAP_LAYOUT_PANORAMA = 5 + +/** + * Default font generation, anti-aliased + * + * @type {number} + * @constant + */ +raylib.FONT_DEFAULT = 0 + +/** + * Bitmap font generation, no anti-aliasing + * + * @type {number} + * @constant + */ +raylib.FONT_BITMAP = 1 + +/** + * SDF font generation, requires external shader + * + * @type {number} + * @constant + */ +raylib.FONT_SDF = 2 + +/** + * Blend textures considering alpha (default) + * + * @type {number} + * @constant + */ +raylib.BLEND_ALPHA = 0 + +/** + * Blend textures adding colors + * + * @type {number} + * @constant + */ +raylib.BLEND_ADDITIVE = 1 + +/** + * Blend textures multiplying colors + * + * @type {number} + * @constant + */ +raylib.BLEND_MULTIPLIED = 2 + +/** + * Blend textures adding colors (alternative) + * + * @type {number} + * @constant + */ +raylib.BLEND_ADD_COLORS = 3 + +/** + * Blend textures subtracting colors (alternative) + * + * @type {number} + * @constant + */ +raylib.BLEND_SUBTRACT_COLORS = 4 + +/** + * Blend premultiplied textures considering alpha + * + * @type {number} + * @constant + */ +raylib.BLEND_ALPHA_PREMULTIPLY = 5 + +/** + * Blend textures using custom src/dst factors (use rlSetBlendMode()) + * + * @type {number} + * @constant + */ +raylib.BLEND_CUSTOM = 6 + +/** + * No gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_NONE = 0 + +/** + * Tap gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_TAP = 1 + +/** + * Double tap gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_DOUBLETAP = 2 + +/** + * Hold gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_HOLD = 4 + +/** + * Drag gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_DRAG = 8 + +/** + * Swipe right gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_SWIPE_RIGHT = 16 + +/** + * Swipe left gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_SWIPE_LEFT = 32 + +/** + * Swipe up gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_SWIPE_UP = 64 + +/** + * Swipe down gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_SWIPE_DOWN = 128 + +/** + * Pinch in gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_PINCH_IN = 256 + +/** + * Pinch out gesture + * + * @type {number} + * @constant + */ +raylib.GESTURE_PINCH_OUT = 512 + +/** + * Custom camera + * + * @type {number} + * @constant + */ +raylib.CAMERA_CUSTOM = 0 + +/** + * Free camera + * + * @type {number} + * @constant + */ +raylib.CAMERA_FREE = 1 + +/** + * Orbital camera + * + * @type {number} + * @constant + */ +raylib.CAMERA_ORBITAL = 2 + +/** + * First person camera + * + * @type {number} + * @constant + */ +raylib.CAMERA_FIRST_PERSON = 3 + +/** + * Third person camera + * + * @type {number} + * @constant + */ +raylib.CAMERA_THIRD_PERSON = 4 + +/** + * Perspective projection + * + * @type {number} + * @constant + */ +raylib.CAMERA_PERSPECTIVE = 0 + +/** + * Orthographic projection + * + * @type {number} + * @constant + */ +raylib.CAMERA_ORTHOGRAPHIC = 1 + +/** + * Npatch layout: 3x3 tiles + * + * @type {number} + * @constant + */ +raylib.NPATCH_NINE_PATCH = 0 + +/** + * Npatch layout: 1x3 tiles + * + * @type {number} + * @constant + */ +raylib.NPATCH_THREE_PATCH_VERTICAL = 1 + +/** + * Npatch layout: 3x1 tiles + * + * @type {number} + * @constant + */ +raylib.NPATCH_THREE_PATCH_HORIZONTAL = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.STATE_NORMAL = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.STATE_FOCUSED = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.STATE_PRESSED = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.STATE_DISABLED = 3 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_LEFT = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_CENTER = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGN_RIGHT = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.DEFAULT = 0 + +/** + * Used also for: LABELBUTTON + * + * @type {number} + * @constant + */ +raylib.LABEL = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BUTTON = 2 + +/** + * Used also for: TOGGLEGROUP + * + * @type {number} + * @constant + */ +raylib.TOGGLE = 3 + +/** + * Used also for: SLIDERBAR + * + * @type {number} + * @constant + */ +raylib.SLIDER = 4 + +/** + * + * + * @type {number} + * @constant + */ +raylib.PROGRESSBAR = 5 + +/** + * + * + * @type {number} + * @constant + */ +raylib.CHECKBOX = 6 + +/** + * + * + * @type {number} + * @constant + */ +raylib.COMBOBOX = 7 + +/** + * + * + * @type {number} + * @constant + */ +raylib.DROPDOWNBOX = 8 + +/** + * Used also for: TEXTBOXMULTI + * + * @type {number} + * @constant + */ +raylib.TEXTBOX = 9 + +/** + * + * + * @type {number} + * @constant + */ +raylib.VALUEBOX = 10 + +/** + * Uses: BUTTON, VALUEBOX + * + * @type {number} + * @constant + */ +raylib.SPINNER = 11 + +/** + * + * + * @type {number} + * @constant + */ +raylib.LISTVIEW = 12 + +/** + * + * + * @type {number} + * @constant + */ +raylib.COLORPICKER = 13 + +/** + * + * + * @type {number} + * @constant + */ +raylib.SCROLLBAR = 14 + +/** + * + * + * @type {number} + * @constant + */ +raylib.STATUSBAR = 15 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BORDER_COLOR_NORMAL = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BASE_COLOR_NORMAL = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_COLOR_NORMAL = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BORDER_COLOR_FOCUSED = 3 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BASE_COLOR_FOCUSED = 4 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_COLOR_FOCUSED = 5 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BORDER_COLOR_PRESSED = 6 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BASE_COLOR_PRESSED = 7 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_COLOR_PRESSED = 8 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BORDER_COLOR_DISABLED = 9 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BASE_COLOR_DISABLED = 10 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_COLOR_DISABLED = 11 + +/** + * + * + * @type {number} + * @constant + */ +raylib.BORDER_WIDTH = 12 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_PADDING = 13 + +/** + * + * + * @type {number} + * @constant + */ +raylib.TEXT_ALIGNMENT = 14 + +/** + * + * + * @type {number} + * @constant + */ +raylib.RESERVED = 15 + +/** + * Text size (glyphs max height) + * + * @type {number} + * @constant + */ +raylib.TEXT_SIZE = 16 + +/** + * Text spacing between glyphs + * + * @type {number} + * @constant + */ +raylib.TEXT_SPACING = 17 + +/** + * Line control color + * + * @type {number} + * @constant + */ +raylib.LINE_COLOR = 18 + +/** + * Background color + * + * @type {number} + * @constant + */ +raylib.BACKGROUND_COLOR = 19 + +/** + * ToggleGroup separation between toggles + * + * @type {number} + * @constant + */ +raylib.GROUP_PADDING = 16 + +/** + * Slider size of internal bar + * + * @type {number} + * @constant + */ +raylib.SLIDER_WIDTH = 16 + +/** + * Slider/SliderBar internal bar padding + * + * @type {number} + * @constant + */ +raylib.SLIDER_PADDING = 17 + +/** + * ProgressBar internal padding + * + * @type {number} + * @constant + */ +raylib.PROGRESS_PADDING = 16 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ARROWS_SIZE = 16 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ARROWS_VISIBLE = 17 + +/** + * (SLIDERBAR, SLIDER_PADDING) + * + * @type {number} + * @constant + */ +raylib.SCROLL_SLIDER_PADDING = 18 + +/** + * + * + * @type {number} + * @constant + */ +raylib.SCROLL_SLIDER_SIZE = 19 + +/** + * + * + * @type {number} + * @constant + */ +raylib.SCROLL_PADDING = 20 + +/** + * + * + * @type {number} + * @constant + */ +raylib.SCROLL_SPEED = 21 + +/** + * CheckBox internal check padding + * + * @type {number} + * @constant + */ +raylib.CHECK_PADDING = 16 + +/** + * ComboBox right button width + * + * @type {number} + * @constant + */ +raylib.COMBO_BUTTON_WIDTH = 16 + +/** + * ComboBox button separation + * + * @type {number} + * @constant + */ +raylib.COMBO_BUTTON_SPACING = 17 + +/** + * DropdownBox arrow separation from border and items + * + * @type {number} + * @constant + */ +raylib.ARROW_PADDING = 16 + +/** + * DropdownBox items separation + * + * @type {number} + * @constant + */ +raylib.DROPDOWN_ITEMS_SPACING = 17 + +/** + * TextBox/TextBoxMulti/ValueBox/Spinner inner text padding + * + * @type {number} + * @constant + */ +raylib.TEXT_INNER_PADDING = 16 + +/** + * TextBoxMulti lines separation + * + * @type {number} + * @constant + */ +raylib.TEXT_LINES_SPACING = 17 + +/** + * Spinner left/right buttons width + * + * @type {number} + * @constant + */ +raylib.SPIN_BUTTON_WIDTH = 16 + +/** + * Spinner buttons separation + * + * @type {number} + * @constant + */ +raylib.SPIN_BUTTON_SPACING = 17 + +/** + * ListView items height + * + * @type {number} + * @constant + */ +raylib.LIST_ITEMS_HEIGHT = 16 + +/** + * ListView items separation + * + * @type {number} + * @constant + */ +raylib.LIST_ITEMS_SPACING = 17 + +/** + * ListView scrollbar size (usually width) + * + * @type {number} + * @constant + */ +raylib.SCROLLBAR_WIDTH = 18 + +/** + * ListView scrollbar side (0-left, 1-right) + * + * @type {number} + * @constant + */ +raylib.SCROLLBAR_SIDE = 19 + +/** + * + * + * @type {number} + * @constant + */ +raylib.COLOR_SELECTOR_SIZE = 16 + +/** + * ColorPicker right hue bar width + * + * @type {number} + * @constant + */ +raylib.HUEBAR_WIDTH = 17 + +/** + * ColorPicker right hue bar separation from panel + * + * @type {number} + * @constant + */ +raylib.HUEBAR_PADDING = 18 + +/** + * ColorPicker right hue bar selector height + * + * @type {number} + * @constant + */ +raylib.HUEBAR_SELECTOR_HEIGHT = 19 + +/** + * ColorPicker right hue bar selector overflow + * + * @type {number} + * @constant + */ +raylib.HUEBAR_SELECTOR_OVERFLOW = 20 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_NONE = 0 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FOLDER_FILE_OPEN = 1 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FILE_SAVE_CLASSIC = 2 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FOLDER_OPEN = 3 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FOLDER_SAVE = 4 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FILE_OPEN = 5 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FILE_SAVE = 6 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FILE_EXPORT = 7 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FILE_ADD = 8 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FILE_DELETE = 9 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FILETYPE_TEXT = 10 + +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_FILETYPE_AUDIO = 11 /** - * Color, 4 components, R8G8B8A8 (32bit) - * - * @param {number} r - Color red value - * @param {number} g - Color green value - * @param {number} b - Color blue value - * @param {number} a - Color alpha value + * * - * @return {Color} The new Color. + * @type {number} + * @constant */ -function Color(r,g,b,a) { - return {r,g,b,a} -} -raylib.Color = Color +raylib.ICON_FILETYPE_IMAGE = 12 /** - * Vector2, 2 components - * - * @param {number} x - Vector x component - * @param {number} y - Vector y component + * * - * @return {Vector2} The new Vector2. + * @type {number} + * @constant */ -function Vector2(x,y) { - return {x,y} -} -raylib.Vector2 = Vector2 +raylib.ICON_FILETYPE_PLAY = 13 /** - * Vector3, 3 components + * * - * @param {number} x - Vector x component - * @param {number} y - Vector y component - * @param {number} z - Vector z component + * @type {number} + * @constant + */ +raylib.ICON_FILETYPE_VIDEO = 14 + +/** + * * - * @return {Vector3} The new Vector3. + * @type {number} + * @constant */ -function Vector3(x,y,z) { - return {x,y,z} -} -raylib.Vector3 = Vector3 +raylib.ICON_FILETYPE_INFO = 15 /** - * Vector4, 4 components + * * - * @param {number} x - Vector x component - * @param {number} y - Vector y component - * @param {number} z - Vector z component - * @param {number} w - Vector w component + * @type {number} + * @constant + */ +raylib.ICON_FILE_COPY = 16 + +/** + * * - * @return {Vector4} The new Vector4. + * @type {number} + * @constant */ -function Vector4(x,y,z,w) { - return {x,y,z,w} -} -raylib.Vector4 = Vector4 +raylib.ICON_FILE_CUT = 17 /** - * Rectangle, 4 components + * * - * @param {number} x - Rectangle top-left corner position x - * @param {number} y - Rectangle top-left corner position y - * @param {number} width - Rectangle width - * @param {number} height - Rectangle height + * @type {number} + * @constant + */ +raylib.ICON_FILE_PASTE = 18 + +/** + * * - * @return {Rectangle} The new Rectangle. + * @type {number} + * @constant */ -function Rectangle(x,y,width,height) { - return {x,y,width,height} -} -raylib.Rectangle = Rectangle +raylib.ICON_CURSOR_HAND = 19 /** - * Camera2D, defines position/orientation in 2d space + * * - * @param {Vector2} offset - Camera offset (displacement from target) - * @param {Vector2} target - Camera target (rotation and zoom origin) - * @param {number} rotation - Camera rotation in degrees - * @param {number} zoom - Camera zoom (scaling), should be 1.0f by default + * @type {number} + * @constant + */ +raylib.ICON_CURSOR_POINTER = 20 + +/** + * * - * @return {Camera2D} The new Camera2D. + * @type {number} + * @constant */ -function Camera2D(offset,target,rotation,zoom) { - return {offset,target,rotation,zoom} -} -raylib.Camera2D = Camera2D +raylib.ICON_CURSOR_CLASSIC = 21 /** - * Camera, defines position/orientation in 3d space + * * - * @param {Vector3} position - Camera position - * @param {Vector3} target - Camera target it looks-at - * @param {Vector3} up - Camera up vector (rotation over its axis) - * @param {number} fovy - Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic - * @param {number} projection - Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC + * @type {number} + * @constant + */ +raylib.ICON_PENCIL = 22 + +/** + * * - * @return {Camera3D} The new Camera3D. + * @type {number} + * @constant */ -function Camera3D(position,target,up,fovy,projection) { - return {position,target,up,fovy,projection} -} -raylib.Camera3D = Camera3D -raylib.Camera = raylib.Camera3D +raylib.ICON_PENCIL_BIG = 23 -// WRAPPED TYPED SHADER FUNCTIONS +/** + * + * + * @type {number} + * @constant + */ +raylib.ICON_BRUSH_CLASSIC = 24 /** - * Set shader uniform value float * - * @param {Shader} shader - * @param {number} locIndex - * @param {number} value + * + * @type {number} + * @constant + */ +raylib.ICON_BRUSH_PAINTER = 25 + +/** * - * @returns {undefined} + * + * @type {number} + * @constant */ -function SetShaderFloat(shader, locIndex, value) { - return r.BindSetShaderFloat( - shader.id, - shader.locs, - locIndex, - value - ) -} -raylib.SetShaderFloat = SetShaderFloat +raylib.ICON_WATER_DROP = 26 /** - * Set shader uniform value float * - * @param {Shader} shader - * @param {number} locIndex - * @param {number} value + * + * @type {number} + * @constant + */ +raylib.ICON_COLOR_PICKER = 27 + +/** * - * @returns {undefined} + * + * @type {number} + * @constant */ -function SetShaderInt(shader, locIndex, value) { - return r.BindSetShaderInt( - shader.id, - shader.locs, - locIndex, - value - ) -} -raylib.SetShaderInt = SetShaderInt +raylib.ICON_RUBBER = 28 /** - * Set shader uniform value vector2 * - * @param {Shader} shader - * @param {number} locIndex - * @param {Vector2} value + * + * @type {number} + * @constant + */ +raylib.ICON_COLOR_BUCKET = 29 + +/** * - * @returns {undefined} + * + * @type {number} + * @constant */ -function SetShaderVec2(shader, locIndex, value) { - return r.BindSetShaderVec2( - shader.id, - shader.locs, - locIndex, - value.x, - value.y - ) -} -raylib.SetShaderVec2 = SetShaderVec2 +raylib.ICON_TEXT_T = 30 /** - * Set shader uniform value vector3 * - * @param {Shader} shader - * @param {number} locIndex - * @param {Vector3} value + * + * @type {number} + * @constant + */ +raylib.ICON_TEXT_A = 31 + +/** * - * @returns {undefined} + * + * @type {number} + * @constant */ -function SetShaderVec3(shader, locIndex, value) { - return r.BindSetShaderVec3( - shader.id, - shader.locs, - locIndex, - value.x, - value.y, - value.z - ) -} -raylib.SetShaderVec3 = SetShaderVec3 +raylib.ICON_SCALE = 32 /** - * Set shader uniform value vector4 * - * @param {Shader} shader - * @param {number} locIndex - * @param {Vector4} value + * + * @type {number} + * @constant + */ +raylib.ICON_RESIZE = 33 + +/** * - * @returns {undefined} + * + * @type {number} + * @constant */ -function SetShaderVec4(shader, locIndex, value) { - return r.BindSetShaderVec4( - shader.id, - shader.locs, - locIndex, - value.x, - value.y, - value.z, - value.w - ) -} -raylib.SetShaderVec4 = SetShaderVec4 +raylib.ICON_FILTER_POINT = 34 /** - * Set to try enabling V-Sync on GPU + * * * @type {number} * @constant */ -raylib.FLAG_VSYNC_HINT = 64 +raylib.ICON_FILTER_BILINEAR = 35 /** - * Set to run program in fullscreen + * * * @type {number} * @constant */ -raylib.FLAG_FULLSCREEN_MODE = 2 +raylib.ICON_CROP = 36 /** - * Set to allow resizable window + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_RESIZABLE = 4 +raylib.ICON_CROP_ALPHA = 37 /** - * Set to disable window decoration (frame and buttons) + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_UNDECORATED = 8 +raylib.ICON_SQUARE_TOGGLE = 38 /** - * Set to hide window + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_HIDDEN = 128 +raylib.ICON_SYMMETRY = 39 /** - * Set to minimize window (iconify) + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_MINIMIZED = 512 +raylib.ICON_SYMMETRY_HORIZONTAL = 40 /** - * Set to maximize window (expanded to monitor) + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_MAXIMIZED = 1024 +raylib.ICON_SYMMETRY_VERTICAL = 41 /** - * Set to window non focused + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_UNFOCUSED = 2048 +raylib.ICON_LENS = 42 /** - * Set to window always on top + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_TOPMOST = 4096 +raylib.ICON_LENS_BIG = 43 /** - * Set to allow windows running while minimized + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_ALWAYS_RUN = 256 +raylib.ICON_EYE_ON = 44 /** - * Set to allow transparent framebuffer + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_TRANSPARENT = 16 +raylib.ICON_EYE_OFF = 45 /** - * Set to support HighDPI + * * * @type {number} * @constant */ -raylib.FLAG_WINDOW_HIGHDPI = 8192 +raylib.ICON_FILTER_TOP = 46 /** - * Set to try enabling MSAA 4X + * * * @type {number} * @constant */ -raylib.FLAG_MSAA_4X_HINT = 32 +raylib.ICON_FILTER = 47 /** - * Set to try enabling interlaced video format (for V3D) + * * * @type {number} * @constant */ -raylib.FLAG_INTERLACED_HINT = 65536 +raylib.ICON_TARGET_POINT = 48 /** - * Display all logs + * * * @type {number} * @constant */ -raylib.LOG_ALL = 0 +raylib.ICON_TARGET_SMALL = 49 /** - * Trace logging, intended for internal use only + * * * @type {number} * @constant */ -raylib.LOG_TRACE = 1 +raylib.ICON_TARGET_BIG = 50 /** - * Debug logging, used for internal debugging, it should be disabled on release builds + * * * @type {number} * @constant */ -raylib.LOG_DEBUG = 2 +raylib.ICON_TARGET_MOVE = 51 /** - * Info logging, used for program execution info + * * * @type {number} * @constant */ -raylib.LOG_INFO = 3 +raylib.ICON_CURSOR_MOVE = 52 /** - * Warning logging, used on recoverable failures + * * * @type {number} * @constant */ -raylib.LOG_WARNING = 4 +raylib.ICON_CURSOR_SCALE = 53 /** - * Error logging, used on unrecoverable failures + * * * @type {number} * @constant */ -raylib.LOG_ERROR = 5 +raylib.ICON_CURSOR_SCALE_RIGHT = 54 /** - * Fatal logging, used to abort program: exit(EXIT_FAILURE) + * * * @type {number} * @constant */ -raylib.LOG_FATAL = 6 +raylib.ICON_CURSOR_SCALE_LEFT = 55 /** - * Disable logging + * * * @type {number} * @constant */ -raylib.LOG_NONE = 7 +raylib.ICON_UNDO = 56 /** - * Key: NULL, used for no key pressed + * * * @type {number} * @constant */ -raylib.KEY_NULL = 0 +raylib.ICON_REDO = 57 /** - * Key: ' + * * * @type {number} * @constant */ -raylib.KEY_APOSTROPHE = 39 +raylib.ICON_REREDO = 58 /** - * Key: , + * * * @type {number} * @constant */ -raylib.KEY_COMMA = 44 +raylib.ICON_MUTATE = 59 /** - * Key: - + * * * @type {number} * @constant */ -raylib.KEY_MINUS = 45 +raylib.ICON_ROTATE = 60 /** - * Key: . + * * * @type {number} * @constant */ -raylib.KEY_PERIOD = 46 +raylib.ICON_REPEAT = 61 /** - * Key: / + * * * @type {number} * @constant */ -raylib.KEY_SLASH = 47 +raylib.ICON_SHUFFLE = 62 /** - * Key: 0 + * * * @type {number} * @constant */ -raylib.KEY_ZERO = 48 +raylib.ICON_EMPTYBOX = 63 /** - * Key: 1 + * * * @type {number} * @constant */ -raylib.KEY_ONE = 49 +raylib.ICON_TARGET = 64 /** - * Key: 2 + * * * @type {number} * @constant */ -raylib.KEY_TWO = 50 +raylib.ICON_TARGET_SMALL_FILL = 65 /** - * Key: 3 + * * * @type {number} * @constant */ -raylib.KEY_THREE = 51 +raylib.ICON_TARGET_BIG_FILL = 66 /** - * Key: 4 + * * * @type {number} * @constant */ -raylib.KEY_FOUR = 52 +raylib.ICON_TARGET_MOVE_FILL = 67 /** - * Key: 5 + * * * @type {number} * @constant */ -raylib.KEY_FIVE = 53 +raylib.ICON_CURSOR_MOVE_FILL = 68 /** - * Key: 6 + * * * @type {number} * @constant */ -raylib.KEY_SIX = 54 +raylib.ICON_CURSOR_SCALE_FILL = 69 /** - * Key: 7 + * * * @type {number} * @constant */ -raylib.KEY_SEVEN = 55 +raylib.ICON_CURSOR_SCALE_RIGHT_FILL = 70 /** - * Key: 8 + * * * @type {number} * @constant */ -raylib.KEY_EIGHT = 56 +raylib.ICON_CURSOR_SCALE_LEFT_FILL = 71 /** - * Key: 9 + * * * @type {number} * @constant */ -raylib.KEY_NINE = 57 +raylib.ICON_UNDO_FILL = 72 /** - * Key: ; + * * * @type {number} * @constant */ -raylib.KEY_SEMICOLON = 59 +raylib.ICON_REDO_FILL = 73 /** - * Key: = + * * * @type {number} * @constant */ -raylib.KEY_EQUAL = 61 +raylib.ICON_REREDO_FILL = 74 /** - * Key: A | a + * * * @type {number} * @constant */ -raylib.KEY_A = 65 +raylib.ICON_MUTATE_FILL = 75 /** - * Key: B | b + * * * @type {number} * @constant */ -raylib.KEY_B = 66 +raylib.ICON_ROTATE_FILL = 76 /** - * Key: C | c + * * * @type {number} * @constant */ -raylib.KEY_C = 67 +raylib.ICON_REPEAT_FILL = 77 /** - * Key: D | d + * * * @type {number} * @constant */ -raylib.KEY_D = 68 +raylib.ICON_SHUFFLE_FILL = 78 /** - * Key: E | e + * * * @type {number} * @constant */ -raylib.KEY_E = 69 +raylib.ICON_EMPTYBOX_SMALL = 79 /** - * Key: F | f + * * * @type {number} * @constant */ -raylib.KEY_F = 70 +raylib.ICON_BOX = 80 /** - * Key: G | g + * * * @type {number} * @constant */ -raylib.KEY_G = 71 +raylib.ICON_BOX_TOP = 81 /** - * Key: H | h + * * * @type {number} * @constant */ -raylib.KEY_H = 72 +raylib.ICON_BOX_TOP_RIGHT = 82 /** - * Key: I | i + * * * @type {number} * @constant */ -raylib.KEY_I = 73 +raylib.ICON_BOX_RIGHT = 83 /** - * Key: J | j + * * * @type {number} * @constant */ -raylib.KEY_J = 74 +raylib.ICON_BOX_BOTTOM_RIGHT = 84 /** - * Key: K | k + * * * @type {number} * @constant */ -raylib.KEY_K = 75 +raylib.ICON_BOX_BOTTOM = 85 /** - * Key: L | l + * * * @type {number} * @constant */ -raylib.KEY_L = 76 +raylib.ICON_BOX_BOTTOM_LEFT = 86 /** - * Key: M | m + * * * @type {number} * @constant */ -raylib.KEY_M = 77 +raylib.ICON_BOX_LEFT = 87 /** - * Key: N | n + * * * @type {number} * @constant */ -raylib.KEY_N = 78 +raylib.ICON_BOX_TOP_LEFT = 88 /** - * Key: O | o + * * * @type {number} * @constant */ -raylib.KEY_O = 79 +raylib.ICON_BOX_CENTER = 89 /** - * Key: P | p + * * * @type {number} * @constant */ -raylib.KEY_P = 80 +raylib.ICON_BOX_CIRCLE_MASK = 90 /** - * Key: Q | q + * * * @type {number} * @constant */ -raylib.KEY_Q = 81 +raylib.ICON_POT = 91 /** - * Key: R | r + * * * @type {number} * @constant */ -raylib.KEY_R = 82 +raylib.ICON_ALPHA_MULTIPLY = 92 /** - * Key: S | s + * * * @type {number} * @constant */ -raylib.KEY_S = 83 +raylib.ICON_ALPHA_CLEAR = 93 /** - * Key: T | t + * * * @type {number} * @constant */ -raylib.KEY_T = 84 +raylib.ICON_DITHERING = 94 /** - * Key: U | u + * * * @type {number} * @constant */ -raylib.KEY_U = 85 +raylib.ICON_MIPMAPS = 95 /** - * Key: V | v + * * * @type {number} * @constant */ -raylib.KEY_V = 86 +raylib.ICON_BOX_GRID = 96 /** - * Key: W | w + * * * @type {number} * @constant */ -raylib.KEY_W = 87 +raylib.ICON_GRID = 97 /** - * Key: X | x + * * * @type {number} * @constant */ -raylib.KEY_X = 88 +raylib.ICON_BOX_CORNERS_SMALL = 98 /** - * Key: Y | y + * * * @type {number} * @constant */ -raylib.KEY_Y = 89 +raylib.ICON_BOX_CORNERS_BIG = 99 /** - * Key: Z | z + * * * @type {number} * @constant */ -raylib.KEY_Z = 90 +raylib.ICON_FOUR_BOXES = 100 /** - * Key: [ + * * * @type {number} * @constant */ -raylib.KEY_LEFT_BRACKET = 91 +raylib.ICON_GRID_FILL = 101 /** - * Key: '\' + * * * @type {number} * @constant */ -raylib.KEY_BACKSLASH = 92 +raylib.ICON_BOX_MULTISIZE = 102 /** - * Key: ] + * * * @type {number} * @constant */ -raylib.KEY_RIGHT_BRACKET = 93 +raylib.ICON_ZOOM_SMALL = 103 /** - * Key: ` + * * * @type {number} * @constant */ -raylib.KEY_GRAVE = 96 +raylib.ICON_ZOOM_MEDIUM = 104 /** - * Key: Space + * * * @type {number} * @constant */ -raylib.KEY_SPACE = 32 +raylib.ICON_ZOOM_BIG = 105 /** - * Key: Esc + * * * @type {number} * @constant */ -raylib.KEY_ESCAPE = 256 +raylib.ICON_ZOOM_ALL = 106 /** - * Key: Enter + * * * @type {number} * @constant */ -raylib.KEY_ENTER = 257 +raylib.ICON_ZOOM_CENTER = 107 /** - * Key: Tab + * * * @type {number} * @constant */ -raylib.KEY_TAB = 258 +raylib.ICON_BOX_DOTS_SMALL = 108 /** - * Key: Backspace + * * * @type {number} * @constant */ -raylib.KEY_BACKSPACE = 259 +raylib.ICON_BOX_DOTS_BIG = 109 /** - * Key: Ins + * * * @type {number} * @constant */ -raylib.KEY_INSERT = 260 +raylib.ICON_BOX_CONCENTRIC = 110 /** - * Key: Del + * * * @type {number} * @constant */ -raylib.KEY_DELETE = 261 +raylib.ICON_BOX_GRID_BIG = 111 /** - * Key: Cursor right + * * * @type {number} * @constant */ -raylib.KEY_RIGHT = 262 +raylib.ICON_OK_TICK = 112 /** - * Key: Cursor left + * * * @type {number} * @constant */ -raylib.KEY_LEFT = 263 +raylib.ICON_CROSS = 113 /** - * Key: Cursor down + * * * @type {number} * @constant */ -raylib.KEY_DOWN = 264 +raylib.ICON_ARROW_LEFT = 114 /** - * Key: Cursor up + * * * @type {number} * @constant */ -raylib.KEY_UP = 265 +raylib.ICON_ARROW_RIGHT = 115 /** - * Key: Page up + * * * @type {number} * @constant */ -raylib.KEY_PAGE_UP = 266 +raylib.ICON_ARROW_DOWN = 116 /** - * Key: Page down + * * * @type {number} * @constant */ -raylib.KEY_PAGE_DOWN = 267 +raylib.ICON_ARROW_UP = 117 /** - * Key: Home + * * * @type {number} * @constant */ -raylib.KEY_HOME = 268 +raylib.ICON_ARROW_LEFT_FILL = 118 /** - * Key: End + * * * @type {number} * @constant */ -raylib.KEY_END = 269 +raylib.ICON_ARROW_RIGHT_FILL = 119 /** - * Key: Caps lock + * * * @type {number} * @constant */ -raylib.KEY_CAPS_LOCK = 280 +raylib.ICON_ARROW_DOWN_FILL = 120 /** - * Key: Scroll down + * * * @type {number} * @constant */ -raylib.KEY_SCROLL_LOCK = 281 +raylib.ICON_ARROW_UP_FILL = 121 /** - * Key: Num lock + * * * @type {number} * @constant */ -raylib.KEY_NUM_LOCK = 282 +raylib.ICON_AUDIO = 122 /** - * Key: Print screen + * * * @type {number} * @constant */ -raylib.KEY_PRINT_SCREEN = 283 +raylib.ICON_FX = 123 /** - * Key: Pause + * * * @type {number} * @constant */ -raylib.KEY_PAUSE = 284 +raylib.ICON_WAVE = 124 /** - * Key: F1 + * * * @type {number} * @constant */ -raylib.KEY_F1 = 290 +raylib.ICON_WAVE_SINUS = 125 /** - * Key: F2 + * * * @type {number} * @constant */ -raylib.KEY_F2 = 291 +raylib.ICON_WAVE_SQUARE = 126 /** - * Key: F3 + * * * @type {number} * @constant */ -raylib.KEY_F3 = 292 +raylib.ICON_WAVE_TRIANGULAR = 127 /** - * Key: F4 + * * * @type {number} * @constant */ -raylib.KEY_F4 = 293 +raylib.ICON_CROSS_SMALL = 128 /** - * Key: F5 + * * * @type {number} * @constant */ -raylib.KEY_F5 = 294 +raylib.ICON_PLAYER_PREVIOUS = 129 /** - * Key: F6 + * * * @type {number} * @constant */ -raylib.KEY_F6 = 295 +raylib.ICON_PLAYER_PLAY_BACK = 130 /** - * Key: F7 + * * * @type {number} * @constant */ -raylib.KEY_F7 = 296 +raylib.ICON_PLAYER_PLAY = 131 /** - * Key: F8 + * * * @type {number} * @constant */ -raylib.KEY_F8 = 297 +raylib.ICON_PLAYER_PAUSE = 132 /** - * Key: F9 + * * * @type {number} * @constant */ -raylib.KEY_F9 = 298 +raylib.ICON_PLAYER_STOP = 133 /** - * Key: F10 + * * * @type {number} * @constant */ -raylib.KEY_F10 = 299 +raylib.ICON_PLAYER_NEXT = 134 /** - * Key: F11 + * * * @type {number} * @constant */ -raylib.KEY_F11 = 300 +raylib.ICON_PLAYER_RECORD = 135 /** - * Key: F12 + * * * @type {number} * @constant */ -raylib.KEY_F12 = 301 +raylib.ICON_MAGNET = 136 /** - * Key: Shift left + * * * @type {number} * @constant */ -raylib.KEY_LEFT_SHIFT = 340 +raylib.ICON_LOCK_CLOSE = 137 /** - * Key: Control left + * * * @type {number} * @constant */ -raylib.KEY_LEFT_CONTROL = 341 +raylib.ICON_LOCK_OPEN = 138 /** - * Key: Alt left + * * * @type {number} * @constant */ -raylib.KEY_LEFT_ALT = 342 +raylib.ICON_CLOCK = 139 /** - * Key: Super left + * * * @type {number} * @constant */ -raylib.KEY_LEFT_SUPER = 343 +raylib.ICON_TOOLS = 140 /** - * Key: Shift right + * * * @type {number} * @constant */ -raylib.KEY_RIGHT_SHIFT = 344 +raylib.ICON_GEAR = 141 /** - * Key: Control right + * * * @type {number} * @constant */ -raylib.KEY_RIGHT_CONTROL = 345 +raylib.ICON_GEAR_BIG = 142 /** - * Key: Alt right + * * * @type {number} * @constant */ -raylib.KEY_RIGHT_ALT = 346 +raylib.ICON_BIN = 143 /** - * Key: Super right + * * * @type {number} * @constant */ -raylib.KEY_RIGHT_SUPER = 347 +raylib.ICON_HAND_POINTER = 144 /** - * Key: KB menu + * * * @type {number} * @constant */ -raylib.KEY_KB_MENU = 348 +raylib.ICON_LASER = 145 /** - * Key: Keypad 0 + * * * @type {number} * @constant */ -raylib.KEY_KP_0 = 320 +raylib.ICON_COIN = 146 /** - * Key: Keypad 1 + * * * @type {number} * @constant */ -raylib.KEY_KP_1 = 321 +raylib.ICON_EXPLOSION = 147 /** - * Key: Keypad 2 + * * * @type {number} * @constant */ -raylib.KEY_KP_2 = 322 +raylib.ICON_1UP = 148 /** - * Key: Keypad 3 + * * * @type {number} * @constant */ -raylib.KEY_KP_3 = 323 +raylib.ICON_PLAYER = 149 /** - * Key: Keypad 4 + * * * @type {number} * @constant */ -raylib.KEY_KP_4 = 324 +raylib.ICON_PLAYER_JUMP = 150 /** - * Key: Keypad 5 + * * * @type {number} * @constant */ -raylib.KEY_KP_5 = 325 +raylib.ICON_KEY = 151 /** - * Key: Keypad 6 + * * * @type {number} * @constant */ -raylib.KEY_KP_6 = 326 +raylib.ICON_DEMON = 152 /** - * Key: Keypad 7 + * * * @type {number} * @constant */ -raylib.KEY_KP_7 = 327 +raylib.ICON_TEXT_POPUP = 153 /** - * Key: Keypad 8 + * * * @type {number} * @constant */ -raylib.KEY_KP_8 = 328 +raylib.ICON_GEAR_EX = 154 /** - * Key: Keypad 9 + * * * @type {number} * @constant */ -raylib.KEY_KP_9 = 329 +raylib.ICON_CRACK = 155 /** - * Key: Keypad . + * * * @type {number} * @constant */ -raylib.KEY_KP_DECIMAL = 330 +raylib.ICON_CRACK_POINTS = 156 /** - * Key: Keypad / + * * * @type {number} * @constant */ -raylib.KEY_KP_DIVIDE = 331 +raylib.ICON_STAR = 157 /** - * Key: Keypad * + * * * @type {number} * @constant */ -raylib.KEY_KP_MULTIPLY = 332 +raylib.ICON_DOOR = 158 /** - * Key: Keypad - + * * * @type {number} * @constant */ -raylib.KEY_KP_SUBTRACT = 333 +raylib.ICON_EXIT = 159 /** - * Key: Keypad + + * * * @type {number} * @constant */ -raylib.KEY_KP_ADD = 334 +raylib.ICON_MODE_2D = 160 /** - * Key: Keypad Enter + * * * @type {number} * @constant */ -raylib.KEY_KP_ENTER = 335 +raylib.ICON_MODE_3D = 161 /** - * Key: Keypad = + * * * @type {number} * @constant */ -raylib.KEY_KP_EQUAL = 336 +raylib.ICON_CUBE = 162 /** - * Key: Android back button + * * * @type {number} * @constant */ -raylib.KEY_BACK = 4 +raylib.ICON_CUBE_FACE_TOP = 163 /** - * Key: Android menu button + * * * @type {number} * @constant */ -raylib.KEY_MENU = 82 +raylib.ICON_CUBE_FACE_LEFT = 164 /** - * Key: Android volume up button + * * * @type {number} * @constant */ -raylib.KEY_VOLUME_UP = 24 +raylib.ICON_CUBE_FACE_FRONT = 165 /** - * Key: Android volume down button + * * * @type {number} * @constant */ -raylib.KEY_VOLUME_DOWN = 25 +raylib.ICON_CUBE_FACE_BOTTOM = 166 /** - * Mouse button left + * * * @type {number} * @constant */ -raylib.MOUSE_BUTTON_LEFT = 0 +raylib.ICON_CUBE_FACE_RIGHT = 167 /** - * Mouse button right + * * * @type {number} * @constant */ -raylib.MOUSE_BUTTON_RIGHT = 1 +raylib.ICON_CUBE_FACE_BACK = 168 /** - * Mouse button middle (pressed wheel) + * * * @type {number} * @constant */ -raylib.MOUSE_BUTTON_MIDDLE = 2 +raylib.ICON_CAMERA = 169 /** - * Mouse button side (advanced mouse device) + * * * @type {number} * @constant */ -raylib.MOUSE_BUTTON_SIDE = 3 +raylib.ICON_SPECIAL = 170 /** - * Mouse button extra (advanced mouse device) + * * * @type {number} * @constant */ -raylib.MOUSE_BUTTON_EXTRA = 4 +raylib.ICON_LINK_NET = 171 /** - * Mouse button fordward (advanced mouse device) + * * * @type {number} * @constant */ -raylib.MOUSE_BUTTON_FORWARD = 5 +raylib.ICON_LINK_BOXES = 172 /** - * Mouse button back (advanced mouse device) + * * * @type {number} * @constant */ -raylib.MOUSE_BUTTON_BACK = 6 +raylib.ICON_LINK_MULTI = 173 /** - * Default pointer shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_DEFAULT = 0 +raylib.ICON_LINK = 174 /** - * Arrow shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_ARROW = 1 +raylib.ICON_LINK_BROKE = 175 /** - * Text writing cursor shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_IBEAM = 2 +raylib.ICON_TEXT_NOTES = 176 /** - * Cross shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_CROSSHAIR = 3 +raylib.ICON_NOTEBOOK = 177 /** - * Pointing hand cursor + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_POINTING_HAND = 4 +raylib.ICON_SUITCASE = 178 /** - * Horizontal resize/move arrow shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_RESIZE_EW = 5 +raylib.ICON_SUITCASE_ZIP = 179 /** - * Vertical resize/move arrow shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_RESIZE_NS = 6 +raylib.ICON_MAILBOX = 180 /** - * Top-left to bottom-right diagonal resize/move arrow shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_RESIZE_NWSE = 7 +raylib.ICON_MONITOR = 181 /** - * The top-right to bottom-left diagonal resize/move arrow shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_RESIZE_NESW = 8 +raylib.ICON_PRINTER = 182 /** - * The omni-directional resize/move cursor shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_RESIZE_ALL = 9 +raylib.ICON_PHOTO_CAMERA = 183 /** - * The operation-not-allowed shape + * * * @type {number} * @constant */ -raylib.MOUSE_CURSOR_NOT_ALLOWED = 10 +raylib.ICON_PHOTO_CAMERA_FLASH = 184 /** - * Unknown button, just for error checking + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_UNKNOWN = 0 +raylib.ICON_HOUSE = 185 /** - * Gamepad left DPAD up button + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_LEFT_FACE_UP = 1 +raylib.ICON_HEART = 186 /** - * Gamepad left DPAD right button + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2 +raylib.ICON_CORNER = 187 /** - * Gamepad left DPAD down button + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3 +raylib.ICON_VERTICAL_BARS = 188 /** - * Gamepad left DPAD left button + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4 +raylib.ICON_VERTICAL_BARS_FILL = 189 /** - * Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_RIGHT_FACE_UP = 5 +raylib.ICON_LIFE_BARS = 190 /** - * Gamepad right button right (i.e. PS3: Square, Xbox: X) + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6 +raylib.ICON_INFO = 191 /** - * Gamepad right button down (i.e. PS3: Cross, Xbox: A) + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7 +raylib.ICON_CROSSLINE = 192 /** - * Gamepad right button left (i.e. PS3: Circle, Xbox: B) + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8 +raylib.ICON_HELP = 193 /** - * Gamepad top/back trigger left (first), it could be a trailing button + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9 +raylib.ICON_FILETYPE_ALPHA = 194 /** - * Gamepad top/back trigger left (second), it could be a trailing button + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10 +raylib.ICON_FILETYPE_HOME = 195 /** - * Gamepad top/back trigger right (one), it could be a trailing button + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11 +raylib.ICON_LAYERS_VISIBLE = 196 /** - * Gamepad top/back trigger right (second), it could be a trailing button + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12 +raylib.ICON_LAYERS = 197 /** - * Gamepad center buttons, left one (i.e. PS3: Select) + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_MIDDLE_LEFT = 13 +raylib.ICON_WINDOW = 198 /** - * Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX) + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_MIDDLE = 14 +raylib.ICON_HIDPI = 199 /** - * Gamepad center buttons, right one (i.e. PS3: Start) + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_MIDDLE_RIGHT = 15 +raylib.ICON_FILETYPE_BINARY = 200 /** - * Gamepad joystick pressed button left + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_LEFT_THUMB = 16 +raylib.ICON_HEX = 201 /** - * Gamepad joystick pressed button right + * * * @type {number} * @constant */ -raylib.GAMEPAD_BUTTON_RIGHT_THUMB = 17 +raylib.ICON_SHIELD = 202 /** - * Gamepad left stick X axis + * * * @type {number} * @constant */ -raylib.GAMEPAD_AXIS_LEFT_X = 0 +raylib.ICON_FILE_NEW = 203 /** - * Gamepad left stick Y axis + * * * @type {number} * @constant */ -raylib.GAMEPAD_AXIS_LEFT_Y = 1 +raylib.ICON_FOLDER_ADD = 204 /** - * Gamepad right stick X axis + * * * @type {number} * @constant */ -raylib.GAMEPAD_AXIS_RIGHT_X = 2 +raylib.ICON_ALARM = 205 /** - * Gamepad right stick Y axis + * * * @type {number} * @constant */ -raylib.GAMEPAD_AXIS_RIGHT_Y = 3 +raylib.ICON_206 = 206 /** - * Gamepad back trigger left, pressure level: [1..-1] + * * * @type {number} * @constant */ -raylib.GAMEPAD_AXIS_LEFT_TRIGGER = 4 +raylib.ICON_207 = 207 /** - * Gamepad back trigger right, pressure level: [1..-1] + * * * @type {number} * @constant */ -raylib.GAMEPAD_AXIS_RIGHT_TRIGGER = 5 +raylib.ICON_208 = 208 /** - * Albedo material (same as: MATERIAL_MAP_DIFFUSE) + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_ALBEDO = 0 +raylib.ICON_209 = 209 /** - * Metalness material (same as: MATERIAL_MAP_SPECULAR) + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_METALNESS = 1 +raylib.ICON_210 = 210 /** - * Normal material + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_NORMAL = 2 +raylib.ICON_211 = 211 /** - * Roughness material + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_ROUGHNESS = 3 +raylib.ICON_212 = 212 /** - * Ambient occlusion material + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_OCCLUSION = 4 +raylib.ICON_213 = 213 /** - * Emission material + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_EMISSION = 5 +raylib.ICON_214 = 214 /** - * Heightmap material + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_HEIGHT = 6 +raylib.ICON_215 = 215 /** - * Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_CUBEMAP = 7 +raylib.ICON_216 = 216 /** - * Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_IRRADIANCE = 8 +raylib.ICON_217 = 217 /** - * Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_PREFILTER = 9 +raylib.ICON_218 = 218 /** - * Brdf material + * * * @type {number} * @constant */ -raylib.MATERIAL_MAP_BRDF = 10 +raylib.ICON_219 = 219 /** - * Shader location: vertex attribute: position + * * * @type {number} * @constant */ -raylib.SHADER_LOC_VERTEX_POSITION = 0 +raylib.ICON_220 = 220 /** - * Shader location: vertex attribute: texcoord01 + * * * @type {number} * @constant */ -raylib.SHADER_LOC_VERTEX_TEXCOORD01 = 1 +raylib.ICON_221 = 221 /** - * Shader location: vertex attribute: texcoord02 + * * * @type {number} * @constant */ -raylib.SHADER_LOC_VERTEX_TEXCOORD02 = 2 +raylib.ICON_222 = 222 /** - * Shader location: vertex attribute: normal + * * * @type {number} * @constant */ -raylib.SHADER_LOC_VERTEX_NORMAL = 3 +raylib.ICON_223 = 223 /** - * Shader location: vertex attribute: tangent + * * * @type {number} * @constant */ -raylib.SHADER_LOC_VERTEX_TANGENT = 4 +raylib.ICON_224 = 224 /** - * Shader location: vertex attribute: color + * * * @type {number} * @constant */ -raylib.SHADER_LOC_VERTEX_COLOR = 5 +raylib.ICON_225 = 225 /** - * Shader location: matrix uniform: model-view-projection + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MATRIX_MVP = 6 +raylib.ICON_226 = 226 /** - * Shader location: matrix uniform: view (camera transform) + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MATRIX_VIEW = 7 +raylib.ICON_227 = 227 /** - * Shader location: matrix uniform: projection + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MATRIX_PROJECTION = 8 +raylib.ICON_228 = 228 /** - * Shader location: matrix uniform: model (transform) + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MATRIX_MODEL = 9 +raylib.ICON_229 = 229 /** - * Shader location: matrix uniform: normal + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MATRIX_NORMAL = 10 +raylib.ICON_230 = 230 /** - * Shader location: vector uniform: view + * * * @type {number} * @constant */ -raylib.SHADER_LOC_VECTOR_VIEW = 11 +raylib.ICON_231 = 231 /** - * Shader location: vector uniform: diffuse color + * * * @type {number} * @constant */ -raylib.SHADER_LOC_COLOR_DIFFUSE = 12 +raylib.ICON_232 = 232 /** - * Shader location: vector uniform: specular color + * * * @type {number} * @constant */ -raylib.SHADER_LOC_COLOR_SPECULAR = 13 +raylib.ICON_233 = 233 /** - * Shader location: vector uniform: ambient color + * * * @type {number} * @constant */ -raylib.SHADER_LOC_COLOR_AMBIENT = 14 +raylib.ICON_234 = 234 /** - * Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE) + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_ALBEDO = 15 +raylib.ICON_235 = 235 /** - * Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR) + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_METALNESS = 16 +raylib.ICON_236 = 236 /** - * Shader location: sampler2d texture: normal + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_NORMAL = 17 +raylib.ICON_237 = 237 /** - * Shader location: sampler2d texture: roughness + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_ROUGHNESS = 18 +raylib.ICON_238 = 238 /** - * Shader location: sampler2d texture: occlusion + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_OCCLUSION = 19 +raylib.ICON_239 = 239 /** - * Shader location: sampler2d texture: emission + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_EMISSION = 20 +raylib.ICON_240 = 240 /** - * Shader location: sampler2d texture: height + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_HEIGHT = 21 +raylib.ICON_241 = 241 /** - * Shader location: samplerCube texture: cubemap + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_CUBEMAP = 22 +raylib.ICON_242 = 242 /** - * Shader location: samplerCube texture: irradiance + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_IRRADIANCE = 23 +raylib.ICON_243 = 243 /** - * Shader location: samplerCube texture: prefilter + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_PREFILTER = 24 +raylib.ICON_244 = 244 /** - * Shader location: sampler2d texture: brdf + * * * @type {number} * @constant */ -raylib.SHADER_LOC_MAP_BRDF = 25 +raylib.ICON_245 = 245 /** - * Shader uniform type: float + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_FLOAT = 0 +raylib.ICON_246 = 246 /** - * Shader uniform type: vec2 (2 float) + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_VEC2 = 1 +raylib.ICON_247 = 247 /** - * Shader uniform type: vec3 (3 float) + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_VEC3 = 2 +raylib.ICON_248 = 248 /** - * Shader uniform type: vec4 (4 float) + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_VEC4 = 3 +raylib.ICON_249 = 249 /** - * Shader uniform type: int + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_INT = 4 +raylib.ICON_250 = 250 /** - * Shader uniform type: ivec2 (2 int) + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_IVEC2 = 5 +raylib.ICON_251 = 251 /** - * Shader uniform type: ivec3 (3 int) + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_IVEC3 = 6 +raylib.ICON_252 = 252 /** - * Shader uniform type: ivec4 (4 int) + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_IVEC4 = 7 +raylib.ICON_253 = 253 /** - * Shader uniform type: sampler2d + * * * @type {number} * @constant */ -raylib.SHADER_UNIFORM_SAMPLER2D = 8 +raylib.ICON_254 = 254 /** - * Shader attribute type: float + * * * @type {number} * @constant */ -raylib.SHADER_ATTRIB_FLOAT = 0 +raylib.ICON_255 = 255 /** - * Shader attribute type: vec2 (2 float) + * * * @type {number} * @constant */ -raylib.SHADER_ATTRIB_VEC2 = 1 +raylib.OPENGL_11 = 1 /** - * Shader attribute type: vec3 (3 float) + * * * @type {number} * @constant */ -raylib.SHADER_ATTRIB_VEC3 = 2 +raylib.OPENGL_21 = 2 /** - * Shader attribute type: vec4 (4 float) + * * * @type {number} * @constant */ -raylib.SHADER_ATTRIB_VEC4 = 3 +raylib.OPENGL_33 = 3 /** - * 8 bit per pixel (no alpha) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1 +raylib.OPENGL_43 = 4 /** - * 8*2 bpp (2 channels) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2 +raylib.OPENGL_ES_20 = 5 /** - * 16 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3 +raylib.RL_ATTACHMENT_COLOR_CHANNEL0 = 0 /** - * 24 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4 +raylib.RL_ATTACHMENT_COLOR_CHANNEL1 = 1 /** - * 16 bpp (1 bit alpha) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5 +raylib.RL_ATTACHMENT_COLOR_CHANNEL2 = 2 /** - * 16 bpp (4 bit alpha) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6 +raylib.RL_ATTACHMENT_COLOR_CHANNEL3 = 3 /** - * 32 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7 +raylib.RL_ATTACHMENT_COLOR_CHANNEL4 = 4 /** - * 32 bpp (1 channel - float) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_R32 = 8 +raylib.RL_ATTACHMENT_COLOR_CHANNEL5 = 5 /** - * 32*3 bpp (3 channels - float) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 +raylib.RL_ATTACHMENT_COLOR_CHANNEL6 = 6 /** - * 32*4 bpp (4 channels - float) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 +raylib.RL_ATTACHMENT_COLOR_CHANNEL7 = 7 /** - * 4 bpp (no alpha) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 +raylib.RL_ATTACHMENT_DEPTH = 100 /** - * 4 bpp (1 bit alpha) + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 +raylib.RL_ATTACHMENT_STENCIL = 200 /** - * 8 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 +raylib.RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0 /** - * 8 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 +raylib.RL_ATTACHMENT_CUBEMAP_NEGATIVE_X = 1 /** - * 4 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 +raylib.RL_ATTACHMENT_CUBEMAP_POSITIVE_Y = 2 /** - * 4 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 +raylib.RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y = 3 /** - * 8 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 +raylib.RL_ATTACHMENT_CUBEMAP_POSITIVE_Z = 4 /** - * 4 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 +raylib.RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z = 5 /** - * 4 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 +raylib.RL_ATTACHMENT_TEXTURE2D = 100 /** - * 8 bpp + * * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 +raylib.RL_ATTACHMENT_RENDERBUFFER = 200 /** - * 2 bpp + * Display all logs * * @type {number} * @constant */ -raylib.PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 +raylib.RL_LOG_ALL = 0 /** - * No filter, just pixel aproximation + * Trace logging, intended for internal use only * * @type {number} * @constant */ -raylib.TEXTURE_FILTER_POINT = 0 +raylib.RL_LOG_TRACE = 1 /** - * Linear filtering + * Debug logging, used for internal debugging, it should be disabled on release builds * * @type {number} * @constant */ -raylib.TEXTURE_FILTER_BILINEAR = 1 +raylib.RL_LOG_DEBUG = 2 /** - * Trilinear filtering (linear with mipmaps) + * Info logging, used for program execution info * * @type {number} * @constant */ -raylib.TEXTURE_FILTER_TRILINEAR = 2 +raylib.RL_LOG_INFO = 3 /** - * Anisotropic filtering 4x + * Warning logging, used on recoverable failures * * @type {number} * @constant */ -raylib.TEXTURE_FILTER_ANISOTROPIC_4X = 3 +raylib.RL_LOG_WARNING = 4 /** - * Anisotropic filtering 8x + * Error logging, used on unrecoverable failures * * @type {number} * @constant */ -raylib.TEXTURE_FILTER_ANISOTROPIC_8X = 4 +raylib.RL_LOG_ERROR = 5 /** - * Anisotropic filtering 16x + * Fatal logging, used to abort program: exit(EXIT_FAILURE) * * @type {number} * @constant */ -raylib.TEXTURE_FILTER_ANISOTROPIC_16X = 5 +raylib.RL_LOG_FATAL = 6 /** - * Repeats texture in tiled mode + * Disable logging * * @type {number} * @constant */ -raylib.TEXTURE_WRAP_REPEAT = 0 +raylib.RL_LOG_NONE = 7 /** - * Clamps texture to edge pixel in tiled mode + * 8 bit per pixel (no alpha) * * @type {number} * @constant */ -raylib.TEXTURE_WRAP_CLAMP = 1 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1 /** - * Mirrors and repeats the texture in tiled mode + * 8*2 bpp (2 channels) * * @type {number} * @constant */ -raylib.TEXTURE_WRAP_MIRROR_REPEAT = 2 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2 /** - * Mirrors and clamps to border the texture in tiled mode + * 16 bpp * * @type {number} * @constant */ -raylib.TEXTURE_WRAP_MIRROR_CLAMP = 3 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3 /** - * Automatically detect layout type + * 24 bpp * * @type {number} * @constant */ -raylib.CUBEMAP_LAYOUT_AUTO_DETECT = 0 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4 /** - * Layout is defined by a vertical line with faces + * 16 bpp (1 bit alpha) * * @type {number} * @constant */ -raylib.CUBEMAP_LAYOUT_LINE_VERTICAL = 1 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5 /** - * Layout is defined by an horizontal line with faces + * 16 bpp (4 bit alpha) * * @type {number} * @constant */ -raylib.CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6 /** - * Layout is defined by a 3x4 cross with cubemap faces + * 32 bpp * * @type {number} * @constant */ -raylib.CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7 /** - * Layout is defined by a 4x3 cross with cubemap faces + * 32 bpp (1 channel - float) * * @type {number} * @constant */ -raylib.CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R32 = 8 /** - * Layout is defined by a panorama image (equirectangular map) + * 32*3 bpp (3 channels - float) * * @type {number} * @constant */ -raylib.CUBEMAP_LAYOUT_PANORAMA = 5 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 /** - * Default font generation, anti-aliased + * 32*4 bpp (4 channels - float) * * @type {number} * @constant */ -raylib.FONT_DEFAULT = 0 +raylib.RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 /** - * Bitmap font generation, no anti-aliasing + * 4 bpp (no alpha) * * @type {number} * @constant */ -raylib.FONT_BITMAP = 1 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 /** - * SDF font generation, requires external shader + * 4 bpp (1 bit alpha) * * @type {number} * @constant */ -raylib.FONT_SDF = 2 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 /** - * Blend textures considering alpha (default) + * 8 bpp * * @type {number} * @constant */ -raylib.BLEND_ALPHA = 0 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 /** - * Blend textures adding colors + * 8 bpp * * @type {number} * @constant */ -raylib.BLEND_ADDITIVE = 1 +raylib.RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 /** - * Blend textures multiplying colors + * 4 bpp * * @type {number} * @constant */ -raylib.BLEND_MULTIPLIED = 2 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 /** - * Blend textures adding colors (alternative) + * 4 bpp * * @type {number} * @constant */ -raylib.BLEND_ADD_COLORS = 3 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 /** - * Blend textures subtracting colors (alternative) + * 8 bpp * * @type {number} * @constant */ -raylib.BLEND_SUBTRACT_COLORS = 4 +raylib.RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 /** - * Belnd textures using custom src/dst factors (use rlSetBlendMode()) + * 4 bpp * * @type {number} * @constant */ -raylib.BLEND_CUSTOM = 5 +raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 /** - * No gesture + * 4 bpp * * @type {number} * @constant */ -raylib.GESTURE_NONE = 0 +raylib.RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 /** - * Tap gesture + * 8 bpp * * @type {number} * @constant */ -raylib.GESTURE_TAP = 1 +raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 /** - * Double tap gesture + * 2 bpp * * @type {number} * @constant */ -raylib.GESTURE_DOUBLETAP = 2 +raylib.RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 /** - * Hold gesture + * No filter, just pixel approximation * * @type {number} * @constant */ -raylib.GESTURE_HOLD = 4 +raylib.RL_TEXTURE_FILTER_POINT = 0 /** - * Drag gesture + * Linear filtering * * @type {number} * @constant */ -raylib.GESTURE_DRAG = 8 +raylib.RL_TEXTURE_FILTER_BILINEAR = 1 /** - * Swipe right gesture + * Trilinear filtering (linear with mipmaps) * * @type {number} * @constant */ -raylib.GESTURE_SWIPE_RIGHT = 16 +raylib.RL_TEXTURE_FILTER_TRILINEAR = 2 /** - * Swipe left gesture + * Anisotropic filtering 4x * * @type {number} * @constant */ -raylib.GESTURE_SWIPE_LEFT = 32 +raylib.RL_TEXTURE_FILTER_ANISOTROPIC_4X = 3 /** - * Swipe up gesture + * Anisotropic filtering 8x * * @type {number} * @constant */ -raylib.GESTURE_SWIPE_UP = 64 +raylib.RL_TEXTURE_FILTER_ANISOTROPIC_8X = 4 /** - * Swipe down gesture + * Anisotropic filtering 16x * * @type {number} * @constant */ -raylib.GESTURE_SWIPE_DOWN = 128 +raylib.RL_TEXTURE_FILTER_ANISOTROPIC_16X = 5 /** - * Pinch in gesture + * Blend textures considering alpha (default) * * @type {number} * @constant */ -raylib.GESTURE_PINCH_IN = 256 +raylib.RL_BLEND_ALPHA = 0 /** - * Pinch out gesture + * Blend textures adding colors * * @type {number} * @constant */ -raylib.GESTURE_PINCH_OUT = 512 +raylib.RL_BLEND_ADDITIVE = 1 /** - * Custom camera + * Blend textures multiplying colors * * @type {number} * @constant */ -raylib.CAMERA_CUSTOM = 0 +raylib.RL_BLEND_MULTIPLIED = 2 /** - * Free camera + * Blend textures adding colors (alternative) * * @type {number} * @constant */ -raylib.CAMERA_FREE = 1 +raylib.RL_BLEND_ADD_COLORS = 3 /** - * Orbital camera + * Blend textures subtracting colors (alternative) * * @type {number} * @constant */ -raylib.CAMERA_ORBITAL = 2 +raylib.RL_BLEND_SUBTRACT_COLORS = 4 /** - * First person camera + * Blend premultiplied textures considering alpha * * @type {number} * @constant */ -raylib.CAMERA_FIRST_PERSON = 3 +raylib.RL_BLEND_ALPHA_PREMULTIPLY = 5 /** - * Third person camera + * Blend textures using custom src/dst factors (use rlSetBlendFactors()) * * @type {number} * @constant */ -raylib.CAMERA_THIRD_PERSON = 4 +raylib.RL_BLEND_CUSTOM = 6 /** - * Perspective projection + * Shader location: vertex attribute: position * * @type {number} * @constant */ -raylib.CAMERA_PERSPECTIVE = 0 +raylib.RL_SHADER_LOC_VERTEX_POSITION = 0 /** - * Orthographic projection + * Shader location: vertex attribute: texcoord01 * * @type {number} * @constant */ -raylib.CAMERA_ORTHOGRAPHIC = 1 +raylib.RL_SHADER_LOC_VERTEX_TEXCOORD01 = 1 /** - * Npatch layout: 3x3 tiles + * Shader location: vertex attribute: texcoord02 * * @type {number} * @constant */ -raylib.NPATCH_NINE_PATCH = 0 +raylib.RL_SHADER_LOC_VERTEX_TEXCOORD02 = 2 /** - * Npatch layout: 1x3 tiles + * Shader location: vertex attribute: normal * * @type {number} * @constant */ -raylib.NPATCH_THREE_PATCH_VERTICAL = 1 +raylib.RL_SHADER_LOC_VERTEX_NORMAL = 3 /** - * Npatch layout: 3x1 tiles + * Shader location: vertex attribute: tangent * * @type {number} * @constant */ -raylib.NPATCH_THREE_PATCH_HORIZONTAL = 2 +raylib.RL_SHADER_LOC_VERTEX_TANGENT = 4 /** - * + * Shader location: vertex attribute: color * * @type {number} * @constant */ -raylib.GUI_STATE_NORMAL = 0 +raylib.RL_SHADER_LOC_VERTEX_COLOR = 5 /** - * + * Shader location: matrix uniform: model-view-projection * * @type {number} * @constant */ -raylib.GUI_STATE_FOCUSED = 1 +raylib.RL_SHADER_LOC_MATRIX_MVP = 6 /** - * + * Shader location: matrix uniform: view (camera transform) * * @type {number} * @constant */ -raylib.GUI_STATE_PRESSED = 2 +raylib.RL_SHADER_LOC_MATRIX_VIEW = 7 /** - * + * Shader location: matrix uniform: projection * * @type {number} * @constant */ -raylib.GUI_STATE_DISABLED = 3 +raylib.RL_SHADER_LOC_MATRIX_PROJECTION = 8 /** - * + * Shader location: matrix uniform: model (transform) * * @type {number} * @constant */ -raylib.GUI_TEXT_ALIGN_LEFT = 0 +raylib.RL_SHADER_LOC_MATRIX_MODEL = 9 /** - * + * Shader location: matrix uniform: normal * * @type {number} * @constant */ -raylib.GUI_TEXT_ALIGN_CENTER = 1 +raylib.RL_SHADER_LOC_MATRIX_NORMAL = 10 /** - * + * Shader location: vector uniform: view * * @type {number} * @constant */ -raylib.GUI_TEXT_ALIGN_RIGHT = 2 +raylib.RL_SHADER_LOC_VECTOR_VIEW = 11 /** - * Generic control -> populates to all controls when set + * Shader location: vector uniform: diffuse color * * @type {number} * @constant */ -raylib.DEFAULT = 0 +raylib.RL_SHADER_LOC_COLOR_DIFFUSE = 12 /** - * Used also for: LABELBUTTON + * Shader location: vector uniform: specular color * * @type {number} * @constant */ -raylib.LABEL = 1 +raylib.RL_SHADER_LOC_COLOR_SPECULAR = 13 /** - * + * Shader location: vector uniform: ambient color * * @type {number} * @constant */ -raylib.BUTTON = 2 +raylib.RL_SHADER_LOC_COLOR_AMBIENT = 14 /** - * Used also for: TOGGLEGROUP + * Shader location: sampler2d texture: albedo (same as: RL_SHADER_LOC_MAP_DIFFUSE) * * @type {number} * @constant */ -raylib.TOGGLE = 3 +raylib.RL_SHADER_LOC_MAP_ALBEDO = 15 /** - * Used also for: SLIDERBAR + * Shader location: sampler2d texture: metalness (same as: RL_SHADER_LOC_MAP_SPECULAR) * * @type {number} * @constant */ -raylib.SLIDER = 4 +raylib.RL_SHADER_LOC_MAP_METALNESS = 16 /** - * + * Shader location: sampler2d texture: normal * * @type {number} * @constant */ -raylib.PROGRESSBAR = 5 +raylib.RL_SHADER_LOC_MAP_NORMAL = 17 /** - * + * Shader location: sampler2d texture: roughness * * @type {number} * @constant */ -raylib.CHECKBOX = 6 +raylib.RL_SHADER_LOC_MAP_ROUGHNESS = 18 /** - * + * Shader location: sampler2d texture: occlusion * * @type {number} * @constant */ -raylib.COMBOBOX = 7 +raylib.RL_SHADER_LOC_MAP_OCCLUSION = 19 /** - * + * Shader location: sampler2d texture: emission * * @type {number} * @constant */ -raylib.DROPDOWNBOX = 8 +raylib.RL_SHADER_LOC_MAP_EMISSION = 20 /** - * Used also for: TEXTBOXMULTI + * Shader location: sampler2d texture: height * * @type {number} * @constant */ -raylib.TEXTBOX = 9 +raylib.RL_SHADER_LOC_MAP_HEIGHT = 21 /** - * + * Shader location: samplerCube texture: cubemap * * @type {number} * @constant */ -raylib.VALUEBOX = 10 +raylib.RL_SHADER_LOC_MAP_CUBEMAP = 22 /** - * + * Shader location: samplerCube texture: irradiance * * @type {number} * @constant */ -raylib.SPINNER = 11 +raylib.RL_SHADER_LOC_MAP_IRRADIANCE = 23 /** - * + * Shader location: samplerCube texture: prefilter * * @type {number} * @constant */ -raylib.LISTVIEW = 12 +raylib.RL_SHADER_LOC_MAP_PREFILTER = 24 /** - * + * Shader location: sampler2d texture: brdf * * @type {number} * @constant */ -raylib.COLORPICKER = 13 +raylib.RL_SHADER_LOC_MAP_BRDF = 25 /** - * + * Shader uniform type: float * * @type {number} * @constant */ -raylib.SCROLLBAR = 14 +raylib.RL_SHADER_UNIFORM_FLOAT = 0 /** - * + * Shader uniform type: vec2 (2 float) * * @type {number} * @constant */ -raylib.STATUSBAR = 15 +raylib.RL_SHADER_UNIFORM_VEC2 = 1 /** - * + * Shader uniform type: vec3 (3 float) * * @type {number} * @constant */ -raylib.BORDER_COLOR_NORMAL = 0 +raylib.RL_SHADER_UNIFORM_VEC3 = 2 /** - * + * Shader uniform type: vec4 (4 float) * * @type {number} * @constant */ -raylib.BASE_COLOR_NORMAL = 1 +raylib.RL_SHADER_UNIFORM_VEC4 = 3 /** - * + * Shader uniform type: int * * @type {number} * @constant */ -raylib.TEXT_COLOR_NORMAL = 2 +raylib.RL_SHADER_UNIFORM_INT = 4 /** - * + * Shader uniform type: ivec2 (2 int) * * @type {number} * @constant */ -raylib.BORDER_COLOR_FOCUSED = 3 +raylib.RL_SHADER_UNIFORM_IVEC2 = 5 /** - * + * Shader uniform type: ivec3 (3 int) * * @type {number} * @constant */ -raylib.BASE_COLOR_FOCUSED = 4 +raylib.RL_SHADER_UNIFORM_IVEC3 = 6 /** - * + * Shader uniform type: ivec4 (4 int) * * @type {number} * @constant */ -raylib.TEXT_COLOR_FOCUSED = 5 +raylib.RL_SHADER_UNIFORM_IVEC4 = 7 /** - * + * Shader uniform type: sampler2d * * @type {number} * @constant */ -raylib.BORDER_COLOR_PRESSED = 6 +raylib.RL_SHADER_UNIFORM_SAMPLER2D = 8 /** - * + * Shader attribute type: float * * @type {number} * @constant */ -raylib.BASE_COLOR_PRESSED = 7 +raylib.RL_SHADER_ATTRIB_FLOAT = 0 /** - * + * Shader attribute type: vec2 (2 float) * * @type {number} * @constant */ -raylib.TEXT_COLOR_PRESSED = 8 +raylib.RL_SHADER_ATTRIB_VEC2 = 1 /** - * + * Shader attribute type: vec3 (3 float) * * @type {number} * @constant */ -raylib.BORDER_COLOR_DISABLED = 9 +raylib.RL_SHADER_ATTRIB_VEC3 = 2 /** - * + * Shader attribute type: vec4 (4 float) * * @type {number} * @constant */ -raylib.BASE_COLOR_DISABLED = 10 +raylib.RL_SHADER_ATTRIB_VEC4 = 3 /** * @@ -14829,327 +20764,327 @@ raylib.BASE_COLOR_DISABLED = 10 * @type {number} * @constant */ -raylib.TEXT_COLOR_DISABLED = 11 +raylib.RL_DEFAULT_BATCH_BUFFER_ELEMENTS = 8192 /** - * + * Default number of batch buffers (multi-buffering) * * @type {number} * @constant */ -raylib.BORDER_WIDTH = 12 +raylib.RL_DEFAULT_BATCH_BUFFERS = 1 /** - * + * Default number of batch draw calls (by state changes: mode, texture) * * @type {number} * @constant */ -raylib.TEXT_PADDING = 13 +raylib.RL_DEFAULT_BATCH_DRAWCALLS = 256 /** - * + * Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture()) * * @type {number} * @constant */ -raylib.TEXT_ALIGNMENT = 14 +raylib.RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS = 4 /** - * + * Maximum size of Matrix stack * * @type {number} * @constant */ -raylib.RESERVED = 15 +raylib.RL_MAX_MATRIX_STACK_SIZE = 32 /** - * + * Maximum number of shader locations supported * * @type {number} * @constant */ -raylib.TEXT_SIZE = 16 +raylib.RL_MAX_SHADER_LOCATIONS = 32 /** - * + * GL_TEXTURE_WRAP_S * * @type {number} * @constant */ -raylib.TEXT_SPACING = 17 +raylib.RL_TEXTURE_WRAP_S = 10242 /** - * + * GL_TEXTURE_WRAP_T * * @type {number} * @constant */ -raylib.LINE_COLOR = 18 +raylib.RL_TEXTURE_WRAP_T = 10243 /** - * + * GL_TEXTURE_MAG_FILTER * * @type {number} * @constant */ -raylib.BACKGROUND_COLOR = 19 +raylib.RL_TEXTURE_MAG_FILTER = 10240 /** - * + * GL_TEXTURE_MIN_FILTER * * @type {number} * @constant */ -raylib.GROUP_PADDING = 16 +raylib.RL_TEXTURE_MIN_FILTER = 10241 /** - * + * GL_NEAREST * * @type {number} * @constant */ -raylib.SLIDER_WIDTH = 16 +raylib.RL_TEXTURE_FILTER_NEAREST = 9728 /** - * + * GL_LINEAR * * @type {number} * @constant */ -raylib.SLIDER_PADDING = 17 +raylib.RL_TEXTURE_FILTER_LINEAR = 9729 /** - * + * GL_NEAREST_MIPMAP_NEAREST * * @type {number} * @constant */ -raylib.PROGRESS_PADDING = 16 +raylib.RL_TEXTURE_FILTER_MIP_NEAREST = 9984 /** - * + * GL_NEAREST_MIPMAP_LINEAR * * @type {number} * @constant */ -raylib.CHECK_PADDING = 16 +raylib.RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR = 9986 /** - * + * GL_LINEAR_MIPMAP_NEAREST * * @type {number} * @constant */ -raylib.COMBO_BUTTON_WIDTH = 16 +raylib.RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST = 9985 /** - * + * GL_LINEAR_MIPMAP_LINEAR * * @type {number} * @constant */ -raylib.COMBO_BUTTON_PADDING = 17 +raylib.RL_TEXTURE_FILTER_MIP_LINEAR = 9987 /** - * + * Anisotropic filter (custom identifier) * * @type {number} * @constant */ -raylib.ARROW_PADDING = 16 +raylib.RL_TEXTURE_FILTER_ANISOTROPIC = 12288 /** - * + * GL_REPEAT * * @type {number} * @constant */ -raylib.DROPDOWN_ITEMS_PADDING = 17 +raylib.RL_TEXTURE_WRAP_REPEAT = 10497 /** - * + * GL_CLAMP_TO_EDGE * * @type {number} * @constant */ -raylib.TEXT_INNER_PADDING = 16 +raylib.RL_TEXTURE_WRAP_CLAMP = 33071 /** - * + * GL_MIRRORED_REPEAT * * @type {number} * @constant */ -raylib.TEXT_LINES_PADDING = 17 +raylib.RL_TEXTURE_WRAP_MIRROR_REPEAT = 33648 /** - * + * GL_MIRROR_CLAMP_EXT * * @type {number} * @constant */ -raylib.COLOR_SELECTED_FG = 18 +raylib.RL_TEXTURE_WRAP_MIRROR_CLAMP = 34626 /** - * + * GL_MODELVIEW * * @type {number} * @constant */ -raylib.COLOR_SELECTED_BG = 19 +raylib.RL_MODELVIEW = 5888 /** - * + * GL_PROJECTION * * @type {number} * @constant */ -raylib.SPIN_BUTTON_WIDTH = 16 +raylib.RL_PROJECTION = 5889 /** - * + * GL_TEXTURE * * @type {number} * @constant */ -raylib.SPIN_BUTTON_PADDING = 17 +raylib.RL_TEXTURE = 5890 /** - * + * GL_LINES * * @type {number} * @constant */ -raylib.ARROWS_SIZE = 16 +raylib.RL_LINES = 1 /** - * + * GL_TRIANGLES * * @type {number} * @constant */ -raylib.ARROWS_VISIBLE = 17 +raylib.RL_TRIANGLES = 4 /** - * + * GL_QUADS * * @type {number} * @constant */ -raylib.SCROLL_SLIDER_PADDING = 18 +raylib.RL_QUADS = 7 /** - * + * GL_UNSIGNED_BYTE * * @type {number} * @constant */ -raylib.SCROLL_SLIDER_SIZE = 19 +raylib.RL_UNSIGNED_BYTE = 5121 /** - * + * GL_FLOAT * * @type {number} * @constant */ -raylib.SCROLL_PADDING = 20 +raylib.RL_FLOAT = 5126 /** - * + * GL_STREAM_DRAW * * @type {number} * @constant */ -raylib.SCROLL_SPEED = 21 +raylib.RL_STREAM_DRAW = 35040 /** - * + * GL_STREAM_READ * * @type {number} * @constant */ -raylib.SCROLLBAR_LEFT_SIDE = 0 +raylib.RL_STREAM_READ = 35041 /** - * + * GL_STREAM_COPY * * @type {number} * @constant */ -raylib.SCROLLBAR_RIGHT_SIDE = 1 +raylib.RL_STREAM_COPY = 35042 /** - * + * GL_STATIC_DRAW * * @type {number} * @constant */ -raylib.LIST_ITEMS_HEIGHT = 16 +raylib.RL_STATIC_DRAW = 35044 /** - * + * GL_STATIC_READ * * @type {number} * @constant */ -raylib.LIST_ITEMS_PADDING = 17 +raylib.RL_STATIC_READ = 35045 /** - * + * GL_STATIC_COPY * * @type {number} * @constant */ -raylib.SCROLLBAR_WIDTH = 18 +raylib.RL_STATIC_COPY = 35046 /** - * + * GL_DYNAMIC_DRAW * * @type {number} * @constant */ -raylib.SCROLLBAR_SIDE = 19 +raylib.RL_DYNAMIC_DRAW = 35048 /** - * + * GL_DYNAMIC_READ * * @type {number} * @constant */ -raylib.COLOR_SELECTOR_SIZE = 16 +raylib.RL_DYNAMIC_READ = 35049 /** - * Right hue bar width + * GL_DYNAMIC_COPY * * @type {number} * @constant */ -raylib.HUEBAR_WIDTH = 17 +raylib.RL_DYNAMIC_COPY = 35050 /** - * Right hue bar separation from panel + * GL_FRAGMENT_SHADER * * @type {number} * @constant */ -raylib.HUEBAR_PADDING = 18 +raylib.RL_FRAGMENT_SHADER = 35632 /** - * Right hue bar selector height + * GL_VERTEX_SHADER * * @type {number} * @constant */ -raylib.HUEBAR_SELECTOR_HEIGHT = 19 +raylib.RL_VERTEX_SHADER = 35633 /** - * Right hue bar selector overflow + * GL_COMPUTE_SHADER * * @type {number} * @constant */ -raylib.HUEBAR_SELECTOR_OVERFLOW = 20 +raylib.RL_COMPUTE_SHADER = 37305 raylib.LIGHTGRAY = { r: 200, g: 200, b: 200, a: 255 } raylib.GRAY = { r: 130, g: 130, b: 130, a: 255 } diff --git a/tools/generate.js b/tools/generate.js index f33d2c8..9ee6d22 100644 --- a/tools/generate.js +++ b/tools/generate.js @@ -21,6 +21,11 @@ const blocklist = [ 'SetLoadFileTextCallback', 'SetSaveFileTextCallback', + // Callbacks: AudioStream + 'SetAudioStreamCallback', + 'AttachAudioStreamProcessor', + 'DetachAudioStreamProcessor', + // Structs // @todo Verify Structs that have array properties 'VrStereoConfig', // Matrix[2], float[2] @@ -34,7 +39,12 @@ const blocklist = [ // raygui 'UnloadGuiStyle', // Commented out - 'LoadGuiStyle' // Commented out + 'LoadGuiStyle', // Commented out + + // rlgl + 'rlEnableStatePointer', // undefined + 'rlDisableStatePointer' // undefined + ] // these functions expect the first argument to be passed as a reference in C++ @@ -174,8 +184,8 @@ function getDefs () { } // Add the Easings API - const easings = raylibApi.easings - functions.push(...easings.functions) + const reasings = raylibApi.reasings + functions.push(...reasings.functions) // Add Raymath const raymath = raylibApi.raymath @@ -186,6 +196,36 @@ function getDefs () { functions.push(...raygui.functions) enums.push(...raygui.enums) + const rlgl = raylibApi.rlgl + functions.push(...rlgl.functions) + enums.push(...rlgl.enums) + const tmp = { + name: 'RLGL Defines', + description: '', + values: [] + } + for (const define of rlgl.defines) { + if (define.type === 'INT') { + tmp.values.push({ + name: define.name, + description: define.description, + value: define.value + }) + } + } + enums.push(tmp) + for (const struct of rlgl.structs) { + 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 *' + }) + } + } + structs.push(...rlgl.structs.filter(s => { return s.name !== 'Matrix' })) + return { structs, enums, functions } } diff --git a/tools/generate_templates/ArgumentTypeConversion.js b/tools/generate_templates/ArgumentTypeConversion.js index d8f828c..e8ebf67 100644 --- a/tools/generate_templates/ArgumentTypeConversion.js +++ b/tools/generate_templates/ArgumentTypeConversion.js @@ -13,6 +13,7 @@ function ArgumentTypeConversion (arg) { if (arg === 'unsigned char') { return 'number' } if (arg === 'long') { return 'number' } if (arg === 'double') { return 'number' } + if (arg === 'unsigned long long') { return 'BigInt' } if (arg === 'bool') { return 'boolean' } @@ -21,6 +22,10 @@ function ArgumentTypeConversion (arg) { if (arg.includes('*')) { return 'number' } + // float[2], float[4] etc. should be converted to pointers as well + if (arg.includes(']')) { + return 'number' + } return arg } diff --git a/tools/generate_templates/node-raylib-bindings.js b/tools/generate_templates/node-raylib-bindings.js index 42312a0..417ae07 100644 --- a/tools/generate_templates/node-raylib-bindings.js +++ b/tools/generate_templates/node-raylib-bindings.js @@ -17,6 +17,9 @@ const SanitizeTypeName = name => { if (name === 'float[4]') { return 'pointer' } + if (name === 'unsigned int[4]') { + return '(unsigned int) pointer' + } if (name === 'Matrix[2]') { return 'pointer' } @@ -182,11 +185,13 @@ module.exports = ({ functions, structs, enums, blocklist, byreflist }) => ` #include #include #include "raylib.h" -#include "extras/easings.h" #include "raymath.h" +#include "../extras/reasings.h" +#include "../extras/rlgl.h" + #define RAYGUI_IMPLEMENTATION -#include "extras/raygui.h" +#include "../extras/raygui.h" using namespace Napi; @@ -220,6 +225,9 @@ inline Napi::Value ToValue(Napi::Env env, float value) { inline Napi::Value ToValue(Napi::Env env, void * value) { return Napi::Number::New(env, (int64_t) value); } +inline Napi::Value ToValue(Napi::Env env, unsigned long long value) { + return Napi::BigInt::New(env, (uint64_t) value); +} inline float floatFromValue(const Napi::CallbackInfo& info, int index) { return info[index].As().FloatValue(); @@ -239,6 +247,9 @@ inline unsigned char unsignedcharFromValue(const Napi::CallbackInfo& info, int i inline unsigned int unsignedintFromValue(const Napi::CallbackInfo& info, int index) { return info[index].As().Uint32Value(); } +inline unsigned long long unsignedlonglongFromValue(const Napi::CallbackInfo& info, int index) { + return (unsigned long long) info[index].As().Uint64Value(0); +} inline bool boolFromValue(const Napi::CallbackInfo& info, int index) { return info[index].As(); } diff --git a/tools/generate_templates/node-raylib-definitions.js b/tools/generate_templates/node-raylib-definitions.js index e77fe99..c8b5021 100644 --- a/tools/generate_templates/node-raylib-definitions.js +++ b/tools/generate_templates/node-raylib-definitions.js @@ -15,7 +15,7 @@ const StructInterface = (struct) => { return `/** ${struct.description} */ export interface ${struct.name} { ${struct.fields - .map(field => `/** ${field.description} */\n ${field.name}: ${ArgumentTypeConversion(field.type)}`) + .map(field => `/** ${field.description}. (${field.type}) */\n ${field.name}: ${ArgumentTypeConversion(field.type)}`) .join('\n ') } }` @@ -41,6 +41,8 @@ declare module "raylib" { /** Camera, defines position/orientation in 3d space */ export type Camera = Camera3D | Camera2D + /** Quaternion, same as Vector4 */ + export type Quaternion = Vector4 ${functions .filter(({ name }) => !blocklist.includes(name)) .map(FunctionDefinition)