diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json
index 4bfce70d1..f65e6aa24 100644
--- a/parser/output/raylib_api.json
+++ b/parser/output/raylib_api.json
@@ -9479,6 +9479,17 @@
}
]
},
+ {
+ "name": "TextToSnake",
+ "description": "Get Snake case notation version of provided string",
+ "returnType": "const char *",
+ "params": [
+ {
+ "type": "const char *",
+ "name": "text"
+ }
+ ]
+ },
{
"name": "TextToInteger",
"description": "Get integer value from text (negative values not supported)",
diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua
index 4a6998bbd..6343f1629 100644
--- a/parser/output/raylib_api.lua
+++ b/parser/output/raylib_api.lua
@@ -6776,6 +6776,14 @@ return {
{type = "const char *", name = "text"}
}
},
+ {
+ name = "TextToSnake",
+ description = "Get Snake case notation version of provided string",
+ returnType = "const char *",
+ params = {
+ {type = "const char *", name = "text"}
+ }
+ },
{
name = "TextToInteger",
description = "Get integer value from text (negative values not supported)",
diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt
index 979ef0d56..f46a0e6dd 100644
--- a/parser/output/raylib_api.txt
+++ b/parser/output/raylib_api.txt
@@ -984,7 +984,7 @@ Callback 006: AudioCallback() (2 input parameters)
Param[1]: bufferData (type: void *)
Param[2]: frames (type: unsigned int)
-Functions found: 564
+Functions found: 565
Function 001: InitWindow() (3 input parameters)
Name: InitWindow
@@ -3641,30 +3641,35 @@ Function 423: TextToPascal() (1 input parameters)
Return type: const char *
Description: Get Pascal case notation version of provided string
Param[1]: text (type: const char *)
-Function 424: TextToInteger() (1 input parameters)
+Function 424: TextToSnake() (1 input parameters)
+ Name: TextToSnake
+ Return type: const char *
+ Description: Get Snake case notation version of provided string
+ Param[1]: text (type: const char *)
+Function 425: TextToInteger() (1 input parameters)
Name: TextToInteger
Return type: int
Description: Get integer value from text (negative values not supported)
Param[1]: text (type: const char *)
-Function 425: TextToFloat() (1 input parameters)
+Function 426: TextToFloat() (1 input parameters)
Name: TextToFloat
Return type: float
Description: Get float value from text (negative values not supported)
Param[1]: text (type: const char *)
-Function 426: DrawLine3D() (3 input parameters)
+Function 427: DrawLine3D() (3 input parameters)
Name: DrawLine3D
Return type: void
Description: Draw a line in 3D world space
Param[1]: startPos (type: Vector3)
Param[2]: endPos (type: Vector3)
Param[3]: color (type: Color)
-Function 427: DrawPoint3D() (2 input parameters)
+Function 428: DrawPoint3D() (2 input parameters)
Name: DrawPoint3D
Return type: void
Description: Draw a point in 3D space, actually a small line
Param[1]: position (type: Vector3)
Param[2]: color (type: Color)
-Function 428: DrawCircle3D() (5 input parameters)
+Function 429: DrawCircle3D() (5 input parameters)
Name: DrawCircle3D
Return type: void
Description: Draw a circle in 3D world space
@@ -3673,7 +3678,7 @@ Function 428: DrawCircle3D() (5 input parameters)
Param[3]: rotationAxis (type: Vector3)
Param[4]: rotationAngle (type: float)
Param[5]: color (type: Color)
-Function 429: DrawTriangle3D() (4 input parameters)
+Function 430: DrawTriangle3D() (4 input parameters)
Name: DrawTriangle3D
Return type: void
Description: Draw a color-filled triangle (vertex in counter-clockwise order!)
@@ -3681,14 +3686,14 @@ Function 429: DrawTriangle3D() (4 input parameters)
Param[2]: v2 (type: Vector3)
Param[3]: v3 (type: Vector3)
Param[4]: color (type: Color)
-Function 430: DrawTriangleStrip3D() (3 input parameters)
+Function 431: DrawTriangleStrip3D() (3 input parameters)
Name: DrawTriangleStrip3D
Return type: void
Description: Draw a triangle strip defined by points
Param[1]: points (type: Vector3 *)
Param[2]: pointCount (type: int)
Param[3]: color (type: Color)
-Function 431: DrawCube() (5 input parameters)
+Function 432: DrawCube() (5 input parameters)
Name: DrawCube
Return type: void
Description: Draw cube
@@ -3697,14 +3702,14 @@ Function 431: DrawCube() (5 input parameters)
Param[3]: height (type: float)
Param[4]: length (type: float)
Param[5]: color (type: Color)
-Function 432: DrawCubeV() (3 input parameters)
+Function 433: DrawCubeV() (3 input parameters)
Name: DrawCubeV
Return type: void
Description: Draw cube (Vector version)
Param[1]: position (type: Vector3)
Param[2]: size (type: Vector3)
Param[3]: color (type: Color)
-Function 433: DrawCubeWires() (5 input parameters)
+Function 434: DrawCubeWires() (5 input parameters)
Name: DrawCubeWires
Return type: void
Description: Draw cube wires
@@ -3713,21 +3718,21 @@ Function 433: DrawCubeWires() (5 input parameters)
Param[3]: height (type: float)
Param[4]: length (type: float)
Param[5]: color (type: Color)
-Function 434: DrawCubeWiresV() (3 input parameters)
+Function 435: DrawCubeWiresV() (3 input parameters)
Name: DrawCubeWiresV
Return type: void
Description: Draw cube wires (Vector version)
Param[1]: position (type: Vector3)
Param[2]: size (type: Vector3)
Param[3]: color (type: Color)
-Function 435: DrawSphere() (3 input parameters)
+Function 436: DrawSphere() (3 input parameters)
Name: DrawSphere
Return type: void
Description: Draw sphere
Param[1]: centerPos (type: Vector3)
Param[2]: radius (type: float)
Param[3]: color (type: Color)
-Function 436: DrawSphereEx() (5 input parameters)
+Function 437: DrawSphereEx() (5 input parameters)
Name: DrawSphereEx
Return type: void
Description: Draw sphere with extended parameters
@@ -3736,7 +3741,7 @@ Function 436: DrawSphereEx() (5 input parameters)
Param[3]: rings (type: int)
Param[4]: slices (type: int)
Param[5]: color (type: Color)
-Function 437: DrawSphereWires() (5 input parameters)
+Function 438: DrawSphereWires() (5 input parameters)
Name: DrawSphereWires
Return type: void
Description: Draw sphere wires
@@ -3745,7 +3750,7 @@ Function 437: DrawSphereWires() (5 input parameters)
Param[3]: rings (type: int)
Param[4]: slices (type: int)
Param[5]: color (type: Color)
-Function 438: DrawCylinder() (6 input parameters)
+Function 439: DrawCylinder() (6 input parameters)
Name: DrawCylinder
Return type: void
Description: Draw a cylinder/cone
@@ -3755,7 +3760,7 @@ Function 438: DrawCylinder() (6 input parameters)
Param[4]: height (type: float)
Param[5]: slices (type: int)
Param[6]: color (type: Color)
-Function 439: DrawCylinderEx() (6 input parameters)
+Function 440: DrawCylinderEx() (6 input parameters)
Name: DrawCylinderEx
Return type: void
Description: Draw a cylinder with base at startPos and top at endPos
@@ -3765,7 +3770,7 @@ Function 439: DrawCylinderEx() (6 input parameters)
Param[4]: endRadius (type: float)
Param[5]: sides (type: int)
Param[6]: color (type: Color)
-Function 440: DrawCylinderWires() (6 input parameters)
+Function 441: DrawCylinderWires() (6 input parameters)
Name: DrawCylinderWires
Return type: void
Description: Draw a cylinder/cone wires
@@ -3775,7 +3780,7 @@ Function 440: DrawCylinderWires() (6 input parameters)
Param[4]: height (type: float)
Param[5]: slices (type: int)
Param[6]: color (type: Color)
-Function 441: DrawCylinderWiresEx() (6 input parameters)
+Function 442: DrawCylinderWiresEx() (6 input parameters)
Name: DrawCylinderWiresEx
Return type: void
Description: Draw a cylinder wires with base at startPos and top at endPos
@@ -3785,7 +3790,7 @@ Function 441: DrawCylinderWiresEx() (6 input parameters)
Param[4]: endRadius (type: float)
Param[5]: sides (type: int)
Param[6]: color (type: Color)
-Function 442: DrawCapsule() (6 input parameters)
+Function 443: DrawCapsule() (6 input parameters)
Name: DrawCapsule
Return type: void
Description: Draw a capsule with the center of its sphere caps at startPos and endPos
@@ -3795,7 +3800,7 @@ Function 442: DrawCapsule() (6 input parameters)
Param[4]: slices (type: int)
Param[5]: rings (type: int)
Param[6]: color (type: Color)
-Function 443: DrawCapsuleWires() (6 input parameters)
+Function 444: DrawCapsuleWires() (6 input parameters)
Name: DrawCapsuleWires
Return type: void
Description: Draw capsule wireframe with the center of its sphere caps at startPos and endPos
@@ -3805,51 +3810,51 @@ Function 443: DrawCapsuleWires() (6 input parameters)
Param[4]: slices (type: int)
Param[5]: rings (type: int)
Param[6]: color (type: Color)
-Function 444: DrawPlane() (3 input parameters)
+Function 445: DrawPlane() (3 input parameters)
Name: DrawPlane
Return type: void
Description: Draw a plane XZ
Param[1]: centerPos (type: Vector3)
Param[2]: size (type: Vector2)
Param[3]: color (type: Color)
-Function 445: DrawRay() (2 input parameters)
+Function 446: DrawRay() (2 input parameters)
Name: DrawRay
Return type: void
Description: Draw a ray line
Param[1]: ray (type: Ray)
Param[2]: color (type: Color)
-Function 446: DrawGrid() (2 input parameters)
+Function 447: DrawGrid() (2 input parameters)
Name: DrawGrid
Return type: void
Description: Draw a grid (centered at (0, 0, 0))
Param[1]: slices (type: int)
Param[2]: spacing (type: float)
-Function 447: LoadModel() (1 input parameters)
+Function 448: LoadModel() (1 input parameters)
Name: LoadModel
Return type: Model
Description: Load model from files (meshes and materials)
Param[1]: fileName (type: const char *)
-Function 448: LoadModelFromMesh() (1 input parameters)
+Function 449: LoadModelFromMesh() (1 input parameters)
Name: LoadModelFromMesh
Return type: Model
Description: Load model from generated mesh (default material)
Param[1]: mesh (type: Mesh)
-Function 449: IsModelReady() (1 input parameters)
+Function 450: IsModelReady() (1 input parameters)
Name: IsModelReady
Return type: bool
Description: Check if a model is ready
Param[1]: model (type: Model)
-Function 450: UnloadModel() (1 input parameters)
+Function 451: UnloadModel() (1 input parameters)
Name: UnloadModel
Return type: void
Description: Unload model (including meshes) from memory (RAM and/or VRAM)
Param[1]: model (type: Model)
-Function 451: GetModelBoundingBox() (1 input parameters)
+Function 452: GetModelBoundingBox() (1 input parameters)
Name: GetModelBoundingBox
Return type: BoundingBox
Description: Compute model bounding box limits (considers all meshes)
Param[1]: model (type: Model)
-Function 452: DrawModel() (4 input parameters)
+Function 453: DrawModel() (4 input parameters)
Name: DrawModel
Return type: void
Description: Draw a model (with texture if set)
@@ -3857,7 +3862,7 @@ Function 452: DrawModel() (4 input parameters)
Param[2]: position (type: Vector3)
Param[3]: scale (type: float)
Param[4]: tint (type: Color)
-Function 453: DrawModelEx() (6 input parameters)
+Function 454: DrawModelEx() (6 input parameters)
Name: DrawModelEx
Return type: void
Description: Draw a model with extended parameters
@@ -3867,7 +3872,7 @@ Function 453: DrawModelEx() (6 input parameters)
Param[4]: rotationAngle (type: float)
Param[5]: scale (type: Vector3)
Param[6]: tint (type: Color)
-Function 454: DrawModelWires() (4 input parameters)
+Function 455: DrawModelWires() (4 input parameters)
Name: DrawModelWires
Return type: void
Description: Draw a model wires (with texture if set)
@@ -3875,7 +3880,7 @@ Function 454: DrawModelWires() (4 input parameters)
Param[2]: position (type: Vector3)
Param[3]: scale (type: float)
Param[4]: tint (type: Color)
-Function 455: DrawModelWiresEx() (6 input parameters)
+Function 456: DrawModelWiresEx() (6 input parameters)
Name: DrawModelWiresEx
Return type: void
Description: Draw a model wires (with texture if set) with extended parameters
@@ -3885,13 +3890,13 @@ Function 455: DrawModelWiresEx() (6 input parameters)
Param[4]: rotationAngle (type: float)
Param[5]: scale (type: Vector3)
Param[6]: tint (type: Color)
-Function 456: DrawBoundingBox() (2 input parameters)
+Function 457: DrawBoundingBox() (2 input parameters)
Name: DrawBoundingBox
Return type: void
Description: Draw bounding box (wires)
Param[1]: box (type: BoundingBox)
Param[2]: color (type: Color)
-Function 457: DrawBillboard() (5 input parameters)
+Function 458: DrawBillboard() (5 input parameters)
Name: DrawBillboard
Return type: void
Description: Draw a billboard texture
@@ -3900,7 +3905,7 @@ Function 457: DrawBillboard() (5 input parameters)
Param[3]: position (type: Vector3)
Param[4]: size (type: float)
Param[5]: tint (type: Color)
-Function 458: DrawBillboardRec() (6 input parameters)
+Function 459: DrawBillboardRec() (6 input parameters)
Name: DrawBillboardRec
Return type: void
Description: Draw a billboard texture defined by source
@@ -3910,7 +3915,7 @@ Function 458: DrawBillboardRec() (6 input parameters)
Param[4]: position (type: Vector3)
Param[5]: size (type: Vector2)
Param[6]: tint (type: Color)
-Function 459: DrawBillboardPro() (9 input parameters)
+Function 460: DrawBillboardPro() (9 input parameters)
Name: DrawBillboardPro
Return type: void
Description: Draw a billboard texture defined by source and rotation
@@ -3923,13 +3928,13 @@ Function 459: DrawBillboardPro() (9 input parameters)
Param[7]: origin (type: Vector2)
Param[8]: rotation (type: float)
Param[9]: tint (type: Color)
-Function 460: UploadMesh() (2 input parameters)
+Function 461: UploadMesh() (2 input parameters)
Name: UploadMesh
Return type: void
Description: Upload mesh vertex data in GPU and provide VAO/VBO ids
Param[1]: mesh (type: Mesh *)
Param[2]: dynamic (type: bool)
-Function 461: UpdateMeshBuffer() (5 input parameters)
+Function 462: UpdateMeshBuffer() (5 input parameters)
Name: UpdateMeshBuffer
Return type: void
Description: Update mesh vertex data in GPU for a specific buffer index
@@ -3938,19 +3943,19 @@ Function 461: UpdateMeshBuffer() (5 input parameters)
Param[3]: data (type: const void *)
Param[4]: dataSize (type: int)
Param[5]: offset (type: int)
-Function 462: UnloadMesh() (1 input parameters)
+Function 463: UnloadMesh() (1 input parameters)
Name: UnloadMesh
Return type: void
Description: Unload mesh data from CPU and GPU
Param[1]: mesh (type: Mesh)
-Function 463: DrawMesh() (3 input parameters)
+Function 464: DrawMesh() (3 input parameters)
Name: DrawMesh
Return type: void
Description: Draw a 3d mesh with material and transform
Param[1]: mesh (type: Mesh)
Param[2]: material (type: Material)
Param[3]: transform (type: Matrix)
-Function 464: DrawMeshInstanced() (4 input parameters)
+Function 465: DrawMeshInstanced() (4 input parameters)
Name: DrawMeshInstanced
Return type: void
Description: Draw multiple mesh instances with material and different transforms
@@ -3958,35 +3963,35 @@ Function 464: DrawMeshInstanced() (4 input parameters)
Param[2]: material (type: Material)
Param[3]: transforms (type: const Matrix *)
Param[4]: instances (type: int)
-Function 465: GetMeshBoundingBox() (1 input parameters)
+Function 466: GetMeshBoundingBox() (1 input parameters)
Name: GetMeshBoundingBox
Return type: BoundingBox
Description: Compute mesh bounding box limits
Param[1]: mesh (type: Mesh)
-Function 466: GenMeshTangents() (1 input parameters)
+Function 467: GenMeshTangents() (1 input parameters)
Name: GenMeshTangents
Return type: void
Description: Compute mesh tangents
Param[1]: mesh (type: Mesh *)
-Function 467: ExportMesh() (2 input parameters)
+Function 468: ExportMesh() (2 input parameters)
Name: ExportMesh
Return type: bool
Description: Export mesh data to file, returns true on success
Param[1]: mesh (type: Mesh)
Param[2]: fileName (type: const char *)
-Function 468: ExportMeshAsCode() (2 input parameters)
+Function 469: ExportMeshAsCode() (2 input parameters)
Name: ExportMeshAsCode
Return type: bool
Description: Export mesh as code file (.h) defining multiple arrays of vertex attributes
Param[1]: mesh (type: Mesh)
Param[2]: fileName (type: const char *)
-Function 469: GenMeshPoly() (2 input parameters)
+Function 470: GenMeshPoly() (2 input parameters)
Name: GenMeshPoly
Return type: Mesh
Description: Generate polygonal mesh
Param[1]: sides (type: int)
Param[2]: radius (type: float)
-Function 470: GenMeshPlane() (4 input parameters)
+Function 471: GenMeshPlane() (4 input parameters)
Name: GenMeshPlane
Return type: Mesh
Description: Generate plane mesh (with subdivisions)
@@ -3994,42 +3999,42 @@ Function 470: GenMeshPlane() (4 input parameters)
Param[2]: length (type: float)
Param[3]: resX (type: int)
Param[4]: resZ (type: int)
-Function 471: GenMeshCube() (3 input parameters)
+Function 472: GenMeshCube() (3 input parameters)
Name: GenMeshCube
Return type: Mesh
Description: Generate cuboid mesh
Param[1]: width (type: float)
Param[2]: height (type: float)
Param[3]: length (type: float)
-Function 472: GenMeshSphere() (3 input parameters)
+Function 473: GenMeshSphere() (3 input parameters)
Name: GenMeshSphere
Return type: Mesh
Description: Generate sphere mesh (standard sphere)
Param[1]: radius (type: float)
Param[2]: rings (type: int)
Param[3]: slices (type: int)
-Function 473: GenMeshHemiSphere() (3 input parameters)
+Function 474: GenMeshHemiSphere() (3 input parameters)
Name: GenMeshHemiSphere
Return type: Mesh
Description: Generate half-sphere mesh (no bottom cap)
Param[1]: radius (type: float)
Param[2]: rings (type: int)
Param[3]: slices (type: int)
-Function 474: GenMeshCylinder() (3 input parameters)
+Function 475: GenMeshCylinder() (3 input parameters)
Name: GenMeshCylinder
Return type: Mesh
Description: Generate cylinder mesh
Param[1]: radius (type: float)
Param[2]: height (type: float)
Param[3]: slices (type: int)
-Function 475: GenMeshCone() (3 input parameters)
+Function 476: GenMeshCone() (3 input parameters)
Name: GenMeshCone
Return type: Mesh
Description: Generate cone/pyramid mesh
Param[1]: radius (type: float)
Param[2]: height (type: float)
Param[3]: slices (type: int)
-Function 476: GenMeshTorus() (4 input parameters)
+Function 477: GenMeshTorus() (4 input parameters)
Name: GenMeshTorus
Return type: Mesh
Description: Generate torus mesh
@@ -4037,7 +4042,7 @@ Function 476: GenMeshTorus() (4 input parameters)
Param[2]: size (type: float)
Param[3]: radSeg (type: int)
Param[4]: sides (type: int)
-Function 477: GenMeshKnot() (4 input parameters)
+Function 478: GenMeshKnot() (4 input parameters)
Name: GenMeshKnot
Return type: Mesh
Description: Generate trefoil knot mesh
@@ -4045,84 +4050,84 @@ Function 477: GenMeshKnot() (4 input parameters)
Param[2]: size (type: float)
Param[3]: radSeg (type: int)
Param[4]: sides (type: int)
-Function 478: GenMeshHeightmap() (2 input parameters)
+Function 479: GenMeshHeightmap() (2 input parameters)
Name: GenMeshHeightmap
Return type: Mesh
Description: Generate heightmap mesh from image data
Param[1]: heightmap (type: Image)
Param[2]: size (type: Vector3)
-Function 479: GenMeshCubicmap() (2 input parameters)
+Function 480: GenMeshCubicmap() (2 input parameters)
Name: GenMeshCubicmap
Return type: Mesh
Description: Generate cubes-based map mesh from image data
Param[1]: cubicmap (type: Image)
Param[2]: cubeSize (type: Vector3)
-Function 480: LoadMaterials() (2 input parameters)
+Function 481: LoadMaterials() (2 input parameters)
Name: LoadMaterials
Return type: Material *
Description: Load materials from model file
Param[1]: fileName (type: const char *)
Param[2]: materialCount (type: int *)
-Function 481: LoadMaterialDefault() (0 input parameters)
+Function 482: LoadMaterialDefault() (0 input parameters)
Name: LoadMaterialDefault
Return type: Material
Description: Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
No input parameters
-Function 482: IsMaterialReady() (1 input parameters)
+Function 483: IsMaterialReady() (1 input parameters)
Name: IsMaterialReady
Return type: bool
Description: Check if a material is ready
Param[1]: material (type: Material)
-Function 483: UnloadMaterial() (1 input parameters)
+Function 484: UnloadMaterial() (1 input parameters)
Name: UnloadMaterial
Return type: void
Description: Unload material from GPU memory (VRAM)
Param[1]: material (type: Material)
-Function 484: SetMaterialTexture() (3 input parameters)
+Function 485: SetMaterialTexture() (3 input parameters)
Name: SetMaterialTexture
Return type: void
Description: Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
Param[1]: material (type: Material *)
Param[2]: mapType (type: int)
Param[3]: texture (type: Texture2D)
-Function 485: SetModelMeshMaterial() (3 input parameters)
+Function 486: SetModelMeshMaterial() (3 input parameters)
Name: SetModelMeshMaterial
Return type: void
Description: Set material for a mesh
Param[1]: model (type: Model *)
Param[2]: meshId (type: int)
Param[3]: materialId (type: int)
-Function 486: LoadModelAnimations() (2 input parameters)
+Function 487: LoadModelAnimations() (2 input parameters)
Name: LoadModelAnimations
Return type: ModelAnimation *
Description: Load model animations from file
Param[1]: fileName (type: const char *)
Param[2]: animCount (type: int *)
-Function 487: UpdateModelAnimation() (3 input parameters)
+Function 488: UpdateModelAnimation() (3 input parameters)
Name: UpdateModelAnimation
Return type: void
Description: Update model animation pose
Param[1]: model (type: Model)
Param[2]: anim (type: ModelAnimation)
Param[3]: frame (type: int)
-Function 488: UnloadModelAnimation() (1 input parameters)
+Function 489: UnloadModelAnimation() (1 input parameters)
Name: UnloadModelAnimation
Return type: void
Description: Unload animation data
Param[1]: anim (type: ModelAnimation)
-Function 489: UnloadModelAnimations() (2 input parameters)
+Function 490: UnloadModelAnimations() (2 input parameters)
Name: UnloadModelAnimations
Return type: void
Description: Unload animation array data
Param[1]: animations (type: ModelAnimation *)
Param[2]: animCount (type: int)
-Function 490: IsModelAnimationValid() (2 input parameters)
+Function 491: IsModelAnimationValid() (2 input parameters)
Name: IsModelAnimationValid
Return type: bool
Description: Check model animation skeleton match
Param[1]: model (type: Model)
Param[2]: anim (type: ModelAnimation)
-Function 491: CheckCollisionSpheres() (4 input parameters)
+Function 492: CheckCollisionSpheres() (4 input parameters)
Name: CheckCollisionSpheres
Return type: bool
Description: Check collision between two spheres
@@ -4130,40 +4135,40 @@ Function 491: CheckCollisionSpheres() (4 input parameters)
Param[2]: radius1 (type: float)
Param[3]: center2 (type: Vector3)
Param[4]: radius2 (type: float)
-Function 492: CheckCollisionBoxes() (2 input parameters)
+Function 493: CheckCollisionBoxes() (2 input parameters)
Name: CheckCollisionBoxes
Return type: bool
Description: Check collision between two bounding boxes
Param[1]: box1 (type: BoundingBox)
Param[2]: box2 (type: BoundingBox)
-Function 493: CheckCollisionBoxSphere() (3 input parameters)
+Function 494: CheckCollisionBoxSphere() (3 input parameters)
Name: CheckCollisionBoxSphere
Return type: bool
Description: Check collision between box and sphere
Param[1]: box (type: BoundingBox)
Param[2]: center (type: Vector3)
Param[3]: radius (type: float)
-Function 494: GetRayCollisionSphere() (3 input parameters)
+Function 495: GetRayCollisionSphere() (3 input parameters)
Name: GetRayCollisionSphere
Return type: RayCollision
Description: Get collision info between ray and sphere
Param[1]: ray (type: Ray)
Param[2]: center (type: Vector3)
Param[3]: radius (type: float)
-Function 495: GetRayCollisionBox() (2 input parameters)
+Function 496: GetRayCollisionBox() (2 input parameters)
Name: GetRayCollisionBox
Return type: RayCollision
Description: Get collision info between ray and box
Param[1]: ray (type: Ray)
Param[2]: box (type: BoundingBox)
-Function 496: GetRayCollisionMesh() (3 input parameters)
+Function 497: GetRayCollisionMesh() (3 input parameters)
Name: GetRayCollisionMesh
Return type: RayCollision
Description: Get collision info between ray and mesh
Param[1]: ray (type: Ray)
Param[2]: mesh (type: Mesh)
Param[3]: transform (type: Matrix)
-Function 497: GetRayCollisionTriangle() (4 input parameters)
+Function 498: GetRayCollisionTriangle() (4 input parameters)
Name: GetRayCollisionTriangle
Return type: RayCollision
Description: Get collision info between ray and triangle
@@ -4171,7 +4176,7 @@ Function 497: GetRayCollisionTriangle() (4 input parameters)
Param[2]: p1 (type: Vector3)
Param[3]: p2 (type: Vector3)
Param[4]: p3 (type: Vector3)
-Function 498: GetRayCollisionQuad() (5 input parameters)
+Function 499: GetRayCollisionQuad() (5 input parameters)
Name: GetRayCollisionQuad
Return type: RayCollision
Description: Get collision info between ray and quad
@@ -4180,158 +4185,158 @@ Function 498: GetRayCollisionQuad() (5 input parameters)
Param[3]: p2 (type: Vector3)
Param[4]: p3 (type: Vector3)
Param[5]: p4 (type: Vector3)
-Function 499: InitAudioDevice() (0 input parameters)
+Function 500: InitAudioDevice() (0 input parameters)
Name: InitAudioDevice
Return type: void
Description: Initialize audio device and context
No input parameters
-Function 500: CloseAudioDevice() (0 input parameters)
+Function 501: CloseAudioDevice() (0 input parameters)
Name: CloseAudioDevice
Return type: void
Description: Close the audio device and context
No input parameters
-Function 501: IsAudioDeviceReady() (0 input parameters)
+Function 502: IsAudioDeviceReady() (0 input parameters)
Name: IsAudioDeviceReady
Return type: bool
Description: Check if audio device has been initialized successfully
No input parameters
-Function 502: SetMasterVolume() (1 input parameters)
+Function 503: SetMasterVolume() (1 input parameters)
Name: SetMasterVolume
Return type: void
Description: Set master volume (listener)
Param[1]: volume (type: float)
-Function 503: GetMasterVolume() (0 input parameters)
+Function 504: GetMasterVolume() (0 input parameters)
Name: GetMasterVolume
Return type: float
Description: Get master volume (listener)
No input parameters
-Function 504: LoadWave() (1 input parameters)
+Function 505: LoadWave() (1 input parameters)
Name: LoadWave
Return type: Wave
Description: Load wave data from file
Param[1]: fileName (type: const char *)
-Function 505: LoadWaveFromMemory() (3 input parameters)
+Function 506: LoadWaveFromMemory() (3 input parameters)
Name: LoadWaveFromMemory
Return type: Wave
Description: Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
Param[1]: fileType (type: const char *)
Param[2]: fileData (type: const unsigned char *)
Param[3]: dataSize (type: int)
-Function 506: IsWaveReady() (1 input parameters)
+Function 507: IsWaveReady() (1 input parameters)
Name: IsWaveReady
Return type: bool
Description: Checks if wave data is ready
Param[1]: wave (type: Wave)
-Function 507: LoadSound() (1 input parameters)
+Function 508: LoadSound() (1 input parameters)
Name: LoadSound
Return type: Sound
Description: Load sound from file
Param[1]: fileName (type: const char *)
-Function 508: LoadSoundFromWave() (1 input parameters)
+Function 509: LoadSoundFromWave() (1 input parameters)
Name: LoadSoundFromWave
Return type: Sound
Description: Load sound from wave data
Param[1]: wave (type: Wave)
-Function 509: LoadSoundAlias() (1 input parameters)
+Function 510: LoadSoundAlias() (1 input parameters)
Name: LoadSoundAlias
Return type: Sound
Description: Create a new sound that shares the same sample data as the source sound, does not own the sound data
Param[1]: source (type: Sound)
-Function 510: IsSoundReady() (1 input parameters)
+Function 511: IsSoundReady() (1 input parameters)
Name: IsSoundReady
Return type: bool
Description: Checks if a sound is ready
Param[1]: sound (type: Sound)
-Function 511: UpdateSound() (3 input parameters)
+Function 512: UpdateSound() (3 input parameters)
Name: UpdateSound
Return type: void
Description: Update sound buffer with new data
Param[1]: sound (type: Sound)
Param[2]: data (type: const void *)
Param[3]: sampleCount (type: int)
-Function 512: UnloadWave() (1 input parameters)
+Function 513: UnloadWave() (1 input parameters)
Name: UnloadWave
Return type: void
Description: Unload wave data
Param[1]: wave (type: Wave)
-Function 513: UnloadSound() (1 input parameters)
+Function 514: UnloadSound() (1 input parameters)
Name: UnloadSound
Return type: void
Description: Unload sound
Param[1]: sound (type: Sound)
-Function 514: UnloadSoundAlias() (1 input parameters)
+Function 515: UnloadSoundAlias() (1 input parameters)
Name: UnloadSoundAlias
Return type: void
Description: Unload a sound alias (does not deallocate sample data)
Param[1]: alias (type: Sound)
-Function 515: ExportWave() (2 input parameters)
+Function 516: ExportWave() (2 input parameters)
Name: ExportWave
Return type: bool
Description: Export wave data to file, returns true on success
Param[1]: wave (type: Wave)
Param[2]: fileName (type: const char *)
-Function 516: ExportWaveAsCode() (2 input parameters)
+Function 517: ExportWaveAsCode() (2 input parameters)
Name: ExportWaveAsCode
Return type: bool
Description: Export wave sample data to code (.h), returns true on success
Param[1]: wave (type: Wave)
Param[2]: fileName (type: const char *)
-Function 517: PlaySound() (1 input parameters)
+Function 518: PlaySound() (1 input parameters)
Name: PlaySound
Return type: void
Description: Play a sound
Param[1]: sound (type: Sound)
-Function 518: StopSound() (1 input parameters)
+Function 519: StopSound() (1 input parameters)
Name: StopSound
Return type: void
Description: Stop playing a sound
Param[1]: sound (type: Sound)
-Function 519: PauseSound() (1 input parameters)
+Function 520: PauseSound() (1 input parameters)
Name: PauseSound
Return type: void
Description: Pause a sound
Param[1]: sound (type: Sound)
-Function 520: ResumeSound() (1 input parameters)
+Function 521: ResumeSound() (1 input parameters)
Name: ResumeSound
Return type: void
Description: Resume a paused sound
Param[1]: sound (type: Sound)
-Function 521: IsSoundPlaying() (1 input parameters)
+Function 522: IsSoundPlaying() (1 input parameters)
Name: IsSoundPlaying
Return type: bool
Description: Check if a sound is currently playing
Param[1]: sound (type: Sound)
-Function 522: SetSoundVolume() (2 input parameters)
+Function 523: SetSoundVolume() (2 input parameters)
Name: SetSoundVolume
Return type: void
Description: Set volume for a sound (1.0 is max level)
Param[1]: sound (type: Sound)
Param[2]: volume (type: float)
-Function 523: SetSoundPitch() (2 input parameters)
+Function 524: SetSoundPitch() (2 input parameters)
Name: SetSoundPitch
Return type: void
Description: Set pitch for a sound (1.0 is base level)
Param[1]: sound (type: Sound)
Param[2]: pitch (type: float)
-Function 524: SetSoundPan() (2 input parameters)
+Function 525: SetSoundPan() (2 input parameters)
Name: SetSoundPan
Return type: void
Description: Set pan for a sound (0.5 is center)
Param[1]: sound (type: Sound)
Param[2]: pan (type: float)
-Function 525: WaveCopy() (1 input parameters)
+Function 526: WaveCopy() (1 input parameters)
Name: WaveCopy
Return type: Wave
Description: Copy a wave to a new wave
Param[1]: wave (type: Wave)
-Function 526: WaveCrop() (3 input parameters)
+Function 527: WaveCrop() (3 input parameters)
Name: WaveCrop
Return type: void
Description: Crop a wave to defined frames range
Param[1]: wave (type: Wave *)
Param[2]: initFrame (type: int)
Param[3]: finalFrame (type: int)
-Function 527: WaveFormat() (4 input parameters)
+Function 528: WaveFormat() (4 input parameters)
Name: WaveFormat
Return type: void
Description: Convert wave data to desired format
@@ -4339,203 +4344,203 @@ Function 527: WaveFormat() (4 input parameters)
Param[2]: sampleRate (type: int)
Param[3]: sampleSize (type: int)
Param[4]: channels (type: int)
-Function 528: LoadWaveSamples() (1 input parameters)
+Function 529: LoadWaveSamples() (1 input parameters)
Name: LoadWaveSamples
Return type: float *
Description: Load samples data from wave as a 32bit float data array
Param[1]: wave (type: Wave)
-Function 529: UnloadWaveSamples() (1 input parameters)
+Function 530: UnloadWaveSamples() (1 input parameters)
Name: UnloadWaveSamples
Return type: void
Description: Unload samples data loaded with LoadWaveSamples()
Param[1]: samples (type: float *)
-Function 530: LoadMusicStream() (1 input parameters)
+Function 531: LoadMusicStream() (1 input parameters)
Name: LoadMusicStream
Return type: Music
Description: Load music stream from file
Param[1]: fileName (type: const char *)
-Function 531: LoadMusicStreamFromMemory() (3 input parameters)
+Function 532: LoadMusicStreamFromMemory() (3 input parameters)
Name: LoadMusicStreamFromMemory
Return type: Music
Description: Load music stream from data
Param[1]: fileType (type: const char *)
Param[2]: data (type: const unsigned char *)
Param[3]: dataSize (type: int)
-Function 532: IsMusicReady() (1 input parameters)
+Function 533: IsMusicReady() (1 input parameters)
Name: IsMusicReady
Return type: bool
Description: Checks if a music stream is ready
Param[1]: music (type: Music)
-Function 533: UnloadMusicStream() (1 input parameters)
+Function 534: UnloadMusicStream() (1 input parameters)
Name: UnloadMusicStream
Return type: void
Description: Unload music stream
Param[1]: music (type: Music)
-Function 534: PlayMusicStream() (1 input parameters)
+Function 535: PlayMusicStream() (1 input parameters)
Name: PlayMusicStream
Return type: void
Description: Start music playing
Param[1]: music (type: Music)
-Function 535: IsMusicStreamPlaying() (1 input parameters)
+Function 536: IsMusicStreamPlaying() (1 input parameters)
Name: IsMusicStreamPlaying
Return type: bool
Description: Check if music is playing
Param[1]: music (type: Music)
-Function 536: UpdateMusicStream() (1 input parameters)
+Function 537: UpdateMusicStream() (1 input parameters)
Name: UpdateMusicStream
Return type: void
Description: Updates buffers for music streaming
Param[1]: music (type: Music)
-Function 537: StopMusicStream() (1 input parameters)
+Function 538: StopMusicStream() (1 input parameters)
Name: StopMusicStream
Return type: void
Description: Stop music playing
Param[1]: music (type: Music)
-Function 538: PauseMusicStream() (1 input parameters)
+Function 539: PauseMusicStream() (1 input parameters)
Name: PauseMusicStream
Return type: void
Description: Pause music playing
Param[1]: music (type: Music)
-Function 539: ResumeMusicStream() (1 input parameters)
+Function 540: ResumeMusicStream() (1 input parameters)
Name: ResumeMusicStream
Return type: void
Description: Resume playing paused music
Param[1]: music (type: Music)
-Function 540: SeekMusicStream() (2 input parameters)
+Function 541: SeekMusicStream() (2 input parameters)
Name: SeekMusicStream
Return type: void
Description: Seek music to a position (in seconds)
Param[1]: music (type: Music)
Param[2]: position (type: float)
-Function 541: SetMusicVolume() (2 input parameters)
+Function 542: SetMusicVolume() (2 input parameters)
Name: SetMusicVolume
Return type: void
Description: Set volume for music (1.0 is max level)
Param[1]: music (type: Music)
Param[2]: volume (type: float)
-Function 542: SetMusicPitch() (2 input parameters)
+Function 543: SetMusicPitch() (2 input parameters)
Name: SetMusicPitch
Return type: void
Description: Set pitch for a music (1.0 is base level)
Param[1]: music (type: Music)
Param[2]: pitch (type: float)
-Function 543: SetMusicPan() (2 input parameters)
+Function 544: SetMusicPan() (2 input parameters)
Name: SetMusicPan
Return type: void
Description: Set pan for a music (0.5 is center)
Param[1]: music (type: Music)
Param[2]: pan (type: float)
-Function 544: GetMusicTimeLength() (1 input parameters)
+Function 545: GetMusicTimeLength() (1 input parameters)
Name: GetMusicTimeLength
Return type: float
Description: Get music time length (in seconds)
Param[1]: music (type: Music)
-Function 545: GetMusicTimePlayed() (1 input parameters)
+Function 546: GetMusicTimePlayed() (1 input parameters)
Name: GetMusicTimePlayed
Return type: float
Description: Get current music time played (in seconds)
Param[1]: music (type: Music)
-Function 546: LoadAudioStream() (3 input parameters)
+Function 547: LoadAudioStream() (3 input parameters)
Name: LoadAudioStream
Return type: AudioStream
Description: Load audio stream (to stream raw audio pcm data)
Param[1]: sampleRate (type: unsigned int)
Param[2]: sampleSize (type: unsigned int)
Param[3]: channels (type: unsigned int)
-Function 547: IsAudioStreamReady() (1 input parameters)
+Function 548: IsAudioStreamReady() (1 input parameters)
Name: IsAudioStreamReady
Return type: bool
Description: Checks if an audio stream is ready
Param[1]: stream (type: AudioStream)
-Function 548: UnloadAudioStream() (1 input parameters)
+Function 549: UnloadAudioStream() (1 input parameters)
Name: UnloadAudioStream
Return type: void
Description: Unload audio stream and free memory
Param[1]: stream (type: AudioStream)
-Function 549: UpdateAudioStream() (3 input parameters)
+Function 550: UpdateAudioStream() (3 input parameters)
Name: UpdateAudioStream
Return type: void
Description: Update audio stream buffers with data
Param[1]: stream (type: AudioStream)
Param[2]: data (type: const void *)
Param[3]: frameCount (type: int)
-Function 550: IsAudioStreamProcessed() (1 input parameters)
+Function 551: IsAudioStreamProcessed() (1 input parameters)
Name: IsAudioStreamProcessed
Return type: bool
Description: Check if any audio stream buffers requires refill
Param[1]: stream (type: AudioStream)
-Function 551: PlayAudioStream() (1 input parameters)
+Function 552: PlayAudioStream() (1 input parameters)
Name: PlayAudioStream
Return type: void
Description: Play audio stream
Param[1]: stream (type: AudioStream)
-Function 552: PauseAudioStream() (1 input parameters)
+Function 553: PauseAudioStream() (1 input parameters)
Name: PauseAudioStream
Return type: void
Description: Pause audio stream
Param[1]: stream (type: AudioStream)
-Function 553: ResumeAudioStream() (1 input parameters)
+Function 554: ResumeAudioStream() (1 input parameters)
Name: ResumeAudioStream
Return type: void
Description: Resume audio stream
Param[1]: stream (type: AudioStream)
-Function 554: IsAudioStreamPlaying() (1 input parameters)
+Function 555: IsAudioStreamPlaying() (1 input parameters)
Name: IsAudioStreamPlaying
Return type: bool
Description: Check if audio stream is playing
Param[1]: stream (type: AudioStream)
-Function 555: StopAudioStream() (1 input parameters)
+Function 556: StopAudioStream() (1 input parameters)
Name: StopAudioStream
Return type: void
Description: Stop audio stream
Param[1]: stream (type: AudioStream)
-Function 556: SetAudioStreamVolume() (2 input parameters)
+Function 557: SetAudioStreamVolume() (2 input parameters)
Name: SetAudioStreamVolume
Return type: void
Description: Set volume for audio stream (1.0 is max level)
Param[1]: stream (type: AudioStream)
Param[2]: volume (type: float)
-Function 557: SetAudioStreamPitch() (2 input parameters)
+Function 558: SetAudioStreamPitch() (2 input parameters)
Name: SetAudioStreamPitch
Return type: void
Description: Set pitch for audio stream (1.0 is base level)
Param[1]: stream (type: AudioStream)
Param[2]: pitch (type: float)
-Function 558: SetAudioStreamPan() (2 input parameters)
+Function 559: SetAudioStreamPan() (2 input parameters)
Name: SetAudioStreamPan
Return type: void
Description: Set pan for audio stream (0.5 is centered)
Param[1]: stream (type: AudioStream)
Param[2]: pan (type: float)
-Function 559: SetAudioStreamBufferSizeDefault() (1 input parameters)
+Function 560: SetAudioStreamBufferSizeDefault() (1 input parameters)
Name: SetAudioStreamBufferSizeDefault
Return type: void
Description: Default size for new audio streams
Param[1]: size (type: int)
-Function 560: SetAudioStreamCallback() (2 input parameters)
+Function 561: SetAudioStreamCallback() (2 input parameters)
Name: SetAudioStreamCallback
Return type: void
Description: Audio thread callback to request new data
Param[1]: stream (type: AudioStream)
Param[2]: callback (type: AudioCallback)
-Function 561: AttachAudioStreamProcessor() (2 input parameters)
+Function 562: AttachAudioStreamProcessor() (2 input parameters)
Name: AttachAudioStreamProcessor
Return type: void
Description: Attach audio stream processor to stream, receives the samples as 'float'
Param[1]: stream (type: AudioStream)
Param[2]: processor (type: AudioCallback)
-Function 562: DetachAudioStreamProcessor() (2 input parameters)
+Function 563: DetachAudioStreamProcessor() (2 input parameters)
Name: DetachAudioStreamProcessor
Return type: void
Description: Detach audio stream processor from stream
Param[1]: stream (type: AudioStream)
Param[2]: processor (type: AudioCallback)
-Function 563: AttachAudioMixedProcessor() (1 input parameters)
+Function 564: AttachAudioMixedProcessor() (1 input parameters)
Name: AttachAudioMixedProcessor
Return type: void
Description: Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'
Param[1]: processor (type: AudioCallback)
-Function 564: DetachAudioMixedProcessor() (1 input parameters)
+Function 565: DetachAudioMixedProcessor() (1 input parameters)
Name: DetachAudioMixedProcessor
Return type: void
Description: Detach audio stream processor from the entire audio pipeline
diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml
index c4a16f97e..45e8a3fd5 100644
--- a/parser/output/raylib_api.xml
+++ b/parser/output/raylib_api.xml
@@ -670,7 +670,7 @@
-
+
@@ -2405,6 +2405,9 @@
+
+
+
diff --git a/src/raylib.h b/src/raylib.h
index dfa98efb8..3629fc31d 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1,155 +1,155 @@
/**********************************************************************************************
-*
-* raylib v5.1-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
-*
-* FEATURES:
-* - NO external dependencies, all required libraries included with raylib
-* - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly,
-* MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5.
-* - Written in plain C code (C99) in PascalCase/camelCase notation
-* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3 or ES2 - choose at compile)
-* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
-* - Multiple Fonts formats supported (TTF, XNA fonts, AngelCode fonts)
-* - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
-* - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
-* - Flexible Materials system, supporting classic maps and PBR maps
-* - Animated 3D models supported (skeletal bones animation) (IQM)
-* - Shaders support, including Model shaders and Postprocessing shaders
-* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
-* - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
-* - VR stereo rendering with configurable HMD device parameters
-* - Bindings to multiple programming languages available!
-*
-* NOTES:
-* - One default Font is loaded on InitWindow()->LoadFontDefault() [core, text]
-* - One default Texture2D is loaded on rlglInit(), 1x1 white pixel R8G8B8A8 [rlgl] (OpenGL 3.3 or ES2)
-* - One default Shader is loaded on rlglInit()->rlLoadShaderDefault() [rlgl] (OpenGL 3.3 or ES2)
-* - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2)
-*
-* DEPENDENCIES (included):
-* [rcore] rglfw (Camilla Löwy - github.com/glfw/glfw) for window/context management and input (PLATFORM_DESKTOP)
-* [rlgl] glad (David Herberth - github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading (PLATFORM_DESKTOP)
-* [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management
-*
-* OPTIONAL DEPENDENCIES (included):
-* [rcore] msf_gif (Miles Fogle) for GIF recording
-* [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm
-* [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm
-* [rtextures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...)
-* [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG)
-* [rtextures] stb_image_resize (Sean Barret) for image resizing algorithms
-* [rtext] stb_truetype (Sean Barret) for ttf fonts loading
-* [rtext] stb_rect_pack (Sean Barret) for rectangles packing
-* [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation
-* [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL)
-* [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF)
-* [rmodels] Model3D (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d)
-* [raudio] dr_wav (David Reid) for WAV audio file loading
-* [raudio] dr_flac (David Reid) for FLAC audio file loading
-* [raudio] dr_mp3 (David Reid) for MP3 audio file loading
-* [raudio] stb_vorbis (Sean Barret) for OGG audio loading
-* [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading
-* [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading
-*
-*
-* LICENSE: zlib/libpng
-*
-* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
-* BSD-like license that allows static linking with closed source software:
-*
-* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
-*
-* This software is provided "as-is", without any express or implied warranty. In no event
-* will the authors be held liable for any damages arising from the use of this software.
-*
-* 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.
-*
-**********************************************************************************************/
+ *
+ * raylib v5.1-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
+ *
+ * FEATURES:
+ * - NO external dependencies, all required libraries included with raylib
+ * - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly,
+ * MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5.
+ * - Written in plain C code (C99) in PascalCase/camelCase notation
+ * - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3 or ES2 - choose at compile)
+ * - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
+ * - Multiple Fonts formats supported (TTF, XNA fonts, AngelCode fonts)
+ * - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
+ * - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
+ * - Flexible Materials system, supporting classic maps and PBR maps
+ * - Animated 3D models supported (skeletal bones animation) (IQM)
+ * - Shaders support, including Model shaders and Postprocessing shaders
+ * - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
+ * - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
+ * - VR stereo rendering with configurable HMD device parameters
+ * - Bindings to multiple programming languages available!
+ *
+ * NOTES:
+ * - One default Font is loaded on InitWindow()->LoadFontDefault() [core, text]
+ * - One default Texture2D is loaded on rlglInit(), 1x1 white pixel R8G8B8A8 [rlgl] (OpenGL 3.3 or ES2)
+ * - One default Shader is loaded on rlglInit()->rlLoadShaderDefault() [rlgl] (OpenGL 3.3 or ES2)
+ * - One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() [rlgl] (OpenGL 3.3 or ES2)
+ *
+ * DEPENDENCIES (included):
+ * [rcore] rglfw (Camilla Löwy - github.com/glfw/glfw) for window/context management and input (PLATFORM_DESKTOP)
+ * [rlgl] glad (David Herberth - github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading (PLATFORM_DESKTOP)
+ * [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management
+ *
+ * OPTIONAL DEPENDENCIES (included):
+ * [rcore] msf_gif (Miles Fogle) for GIF recording
+ * [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm
+ * [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm
+ * [rtextures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...)
+ * [rtextures] stb_image_write (Sean Barret) for image writing (BMP, TGA, PNG, JPG)
+ * [rtextures] stb_image_resize (Sean Barret) for image resizing algorithms
+ * [rtext] stb_truetype (Sean Barret) for ttf fonts loading
+ * [rtext] stb_rect_pack (Sean Barret) for rectangles packing
+ * [rmodels] par_shapes (Philip Rideout) for parametric 3d shapes generation
+ * [rmodels] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL)
+ * [rmodels] cgltf (Johannes Kuhlmann) for models loading (glTF)
+ * [rmodels] Model3D (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d)
+ * [raudio] dr_wav (David Reid) for WAV audio file loading
+ * [raudio] dr_flac (David Reid) for FLAC audio file loading
+ * [raudio] dr_mp3 (David Reid) for MP3 audio file loading
+ * [raudio] stb_vorbis (Sean Barret) for OGG audio loading
+ * [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading
+ * [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading
+ *
+ *
+ * LICENSE: zlib/libpng
+ *
+ * raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
+ * BSD-like license that allows static linking with closed source software:
+ *
+ * Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
+ *
+ * This software is provided "as-is", without any express or implied warranty. In no event
+ * will the authors be held liable for any damages arising from the use of this software.
+ *
+ * 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 RAYLIB_H
#define RAYLIB_H
-#include // Required for: va_list - Only used by TraceLogCallback
+#include // Required for: va_list - Only used by TraceLogCallback
#define RAYLIB_VERSION_MAJOR 5
#define RAYLIB_VERSION_MINOR 1
#define RAYLIB_VERSION_PATCH 0
-#define RAYLIB_VERSION "5.1-dev"
+#define RAYLIB_VERSION "5.1-dev"
// Function specifiers in case library is build/used as a shared library
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
// NOTE: visibility("default") attribute makes symbols "visible" when compiled with -fvisibility=hidden
#if defined(_WIN32)
- #if defined(__TINYC__)
- #define __declspec(x) __attribute__((x))
- #endif
- #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
+#if defined(__TINYC__)
+#define __declspec(x) __attribute__((x))
+#endif
+#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
#else
- #if defined(BUILD_LIBTYPE_SHARED)
- #define RLAPI __attribute__((visibility("default"))) // We are building as a Unix shared library (.so/.dylib)
- #endif
+#if defined(BUILD_LIBTYPE_SHARED)
+#define RLAPI __attribute__((visibility("default"))) // We are building as a Unix shared library (.so/.dylib)
+#endif
#endif
#ifndef RLAPI
- #define RLAPI // Functions defined as 'extern' by default (implicit specifiers)
+#define RLAPI // Functions defined as 'extern' by default (implicit specifiers)
#endif
//----------------------------------------------------------------------------------
// Some basic Defines
//----------------------------------------------------------------------------------
#ifndef PI
- #define PI 3.14159265358979323846f
+#define PI 3.14159265358979323846f
#endif
#ifndef DEG2RAD
- #define DEG2RAD (PI/180.0f)
+#define DEG2RAD (PI / 180.0f)
#endif
#ifndef RAD2DEG
- #define RAD2DEG (180.0f/PI)
+#define RAD2DEG (180.0f / PI)
#endif
// Allow custom memory allocators
// NOTE: Require recompiling raylib sources
#ifndef RL_MALLOC
- #define RL_MALLOC(sz) malloc(sz)
+#define RL_MALLOC(sz) malloc(sz)
#endif
#ifndef RL_CALLOC
- #define RL_CALLOC(n,sz) calloc(n,sz)
+#define RL_CALLOC(n, sz) calloc(n, sz)
#endif
#ifndef RL_REALLOC
- #define RL_REALLOC(ptr,sz) realloc(ptr,sz)
+#define RL_REALLOC(ptr, sz) realloc(ptr, sz)
#endif
#ifndef RL_FREE
- #define RL_FREE(ptr) free(ptr)
+#define RL_FREE(ptr) free(ptr)
#endif
// NOTE: MSVC C++ compiler does not support compound literals (C99 feature)
// Plain structures in C++ (without constructors) can be initialized with { }
// This is called aggregate initialization (C++11 feature)
#if defined(__cplusplus)
- #define CLITERAL(type) type
+#define CLITERAL(type) type
#else
- #define CLITERAL(type) (type)
+#define CLITERAL(type) (type)
#endif
// Some compilers (mostly macos clang) default to C++98,
// where aggregate initialization can't be used
// So, give a more clear error stating how to fix this
#if !defined(_MSC_VER) && (defined(__cplusplus) && __cplusplus < 201103L)
- #error "C++11 or later is required. Add -std=c++11"
+#error "C++11 or later is required. Add -std=c++11"
#endif
// NOTE: We set some defines with some data types declared by raylib
@@ -166,71 +166,105 @@
// Some Basic Colors
// NOTE: Custom raylib color palette for amazing visuals on WHITE background
-#define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray
-#define GRAY CLITERAL(Color){ 130, 130, 130, 255 } // Gray
-#define DARKGRAY CLITERAL(Color){ 80, 80, 80, 255 } // Dark Gray
-#define YELLOW CLITERAL(Color){ 253, 249, 0, 255 } // Yellow
-#define GOLD CLITERAL(Color){ 255, 203, 0, 255 } // Gold
-#define ORANGE CLITERAL(Color){ 255, 161, 0, 255 } // Orange
-#define PINK CLITERAL(Color){ 255, 109, 194, 255 } // Pink
-#define RED CLITERAL(Color){ 230, 41, 55, 255 } // Red
-#define MAROON CLITERAL(Color){ 190, 33, 55, 255 } // Maroon
-#define GREEN CLITERAL(Color){ 0, 228, 48, 255 } // Green
-#define LIME CLITERAL(Color){ 0, 158, 47, 255 } // Lime
-#define DARKGREEN CLITERAL(Color){ 0, 117, 44, 255 } // Dark Green
-#define SKYBLUE CLITERAL(Color){ 102, 191, 255, 255 } // Sky Blue
-#define BLUE CLITERAL(Color){ 0, 121, 241, 255 } // Blue
-#define DARKBLUE CLITERAL(Color){ 0, 82, 172, 255 } // Dark Blue
-#define PURPLE CLITERAL(Color){ 200, 122, 255, 255 } // Purple
-#define VIOLET CLITERAL(Color){ 135, 60, 190, 255 } // Violet
-#define DARKPURPLE CLITERAL(Color){ 112, 31, 126, 255 } // Dark Purple
-#define BEIGE CLITERAL(Color){ 211, 176, 131, 255 } // Beige
-#define BROWN CLITERAL(Color){ 127, 106, 79, 255 } // Brown
-#define DARKBROWN CLITERAL(Color){ 76, 63, 47, 255 } // Dark Brown
+#define LIGHTGRAY \
+ CLITERAL(Color) { 200, 200, 200, 255 } // Light Gray
+#define GRAY \
+ CLITERAL(Color) { 130, 130, 130, 255 } // Gray
+#define DARKGRAY \
+ CLITERAL(Color) { 80, 80, 80, 255 } // Dark Gray
+#define YELLOW \
+ CLITERAL(Color) { 253, 249, 0, 255 } // Yellow
+#define GOLD \
+ CLITERAL(Color) { 255, 203, 0, 255 } // Gold
+#define ORANGE \
+ CLITERAL(Color) { 255, 161, 0, 255 } // Orange
+#define PINK \
+ CLITERAL(Color) { 255, 109, 194, 255 } // Pink
+#define RED \
+ CLITERAL(Color) { 230, 41, 55, 255 } // Red
+#define MAROON \
+ CLITERAL(Color) { 190, 33, 55, 255 } // Maroon
+#define GREEN \
+ CLITERAL(Color) { 0, 228, 48, 255 } // Green
+#define LIME \
+ CLITERAL(Color) { 0, 158, 47, 255 } // Lime
+#define DARKGREEN \
+ CLITERAL(Color) { 0, 117, 44, 255 } // Dark Green
+#define SKYBLUE \
+ CLITERAL(Color) { 102, 191, 255, 255 } // Sky Blue
+#define BLUE \
+ CLITERAL(Color) { 0, 121, 241, 255 } // Blue
+#define DARKBLUE \
+ CLITERAL(Color) { 0, 82, 172, 255 } // Dark Blue
+#define PURPLE \
+ CLITERAL(Color) { 200, 122, 255, 255 } // Purple
+#define VIOLET \
+ CLITERAL(Color) { 135, 60, 190, 255 } // Violet
+#define DARKPURPLE \
+ CLITERAL(Color) { 112, 31, 126, 255 } // Dark Purple
+#define BEIGE \
+ CLITERAL(Color) { 211, 176, 131, 255 } // Beige
+#define BROWN \
+ CLITERAL(Color) { 127, 106, 79, 255 } // Brown
+#define DARKBROWN \
+ CLITERAL(Color) { 76, 63, 47, 255 } // Dark Brown
-#define WHITE CLITERAL(Color){ 255, 255, 255, 255 } // White
-#define BLACK CLITERAL(Color){ 0, 0, 0, 255 } // Black
-#define BLANK CLITERAL(Color){ 0, 0, 0, 0 } // Blank (Transparent)
-#define MAGENTA CLITERAL(Color){ 255, 0, 255, 255 } // Magenta
-#define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 } // My own White (raylib logo)
+#define WHITE \
+ CLITERAL(Color) { 255, 255, 255, 255 } // White
+#define BLACK \
+ CLITERAL(Color) { 0, 0, 0, 255 } // Black
+#define BLANK \
+ CLITERAL(Color) { 0, 0, 0, 0 } // Blank (Transparent)
+#define MAGENTA \
+ CLITERAL(Color) { 255, 0, 255, 255 } // Magenta
+#define RAYWHITE \
+ CLITERAL(Color) { 245, 245, 245, 255 } // My own White (raylib logo)
//----------------------------------------------------------------------------------
// Structures Definition
//----------------------------------------------------------------------------------
// Boolean type
#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
- #include
+#include
#elif !defined(__cplusplus) && !defined(bool)
- typedef enum bool { false = 0, true = !false } bool;
- #define RL_BOOL_TYPE
+typedef enum bool
+{
+ false = 0,
+ true = !false
+} bool;
+#define RL_BOOL_TYPE
#endif
// Vector2, 2 components
-typedef struct Vector2 {
- float x; // Vector x component
- float y; // Vector y component
+typedef struct Vector2
+{
+ float x; // Vector x component
+ float y; // Vector y component
} Vector2;
// Vector3, 3 components
-typedef struct Vector3 {
- float x; // Vector x component
- float y; // Vector y component
- float z; // Vector z component
+typedef struct Vector3
+{
+ float x; // Vector x component
+ float y; // Vector y component
+ float z; // Vector z component
} Vector3;
// Vector4, 4 components
-typedef struct Vector4 {
- float x; // Vector x component
- float y; // Vector y component
- float z; // Vector z component
- float w; // Vector w component
+typedef struct Vector4
+{
+ float x; // Vector x component
+ float y; // Vector y component
+ float z; // Vector z component
+ float w; // Vector w component
} Vector4;
// Quaternion, 4 components (Vector4 alias)
typedef Vector4 Quaternion;
// Matrix, 4x4 components, column major, OpenGL style, right-handed
-typedef struct Matrix {
+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)
@@ -238,37 +272,41 @@ typedef struct Matrix {
} Matrix;
// Color, 4 components, R8G8B8A8 (32bit)
-typedef struct Color {
- unsigned char r; // Color red value
- unsigned char g; // Color green value
- unsigned char b; // Color blue value
- unsigned char a; // Color alpha value
+typedef struct Color
+{
+ unsigned char r; // Color red value
+ unsigned char g; // Color green value
+ unsigned char b; // Color blue value
+ unsigned char a; // Color alpha value
} Color;
// Rectangle, 4 components
-typedef struct Rectangle {
- float x; // Rectangle top-left corner position x
- float y; // Rectangle top-left corner position y
- float width; // Rectangle width
- float height; // Rectangle height
+typedef struct Rectangle
+{
+ float x; // Rectangle top-left corner position x
+ float y; // Rectangle top-left corner position y
+ float width; // Rectangle width
+ float height; // Rectangle height
} Rectangle;
// Image, pixel data stored in CPU memory (RAM)
-typedef struct Image {
- void *data; // Image raw data
- int width; // Image base width
- int height; // Image base height
- int mipmaps; // Mipmap levels, 1 by default
- int format; // Data format (PixelFormat type)
+typedef struct Image
+{
+ void *data; // Image raw data
+ int width; // Image base width
+ int height; // Image base height
+ int mipmaps; // Mipmap levels, 1 by default
+ int format; // Data format (PixelFormat type)
} Image;
// Texture, tex data stored in GPU memory (VRAM)
-typedef struct Texture {
- 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)
+typedef struct Texture
+{
+ 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)
} Texture;
// Texture2D, same as Texture
@@ -278,76 +316,83 @@ typedef Texture Texture2D;
typedef Texture TextureCubemap;
// RenderTexture, fbo for texture rendering
-typedef struct RenderTexture {
- unsigned int id; // OpenGL framebuffer object id
- Texture texture; // Color buffer attachment texture
- Texture depth; // Depth buffer attachment texture
+typedef struct RenderTexture
+{
+ unsigned int id; // OpenGL framebuffer object id
+ Texture texture; // Color buffer attachment texture
+ Texture depth; // Depth buffer attachment texture
} RenderTexture;
// RenderTexture2D, same as RenderTexture
typedef RenderTexture RenderTexture2D;
// NPatchInfo, n-patch layout info
-typedef struct NPatchInfo {
- Rectangle source; // Texture source rectangle
- int left; // Left border offset
- int top; // Top border offset
- int right; // Right border offset
- int bottom; // Bottom border offset
- int layout; // Layout of the n-patch: 3x3, 1x3 or 3x1
+typedef struct NPatchInfo
+{
+ Rectangle source; // Texture source rectangle
+ int left; // Left border offset
+ int top; // Top border offset
+ int right; // Right border offset
+ int bottom; // Bottom border offset
+ int layout; // Layout of the n-patch: 3x3, 1x3 or 3x1
} NPatchInfo;
// 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
+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;
// Font, font texture and GlyphInfo array data
-typedef struct Font {
- int baseSize; // Base size (default chars height)
- int glyphCount; // Number of glyph characters
- int glyphPadding; // Padding around the glyph characters
- Texture2D texture; // Texture atlas containing the glyphs
- Rectangle *recs; // Rectangles in texture for the glyphs
- GlyphInfo *glyphs; // Glyphs info data
+typedef struct Font
+{
+ int baseSize; // Base size (default chars height)
+ int glyphCount; // Number of glyph characters
+ int glyphPadding; // Padding around the glyph characters
+ Texture2D texture; // Texture atlas containing the glyphs
+ Rectangle *recs; // Rectangles in texture for the glyphs
+ GlyphInfo *glyphs; // Glyphs info data
} Font;
// Camera, defines position/orientation in 3d space
-typedef struct Camera3D {
- Vector3 position; // Camera position
- Vector3 target; // Camera target it looks-at
- Vector3 up; // Camera up vector (rotation over its axis)
- float fovy; // Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
- int projection; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
+typedef struct Camera3D
+{
+ Vector3 position; // Camera position
+ Vector3 target; // Camera target it looks-at
+ Vector3 up; // Camera up vector (rotation over its axis)
+ float fovy; // Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
+ int projection; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
} Camera3D;
-typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D
+typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D
// Camera2D, defines position/orientation in 2d space
-typedef struct Camera2D {
- Vector2 offset; // Camera offset (displacement from target)
- Vector2 target; // Camera target (rotation and zoom origin)
- float rotation; // Camera rotation in degrees
- float zoom; // Camera zoom (scaling), should be 1.0f by default
+typedef struct Camera2D
+{
+ Vector2 offset; // Camera offset (displacement from target)
+ Vector2 target; // Camera target (rotation and zoom origin)
+ float rotation; // Camera rotation in degrees
+ float zoom; // Camera zoom (scaling), should be 1.0f by default
} Camera2D;
// Mesh, vertex data and vao/vbo
-typedef struct Mesh {
- int vertexCount; // Number of vertices stored in arrays
- int triangleCount; // Number of triangles stored (indexed or not)
+typedef struct Mesh
+{
+ int vertexCount; // Number of vertices stored in arrays
+ int triangleCount; // Number of triangles stored (indexed or not)
// Vertex attributes data
- float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
- float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
- float *texcoords2; // Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
- float *normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
- float *tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
- unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
- unsigned short *indices; // Vertex indices (in case vertex data comes indexed)
+ float *vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
+ float *texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
+ float *texcoords2; // Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
+ float *normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
+ float *tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
+ unsigned char *colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
+ unsigned short *indices; // Vertex indices (in case vertex data comes indexed)
// Animation vertex data
float *animVertices; // Animated vertex positions (after bones transformations)
@@ -356,61 +401,68 @@ typedef struct Mesh {
float *boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning)
// OpenGL identifiers
- unsigned int vaoId; // OpenGL Vertex Array Object id
- unsigned int *vboId; // OpenGL Vertex Buffer Objects id (default vertex data)
+ unsigned int vaoId; // OpenGL Vertex Array Object id
+ unsigned int *vboId; // OpenGL Vertex Buffer Objects id (default vertex data)
} Mesh;
// Shader
-typedef struct Shader {
- unsigned int id; // Shader program id
- int *locs; // Shader locations array (RL_MAX_SHADER_LOCATIONS)
+typedef struct Shader
+{
+ unsigned int id; // Shader program id
+ int *locs; // Shader locations array (RL_MAX_SHADER_LOCATIONS)
} Shader;
// MaterialMap
-typedef struct MaterialMap {
- Texture2D texture; // Material map texture
- Color color; // Material map color
- float value; // Material map value
+typedef struct MaterialMap
+{
+ Texture2D texture; // Material map texture
+ Color color; // Material map color
+ float value; // Material map value
} MaterialMap;
// Material, includes shader and maps
-typedef struct Material {
- Shader shader; // Material shader
- MaterialMap *maps; // Material maps array (MAX_MATERIAL_MAPS)
- float params[4]; // Material generic parameters (if required)
+typedef struct Material
+{
+ Shader shader; // Material shader
+ MaterialMap *maps; // Material maps array (MAX_MATERIAL_MAPS)
+ float params[4]; // Material generic parameters (if required)
} Material;
// Transform, vertex transformation data
-typedef struct Transform {
- Vector3 translation; // Translation
- Quaternion rotation; // Rotation
- Vector3 scale; // Scale
+typedef struct Transform
+{
+ Vector3 translation; // Translation
+ Quaternion rotation; // Rotation
+ Vector3 scale; // Scale
} Transform;
// Bone, skeletal animation bone
-typedef struct BoneInfo {
- char name[32]; // Bone name
- int parent; // Bone parent
+typedef struct BoneInfo
+{
+ char name[32]; // Bone name
+ int parent; // Bone parent
} BoneInfo;
// Model, meshes, materials and animation data
-typedef struct Model {
- Matrix transform; // Local transform matrix
+typedef struct Model
+{
+ Matrix transform; // Local transform matrix
- int meshCount; // Number of meshes
- int materialCount; // Number of materials
- Mesh *meshes; // Meshes array
- Material *materials; // Materials array
- int *meshMaterial; // Mesh material number
+ int meshCount; // Number of meshes
+ int materialCount; // Number of materials
+ Mesh *meshes; // Meshes array
+ Material *materials; // Materials array
+ int *meshMaterial; // Mesh material number
// Animation data
- int boneCount; // Number of bones
- BoneInfo *bones; // Bones information (skeleton)
- Transform *bindPose; // Bones base transformation (pose)
+ int boneCount; // Number of bones
+ BoneInfo *bones; // Bones information (skeleton)
+ Transform *bindPose; // Bones base transformation (pose)
} Model;
// ModelAnimation
-typedef struct ModelAnimation {
+typedef struct ModelAnimation
+{
int boneCount; // Number of bones
int frameCount; // Number of animation frames
BoneInfo *bones; // Bones information (skeleton)
@@ -419,32 +471,36 @@ typedef struct ModelAnimation {
} ModelAnimation;
// Ray, ray for raycasting
-typedef struct Ray {
- Vector3 position; // Ray position (origin)
- Vector3 direction; // Ray direction
+typedef struct Ray
+{
+ Vector3 position; // Ray position (origin)
+ Vector3 direction; // Ray direction
} Ray;
// RayCollision, ray hit information
-typedef struct RayCollision {
- bool hit; // Did the ray hit something?
- float distance; // Distance to the nearest hit
- Vector3 point; // Point of the nearest hit
- Vector3 normal; // Surface normal of hit
+typedef struct RayCollision
+{
+ bool hit; // Did the ray hit something?
+ float distance; // Distance to the nearest hit
+ Vector3 point; // Point of the nearest hit
+ Vector3 normal; // Surface normal of hit
} RayCollision;
// BoundingBox
-typedef struct BoundingBox {
- Vector3 min; // Minimum vertex box-corner
- Vector3 max; // Maximum vertex box-corner
+typedef struct BoundingBox
+{
+ Vector3 min; // Minimum vertex box-corner
+ Vector3 max; // Maximum vertex box-corner
} BoundingBox;
// Wave, audio wave data
-typedef struct Wave {
- unsigned int frameCount; // Total number of frames (considering channels)
- unsigned int sampleRate; // Frequency (samples per second)
- unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
- unsigned int channels; // Number of channels (1-mono, 2-stereo, ...)
- void *data; // Buffer data pointer
+typedef struct Wave
+{
+ unsigned int frameCount; // Total number of frames (considering channels)
+ unsigned int sampleRate; // Frequency (samples per second)
+ unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
+ unsigned int channels; // Number of channels (1-mono, 2-stereo, ...)
+ void *data; // Buffer data pointer
} Wave;
// Opaque structs declaration
@@ -453,75 +509,83 @@ typedef struct rAudioBuffer rAudioBuffer;
typedef struct rAudioProcessor rAudioProcessor;
// AudioStream, custom audio stream
-typedef struct AudioStream {
+typedef struct AudioStream
+{
rAudioBuffer *buffer; // Pointer to internal data used by the audio system
rAudioProcessor *processor; // Pointer to internal data processor, useful for audio effects
- unsigned int sampleRate; // Frequency (samples per second)
- unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
- unsigned int channels; // Number of channels (1-mono, 2-stereo, ...)
+ unsigned int sampleRate; // Frequency (samples per second)
+ unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
+ unsigned int channels; // Number of channels (1-mono, 2-stereo, ...)
} AudioStream;
// Sound
-typedef struct Sound {
- AudioStream stream; // Audio stream
- unsigned int frameCount; // Total number of frames (considering channels)
+typedef struct Sound
+{
+ AudioStream stream; // Audio stream
+ unsigned int frameCount; // Total number of frames (considering channels)
} Sound;
// Music, audio stream, anything longer than ~10 seconds should be streamed
-typedef struct Music {
- AudioStream stream; // Audio stream
- unsigned int frameCount; // Total number of frames (considering channels)
- bool looping; // Music looping enable
+typedef struct Music
+{
+ AudioStream stream; // Audio stream
+ unsigned int frameCount; // Total number of frames (considering channels)
+ bool looping; // Music looping enable
- int ctxType; // Type of music context (audio filetype)
- void *ctxData; // Audio context data, depends on type
+ int ctxType; // Type of music context (audio filetype)
+ void *ctxData; // Audio context data, depends on type
} Music;
// VrDeviceInfo, Head-Mounted-Display device parameters
-typedef struct VrDeviceInfo {
- int hResolution; // Horizontal resolution in pixels
- int vResolution; // Vertical resolution in pixels
- float hScreenSize; // Horizontal size in meters
- float vScreenSize; // Vertical size in meters
- float eyeToScreenDistance; // Distance between eye and display in meters
- float lensSeparationDistance; // Lens separation distance in meters
- float interpupillaryDistance; // IPD (distance between pupils) in meters
- float lensDistortionValues[4]; // Lens distortion constant parameters
- float chromaAbCorrection[4]; // Chromatic aberration correction parameters
+typedef struct VrDeviceInfo
+{
+ int hResolution; // Horizontal resolution in pixels
+ int vResolution; // Vertical resolution in pixels
+ float hScreenSize; // Horizontal size in meters
+ float vScreenSize; // Vertical size in meters
+ float eyeToScreenDistance; // Distance between eye and display in meters
+ float lensSeparationDistance; // Lens separation distance in meters
+ float interpupillaryDistance; // IPD (distance between pupils) in meters
+ float lensDistortionValues[4]; // Lens distortion constant parameters
+ float chromaAbCorrection[4]; // Chromatic aberration correction parameters
} VrDeviceInfo;
// VrStereoConfig, VR stereo rendering configuration for simulator
-typedef struct VrStereoConfig {
- Matrix projection[2]; // VR projection matrices (per eye)
- Matrix viewOffset[2]; // VR view offset matrices (per eye)
- float leftLensCenter[2]; // VR left lens center
- float rightLensCenter[2]; // VR right lens center
- float leftScreenCenter[2]; // VR left screen center
- float rightScreenCenter[2]; // VR right screen center
- float scale[2]; // VR distortion scale
- float scaleIn[2]; // VR distortion scale in
+typedef struct VrStereoConfig
+{
+ Matrix projection[2]; // VR projection matrices (per eye)
+ Matrix viewOffset[2]; // VR view offset matrices (per eye)
+ float leftLensCenter[2]; // VR left lens center
+ float rightLensCenter[2]; // VR right lens center
+ float leftScreenCenter[2]; // VR left screen center
+ float rightScreenCenter[2]; // VR right screen center
+ float scale[2]; // VR distortion scale
+ float scaleIn[2]; // VR distortion scale in
} VrStereoConfig;
// File path list
-typedef struct FilePathList {
- unsigned int capacity; // Filepaths max entries
- unsigned int count; // Filepaths entries count
- char **paths; // Filepaths entries
+typedef struct FilePathList
+{
+ unsigned int capacity; // Filepaths max entries
+ unsigned int count; // Filepaths entries count
+ char **paths; // Filepaths entries
} FilePathList;
// Automation event
-typedef struct AutomationEvent {
- unsigned int frame; // Event frame
- unsigned int type; // Event type (AutomationEventType)
- int params[4]; // Event parameters (if required)
+typedef struct AutomationEvent
+{
+ unsigned int frame; // Event frame
+ unsigned int type; // Event type (AutomationEventType)
+ int params[4]; // Event parameters (if required)
} AutomationEvent;
// Automation event list
-typedef struct AutomationEventList {
- unsigned int capacity; // Events max entries (MAX_AUTOMATION_EVENTS)
- unsigned int count; // Events entries count
- AutomationEvent *events; // Events entries
+typedef struct AutomationEventList
+{
+ unsigned int capacity; // Events max entries (MAX_AUTOMATION_EVENTS)
+ unsigned int count; // Events entries count
+ AutomationEvent *events; // Events entries
} AutomationEventList;
//----------------------------------------------------------------------------------
@@ -530,241 +594,250 @@ typedef struct AutomationEventList {
// System/Window config flags
// NOTE: Every bit registers one state (use it with bit masks)
// By default all flags are set to 0
-typedef enum {
- FLAG_VSYNC_HINT = 0x00000040, // Set to try enabling V-Sync on GPU
- FLAG_FULLSCREEN_MODE = 0x00000002, // Set to run program in fullscreen
- FLAG_WINDOW_RESIZABLE = 0x00000004, // Set to allow resizable window
- FLAG_WINDOW_UNDECORATED = 0x00000008, // Set to disable window decoration (frame and buttons)
- FLAG_WINDOW_HIDDEN = 0x00000080, // Set to hide window
- FLAG_WINDOW_MINIMIZED = 0x00000200, // Set to minimize window (iconify)
- FLAG_WINDOW_MAXIMIZED = 0x00000400, // Set to maximize window (expanded to monitor)
- FLAG_WINDOW_UNFOCUSED = 0x00000800, // Set to window non focused
- FLAG_WINDOW_TOPMOST = 0x00001000, // Set to window always on top
- FLAG_WINDOW_ALWAYS_RUN = 0x00000100, // Set to allow windows running while minimized
- FLAG_WINDOW_TRANSPARENT = 0x00000010, // Set to allow transparent framebuffer
- FLAG_WINDOW_HIGHDPI = 0x00002000, // Set to support HighDPI
+typedef enum
+{
+ FLAG_VSYNC_HINT = 0x00000040, // Set to try enabling V-Sync on GPU
+ FLAG_FULLSCREEN_MODE = 0x00000002, // Set to run program in fullscreen
+ FLAG_WINDOW_RESIZABLE = 0x00000004, // Set to allow resizable window
+ FLAG_WINDOW_UNDECORATED = 0x00000008, // Set to disable window decoration (frame and buttons)
+ FLAG_WINDOW_HIDDEN = 0x00000080, // Set to hide window
+ FLAG_WINDOW_MINIMIZED = 0x00000200, // Set to minimize window (iconify)
+ FLAG_WINDOW_MAXIMIZED = 0x00000400, // Set to maximize window (expanded to monitor)
+ FLAG_WINDOW_UNFOCUSED = 0x00000800, // Set to window non focused
+ FLAG_WINDOW_TOPMOST = 0x00001000, // Set to window always on top
+ FLAG_WINDOW_ALWAYS_RUN = 0x00000100, // Set to allow windows running while minimized
+ FLAG_WINDOW_TRANSPARENT = 0x00000010, // Set to allow transparent framebuffer
+ FLAG_WINDOW_HIGHDPI = 0x00002000, // Set to support HighDPI
FLAG_WINDOW_MOUSE_PASSTHROUGH = 0x00004000, // Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
FLAG_BORDERLESS_WINDOWED_MODE = 0x00008000, // Set to run program in borderless windowed mode
- FLAG_MSAA_4X_HINT = 0x00000020, // Set to try enabling MSAA 4X
- FLAG_INTERLACED_HINT = 0x00010000 // Set to try enabling interlaced video format (for V3D)
+ FLAG_MSAA_4X_HINT = 0x00000020, // Set to try enabling MSAA 4X
+ FLAG_INTERLACED_HINT = 0x00010000 // Set to try enabling interlaced video format (for V3D)
} ConfigFlags;
// Trace log level
// NOTE: Organized by priority level
-typedef enum {
- LOG_ALL = 0, // Display all logs
- LOG_TRACE, // Trace logging, intended for internal use only
- LOG_DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds
- LOG_INFO, // Info logging, used for program execution info
- LOG_WARNING, // Warning logging, used on recoverable failures
- LOG_ERROR, // Error logging, used on unrecoverable failures
- LOG_FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE)
- LOG_NONE // Disable logging
+typedef enum
+{
+ LOG_ALL = 0, // Display all logs
+ LOG_TRACE, // Trace logging, intended for internal use only
+ LOG_DEBUG, // Debug logging, used for internal debugging, it should be disabled on release builds
+ LOG_INFO, // Info logging, used for program execution info
+ LOG_WARNING, // Warning logging, used on recoverable failures
+ LOG_ERROR, // Error logging, used on unrecoverable failures
+ LOG_FATAL, // Fatal logging, used to abort program: exit(EXIT_FAILURE)
+ LOG_NONE // Disable logging
} TraceLogLevel;
// Keyboard keys (US keyboard layout)
// NOTE: Use GetKeyPressed() to allow redefining
// required keys for alternative layouts
-typedef enum {
- KEY_NULL = 0, // Key: NULL, used for no key pressed
+typedef enum
+{
+ KEY_NULL = 0, // Key: NULL, used for no key pressed
// Alphanumeric keys
- KEY_APOSTROPHE = 39, // Key: '
- KEY_COMMA = 44, // Key: ,
- KEY_MINUS = 45, // Key: -
- KEY_PERIOD = 46, // Key: .
- KEY_SLASH = 47, // Key: /
- KEY_ZERO = 48, // Key: 0
- KEY_ONE = 49, // Key: 1
- KEY_TWO = 50, // Key: 2
- KEY_THREE = 51, // Key: 3
- KEY_FOUR = 52, // Key: 4
- KEY_FIVE = 53, // Key: 5
- KEY_SIX = 54, // Key: 6
- KEY_SEVEN = 55, // Key: 7
- KEY_EIGHT = 56, // Key: 8
- KEY_NINE = 57, // Key: 9
- KEY_SEMICOLON = 59, // Key: ;
- KEY_EQUAL = 61, // Key: =
- KEY_A = 65, // Key: A | a
- KEY_B = 66, // Key: B | b
- KEY_C = 67, // Key: C | c
- KEY_D = 68, // Key: D | d
- KEY_E = 69, // Key: E | e
- KEY_F = 70, // Key: F | f
- KEY_G = 71, // Key: G | g
- KEY_H = 72, // Key: H | h
- KEY_I = 73, // Key: I | i
- KEY_J = 74, // Key: J | j
- KEY_K = 75, // Key: K | k
- KEY_L = 76, // Key: L | l
- KEY_M = 77, // Key: M | m
- KEY_N = 78, // Key: N | n
- KEY_O = 79, // Key: O | o
- KEY_P = 80, // Key: P | p
- KEY_Q = 81, // Key: Q | q
- KEY_R = 82, // Key: R | r
- KEY_S = 83, // Key: S | s
- KEY_T = 84, // Key: T | t
- KEY_U = 85, // Key: U | u
- KEY_V = 86, // Key: V | v
- KEY_W = 87, // Key: W | w
- KEY_X = 88, // Key: X | x
- KEY_Y = 89, // Key: Y | y
- KEY_Z = 90, // Key: Z | z
- KEY_LEFT_BRACKET = 91, // Key: [
- KEY_BACKSLASH = 92, // Key: '\'
- KEY_RIGHT_BRACKET = 93, // Key: ]
- KEY_GRAVE = 96, // Key: `
+ KEY_APOSTROPHE = 39, // Key: '
+ KEY_COMMA = 44, // Key: ,
+ KEY_MINUS = 45, // Key: -
+ KEY_PERIOD = 46, // Key: .
+ KEY_SLASH = 47, // Key: /
+ KEY_ZERO = 48, // Key: 0
+ KEY_ONE = 49, // Key: 1
+ KEY_TWO = 50, // Key: 2
+ KEY_THREE = 51, // Key: 3
+ KEY_FOUR = 52, // Key: 4
+ KEY_FIVE = 53, // Key: 5
+ KEY_SIX = 54, // Key: 6
+ KEY_SEVEN = 55, // Key: 7
+ KEY_EIGHT = 56, // Key: 8
+ KEY_NINE = 57, // Key: 9
+ KEY_SEMICOLON = 59, // Key: ;
+ KEY_EQUAL = 61, // Key: =
+ KEY_A = 65, // Key: A | a
+ KEY_B = 66, // Key: B | b
+ KEY_C = 67, // Key: C | c
+ KEY_D = 68, // Key: D | d
+ KEY_E = 69, // Key: E | e
+ KEY_F = 70, // Key: F | f
+ KEY_G = 71, // Key: G | g
+ KEY_H = 72, // Key: H | h
+ KEY_I = 73, // Key: I | i
+ KEY_J = 74, // Key: J | j
+ KEY_K = 75, // Key: K | k
+ KEY_L = 76, // Key: L | l
+ KEY_M = 77, // Key: M | m
+ KEY_N = 78, // Key: N | n
+ KEY_O = 79, // Key: O | o
+ KEY_P = 80, // Key: P | p
+ KEY_Q = 81, // Key: Q | q
+ KEY_R = 82, // Key: R | r
+ KEY_S = 83, // Key: S | s
+ KEY_T = 84, // Key: T | t
+ KEY_U = 85, // Key: U | u
+ KEY_V = 86, // Key: V | v
+ KEY_W = 87, // Key: W | w
+ KEY_X = 88, // Key: X | x
+ KEY_Y = 89, // Key: Y | y
+ KEY_Z = 90, // Key: Z | z
+ KEY_LEFT_BRACKET = 91, // Key: [
+ KEY_BACKSLASH = 92, // Key: '\'
+ KEY_RIGHT_BRACKET = 93, // Key: ]
+ KEY_GRAVE = 96, // Key: `
// Function keys
- KEY_SPACE = 32, // Key: Space
- KEY_ESCAPE = 256, // Key: Esc
- KEY_ENTER = 257, // Key: Enter
- KEY_TAB = 258, // Key: Tab
- KEY_BACKSPACE = 259, // Key: Backspace
- KEY_INSERT = 260, // Key: Ins
- KEY_DELETE = 261, // Key: Del
- KEY_RIGHT = 262, // Key: Cursor right
- KEY_LEFT = 263, // Key: Cursor left
- KEY_DOWN = 264, // Key: Cursor down
- KEY_UP = 265, // Key: Cursor up
- KEY_PAGE_UP = 266, // Key: Page up
- KEY_PAGE_DOWN = 267, // Key: Page down
- KEY_HOME = 268, // Key: Home
- KEY_END = 269, // Key: End
- KEY_CAPS_LOCK = 280, // Key: Caps lock
- KEY_SCROLL_LOCK = 281, // Key: Scroll down
- KEY_NUM_LOCK = 282, // Key: Num lock
- KEY_PRINT_SCREEN = 283, // Key: Print screen
- KEY_PAUSE = 284, // Key: Pause
- KEY_F1 = 290, // Key: F1
- KEY_F2 = 291, // Key: F2
- KEY_F3 = 292, // Key: F3
- KEY_F4 = 293, // Key: F4
- KEY_F5 = 294, // Key: F5
- KEY_F6 = 295, // Key: F6
- KEY_F7 = 296, // Key: F7
- KEY_F8 = 297, // Key: F8
- KEY_F9 = 298, // Key: F9
- KEY_F10 = 299, // Key: F10
- KEY_F11 = 300, // Key: F11
- KEY_F12 = 301, // Key: F12
- KEY_LEFT_SHIFT = 340, // Key: Shift left
- KEY_LEFT_CONTROL = 341, // Key: Control left
- KEY_LEFT_ALT = 342, // Key: Alt left
- KEY_LEFT_SUPER = 343, // Key: Super left
- KEY_RIGHT_SHIFT = 344, // Key: Shift right
- KEY_RIGHT_CONTROL = 345, // Key: Control right
- KEY_RIGHT_ALT = 346, // Key: Alt right
- KEY_RIGHT_SUPER = 347, // Key: Super right
- KEY_KB_MENU = 348, // Key: KB menu
+ KEY_SPACE = 32, // Key: Space
+ KEY_ESCAPE = 256, // Key: Esc
+ KEY_ENTER = 257, // Key: Enter
+ KEY_TAB = 258, // Key: Tab
+ KEY_BACKSPACE = 259, // Key: Backspace
+ KEY_INSERT = 260, // Key: Ins
+ KEY_DELETE = 261, // Key: Del
+ KEY_RIGHT = 262, // Key: Cursor right
+ KEY_LEFT = 263, // Key: Cursor left
+ KEY_DOWN = 264, // Key: Cursor down
+ KEY_UP = 265, // Key: Cursor up
+ KEY_PAGE_UP = 266, // Key: Page up
+ KEY_PAGE_DOWN = 267, // Key: Page down
+ KEY_HOME = 268, // Key: Home
+ KEY_END = 269, // Key: End
+ KEY_CAPS_LOCK = 280, // Key: Caps lock
+ KEY_SCROLL_LOCK = 281, // Key: Scroll down
+ KEY_NUM_LOCK = 282, // Key: Num lock
+ KEY_PRINT_SCREEN = 283, // Key: Print screen
+ KEY_PAUSE = 284, // Key: Pause
+ KEY_F1 = 290, // Key: F1
+ KEY_F2 = 291, // Key: F2
+ KEY_F3 = 292, // Key: F3
+ KEY_F4 = 293, // Key: F4
+ KEY_F5 = 294, // Key: F5
+ KEY_F6 = 295, // Key: F6
+ KEY_F7 = 296, // Key: F7
+ KEY_F8 = 297, // Key: F8
+ KEY_F9 = 298, // Key: F9
+ KEY_F10 = 299, // Key: F10
+ KEY_F11 = 300, // Key: F11
+ KEY_F12 = 301, // Key: F12
+ KEY_LEFT_SHIFT = 340, // Key: Shift left
+ KEY_LEFT_CONTROL = 341, // Key: Control left
+ KEY_LEFT_ALT = 342, // Key: Alt left
+ KEY_LEFT_SUPER = 343, // Key: Super left
+ KEY_RIGHT_SHIFT = 344, // Key: Shift right
+ KEY_RIGHT_CONTROL = 345, // Key: Control right
+ KEY_RIGHT_ALT = 346, // Key: Alt right
+ KEY_RIGHT_SUPER = 347, // Key: Super right
+ KEY_KB_MENU = 348, // Key: KB menu
// Keypad keys
- KEY_KP_0 = 320, // Key: Keypad 0
- KEY_KP_1 = 321, // Key: Keypad 1
- KEY_KP_2 = 322, // Key: Keypad 2
- KEY_KP_3 = 323, // Key: Keypad 3
- KEY_KP_4 = 324, // Key: Keypad 4
- KEY_KP_5 = 325, // Key: Keypad 5
- KEY_KP_6 = 326, // Key: Keypad 6
- KEY_KP_7 = 327, // Key: Keypad 7
- KEY_KP_8 = 328, // Key: Keypad 8
- KEY_KP_9 = 329, // Key: Keypad 9
- KEY_KP_DECIMAL = 330, // Key: Keypad .
- KEY_KP_DIVIDE = 331, // Key: Keypad /
- KEY_KP_MULTIPLY = 332, // Key: Keypad *
- KEY_KP_SUBTRACT = 333, // Key: Keypad -
- KEY_KP_ADD = 334, // Key: Keypad +
- KEY_KP_ENTER = 335, // Key: Keypad Enter
- KEY_KP_EQUAL = 336, // Key: Keypad =
+ KEY_KP_0 = 320, // Key: Keypad 0
+ KEY_KP_1 = 321, // Key: Keypad 1
+ KEY_KP_2 = 322, // Key: Keypad 2
+ KEY_KP_3 = 323, // Key: Keypad 3
+ KEY_KP_4 = 324, // Key: Keypad 4
+ KEY_KP_5 = 325, // Key: Keypad 5
+ KEY_KP_6 = 326, // Key: Keypad 6
+ KEY_KP_7 = 327, // Key: Keypad 7
+ KEY_KP_8 = 328, // Key: Keypad 8
+ KEY_KP_9 = 329, // Key: Keypad 9
+ KEY_KP_DECIMAL = 330, // Key: Keypad .
+ KEY_KP_DIVIDE = 331, // Key: Keypad /
+ KEY_KP_MULTIPLY = 332, // Key: Keypad *
+ KEY_KP_SUBTRACT = 333, // Key: Keypad -
+ KEY_KP_ADD = 334, // Key: Keypad +
+ KEY_KP_ENTER = 335, // Key: Keypad Enter
+ KEY_KP_EQUAL = 336, // Key: Keypad =
// Android key buttons
- KEY_BACK = 4, // Key: Android back button
- KEY_MENU = 5, // Key: Android menu button
- KEY_VOLUME_UP = 24, // Key: Android volume up button
- KEY_VOLUME_DOWN = 25 // Key: Android volume down button
+ KEY_BACK = 4, // Key: Android back button
+ KEY_MENU = 5, // Key: Android menu button
+ KEY_VOLUME_UP = 24, // Key: Android volume up button
+ KEY_VOLUME_DOWN = 25 // Key: Android volume down button
} KeyboardKey;
// Add backwards compatibility support for deprecated names
-#define MOUSE_LEFT_BUTTON MOUSE_BUTTON_LEFT
-#define MOUSE_RIGHT_BUTTON MOUSE_BUTTON_RIGHT
+#define MOUSE_LEFT_BUTTON MOUSE_BUTTON_LEFT
+#define MOUSE_RIGHT_BUTTON MOUSE_BUTTON_RIGHT
#define MOUSE_MIDDLE_BUTTON MOUSE_BUTTON_MIDDLE
// Mouse buttons
-typedef enum {
- MOUSE_BUTTON_LEFT = 0, // Mouse button left
- MOUSE_BUTTON_RIGHT = 1, // Mouse button right
- MOUSE_BUTTON_MIDDLE = 2, // Mouse button middle (pressed wheel)
- MOUSE_BUTTON_SIDE = 3, // Mouse button side (advanced mouse device)
- MOUSE_BUTTON_EXTRA = 4, // Mouse button extra (advanced mouse device)
- MOUSE_BUTTON_FORWARD = 5, // Mouse button forward (advanced mouse device)
- MOUSE_BUTTON_BACK = 6, // Mouse button back (advanced mouse device)
+typedef enum
+{
+ MOUSE_BUTTON_LEFT = 0, // Mouse button left
+ MOUSE_BUTTON_RIGHT = 1, // Mouse button right
+ MOUSE_BUTTON_MIDDLE = 2, // Mouse button middle (pressed wheel)
+ MOUSE_BUTTON_SIDE = 3, // Mouse button side (advanced mouse device)
+ MOUSE_BUTTON_EXTRA = 4, // Mouse button extra (advanced mouse device)
+ MOUSE_BUTTON_FORWARD = 5, // Mouse button forward (advanced mouse device)
+ MOUSE_BUTTON_BACK = 6, // Mouse button back (advanced mouse device)
} MouseButton;
// Mouse cursor
-typedef enum {
- MOUSE_CURSOR_DEFAULT = 0, // Default pointer shape
- MOUSE_CURSOR_ARROW = 1, // Arrow shape
- MOUSE_CURSOR_IBEAM = 2, // Text writing cursor shape
- MOUSE_CURSOR_CROSSHAIR = 3, // Cross shape
- MOUSE_CURSOR_POINTING_HAND = 4, // Pointing hand cursor
- MOUSE_CURSOR_RESIZE_EW = 5, // Horizontal resize/move arrow shape
- MOUSE_CURSOR_RESIZE_NS = 6, // Vertical resize/move arrow shape
- MOUSE_CURSOR_RESIZE_NWSE = 7, // Top-left to bottom-right diagonal resize/move arrow shape
- MOUSE_CURSOR_RESIZE_NESW = 8, // The top-right to bottom-left diagonal resize/move arrow shape
- MOUSE_CURSOR_RESIZE_ALL = 9, // The omnidirectional resize/move cursor shape
- MOUSE_CURSOR_NOT_ALLOWED = 10 // The operation-not-allowed shape
+typedef enum
+{
+ MOUSE_CURSOR_DEFAULT = 0, // Default pointer shape
+ MOUSE_CURSOR_ARROW = 1, // Arrow shape
+ MOUSE_CURSOR_IBEAM = 2, // Text writing cursor shape
+ MOUSE_CURSOR_CROSSHAIR = 3, // Cross shape
+ MOUSE_CURSOR_POINTING_HAND = 4, // Pointing hand cursor
+ MOUSE_CURSOR_RESIZE_EW = 5, // Horizontal resize/move arrow shape
+ MOUSE_CURSOR_RESIZE_NS = 6, // Vertical resize/move arrow shape
+ MOUSE_CURSOR_RESIZE_NWSE = 7, // Top-left to bottom-right diagonal resize/move arrow shape
+ MOUSE_CURSOR_RESIZE_NESW = 8, // The top-right to bottom-left diagonal resize/move arrow shape
+ MOUSE_CURSOR_RESIZE_ALL = 9, // The omnidirectional resize/move cursor shape
+ MOUSE_CURSOR_NOT_ALLOWED = 10 // The operation-not-allowed shape
} MouseCursor;
// Gamepad buttons
-typedef enum {
- GAMEPAD_BUTTON_UNKNOWN = 0, // Unknown button, just for error checking
- GAMEPAD_BUTTON_LEFT_FACE_UP, // Gamepad left DPAD up button
- GAMEPAD_BUTTON_LEFT_FACE_RIGHT, // Gamepad left DPAD right button
- GAMEPAD_BUTTON_LEFT_FACE_DOWN, // Gamepad left DPAD down button
- GAMEPAD_BUTTON_LEFT_FACE_LEFT, // Gamepad left DPAD left button
- GAMEPAD_BUTTON_RIGHT_FACE_UP, // Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)
- GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, // Gamepad right button right (i.e. PS3: Circle, Xbox: B)
- GAMEPAD_BUTTON_RIGHT_FACE_DOWN, // Gamepad right button down (i.e. PS3: Cross, Xbox: A)
- GAMEPAD_BUTTON_RIGHT_FACE_LEFT, // Gamepad right button left (i.e. PS3: Square, Xbox: X)
- GAMEPAD_BUTTON_LEFT_TRIGGER_1, // Gamepad top/back trigger left (first), it could be a trailing button
- GAMEPAD_BUTTON_LEFT_TRIGGER_2, // Gamepad top/back trigger left (second), it could be a trailing button
- GAMEPAD_BUTTON_RIGHT_TRIGGER_1, // Gamepad top/back trigger right (first), it could be a trailing button
- GAMEPAD_BUTTON_RIGHT_TRIGGER_2, // Gamepad top/back trigger right (second), it could be a trailing button
- GAMEPAD_BUTTON_MIDDLE_LEFT, // Gamepad center buttons, left one (i.e. PS3: Select)
- GAMEPAD_BUTTON_MIDDLE, // Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)
- GAMEPAD_BUTTON_MIDDLE_RIGHT, // Gamepad center buttons, right one (i.e. PS3: Start)
- GAMEPAD_BUTTON_LEFT_THUMB, // Gamepad joystick pressed button left
- GAMEPAD_BUTTON_RIGHT_THUMB // Gamepad joystick pressed button right
+typedef enum
+{
+ GAMEPAD_BUTTON_UNKNOWN = 0, // Unknown button, just for error checking
+ GAMEPAD_BUTTON_LEFT_FACE_UP, // Gamepad left DPAD up button
+ GAMEPAD_BUTTON_LEFT_FACE_RIGHT, // Gamepad left DPAD right button
+ GAMEPAD_BUTTON_LEFT_FACE_DOWN, // Gamepad left DPAD down button
+ GAMEPAD_BUTTON_LEFT_FACE_LEFT, // Gamepad left DPAD left button
+ GAMEPAD_BUTTON_RIGHT_FACE_UP, // Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)
+ GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, // Gamepad right button right (i.e. PS3: Circle, Xbox: B)
+ GAMEPAD_BUTTON_RIGHT_FACE_DOWN, // Gamepad right button down (i.e. PS3: Cross, Xbox: A)
+ GAMEPAD_BUTTON_RIGHT_FACE_LEFT, // Gamepad right button left (i.e. PS3: Square, Xbox: X)
+ GAMEPAD_BUTTON_LEFT_TRIGGER_1, // Gamepad top/back trigger left (first), it could be a trailing button
+ GAMEPAD_BUTTON_LEFT_TRIGGER_2, // Gamepad top/back trigger left (second), it could be a trailing button
+ GAMEPAD_BUTTON_RIGHT_TRIGGER_1, // Gamepad top/back trigger right (first), it could be a trailing button
+ GAMEPAD_BUTTON_RIGHT_TRIGGER_2, // Gamepad top/back trigger right (second), it could be a trailing button
+ GAMEPAD_BUTTON_MIDDLE_LEFT, // Gamepad center buttons, left one (i.e. PS3: Select)
+ GAMEPAD_BUTTON_MIDDLE, // Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)
+ GAMEPAD_BUTTON_MIDDLE_RIGHT, // Gamepad center buttons, right one (i.e. PS3: Start)
+ GAMEPAD_BUTTON_LEFT_THUMB, // Gamepad joystick pressed button left
+ GAMEPAD_BUTTON_RIGHT_THUMB // Gamepad joystick pressed button right
} GamepadButton;
// Gamepad axis
-typedef enum {
- GAMEPAD_AXIS_LEFT_X = 0, // Gamepad left stick X axis
- GAMEPAD_AXIS_LEFT_Y = 1, // Gamepad left stick Y axis
- GAMEPAD_AXIS_RIGHT_X = 2, // Gamepad right stick X axis
- GAMEPAD_AXIS_RIGHT_Y = 3, // Gamepad right stick Y axis
- GAMEPAD_AXIS_LEFT_TRIGGER = 4, // Gamepad back trigger left, pressure level: [1..-1]
- GAMEPAD_AXIS_RIGHT_TRIGGER = 5 // Gamepad back trigger right, pressure level: [1..-1]
+typedef enum
+{
+ GAMEPAD_AXIS_LEFT_X = 0, // Gamepad left stick X axis
+ GAMEPAD_AXIS_LEFT_Y = 1, // Gamepad left stick Y axis
+ GAMEPAD_AXIS_RIGHT_X = 2, // Gamepad right stick X axis
+ GAMEPAD_AXIS_RIGHT_Y = 3, // Gamepad right stick Y axis
+ GAMEPAD_AXIS_LEFT_TRIGGER = 4, // Gamepad back trigger left, pressure level: [1..-1]
+ GAMEPAD_AXIS_RIGHT_TRIGGER = 5 // Gamepad back trigger right, pressure level: [1..-1]
} GamepadAxis;
// Material map index
-typedef enum {
- MATERIAL_MAP_ALBEDO = 0, // Albedo material (same as: MATERIAL_MAP_DIFFUSE)
- MATERIAL_MAP_METALNESS, // Metalness material (same as: MATERIAL_MAP_SPECULAR)
- MATERIAL_MAP_NORMAL, // Normal material
- MATERIAL_MAP_ROUGHNESS, // Roughness material
- MATERIAL_MAP_OCCLUSION, // Ambient occlusion material
- MATERIAL_MAP_EMISSION, // Emission material
- MATERIAL_MAP_HEIGHT, // Heightmap material
- MATERIAL_MAP_CUBEMAP, // Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
- MATERIAL_MAP_IRRADIANCE, // Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
- MATERIAL_MAP_PREFILTER, // Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
- MATERIAL_MAP_BRDF // Brdf material
+typedef enum
+{
+ MATERIAL_MAP_ALBEDO = 0, // Albedo material (same as: MATERIAL_MAP_DIFFUSE)
+ MATERIAL_MAP_METALNESS, // Metalness material (same as: MATERIAL_MAP_SPECULAR)
+ MATERIAL_MAP_NORMAL, // Normal material
+ MATERIAL_MAP_ROUGHNESS, // Roughness material
+ MATERIAL_MAP_OCCLUSION, // Ambient occlusion material
+ MATERIAL_MAP_EMISSION, // Emission material
+ MATERIAL_MAP_HEIGHT, // Heightmap material
+ MATERIAL_MAP_CUBEMAP, // Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
+ MATERIAL_MAP_IRRADIANCE, // Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
+ MATERIAL_MAP_PREFILTER, // Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
+ MATERIAL_MAP_BRDF // Brdf material
} MaterialMapIndex;
-#define MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO
-#define MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS
+#define MATERIAL_MAP_DIFFUSE MATERIAL_MAP_ALBEDO
+#define MATERIAL_MAP_SPECULAR MATERIAL_MAP_METALNESS
// Shader location index
-typedef enum {
+typedef enum
+{
SHADER_LOC_VERTEX_POSITION = 0, // Shader location: vertex attribute: position
SHADER_LOC_VERTEX_TEXCOORD01, // Shader location: vertex attribute: texcoord01
SHADER_LOC_VERTEX_TEXCOORD02, // Shader location: vertex attribute: texcoord02
@@ -793,33 +866,36 @@ typedef enum {
SHADER_LOC_MAP_BRDF // Shader location: sampler2d texture: brdf
} ShaderLocationIndex;
-#define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO
-#define SHADER_LOC_MAP_SPECULAR SHADER_LOC_MAP_METALNESS
+#define SHADER_LOC_MAP_DIFFUSE SHADER_LOC_MAP_ALBEDO
+#define SHADER_LOC_MAP_SPECULAR SHADER_LOC_MAP_METALNESS
// Shader uniform data type
-typedef enum {
- SHADER_UNIFORM_FLOAT = 0, // Shader uniform type: float
- SHADER_UNIFORM_VEC2, // Shader uniform type: vec2 (2 float)
- SHADER_UNIFORM_VEC3, // Shader uniform type: vec3 (3 float)
- SHADER_UNIFORM_VEC4, // Shader uniform type: vec4 (4 float)
- SHADER_UNIFORM_INT, // Shader uniform type: int
- SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int)
- SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int)
- SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int)
- SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d
+typedef enum
+{
+ SHADER_UNIFORM_FLOAT = 0, // Shader uniform type: float
+ SHADER_UNIFORM_VEC2, // Shader uniform type: vec2 (2 float)
+ SHADER_UNIFORM_VEC3, // Shader uniform type: vec3 (3 float)
+ SHADER_UNIFORM_VEC4, // Shader uniform type: vec4 (4 float)
+ SHADER_UNIFORM_INT, // Shader uniform type: int
+ SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int)
+ SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int)
+ SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int)
+ SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d
} ShaderUniformDataType;
// Shader attribute data types
-typedef enum {
- SHADER_ATTRIB_FLOAT = 0, // Shader attribute type: float
- SHADER_ATTRIB_VEC2, // Shader attribute type: vec2 (2 float)
- SHADER_ATTRIB_VEC3, // Shader attribute type: vec3 (3 float)
- SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float)
+typedef enum
+{
+ SHADER_ATTRIB_FLOAT = 0, // Shader attribute type: float
+ SHADER_ATTRIB_VEC2, // Shader attribute type: vec2 (2 float)
+ SHADER_ATTRIB_VEC3, // Shader attribute type: vec3 (3 float)
+ SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float)
} ShaderAttributeDataType;
// Pixel formats
// NOTE: Support depends on OpenGL version and platform
-typedef enum {
+typedef enum
+{
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels)
PIXELFORMAT_UNCOMPRESSED_R5G6B5, // 16 bpp
@@ -849,97 +925,106 @@ typedef enum {
// 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 {
- TEXTURE_FILTER_POINT = 0, // No filter, just pixel approximation
- TEXTURE_FILTER_BILINEAR, // Linear filtering
- TEXTURE_FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
- TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
- TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
- TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
+typedef enum
+{
+ TEXTURE_FILTER_POINT = 0, // No filter, just pixel approximation
+ TEXTURE_FILTER_BILINEAR, // Linear filtering
+ TEXTURE_FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
+ TEXTURE_FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
+ TEXTURE_FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
+ TEXTURE_FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
} TextureFilter;
// Texture parameters: wrap mode
-typedef enum {
- TEXTURE_WRAP_REPEAT = 0, // Repeats texture in tiled mode
- TEXTURE_WRAP_CLAMP, // Clamps texture to edge pixel in tiled mode
- TEXTURE_WRAP_MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode
- TEXTURE_WRAP_MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode
+typedef enum
+{
+ TEXTURE_WRAP_REPEAT = 0, // Repeats texture in tiled mode
+ TEXTURE_WRAP_CLAMP, // Clamps texture to edge pixel in tiled mode
+ TEXTURE_WRAP_MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode
+ TEXTURE_WRAP_MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode
} TextureWrap;
// Cubemap layouts
-typedef enum {
- CUBEMAP_LAYOUT_AUTO_DETECT = 0, // Automatically detect layout type
- CUBEMAP_LAYOUT_LINE_VERTICAL, // Layout is defined by a vertical line with faces
- CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by a horizontal line with faces
- CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces
- CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces
- CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirrectangular map)
+typedef enum
+{
+ CUBEMAP_LAYOUT_AUTO_DETECT = 0, // Automatically detect layout type
+ CUBEMAP_LAYOUT_LINE_VERTICAL, // Layout is defined by a vertical line with faces
+ CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by a horizontal line with faces
+ CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces
+ CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces
+ CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirrectangular map)
} CubemapLayout;
// Font type, defines generation method
-typedef enum {
- FONT_DEFAULT = 0, // Default font generation, anti-aliased
- FONT_BITMAP, // Bitmap font generation, no anti-aliasing
- FONT_SDF // SDF font generation, requires external shader
+typedef enum
+{
+ FONT_DEFAULT = 0, // Default font generation, anti-aliased
+ FONT_BITMAP, // Bitmap font generation, no anti-aliasing
+ FONT_SDF // SDF font generation, requires external shader
} FontType;
// Color blending modes (pre-defined)
-typedef enum {
- BLEND_ALPHA = 0, // Blend textures considering alpha (default)
- BLEND_ADDITIVE, // Blend textures adding colors
- BLEND_MULTIPLIED, // Blend textures multiplying colors
- BLEND_ADD_COLORS, // Blend textures adding colors (alternative)
- BLEND_SUBTRACT_COLORS, // Blend textures subtracting colors (alternative)
- BLEND_ALPHA_PREMULTIPLY, // Blend premultiplied textures considering alpha
- BLEND_CUSTOM, // Blend textures using custom src/dst factors (use rlSetBlendFactors())
- BLEND_CUSTOM_SEPARATE // Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())
+typedef enum
+{
+ BLEND_ALPHA = 0, // Blend textures considering alpha (default)
+ BLEND_ADDITIVE, // Blend textures adding colors
+ BLEND_MULTIPLIED, // Blend textures multiplying colors
+ BLEND_ADD_COLORS, // Blend textures adding colors (alternative)
+ BLEND_SUBTRACT_COLORS, // Blend textures subtracting colors (alternative)
+ BLEND_ALPHA_PREMULTIPLY, // Blend premultiplied textures considering alpha
+ BLEND_CUSTOM, // Blend textures using custom src/dst factors (use rlSetBlendFactors())
+ BLEND_CUSTOM_SEPARATE // Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())
} BlendMode;
// Gesture
// NOTE: Provided as bit-wise flags to enable only desired gestures
-typedef enum {
- GESTURE_NONE = 0, // No gesture
- GESTURE_TAP = 1, // Tap gesture
- GESTURE_DOUBLETAP = 2, // Double tap gesture
- GESTURE_HOLD = 4, // Hold gesture
- GESTURE_DRAG = 8, // Drag gesture
- GESTURE_SWIPE_RIGHT = 16, // Swipe right gesture
- GESTURE_SWIPE_LEFT = 32, // Swipe left gesture
- GESTURE_SWIPE_UP = 64, // Swipe up gesture
- GESTURE_SWIPE_DOWN = 128, // Swipe down gesture
- GESTURE_PINCH_IN = 256, // Pinch in gesture
- GESTURE_PINCH_OUT = 512 // Pinch out gesture
+typedef enum
+{
+ GESTURE_NONE = 0, // No gesture
+ GESTURE_TAP = 1, // Tap gesture
+ GESTURE_DOUBLETAP = 2, // Double tap gesture
+ GESTURE_HOLD = 4, // Hold gesture
+ GESTURE_DRAG = 8, // Drag gesture
+ GESTURE_SWIPE_RIGHT = 16, // Swipe right gesture
+ GESTURE_SWIPE_LEFT = 32, // Swipe left gesture
+ GESTURE_SWIPE_UP = 64, // Swipe up gesture
+ GESTURE_SWIPE_DOWN = 128, // Swipe down gesture
+ GESTURE_PINCH_IN = 256, // Pinch in gesture
+ GESTURE_PINCH_OUT = 512 // Pinch out gesture
} Gesture;
// Camera system modes
-typedef enum {
- CAMERA_CUSTOM = 0, // Camera custom, controlled by user (UpdateCamera() does nothing)
- CAMERA_FREE, // Camera free mode
- CAMERA_ORBITAL, // Camera orbital, around target, zoom supported
- CAMERA_FIRST_PERSON, // Camera first person
- CAMERA_THIRD_PERSON // Camera third person
+typedef enum
+{
+ CAMERA_CUSTOM = 0, // Camera custom, controlled by user (UpdateCamera() does nothing)
+ CAMERA_FREE, // Camera free mode
+ CAMERA_ORBITAL, // Camera orbital, around target, zoom supported
+ CAMERA_FIRST_PERSON, // Camera first person
+ CAMERA_THIRD_PERSON // Camera third person
} CameraMode;
// Camera projection
-typedef enum {
- CAMERA_PERSPECTIVE = 0, // Perspective projection
- CAMERA_ORTHOGRAPHIC // Orthographic projection
+typedef enum
+{
+ CAMERA_PERSPECTIVE = 0, // Perspective projection
+ CAMERA_ORTHOGRAPHIC // Orthographic projection
} CameraProjection;
// N-patch layout
-typedef enum {
- NPATCH_NINE_PATCH = 0, // Npatch layout: 3x3 tiles
- NPATCH_THREE_PATCH_VERTICAL, // Npatch layout: 1x3 tiles
- NPATCH_THREE_PATCH_HORIZONTAL // Npatch layout: 3x1 tiles
+typedef enum
+{
+ NPATCH_NINE_PATCH = 0, // Npatch layout: 3x3 tiles
+ NPATCH_THREE_PATCH_VERTICAL, // Npatch layout: 1x3 tiles
+ NPATCH_THREE_PATCH_HORIZONTAL // Npatch layout: 3x1 tiles
} NPatchLayout;
// Callbacks to hook some internal functions
// WARNING: These callbacks are intended for advanced users
-typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages
-typedef unsigned char *(*LoadFileDataCallback)(const char *fileName, int *dataSize); // FileIO: Load binary data
-typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, int dataSize); // FileIO: Save binary data
-typedef char *(*LoadFileTextCallback)(const char *fileName); // FileIO: Load text data
-typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileIO: Save text data
+typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages
+typedef unsigned char *(*LoadFileDataCallback)(const char *fileName, int *dataSize); // FileIO: Load binary data
+typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, int dataSize); // FileIO: Save binary data
+typedef char *(*LoadFileTextCallback)(const char *fileName); // FileIO: Load text data
+typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileIO: Save text data
//------------------------------------------------------------------------------------
// Global Variables Definition
@@ -951,726 +1036,730 @@ typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileI
//------------------------------------------------------------------------------------
#if defined(__cplusplus)
-extern "C" { // Prevents name mangling of functions
+extern "C"
+{ // Prevents name mangling of functions
#endif
-// Window-related functions
-RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
-RLAPI void CloseWindow(void); // Close window and unload OpenGL context
-RLAPI bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
-RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully
-RLAPI bool IsWindowFullscreen(void); // Check if window is currently fullscreen
-RLAPI bool IsWindowHidden(void); // Check if window is currently hidden (only PLATFORM_DESKTOP)
-RLAPI bool IsWindowMinimized(void); // Check if window is currently minimized (only PLATFORM_DESKTOP)
-RLAPI bool IsWindowMaximized(void); // Check if window is currently maximized (only PLATFORM_DESKTOP)
-RLAPI bool IsWindowFocused(void); // Check if window is currently focused (only PLATFORM_DESKTOP)
-RLAPI bool IsWindowResized(void); // Check if window has been resized last frame
-RLAPI bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled
-RLAPI void SetWindowState(unsigned int flags); // Set window configuration state using flags (only PLATFORM_DESKTOP)
-RLAPI void ClearWindowState(unsigned int flags); // Clear window configuration state flags
-RLAPI void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
-RLAPI void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
-RLAPI void MaximizeWindow(void); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
-RLAPI void MinimizeWindow(void); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
-RLAPI void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
-RLAPI void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
-RLAPI void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
-RLAPI void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)
-RLAPI void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP)
-RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window
-RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
-RLAPI void SetWindowMaxSize(int width, int height); // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
-RLAPI void SetWindowSize(int width, int height); // Set window dimensions
-RLAPI void SetWindowOpacity(float opacity); // Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
-RLAPI void SetWindowFocused(void); // Set window focused (only PLATFORM_DESKTOP)
-RLAPI void *GetWindowHandle(void); // Get native window handle
-RLAPI int GetScreenWidth(void); // Get current screen width
-RLAPI int GetScreenHeight(void); // Get current screen height
-RLAPI int GetRenderWidth(void); // Get current render width (it considers HiDPI)
-RLAPI int GetRenderHeight(void); // Get current render height (it considers HiDPI)
-RLAPI int GetMonitorCount(void); // Get number of connected monitors
-RLAPI int GetCurrentMonitor(void); // Get current connected monitor
-RLAPI Vector2 GetMonitorPosition(int monitor); // Get specified monitor position
-RLAPI int GetMonitorWidth(int monitor); // Get specified monitor width (current video mode used by monitor)
-RLAPI int GetMonitorHeight(int monitor); // Get specified monitor height (current video mode used by monitor)
-RLAPI int GetMonitorPhysicalWidth(int monitor); // Get specified monitor physical width in millimetres
-RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres
-RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
-RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
-RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor
-RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
-RLAPI void SetClipboardText(const char *text); // Set clipboard text content
-RLAPI const char *GetClipboardText(void); // Get clipboard text content
-RLAPI void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling
-RLAPI void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling
+ // Window-related functions
+ RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
+ RLAPI void CloseWindow(void); // Close window and unload OpenGL context
+ RLAPI bool WindowShouldClose(void); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
+ RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully
+ RLAPI bool IsWindowFullscreen(void); // Check if window is currently fullscreen
+ RLAPI bool IsWindowHidden(void); // Check if window is currently hidden (only PLATFORM_DESKTOP)
+ RLAPI bool IsWindowMinimized(void); // Check if window is currently minimized (only PLATFORM_DESKTOP)
+ RLAPI bool IsWindowMaximized(void); // Check if window is currently maximized (only PLATFORM_DESKTOP)
+ RLAPI bool IsWindowFocused(void); // Check if window is currently focused (only PLATFORM_DESKTOP)
+ RLAPI bool IsWindowResized(void); // Check if window has been resized last frame
+ RLAPI bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled
+ RLAPI void SetWindowState(unsigned int flags); // Set window configuration state using flags (only PLATFORM_DESKTOP)
+ RLAPI void ClearWindowState(unsigned int flags); // Clear window configuration state flags
+ RLAPI void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
+ RLAPI void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
+ RLAPI void MaximizeWindow(void); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
+ RLAPI void MinimizeWindow(void); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
+ RLAPI void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
+ RLAPI void SetWindowIcon(Image image); // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
+ RLAPI void SetWindowIcons(Image *images, int count); // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
+ RLAPI void SetWindowTitle(const char *title); // Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)
+ RLAPI void SetWindowPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP)
+ RLAPI void SetWindowMonitor(int monitor); // Set monitor for the current window
+ RLAPI void SetWindowMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
+ RLAPI void SetWindowMaxSize(int width, int height); // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
+ RLAPI void SetWindowSize(int width, int height); // Set window dimensions
+ RLAPI void SetWindowOpacity(float opacity); // Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
+ RLAPI void SetWindowFocused(void); // Set window focused (only PLATFORM_DESKTOP)
+ RLAPI void *GetWindowHandle(void); // Get native window handle
+ RLAPI int GetScreenWidth(void); // Get current screen width
+ RLAPI int GetScreenHeight(void); // Get current screen height
+ RLAPI int GetRenderWidth(void); // Get current render width (it considers HiDPI)
+ RLAPI int GetRenderHeight(void); // Get current render height (it considers HiDPI)
+ RLAPI int GetMonitorCount(void); // Get number of connected monitors
+ RLAPI int GetCurrentMonitor(void); // Get current connected monitor
+ RLAPI Vector2 GetMonitorPosition(int monitor); // Get specified monitor position
+ RLAPI int GetMonitorWidth(int monitor); // Get specified monitor width (current video mode used by monitor)
+ RLAPI int GetMonitorHeight(int monitor); // Get specified monitor height (current video mode used by monitor)
+ RLAPI int GetMonitorPhysicalWidth(int monitor); // Get specified monitor physical width in millimetres
+ RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres
+ RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
+ RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
+ RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor
+ RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
+ RLAPI void SetClipboardText(const char *text); // Set clipboard text content
+ RLAPI const char *GetClipboardText(void); // Get clipboard text content
+ RLAPI void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling
+ RLAPI void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling
-// Cursor-related functions
-RLAPI void ShowCursor(void); // Shows cursor
-RLAPI void HideCursor(void); // Hides cursor
-RLAPI bool IsCursorHidden(void); // Check if cursor is not visible
-RLAPI void EnableCursor(void); // Enables cursor (unlock cursor)
-RLAPI void DisableCursor(void); // Disables cursor (lock cursor)
-RLAPI bool IsCursorOnScreen(void); // Check if cursor is on the screen
+ // Cursor-related functions
+ RLAPI void ShowCursor(void); // Shows cursor
+ RLAPI void HideCursor(void); // Hides cursor
+ RLAPI bool IsCursorHidden(void); // Check if cursor is not visible
+ RLAPI void EnableCursor(void); // Enables cursor (unlock cursor)
+ RLAPI void DisableCursor(void); // Disables cursor (lock cursor)
+ RLAPI bool IsCursorOnScreen(void); // Check if cursor is on the screen
-// Drawing-related functions
-RLAPI void ClearBackground(Color color); // Set background color (framebuffer clear color)
-RLAPI void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing
-RLAPI void EndDrawing(void); // End canvas drawing and swap buffers (double buffering)
-RLAPI void BeginMode2D(Camera2D camera); // Begin 2D mode with custom camera (2D)
-RLAPI void EndMode2D(void); // Ends 2D mode with custom camera
-RLAPI void BeginMode3D(Camera3D camera); // Begin 3D mode with custom camera (3D)
-RLAPI void EndMode3D(void); // Ends 3D mode and returns to default 2D orthographic mode
-RLAPI void BeginTextureMode(RenderTexture2D target); // Begin drawing to render texture
-RLAPI void EndTextureMode(void); // Ends drawing to render texture
-RLAPI void BeginShaderMode(Shader shader); // Begin custom shader drawing
-RLAPI void EndShaderMode(void); // End custom shader drawing (use default shader)
-RLAPI void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied, subtract, custom)
-RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
-RLAPI void BeginScissorMode(int x, int y, int width, int height); // Begin scissor mode (define screen area for following drawing)
-RLAPI void EndScissorMode(void); // End scissor mode
-RLAPI void BeginVrStereoMode(VrStereoConfig config); // Begin stereo rendering (requires VR simulator)
-RLAPI void EndVrStereoMode(void); // End stereo rendering (requires VR simulator)
+ // Drawing-related functions
+ RLAPI void ClearBackground(Color color); // Set background color (framebuffer clear color)
+ RLAPI void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing
+ RLAPI void EndDrawing(void); // End canvas drawing and swap buffers (double buffering)
+ RLAPI void BeginMode2D(Camera2D camera); // Begin 2D mode with custom camera (2D)
+ RLAPI void EndMode2D(void); // Ends 2D mode with custom camera
+ RLAPI void BeginMode3D(Camera3D camera); // Begin 3D mode with custom camera (3D)
+ RLAPI void EndMode3D(void); // Ends 3D mode and returns to default 2D orthographic mode
+ RLAPI void BeginTextureMode(RenderTexture2D target); // Begin drawing to render texture
+ RLAPI void EndTextureMode(void); // Ends drawing to render texture
+ RLAPI void BeginShaderMode(Shader shader); // Begin custom shader drawing
+ RLAPI void EndShaderMode(void); // End custom shader drawing (use default shader)
+ RLAPI void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied, subtract, custom)
+ RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
+ RLAPI void BeginScissorMode(int x, int y, int width, int height); // Begin scissor mode (define screen area for following drawing)
+ RLAPI void EndScissorMode(void); // End scissor mode
+ RLAPI void BeginVrStereoMode(VrStereoConfig config); // Begin stereo rendering (requires VR simulator)
+ RLAPI void EndVrStereoMode(void); // End stereo rendering (requires VR simulator)
-// VR stereo config functions for VR simulator
-RLAPI VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device); // Load VR stereo config for VR simulator device parameters
-RLAPI void UnloadVrStereoConfig(VrStereoConfig config); // Unload VR stereo config
+ // VR stereo config functions for VR simulator
+ RLAPI VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device); // Load VR stereo config for VR simulator device parameters
+ RLAPI void UnloadVrStereoConfig(VrStereoConfig config); // Unload VR stereo config
-// Shader management functions
-// NOTE: Shader functionality is not available on OpenGL 1.1
-RLAPI Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
-RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
-RLAPI bool IsShaderReady(Shader shader); // Check if a shader is ready
-RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
-RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
-RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
-RLAPI void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count); // Set shader uniform value vector
-RLAPI void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4)
-RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture (sampler2d)
-RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
+ // Shader management functions
+ // NOTE: Shader functionality is not available on OpenGL 1.1
+ RLAPI Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
+ RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
+ RLAPI bool IsShaderReady(Shader shader); // Check if a shader is ready
+ RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
+ RLAPI int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
+ RLAPI void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
+ RLAPI void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count); // Set shader uniform value vector
+ RLAPI void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4)
+ RLAPI void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture (sampler2d)
+ RLAPI void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
// Screen-space-related functions
-#define GetMouseRay GetScreenToWorldRay // Compatibility hack for previous raylib versions
-RLAPI Ray GetScreenToWorldRay(Vector2 position, Camera camera); // Get a ray trace from screen position (i.e mouse)
-RLAPI Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height); // Get a ray trace from screen position (i.e mouse) in a viewport
-RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get the screen space position for a 3d world space position
-RLAPI Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Get size position for a 3d world space position
-RLAPI Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Get the screen space position for a 2d camera world space position
-RLAPI Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Get the world space position for a 2d camera screen space position
-RLAPI Matrix GetCameraMatrix(Camera camera); // Get camera transform matrix (view matrix)
-RLAPI Matrix GetCameraMatrix2D(Camera2D camera); // Get camera 2d transform matrix
+#define GetMouseRay GetScreenToWorldRay // Compatibility hack for previous raylib versions
+ RLAPI Ray GetScreenToWorldRay(Vector2 position, Camera camera); // Get a ray trace from screen position (i.e mouse)
+ RLAPI Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height); // Get a ray trace from screen position (i.e mouse) in a viewport
+ RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Get the screen space position for a 3d world space position
+ RLAPI Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Get size position for a 3d world space position
+ RLAPI Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Get the screen space position for a 2d camera world space position
+ RLAPI Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Get the world space position for a 2d camera screen space position
+ RLAPI Matrix GetCameraMatrix(Camera camera); // Get camera transform matrix (view matrix)
+ RLAPI Matrix GetCameraMatrix2D(Camera2D camera); // Get camera 2d transform matrix
-// Timing-related functions
-RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
-RLAPI float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time)
-RLAPI double GetTime(void); // Get elapsed time in seconds since InitWindow()
-RLAPI int GetFPS(void); // Get current FPS
+ // Timing-related functions
+ RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
+ RLAPI float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time)
+ RLAPI double GetTime(void); // Get elapsed time in seconds since InitWindow()
+ RLAPI int GetFPS(void); // Get current FPS
-// Custom frame control functions
-// NOTE: Those functions are intended for advanced users that want full control over the frame processing
-// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
-// To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
-RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
-RLAPI void PollInputEvents(void); // Register all input events
-RLAPI void WaitTime(double seconds); // Wait for some time (halt program execution)
+ // Custom frame control functions
+ // NOTE: Those functions are intended for advanced users that want full control over the frame processing
+ // By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
+ // To avoid that behaviour and control frame processes manually, enable in config.h: SUPPORT_CUSTOM_FRAME_CONTROL
+ RLAPI void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing)
+ RLAPI void PollInputEvents(void); // Register all input events
+ RLAPI void WaitTime(double seconds); // Wait for some time (halt program execution)
-// Random values generation functions
-RLAPI void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator
-RLAPI int GetRandomValue(int min, int max); // Get a random value between min and max (both included)
-RLAPI int *LoadRandomSequence(unsigned int count, int min, int max); // Load random values sequence, no values repeated
-RLAPI void UnloadRandomSequence(int *sequence); // Unload random values sequence
+ // Random values generation functions
+ RLAPI void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator
+ RLAPI int GetRandomValue(int min, int max); // Get a random value between min and max (both included)
+ RLAPI int *LoadRandomSequence(unsigned int count, int min, int max); // Load random values sequence, no values repeated
+ RLAPI void UnloadRandomSequence(int *sequence); // Unload random values sequence
-// Misc. functions
-RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
-RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
-RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available)
+ // Misc. functions
+ RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
+ RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
+ RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available)
-// NOTE: Following functions implemented in module [utils]
-//------------------------------------------------------------------
-RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
-RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
-RLAPI void *MemAlloc(unsigned int size); // Internal memory allocator
-RLAPI void *MemRealloc(void *ptr, unsigned int size); // Internal memory reallocator
-RLAPI void MemFree(void *ptr); // Internal memory free
+ // NOTE: Following functions implemented in module [utils]
+ //------------------------------------------------------------------
+ RLAPI void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
+ RLAPI void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
+ RLAPI void *MemAlloc(unsigned int size); // Internal memory allocator
+ RLAPI void *MemRealloc(void *ptr, unsigned int size); // Internal memory reallocator
+ RLAPI void MemFree(void *ptr); // Internal memory free
-// Set custom callbacks
-// WARNING: Callbacks setup is intended for advanced users
-RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
-RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
-RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
-RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
-RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
+ // Set custom callbacks
+ // WARNING: Callbacks setup is intended for advanced users
+ RLAPI void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
+ RLAPI void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
+ RLAPI void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
+ RLAPI void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
+ RLAPI void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
-// Files management functions
-RLAPI unsigned char *LoadFileData(const char *fileName, int *dataSize); // Load file data as byte array (read)
-RLAPI void UnloadFileData(unsigned char *data); // Unload file data allocated by LoadFileData()
-RLAPI bool SaveFileData(const char *fileName, void *data, int dataSize); // Save data to file from byte array (write), returns true on success
-RLAPI bool ExportDataAsCode(const unsigned char *data, int dataSize, const char *fileName); // Export data to code (.h), returns true on success
-RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string
-RLAPI void UnloadFileText(char *text); // Unload file text data allocated by LoadFileText()
-RLAPI bool SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success
-//------------------------------------------------------------------
+ // Files management functions
+ RLAPI unsigned char *LoadFileData(const char *fileName, int *dataSize); // Load file data as byte array (read)
+ RLAPI void UnloadFileData(unsigned char *data); // Unload file data allocated by LoadFileData()
+ RLAPI bool SaveFileData(const char *fileName, void *data, int dataSize); // Save data to file from byte array (write), returns true on success
+ RLAPI bool ExportDataAsCode(const unsigned char *data, int dataSize, const char *fileName); // Export data to code (.h), returns true on success
+ RLAPI char *LoadFileText(const char *fileName); // Load text data from file (read), returns a '\0' terminated string
+ RLAPI void UnloadFileText(char *text); // Unload file text data allocated by LoadFileText()
+ RLAPI bool SaveFileText(const char *fileName, char *text); // Save text data to file (write), string must be '\0' terminated, returns true on success
+ //------------------------------------------------------------------
-// File system functions
-RLAPI bool FileExists(const char *fileName); // Check if file exists
-RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists
-RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (including point: .png, .wav)
-RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
-RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png')
-RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
-RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string)
-RLAPI const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string)
-RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
-RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
-RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
-RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
-RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
-RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
-RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths
-RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan
-RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
-RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
-RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths
-RLAPI void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths
-RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
+ // File system functions
+ RLAPI bool FileExists(const char *fileName); // Check if file exists
+ RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists
+ RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (including point: .png, .wav)
+ RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
+ RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png')
+ RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
+ RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string)
+ RLAPI const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string)
+ RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
+ RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
+ RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
+ RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
+ RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
+ RLAPI bool IsFileNameValid(const char *fileName); // Check if fileName is valid for the platform/OS
+ RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths
+ RLAPI FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan
+ RLAPI void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
+ RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
+ RLAPI FilePathList LoadDroppedFiles(void); // Load dropped filepaths
+ RLAPI void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths
+ RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
-// Compression/Encoding functionality
-RLAPI unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDataSize); // Compress data (DEFLATE algorithm), memory must be MemFree()
-RLAPI unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree()
-RLAPI char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string, memory must be MemFree()
-RLAPI unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree()
+ // Compression/Encoding functionality
+ RLAPI unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDataSize); // Compress data (DEFLATE algorithm), memory must be MemFree()
+ RLAPI unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree()
+ RLAPI char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string, memory must be MemFree()
+ RLAPI unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree()
-// Automation events functionality
-RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
-RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
-RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file
-RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to
-RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
-RLAPI void StartAutomationEventRecording(void); // Start recording automation events (AutomationEventList must be set)
-RLAPI void StopAutomationEventRecording(void); // Stop recording automation events
-RLAPI void PlayAutomationEvent(AutomationEvent event); // Play a recorded automation event
+ // Automation events functionality
+ RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
+ RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
+ RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file
+ RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to
+ RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
+ RLAPI void StartAutomationEventRecording(void); // Start recording automation events (AutomationEventList must be set)
+ RLAPI void StopAutomationEventRecording(void); // Stop recording automation events
+ RLAPI void PlayAutomationEvent(AutomationEvent event); // Play a recorded automation event
-//------------------------------------------------------------------------------------
-// Input Handling Functions (Module: core)
-//------------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------
+ // Input Handling Functions (Module: core)
+ //------------------------------------------------------------------------------------
-// Input-related functions: keyboard
-RLAPI bool IsKeyPressed(int key); // Check if a key has been pressed once
-RLAPI bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again (Only PLATFORM_DESKTOP)
-RLAPI bool IsKeyDown(int key); // Check if a key is being pressed
-RLAPI bool IsKeyReleased(int key); // Check if a key has been released once
-RLAPI bool IsKeyUp(int key); // Check if a key is NOT being pressed
-RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
-RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
-RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
+ // Input-related functions: keyboard
+ RLAPI bool IsKeyPressed(int key); // Check if a key has been pressed once
+ RLAPI bool IsKeyPressedRepeat(int key); // Check if a key has been pressed again (Only PLATFORM_DESKTOP)
+ RLAPI bool IsKeyDown(int key); // Check if a key is being pressed
+ RLAPI bool IsKeyReleased(int key); // Check if a key has been released once
+ RLAPI bool IsKeyUp(int key); // Check if a key is NOT being pressed
+ RLAPI int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
+ RLAPI int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
+ RLAPI void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
-// Input-related functions: gamepads
-RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available
-RLAPI const char *GetGamepadName(int gamepad); // Get gamepad internal name id
-RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once
-RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed
-RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once
-RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed
-RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
-RLAPI int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad
-RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis
-RLAPI int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
-RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor); // Set gamepad vibration for both motors
+ // Input-related functions: gamepads
+ RLAPI bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available
+ RLAPI const char *GetGamepadName(int gamepad); // Get gamepad internal name id
+ RLAPI bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once
+ RLAPI bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed
+ RLAPI bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once
+ RLAPI bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed
+ RLAPI int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
+ RLAPI int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad
+ RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis
+ RLAPI int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
+ RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor); // Set gamepad vibration for both motors
-// Input-related functions: mouse
-RLAPI bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once
-RLAPI bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed
-RLAPI bool IsMouseButtonReleased(int button); // Check if a mouse button has been released once
-RLAPI bool IsMouseButtonUp(int button); // Check if a mouse button is NOT being pressed
-RLAPI int GetMouseX(void); // Get mouse position X
-RLAPI int GetMouseY(void); // Get mouse position Y
-RLAPI Vector2 GetMousePosition(void); // Get mouse position XY
-RLAPI Vector2 GetMouseDelta(void); // Get mouse delta between frames
-RLAPI void SetMousePosition(int x, int y); // Set mouse position XY
-RLAPI void SetMouseOffset(int offsetX, int offsetY); // Set mouse offset
-RLAPI void SetMouseScale(float scaleX, float scaleY); // Set mouse scaling
-RLAPI float GetMouseWheelMove(void); // Get mouse wheel movement for X or Y, whichever is larger
-RLAPI Vector2 GetMouseWheelMoveV(void); // Get mouse wheel movement for both X and Y
-RLAPI void SetMouseCursor(int cursor); // Set mouse cursor
+ // Input-related functions: mouse
+ RLAPI bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once
+ RLAPI bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed
+ RLAPI bool IsMouseButtonReleased(int button); // Check if a mouse button has been released once
+ RLAPI bool IsMouseButtonUp(int button); // Check if a mouse button is NOT being pressed
+ RLAPI int GetMouseX(void); // Get mouse position X
+ RLAPI int GetMouseY(void); // Get mouse position Y
+ RLAPI Vector2 GetMousePosition(void); // Get mouse position XY
+ RLAPI Vector2 GetMouseDelta(void); // Get mouse delta between frames
+ RLAPI void SetMousePosition(int x, int y); // Set mouse position XY
+ RLAPI void SetMouseOffset(int offsetX, int offsetY); // Set mouse offset
+ RLAPI void SetMouseScale(float scaleX, float scaleY); // Set mouse scaling
+ RLAPI float GetMouseWheelMove(void); // Get mouse wheel movement for X or Y, whichever is larger
+ RLAPI Vector2 GetMouseWheelMoveV(void); // Get mouse wheel movement for both X and Y
+ RLAPI void SetMouseCursor(int cursor); // Set mouse cursor
-// Input-related functions: touch
-RLAPI int GetTouchX(void); // Get touch position X for touch point 0 (relative to screen size)
-RLAPI int GetTouchY(void); // Get touch position Y for touch point 0 (relative to screen size)
-RLAPI Vector2 GetTouchPosition(int index); // Get touch position XY for a touch point index (relative to screen size)
-RLAPI int GetTouchPointId(int index); // Get touch point identifier for given index
-RLAPI int GetTouchPointCount(void); // Get number of touch points
+ // Input-related functions: touch
+ RLAPI int GetTouchX(void); // Get touch position X for touch point 0 (relative to screen size)
+ RLAPI int GetTouchY(void); // Get touch position Y for touch point 0 (relative to screen size)
+ RLAPI Vector2 GetTouchPosition(int index); // Get touch position XY for a touch point index (relative to screen size)
+ RLAPI int GetTouchPointId(int index); // Get touch point identifier for given index
+ RLAPI int GetTouchPointCount(void); // Get number of touch points
-//------------------------------------------------------------------------------------
-// Gestures and Touch Handling Functions (Module: rgestures)
-//------------------------------------------------------------------------------------
-RLAPI void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
-RLAPI bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected
-RLAPI int GetGestureDetected(void); // Get latest detected gesture
-RLAPI float GetGestureHoldDuration(void); // Get gesture hold time in milliseconds
-RLAPI Vector2 GetGestureDragVector(void); // Get gesture drag vector
-RLAPI float GetGestureDragAngle(void); // Get gesture drag angle
-RLAPI Vector2 GetGesturePinchVector(void); // Get gesture pinch delta
-RLAPI float GetGesturePinchAngle(void); // Get gesture pinch angle
+ //------------------------------------------------------------------------------------
+ // Gestures and Touch Handling Functions (Module: rgestures)
+ //------------------------------------------------------------------------------------
+ RLAPI void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
+ RLAPI bool IsGestureDetected(unsigned int gesture); // Check if a gesture have been detected
+ RLAPI int GetGestureDetected(void); // Get latest detected gesture
+ RLAPI float GetGestureHoldDuration(void); // Get gesture hold time in milliseconds
+ RLAPI Vector2 GetGestureDragVector(void); // Get gesture drag vector
+ RLAPI float GetGestureDragAngle(void); // Get gesture drag angle
+ RLAPI Vector2 GetGesturePinchVector(void); // Get gesture pinch delta
+ RLAPI float GetGesturePinchAngle(void); // Get gesture pinch angle
-//------------------------------------------------------------------------------------
-// Camera System Functions (Module: rcamera)
-//------------------------------------------------------------------------------------
-RLAPI void UpdateCamera(Camera *camera, int mode); // Update camera position for selected mode
-RLAPI void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom); // Update camera movement/rotation
+ //------------------------------------------------------------------------------------
+ // Camera System Functions (Module: rcamera)
+ //------------------------------------------------------------------------------------
+ RLAPI void UpdateCamera(Camera *camera, int mode); // Update camera position for selected mode
+ RLAPI void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom); // Update camera movement/rotation
-//------------------------------------------------------------------------------------
-// Basic Shapes Drawing Functions (Module: shapes)
-//------------------------------------------------------------------------------------
-// Set texture and rectangle to be used on shapes drawing
-// NOTE: It can be useful when using basic shapes and one single font,
-// defining a font char white rectangle would allow drawing everything in a single draw call
-RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Set texture and rectangle to be used on shapes drawing
-RLAPI Texture2D GetShapesTexture(void); // Get texture that is used for shapes drawing
-RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
+ //------------------------------------------------------------------------------------
+ // Basic Shapes Drawing Functions (Module: shapes)
+ //------------------------------------------------------------------------------------
+ // Set texture and rectangle to be used on shapes drawing
+ // NOTE: It can be useful when using basic shapes and one single font,
+ // defining a font char white rectangle would allow drawing everything in a single draw call
+ RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Set texture and rectangle to be used on shapes drawing
+ RLAPI Texture2D GetShapesTexture(void); // Get texture that is used for shapes drawing
+ RLAPI Rectangle GetShapesTextureRectangle(void); // Get texture source rectangle that is used for shapes drawing
-// Basic shapes drawing functions
-RLAPI void DrawPixel(int posX, int posY, Color color); // Draw a pixel
-RLAPI void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version)
-RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
-RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
-RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
-RLAPI void DrawLineStrip(Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
-RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
-RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
-RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
-RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
-RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
-RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
-RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
-RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
-RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
-RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
-RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring
-RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
-RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
-RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
-RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
-RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
-RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a vertical-gradient-filled rectangle
-RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a horizontal-gradient-filled rectangle
-RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors
-RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
-RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
-RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
-RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle lines with rounded edges
-RLAPI void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline
-RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
-RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
-RLAPI void DrawTriangleFan(Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
-RLAPI void DrawTriangleStrip(Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
-RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
-RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
-RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
+ // Basic shapes drawing functions
+ RLAPI void DrawPixel(int posX, int posY, Color color); // Draw a pixel
+ RLAPI void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version)
+ RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
+ RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
+ RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
+ RLAPI void DrawLineStrip(Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
+ RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
+ RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
+ RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
+ RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
+ RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
+ RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
+ RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
+ RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
+ RLAPI void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
+ RLAPI void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
+ RLAPI void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring
+ RLAPI void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
+ RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
+ RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
+ RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
+ RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
+ RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a vertical-gradient-filled rectangle
+ RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a horizontal-gradient-filled rectangle
+ RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors
+ RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
+ RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
+ RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
+ RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle lines with rounded edges
+ RLAPI void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline
+ RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
+ RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
+ RLAPI void DrawTriangleFan(Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
+ RLAPI void DrawTriangleStrip(Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
+ RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
+ RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
+ RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
-// Splines drawing functions
-RLAPI void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
-RLAPI void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
-RLAPI void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
-RLAPI void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
-RLAPI void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
-RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
-RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
-RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
-RLAPI void DrawSplineSegmentBezierQuadratic(Vector2 p1, Vector2 c2, Vector2 p3, float thick, Color color); // Draw spline segment: Quadratic Bezier, 2 points, 1 control point
-RLAPI void DrawSplineSegmentBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float thick, Color color); // Draw spline segment: Cubic Bezier, 2 points, 2 control points
+ // Splines drawing functions
+ RLAPI void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
+ RLAPI void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
+ RLAPI void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
+ RLAPI void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
+ RLAPI void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
+ RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
+ RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
+ RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
+ RLAPI void DrawSplineSegmentBezierQuadratic(Vector2 p1, Vector2 c2, Vector2 p3, float thick, Color color); // Draw spline segment: Quadratic Bezier, 2 points, 1 control point
+ RLAPI void DrawSplineSegmentBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float thick, Color color); // Draw spline segment: Cubic Bezier, 2 points, 2 control points
-// Spline segment point evaluation functions, for a given t [0.0f .. 1.0f]
-RLAPI Vector2 GetSplinePointLinear(Vector2 startPos, Vector2 endPos, float t); // Get (evaluate) spline point: Linear
-RLAPI Vector2 GetSplinePointBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); // Get (evaluate) spline point: B-Spline
-RLAPI Vector2 GetSplinePointCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); // Get (evaluate) spline point: Catmull-Rom
-RLAPI Vector2 GetSplinePointBezierQuad(Vector2 p1, Vector2 c2, Vector2 p3, float t); // Get (evaluate) spline point: Quadratic Bezier
-RLAPI Vector2 GetSplinePointBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float t); // Get (evaluate) spline point: Cubic Bezier
+ // Spline segment point evaluation functions, for a given t [0.0f .. 1.0f]
+ RLAPI Vector2 GetSplinePointLinear(Vector2 startPos, Vector2 endPos, float t); // Get (evaluate) spline point: Linear
+ RLAPI Vector2 GetSplinePointBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); // Get (evaluate) spline point: B-Spline
+ RLAPI Vector2 GetSplinePointCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float t); // Get (evaluate) spline point: Catmull-Rom
+ RLAPI Vector2 GetSplinePointBezierQuad(Vector2 p1, Vector2 c2, Vector2 p3, float t); // Get (evaluate) spline point: Quadratic Bezier
+ RLAPI Vector2 GetSplinePointBezierCubic(Vector2 p1, Vector2 c2, Vector2 c3, Vector2 p4, float t); // Get (evaluate) spline point: Cubic Bezier
-// Basic shapes collision detection functions
-RLAPI bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles
-RLAPI bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles
-RLAPI bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle
-RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
-RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
-RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
-RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
-RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
-RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
-RLAPI bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); // Check if circle collides with a line created betweeen two points [p1] and [p2]
-RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
+ // Basic shapes collision detection functions
+ RLAPI bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2); // Check collision between two rectangles
+ RLAPI bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2); // Check collision between two circles
+ RLAPI bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec); // Check collision between circle and rectangle
+ RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
+ RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
+ RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
+ RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
+ RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
+ RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
+ RLAPI bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); // Check if circle collides with a line created betweeen two points [p1] and [p2]
+ RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
-//------------------------------------------------------------------------------------
-// Texture Loading and Drawing Functions (Module: textures)
-//------------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------
+ // Texture Loading and Drawing Functions (Module: textures)
+ //------------------------------------------------------------------------------------
-// Image loading functions
-// NOTE: These functions do not require GPU access
-RLAPI Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
-RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
-RLAPI Image LoadImageSvg(const char *fileNameOrString, int width, int height); // Load image from SVG file data or string with specified size
-RLAPI Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data)
-RLAPI Image LoadImageAnimFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int *frames); // Load image sequence from memory buffer
-RLAPI Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer, fileType refers to extension: i.e. '.png'
-RLAPI Image LoadImageFromTexture(Texture2D texture); // Load image from GPU texture data
-RLAPI Image LoadImageFromScreen(void); // Load image from screen buffer and (screenshot)
-RLAPI bool IsImageReady(Image image); // Check if an image is ready
-RLAPI void UnloadImage(Image image); // Unload image from CPU memory (RAM)
-RLAPI bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success
-RLAPI unsigned char *ExportImageToMemory(Image image, const char *fileType, int *fileSize); // Export image to memory buffer
-RLAPI bool ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes, returns true on success
+ // Image loading functions
+ // NOTE: These functions do not require GPU access
+ RLAPI Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
+ RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
+ RLAPI Image LoadImageSvg(const char *fileNameOrString, int width, int height); // Load image from SVG file data or string with specified size
+ RLAPI Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data)
+ RLAPI Image LoadImageAnimFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int *frames); // Load image sequence from memory buffer
+ RLAPI Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer, fileType refers to extension: i.e. '.png'
+ RLAPI Image LoadImageFromTexture(Texture2D texture); // Load image from GPU texture data
+ RLAPI Image LoadImageFromScreen(void); // Load image from screen buffer and (screenshot)
+ RLAPI bool IsImageReady(Image image); // Check if an image is ready
+ RLAPI void UnloadImage(Image image); // Unload image from CPU memory (RAM)
+ RLAPI bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success
+ RLAPI unsigned char *ExportImageToMemory(Image image, const char *fileType, int *fileSize); // Export image to memory buffer
+ RLAPI bool ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes, returns true on success
-// Image generation functions
-RLAPI Image GenImageColor(int width, int height, Color color); // Generate image: plain color
-RLAPI Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end); // Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient
-RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
-RLAPI Image GenImageGradientSquare(int width, int height, float density, Color inner, Color outer); // Generate image: square gradient
-RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
-RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise
-RLAPI Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise
-RLAPI Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm, bigger tileSize means bigger cells
-RLAPI Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data
+ // Image generation functions
+ RLAPI Image GenImageColor(int width, int height, Color color); // Generate image: plain color
+ RLAPI Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end); // Generate image: linear gradient, direction in degrees [0..360], 0=Vertical gradient
+ RLAPI Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer); // Generate image: radial gradient
+ RLAPI Image GenImageGradientSquare(int width, int height, float density, Color inner, Color outer); // Generate image: square gradient
+ RLAPI Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2); // Generate image: checked
+ RLAPI Image GenImageWhiteNoise(int width, int height, float factor); // Generate image: white noise
+ RLAPI Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale); // Generate image: perlin noise
+ RLAPI Image GenImageCellular(int width, int height, int tileSize); // Generate image: cellular algorithm, bigger tileSize means bigger cells
+ RLAPI Image GenImageText(int width, int height, const char *text); // Generate image: grayscale image from text data
-// Image manipulation functions
-RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
-RLAPI Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece
-RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
-RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
-RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
-RLAPI void ImageToPOT(Image *image, Color fill); // Convert image to POT (power-of-two)
-RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
-RLAPI void ImageAlphaCrop(Image *image, float threshold); // Crop image depending on alpha value
-RLAPI void ImageAlphaClear(Image *image, Color color, float threshold); // Clear alpha channel to desired color
-RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
-RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
-RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
-RLAPI void ImageKernelConvolution(Image *image, float* kernel, int kernelSize); // Apply Custom Square image convolution kernel
-RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
-RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
-RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
-RLAPI void ImageMipmaps(Image *image); // Compute all mipmap levels for a provided image
-RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
-RLAPI void ImageFlipVertical(Image *image); // Flip image vertically
-RLAPI void ImageFlipHorizontal(Image *image); // Flip image horizontally
-RLAPI void ImageRotate(Image *image, int degrees); // Rotate image by input angle in degrees (-359 to 359)
-RLAPI void ImageRotateCW(Image *image); // Rotate image clockwise 90deg
-RLAPI void ImageRotateCCW(Image *image); // Rotate image counter-clockwise 90deg
-RLAPI void ImageColorTint(Image *image, Color color); // Modify image color: tint
-RLAPI void ImageColorInvert(Image *image); // Modify image color: invert
-RLAPI void ImageColorGrayscale(Image *image); // Modify image color: grayscale
-RLAPI void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100)
-RLAPI void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255)
-RLAPI void ImageColorReplace(Image *image, Color color, Color replace); // Modify image color: replace color
-RLAPI Color *LoadImageColors(Image image); // Load color data from image as a Color array (RGBA - 32bit)
-RLAPI Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount); // Load colors palette from image as a Color array (RGBA - 32bit)
-RLAPI void UnloadImageColors(Color *colors); // Unload color data loaded with LoadImageColors()
-RLAPI void UnloadImagePalette(Color *colors); // Unload colors palette loaded with LoadImagePalette()
-RLAPI Rectangle GetImageAlphaBorder(Image image, float threshold); // Get image alpha border rectangle
-RLAPI Color GetImageColor(Image image, int x, int y); // Get image pixel color at (x, y) position
+ // Image manipulation functions
+ RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
+ RLAPI Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece
+ RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
+ RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
+ RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
+ RLAPI void ImageToPOT(Image *image, Color fill); // Convert image to POT (power-of-two)
+ RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
+ RLAPI void ImageAlphaCrop(Image *image, float threshold); // Crop image depending on alpha value
+ RLAPI void ImageAlphaClear(Image *image, Color color, float threshold); // Clear alpha channel to desired color
+ RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
+ RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
+ RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
+ RLAPI void ImageKernelConvolution(Image *image, float *kernel, int kernelSize); // Apply Custom Square image convolution kernel
+ RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
+ RLAPI void ImageResizeNN(Image *image, int newWidth, int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
+ RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
+ RLAPI void ImageMipmaps(Image *image); // Compute all mipmap levels for a provided image
+ RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
+ RLAPI void ImageFlipVertical(Image *image); // Flip image vertically
+ RLAPI void ImageFlipHorizontal(Image *image); // Flip image horizontally
+ RLAPI void ImageRotate(Image *image, int degrees); // Rotate image by input angle in degrees (-359 to 359)
+ RLAPI void ImageRotateCW(Image *image); // Rotate image clockwise 90deg
+ RLAPI void ImageRotateCCW(Image *image); // Rotate image counter-clockwise 90deg
+ RLAPI void ImageColorTint(Image *image, Color color); // Modify image color: tint
+ RLAPI void ImageColorInvert(Image *image); // Modify image color: invert
+ RLAPI void ImageColorGrayscale(Image *image); // Modify image color: grayscale
+ RLAPI void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100)
+ RLAPI void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255)
+ RLAPI void ImageColorReplace(Image *image, Color color, Color replace); // Modify image color: replace color
+ RLAPI Color *LoadImageColors(Image image); // Load color data from image as a Color array (RGBA - 32bit)
+ RLAPI Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount); // Load colors palette from image as a Color array (RGBA - 32bit)
+ RLAPI void UnloadImageColors(Color *colors); // Unload color data loaded with LoadImageColors()
+ RLAPI void UnloadImagePalette(Color *colors); // Unload colors palette loaded with LoadImagePalette()
+ RLAPI Rectangle GetImageAlphaBorder(Image image, float threshold); // Get image alpha border rectangle
+ RLAPI Color GetImageColor(Image image, int x, int y); // Get image pixel color at (x, y) position
-// Image drawing functions
-// NOTE: Image software-rendering functions (CPU)
-RLAPI void ImageClearBackground(Image *dst, Color color); // Clear image background with given color
-RLAPI void ImageDrawPixel(Image *dst, int posX, int posY, Color color); // Draw pixel within an image
-RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version)
-RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
-RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
-RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
-RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
-RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
-RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version)
-RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
-RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
-RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
-RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image
-RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
-RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
-RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
+ // Image drawing functions
+ // NOTE: Image software-rendering functions (CPU)
+ RLAPI void ImageClearBackground(Image *dst, Color color); // Clear image background with given color
+ RLAPI void ImageDrawPixel(Image *dst, int posX, int posY, Color color); // Draw pixel within an image
+ RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version)
+ RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
+ RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
+ RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
+ RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
+ RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
+ RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version)
+ RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
+ RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
+ RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
+ RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image
+ RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
+ RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
+ RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
-// Texture loading functions
-// NOTE: These functions require GPU access
-RLAPI Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
-RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
-RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
-RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
-RLAPI bool IsTextureReady(Texture2D texture); // Check if a texture is ready
-RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
-RLAPI bool IsRenderTextureReady(RenderTexture2D target); // Check if a render texture is ready
-RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
-RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
-RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data
+ // Texture loading functions
+ // NOTE: These functions require GPU access
+ RLAPI Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
+ RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
+ RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
+ RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
+ RLAPI bool IsTextureReady(Texture2D texture); // Check if a texture is ready
+ RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
+ RLAPI bool IsRenderTextureReady(RenderTexture2D target); // Check if a render texture is ready
+ RLAPI void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
+ RLAPI void UpdateTexture(Texture2D texture, const void *pixels); // Update GPU texture with new data
+ RLAPI void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels); // Update GPU texture rectangle with new data
-// Texture configuration functions
-RLAPI void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture
-RLAPI void SetTextureFilter(Texture2D texture, int filter); // Set texture scaling filter mode
-RLAPI void SetTextureWrap(Texture2D texture, int wrap); // Set texture wrapping mode
+ // Texture configuration functions
+ RLAPI void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture
+ RLAPI void SetTextureFilter(Texture2D texture, int filter); // Set texture scaling filter mode
+ RLAPI void SetTextureWrap(Texture2D texture, int wrap); // Set texture wrapping mode
-// Texture drawing functions
-RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
-RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
-RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
-RLAPI void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
-RLAPI void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
-RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely
+ // Texture drawing functions
+ RLAPI void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
+ RLAPI void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2
+ RLAPI void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
+ RLAPI void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
+ RLAPI void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
+ RLAPI void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint); // Draws a texture (or part of it) that stretches or shrinks nicely
-// Color/pixel related functions
-RLAPI bool ColorIsEqual(Color col1, Color col2); // Check if two colors are equal
-RLAPI Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
-RLAPI int ColorToInt(Color color); // Get hexadecimal value for a Color (0xRRGGBBAA)
-RLAPI Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1]
-RLAPI Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1]
-RLAPI Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1]
-RLAPI Color ColorFromHSV(float hue, float saturation, float value); // Get a Color from HSV values, hue [0..360], saturation/value [0..1]
-RLAPI Color ColorTint(Color color, Color tint); // Get color multiplied with another color
-RLAPI Color ColorBrightness(Color color, float factor); // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
-RLAPI Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f
-RLAPI Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
-RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint
-RLAPI Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value
-RLAPI Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
-RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
-RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format
+ // Color/pixel related functions
+ RLAPI bool ColorIsEqual(Color col1, Color col2); // Check if two colors are equal
+ RLAPI Color Fade(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
+ RLAPI int ColorToInt(Color color); // Get hexadecimal value for a Color (0xRRGGBBAA)
+ RLAPI Vector4 ColorNormalize(Color color); // Get Color normalized as float [0..1]
+ RLAPI Color ColorFromNormalized(Vector4 normalized); // Get Color from normalized values [0..1]
+ RLAPI Vector3 ColorToHSV(Color color); // Get HSV values for a Color, hue [0..360], saturation/value [0..1]
+ RLAPI Color ColorFromHSV(float hue, float saturation, float value); // Get a Color from HSV values, hue [0..360], saturation/value [0..1]
+ RLAPI Color ColorTint(Color color, Color tint); // Get color multiplied with another color
+ RLAPI Color ColorBrightness(Color color, float factor); // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
+ RLAPI Color ColorContrast(Color color, float contrast); // Get color with contrast correction, contrast values between -1.0f and 1.0f
+ RLAPI Color ColorAlpha(Color color, float alpha); // Get color with alpha applied, alpha goes from 0.0f to 1.0f
+ RLAPI Color ColorAlphaBlend(Color dst, Color src, Color tint); // Get src alpha-blended into dst color with tint
+ RLAPI Color GetColor(unsigned int hexValue); // Get Color structure from hexadecimal value
+ RLAPI Color GetPixelColor(void *srcPtr, int format); // Get Color from a source pixel pointer of certain format
+ RLAPI void SetPixelColor(void *dstPtr, Color color, int format); // Set color formatted into destination pixel pointer
+ RLAPI int GetPixelDataSize(int width, int height, int format); // Get pixel data size in bytes for certain format
-//------------------------------------------------------------------------------------
-// Font Loading and Text Drawing Functions (Module: text)
-//------------------------------------------------------------------------------------
+ //------------------------------------------------------------------------------------
+ // Font Loading and Text Drawing Functions (Module: text)
+ //------------------------------------------------------------------------------------
-// Font loading/unloading functions
-RLAPI Font GetFontDefault(void); // Get the default Font
-RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
-RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set
-RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
-RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
-RLAPI bool IsFontReady(Font font); // Check if a font is ready
-RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use
-RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
-RLAPI void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM)
-RLAPI void UnloadFont(Font font); // Unload font from GPU memory (VRAM)
-RLAPI bool ExportFontAsCode(Font font, const char *fileName); // Export font as code file, returns true on success
+ // Font loading/unloading functions
+ RLAPI Font GetFontDefault(void); // Get the default Font
+ RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
+ RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set
+ RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
+ RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
+ RLAPI bool IsFontReady(Font font); // Check if a font is ready
+ RLAPI GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount, int type); // Load font data for further use
+ RLAPI Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
+ RLAPI void UnloadFontData(GlyphInfo *glyphs, int glyphCount); // Unload font chars info data (RAM)
+ RLAPI void UnloadFont(Font font); // Unload font from GPU memory (VRAM)
+ RLAPI bool ExportFontAsCode(Font font, const char *fileName); // Export font as code file, returns true on success
-// Text drawing functions
-RLAPI void DrawFPS(int posX, int posY); // Draw current FPS
-RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
-RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
-RLAPI void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using Font and pro parameters (rotation)
-RLAPI void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint)
-RLAPI void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint)
+ // Text drawing functions
+ RLAPI void DrawFPS(int posX, int posY); // Draw current FPS
+ RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
+ RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
+ RLAPI void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using Font and pro parameters (rotation)
+ RLAPI void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint)
+ RLAPI void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint); // Draw multiple character (codepoint)
-// Text font info functions
-RLAPI void SetTextLineSpacing(int spacing); // Set vertical line spacing when drawing with line-breaks
-RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
-RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
-RLAPI int GetGlyphIndex(Font font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
-RLAPI GlyphInfo GetGlyphInfo(Font font, int codepoint); // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
-RLAPI Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
+ // Text font info functions
+ RLAPI void SetTextLineSpacing(int spacing); // Set vertical line spacing when drawing with line-breaks
+ RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
+ RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
+ RLAPI int GetGlyphIndex(Font font, int codepoint); // Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
+ RLAPI GlyphInfo GetGlyphInfo(Font font, int codepoint); // Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
+ RLAPI Rectangle GetGlyphAtlasRec(Font font, int codepoint); // Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
-// Text codepoints management functions (unicode characters)
-RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array
-RLAPI void UnloadUTF8(char *text); // Unload UTF-8 text encoded from codepoints array
-RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
-RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory
-RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string
-RLAPI int GetCodepoint(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
-RLAPI int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
-RLAPI int GetCodepointPrevious(const char *text, int *codepointSize); // Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
-RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size); // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
+ // Text codepoints management functions (unicode characters)
+ RLAPI char *LoadUTF8(const int *codepoints, int length); // Load UTF-8 text encoded from codepoints array
+ RLAPI void UnloadUTF8(char *text); // Unload UTF-8 text encoded from codepoints array
+ RLAPI int *LoadCodepoints(const char *text, int *count); // Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
+ RLAPI void UnloadCodepoints(int *codepoints); // Unload codepoints data from memory
+ RLAPI int GetCodepointCount(const char *text); // Get total number of codepoints in a UTF-8 encoded string
+ RLAPI int GetCodepoint(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+ RLAPI int GetCodepointNext(const char *text, int *codepointSize); // Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+ RLAPI int GetCodepointPrevious(const char *text, int *codepointSize); // Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
+ RLAPI const char *CodepointToUTF8(int codepoint, int *utf8Size); // Encode one codepoint into UTF-8 byte array (array length returned as parameter)
-// Text strings management functions (no UTF-8 strings, only byte chars)
-// NOTE: Some strings allocate memory internally for returned strings, just be careful!
-RLAPI int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied
-RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
-RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
-RLAPI const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf() style)
-RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
-RLAPI char *TextReplace(const char *text, const char *replace, const char *by); // Replace text string (WARNING: memory must be freed!)
-RLAPI char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (WARNING: memory must be freed!)
-RLAPI const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
-RLAPI const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
-RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
-RLAPI int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
-RLAPI const char *TextToUpper(const char *text); // Get upper case version of provided string
-RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
-RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
-RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
-RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported)
+ // Text strings management functions (no UTF-8 strings, only byte chars)
+ // NOTE: Some strings allocate memory internally for returned strings, just be careful!
+ RLAPI int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied
+ RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
+ RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
+ RLAPI const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf() style)
+ RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
+ RLAPI char *TextReplace(const char *text, const char *replace, const char *by); // Replace text string (WARNING: memory must be freed!)
+ RLAPI char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (WARNING: memory must be freed!)
+ RLAPI const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
+ RLAPI const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
+ RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
+ RLAPI int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
+ RLAPI const char *TextToUpper(const char *text); // Get upper case version of provided string
+ RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
+ RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
+ RLAPI const char *TextToSnake(const char *text); // Get Snake case notation version of provided string
+ RLAPI const char *TextToCamel(const char *text); // Get Camel case notation version of provided string
-//------------------------------------------------------------------------------------
-// Basic 3d Shapes Drawing Functions (Module: models)
-//------------------------------------------------------------------------------------
+ RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
+ RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported)
-// Basic geometric 3D shapes drawing functions
-RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
-RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
-RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
-RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
-RLAPI void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
-RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
-RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
-RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
-RLAPI void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); // Draw cube wires (Vector version)
-RLAPI void DrawSphere(Vector3 centerPos, float radius, Color color); // Draw sphere
-RLAPI void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere with extended parameters
-RLAPI void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere wires
-RLAPI void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone
-RLAPI void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder with base at startPos and top at endPos
-RLAPI void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone wires
-RLAPI void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder wires with base at startPos and top at endPos
-RLAPI void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color); // Draw a capsule with the center of its sphere caps at startPos and endPos
-RLAPI void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color); // Draw capsule wireframe with the center of its sphere caps at startPos and endPos
-RLAPI void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ
-RLAPI void DrawRay(Ray ray, Color color); // Draw a ray line
-RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
+ //------------------------------------------------------------------------------------
+ // Basic 3d Shapes Drawing Functions (Module: models)
+ //------------------------------------------------------------------------------------
-//------------------------------------------------------------------------------------
-// Model 3d Loading and Drawing Functions (Module: models)
-//------------------------------------------------------------------------------------
+ // Basic geometric 3D shapes drawing functions
+ RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
+ RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
+ RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
+ RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
+ RLAPI void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
+ RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
+ RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
+ RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
+ RLAPI void DrawCubeWiresV(Vector3 position, Vector3 size, Color color); // Draw cube wires (Vector version)
+ RLAPI void DrawSphere(Vector3 centerPos, float radius, Color color); // Draw sphere
+ RLAPI void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere with extended parameters
+ RLAPI void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Color color); // Draw sphere wires
+ RLAPI void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone
+ RLAPI void DrawCylinderEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder with base at startPos and top at endPos
+ RLAPI void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); // Draw a cylinder/cone wires
+ RLAPI void DrawCylinderWiresEx(Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color); // Draw a cylinder wires with base at startPos and top at endPos
+ RLAPI void DrawCapsule(Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color); // Draw a capsule with the center of its sphere caps at startPos and endPos
+ RLAPI void DrawCapsuleWires(Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color); // Draw capsule wireframe with the center of its sphere caps at startPos and endPos
+ RLAPI void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ
+ RLAPI void DrawRay(Ray ray, Color color); // Draw a ray line
+ RLAPI void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
-// Model management functions
-RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
-RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
-RLAPI bool IsModelReady(Model model); // Check if a model is ready
-RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
-RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
+ //------------------------------------------------------------------------------------
+ // Model 3d Loading and Drawing Functions (Module: models)
+ //------------------------------------------------------------------------------------
-// Model drawing functions
-RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
-RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
-RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
-RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
-RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
-RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint); // Draw a billboard texture
-RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
-RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
+ // Model management functions
+ RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
+ RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
+ RLAPI bool IsModelReady(Model model); // Check if a model is ready
+ RLAPI void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
+ RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
-// Mesh management functions
-RLAPI void UploadMesh(Mesh *mesh, bool dynamic); // Upload mesh vertex data in GPU and provide VAO/VBO ids
-RLAPI void UpdateMeshBuffer(Mesh mesh, int index, const void *data, int dataSize, int offset); // Update mesh vertex data in GPU for a specific buffer index
-RLAPI void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU
-RLAPI void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
-RLAPI void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms
-RLAPI BoundingBox GetMeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits
-RLAPI void GenMeshTangents(Mesh *mesh); // Compute mesh tangents
-RLAPI bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success
-RLAPI bool ExportMeshAsCode(Mesh mesh, const char *fileName); // Export mesh as code file (.h) defining multiple arrays of vertex attributes
+ // Model drawing functions
+ RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
+ RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
+ RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
+ RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
+ RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
+ RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint); // Draw a billboard texture
+ RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
+ RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
-// Mesh generation functions
-RLAPI Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh
-RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
-RLAPI Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh
-RLAPI Mesh GenMeshSphere(float radius, int rings, int slices); // Generate sphere mesh (standard sphere)
-RLAPI Mesh GenMeshHemiSphere(float radius, int rings, int slices); // Generate half-sphere mesh (no bottom cap)
-RLAPI Mesh GenMeshCylinder(float radius, float height, int slices); // Generate cylinder mesh
-RLAPI Mesh GenMeshCone(float radius, float height, int slices); // Generate cone/pyramid mesh
-RLAPI Mesh GenMeshTorus(float radius, float size, int radSeg, int sides); // Generate torus mesh
-RLAPI Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); // Generate trefoil knot mesh
-RLAPI Mesh GenMeshHeightmap(Image heightmap, Vector3 size); // Generate heightmap mesh from image data
-RLAPI Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); // Generate cubes-based map mesh from image data
+ // Mesh management functions
+ RLAPI void UploadMesh(Mesh *mesh, bool dynamic); // Upload mesh vertex data in GPU and provide VAO/VBO ids
+ RLAPI void UpdateMeshBuffer(Mesh mesh, int index, const void *data, int dataSize, int offset); // Update mesh vertex data in GPU for a specific buffer index
+ RLAPI void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU
+ RLAPI void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
+ RLAPI void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms
+ RLAPI BoundingBox GetMeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits
+ RLAPI void GenMeshTangents(Mesh *mesh); // Compute mesh tangents
+ RLAPI bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success
+ RLAPI bool ExportMeshAsCode(Mesh mesh, const char *fileName); // Export mesh as code file (.h) defining multiple arrays of vertex attributes
-// Material loading/unloading functions
-RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
-RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
-RLAPI bool IsMaterialReady(Material material); // Check if a material is ready
-RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
-RLAPI void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
-RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
+ // Mesh generation functions
+ RLAPI Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh
+ RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
+ RLAPI Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh
+ RLAPI Mesh GenMeshSphere(float radius, int rings, int slices); // Generate sphere mesh (standard sphere)
+ RLAPI Mesh GenMeshHemiSphere(float radius, int rings, int slices); // Generate half-sphere mesh (no bottom cap)
+ RLAPI Mesh GenMeshCylinder(float radius, float height, int slices); // Generate cylinder mesh
+ RLAPI Mesh GenMeshCone(float radius, float height, int slices); // Generate cone/pyramid mesh
+ RLAPI Mesh GenMeshTorus(float radius, float size, int radSeg, int sides); // Generate torus mesh
+ RLAPI Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); // Generate trefoil knot mesh
+ RLAPI Mesh GenMeshHeightmap(Image heightmap, Vector3 size); // Generate heightmap mesh from image data
+ RLAPI Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); // Generate cubes-based map mesh from image data
-// Model animations loading/unloading functions
-RLAPI ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount); // Load model animations from file
-RLAPI void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose
-RLAPI void UnloadModelAnimation(ModelAnimation anim); // Unload animation data
-RLAPI void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data
-RLAPI bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match
+ // Material loading/unloading functions
+ RLAPI Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
+ RLAPI Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
+ RLAPI bool IsMaterialReady(Material material); // Check if a material is ready
+ RLAPI void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
+ RLAPI void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
+ RLAPI void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
-// Collision detection functions
-RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres
-RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Check collision between two bounding boxes
-RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Check collision between box and sphere
-RLAPI RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); // Get collision info between ray and sphere
-RLAPI RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); // Get collision info between ray and box
-RLAPI RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform); // Get collision info between ray and mesh
-RLAPI RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
-RLAPI RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); // Get collision info between ray and quad
+ // Model animations loading/unloading functions
+ RLAPI ModelAnimation *LoadModelAnimations(const char *fileName, int *animCount); // Load model animations from file
+ RLAPI void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose
+ RLAPI void UnloadModelAnimation(ModelAnimation anim); // Unload animation data
+ RLAPI void UnloadModelAnimations(ModelAnimation *animations, int animCount); // Unload animation array data
+ RLAPI bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match
-//------------------------------------------------------------------------------------
-// Audio Loading and Playing Functions (Module: audio)
-//------------------------------------------------------------------------------------
-typedef void (*AudioCallback)(void *bufferData, unsigned int frames);
+ // Collision detection functions
+ RLAPI bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2); // Check collision between two spheres
+ RLAPI bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2); // Check collision between two bounding boxes
+ RLAPI bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius); // Check collision between box and sphere
+ RLAPI RayCollision GetRayCollisionSphere(Ray ray, Vector3 center, float radius); // Get collision info between ray and sphere
+ RLAPI RayCollision GetRayCollisionBox(Ray ray, BoundingBox box); // Get collision info between ray and box
+ RLAPI RayCollision GetRayCollisionMesh(Ray ray, Mesh mesh, Matrix transform); // Get collision info between ray and mesh
+ RLAPI RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
+ RLAPI RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4); // Get collision info between ray and quad
-// Audio device management functions
-RLAPI void InitAudioDevice(void); // Initialize audio device and context
-RLAPI void CloseAudioDevice(void); // Close the audio device and context
-RLAPI bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully
-RLAPI void SetMasterVolume(float volume); // Set master volume (listener)
-RLAPI float GetMasterVolume(void); // Get master volume (listener)
+ //------------------------------------------------------------------------------------
+ // Audio Loading and Playing Functions (Module: audio)
+ //------------------------------------------------------------------------------------
+ typedef void (*AudioCallback)(void *bufferData, unsigned int frames);
-// Wave/Sound loading/unloading functions
-RLAPI Wave LoadWave(const char *fileName); // Load wave data from file
-RLAPI Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
-RLAPI bool IsWaveReady(Wave wave); // Checks if wave data is ready
-RLAPI Sound LoadSound(const char *fileName); // Load sound from file
-RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
-RLAPI Sound LoadSoundAlias(Sound source); // Create a new sound that shares the same sample data as the source sound, does not own the sound data
-RLAPI bool IsSoundReady(Sound sound); // Checks if a sound is ready
-RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data
-RLAPI void UnloadWave(Wave wave); // Unload wave data
-RLAPI void UnloadSound(Sound sound); // Unload sound
-RLAPI void UnloadSoundAlias(Sound alias); // Unload a sound alias (does not deallocate sample data)
-RLAPI bool ExportWave(Wave wave, const char *fileName); // Export wave data to file, returns true on success
-RLAPI bool ExportWaveAsCode(Wave wave, const char *fileName); // Export wave sample data to code (.h), returns true on success
+ // Audio device management functions
+ RLAPI void InitAudioDevice(void); // Initialize audio device and context
+ RLAPI void CloseAudioDevice(void); // Close the audio device and context
+ RLAPI bool IsAudioDeviceReady(void); // Check if audio device has been initialized successfully
+ RLAPI void SetMasterVolume(float volume); // Set master volume (listener)
+ RLAPI float GetMasterVolume(void); // Get master volume (listener)
-// Wave/Sound management functions
-RLAPI void PlaySound(Sound sound); // Play a sound
-RLAPI void StopSound(Sound sound); // Stop playing a sound
-RLAPI void PauseSound(Sound sound); // Pause a sound
-RLAPI void ResumeSound(Sound sound); // Resume a paused sound
-RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
-RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
-RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
-RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
-RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
-RLAPI void WaveCrop(Wave *wave, int initFrame, int finalFrame); // Crop a wave to defined frames range
-RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
-RLAPI float *LoadWaveSamples(Wave wave); // Load samples data from wave as a 32bit float data array
-RLAPI void UnloadWaveSamples(float *samples); // Unload samples data loaded with LoadWaveSamples()
+ // Wave/Sound loading/unloading functions
+ RLAPI Wave LoadWave(const char *fileName); // Load wave data from file
+ RLAPI Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
+ RLAPI bool IsWaveReady(Wave wave); // Checks if wave data is ready
+ RLAPI Sound LoadSound(const char *fileName); // Load sound from file
+ RLAPI Sound LoadSoundFromWave(Wave wave); // Load sound from wave data
+ RLAPI Sound LoadSoundAlias(Sound source); // Create a new sound that shares the same sample data as the source sound, does not own the sound data
+ RLAPI bool IsSoundReady(Sound sound); // Checks if a sound is ready
+ RLAPI void UpdateSound(Sound sound, const void *data, int sampleCount); // Update sound buffer with new data
+ RLAPI void UnloadWave(Wave wave); // Unload wave data
+ RLAPI void UnloadSound(Sound sound); // Unload sound
+ RLAPI void UnloadSoundAlias(Sound alias); // Unload a sound alias (does not deallocate sample data)
+ RLAPI bool ExportWave(Wave wave, const char *fileName); // Export wave data to file, returns true on success
+ RLAPI bool ExportWaveAsCode(Wave wave, const char *fileName); // Export wave sample data to code (.h), returns true on success
-// Music management functions
-RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file
-RLAPI Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data, int dataSize); // Load music stream from data
-RLAPI bool IsMusicReady(Music music); // Checks if a music stream is ready
-RLAPI void UnloadMusicStream(Music music); // Unload music stream
-RLAPI void PlayMusicStream(Music music); // Start music playing
-RLAPI bool IsMusicStreamPlaying(Music music); // Check if music is playing
-RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming
-RLAPI void StopMusicStream(Music music); // Stop music playing
-RLAPI void PauseMusicStream(Music music); // Pause music playing
-RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
-RLAPI void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds)
-RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
-RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
-RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (0.5 is center)
-RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds)
-RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
+ // Wave/Sound management functions
+ RLAPI void PlaySound(Sound sound); // Play a sound
+ RLAPI void StopSound(Sound sound); // Stop playing a sound
+ RLAPI void PauseSound(Sound sound); // Pause a sound
+ RLAPI void ResumeSound(Sound sound); // Resume a paused sound
+ RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
+ RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
+ RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
+ RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
+ RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
+ RLAPI void WaveCrop(Wave *wave, int initFrame, int finalFrame); // Crop a wave to defined frames range
+ RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
+ RLAPI float *LoadWaveSamples(Wave wave); // Load samples data from wave as a 32bit float data array
+ RLAPI void UnloadWaveSamples(float *samples); // Unload samples data loaded with LoadWaveSamples()
-// AudioStream management functions
-RLAPI AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Load audio stream (to stream raw audio pcm data)
-RLAPI bool IsAudioStreamReady(AudioStream stream); // Checks if an audio stream is ready
-RLAPI void UnloadAudioStream(AudioStream stream); // Unload audio stream and free memory
-RLAPI void UpdateAudioStream(AudioStream stream, const void *data, int frameCount); // Update audio stream buffers with data
-RLAPI bool IsAudioStreamProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
-RLAPI void PlayAudioStream(AudioStream stream); // Play audio stream
-RLAPI void PauseAudioStream(AudioStream stream); // Pause audio stream
-RLAPI void ResumeAudioStream(AudioStream stream); // Resume audio stream
-RLAPI bool IsAudioStreamPlaying(AudioStream stream); // Check if audio stream is playing
-RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream
-RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
-RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
-RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered)
-RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
-RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data
+ // Music management functions
+ RLAPI Music LoadMusicStream(const char *fileName); // Load music stream from file
+ RLAPI Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data, int dataSize); // Load music stream from data
+ RLAPI bool IsMusicReady(Music music); // Checks if a music stream is ready
+ RLAPI void UnloadMusicStream(Music music); // Unload music stream
+ RLAPI void PlayMusicStream(Music music); // Start music playing
+ RLAPI bool IsMusicStreamPlaying(Music music); // Check if music is playing
+ RLAPI void UpdateMusicStream(Music music); // Updates buffers for music streaming
+ RLAPI void StopMusicStream(Music music); // Stop music playing
+ RLAPI void PauseMusicStream(Music music); // Pause music playing
+ RLAPI void ResumeMusicStream(Music music); // Resume playing paused music
+ RLAPI void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds)
+ RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
+ RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
+ RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (0.5 is center)
+ RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds)
+ RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
-RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as 'float'
-RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream
+ // AudioStream management functions
+ RLAPI AudioStream LoadAudioStream(unsigned int sampleRate, unsigned int sampleSize, unsigned int channels); // Load audio stream (to stream raw audio pcm data)
+ RLAPI bool IsAudioStreamReady(AudioStream stream); // Checks if an audio stream is ready
+ RLAPI void UnloadAudioStream(AudioStream stream); // Unload audio stream and free memory
+ RLAPI void UpdateAudioStream(AudioStream stream, const void *data, int frameCount); // Update audio stream buffers with data
+ RLAPI bool IsAudioStreamProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
+ RLAPI void PlayAudioStream(AudioStream stream); // Play audio stream
+ RLAPI void PauseAudioStream(AudioStream stream); // Pause audio stream
+ RLAPI void ResumeAudioStream(AudioStream stream); // Resume audio stream
+ RLAPI bool IsAudioStreamPlaying(AudioStream stream); // Check if audio stream is playing
+ RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream
+ RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
+ RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
+ RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered)
+ RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
+ RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data
-RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'
-RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline
+ RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as 'float'
+ RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream
+
+ RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'
+ RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline
#if defined(__cplusplus)
}
diff --git a/src/rtext.c b/src/rtext.c
index 5ba4e8b6a..5c9c36dcc 100644
--- a/src/rtext.c
+++ b/src/rtext.c
@@ -1,119 +1,119 @@
/**********************************************************************************************
-*
-* rtext - Basic functions to load fonts and draw text
-*
-* CONFIGURATION:
-* #define SUPPORT_MODULE_RTEXT
-* rtext module is included in the build
-*
-* #define SUPPORT_DEFAULT_FONT
-* Load default raylib font on initialization to be used by DrawText() and MeasureText().
-* If no default font loaded, DrawTextEx() and MeasureTextEx() are required.
-*
-* #define SUPPORT_FILEFORMAT_FNT
-* #define SUPPORT_FILEFORMAT_TTF
-* #define SUPPORT_FILEFORMAT_BDF
-* Selected desired fileformats to be supported for loading. Some of those formats are
-* supported by default, to remove support, just comment unrequired #define in this module
-*
-* #define SUPPORT_FONT_ATLAS_WHITE_REC
-* On font atlas image generation [GenImageFontAtlas()], add a 3x3 pixels white rectangle
-* at the bottom-right corner of the atlas. It can be useful to for shapes drawing, to allow
-* drawing text and shapes with a single draw call [SetShapesTexture()].
-*
-* #define TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH
-* TextSplit() function static buffer max size
-*
-* #define MAX_TEXTSPLIT_COUNT
-* TextSplit() function static substrings pointers array (pointing to static buffer)
-*
-* DEPENDENCIES:
-* stb_truetype - Load TTF file and rasterize characters data
-* stb_rect_pack - Rectangles packing algorithms, required for font atlas generation
-*
-*
-* LICENSE: zlib/libpng
-*
-* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
-*
-* This software is provided "as-is", without any express or implied warranty. In no event
-* will the authors be held liable for any damages arising from the use of this software.
-*
-* 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.
-*
-**********************************************************************************************/
+ *
+ * rtext - Basic functions to load fonts and draw text
+ *
+ * CONFIGURATION:
+ * #define SUPPORT_MODULE_RTEXT
+ * rtext module is included in the build
+ *
+ * #define SUPPORT_DEFAULT_FONT
+ * Load default raylib font on initialization to be used by DrawText() and MeasureText().
+ * If no default font loaded, DrawTextEx() and MeasureTextEx() are required.
+ *
+ * #define SUPPORT_FILEFORMAT_FNT
+ * #define SUPPORT_FILEFORMAT_TTF
+ * #define SUPPORT_FILEFORMAT_BDF
+ * Selected desired fileformats to be supported for loading. Some of those formats are
+ * supported by default, to remove support, just comment unrequired #define in this module
+ *
+ * #define SUPPORT_FONT_ATLAS_WHITE_REC
+ * On font atlas image generation [GenImageFontAtlas()], add a 3x3 pixels white rectangle
+ * at the bottom-right corner of the atlas. It can be useful to for shapes drawing, to allow
+ * drawing text and shapes with a single draw call [SetShapesTexture()].
+ *
+ * #define TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH
+ * TextSplit() function static buffer max size
+ *
+ * #define MAX_TEXTSPLIT_COUNT
+ * TextSplit() function static substrings pointers array (pointing to static buffer)
+ *
+ * DEPENDENCIES:
+ * stb_truetype - Load TTF file and rasterize characters data
+ * stb_rect_pack - Rectangles packing algorithms, required for font atlas generation
+ *
+ *
+ * LICENSE: zlib/libpng
+ *
+ * Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
+ *
+ * This software is provided "as-is", without any express or implied warranty. In no event
+ * will the authors be held liable for any damages arising from the use of this software.
+ *
+ * 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.
+ *
+ **********************************************************************************************/
-#include "raylib.h" // Declares module functions
+#include "raylib.h" // Declares module functions
// Check if config flags have been externally provided on compilation line
#if !defined(EXTERNAL_CONFIG_FLAGS)
- #include "config.h" // Defines module configuration flags
+#include "config.h" // Defines module configuration flags
#endif
#if defined(SUPPORT_MODULE_RTEXT)
-#include "utils.h" // Required for: LoadFile*()
-#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 -> Only DrawTextPro()
+#include "utils.h" // Required for: LoadFile*()
+#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 -> Only DrawTextPro()
-#include // Required for: malloc(), free()
-#include // Required for: vsprintf()
-#include // Required for: strcmp(), strstr(), strcpy(), strncpy() [Used in TextReplace()], sscanf() [Used in LoadBMFont()]
-#include // Required for: va_list, va_start(), vsprintf(), va_end() [Used in TextFormat()]
-#include // Required for: toupper(), tolower() [Used in TextToUpper(), TextToLower()]
+#include // Required for: malloc(), free()
+#include // Required for: vsprintf()
+#include // Required for: strcmp(), strstr(), strcpy(), strncpy() [Used in TextReplace()], sscanf() [Used in LoadBMFont()]
+#include // Required for: va_list, va_start(), vsprintf(), va_end() [Used in TextFormat()]
+#include // Required for: toupper(), tolower() [Used in TextToUpper(), TextToLower()]
#if defined(SUPPORT_FILEFORMAT_TTF) || defined(SUPPORT_FILEFORMAT_BDF)
- #if defined(__GNUC__) // GCC and Clang
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunused-function"
- #endif
+#if defined(__GNUC__) // GCC and Clang
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
- #define STB_RECT_PACK_IMPLEMENTATION
- #include "external/stb_rect_pack.h" // Required for: ttf/bdf font rectangles packaging
+#define STB_RECT_PACK_IMPLEMENTATION
+#include "external/stb_rect_pack.h" // Required for: ttf/bdf font rectangles packaging
- #include // Required for: ttf/bdf font rectangles packaging
+#include // Required for: ttf/bdf font rectangles packaging
- #if defined(__GNUC__) // GCC and Clang
- #pragma GCC diagnostic pop
- #endif
+#if defined(__GNUC__) // GCC and Clang
+#pragma GCC diagnostic pop
+#endif
#endif
#if defined(SUPPORT_FILEFORMAT_TTF)
- #if defined(__GNUC__) // GCC and Clang
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunused-function"
- #endif
+#if defined(__GNUC__) // GCC and Clang
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
- #define STBTT_STATIC
- #define STB_TRUETYPE_IMPLEMENTATION
- #include "external/stb_truetype.h" // Required for: ttf font data reading
+#define STBTT_STATIC
+#define STB_TRUETYPE_IMPLEMENTATION
+#include "external/stb_truetype.h" // Required for: ttf font data reading
- #if defined(__GNUC__) // GCC and Clang
- #pragma GCC diagnostic pop
- #endif
+#if defined(__GNUC__) // GCC and Clang
+#pragma GCC diagnostic pop
+#endif
#endif
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
#ifndef MAX_TEXT_BUFFER_LENGTH
- #define MAX_TEXT_BUFFER_LENGTH 1024 // Size of internal static buffers used on some functions:
- // TextFormat(), TextSubtext(), TextToUpper(), TextToLower(), TextToPascal(), TextSplit()
+#define MAX_TEXT_BUFFER_LENGTH 1024 // Size of internal static buffers used on some functions:
+ // TextFormat(), TextSubtext(), TextToUpper(), TextToLower(), TextToPascal(), TextSplit()
#endif
#ifndef MAX_TEXT_UNICODE_CHARS
- #define MAX_TEXT_UNICODE_CHARS 512 // Maximum number of unicode codepoints: GetCodepoints()
+#define MAX_TEXT_UNICODE_CHARS 512 // Maximum number of unicode codepoints: GetCodepoints()
#endif
#ifndef MAX_TEXTSPLIT_COUNT
- #define MAX_TEXTSPLIT_COUNT 128 // Maximum number of substrings to split: TextSplit()
+#define MAX_TEXTSPLIT_COUNT 128 // Maximum number of substrings to split: TextSplit()
#endif
//----------------------------------------------------------------------------------
@@ -127,7 +127,7 @@
#if defined(SUPPORT_DEFAULT_FONT)
// Default font provided by raylib
// NOTE: Default font is loaded on InitWindow() and disposed on CloseWindow() [module: core]
-static Font defaultFont = { 0 };
+static Font defaultFont = {0};
#endif
//----------------------------------------------------------------------------------
@@ -139,12 +139,12 @@ static Font defaultFont = { 0 };
// Module specific Functions Declaration
//----------------------------------------------------------------------------------
#if defined(SUPPORT_FILEFORMAT_FNT)
-static Font LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file)
+static Font LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file)
#endif
#if defined(SUPPORT_FILEFORMAT_BDF)
static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, int *codepoints, int codepointCount, int *outFontSize);
#endif
-static int textLineSpacing = 2; // Text vertical line spacing in pixels (between lines)
+static int textLineSpacing = 2; // Text vertical line spacing in pixels (between lines)
#if defined(SUPPORT_DEFAULT_FONT)
extern void LoadFontDefault(void);
@@ -158,13 +158,13 @@ extern void UnloadFontDefault(void);
// Load raylib default font
extern void LoadFontDefault(void)
{
- #define BIT_CHECK(a,b) ((a) & (1u << (b)))
+#define BIT_CHECK(a, b) ((a) & (1u << (b)))
// NOTE: Using UTF-8 encoding table for Unicode U+0000..U+00FF Basic Latin + Latin-1 Supplement
// Ref: http://www.utf8-chartable.de/unicode-utf8-table.pl
- defaultFont.glyphCount = 224; // Number of chars included in our default font
- defaultFont.glyphPadding = 0; // Characters padding
+ defaultFont.glyphCount = 224; // Number of chars included in our default font
+ defaultFont.glyphPadding = 0; // Characters padding
// Default font is directly defined here (data generated from a sprite font image)
// This way, we reconstruct Font without creating large global variables
@@ -212,31 +212,30 @@ extern void LoadFontDefault(void)
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000};
int charsHeight = 10;
- int charsDivisor = 1; // Every char is separated from the consecutive by a 1 pixel divisor, horizontally and vertically
+ int charsDivisor = 1; // Every char is separated from the consecutive by a 1 pixel divisor, horizontally and vertically
- int charsWidth[224] = { 3, 1, 4, 6, 5, 7, 6, 2, 3, 3, 5, 5, 2, 4, 1, 7, 5, 2, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 3, 4, 3, 6,
- 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 5, 6, 5, 7, 6, 6, 6, 6, 6, 6, 7, 6, 7, 7, 6, 6, 6, 2, 7, 2, 3, 5,
- 2, 5, 5, 5, 5, 5, 4, 5, 5, 1, 2, 5, 2, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 3, 1, 3, 4, 4,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 5, 5, 5, 7, 1, 5, 3, 7, 3, 5, 4, 1, 7, 4, 3, 5, 3, 3, 2, 5, 6, 1, 2, 2, 3, 5, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 3, 3, 3, 3, 7, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 4, 6,
- 5, 5, 5, 5, 5, 5, 9, 5, 5, 5, 5, 5, 2, 2, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 5 };
+ int charsWidth[224] = {3, 1, 4, 6, 5, 7, 6, 2, 3, 3, 5, 5, 2, 4, 1, 7, 5, 2, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 3, 4, 3, 6,
+ 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 5, 6, 5, 7, 6, 6, 6, 6, 6, 6, 7, 6, 7, 7, 6, 6, 6, 2, 7, 2, 3, 5,
+ 2, 5, 5, 5, 5, 5, 4, 5, 5, 1, 2, 5, 2, 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 3, 1, 3, 4, 4,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 5, 5, 5, 7, 1, 5, 3, 7, 3, 5, 4, 1, 7, 4, 3, 5, 3, 3, 2, 5, 6, 1, 2, 2, 3, 5, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6, 3, 3, 3, 3, 7, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 4, 6,
+ 5, 5, 5, 5, 5, 5, 9, 5, 5, 5, 5, 5, 2, 2, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 5};
// Re-construct image from defaultFontData and generate OpenGL texture
//----------------------------------------------------------------------
Image imFont = {
- .data = RL_CALLOC(128*128, 2), // 2 bytes per pixel (gray + alpha)
+ .data = RL_CALLOC(128 * 128, 2), // 2 bytes per pixel (gray + alpha)
.width = 128,
.height = 128,
.mipmaps = 1,
- .format = PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA
- };
+ .format = PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA};
// Fill image.data with defaultFontData (convert from bit to pixel!)
- for (int i = 0, counter = 0; i < imFont.width*imFont.height; i += 32)
+ for (int i = 0, counter = 0; i < imFont.width * imFont.height; i += 32)
{
for (int j = 31; j >= 0; j--)
{
@@ -246,7 +245,8 @@ extern void LoadFontDefault(void)
// we must consider data as little-endian order (alpha + gray)
((unsigned short *)imFont.data)[i + j] = 0xffff;
}
- else ((unsigned short *)imFont.data)[i + j] = 0x00ff;
+ else
+ ((unsigned short *)imFont.data)[i + j] = 0x00ff;
}
counter++;
@@ -259,8 +259,8 @@ extern void LoadFontDefault(void)
// Allocate space for our characters info data
// NOTE: This memory must be freed at end! --> Done by CloseWindow()
- defaultFont.glyphs = (GlyphInfo *)RL_MALLOC(defaultFont.glyphCount*sizeof(GlyphInfo));
- defaultFont.recs = (Rectangle *)RL_MALLOC(defaultFont.glyphCount*sizeof(Rectangle));
+ defaultFont.glyphs = (GlyphInfo *)RL_MALLOC(defaultFont.glyphCount * sizeof(GlyphInfo));
+ defaultFont.recs = (Rectangle *)RL_MALLOC(defaultFont.glyphCount * sizeof(Rectangle));
int currentLine = 0;
int currentPosX = charsDivisor;
@@ -268,10 +268,10 @@ extern void LoadFontDefault(void)
for (int i = 0; i < defaultFont.glyphCount; i++)
{
- defaultFont.glyphs[i].value = 32 + i; // First char is 32
+ defaultFont.glyphs[i].value = 32 + i; // First char is 32
defaultFont.recs[i].x = (float)currentPosX;
- defaultFont.recs[i].y = (float)(charsDivisor + currentLine*(charsHeight + charsDivisor));
+ defaultFont.recs[i].y = (float)(charsDivisor + currentLine * (charsHeight + charsDivisor));
defaultFont.recs[i].width = (float)charsWidth[i];
defaultFont.recs[i].height = (float)charsHeight;
@@ -280,13 +280,14 @@ extern void LoadFontDefault(void)
if (testPosX >= defaultFont.texture.width)
{
currentLine++;
- currentPosX = 2*charsDivisor + charsWidth[i];
+ currentPosX = 2 * charsDivisor + charsWidth[i];
testPosX = currentPosX;
defaultFont.recs[i].x = (float)charsDivisor;
- defaultFont.recs[i].y = (float)(charsDivisor + currentLine*(charsHeight + charsDivisor));
+ defaultFont.recs[i].y = (float)(charsDivisor + currentLine * (charsHeight + charsDivisor));
}
- else currentPosX = testPosX;
+ else
+ currentPosX = testPosX;
// NOTE: On default font character offsets and xAdvance are not required
defaultFont.glyphs[i].offsetX = 0;
@@ -307,12 +308,13 @@ extern void LoadFontDefault(void)
// Unload raylib default font
extern void UnloadFontDefault(void)
{
- for (int i = 0; i < defaultFont.glyphCount; i++) UnloadImage(defaultFont.glyphs[i].image);
+ for (int i = 0; i < defaultFont.glyphCount; i++)
+ UnloadImage(defaultFont.glyphs[i].image);
UnloadTexture(defaultFont.texture);
RL_FREE(defaultFont.glyphs);
RL_FREE(defaultFont.recs);
}
-#endif // SUPPORT_DEFAULT_FONT
+#endif // SUPPORT_DEFAULT_FONT
// Get the default font, useful to be used with extended parameters
Font GetFontDefault()
@@ -320,7 +322,7 @@ Font GetFontDefault()
#if defined(SUPPORT_DEFAULT_FONT)
return defaultFont;
#else
- Font font = { 0 };
+ Font font = {0};
return font;
#endif
}
@@ -330,35 +332,39 @@ Font LoadFont(const char *fileName)
{
// Default values for ttf font generation
#ifndef FONT_TTF_DEFAULT_SIZE
- #define FONT_TTF_DEFAULT_SIZE 32 // TTF font generation default char size (char-height)
+#define FONT_TTF_DEFAULT_SIZE 32 // TTF font generation default char size (char-height)
#endif
#ifndef FONT_TTF_DEFAULT_NUMCHARS
- #define FONT_TTF_DEFAULT_NUMCHARS 95 // TTF font generation default charset: 95 glyphs (ASCII 32..126)
+#define FONT_TTF_DEFAULT_NUMCHARS 95 // TTF font generation default charset: 95 glyphs (ASCII 32..126)
#endif
#ifndef FONT_TTF_DEFAULT_FIRST_CHAR
- #define FONT_TTF_DEFAULT_FIRST_CHAR 32 // TTF font generation default first char for image sprite font (32-Space)
+#define FONT_TTF_DEFAULT_FIRST_CHAR 32 // TTF font generation default first char for image sprite font (32-Space)
#endif
#ifndef FONT_TTF_DEFAULT_CHARS_PADDING
- #define FONT_TTF_DEFAULT_CHARS_PADDING 4 // TTF font generation default chars padding
+#define FONT_TTF_DEFAULT_CHARS_PADDING 4 // TTF font generation default chars padding
#endif
- Font font = { 0 };
+ Font font = {0};
#if defined(SUPPORT_FILEFORMAT_TTF)
- if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS);
+ if (IsFileExtension(fileName, ".ttf") || IsFileExtension(fileName, ".otf"))
+ font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS);
else
#endif
#if defined(SUPPORT_FILEFORMAT_FNT)
- if (IsFileExtension(fileName, ".fnt")) font = LoadBMFont(fileName);
+ if (IsFileExtension(fileName, ".fnt"))
+ font = LoadBMFont(fileName);
else
#endif
#if defined(SUPPORT_FILEFORMAT_BDF)
- if (IsFileExtension(fileName, ".bdf")) font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS);
+ if (IsFileExtension(fileName, ".bdf"))
+ font = LoadFontEx(fileName, FONT_TTF_DEFAULT_SIZE, NULL, FONT_TTF_DEFAULT_NUMCHARS);
else
#endif
{
Image image = LoadImage(fileName);
- if (image.data != NULL) font = LoadFontFromImage(image, MAGENTA, FONT_TTF_DEFAULT_FIRST_CHAR);
+ if (image.data != NULL)
+ font = LoadFontFromImage(image, MAGENTA, FONT_TTF_DEFAULT_FIRST_CHAR);
UnloadImage(image);
}
@@ -369,7 +375,7 @@ Font LoadFont(const char *fileName)
}
else
{
- SetTextureFilter(font.texture, TEXTURE_FILTER_POINT); // By default, we set point filter (the best performance)
+ SetTextureFilter(font.texture, TEXTURE_FILTER_POINT); // By default, we set point filter (the best performance)
TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", FONT_TTF_DEFAULT_SIZE, FONT_TTF_DEFAULT_NUMCHARS);
}
@@ -381,7 +387,7 @@ Font LoadFont(const char *fileName)
// if array is NULL, default char set is selected 32..126
Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount)
{
- Font font = { 0 };
+ Font font = {0};
// Loading file to memory
int dataSize = 0;
@@ -394,7 +400,8 @@ Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepoi
UnloadFileData(fileData);
}
- else font = GetFontDefault();
+ else
+ font = GetFontDefault();
return font;
}
@@ -403,10 +410,10 @@ Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepoi
Font LoadFontFromImage(Image image, Color key, int firstChar)
{
#ifndef MAX_GLYPHS_FROM_IMAGE
- #define MAX_GLYPHS_FROM_IMAGE 256 // Maximum number of glyphs supported on image scan
+#define MAX_GLYPHS_FROM_IMAGE 256 // Maximum number of glyphs supported on image scan
#endif
- #define COLOR_EQUAL(col1, col2) ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a))
+#define COLOR_EQUAL(col1, col2) ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a))
Font font = GetFontDefault();
@@ -418,8 +425,8 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
// We allocate a temporal arrays for chars data measures,
// once we get the actual number of chars, we copy data to a sized arrays
- int tempCharValues[MAX_GLYPHS_FROM_IMAGE] = { 0 };
- Rectangle tempCharRecs[MAX_GLYPHS_FROM_IMAGE] = { 0 };
+ int tempCharValues[MAX_GLYPHS_FROM_IMAGE] = {0};
+ Rectangle tempCharRecs[MAX_GLYPHS_FROM_IMAGE] = {0};
Color *pixels = LoadImageColors(image);
@@ -428,13 +435,16 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
{
for (x = 0; x < image.width; x++)
{
- if (!COLOR_EQUAL(pixels[y*image.width + x], key)) break;
+ if (!COLOR_EQUAL(pixels[y * image.width + x], key))
+ break;
}
- if (!COLOR_EQUAL(pixels[y*image.width + x], key)) break;
+ if (!COLOR_EQUAL(pixels[y * image.width + x], key))
+ break;
}
- if ((x == 0) || (y == 0)) return font; // Security check
+ if ((x == 0) || (y == 0))
+ return font; // Security check
charSpacing = x;
lineSpacing = y;
@@ -442,7 +452,8 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
int charHeight = 0;
int j = 0;
- while (!COLOR_EQUAL(pixels[(lineSpacing + j)*image.width + charSpacing], key)) j++;
+ while (!COLOR_EQUAL(pixels[(lineSpacing + j) * image.width + charSpacing], key))
+ j++;
charHeight = j;
@@ -452,20 +463,21 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
int xPosToRead = charSpacing;
// Parse image data to get rectangle sizes
- while ((lineSpacing + lineToRead*(charHeight + lineSpacing)) < image.height)
+ while ((lineSpacing + lineToRead * (charHeight + lineSpacing)) < image.height)
{
while ((xPosToRead < image.width) &&
- !COLOR_EQUAL((pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead]), key))
+ !COLOR_EQUAL((pixels[(lineSpacing + (charHeight + lineSpacing) * lineToRead) * image.width + xPosToRead]), key))
{
tempCharValues[index] = firstChar + index;
tempCharRecs[index].x = (float)xPosToRead;
- tempCharRecs[index].y = (float)(lineSpacing + lineToRead*(charHeight + lineSpacing));
+ tempCharRecs[index].y = (float)(lineSpacing + lineToRead * (charHeight + lineSpacing));
tempCharRecs[index].height = (float)charHeight;
int charWidth = 0;
- while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
+ while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight + lineSpacing) * lineToRead) * image.width + xPosToRead + charWidth], key))
+ charWidth++;
tempCharRecs[index].width = (float)charWidth;
@@ -480,7 +492,9 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
// NOTE: We need to remove key color borders from image to avoid weird
// artifacts on texture scaling when using TEXTURE_FILTER_BILINEAR or TEXTURE_FILTER_TRILINEAR
- for (int i = 0; i < image.height*image.width; i++) if (COLOR_EQUAL(pixels[i], key)) pixels[i] = BLANK;
+ for (int i = 0; i < image.height * image.width; i++)
+ if (COLOR_EQUAL(pixels[i], key))
+ pixels[i] = BLANK;
// Create a new image with the processed color data (key color replaced by BLANK)
Image fontClear = {
@@ -488,8 +502,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
.width = image.width,
.height = image.height,
.mipmaps = 1,
- .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
- };
+ .format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8};
// Set font with all data parsed from image
font.texture = LoadTextureFromImage(fontClear); // Convert processed image to OpenGL texture
@@ -498,8 +511,8 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
// We got tempCharValues and tempCharsRecs populated with chars data
// Now we move temp data to sized charValues and charRecs arrays
- font.glyphs = (GlyphInfo *)RL_MALLOC(font.glyphCount*sizeof(GlyphInfo));
- font.recs = (Rectangle *)RL_MALLOC(font.glyphCount*sizeof(Rectangle));
+ font.glyphs = (GlyphInfo *)RL_MALLOC(font.glyphCount * sizeof(GlyphInfo));
+ font.recs = (Rectangle *)RL_MALLOC(font.glyphCount * sizeof(Rectangle));
for (int i = 0; i < font.glyphCount; i++)
{
@@ -517,7 +530,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
font.glyphs[i].image = ImageFromImage(fontClear, tempCharRecs[i]);
}
- UnloadImage(fontClear); // Unload processed image once converted to texture
+ UnloadImage(fontClear); // Unload processed image once converted to texture
font.baseSize = (int)font.recs[0].height;
@@ -527,13 +540,13 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
// Load font from memory buffer, fileType refers to extension: i.e. ".ttf"
Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount)
{
- Font font = { 0 };
+ Font font = {0};
- char fileExtLower[16] = { 0 };
+ char fileExtLower[16] = {0};
strncpy(fileExtLower, TextToLower(fileType), 16 - 1);
font.baseSize = fontSize;
- font.glyphCount = (codepointCount > 0)? codepointCount : 95;
+ font.glyphCount = (codepointCount > 0) ? codepointCount : 95;
font.glyphPadding = 0;
#if defined(SUPPORT_FILEFORMAT_TTF)
@@ -545,7 +558,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
else
#endif
#if defined(SUPPORT_FILEFORMAT_BDF)
- if (TextIsEqual(fileExtLower, ".bdf"))
+ if (TextIsEqual(fileExtLower, ".bdf"))
{
font.glyphs = LoadFontDataBDF(fileData, dataSize, codepoints, font.glyphCount, &font.baseSize);
}
@@ -574,7 +587,8 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", font.baseSize, font.glyphCount);
}
- else font = GetFontDefault();
+ else
+ font = GetFontDefault();
#else
font = GetFontDefault();
#endif
@@ -585,11 +599,11 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
// Check if a font is ready
bool IsFontReady(Font font)
{
- return ((font.texture.id > 0) && // Validate OpenGL id fot font texture atlas
- (font.baseSize > 0) && // Validate font size
- (font.glyphCount > 0) && // Validate font contains some glyph
- (font.recs != NULL) && // Validate font recs defining glyphs on texture atlas
- (font.glyphs != NULL)); // Validate glyph data is loaded
+ return ((font.texture.id > 0) && // Validate OpenGL id fot font texture atlas
+ (font.baseSize > 0) && // Validate font size
+ (font.glyphCount > 0) && // Validate font contains some glyph
+ (font.recs != NULL) && // Validate font recs defining glyphs on texture atlas
+ (font.glyphs != NULL)); // Validate glyph data is loaded
// NOTE: Further validations could be done to verify if recs count and glyphs count
// match glyphCount and to verify that data contained is valid (glyphs values, metrics...)
@@ -602,16 +616,16 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
// NOTE: Using some SDF generation default values,
// trades off precision with ability to handle *smaller* sizes
#ifndef FONT_SDF_CHAR_PADDING
- #define FONT_SDF_CHAR_PADDING 4 // SDF font generation char padding
+#define FONT_SDF_CHAR_PADDING 4 // SDF font generation char padding
#endif
#ifndef FONT_SDF_ON_EDGE_VALUE
- #define FONT_SDF_ON_EDGE_VALUE 128 // SDF font generation on edge value
+#define FONT_SDF_ON_EDGE_VALUE 128 // SDF font generation on edge value
#endif
#ifndef FONT_SDF_PIXEL_DIST_SCALE
- #define FONT_SDF_PIXEL_DIST_SCALE 64.0f // SDF font generation pixel distance scale
+#define FONT_SDF_PIXEL_DIST_SCALE 64.0f // SDF font generation pixel distance scale
#endif
#ifndef FONT_BITMAP_ALPHA_THRESHOLD
- #define FONT_BITMAP_ALPHA_THRESHOLD 80 // Bitmap (B&W) font generation alpha threshold
+#define FONT_BITMAP_ALPHA_THRESHOLD 80 // Bitmap (B&W) font generation alpha threshold
#endif
GlyphInfo *chars = NULL;
@@ -622,9 +636,9 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
if (fileData != NULL)
{
bool genFontChars = false;
- stbtt_fontinfo fontInfo = { 0 };
+ stbtt_fontinfo fontInfo = {0};
- if (stbtt_InitFont(&fontInfo, (unsigned char *)fileData, 0)) // Initialize font for data reading
+ if (stbtt_InitFont(&fontInfo, (unsigned char *)fileData, 0)) // Initialize font for data reading
{
// Calculate font scale factor
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float)fontSize);
@@ -635,14 +649,15 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
stbtt_GetFontVMetrics(&fontInfo, &ascent, &descent, &lineGap);
// In case no chars count provided, default to 95
- codepointCount = (codepointCount > 0)? codepointCount : 95;
+ codepointCount = (codepointCount > 0) ? codepointCount : 95;
// Fill fontChars in case not provided externally
// NOTE: By default we fill glyphCount consecutively, starting at 32 (Space)
if (codepoints == NULL)
{
- codepoints = (int *)RL_MALLOC(codepointCount*sizeof(int));
- for (int i = 0; i < codepointCount; i++) codepoints[i] = i + 32;
+ codepoints = (int *)RL_MALLOC(codepointCount * sizeof(int));
+ for (int i = 0; i < codepointCount; i++)
+ codepoints[i] = i + 32;
genFontChars = true;
}
@@ -652,7 +667,7 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
for (int i = 0; i < codepointCount; i++)
{
int chw = 0, chh = 0; // Character width and height (on generation)
- int ch = codepoints[i]; // Character value to get info for
+ int ch = codepoints[i]; // Character value to get info for
chars[i].value = ch;
// Render a unicode codepoint to a bitmap
@@ -668,16 +683,22 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
{
switch (type)
{
- case FONT_DEFAULT:
- case FONT_BITMAP: chars[i].image.data = stbtt_GetCodepointBitmap(&fontInfo, scaleFactor, scaleFactor, ch, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY); break;
- case FONT_SDF: if (ch != 32) chars[i].image.data = stbtt_GetCodepointSDF(&fontInfo, scaleFactor, ch, FONT_SDF_CHAR_PADDING, FONT_SDF_ON_EDGE_VALUE, FONT_SDF_PIXEL_DIST_SCALE, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY); break;
- default: break;
+ case FONT_DEFAULT:
+ case FONT_BITMAP:
+ chars[i].image.data = stbtt_GetCodepointBitmap(&fontInfo, scaleFactor, scaleFactor, ch, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY);
+ break;
+ case FONT_SDF:
+ if (ch != 32)
+ chars[i].image.data = stbtt_GetCodepointSDF(&fontInfo, scaleFactor, ch, FONT_SDF_CHAR_PADDING, FONT_SDF_ON_EDGE_VALUE, FONT_SDF_PIXEL_DIST_SCALE, &chw, &chh, &chars[i].offsetX, &chars[i].offsetY);
+ break;
+ default:
+ break;
}
- if (chars[i].image.data != NULL) // Glyph data has been found in the font
+ if (chars[i].image.data != NULL) // Glyph data has been found in the font
{
stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL);
- chars[i].advanceX = (int)((float)chars[i].advanceX*scaleFactor);
+ chars[i].advanceX = (int)((float)chars[i].advanceX * scaleFactor);
// Load characters images
chars[i].image.width = chw;
@@ -685,7 +706,7 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
chars[i].image.mipmaps = 1;
chars[i].image.format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE;
- chars[i].offsetY += (int)((float)ascent*scaleFactor);
+ chars[i].offsetY += (int)((float)ascent * scaleFactor);
}
// NOTE: We create an empty image for space character,
@@ -693,15 +714,14 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
if (ch == 32)
{
stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL);
- chars[i].advanceX = (int)((float)chars[i].advanceX*scaleFactor);
+ chars[i].advanceX = (int)((float)chars[i].advanceX * scaleFactor);
Image imSpace = {
- .data = RL_CALLOC(chars[i].advanceX*fontSize, 2),
+ .data = RL_CALLOC(chars[i].advanceX * fontSize, 2),
.width = chars[i].advanceX,
.height = fontSize,
.mipmaps = 1,
- .format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE
- };
+ .format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE};
chars[i].image = imSpace;
}
@@ -710,10 +730,12 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
{
// Aliased bitmap (black & white) font generation, avoiding anti-aliasing
// NOTE: For optimum results, bitmap font should be generated at base pixel size
- for (int p = 0; p < chw*chh; p++)
+ for (int p = 0; p < chw * chh; p++)
{
- if (((unsigned char *)chars[i].image.data)[p] < FONT_BITMAP_ALPHA_THRESHOLD) ((unsigned char *)chars[i].image.data)[p] = 0;
- else ((unsigned char *)chars[i].image.data)[p] = 255;
+ if (((unsigned char *)chars[i].image.data)[p] < FONT_BITMAP_ALPHA_THRESHOLD)
+ ((unsigned char *)chars[i].image.data)[p] = 0;
+ else
+ ((unsigned char *)chars[i].image.data)[p] = 255;
}
}
}
@@ -723,9 +745,11 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
}
}
}
- else TRACELOG(LOG_WARNING, "FONT: Failed to process TTF font data");
+ else
+ TRACELOG(LOG_WARNING, "FONT: Failed to process TTF font data");
- if (genFontChars) RL_FREE(codepoints);
+ if (genFontChars)
+ RL_FREE(codepoints);
}
#endif
@@ -737,7 +761,7 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
#if defined(SUPPORT_FILEFORMAT_TTF) || defined(SUPPORT_FILEFORMAT_BDF)
Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyphCount, int fontSize, int padding, int packMethod)
{
- Image atlas = { 0 };
+ Image atlas = {0};
if (glyphs == NULL)
{
@@ -748,10 +772,10 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
*glyphRecs = NULL;
// In case no chars count provided we suppose default of 95
- glyphCount = (glyphCount > 0)? glyphCount : 95;
+ glyphCount = (glyphCount > 0) ? glyphCount : 95;
// NOTE: Rectangles memory is loaded here!
- Rectangle *recs = (Rectangle *)RL_MALLOC(glyphCount*sizeof(Rectangle));
+ Rectangle *recs = (Rectangle *)RL_MALLOC(glyphCount * sizeof(Rectangle));
// Calculate image size based on total glyph width and glyph row count
int totalWidth = 0;
@@ -759,51 +783,52 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
for (int i = 0; i < glyphCount; i++)
{
- if (glyphs[i].image.width > maxGlyphWidth) maxGlyphWidth = glyphs[i].image.width;
- totalWidth += glyphs[i].image.width + 2*padding;
+ if (glyphs[i].image.width > maxGlyphWidth)
+ maxGlyphWidth = glyphs[i].image.width;
+ totalWidth += glyphs[i].image.width + 2 * padding;
}
-//#define SUPPORT_FONT_ATLAS_SIZE_CONSERVATIVE
+// #define SUPPORT_FONT_ATLAS_SIZE_CONSERVATIVE
#if defined(SUPPORT_FONT_ATLAS_SIZE_CONSERVATIVE)
int rowCount = 0;
- int imageSize = 64; // Define minimum starting value to avoid unnecessary calculation steps for very small images
+ int imageSize = 64; // Define minimum starting value to avoid unnecessary calculation steps for very small images
// NOTE: maxGlyphWidth is maximum possible space left at the end of row
- while (totalWidth > (imageSize - maxGlyphWidth)*rowCount)
+ while (totalWidth > (imageSize - maxGlyphWidth) * rowCount)
{
- imageSize *= 2; // Double the size of image (to keep POT)
- rowCount = imageSize/(fontSize + 2*padding); // Calculate new row count for the new image size
+ imageSize *= 2; // Double the size of image (to keep POT)
+ rowCount = imageSize / (fontSize + 2 * padding); // Calculate new row count for the new image size
}
- atlas.width = imageSize; // Atlas bitmap width
- atlas.height = imageSize; // Atlas bitmap height
+ atlas.width = imageSize; // Atlas bitmap width
+ atlas.height = imageSize; // Atlas bitmap height
#else
- int paddedFontSize = fontSize + 2*padding;
+ int paddedFontSize = fontSize + 2 * padding;
// No need for a so-conservative atlas generation
- float totalArea = totalWidth*paddedFontSize*1.2f;
+ float totalArea = totalWidth * paddedFontSize * 1.2f;
float imageMinSize = sqrtf(totalArea);
- int imageSize = (int)powf(2, ceilf(logf(imageMinSize)/logf(2)));
+ int imageSize = (int)powf(2, ceilf(logf(imageMinSize) / logf(2)));
- if (totalArea < ((imageSize*imageSize)/2))
+ if (totalArea < ((imageSize * imageSize) / 2))
{
- atlas.width = imageSize; // Atlas bitmap width
- atlas.height = imageSize/2; // Atlas bitmap height
+ atlas.width = imageSize; // Atlas bitmap width
+ atlas.height = imageSize / 2; // Atlas bitmap height
}
else
{
- atlas.width = imageSize; // Atlas bitmap width
- atlas.height = imageSize; // Atlas bitmap height
+ atlas.width = imageSize; // Atlas bitmap width
+ atlas.height = imageSize; // Atlas bitmap height
}
#endif
- atlas.data = (unsigned char *)RL_CALLOC(1, atlas.width*atlas.height); // Create a bitmap to store characters (8 bpp)
+ atlas.data = (unsigned char *)RL_CALLOC(1, atlas.width * atlas.height); // Create a bitmap to store characters (8 bpp)
atlas.format = PIXELFORMAT_UNCOMPRESSED_GRAYSCALE;
atlas.mipmaps = 1;
// DEBUG: We can see padding in the generated image setting a gray background...
- //for (int i = 0; i < atlas.width*atlas.height; i++) ((unsigned char *)atlas.data)[i] = 100;
+ // for (int i = 0; i < atlas.width*atlas.height; i++) ((unsigned char *)atlas.data)[i] = 100;
- if (packMethod == 0) // Use basic packing algorithm
+ if (packMethod == 0) // Use basic packing algorithm
{
int offsetX = padding;
int offsetY = padding;
@@ -812,14 +837,14 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
for (int i = 0; i < glyphCount; i++)
{
// Check remaining space for glyph
- if (offsetX >= (atlas.width - glyphs[i].image.width - 2*padding))
+ if (offsetX >= (atlas.width - glyphs[i].image.width - 2 * padding))
{
offsetX = padding;
// NOTE: Be careful on offsetY for SDF fonts, by default SDF
// use an internal padding of 4 pixels, it means char rectangle
// height is bigger than fontSize, it could be up to (fontSize + 8)
- offsetY += (fontSize + 2*padding);
+ offsetY += (fontSize + 2 * padding);
if (offsetY > (atlas.height - fontSize - padding))
{
@@ -841,7 +866,7 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
{
for (int x = 0; x < glyphs[i].image.width; x++)
{
- ((unsigned char *)atlas.data)[(offsetY + y)*atlas.width + (offsetX + x)] = ((unsigned char *)glyphs[i].image.data)[y*glyphs[i].image.width + x];
+ ((unsigned char *)atlas.data)[(offsetY + y) * atlas.width + (offsetX + x)] = ((unsigned char *)glyphs[i].image.data)[y * glyphs[i].image.width + x];
}
}
@@ -852,23 +877,23 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
recs[i].height = (float)glyphs[i].image.height;
// Move atlas position X for next character drawing
- offsetX += (glyphs[i].image.width + 2*padding);
+ offsetX += (glyphs[i].image.width + 2 * padding);
}
}
- else if (packMethod == 1) // Use Skyline rect packing algorithm (stb_pack_rect)
+ else if (packMethod == 1) // Use Skyline rect packing algorithm (stb_pack_rect)
{
stbrp_context *context = (stbrp_context *)RL_MALLOC(sizeof(*context));
- stbrp_node *nodes = (stbrp_node *)RL_MALLOC(glyphCount*sizeof(*nodes));
+ stbrp_node *nodes = (stbrp_node *)RL_MALLOC(glyphCount * sizeof(*nodes));
stbrp_init_target(context, atlas.width, atlas.height, nodes, glyphCount);
- stbrp_rect *rects = (stbrp_rect *)RL_MALLOC(glyphCount*sizeof(stbrp_rect));
+ stbrp_rect *rects = (stbrp_rect *)RL_MALLOC(glyphCount * sizeof(stbrp_rect));
// Fill rectangles for packaging
for (int i = 0; i < glyphCount; i++)
{
rects[i].id = i;
- rects[i].w = glyphs[i].image.width + 2*padding;
- rects[i].h = glyphs[i].image.height + 2*padding;
+ rects[i].w = glyphs[i].image.width + 2 * padding;
+ rects[i].h = glyphs[i].image.height + 2 * padding;
}
// Package rectangles into atlas
@@ -889,11 +914,12 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
{
for (int x = 0; x < glyphs[i].image.width; x++)
{
- ((unsigned char *)atlas.data)[(rects[i].y + padding + y)*atlas.width + (rects[i].x + padding + x)] = ((unsigned char *)glyphs[i].image.data)[y*glyphs[i].image.width + x];
+ ((unsigned char *)atlas.data)[(rects[i].y + padding + y) * atlas.width + (rects[i].x + padding + x)] = ((unsigned char *)glyphs[i].image.data)[y * glyphs[i].image.width + x];
}
}
}
- else TRACELOG(LOG_WARNING, "FONT: Failed to package character (%i)", i);
+ else
+ TRACELOG(LOG_WARNING, "FONT: Failed to package character (%i)", i);
}
RL_FREE(rects);
@@ -905,7 +931,7 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
// Add a 3x3 white rectangle at the bottom-right corner of the generated atlas,
// useful to use as the white texture to draw shapes with raylib, using this rectangle
// shapes and text can be backed into a single draw call: SetShapesTexture()
- for (int i = 0, k = atlas.width*atlas.height - 1; i < 3; i++)
+ for (int i = 0, k = atlas.width * atlas.height - 1; i < 3; i++)
{
((unsigned char *)atlas.data)[k - 0] = 255;
((unsigned char *)atlas.data)[k - 1] = 255;
@@ -915,9 +941,9 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
#endif
// Convert image data from GRAYSCALE to GRAY_ALPHA
- unsigned char *dataGrayAlpha = (unsigned char *)RL_MALLOC(atlas.width*atlas.height*sizeof(unsigned char)*2); // Two channels
+ unsigned char *dataGrayAlpha = (unsigned char *)RL_MALLOC(atlas.width * atlas.height * sizeof(unsigned char) * 2); // Two channels
- for (int i = 0, k = 0; i < atlas.width*atlas.height; i++, k += 2)
+ for (int i = 0, k = 0; i < atlas.width * atlas.height; i++, k += 2)
{
dataGrayAlpha[k] = 255;
dataGrayAlpha[k + 1] = ((unsigned char *)atlas.data)[i];
@@ -938,7 +964,8 @@ void UnloadFontData(GlyphInfo *glyphs, int glyphCount)
{
if (glyphs != NULL)
{
- for (int i = 0; i < glyphCount; i++) UnloadImage(glyphs[i].image);
+ for (int i = 0; i < glyphCount; i++)
+ UnloadImage(glyphs[i].image);
RL_FREE(glyphs);
}
@@ -964,13 +991,13 @@ bool ExportFontAsCode(Font font, const char *fileName)
bool success = false;
#ifndef TEXT_BYTES_PER_LINE
- #define TEXT_BYTES_PER_LINE 20
+#define TEXT_BYTES_PER_LINE 20
#endif
- #define MAX_FONT_DATA_SIZE 1024*1024 // 1 MB
+#define MAX_FONT_DATA_SIZE 1024 * 1024 // 1 MB
// Get file name from path
- char fileNamePascal[256] = { 0 };
+ char fileNamePascal[256] = {0};
strncpy(fileNamePascal, TextToPascal(GetFileNameWithoutExt(fileName)), 256 - 1);
// NOTE: Text data buffer size is estimated considering image data size in bytes
@@ -1000,11 +1027,12 @@ bool ExportFontAsCode(Font font, const char *fileName)
// Support font export and initialization
// NOTE: This mechanism is highly coupled to raylib
Image image = LoadImageFromTexture(font.texture);
- if (image.format != PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA) TRACELOG(LOG_WARNING, "Font export as code: Font image format is not GRAY+ALPHA!");
+ if (image.format != PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA)
+ TRACELOG(LOG_WARNING, "Font export as code: Font image format is not GRAY+ALPHA!");
int imageDataSize = GetPixelDataSize(image.width, image.height, image.format);
// Image data is usually GRAYSCALE + ALPHA and can be reduced to GRAYSCALE
- //ImageFormat(&image, PIXELFORMAT_UNCOMPRESSED_GRAYSCALE);
+ // ImageFormat(&image, PIXELFORMAT_UNCOMPRESSED_GRAYSCALE);
#define SUPPORT_COMPRESSED_FONT_ATLAS
#if defined(SUPPORT_COMPRESSED_FONT_ATLAS)
@@ -1021,7 +1049,8 @@ bool ExportFontAsCode(Font font, const char *fileName)
byteCount += sprintf(txtData + byteCount, "// Font image pixels data compressed (DEFLATE)\n");
byteCount += sprintf(txtData + byteCount, "// NOTE: Original pixel data simplified to GRAYSCALE\n");
byteCount += sprintf(txtData + byteCount, "static unsigned char fontData_%s[COMPRESSED_DATA_SIZE_FONT_%s] = { ", fileNamePascal, TextToUpper(fileNamePascal));
- for (int i = 0; i < compDataSize - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%02x,\n " : "0x%02x, "), compData[i]);
+ for (int i = 0; i < compDataSize - 1; i++)
+ byteCount += sprintf(txtData + byteCount, ((i % TEXT_BYTES_PER_LINE == 0) ? "0x%02x,\n " : "0x%02x, "), compData[i]);
byteCount += sprintf(txtData + byteCount, "0x%02x };\n\n", compData[compDataSize - 1]);
RL_FREE(compData);
#else
@@ -1029,7 +1058,8 @@ bool ExportFontAsCode(Font font, const char *fileName)
byteCount += sprintf(txtData + byteCount, "// Font image pixels data\n");
byteCount += sprintf(txtData + byteCount, "// NOTE: 2 bytes per pixel, GRAY + ALPHA channels\n");
byteCount += sprintf(txtData + byteCount, "static unsigned char fontImageData_%s[%i] = { ", fileNamePascal, imageDataSize);
- for (int i = 0; i < imageDataSize - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%02x,\n " : "0x%02x, "), ((unsigned char *)imFont.data)[i]);
+ for (int i = 0; i < imageDataSize - 1; i++)
+ byteCount += sprintf(txtData + byteCount, ((i % TEXT_BYTES_PER_LINE == 0) ? "0x%02x,\n " : "0x%02x, "), ((unsigned char *)imFont.data)[i]);
byteCount += sprintf(txtData + byteCount, "0x%02x };\n\n", ((unsigned char *)imFont.data)[imageDataSize - 1]);
#endif
@@ -1079,7 +1109,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
// that data is already available as global arrays, we two options to assign that data:
// - 1. Data copy. This option consumes more memory and Font MUST be unloaded by user, requiring additional code
// - 2. Data assignment. This option consumes less memory and Font MUST NOT be unloaded by user because data is on protected DATA segment
-//#define SUPPORT_FONT_DATA_COPY
+// #define SUPPORT_FONT_DATA_COPY
#if defined(SUPPORT_FONT_DATA_COPY)
byteCount += sprintf(txtData + byteCount, " // Copy glyph recs data from global fontRecs\n");
byteCount += sprintf(txtData + byteCount, " // NOTE: Required to avoid issues if trying to free font\n");
@@ -1106,8 +1136,10 @@ bool ExportFontAsCode(Font font, const char *fileName)
RL_FREE(txtData);
- if (success != 0) TRACELOG(LOG_INFO, "FILEIO: [%s] Font as code exported successfully", fileName);
- else TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export font as code", fileName);
+ if (success != 0)
+ TRACELOG(LOG_INFO, "FILEIO: [%s] Font as code exported successfully", fileName);
+ else
+ TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to export font as code", fileName);
return success;
}
@@ -1116,11 +1148,13 @@ bool ExportFontAsCode(Font font, const char *fileName)
// NOTE: Uses default font
void DrawFPS(int posX, int posY)
{
- Color color = LIME; // Good FPS
+ Color color = LIME; // Good FPS
int fps = GetFPS();
- if ((fps < 30) && (fps >= 15)) color = ORANGE; // Warning FPS
- else if (fps < 15) color = RED; // Low FPS
+ if ((fps < 30) && (fps >= 15))
+ color = ORANGE; // Warning FPS
+ else if (fps < 15)
+ color = RED; // Low FPS
DrawText(TextFormat("%2i FPS", fps), posX, posY, 20, color);
}
@@ -1133,11 +1167,12 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
// Check if default font has been loaded
if (GetFontDefault().texture.id != 0)
{
- Vector2 position = { (float)posX, (float)posY };
+ Vector2 position = {(float)posX, (float)posY};
- int defaultFontSize = 10; // Default Font chars height in pixel
- if (fontSize < defaultFontSize) fontSize = defaultFontSize;
- int spacing = fontSize/defaultFontSize;
+ int defaultFontSize = 10; // Default Font chars height in pixel
+ if (fontSize < defaultFontSize)
+ fontSize = defaultFontSize;
+ int spacing = fontSize / defaultFontSize;
DrawTextEx(GetFontDefault(), text, position, (float)fontSize, (float)spacing, color);
}
@@ -1147,14 +1182,15 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
// NOTE: chars spacing is NOT proportional to fontSize
void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint)
{
- if (font.texture.id == 0) font = GetFontDefault(); // Security check in case of not valid font
+ if (font.texture.id == 0)
+ font = GetFontDefault(); // Security check in case of not valid font
- int size = TextLength(text); // Total size in bytes of the text, scanned by codepoints in loop
+ int size = TextLength(text); // Total size in bytes of the text, scanned by codepoints in loop
- float textOffsetY = 0; // Offset between lines (on linebreak '\n')
- float textOffsetX = 0.0f; // Offset X to next character to draw
+ float textOffsetY = 0; // Offset between lines (on linebreak '\n')
+ float textOffsetX = 0.0f; // Offset X to next character to draw
- float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor
+ float scaleFactor = fontSize / font.baseSize; // Character quad scaling factor
for (int i = 0; i < size;)
{
@@ -1173,14 +1209,16 @@ void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, f
{
if ((codepoint != ' ') && (codepoint != '\t'))
{
- DrawTextCodepoint(font, codepoint, (Vector2){ position.x + textOffsetX, position.y + textOffsetY }, fontSize, tint);
+ DrawTextCodepoint(font, codepoint, (Vector2){position.x + textOffsetX, position.y + textOffsetY}, fontSize, tint);
}
- if (font.glyphs[index].advanceX == 0) textOffsetX += ((float)font.recs[index].width*scaleFactor + spacing);
- else textOffsetX += ((float)font.glyphs[index].advanceX*scaleFactor + spacing);
+ if (font.glyphs[index].advanceX == 0)
+ textOffsetX += ((float)font.recs[index].width * scaleFactor + spacing);
+ else
+ textOffsetX += ((float)font.glyphs[index].advanceX * scaleFactor + spacing);
}
- i += codepointByteCount; // Move text bytes counter to next codepoint
+ i += codepointByteCount; // Move text bytes counter to next codepoint
}
}
@@ -1189,11 +1227,11 @@ void DrawTextPro(Font font, const char *text, Vector2 position, Vector2 origin,
{
rlPushMatrix();
- rlTranslatef(position.x, position.y, 0.0f);
- rlRotatef(rotation, 0.0f, 0.0f, 1.0f);
- rlTranslatef(-origin.x, -origin.y, 0.0f);
+ rlTranslatef(position.x, position.y, 0.0f);
+ rlRotatef(rotation, 0.0f, 0.0f, 1.0f);
+ rlTranslatef(-origin.x, -origin.y, 0.0f);
- DrawTextEx(font, text, (Vector2){ 0.0f, 0.0f }, fontSize, spacing, tint);
+ DrawTextEx(font, text, (Vector2){0.0f, 0.0f}, fontSize, spacing, tint);
rlPopMatrix();
}
@@ -1204,31 +1242,31 @@ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSiz
// Character index position in sprite font
// NOTE: In case a codepoint is not available in the font, index returned points to '?'
int index = GetGlyphIndex(font, codepoint);
- float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor
+ float scaleFactor = fontSize / font.baseSize; // Character quad scaling factor
// Character destination rectangle on screen
// NOTE: We consider glyphPadding on drawing
- Rectangle dstRec = { position.x + font.glyphs[index].offsetX*scaleFactor - (float)font.glyphPadding*scaleFactor,
- position.y + font.glyphs[index].offsetY*scaleFactor - (float)font.glyphPadding*scaleFactor,
- (font.recs[index].width + 2.0f*font.glyphPadding)*scaleFactor,
- (font.recs[index].height + 2.0f*font.glyphPadding)*scaleFactor };
+ Rectangle dstRec = {position.x + font.glyphs[index].offsetX * scaleFactor - (float)font.glyphPadding * scaleFactor,
+ position.y + font.glyphs[index].offsetY * scaleFactor - (float)font.glyphPadding * scaleFactor,
+ (font.recs[index].width + 2.0f * font.glyphPadding) * scaleFactor,
+ (font.recs[index].height + 2.0f * font.glyphPadding) * scaleFactor};
// Character source rectangle from font texture atlas
// NOTE: We consider chars padding when drawing, it could be required for outline/glow shader effects
- Rectangle srcRec = { font.recs[index].x - (float)font.glyphPadding, font.recs[index].y - (float)font.glyphPadding,
- font.recs[index].width + 2.0f*font.glyphPadding, font.recs[index].height + 2.0f*font.glyphPadding };
+ Rectangle srcRec = {font.recs[index].x - (float)font.glyphPadding, font.recs[index].y - (float)font.glyphPadding,
+ font.recs[index].width + 2.0f * font.glyphPadding, font.recs[index].height + 2.0f * font.glyphPadding};
// Draw the character texture on the screen
- DrawTexturePro(font.texture, srcRec, dstRec, (Vector2){ 0, 0 }, 0.0f, tint);
+ DrawTexturePro(font.texture, srcRec, dstRec, (Vector2){0, 0}, 0.0f, tint);
}
// Draw multiple character (codepoints)
void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint)
{
- float textOffsetY = 0; // Offset between lines (on linebreak '\n')
- float textOffsetX = 0.0f; // Offset X to next character to draw
+ float textOffsetY = 0; // Offset between lines (on linebreak '\n')
+ float textOffsetX = 0.0f; // Offset X to next character to draw
- float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor
+ float scaleFactor = fontSize / font.baseSize; // Character quad scaling factor
for (int i = 0; i < codepointCount; i++)
{
@@ -1244,11 +1282,13 @@ void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Ve
{
if ((codepoints[i] != ' ') && (codepoints[i] != '\t'))
{
- DrawTextCodepoint(font, codepoints[i], (Vector2){ position.x + textOffsetX, position.y + textOffsetY }, fontSize, tint);
+ DrawTextCodepoint(font, codepoints[i], (Vector2){position.x + textOffsetX, position.y + textOffsetY}, fontSize, tint);
}
- if (font.glyphs[index].advanceX == 0) textOffsetX += ((float)font.recs[index].width*scaleFactor + spacing);
- else textOffsetX += ((float)font.glyphs[index].advanceX*scaleFactor + spacing);
+ if (font.glyphs[index].advanceX == 0)
+ textOffsetX += ((float)font.recs[index].width * scaleFactor + spacing);
+ else
+ textOffsetX += ((float)font.glyphs[index].advanceX * scaleFactor + spacing);
}
}
}
@@ -1262,14 +1302,15 @@ void SetTextLineSpacing(int spacing)
// Measure string width for default font
int MeasureText(const char *text, int fontSize)
{
- Vector2 textSize = { 0.0f, 0.0f };
+ Vector2 textSize = {0.0f, 0.0f};
// Check if default font has been loaded
if (GetFontDefault().texture.id != 0)
{
- int defaultFontSize = 10; // Default Font chars height in pixel
- if (fontSize < defaultFontSize) fontSize = defaultFontSize;
- int spacing = fontSize/defaultFontSize;
+ int defaultFontSize = 10; // Default Font chars height in pixel
+ if (fontSize < defaultFontSize)
+ fontSize = defaultFontSize;
+ int spacing = fontSize / defaultFontSize;
textSize = MeasureTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing);
}
@@ -1280,22 +1321,23 @@ int MeasureText(const char *text, int fontSize)
// Measure string size for Font
Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing)
{
- Vector2 textSize = { 0 };
+ Vector2 textSize = {0};
- if ((font.texture.id == 0) || (text == NULL)) return textSize; // Security check
+ if ((font.texture.id == 0) || (text == NULL))
+ return textSize; // Security check
- int size = TextLength(text); // Get size in bytes of text
- int tempByteCounter = 0; // Used to count longer text line num chars
+ int size = TextLength(text); // Get size in bytes of text
+ int tempByteCounter = 0; // Used to count longer text line num chars
int byteCounter = 0;
float textWidth = 0.0f;
- float tempTextWidth = 0.0f; // Used to count longer text line width
+ float tempTextWidth = 0.0f; // Used to count longer text line width
float textHeight = fontSize;
- float scaleFactor = fontSize/(float)font.baseSize;
+ float scaleFactor = fontSize / (float)font.baseSize;
- int letter = 0; // Current character
- int index = 0; // Index position in sprite font
+ int letter = 0; // Current character
+ int index = 0; // Index position in sprite font
for (int i = 0; i < size;)
{
@@ -1309,12 +1351,15 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
if (letter != '\n')
{
- if (font.glyphs[index].advanceX != 0) textWidth += font.glyphs[index].advanceX;
- else textWidth += (font.recs[index].width + font.glyphs[index].offsetX);
+ if (font.glyphs[index].advanceX != 0)
+ textWidth += font.glyphs[index].advanceX;
+ else
+ textWidth += (font.recs[index].width + font.glyphs[index].offsetX);
}
else
{
- if (tempTextWidth < textWidth) tempTextWidth = textWidth;
+ if (tempTextWidth < textWidth)
+ tempTextWidth = textWidth;
byteCounter = 0;
textWidth = 0;
@@ -1322,12 +1367,14 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
textHeight += (fontSize + textLineSpacing);
}
- if (tempByteCounter < byteCounter) tempByteCounter = byteCounter;
+ if (tempByteCounter < byteCounter)
+ tempByteCounter = byteCounter;
}
- if (tempTextWidth < textWidth) tempTextWidth = textWidth;
+ if (tempTextWidth < textWidth)
+ tempTextWidth = textWidth;
- textSize.x = tempTextWidth*scaleFactor + (float)((tempByteCounter - 1)*spacing);
+ textSize.x = tempTextWidth * scaleFactor + (float)((tempByteCounter - 1) * spacing);
textSize.y = textHeight;
return textSize;
@@ -1341,12 +1388,13 @@ int GetGlyphIndex(Font font, int codepoint)
#define SUPPORT_UNORDERED_CHARSET
#if defined(SUPPORT_UNORDERED_CHARSET)
- int fallbackIndex = 0; // Get index of fallback glyph '?'
+ int fallbackIndex = 0; // Get index of fallback glyph '?'
// Look for character index in the unordered charset
for (int i = 0; i < font.glyphCount; i++)
{
- if (font.glyphs[i].value == 63) fallbackIndex = i;
+ if (font.glyphs[i].value == 63)
+ fallbackIndex = i;
if (font.glyphs[i].value == codepoint)
{
@@ -1355,7 +1403,8 @@ int GetGlyphIndex(Font font, int codepoint)
}
}
- if ((index == 0) && (font.glyphs[0].value != codepoint)) index = fallbackIndex;
+ if ((index == 0) && (font.glyphs[0].value != codepoint))
+ index = fallbackIndex;
#else
index = codepoint - 32;
#endif
@@ -1367,7 +1416,7 @@ int GetGlyphIndex(Font font, int codepoint)
// NOTE: If codepoint is not found in the font it fallbacks to '?'
GlyphInfo GetGlyphInfo(Font font, int codepoint)
{
- GlyphInfo info = { 0 };
+ GlyphInfo info = {0};
info = font.glyphs[GetGlyphIndex(font, codepoint)];
@@ -1378,7 +1427,7 @@ GlyphInfo GetGlyphInfo(Font font, int codepoint)
// NOTE: If codepoint is not found in the font it fallbacks to '?'
Rectangle GetGlyphAtlasRec(Font font, int codepoint)
{
- Rectangle rec = { 0 };
+ Rectangle rec = {0};
rec = font.recs[GetGlyphIndex(font, codepoint)];
@@ -1397,7 +1446,8 @@ unsigned int TextLength(const char *text)
{
// NOTE: Alternative: use strlen(text)
- while (*text++) length++;
+ while (*text++)
+ length++;
}
return length;
@@ -1408,15 +1458,15 @@ unsigned int TextLength(const char *text)
const char *TextFormat(const char *text, ...)
{
#ifndef MAX_TEXTFORMAT_BUFFERS
- #define MAX_TEXTFORMAT_BUFFERS 4 // Maximum number of static buffers for text formatting
+#define MAX_TEXTFORMAT_BUFFERS 4 // Maximum number of static buffers for text formatting
#endif
// We create an array of buffers so strings don't expire until MAX_TEXTFORMAT_BUFFERS invocations
- static char buffers[MAX_TEXTFORMAT_BUFFERS][MAX_TEXT_BUFFER_LENGTH] = { 0 };
+ static char buffers[MAX_TEXTFORMAT_BUFFERS][MAX_TEXT_BUFFER_LENGTH] = {0};
static int index = 0;
char *currentBuffer = buffers[index];
- memset(currentBuffer, 0, MAX_TEXT_BUFFER_LENGTH); // Clear buffer before using
+ memset(currentBuffer, 0, MAX_TEXT_BUFFER_LENGTH); // Clear buffer before using
va_list args;
va_start(args, text);
@@ -1431,8 +1481,9 @@ const char *TextFormat(const char *text, ...)
sprintf(truncBuffer, "...");
}
- index += 1; // Move to next buffer for next function call
- if (index >= MAX_TEXTFORMAT_BUFFERS) index = 0;
+ index += 1; // Move to next buffer for next function call
+ if (index >= MAX_TEXTFORMAT_BUFFERS)
+ index = 0;
return currentBuffer;
}
@@ -1446,13 +1497,15 @@ int TextToInteger(const char *text)
if ((text[0] == '+') || (text[0] == '-'))
{
- if (text[0] == '-') sign = -1;
+ if (text[0] == '-')
+ sign = -1;
text++;
}
- for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10 + (int)(text[i] - '0');
+ for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); i++)
+ value = value * 10 + (int)(text[i] - '0');
- return value*sign;
+ return value * sign;
}
// Get float value from text
@@ -1465,21 +1518,24 @@ float TextToFloat(const char *text)
if ((text[0] == '+') || (text[0] == '-'))
{
- if (text[0] == '-') sign = -1.0f;
+ if (text[0] == '-')
+ sign = -1.0f;
text++;
}
int i = 0;
- for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
+ for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
+ value = value * 10.0f + (float)(text[i] - '0');
- if (text[i++] != '.') value *= sign;
+ if (text[i++] != '.')
+ value *= sign;
else
{
float divisor = 10.0f;
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
{
- value += ((float)(text[i] - '0'))/divisor;
- divisor = divisor*10.0f;
+ value += ((float)(text[i] - '0')) / divisor;
+ divisor = divisor * 10.0f;
}
}
@@ -1519,7 +1575,8 @@ bool TextIsEqual(const char *text1, const char *text2)
if ((text1 != NULL) && (text2 != NULL))
{
- if (strcmp(text1, text2) == 0) result = true;
+ if (strcmp(text1, text2) == 0)
+ result = true;
}
return result;
@@ -1528,7 +1585,7 @@ bool TextIsEqual(const char *text1, const char *text2)
// Get a piece of a text string
const char *TextSubtext(const char *text, int position, int length)
{
- static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
+ static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
int textLength = TextLength(text);
@@ -1539,11 +1596,12 @@ const char *TextSubtext(const char *text, int position, int length)
length = 0;
}
- if (length >= textLength) length = textLength;
+ if (length >= textLength)
+ length = textLength;
// NOTE: Alternative: memcpy(buffer, text + position, length)
- for (int c = 0 ; c < length ; c++)
+ for (int c = 0; c < length; c++)
{
*(buffer + c) = *(text + position);
text++;
@@ -1560,30 +1618,34 @@ const char *TextSubtext(const char *text, int position, int length)
char *TextReplace(const char *text, const char *replace, const char *by)
{
// Sanity checks and initialization
- if (!text || !replace || !by) return NULL;
+ if (!text || !replace || !by)
+ return NULL;
char *result = NULL;
- char *insertPoint = NULL; // Next insert point
- char *temp = NULL; // Temp pointer
- int replaceLen = 0; // Replace string length of (the string to remove)
- int byLen = 0; // Replacement length (the string to replace by)
- int lastReplacePos = 0; // Distance between replace and end of last replace
- int count = 0; // Number of replacements
+ char *insertPoint = NULL; // Next insert point
+ char *temp = NULL; // Temp pointer
+ int replaceLen = 0; // Replace string length of (the string to remove)
+ int byLen = 0; // Replacement length (the string to replace by)
+ int lastReplacePos = 0; // Distance between replace and end of last replace
+ int count = 0; // Number of replacements
replaceLen = TextLength(replace);
- if (replaceLen == 0) return NULL; // Empty replace causes infinite loop during count
+ if (replaceLen == 0)
+ return NULL; // Empty replace causes infinite loop during count
byLen = TextLength(by);
// Count the number of replacements needed
- insertPoint = (char*)text;
- for (count = 0; (temp = strstr(insertPoint, replace)); count++) insertPoint = temp + replaceLen;
+ insertPoint = (char *)text;
+ for (count = 0; (temp = strstr(insertPoint, replace)); count++)
+ insertPoint = temp + replaceLen;
// Allocate returning string and point temp to it
- temp = result = (char *)RL_MALLOC(TextLength(text) + (byLen - replaceLen)*count + 1);
+ temp = result = (char *)RL_MALLOC(TextLength(text) + (byLen - replaceLen) * count + 1);
- if (!result) return NULL; // Memory could not be allocated
+ if (!result)
+ return NULL; // Memory could not be allocated
// First time through the loop, all the variable are set correctly from here on,
// - 'temp' points to the end of the result string
@@ -1613,11 +1675,14 @@ char *TextInsert(const char *text, const char *insert, int position)
char *result = (char *)RL_MALLOC(textLen + insertLen + 1);
- for (int i = 0; i < position; i++) result[i] = text[i];
- for (int i = position; i < insertLen + position; i++) result[i] = insert[i];
- for (int i = (insertLen + position); i < (textLen + insertLen); i++) result[i] = text[i];
+ for (int i = 0; i < position; i++)
+ result[i] = text[i];
+ for (int i = position; i < insertLen + position; i++)
+ result[i] = insert[i];
+ for (int i = (insertLen + position); i < (textLen + insertLen); i++)
+ result[i] = text[i];
- result[textLen + insertLen] = '\0'; // Make sure text string is valid!
+ result[textLen + insertLen] = '\0'; // Make sure text string is valid!
return result;
}
@@ -1626,7 +1691,7 @@ char *TextInsert(const char *text, const char *insert, int position)
// REQUIRES: memset(), memcpy()
const char *TextJoin(const char **textList, int count, const char *delimiter)
{
- static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
+ static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
char *textPtr = buffer;
@@ -1666,8 +1731,8 @@ const char **TextSplit(const char *text, char delimiter, int *count)
// 1. Maximum number of possible split strings is set by MAX_TEXTSPLIT_COUNT
// 2. Maximum size of text to split is MAX_TEXT_BUFFER_LENGTH
- static const char *result[MAX_TEXTSPLIT_COUNT] = { NULL };
- static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
+ static const char *result[MAX_TEXTSPLIT_COUNT] = {NULL};
+ static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
result[0] = buffer;
@@ -1681,14 +1746,16 @@ const char **TextSplit(const char *text, char delimiter, int *count)
for (int i = 0; i < MAX_TEXT_BUFFER_LENGTH; i++)
{
buffer[i] = text[i];
- if (buffer[i] == '\0') break;
+ if (buffer[i] == '\0')
+ break;
else if (buffer[i] == delimiter)
{
- buffer[i] = '\0'; // Set an end of string at this point
+ buffer[i] = '\0'; // Set an end of string at this point
result[counter] = buffer + i + 1;
counter++;
- if (counter == MAX_TEXTSPLIT_COUNT) break;
+ if (counter == MAX_TEXTSPLIT_COUNT)
+ break;
}
}
}
@@ -1714,7 +1781,8 @@ int TextFindIndex(const char *text, const char *find)
char *ptr = strstr(text, find);
- if (ptr != NULL) position = (int)(ptr - text);
+ if (ptr != NULL)
+ position = (int)(ptr - text);
return position;
}
@@ -1724,15 +1792,17 @@ int TextFindIndex(const char *text, const char *find)
// TODO: Support UTF-8 diacritics to upper-case, check codepoints
const char *TextToUpper(const char *text)
{
- static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
+ static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
if (text != NULL)
{
for (int i = 0; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[i] != '\0'); i++)
{
- if ((text[i] >= 'a') && (text[i] <= 'z')) buffer[i] = text[i] - 32;
- else buffer[i] = text[i];
+ if ((text[i] >= 'a') && (text[i] <= 'z'))
+ buffer[i] = text[i] - 32;
+ else
+ buffer[i] = text[i];
}
}
@@ -1743,15 +1813,17 @@ const char *TextToUpper(const char *text)
// WARNING: Limited functionality, only basic characters set
const char *TextToLower(const char *text)
{
- static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
+ static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
if (text != NULL)
{
for (int i = 0; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[i] != '\0'); i++)
{
- if ((text[i] >= 'A') && (text[i] <= 'Z')) buffer[i] = text[i] + 32;
- else buffer[i] = text[i];
+ if ((text[i] >= 'A') && (text[i] <= 'Z'))
+ buffer[i] = text[i] + 32;
+ else
+ buffer[i] = text[i];
}
}
@@ -1762,23 +1834,99 @@ const char *TextToLower(const char *text)
// WARNING: Limited functionality, only basic characters set
const char *TextToPascal(const char *text)
{
- static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
+ static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
if (text != NULL)
{
// Upper case first character
- if ((text[0] >= 'a') && (text[0] <= 'z')) buffer[0] = text[0] - 32;
- else buffer[0] = text[0];
+ if ((text[0] >= 'a') && (text[0] <= 'z'))
+ buffer[0] = text[0] - 32;
+ else
+ buffer[0] = text[0];
// Check for next separator to upper case another character
for (int i = 1, j = 1; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[j] != '\0'); i++, j++)
{
- if (text[j] != '_') buffer[i] = text[j];
+ if (text[j] != '_')
+ buffer[i] = text[j];
else
{
j++;
- if ((text[j] >= 'a') && (text[j] <= 'z')) buffer[i] = text[j] - 32;
+ if ((text[j] >= 'a') && (text[j] <= 'z'))
+ buffer[i] = text[j] - 32;
+ }
+ }
+ }
+
+ return buffer;
+}
+
+// Get snake case notation version of provided string
+// WARNING: Limited functionality, only basic characters set
+const char *TextToSnake(const char *text)
+{
+ static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
+ memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
+
+ if (text != NULL)
+ {
+ // Check for next separator to upper case another character
+ for (int i = 0, j = 0; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[j] != '\0'); i++, j++)
+ {
+ if ((text[j] >= 'A') && (text[j] <= 'Z'))
+ {
+ if (i >= 1)
+ {
+ buffer[i] = '_';
+ i++;
+ }
+ buffer[i] = text[j] + 32;
+ }
+ else
+ {
+ buffer[i] = text[j];
+ }
+ }
+ }
+
+ return buffer;
+}
+
+// Get Camel case notation version of provided string
+// WARNING: Limited functionality, only basic characters set
+const char *TextToCamel(const char *text)
+{
+ static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
+ memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
+
+ if (text != NULL)
+ {
+ // Lower case first character
+ if ((text[0] >= 'A') && (text[0] <= 'Z'))
+ buffer[0] = text[0] + 32;
+ else
+ buffer[0] = text[0];
+
+ // Check for next separator to upper case another character
+ for (int i = 1, j = 1; (i < MAX_TEXT_BUFFER_LENGTH - 1) && (text[j] != '\0'); i++, j++)
+ {
+ if (text[j] != '_')
+ buffer[i] = text[j];
+ else
+ {
+ j++;
+ if ((text[j] >= 'a') && (text[j] <= 'z'))
+ {
+ if (i == 0)
+ {
+ buffer[i] = text[j];
+ }
+ else
+ {
+ buffer[i] = text[j] - 32;
+ }
+ }
}
}
}
@@ -1793,7 +1941,7 @@ char *LoadUTF8(const int *codepoints, int length)
{
// We allocate enough memory to fit all possible codepoints
// NOTE: 5 bytes for every codepoint should be enough
- char *text = (char *)RL_CALLOC(length*5, 1);
+ char *text = (char *)RL_CALLOC(length * 5, 1);
const char *utf8 = NULL;
int size = 0;
@@ -1807,7 +1955,8 @@ char *LoadUTF8(const int *codepoints, int length)
// Resize memory to text length + string NULL terminator
void *ptr = RL_REALLOC(text, size + 1);
- if (ptr != NULL) text = (char *)ptr;
+ if (ptr != NULL)
+ text = (char *)ptr;
return text;
}
@@ -1836,8 +1985,9 @@ int *LoadCodepoints(const char *text, int *count)
}
// Re-allocate buffer to the actual number of codepoints loaded
- int *temp = (int *)RL_REALLOC(codepoints, codepointCount*sizeof(int));
- if (temp != NULL) codepoints = temp;
+ int *temp = (int *)RL_REALLOC(codepoints, codepointCount * sizeof(int));
+ if (temp != NULL)
+ codepoints = temp;
*count = codepointCount;
@@ -1874,8 +2024,8 @@ int GetCodepointCount(const char *text)
// NOTE: It uses a static array to store UTF-8 bytes
const char *CodepointToUTF8(int codepoint, int *utf8Size)
{
- static char utf8[6] = { 0 };
- int size = 0; // Byte size of codepoint
+ static char utf8[6] = {0};
+ int size = 0; // Byte size of codepoint
if (codepoint <= 0x7f)
{
@@ -1891,7 +2041,7 @@ const char *CodepointToUTF8(int codepoint, int *utf8Size)
else if (codepoint <= 0xffff)
{
utf8[0] = (char)(((codepoint >> 12) & 0x0f) | 0xe0);
- utf8[1] = (char)(((codepoint >> 6) & 0x3f) | 0x80);
+ utf8[1] = (char)(((codepoint >> 6) & 0x3f) | 0x80);
utf8[2] = (char)((codepoint & 0x3f) | 0x80);
size = 3;
}
@@ -1899,7 +2049,7 @@ const char *CodepointToUTF8(int codepoint, int *utf8Size)
{
utf8[0] = (char)(((codepoint >> 18) & 0x07) | 0xf0);
utf8[1] = (char)(((codepoint >> 12) & 0x3f) | 0x80);
- utf8[2] = (char)(((codepoint >> 6) & 0x3f) | 0x80);
+ utf8[2] = (char)(((codepoint >> 6) & 0x3f) | 0x80);
utf8[3] = (char)((codepoint & 0x3f) | 0x80);
size = 4;
}
@@ -1908,7 +2058,7 @@ const char *CodepointToUTF8(int codepoint, int *utf8Size)
return utf8;
}
-#endif // SUPPORT_TEXT_MANIPULATION
+#endif // SUPPORT_TEXT_MANIPULATION
// Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found
// When an invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned
@@ -1917,20 +2067,20 @@ const char *CodepointToUTF8(int codepoint, int *utf8Size)
// but that character is not supported by the default font in raylib
int GetCodepoint(const char *text, int *codepointSize)
{
-/*
- UTF-8 specs from https://www.ietf.org/rfc/rfc3629.txt
+ /*
+ 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
-*/
+ 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 codepoint = 0x3f; // Codepoint (defaults to '?')
+ int codepoint = 0x3f; // Codepoint (defaults to '?')
int octet = (unsigned char)(text[0]); // The first UTF8 octet
*codepointSize = 1;
@@ -1946,7 +2096,11 @@ int GetCodepoint(const char *text, int *codepointSize)
// [0]xC2-DF [1]UTF8-tail(x80-BF)
unsigned char octet1 = text[1];
- if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *codepointSize = 2; return codepoint; } // Unexpected sequence
+ if ((octet1 == '\0') || ((octet1 >> 6) != 2))
+ {
+ *codepointSize = 2;
+ return codepoint;
+ } // Unexpected sequence
if ((octet >= 0xc2) && (octet <= 0xdf))
{
@@ -1960,11 +2114,19 @@ int GetCodepoint(const char *text, int *codepointSize)
unsigned char octet1 = text[1];
unsigned char octet2 = '\0';
- if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *codepointSize = 2; return codepoint; } // Unexpected sequence
+ if ((octet1 == '\0') || ((octet1 >> 6) != 2))
+ {
+ *codepointSize = 2;
+ return codepoint;
+ } // Unexpected sequence
octet2 = text[2];
- if ((octet2 == '\0') || ((octet2 >> 6) != 2)) { *codepointSize = 3; return codepoint; } // Unexpected sequence
+ if ((octet2 == '\0') || ((octet2 >> 6) != 2))
+ {
+ *codepointSize = 3;
+ return codepoint;
+ } // Unexpected sequence
// [0]xE0 [1]xA0-BF [2]UTF8-tail(x80-BF)
// [0]xE1-EC [1]UTF8-tail [2]UTF8-tail(x80-BF)
@@ -1972,7 +2134,11 @@ int GetCodepoint(const char *text, int *codepointSize)
// [0]xEE-EF [1]UTF8-tail [2]UTF8-tail(x80-BF)
if (((octet == 0xe0) && !((octet1 >= 0xa0) && (octet1 <= 0xbf))) ||
- ((octet == 0xed) && !((octet1 >= 0x80) && (octet1 <= 0x9f)))) { *codepointSize = 2; return codepoint; }
+ ((octet == 0xed) && !((octet1 >= 0x80) && (octet1 <= 0x9f))))
+ {
+ *codepointSize = 2;
+ return codepoint;
+ }
if ((octet >= 0xe0) && (octet <= 0xef))
{
@@ -1983,28 +2149,45 @@ int GetCodepoint(const char *text, int *codepointSize)
else if ((octet & 0xf8) == 0xf0)
{
// Four octets
- if (octet > 0xf4) return codepoint;
+ if (octet > 0xf4)
+ return codepoint;
unsigned char octet1 = text[1];
unsigned char octet2 = '\0';
unsigned char octet3 = '\0';
- if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *codepointSize = 2; return codepoint; } // Unexpected sequence
+ if ((octet1 == '\0') || ((octet1 >> 6) != 2))
+ {
+ *codepointSize = 2;
+ return codepoint;
+ } // Unexpected sequence
octet2 = text[2];
- if ((octet2 == '\0') || ((octet2 >> 6) != 2)) { *codepointSize = 3; return codepoint; } // Unexpected sequence
+ if ((octet2 == '\0') || ((octet2 >> 6) != 2))
+ {
+ *codepointSize = 3;
+ return codepoint;
+ } // Unexpected sequence
octet3 = text[3];
- if ((octet3 == '\0') || ((octet3 >> 6) != 2)) { *codepointSize = 4; return codepoint; } // Unexpected sequence
+ if ((octet3 == '\0') || ((octet3 >> 6) != 2))
+ {
+ *codepointSize = 4;
+ return codepoint;
+ } // 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)))) { *codepointSize = 2; return codepoint; } // Unexpected sequence
+ ((octet == 0xf4) && !((octet1 >= 0x80) && (octet1 <= 0x8f))))
+ {
+ *codepointSize = 2;
+ return codepoint;
+ } // Unexpected sequence
if (octet >= 0xf0)
{
@@ -2013,7 +2196,8 @@ int GetCodepoint(const char *text, int *codepointSize)
}
}
- if (codepoint > 0x10ffff) codepoint = 0x3f; // Codepoints after U+10ffff are invalid
+ if (codepoint > 0x10ffff)
+ codepoint = 0x3f; // Codepoints after U+10ffff are invalid
return codepoint;
}
@@ -2022,28 +2206,37 @@ int GetCodepoint(const char *text, int *codepointSize)
int GetCodepointNext(const char *text, int *codepointSize)
{
const char *ptr = text;
- int codepoint = 0x3f; // Codepoint (defaults to '?')
+ int codepoint = 0x3f; // Codepoint (defaults to '?')
*codepointSize = 1;
// Get current codepoint and bytes processed
if (0xf0 == (0xf8 & ptr[0]))
{
// 4 byte UTF-8 codepoint
- if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80) || ((ptr[3] & 0xC0) ^ 0x80)) { return codepoint; } // 10xxxxxx checks
+ if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80) || ((ptr[3] & 0xC0) ^ 0x80))
+ {
+ return codepoint;
+ } // 10xxxxxx checks
codepoint = ((0x07 & ptr[0]) << 18) | ((0x3f & ptr[1]) << 12) | ((0x3f & ptr[2]) << 6) | (0x3f & ptr[3]);
*codepointSize = 4;
}
else if (0xe0 == (0xf0 & ptr[0]))
{
// 3 byte UTF-8 codepoint */
- if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80)) { return codepoint; } // 10xxxxxx checks
+ if (((ptr[1] & 0xC0) ^ 0x80) || ((ptr[2] & 0xC0) ^ 0x80))
+ {
+ return codepoint;
+ } // 10xxxxxx checks
codepoint = ((0x0f & ptr[0]) << 12) | ((0x3f & ptr[1]) << 6) | (0x3f & ptr[2]);
*codepointSize = 3;
}
else if (0xc0 == (0xe0 & ptr[0]))
{
// 2 byte UTF-8 codepoint
- if ((ptr[1] & 0xC0) ^ 0x80) { return codepoint; } // 10xxxxxx checks
+ if ((ptr[1] & 0xC0) ^ 0x80)
+ {
+ return codepoint;
+ } // 10xxxxxx checks
codepoint = ((0x1f & ptr[0]) << 6) | (0x3f & ptr[1]);
*codepointSize = 2;
}
@@ -2061,17 +2254,19 @@ int GetCodepointNext(const char *text, int *codepointSize)
int GetCodepointPrevious(const char *text, int *codepointSize)
{
const char *ptr = text;
- int codepoint = 0x3f; // Codepoint (defaults to '?')
+ int codepoint = 0x3f; // Codepoint (defaults to '?')
int cpSize = 0;
*codepointSize = 0;
// Move to previous codepoint
- do ptr--;
- while (((0x80 & ptr[0]) != 0) && ((0xc0 & ptr[0]) == 0x80));
+ do
+ ptr--;
+ while (((0x80 & ptr[0]) != 0) && ((0xc0 & ptr[0]) == 0x80));
codepoint = GetCodepointNext(ptr, &cpSize);
- if (codepoint != 0) *codepointSize = cpSize;
+ if (codepoint != 0)
+ *codepointSize = cpSize;
return codepoint;
}
@@ -2086,7 +2281,9 @@ int GetCodepointPrevious(const char *text, int *codepointSize)
static int GetLine(const char *origin, char *buffer, int maxLength)
{
int count = 0;
- for (; count < maxLength - 1; count++) if (origin[count] == '\n') break;
+ for (; count < maxLength - 1; count++)
+ if (origin[count] == '\n')
+ break;
memcpy(buffer, origin, count);
buffer[count] = '\0';
return count;
@@ -2098,12 +2295,12 @@ static int GetLine(const char *origin, char *buffer, int maxLength)
// REQUIRES: strstr(), sscanf(), strrchr(), memcpy()
static Font LoadBMFont(const char *fileName)
{
- #define MAX_BUFFER_SIZE 256
- #define MAX_FONT_IMAGE_PAGES 8
+#define MAX_BUFFER_SIZE 256
+#define MAX_FONT_IMAGE_PAGES 8
- Font font = { 0 };
+ Font font = {0};
- char buffer[MAX_BUFFER_SIZE] = { 0 };
+ char buffer[MAX_BUFFER_SIZE] = {0};
char *searchPoint = NULL;
int fontSize = 0;
@@ -2112,15 +2309,16 @@ static Font LoadBMFont(const char *fileName)
int imWidth = 0;
int imHeight = 0;
int pageCount = 1;
- char imFileName[MAX_FONT_IMAGE_PAGES][129] = { 0 };
+ char imFileName[MAX_FONT_IMAGE_PAGES][129] = {0};
- int base = 0; // Useless data
- int readBytes = 0; // Data bytes read
- int readVars = 0; // Variables filled by sscanf()
+ int base = 0; // Useless data
+ int readBytes = 0; // Data bytes read
+ int readVars = 0; // Variables filled by sscanf()
char *fileText = LoadFileText(fileName);
- if (fileText == NULL) return font;
+ if (fileText == NULL)
+ return font;
char *fileTextPtr = fileText;
@@ -2134,7 +2332,11 @@ static Font LoadBMFont(const char *fileName)
readVars = sscanf(searchPoint, "lineHeight=%i base=%i scaleW=%i scaleH=%i pages=%i", &fontSize, &base, &imWidth, &imHeight, &pageCount);
fileTextPtr += (readBytes + 1);
- if (readVars < 4) { UnloadFileText(fileText); return font; } // Some data not available, file malformed
+ if (readVars < 4)
+ {
+ UnloadFileText(fileText);
+ return font;
+ } // Some data not available, file malformed
if (pageCount > MAX_FONT_IMAGE_PAGES)
{
@@ -2149,7 +2351,11 @@ static Font LoadBMFont(const char *fileName)
readVars = sscanf(searchPoint, "file=\"%128[^\"]\"", imFileName[i]);
fileTextPtr += (readBytes + 1);
- if (readVars < 1) { UnloadFileText(fileText); return font; } // No fileName read
+ if (readVars < 1)
+ {
+ UnloadFileText(fileText);
+ return font;
+ } // No fileName read
}
readBytes = GetLine(fileTextPtr, buffer, MAX_BUFFER_SIZE);
@@ -2157,7 +2363,11 @@ static Font LoadBMFont(const char *fileName)
readVars = sscanf(searchPoint, "count=%i", &glyphCount);
fileTextPtr += (readBytes + 1);
- if (readVars < 1) { UnloadFileText(fileText); return font; } // No glyphCount read
+ if (readVars < 1)
+ {
+ UnloadFileText(fileText);
+ return font;
+ } // No glyphCount read
// Load all required images for further compose
Image *imFonts = (Image *)RL_CALLOC(pageCount, sizeof(Image)); // Font atlases, multiple images
@@ -2170,14 +2380,13 @@ static Font LoadBMFont(const char *fileName)
{
// Convert image to GRAYSCALE + ALPHA, using the mask as the alpha channel
Image imFontAlpha = {
- .data = RL_CALLOC(imFonts[i].width*imFonts[i].height, 2),
+ .data = RL_CALLOC(imFonts[i].width * imFonts[i].height, 2),
.width = imFonts[i].width,
.height = imFonts[i].height,
.mipmaps = 1,
- .format = PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA
- };
+ .format = PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA};
- for (int p = 0, pi = 0; p < (imFonts[i].width*imFonts[i].height*2); p += 2, pi++)
+ for (int p = 0, pi = 0; p < (imFonts[i].width * imFonts[i].height * 2); p += 2, pi++)
{
((unsigned char *)(imFontAlpha.data))[p] = 0xff;
((unsigned char *)(imFontAlpha.data))[p + 1] = ((unsigned char *)imFonts[i].data)[pi];
@@ -2189,19 +2398,20 @@ static Font LoadBMFont(const char *fileName)
}
Image fullFont = imFonts[0];
- for (int i = 1; i < pageCount; i++) UnloadImage(imFonts[i]);
+ for (int i = 1; i < pageCount; i++)
+ UnloadImage(imFonts[i]);
// If multiple atlas, then merge atlas
// NOTE: WARNING: This process could be really slow!
if (pageCount > 1)
{
// Resize font atlas to draw additional images
- ImageResizeCanvas(&fullFont, imWidth, imHeight*pageCount, 0, 0, BLACK);
+ ImageResizeCanvas(&fullFont, imWidth, imHeight * pageCount, 0, 0, BLACK);
for (int i = 1; i < pageCount; i++)
{
- Rectangle srcRec = { 0.0f, 0.0f, (float)imWidth, (float)imHeight };
- Rectangle destRec = { 0.0f, (float)imHeight*(float)i, (float)imWidth, (float)imHeight };
+ Rectangle srcRec = {0.0f, 0.0f, (float)imWidth, (float)imHeight};
+ Rectangle destRec = {0.0f, (float)imHeight * (float)i, (float)imWidth, (float)imHeight};
ImageDraw(&fullFont, imFonts[i], srcRec, destRec, WHITE);
}
}
@@ -2214,8 +2424,8 @@ static Font LoadBMFont(const char *fileName)
font.baseSize = fontSize;
font.glyphCount = glyphCount;
font.glyphPadding = 0;
- font.glyphs = (GlyphInfo *)RL_MALLOC(glyphCount*sizeof(GlyphInfo));
- font.recs = (Rectangle *)RL_MALLOC(glyphCount*sizeof(Rectangle));
+ font.glyphs = (GlyphInfo *)RL_MALLOC(glyphCount * sizeof(GlyphInfo));
+ font.recs = (Rectangle *)RL_MALLOC(glyphCount * sizeof(Rectangle));
int charId, charX, charY, charWidth, charHeight, charOffsetX, charOffsetY, charAdvanceX, pageID;
@@ -2223,13 +2433,13 @@ static Font LoadBMFont(const char *fileName)
{
readBytes = GetLine(fileTextPtr, buffer, MAX_BUFFER_SIZE);
readVars = sscanf(buffer, "char id=%i x=%i y=%i width=%i height=%i xoffset=%i yoffset=%i xadvance=%i page=%i",
- &charId, &charX, &charY, &charWidth, &charHeight, &charOffsetX, &charOffsetY, &charAdvanceX, &pageID);
+ &charId, &charX, &charY, &charWidth, &charHeight, &charOffsetX, &charOffsetY, &charAdvanceX, &pageID);
fileTextPtr += (readBytes + 1);
- if (readVars == 9) // Make sure all char data has been properly read
+ if (readVars == 9) // Make sure all char data has been properly read
{
// Get character rectangle in the font atlas texture
- font.recs[i] = (Rectangle){ (float)charX, (float)charY + (float)imHeight*pageID, (float)charWidth, (float)charHeight };
+ font.recs[i] = (Rectangle){(float)charX, (float)charY + (float)imHeight * pageID, (float)charWidth, (float)charHeight};
// Save data properly in sprite font
font.glyphs[i].value = charId;
@@ -2256,7 +2466,8 @@ static Font LoadBMFont(const char *fileName)
font = GetFontDefault();
TRACELOG(LOG_WARNING, "FONT: [%s] Failed to load texture, reverted to default font", fileName);
}
- else TRACELOG(LOG_INFO, "FONT: [%s] Font loaded successfully (%i glyphs)", fileName, font.glyphCount);
+ else
+ TRACELOG(LOG_INFO, "FONT: [%s] Font loaded successfully (%i glyphs)", fileName, font.glyphCount);
return font;
}
@@ -2268,61 +2479,67 @@ static Font LoadBMFont(const char *fileName)
// Convert hexadecimal to decimal (single digit)
static unsigned char HexToInt(char hex)
{
- if (hex >= '0' && hex <= '9') return hex - '0';
- else if (hex >= 'a' && hex <= 'f') return hex - 'a' + 10;
- else if (hex >= 'A' && hex <= 'F') return hex - 'A' + 10;
- else return 0;
+ if (hex >= '0' && hex <= '9')
+ return hex - '0';
+ else if (hex >= 'a' && hex <= 'f')
+ return hex - 'a' + 10;
+ else if (hex >= 'A' && hex <= 'F')
+ return hex - 'A' + 10;
+ else
+ return 0;
}
// Load font data for further use
// NOTE: Requires BDF font memory data
static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, int *codepoints, int codepointCount, int *outFontSize)
{
- #define MAX_BUFFER_SIZE 256
+#define MAX_BUFFER_SIZE 256
- char buffer[MAX_BUFFER_SIZE] = { 0 };
+ char buffer[MAX_BUFFER_SIZE] = {0};
GlyphInfo *glyphs = NULL;
bool genFontChars = false;
- int totalReadBytes = 0; // Data bytes read (total)
- int readBytes = 0; // Data bytes read (line)
- int readVars = 0; // Variables filled by sscanf()
+ int totalReadBytes = 0; // Data bytes read (total)
+ int readBytes = 0; // Data bytes read (line)
+ int readVars = 0; // Variables filled by sscanf()
- const char *fileText = (const char*)fileData;
+ const char *fileText = (const char *)fileData;
const char *fileTextPtr = fileText;
- bool fontMalformed = false; // Is the font malformed
- bool fontStarted = false; // Has font started (STARTFONT)
- int fontBBw = 0; // Font base character bounding box width
- int fontBBh = 0; // Font base character bounding box height
- int fontBBxoff0 = 0; // Font base character bounding box X0 offset
- int fontBByoff0 = 0; // Font base character bounding box Y0 offset
- int fontAscent = 0; // Font ascent
+ bool fontMalformed = false; // Is the font malformed
+ bool fontStarted = false; // Has font started (STARTFONT)
+ int fontBBw = 0; // Font base character bounding box width
+ int fontBBh = 0; // Font base character bounding box height
+ int fontBBxoff0 = 0; // Font base character bounding box X0 offset
+ int fontBByoff0 = 0; // Font base character bounding box Y0 offset
+ int fontAscent = 0; // Font ascent
- bool charStarted = false; // Has character started (STARTCHAR)
- bool charBitmapStarted = false; // Has bitmap data started (BITMAP)
- int charBitmapNextRow = 0; // Y position for the next row of bitmap data
- int charEncoding = -1; // The unicode value of the character (-1 if not set)
- int charBBw = 0; // Character bounding box width
- int charBBh = 0; // Character bounding box height
- int charBBxoff0 = 0; // Character bounding box X0 offset
- int charBByoff0 = 0; // Character bounding box Y0 offset
- int charDWidthX = 0; // Character advance X
- int charDWidthY = 0; // Character advance Y (unused)
+ bool charStarted = false; // Has character started (STARTCHAR)
+ bool charBitmapStarted = false; // Has bitmap data started (BITMAP)
+ int charBitmapNextRow = 0; // Y position for the next row of bitmap data
+ int charEncoding = -1; // The unicode value of the character (-1 if not set)
+ int charBBw = 0; // Character bounding box width
+ int charBBh = 0; // Character bounding box height
+ int charBBxoff0 = 0; // Character bounding box X0 offset
+ int charBByoff0 = 0; // Character bounding box Y0 offset
+ int charDWidthX = 0; // Character advance X
+ int charDWidthY = 0; // Character advance Y (unused)
GlyphInfo *charGlyphInfo = NULL; // Pointer to output glyph info (NULL if not set)
- if (fileData == NULL) return glyphs;
+ if (fileData == NULL)
+ return glyphs;
// In case no chars count provided, default to 95
- codepointCount = (codepointCount > 0)? codepointCount : 95;
+ codepointCount = (codepointCount > 0) ? codepointCount : 95;
// Fill fontChars in case not provided externally
// NOTE: By default we fill glyphCount consecutively, starting at 32 (Space)
if (codepoints == NULL)
{
- codepoints = (int *)RL_MALLOC(codepointCount*sizeof(int));
- for (int i = 0; i < codepointCount; i++) codepoints[i] = i + 32;
+ codepoints = (int *)RL_MALLOC(codepointCount * sizeof(int));
+ for (int i = 0; i < codepointCount; i++)
+ codepoints[i] = i + 32;
genFontChars = true;
}
@@ -2335,7 +2552,8 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i
fileTextPtr += (readBytes + 1);
// Line: COMMENT
- if (strstr(buffer, "COMMENT") != NULL) continue; // Ignore line
+ if (strstr(buffer, "COMMENT") != NULL)
+ continue; // Ignore line
if (charStarted)
{
@@ -2352,7 +2570,8 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i
{
int pixelY = charBitmapNextRow++;
- if (pixelY >= charGlyphInfo->image.height) break;
+ if (pixelY >= charGlyphInfo->image.height)
+ break;
for (int x = 0; x < readBytes; x++)
{
@@ -2360,11 +2579,13 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i
for (int bitX = 0; bitX < 4; bitX++)
{
- int pixelX = ((x*4) + bitX);
+ int pixelX = ((x * 4) + bitX);
- if (pixelX >= charGlyphInfo->image.width) break;
+ if (pixelX >= charGlyphInfo->image.width)
+ break;
- if ((byte & (8 >> bitX)) > 0) ((unsigned char *)charGlyphInfo->image.data)[(pixelY*charGlyphInfo->image.width) + pixelX] = 255;
+ if ((byte & (8 >> bitX)) > 0)
+ ((unsigned char *)charGlyphInfo->image.data)[(pixelY * charGlyphInfo->image.width) + pixelX] = 255;
}
}
}
@@ -2415,7 +2636,7 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i
charGlyphInfo->offsetY = fontBBh - (charBBh + charBByoff0 + fontBByoff0 + fontAscent);
charGlyphInfo->advanceX = charDWidthX;
- charGlyphInfo->image.data = RL_CALLOC(charBBw*charBBh, 1);
+ charGlyphInfo->image.data = RL_CALLOC(charBBw * charBBh, 1);
charGlyphInfo->image.width = charBBw;
charGlyphInfo->image.height = charBBh;
charGlyphInfo->image.mipmaps = 1;
@@ -2440,14 +2661,16 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i
// Line: SIZE
if (strstr(buffer, "SIZE") != NULL)
{
- if (outFontSize != NULL) readVars = sscanf(buffer, "SIZE %i", outFontSize);
+ if (outFontSize != NULL)
+ readVars = sscanf(buffer, "SIZE %i", outFontSize);
continue;
}
// PIXEL_SIZE
if (strstr(buffer, "PIXEL_SIZE") != NULL)
{
- if (outFontSize != NULL) readVars = sscanf(buffer, "PIXEL_SIZE %i", outFontSize);
+ if (outFontSize != NULL)
+ readVars = sscanf(buffer, "PIXEL_SIZE %i", outFontSize);
continue;
}
@@ -2502,7 +2725,8 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i
}
}
- if (genFontChars) RL_FREE(codepoints);
+ if (genFontChars)
+ RL_FREE(codepoints);
if (fontMalformed)
{
@@ -2512,6 +2736,6 @@ static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, i
return glyphs;
}
-#endif // SUPPORT_FILEFORMAT_BDF
+#endif // SUPPORT_FILEFORMAT_BDF
-#endif // SUPPORT_MODULE_RTEXT
+#endif // SUPPORT_MODULE_RTEXT