raylib is a highly modular library. Everything is contained within a small number of well defined, specific and self-contained modules, each organized according to its primary functionality (nicely avoiding the huge tree of recursive dependencies, typical of other C libraries).
raylib is a highly modular library. Everything is contained within a small number of well defined, specific and self-contained modules, each organized according to its primary functionality (nicely avoiding the huge tree of recursive dependencies, typical of other C libraries).
@ -12,7 +11,7 @@ raylib is a highly modular library. Everything is contained within a small numbe
- [`models`](https://github.com/raysan5/raylib/blob/master/src/models.c): 3D models loading and drawing.
- [`models`](https://github.com/raysan5/raylib/blob/master/src/models.c): 3D models loading and drawing.
- [`raudio`](https://github.com/raysan5/raylib/blob/master/src/raudio.c): Audio device management and sounds / music loading and playing.
- [`raudio`](https://github.com/raysan5/raylib/blob/master/src/raudio.c): Audio device management and sounds / music loading and playing.
Those seven modules share a common header: [`raylib.h`](https://github.com/raysan5/raylib/blob/master/src/raylib.h), all user functions are defined in that header, despite the fact they are divided internally in seven modules. That way, the user just needs to include `raylib.h` to get all raylib functionality. Other libraries use one header for every module (that way the user can choose included modules) or also headers that refer to other headers. raylib uses a simpler approach that's easier for novice (and expert) users.
Those seven modules share a common header, named [`raylib.h`](https://github.com/raysan5/raylib/blob/master/src/raylib.h). All API functions are defined in that header, despite being internally divided into seven modules, so the user only needs to include `raylib.h` to access all of the raylib functionality. Other libraries often use a header for every module (so users can select the ones they need), but this complicates the dependencies. The simple approach that raylib adopts is just easier for novice (and expert) users.
Apart from those seven main modules, some other modules have been implemented with additional features:
Apart from those seven main modules, some other modules have been implemented with additional features:
- [`raymath`](https://github.com/raysan5/raylib/blob/master/src/raymath.h): Vector2, Vector3, Matrix and Quaternion math related functions
- [`raymath`](https://github.com/raysan5/raylib/blob/master/src/raymath.h): Vector2, Vector3, Matrix and Quaternion math related functions
@ -22,7 +21,7 @@ Apart from those seven main modules, some other modules have been implemented wi
- [`easings`](https://github.com/raysan5/raylib/blob/master/src/easings.h): Easing functions for animations (based on [Robert Penner](http://robertpenner.com/easing/) implementation)
- [`easings`](https://github.com/raysan5/raylib/blob/master/src/easings.h): Easing functions for animations (based on [Robert Penner](http://robertpenner.com/easing/) implementation)
Most of the modules have been designed to be as decoupled as possible from other modules, so, some modules can be used independently of raylib, as standalone libraries. For example, two such modules are `rlgl` ([example](https://github.com/raysan5/raylib/blob/master/examples/others/rlgl_standalone.c)) and `audio` ([example](https://github.com/raysan5/raylib/blob/master/examples/others/audio_standalone.c)).
Most of the modules were designed to allow them to be as decoupled as possible from the other modules. In fact, some modules can be used as standalone libraries, independently of raylib, including the `rlgl` ([example](https://github.com/raysan5/raylib/blob/master/examples/others/rlgl_standalone.c)) and `audio` ([example](https://github.com/raysan5/raylib/blob/master/examples/others/audio_standalone.c)) modules.
Most of the secondary modules can also be used as standalone libraries: `raymath`, `camera`, `gestures`, `raygui`, `easings`, `physac`. All those modules are distributed as configurable single-file header-only libraries to be independently added to any project. Being header-only means the header also contains function implementations; that's extremely useful if you have a library (a bunch of functions) that you only want to drop on your code-base to cover a very specific functionality. However, creating a header-only module is not trivial. That module has to minimize external dependencies and global variables and give a very specific functionality; let's say it has to be completely portable.
Most of the secondary modules can also be used as standalone libraries: `raymath`, `camera`, `gestures`, `raygui`, `easings`, `physac`. All those modules are distributed as configurable single-file header-only libraries to be independently added to any project. Being header-only means the header also contains function implementations; that's extremely useful if you have a library (a bunch of functions) that you only want to drop on your code-base to cover a very specific functionality. However, creating a header-only module is not trivial. That module has to minimize external dependencies and global variables and give a very specific functionality; let's say it has to be completely portable.