-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
raylib architecture
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 has seven main modules:
-
core
: Window / Graphic Context / Inputs management. -
rlgl
: Graphic API (OpenGL) wrapper and pseudo-OpenGL 1.1 translation layer. -
shapes
: Basic 2D shapes drawing functions. -
textures
: Textures / Image loading and management. -
text
: Font data loading and text drawing. -
models
: 3D models loading and drawing. -
raudio
: Audio device management and sounds / music loading and playing.
Those seven modules share a common header: 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.
Apart from those seven main modules, some other modules have been implemented with additional features:
-
raymath
: Vector2, Vector3, Matrix and Quaternion math related functions -
camera
: 3D Camera system (free, 1st person, 3rd person, custom) -
gestures
: Touch gestures detection and processing (Tap, Swipe, Drag, Pinch) -
raygui
: Simple IMGUI system with several controls for tools development -
easings
: Easing functions for animations (based on Robert Penner implementation) -
physac
: 2D physics library (collision detection, resolution, dinamics...)
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) and audio
(example).
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.
NOTE: raymath
, camera
and gestures
are compiled by default with raylib.
raylib also uses some external libraries—most of them included as single-file header-only libraries, like the well-known stb libraries and similar ones.
And that's currently the raylib internal structure.
www.raylib.com | itch.io | GitHub | Discord | YouTube
- Architecture
- Syntax analysis
- Data structures
- Enumerated types
- External dependencies
- GLFW dependency
- libc dependency
- Platforms and graphics
- Input system
- Default shader
- Custom shaders
- Coding conventions
- Integration with other libs
- Working on Windows
- Working on macOS
- Working on GNU Linux
- Working on Chrome OS
- Working on FreeBSD
- Working on Raspberry Pi
- Working for Android
- Working for Web (HTML5)
- Working on exaequOS Web Computer
- Creating Discord Activities
- Working anywhere with CMake
- CMake Build Options
- raylib templates: Get started easily
- How To: Quick C/C++ Setup in Visual Studio 2022, GCC or MinGW
- How To: C# Visual Studio Setup
- How To: VSCode
- How To: Eclipse
- How To: Sublime Text
- How To: Code::Blocks