@ -6,11 +6,11 @@ To do this analysis a [`raylib.h` parser](https://github.com/raysan5/raylib/tree
The analysis is organized in 3 parts, one for each API element analyzed:
- **Functions**: Instructions called by the users to make things happen
- **Structures (`struct`)**: Data types to organize information packages
- **Enumerators (`enum`)**: Sequence of named values used for convenience
- **1. Functions**: Instructions called by the users to make things happen
- **2. Structures (`struct`)**: Data types to organize information packages
- **3. Enumerators (`enum`)**: Sequence of named values used for convenience
## Functions
## 1. Functions
Latest raylib version (3.8-dev) exposes a total of **470 functions**, a relatively small API for a gamedev library.
@ -27,11 +27,14 @@ More specifically, every syntactic element implies:
Checking the available **functions** with more detail, they can be divided into **3 groups**:
1. Functions following a common pattern
2. Functions operating over specific type of data
3. Functions with unique pattern
- 1.1. Functions following a common pattern
- 1.2. Functions operating over specific type of data
- 1.3. Functions with unique pattern
- 1.4. Functions suffixes
- 1.5. Functions naming
- 1.6. Functions parameters
### 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:
@ -53,7 +56,7 @@ pattern | function format | API count | examples
### 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:
@ -66,7 +69,7 @@ pattern | function format | API count | examples
_NOTE: Maybe some of them are renamed in the future for consistency._
### 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>`.
@ -125,7 +128,7 @@ PauseAudioStream();
ResumeAudioStream();
```
### 4. Functions suffixes
### 1.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:
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:
@ -238,7 +241,7 @@ count| function | words | comments
016 | `LoadMusicStreamFromMemory()` | 5 | _*FromMemory() set of functions_
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**:
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).