**WARNING: This analysis has been made on `raylib 3.8-dev` that exposes a total of `470 functions`. Latest version of the library, `raylib 4.1-dev` exposes `+500 functions`. This information could be not updated.**
This analysis has been made on `raylib 5.1-dev` that exposes a total of `558 functions`.
raylib is a simple and easy-to-use library to enjoy videogames programing... but, **what makes the library simple and easy-to-use?** For many users the first approach to the library is through its API, so, here it is a small analysis of the API from a **syntactic point of view**.
raylib is a simple and easy-to-use library to enjoy videogames programing... but, **what makes the library simple and easy-to-use?** For many users the first approach to the library is through its API, so, here it is a small analysis of the API from a **syntactic point of view**.
@ -36,7 +36,7 @@ Checking the available **functions** with more detail, they can be divided into
### 1.1. Functions following a common pattern
### 1.1. Functions following a common pattern
Most of the functions of the library go into this first group **(359 functions)**, there is some common `<Action>` that prepends the name of most of the functions:
Most of the functions of the library go into this first group **(416 functions)**, there is some common `<Action>` that prepends the name of most of the functions:
pattern | function format | API count | examples
pattern | function format | API count | examples
:--: | :----- | :---: | :----------
:--: | :----- | :---: | :----------
@ -44,26 +44,26 @@ pattern | function format | API count | examples
### 1.2. Functions operating over specific type of data
### 1.2. Functions operating over specific type of data
Those functions **(68 in total)** operate over a specific data type, so, it was decided to prepend the `DataType` to the function name, they are an exception over the main syntax rule followed by the API:
Those functions **(74 in total)** operate over a specific data type, so, it was decided to prepend the `DataType` to the function name, they are an exception over the main syntax rule followed by the API:
@ -71,23 +71,30 @@ _NOTE: Maybe some of them are renamed in the future for consistency._
### 1.3. Functions with unique pattern
### 1.3. Functions with unique pattern
Remaining functions **(43 in total)** follow a unique pattern, still, **most of them** follow the standard syntax pattern of `<Verb><Subject><Complement>`.
Remaining functions **(57 in total)** follow a unique pattern, still, **most of them** follow the standard syntax pattern of `<Verb><Subject><Complement>`.
```c
```c
// core.c
// core.c
WindowShouldClose(); // Not following pattern
WindowShouldClose(); // Not following pattern
ClearWindowState();
ClearWindowState();
ToggleFullscreen();
ToggleFullscreen();
ToggleBorderlessWindowed();
MaximizeWindow();
MaximizeWindow();
MinimizeWindow();
MinimizeWindow();
RestoreWindow();
RestoreWindow();
EnableEventWaiting();
DisableEventWaiting();
ShowCursor();
ShowCursor();
HideCursor();
HideCursor();
EnableCursor();
EnableCursor();
DisableCursor();
DisableCursor();
ClearBackground();
ClearBackground();
SwapScreenBuffer();
PollInputEvents();
WaitTime();
TakeScreenshot();
TakeScreenshot();
TraceLog(); // Not following pattern
TraceLog(); // Not following pattern
OpenURL();
MemAlloc(); // Data-type pattern?
MemAlloc(); // Data-type pattern?
MemRealloc(); // Data-type pattern?
MemRealloc(); // Data-type pattern?
MemFree(); // Data-type pattern?
MemFree(); // Data-type pattern?
@ -95,10 +102,13 @@ FileExists(); // Not following pattern -> IsFileAvailable()?
DirectoryExists(); // Not following pattern -> IsDirectoryAvailable()?
DirectoryExists(); // Not following pattern -> IsDirectoryAvailable()?
ClearDirectoryFiles();
ClearDirectoryFiles();
ChangeDirectory();
ChangeDirectory();
ClearDroppedFiles();
CompressData();
CompressData();
DecompressData();
DecompressData();
OpenURL();
EncodeDataBase64();
DecodeDataBase64();
StartAutomationEventRecording();
StopAutomationEventRecording();
PlayAutomationEvent();
// textures.c
// textures.c
Fade(); // Superseded by ColorAlpha()
Fade(); // Superseded by ColorAlpha()
@ -116,16 +126,20 @@ PlaySound();
StopSound();
StopSound();
PauseSound();
PauseSound();
ResumeSound();
ResumeSound();
PlaySoundMulti();
StopSoundMulti();
PlayMusicStream();
PlayMusicStream();
StopMusicStream();
StopMusicStream();
PauseMusicStream();
PauseMusicStream();
ResumeMusicStream();
ResumeMusicStream();
SeekMusicStream();
PlayAudioStream();
PlayAudioStream();
StopAudioStream();
StopAudioStream();
PauseAudioStream();
PauseAudioStream();
ResumeAudioStream();
ResumeAudioStream();
SeekAudioStream();
AttachAudioStreamProcessor();
DetachAudioStreamProcessor();
AttachAudioMixedProcessor();
DetachAudioMixedProcessor();
```
```
### 1.4. Functions suffixes
### 1.4. Functions suffixes
@ -137,10 +151,12 @@ A part from the function prefixes that we can find in many functions names (1. c
Note that **only 6 function out of 470** require more than 6 parameters. This is what makes raylib so special.
Note that **only 6 function out of 470** require more than 6 parameters. This is what makes raylib so special.
## 2. Structures
## 2. Structures
raylib defines a total of **31 struct data types**, most of those structs use a single word to define the type and some of them use two words.
raylib defines a total of **34 struct data types**, most of those structs use a single word to define the type and some of them use two words.
raylib tries to provide generic data types for most common use scenarios, only some of those structs are required for specific examples: `NPatchInfo`, `VrDeviceInfo`, `VrStereoConfig`.
raylib tries to provide generic data types for most common use scenarios, only some of those structs are required for specific examples: `NPatchInfo`, `VrDeviceInfo`, `VrStereoConfig`.
raylib defines **20 enumerations** for convenience. Enum names and contained value names are kept simple and clear. Most of those values are only required to be used by some very specific functions, for a detailed list check Wiki entry: [raylib enumerated types](https://github.com/raysan5/raylib/wiki/raylib-enumerated-types).
raylib defines **21 enumerations** for convenience. Enum names and contained value names are kept simple and clear. Most of those values are only required to be used by some very specific functions, for a detailed list check Wiki entry: [raylib enumerated types](https://github.com/raysan5/raylib/wiki/raylib-enumerated-types).
Personally, I tried to avoid enum values requirement as much as possible within the library, actually, **only 35 function in raylib could require using some enum value on some of its input parameters**.
Personally, I tried to avoid enum values requirement as much as possible within the library, actually, **only 35 function in raylib could require using some enum value on some of its input parameters**.
count | enum name | values count | comments
count | enum name | values count | comments
:--:| :---------: | :-------: | :--------
:--:| :---------: | :-------: | :--------
01 | `ConfigFlags` | 14 |
01 | `ConfigFlags` | 16 |
02 | `TraceLogLevel` | 8 | _3 words name_
02 | `TraceLogLevel` | 8 | _3 words name_
03 | `KeyboardKey` | **110** |
04 | `MouseButton` | 8 |
03 | `KeyboardKey` | **114** |
04 | `MouseButton` | 7 |
05 | `MouseCursor` | 11 |
05 | `MouseCursor` | 11 |
06 | `GamepadButton` | **18** |
06 | `GamepadButton` | **18** |
07 | `GamepadAxis` | 6 |
07 | `GamepadAxis` | 6 |
08 | `MaterialMapIndex` | 11 | _3 words name_
08 | `MaterialMapIndex` | 11 | _3 words name_
09 | `ShaderLocationIndex` | **26** | _3 words name_
09 | `ShaderLocationIndex` | **26** | _3 words name_
10 | `ShaderUniformDataType` | 9 | **_4 words name_**
10 | `ShaderUniformDataType` | 9 | **_4 words name_**
11 | `PixelFormat` | **21** |
12 | `TextureFilter` | 6 |
13 | `TextureWrap` | 4 |
14 | `CubemapLayout` | 6 |
15 | `FontType` | 3 |
16 | `BlendMode` | 6 |
17 | `Gesture` | 11 |
18 | `CameraMode` | 5 |
19 | `CameraProjection` | 2 |
20 | `NPatchLayout` | 3 | _3 words name_
11 | `ShaderAttributeDataType` | 4 | **_4 words name_**