summaryrefslogtreecommitdiffhomepage
path: root/cheatsheet
diff options
context:
space:
mode:
authorRay <[email protected]>2021-04-06 12:57:43 +0200
committerRay <[email protected]>2021-04-06 12:57:43 +0200
commit8940a2f553026e46fc97f49c449fe199df36745a (patch)
tree7ac79edc9205f1e1741fea38344c4a7a3c2068d8 /cheatsheet
parent0e9fa0a3f99813f5bacee372ada1f3e874981e9c (diff)
downloadraylib.com-8940a2f553026e46fc97f49c449fe199df36745a.tar.gz
raylib.com-8940a2f553026e46fc97f49c449fe199df36745a.zip
Update cheatsheet for raylib 3.7
Diffstat (limited to 'cheatsheet')
-rw-r--r--cheatsheet/cheatsheet.html18
-rw-r--r--cheatsheet/raylib_audio.c4
-rw-r--r--cheatsheet/raylib_core.c74
-rw-r--r--cheatsheet/raylib_models.c34
-rw-r--r--cheatsheet/raylib_shaders.c52
-rw-r--r--cheatsheet/raylib_shapes.c16
-rw-r--r--cheatsheet/raylib_structs.c1
-rw-r--r--cheatsheet/raylib_text.c76
-rw-r--r--cheatsheet/raylib_textures.c15
9 files changed, 144 insertions, 146 deletions
diff --git a/cheatsheet/cheatsheet.html b/cheatsheet/cheatsheet.html
index 846d2a2..df6be81 100644
--- a/cheatsheet/cheatsheet.html
+++ b/cheatsheet/cheatsheet.html
@@ -49,11 +49,11 @@
}
.exdownbtn:hover{background-color:#f0d6d6; color:#c55757; border:4px solid #e66666;}
#core pre code{border:10px solid; border-color:#888888; background-color:#dbdbe1; }
+ #shaders pre code{border:10px solid; border-color:#a864d2; background-color:#e0c6f1; }
#shapes pre code{border:10px solid; border-color:#e66666; background-color:#e9d0d6; }
#textures pre code{border:10px solid; border-color:#75a06d; background-color:#c3e4bf; }
#text pre code{border:10px solid; border-color:#52b296; background-color:#b9e9dd; }
#models pre code{border:10px solid; border-color:#5d9cbd; background-color:#b9d6e8; }
- #shaders pre code{border:10px solid; border-color:#a864d2; background-color:#e0c6f1; }
#audio pre code{border:10px solid; border-color:#d3b157; background-color:#e5d7ae; }
#structs pre code{border:10px solid; border-color:#d2c9c6; background-color:#f8f8ff;}
#colors pre code{border:10px solid; border-color:#c6d2c6; background-color:#e9f1f2;}
@@ -93,6 +93,10 @@
$('#core pre code').text(data);
$('#core pre code').each(function(i, e) {hljs.highlightBlock(e)});
}, 'text');
+ $.get('raylib_shaders.c', function(data) {
+ $('#shaders pre code').text(data);
+ $('#shaders pre code').each(function(i, e) {hljs.highlightBlock(e)});
+ }, 'text');
$.get('raylib_shapes.c', function(data) {
$('#shapes pre code').text(data);
$('#shapes pre code').each(function(i, e) {hljs.highlightBlock(e)});
@@ -109,10 +113,6 @@
$('#models pre code').text(data);
$('#models pre code').each(function(i, e) {hljs.highlightBlock(e)});
}, 'text');
- $.get('raylib_shaders.c', function(data) {
- $('#shaders pre code').text(data);
- $('#shaders pre code').each(function(i, e) {hljs.highlightBlock(e)});
- }, 'text');
$.get('raylib_audio.c', function(data) {
$('#audio pre code').text(data);
$('#audio pre code').each(function(i, e) {hljs.highlightBlock(e)});
@@ -135,12 +135,14 @@
<p id="title">A simple and easy-to-use library to enjoy videogames programming</p>
<p id="plinks">[<a href="https://discord.gg/raylib">raylib Discord server</a>][<a href="https://github.com/raysan5/raylib">github.com/raysan5/raylib</a>]</p>
<p></p>
- <p id="version">v3.5 quick reference card [<a id="downpdf" href="raylib_cheatsheet.pdf">download as PDF</a>]</p>
+ <p id="version">v3.7 quick reference card [<a id="downpdf" href="raylib_cheatsheet.pdf">download as PDF</a>]</p>
</div>
<br>
<div id="fulldata">
<p id="pcore">module: core</p>
<div id="core"><pre><code class="cpp"></code></pre></div>
+ <p id="pshaders">module: shaders (rlgl)</p>
+ <div id="shaders"><pre><code class="cpp"></code></pre></div>
<p id="pshapes">module: shapes</p>
<div id="shapes"><pre><code class="cpp"></code></pre></div>
<p id="ptextures">module: textures</p>
@@ -149,8 +151,6 @@
<div id="text"><pre><code class="cpp"></code></pre></div>
<p id="pmodels">module: models</p>
<div id="models"><pre><code class="cpp"></code></pre></div>
- <p id="pshaders">module: shaders (rlgl)</p>
- <div id="shaders"><pre><code class="cpp"></code></pre></div>
<p id="paudio">module: audio</p>
<div id="audio"><pre><code class="cpp"></code></pre></div>
@@ -165,7 +165,7 @@
</div>
</div>
<div id="copyright">
- <p>raylib quick reference card - Copyright (c) 2013-2020 Ramon Santamaria (<a href="https://www.twitter.com/raysan5">@raysan5</a>)</p>
+ <p>raylib quick reference card - Copyright (c) 2013-2021 Ramon Santamaria (<a href="https://www.twitter.com/raysan5">@raysan5</a>)</p>
</div>
</div>
diff --git a/cheatsheet/raylib_audio.c b/cheatsheet/raylib_audio.c
index 396dd61..4e39638 100644
--- a/cheatsheet/raylib_audio.c
+++ b/cheatsheet/raylib_audio.c
@@ -35,13 +35,14 @@
// Music management functions
Music LoadMusicStream(const char *fileName); // Load music stream from file
+ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char* data, int dataSize); // Load music stream from data
void UnloadMusicStream(Music music); // Unload music stream
void PlayMusicStream(Music music); // Start music playing
+ bool IsMusicPlaying(Music music); // Check if music is playing
void UpdateMusicStream(Music music); // Updates buffers for music streaming
void StopMusicStream(Music music); // Stop music playing
void PauseMusicStream(Music music); // Pause music playing
void ResumeMusicStream(Music music); // Resume playing paused music
- bool IsMusicPlaying(Music music); // Check if music is playing
void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
float GetMusicTimeLength(Music music); // Get music time length (in seconds)
@@ -60,3 +61,4 @@
void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
+
diff --git a/cheatsheet/raylib_core.c b/cheatsheet/raylib_core.c
index cd54384..d6d92d7 100644
--- a/cheatsheet/raylib_core.c
+++ b/cheatsheet/raylib_core.c
@@ -27,9 +27,10 @@
int GetScreenWidth(void); // Get current screen width
int GetScreenHeight(void); // Get current screen height
int GetMonitorCount(void); // Get number of connected monitors
+ int GetCurrentMonitor(void); // Get current connected monitor
Vector2 GetMonitorPosition(int monitor); // Get specified monitor position
- int GetMonitorWidth(int monitor); // Get specified monitor width
- int GetMonitorHeight(int monitor); // Get specified monitor height
+ int GetMonitorWidth(int monitor); // Get specified monitor width (max available by monitor)
+ int GetMonitorHeight(int monitor); // Get specified monitor height (max available by monitor)
int GetMonitorPhysicalWidth(int monitor); // Get specified monitor physical width in millimetres
int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres
int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
@@ -38,16 +39,16 @@
const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
void SetClipboardText(const char *text); // Set clipboard text content
const char *GetClipboardText(void); // Get clipboard text content
-
- // Cursor-related functions
+
+ // Cursor-related functions
void ShowCursor(void); // Shows cursor
void HideCursor(void); // Hides cursor
bool IsCursorHidden(void); // Check if cursor is not visible
void EnableCursor(void); // Enables cursor (unlock cursor)
void DisableCursor(void); // Disables cursor (lock cursor)
bool IsCursorOnScreen(void); // Check if cursor is on the current screen.
-
- // Drawing-related functions
+
+ // Drawing-related functions
void ClearBackground(Color color); // Set background color (framebuffer clear color)
void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing
void EndDrawing(void); // End canvas drawing and swap buffers (double buffering)
@@ -72,21 +73,27 @@
// Timing-related functions
void SetTargetFPS(int fps); // Set target FPS (maximum)
int GetFPS(void); // Returns current FPS
- float GetFrameTime(void); // Returns time in seconds for last frame drawn
+ float GetFrameTime(void); // Returns time in seconds for last frame drawn (delta time)
double GetTime(void); // Returns elapsed time in seconds since InitWindow()
// Misc. functions
+ int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
+ void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format)
void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS)
- void SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level
- void SetTraceLogExit(int logType); // Set the exit threshold (minimum) log level
- void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging
- void TraceLog(int logType, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
-
+ void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
+ void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level
void *MemAlloc(int size); // Internal memory allocator
+ void *MemRealloc(void *ptr, int size); // Internal memory reallocator
void MemFree(void *ptr); // Internal memory free
- void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (saved a .png)
- int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
+
+ // Set custom callbacks
+ // WARNING: Callbacks setup is intended for advance users
+ void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log
+ void SetLoadFileDataCallback(LoadFileDataCallback callback); // Set custom file binary data loader
+ void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver
+ void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader
+ void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver
// Files management functions
unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read)
@@ -98,7 +105,7 @@
bool FileExists(const char *fileName); // Check if file exists
bool DirectoryExists(const char *dirPath); // Check if a directory path exists
bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (including point: .png, .wav)
- const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (including point: ".png")
+ const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: ".png")
const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string)
const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string)
@@ -121,10 +128,6 @@
void OpenURL(const char *url); // Open URL with default system browser (if available)
- //------------------------------------------------------------------------------------
- // Input Handling Functions (Module: core)
- //------------------------------------------------------------------------------------
-
// Input-related functions: keyboard
bool IsKeyPressed(int key); // Detect if a key has been pressed once
bool IsKeyDown(int key); // Detect if a key is being pressed
@@ -132,9 +135,9 @@
bool IsKeyUp(int key); // Detect if a key is NOT being pressed
void SetExitKey(int key); // Set a custom key to exit program (default is ESC)
int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued
- int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued
-
- // Input-related functions: gamepads
+ int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued
+
+ // Input-related functions: gamepads
bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
bool IsGamepadName(int gamepad, const char *name); // Check gamepad name (if available)
const char *GetGamepadName(int gamepad); // Return gamepad internal name id
@@ -145,8 +148,9 @@
int GetGamepadButtonPressed(void); // Get the last gamepad button pressed
int GetGamepadAxisCount(int gamepad); // Return gamepad axis count for a gamepad
float GetGamepadAxisMovement(int gamepad, int axis); // Return axis movement value for a gamepad axis
-
- // Input-related functions: mouse
+ int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
+
+ // Input-related functions: mouse
bool IsMouseButtonPressed(int button); // Detect if a mouse button has been pressed once
bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
bool IsMouseButtonReleased(int button); // Detect if a mouse button has been released once
@@ -158,18 +162,15 @@
void SetMouseOffset(int offsetX, int offsetY); // Set mouse offset
void SetMouseScale(float scaleX, float scaleY); // Set mouse scaling
float GetMouseWheelMove(void); // Returns mouse wheel movement Y
- int GetMouseCursor(void); // Returns mouse cursor if (MouseCursor enum)
void SetMouseCursor(int cursor); // Set mouse cursor
-
- // Input-related functions: touch
+
+ // Input-related functions: touch
int GetTouchX(void); // Returns touch position X for touch point 0 (relative to screen size)
int GetTouchY(void); // Returns touch position Y for touch point 0 (relative to screen size)
Vector2 GetTouchPosition(int index); // Returns touch position XY for a touch point index (relative to screen size)
- //------------------------------------------------------------------------------------
// Gestures and Touch Handling Functions (Module: gestures)
- //------------------------------------------------------------------------------------
- void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags
+ void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
bool IsGestureDetected(int gesture); // Check if a gesture have been detected
int GetGestureDetected(void); // Get latest detected gesture
int GetTouchPointsCount(void); // Get touch points count
@@ -179,16 +180,23 @@
Vector2 GetGesturePinchVector(void); // Get gesture pinch delta
float GetGesturePinchAngle(void); // Get gesture pinch angle
- //------------------------------------------------------------------------------------
// Camera System Functions (Module: camera)
- //------------------------------------------------------------------------------------
void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available)
void UpdateCamera(Camera *camera); // Update camera position for selected mode
-
+
void SetCameraPanControl(int keyPan); // Set camera pan key to combine with mouse movement (free camera)
void SetCameraAltControl(int keyAlt); // Set camera alt key to combine with mouse movement (free camera)
void SetCameraSmoothZoomControl(int keySmoothZoom); // Set camera smooth zoom key to combine with mouse (free camera)
void SetCameraMoveControls(int frontKey, int backKey,
int rightKey, int leftKey,
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
+
+ // VR Simulator Functions (Module: core)
+ void InitVrSimulator(VrDeviceInfo device); // Init VR simulator for selected device parameters
+ void CloseVrSimulator(void); // Close VR simulator for current device
+ bool IsVrSimulatorReady(void); // Detect if VR simulator is ready
+ void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
+ void BeginVrDrawing(RenderTexture2D target); // Begin VR simulator stereo rendering (using provided fbo)
+ void EndVrDrawing(void); // End VR simulator stereo rendering
+ VrStereoConfig GetVrConfig(VrDeviceInfo device); // Get stereo rendering configuration parameters
diff --git a/cheatsheet/raylib_models.c b/cheatsheet/raylib_models.c
index 4ad632b..8ceca51 100644
--- a/cheatsheet/raylib_models.c
+++ b/cheatsheet/raylib_models.c
@@ -18,33 +18,36 @@
void DrawPlane(Vector3 centerPos, Vector2 size, Color color); // Draw a plane XZ
void DrawRay(Ray ray, Color color); // Draw a ray line
void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
- void DrawGizmo(Vector3 position); // Draw simple gizmo
// Model loading/unloading functions
Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
void UnloadModel(Model model); // Unload model (including meshes) from memory (RAM and/or VRAM)
void UnloadModelKeepMeshes(Model model); // Unload model (but not meshes) from memory (RAM and/or VRAM)
-
- // Mesh loading/unloading functions
- Mesh *LoadMeshes(const char *fileName, int *meshCount); // Load meshes from model file
- void UnloadMesh(Mesh mesh); // Unload mesh from memory (RAM and/or VRAM)
+
+ // Mesh loading/unloading functions
+ void UploadMesh(Mesh *mesh, bool dynamic); // Upload vertex data into GPU and provided VAO/VBO ids
+ void DrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
+ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int instances); // Draw multiple mesh instances with material and different transforms
+ void UnloadMesh(Mesh mesh); // Unload mesh data from CPU and GPU
bool ExportMesh(Mesh mesh, const char *fileName); // Export mesh data to file, returns true on success
-
- // Material loading/unloading functions
+
+ // Material loading/unloading functions
Material *LoadMaterials(const char *fileName, int *materialCount); // Load materials from model file
Material LoadMaterialDefault(void); // Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
void UnloadMaterial(Material material); // Unload material from GPU memory (VRAM)
- void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
+ void SetMaterialTexture(Material *material, int mapType, Texture2D texture); // Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
void SetModelMeshMaterial(Model *model, int meshId, int materialId); // Set material for a mesh
-
- // Model animations loading/unloading functions
+
+ // Model animations loading/unloading functions
ModelAnimation *LoadModelAnimations(const char *fileName, int *animsCount); // Load model animations from file
void UpdateModelAnimation(Model model, ModelAnimation anim, int frame); // Update model animation pose
void UnloadModelAnimation(ModelAnimation anim); // Unload animation data
+ void UnloadModelAnimations(ModelAnimation* animations, unsigned int count); // Unload animation array data
bool IsModelAnimationValid(Model model, ModelAnimation anim); // Check model animation skeleton match
-
- // Mesh generation functions
+
+ // Mesh generation functions
+ Mesh GenMeshDefault(int vertexCount); // Generate an empty mesh with vertex: position, texcoords, normals, colors
Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh
Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh
@@ -55,12 +58,11 @@
Mesh GenMeshKnot(float radius, float size, int radSeg, int sides); // Generate trefoil knot mesh
Mesh GenMeshHeightmap(Image heightmap, Vector3 size); // Generate heightmap mesh from image data
Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize); // Generate cubes-based map mesh from image data
-
- // Mesh manipulation functions
+
+ // Mesh manipulation functions
BoundingBox MeshBoundingBox(Mesh mesh); // Compute mesh bounding box limits
void MeshTangents(Mesh *mesh); // Compute mesh tangents
void MeshBinormals(Mesh *mesh); // Compute mesh binormals
- void MeshNormalsSmooth(Mesh *mesh); // Smooth (average) vertex normals
// Model drawing functions
void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
@@ -82,4 +84,4 @@
RayHitInfo GetCollisionRayModel(Ray ray, Model model); // Get collision info between ray and model
RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3); // Get collision info between ray and triangle
RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight); // Get collision info between ray and ground plane (Y-normal plane)
-
+
diff --git a/cheatsheet/raylib_shaders.c b/cheatsheet/raylib_shaders.c
index fa01809..d808d18 100644
--- a/cheatsheet/raylib_shaders.c
+++ b/cheatsheet/raylib_shaders.c
@@ -1,40 +1,18 @@
- // Shader loading/unloading functions
- Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
- Shader LoadShaderCode(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
- void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
-
- Shader GetShaderDefault(void); // Get default shader
- Texture2D GetTextureDefault(void); // Get default texture
- Texture2D GetShapesTexture(void); // Get texture to draw shapes
- Rectangle GetShapesTextureRec(void); // Get texture rectangle to draw shapes
- void SetShapesTexture(Texture2D texture, Rectangle source); // Define default texture used to draw shapes
+ // Shaders System Functions (Module: core)
+ void BeginShaderMode(Shader shader); // Begin custom shader drawing
+ void EndShaderMode(void); // End custom shader drawing (use default shader)
+ void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
+ void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
- // Shader configuration functions
- int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
- int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
- void SetShaderValue(Shader shader, int uniformLoc, const void *value, int uniformType); // Set shader uniform value
- void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int uniformType, int count); // Set shader uniform value vector
- void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
- void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D texture); // Set shader uniform value for texture
- void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
- void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
- Matrix GetMatrixModelview(void); // Get internal modelview matrix
- Matrix GetMatrixProjection(void); // Get internal projection matrix
-
- // Shading begin/end functions
- void BeginShaderMode(Shader shader); // Begin custom shader drawing
- void EndShaderMode(void); // End custom shader drawing (use default shader)
- void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
- void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
-
- // VR control functions
- void InitVrSimulator(void); // Init VR simulator for selected device parameters
- void CloseVrSimulator(void); // Close VR simulator for current device
- void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
- void SetVrConfiguration(VrDeviceInfo info, Shader distortion); // Set stereo rendering configuration parameters
- bool IsVrSimulatorReady(void); // Detect if VR simulator is ready
- void ToggleVrMode(void); // Enable/Disable VR experience
- void BeginVrDrawing(void); // Begin VR simulator stereo rendering
- void EndVrDrawing(void); // End VR simulator stereo rendering
+ // Shader management functions
+ Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations
+ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode); // Load shader from code strings and bind default locations
+ int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
+ int GetShaderLocationAttrib(Shader shader, const char *attribName); // Get shader attribute location
+ void SetShaderValue(Shader shader, int locIndex, const void *value, int uniformType); // Set shader uniform value
+ void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniformType, int count); // Set shader uniform value vector
+ void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4)
+ void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture (sampler2d)
+ void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM)
diff --git a/cheatsheet/raylib_shapes.c b/cheatsheet/raylib_shapes.c
index 73a9c3b..079a078 100644
--- a/cheatsheet/raylib_shapes.c
+++ b/cheatsheet/raylib_shapes.c
@@ -1,4 +1,9 @@
+ // 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
+ void SetShapesTexture(Texture2D texture, Rectangle source);
+
// Basic shapes drawing functions
void DrawPixel(int posX, int posY, Color color); // Draw a pixel
void DrawPixelV(Vector2 position, Color color); // Draw a pixel (Vector version)
@@ -6,17 +11,18 @@
void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version)
void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line defining thickness
void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line using cubic-bezier curves in-out
+ void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thick, Color color); //Draw line using quadratic bezier curves with a control point
void DrawLineStrip(Vector2 *points, int pointsCount, Color color); // Draw lines sequence
void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
- void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color); // Draw a piece of a circle
- void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color); // Draw circle sector outline
+ void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
+ void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse
void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color); // Draw ellipse outline
- void DrawRing(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color); // Draw ring
- void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, int startAngle, int endAngle, int segments, Color color); // Draw ring outline
+ void DrawRing(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring
+ void DrawRingLines(Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color); // Draw ring outline
void DrawRectangle(int posX, int posY, int width, int height, Color color); // Draw a color-filled rectangle
void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
@@ -42,6 +48,6 @@
bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
- bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines
+ 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
Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2); // Get collision rectangle for two rectangles collision
diff --git a/cheatsheet/raylib_structs.c b/cheatsheet/raylib_structs.c
index f22007e..7f7e7a2 100644
--- a/cheatsheet/raylib_structs.c
+++ b/cheatsheet/raylib_structs.c
@@ -36,4 +36,5 @@
struct AudioStream; // Raw audio stream type
struct VrDeviceInfo; // VR device parameters
+ struct VrStereoConfig; // VR Stereo rendering configuration for simulator
diff --git a/cheatsheet/raylib_text.c b/cheatsheet/raylib_text.c
index 9ee6f0b..172e9de 100644
--- a/cheatsheet/raylib_text.c
+++ b/cheatsheet/raylib_text.c
@@ -1,51 +1,51 @@
// Font loading/unloading functions
- Font GetFontDefault(void); // Get the default Font
- Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
- Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount); // Load font from file with extended parameters
- Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
+ Font GetFontDefault(void); // Get the default Font
+ Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
+ Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount); // Load font from file with extended parameters
+ Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int charsCount); // Load font from memory buffer
- CharInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int charsCount, int type); // Load font data for further use
- Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
- void UnloadFontData(CharInfo *chars, int charsCount); // Unload font chars info data (RAM)
- void UnloadFont(Font font); // Unload Font from GPU memory (VRAM)
+ CharInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int charsCount, int type); // Load font data for further use
+ Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
+ void UnloadFontData(CharInfo *chars, int charsCount); // Unload font chars info data (RAM)
+ void UnloadFont(Font font); // Unload Font from GPU memory (VRAM)
// Text drawing functions
- void DrawFPS(int posX, int posY); // Shows current FPS
- void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
+ void DrawFPS(int posX, int posY); // Draw current FPS
+ void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint,
- int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection
- void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint)
+ int selectStart, int selectLength, Color selectTint, Color selectBackTint); // Draw text using font inside rectangle limits with support for text selection
+ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint)
// Text misc. functions
- int MeasureText(const char *text, int fontSize); // Measure string width for default font
- Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
- int GetGlyphIndex(Font font, int codepoint); // Get index position for a unicode character on font
+ int MeasureText(const char *text, int fontSize); // Measure string width for default font
+ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
+ int GetGlyphIndex(Font font, int codepoint); // Get index position for a unicode character on font
+
+ // Text strings management functions (no utf8 strings, only byte chars)
+ // NOTE: Some strings allocate memory internally for returned strings, just be careful!
+ int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied
+ bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
+ unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
+ const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf style)
+ const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
+ char *TextReplace(char *text, const char *replace, const char *by); // Replace text string (memory must be freed!)
+ char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (memory must be freed!)
+ const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
+ const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
+ void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
+ int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
+ const char *TextToUpper(const char *text); // Get upper case version of provided string
+ const char *TextToLower(const char *text); // Get lower case version of provided string
+ const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
+ int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
+ char *TextToUtf8(int *codepoints, int length); // Encode text codepoint into utf8 text (memory must be freed!)
- // Text strings management functions (no utf8 strings, only byte chars)
- // NOTE: Some strings allocate memory internally for returned strings, just be careful!
- int TextCopy(char *dst, const char *src); // Copy one string to another, returns bytes copied
- bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
- unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
- const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf style)
- const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
- char *TextReplace(char *text, const char *replace, const char *by); // Replace text string (memory must be freed!)
- char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (memory must be freed!)
- const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
- const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
- void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
- int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
- const char *TextToUpper(const char *text); // Get upper case version of provided string
- const char *TextToLower(const char *text); // Get lower case version of provided string
- const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
- int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
- char *TextToUtf8(int *codepoints, int length); // Encode text codepoint into utf8 text (memory must be freed!)
-
// UTF8 text strings management functions
- int *GetCodepoints(const char *text, int *count); // Get all codepoints in a string, codepoints count returned by parameters
- int GetCodepointsCount(const char *text); // Get total number of characters (codepoints) in a UTF8 encoded string
- int GetNextCodepoint(const char *text, int *bytesProcessed); // Returns next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure
- const char *CodepointToUtf8(int codepoint, int *byteLength); // Encode codepoint into utf8 text (char array length returned as parameter)
+ int *GetCodepoints(const char *text, int *count); // Get all codepoints in a string, codepoints count returned by parameters
+ int GetCodepointsCount(const char *text); // Get total number of characters (codepoints) in a UTF8 encoded string
+ int GetNextCodepoint(const char *text, int *bytesProcessed); // Returns next codepoint in a UTF8 encoded string; 0x3f('?') is returned on failure
+ const char *CodepointToUtf8(int codepoint, int *byteLength); // Encode codepoint into utf8 text (char array length returned as parameter)
diff --git a/cheatsheet/raylib_textures.c b/cheatsheet/raylib_textures.c
index 75efc7a..edb1eb8 100644
--- a/cheatsheet/raylib_textures.c
+++ b/cheatsheet/raylib_textures.c
@@ -4,7 +4,7 @@
Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data)
- Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer, fileType refers to extension: i.e. "png"
+ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize); // Load image from memory buffer
void UnloadImage(Image image); // Unload image from CPU memory (RAM)
bool ExportImage(Image image, const char *fileName); // Export image data to file, returns true on success
bool ExportImageAsCode(Image image, const char *fileName); // Export image as code file defining an array of bytes, returns true on success
@@ -73,7 +73,7 @@
// NOTE: These functions require GPU access
Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
Texture2D LoadTextureFromImage(Image image); // Load texture from image data
- TextureCubemap LoadTextureCubemap(Image image, int layoutType); // Load cubemap from image, multiple image cubemap layouts supported
+ TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory (VRAM)
@@ -84,8 +84,8 @@
// Texture configuration functions
void GenTextureMipmaps(Texture2D *texture); // Generate GPU mipmaps for a texture
- void SetTextureFilter(Texture2D texture, int filterMode); // Set texture scaling filter mode
- void SetTextureWrap(Texture2D texture, int wrapMode); // Set texture wrapping mode
+ void SetTextureFilter(Texture2D texture, int filter); // Set texture scaling filter mode
+ void SetTextureWrap(Texture2D texture, int wrap); // Set texture wrapping mode
// Texture drawing functions
void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
@@ -93,9 +93,10 @@
void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint); // Draw texture quad with tiling and offset parameters
- void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint); // Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
- 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
- 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
+ void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint); // Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
+ 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
+ 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
+ void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointsCount, Color tint); // Draw a textured polygon
// Color/pixel related functions
Color Fade(Color color, float alpha); // Returns color with alpha applied, alpha goes from 0.0f to 1.0f