diff --git a/raylib-syntax-analysis.md b/raylib-syntax-analysis.md index 1f636e3..d33a54a 100644 --- a/raylib-syntax-analysis.md +++ b/raylib-syntax-analysis.md @@ -125,44 +125,80 @@ PauseAudioStream(); ResumeAudioStream(); ``` -### Functions suffixes +### 4. Functions suffixes A part from the function prefixes that we can find in many functions names (1. common patterns), we can also find some common suffixes used by several functions: ```c +// Suffix: *V() -> Used for "Vector" versions of same name functions +//------------------------------------------------------------------------------------------------ +// rcore.c +void SetShaderValueV(); +// rshapes.c +void DrawPixelV(); +void DrawLineV(); +void DrawCircleV(); +void DrawRectangleV(); +void DrawRectangleGradientV(); +// rtextures.c +void ImageDrawPixelV(); +void ImageDrawLineV(); +void ImageDrawCircleV(); +void ImageDrawRectangleV(); +void DrawTextureV(); +// rmodels.c +void DrawCubeV(); +void DrawCubeWiresV(); + // Suffix: *Ex() -> Used for "Extended" versions of same name functions +//------------------------------------------------------------------------------------------------ +// rcore.c Vector2 GetWorldToScreenEx(); +// rshapes.c void DrawLineEx(); void DrawRectangleGradientEx(); void DrawRectangleLinesEx(); void DrawPolyLinesEx(); +// rtextures.c Image ImageTextEx(); void ImageDrawTextEx(); void DrawTextureEx(); +// rtext.c Font LoadFontEx(); void DrawTextEx(); Vector2 MeasureTextEx(); +// rmodels.c void DrawSphereEx(); void DrawModelEx(); void DrawModelWiresEx(); // Suffix: *Pro() -> Used for "Professional" versions of same name functions, more advanced than "Ex" +//------------------------------------------------------------------------------------------------ +// rshapes.c void DrawRectanglePro(); +// rtextures.c void DrawTexturePro(); +// rtext.c void DrawTextPro(); +// rmodels.c void DrawBillboardPro(); // Suffix: *Rec() -> Used for functions requiring a "Rectangle" as one main input parameter +//------------------------------------------------------------------------------------------------ +// rshapes.c void DrawRectangleRec(); bool CheckCollisionCircleRec(); bool CheckCollisionPointRec(); Rectangle GetCollisionRec(); +// rtextures.c void ImageDrawRectangleRec(); void UpdateTextureRec(); void DrawTextureRec(); +// rmodels.c void DrawBillboardRec(); // Suffix: *FromMemory() -> Used for functions loading data "from memory" instead of from files +//------------------------------------------------------------------------------------------------ Shader LoadShaderFromMemory(); Image LoadImageFromMemory(); Font LoadFontFromMemory(); @@ -170,6 +206,7 @@ Wave LoadWaveFromMemory(); Music LoadMusicStreamFromMemory(); // Suffix: *Callback() -> Used for functions setting a callback function +//------------------------------------------------------------------------------------------------ void SetTraceLogCallback(); void SetLoadFileDataCallback(); void SetSaveFileDataCallback(); @@ -177,7 +214,7 @@ void SetLoadFileTextCallback(); void SetSaveFileTextCallback(); ``` -### Functions naming +### 5. Functions naming Most functions in raylib use a **maximum of 4 words** on its name. I think that's a good trade-off to remember the name of the function. Still, there is a small set of functions that go beyond that limit: @@ -201,7 +238,7 @@ count| function | words | comments 016 | `LoadMusicStreamFromMemory()` | 5 | _*FromMemory() set of functions_ 017 | `SetAudioStreamBufferSizeDefault()` | **6** | **TODO: Review!!!** -### Functions parameters +### 6. Functions parameters Most functions are limited to **5 or less input parameters**. I think 5 or less parameters is a good number to keep the function simple and rememberable, more than 5 usually requires the user to use some kind of intellisense system. **The number of parameters is a key point for raylib simplicity**, still, there are some functions requiring **6 or more parameters**: