Updated raylib syntax analysis (markdown)

master
Ray 3 年之前
父節點
當前提交
aef1e424f2
共有 1 個檔案被更改,包括 40 行新增3 行删除
  1. +40
    -3
      raylib-syntax-analysis.md

+ 40
- 3
raylib-syntax-analysis.md

@ -125,44 +125,80 @@ PauseAudioStream();
ResumeAudioStream(); 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: 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 ```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 // Suffix: *Ex() -> Used for "Extended" versions of same name functions
//------------------------------------------------------------------------------------------------
// rcore.c
Vector2 GetWorldToScreenEx(); Vector2 GetWorldToScreenEx();
// rshapes.c
void DrawLineEx(); void DrawLineEx();
void DrawRectangleGradientEx(); void DrawRectangleGradientEx();
void DrawRectangleLinesEx(); void DrawRectangleLinesEx();
void DrawPolyLinesEx(); void DrawPolyLinesEx();
// rtextures.c
Image ImageTextEx(); Image ImageTextEx();
void ImageDrawTextEx(); void ImageDrawTextEx();
void DrawTextureEx(); void DrawTextureEx();
// rtext.c
Font LoadFontEx(); Font LoadFontEx();
void DrawTextEx(); void DrawTextEx();
Vector2 MeasureTextEx(); Vector2 MeasureTextEx();
// rmodels.c
void DrawSphereEx(); void DrawSphereEx();
void DrawModelEx(); void DrawModelEx();
void DrawModelWiresEx(); void DrawModelWiresEx();
// Suffix: *Pro() -> Used for "Professional" versions of same name functions, more advanced than "Ex" // Suffix: *Pro() -> Used for "Professional" versions of same name functions, more advanced than "Ex"
//------------------------------------------------------------------------------------------------
// rshapes.c
void DrawRectanglePro(); void DrawRectanglePro();
// rtextures.c
void DrawTexturePro(); void DrawTexturePro();
// rtext.c
void DrawTextPro(); void DrawTextPro();
// rmodels.c
void DrawBillboardPro(); void DrawBillboardPro();
// Suffix: *Rec() -> Used for functions requiring a "Rectangle" as one main input parameter // Suffix: *Rec() -> Used for functions requiring a "Rectangle" as one main input parameter
//------------------------------------------------------------------------------------------------
// rshapes.c
void DrawRectangleRec(); void DrawRectangleRec();
bool CheckCollisionCircleRec(); bool CheckCollisionCircleRec();
bool CheckCollisionPointRec(); bool CheckCollisionPointRec();
Rectangle GetCollisionRec(); Rectangle GetCollisionRec();
// rtextures.c
void ImageDrawRectangleRec(); void ImageDrawRectangleRec();
void UpdateTextureRec(); void UpdateTextureRec();
void DrawTextureRec(); void DrawTextureRec();
// rmodels.c
void DrawBillboardRec(); void DrawBillboardRec();
// Suffix: *FromMemory() -> Used for functions loading data "from memory" instead of from files // Suffix: *FromMemory() -> Used for functions loading data "from memory" instead of from files
//------------------------------------------------------------------------------------------------
Shader LoadShaderFromMemory(); Shader LoadShaderFromMemory();
Image LoadImageFromMemory(); Image LoadImageFromMemory();
Font LoadFontFromMemory(); Font LoadFontFromMemory();
@ -170,6 +206,7 @@ Wave LoadWaveFromMemory();
Music LoadMusicStreamFromMemory(); Music LoadMusicStreamFromMemory();
// Suffix: *Callback() -> Used for functions setting a callback function // Suffix: *Callback() -> Used for functions setting a callback function
//------------------------------------------------------------------------------------------------
void SetTraceLogCallback(); void SetTraceLogCallback();
void SetLoadFileDataCallback(); void SetLoadFileDataCallback();
void SetSaveFileDataCallback(); void SetSaveFileDataCallback();
@ -177,7 +214,7 @@ void SetLoadFileTextCallback();
void SetSaveFileTextCallback(); 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: 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_ 016 | `LoadMusicStreamFromMemory()` | 5 | _*FromMemory() set of functions_
017 | `SetAudioStreamBufferSizeDefault()` | **6** | **TODO: Review!!!** 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**: 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**:

Loading…
取消
儲存