* Submodules (#3311) * Check in current state * Add submodules to Makefile and clean up some imports * Start moving InitGraphicsDeivce * Move android_main and CloseWindow() out of rcore * Move WindowShouldClose out of rcore * Move IsWindowHidden out of rcore * Move IsWindowMinimized out of rcore * Move IsWindowMaximized, IsWindowFocused and IsWindowResized out of rcore * Move ToggleFullscreen out of rcore * Move MaximizeWindow, MinimizeWindow and RestoreWindow out of rcore * Move 13 functions out of rcore: ToggleBorderlessWindowed SetWindowState ClearWindowState SetWindowIcon SetWindowIcons SetWindowTitle SetWindowPosition SetWindowMonitor SetWindowMinSize SetWindowMaxSize SetWindowSize SetWindowOpacity SetWindowFocused * Minor clean up, revert makefile change, include submodules directly in rcore * Fix makefile comment * Remove rcore.h from Makefile * Remove debug include * Move 18 functions from rcore to submodules GetWindowHandle GetMonitorCount GetCurrentMonitor GetMonitorPosition GetMonitorWidth GetMonitorHeight GetMonitorPhysicalHeight GetMonitorRefreshRate GetWindowPosition GetWindowScaleDPI GetMonitorName SetClipboardText GetClipboardText ShowCursor HideCursor EnableCursor DisableCursor GetTime * Move TakeScreenshot, OpenURL, GetGamepadName out of rcore into submodules * remove debugging #defines * Move GetMonitorPhysicalWidth from rcore to submodule * Move GetGamepadAxisCount from rcore * Move SetGamepadMappings out of rcore * Move GetMouseX, GetMouseY, GetMousePosition out of rcore * Move SetMousePosition out of rcore * Move GetMouseWheelMove out of rcore * Move the last functions out of rcore * Move shared function defs and some global var to rcore.h * Clean up rcore.c and rcore.h a little more * Remove unnecessary #define --------- Co-authored-by: MichaelFiber <michael@cubeofb.org> * REVIEWED: `PLATFORM_DESKTOP` Windows building * Revert "REVIEWED: `PLATFORM_DESKTOP` Windows building" This reverts commit71a12171f7. * Reviewed Windows building * [split] Fix compilation for web (and desktop) (#3329) * Fix compilation for web * Remove EM_ASM_INT from core_input_gestures_web example * Fix raymath undefined symbols for desktop and web * Remove raylib_opengl_interop from examples Makefile * Revert previous commit (8651c78) * Fix TraceLog for web and desktop * [split] `rcore`, `rcore_web` and `rcore_desktop` changes (batch 2) (#3334) * Fix formatting * Reapply commit9d230d7(#3305) that was missing * Reapplies commits719365f(#3309) and8a1779b(#3312) that were missing * Reapply commit5c9cc3f(#3323) that was missing * Reapply commita2b3b1ethat was missing * Revert commitcef25c6to fix macro redefined warning * Move rcore.h #include to after config.h to fix macro redefinitions warnings * [split] `rcore`, `web`, `desktop`, `android` changes (batch 3) (#3338) * First pass to remove unneeded platform macros for web * Second pass to remove unneeded platform macros for web * Move GetTouchX, GetTouchY, GetTouchPosition from rcore to web, desktop, android * Move SetMouseCursor from rcore to android, desktop, web * [split] `rcore`, `web`, `desktop`, `android` changes (batch 4) (#3343) * Fix ToggleBorderlessWindowed duplicated glfwSetWindowSize calls * First pass to remove unneeded platform macros for android * Second pass to remove unneeded platform macros for android * Remove unneeded platform macros for desktop * Relocate GetGamepadName and update SetGamepadMappings on android, desktop, web * Add missing comment to web * [split] `rcore`, `web`, `desktop`, `android` changes (batch 5) (#3345) * Move SetExitKey from core to android, desktop, web * Move some callbacks from core to desktop and web * Relocate emscripten callbacks on web * Relocate android callbacks on android * Revert "Relocate android callbacks on android" This reverts commitbbdbecc01e. * Updates UnloadVrStereoConfig on rcore * Update SetClipboardText on android * Fix screenMin/Max default values for android * [split] `rcore`, `drm` changes (#3347) * Tweak makefiles for PLATFORM_DRM and move rcore_drm's dependencies to rcore.h * Move drm functions to rcore_drm.c * Fix a typo in rcore.c * Add SetExitKey to rcore_drm.c --------- Co-authored-by: MichaelFiber <michael@cubeofb.org> * Fix compilation for android (#3360) * Fix android include (#3364) * Reviewed platform split #3313 - Added file headers info - Added TRACELOG message for unimplemented functions - Reviewed code formatting and organization - Several code tweaks * REVIEWED: `GetDirectoryPath()` --------- Co-authored-by: MichaelFiber <42419558+michaelfiber@users.noreply.github.com> Co-authored-by: MichaelFiber <michael@cubeofb.org> Co-authored-by: ubkp <118854183+ubkp@users.noreply.github.com>
Building the Examples
The examples assume you have already built the raylib library in ../src.
With GNU make
makebuilds all examplesmake [module]builds all examples for a particular module (e.gmake core)
With Zig
The Zig toolchain can compile C and C++ in addition to Zig.
You may find it easier to use than other toolchains, especially when it comes to cross-compiling.
zig buildto compile all exampleszig build [module]to compile all examples for a module (e.g.zig build core)zig build [example]to compile and run a particular example (e.g.zig build core_basic_window)
EXAMPLES LIST
category: core
Examples using raylib core platform functionality like window creation, inputs, drawing modes and system functionality.
category: shapes
Examples using raylib shapes drawing functionality, provided by raylib shapes module.
| ## | example | image | difficulty level |
version created |
last version updated |
original developer |
|---|---|---|---|---|---|---|
| 31 | shapes_basic_shapes | ![]() |
⭐️☆☆☆ | 1.0 | 4.0 | Ray |
| 32 | shapes_bouncing_ball | ![]() |
⭐️☆☆☆ | 2.5 | 2.5 | Ray |
| 33 | shapes_colors_palette | ![]() |
⭐️⭐️☆☆ | 1.0 | 2.5 | Ray |
| 34 | shapes_logo_raylib | ![]() |
⭐️☆☆☆ | 1.0 | 1.0 | Ray |
| 35 | shapes_logo_raylib_anim | ![]() |
⭐️⭐️☆☆ | 2.5 | 4.0 | Ray |
| 36 | shapes_rectangle_scaling | ![]() |
⭐️⭐️☆☆ | 2.5 | 2.5 | Vlad Adrian |
| 37 | shapes_lines_bezier | ![]() |
⭐️☆☆☆ | 1.7 | 1.7 | Ray |
| 38 | shapes_collision_area | ![]() |
⭐️⭐️☆☆ | 2.5 | 2.5 | Ray |
| 39 | shapes_following_eyes | ![]() |
⭐️⭐️☆☆ | 2.5 | 2.5 | Ray |
| 40 | shapes_easings_ball_anim | ![]() |
⭐️⭐️☆☆ | 2.5 | 2.5 | Ray |
| 41 | shapes_easings_box_anim | ![]() |
⭐️⭐️☆☆ | 2.5 | 2.5 | Ray |
| 42 | shapes_easings_rectangle_array | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 2.5 | Ray |
| 43 | shapes_draw_ring | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 2.5 | Vlad Adrian |
| 44 | shapes_draw_circle_sector | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 2.5 | Vlad Adrian |
| 45 | shapes_draw_rectangle_rounded | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 2.5 | Vlad Adrian |
| 46 | shapes_top_down_lights | ![]() |
⭐️⭐️⭐️⭐️ | 4.2 | 4.2 | Jeffery Myers |
category: textures
Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib textures module.
category: text
Examples using raylib text functionality, including sprite fonts loading/generation and text drawing, provided by raylib text module.
| ## | example | image | difficulty level |
version created |
last version updated |
original developer |
|---|---|---|---|---|---|---|
| 69 | text_raylib_fonts | ![]() |
⭐️☆☆☆ | 1.7 | 3.7 | Ray |
| 70 | text_font_spritefont | ⭐️☆☆☆ | 1.0 | 1.0 | Ray | |
| 71 | text_font_filters | ![]() |
⭐️⭐️☆☆ | 1.3 | 4.2 | Ray |
| 72 | text_font_loading | ![]() |
⭐️☆☆☆ | 1.4 | 3.0 | Ray |
| 73 | text_font_sdf | ![]() |
⭐️⭐️⭐️☆ | 1.3 | 4.0 | Ray |
| 74 | text_format_text | ![]() |
⭐️☆☆☆ | 1.1 | 3.0 | Ray |
| 75 | text_input_box | ![]() |
⭐️⭐️☆☆ | 1.7 | 3.5 | Ray |
| 76 | text_writing_anim | ![]() |
⭐️⭐️☆☆ | 1.4 | 1.4 | Ray |
| 77 | text_rectangle_bounds | ![]() |
⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | Vlad Adrian |
| 78 | text_unicode | ![]() |
⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | Vlad Adrian |
| 79 | text_draw_3d | ![]() |
⭐️⭐️⭐️⭐️ | 3.5 | 4.0 | Vlad Adrian |
| 80 | text_codepoints_loading | ![]() |
⭐️⭐️⭐️☆ | 4.2 | 4.2 | Ray |
category: models
Examples using raylib models functionality, including models loading/generation and drawing, provided by raylib models module.
| ## | example | image | difficulty level |
version created |
last version updated |
original developer |
|---|---|---|---|---|---|---|
| 81 | models_animation | ![]() |
⭐️⭐️☆☆ | 2.5 | 3.5 | culacant |
| 82 | models_billboard | ![]() |
⭐️⭐️⭐️☆ | 1.3 | 3.5 | Ray |
| 83 | models_box_collisions | ![]() |
⭐️☆☆☆ | 1.3 | 3.5 | Ray |
| 84 | models_cubicmap | ![]() |
⭐️⭐️☆☆ | 1.8 | 3.5 | Ray |
| 85 | models_first_person_maze | ![]() |
⭐️⭐️☆☆ | 2.5 | 3.5 | Ray |
| 86 | models_geometric_shapes | ![]() |
⭐️☆☆☆ | 1.0 | 3.5 | Ray |
| 87 | models_mesh_generation | ![]() |
⭐️⭐️☆☆ | 1.8 | 4.0 | Ray |
| 88 | models_mesh_picking | ![]() |
⭐️⭐️⭐️☆ | 1.7 | 4.0 | Joel Davis |
| 89 | models_loading | ![]() |
⭐️☆☆☆ | 2.5 | 4.0 | Ray |
| 90 | models_loading_gltf | ![]() |
⭐️☆☆☆ | 3.7 | 4.2 | Ray |
| 91 | models_loading_vox | ![]() |
⭐️☆☆☆ | 4.0 | 4.0 | Johann Nadalutti |
| 92 | models_loading_m3d | ![]() |
⭐️☆☆☆ | 4.2 | 4.2 | bzt |
| 93 | models_orthographic_projection | ![]() |
⭐️☆☆☆ | 2.0 | 3.7 | Max Danielsson |
| 94 | models_rlgl_solar_system | ![]() |
⭐️⭐️⭐️⭐️ | 2.5 | 4.0 | Ray |
| 95 | models_yaw_pitch_roll | ![]() |
⭐️⭐️☆☆ | 1.8 | 4.0 | Berni |
| 96 | models_waving_cubes | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 3.7 | codecat |
| 97 | models_heightmap | ![]() |
⭐️☆☆☆ | 1.8 | 3.5 | Ray |
| 98 | models_skybox | ![]() |
⭐️⭐️☆☆ | 1.8 | 4.0 | Ray |
category: shaders
Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib rlgl module.
| ## | example | image | difficulty level |
version created |
last version updated |
original developer |
|---|---|---|---|---|---|---|
| 99 | shaders_basic_lighting | ![]() |
⭐️⭐️⭐️⭐️ | 3.0 | 4.2 | Chris Camacho |
| 100 | shaders_model_shader | ![]() |
⭐️⭐️☆☆ | 1.3 | 3.7 | Ray |
| 101 | shaders_shapes_textures | ![]() |
⭐️⭐️☆☆ | 1.7 | 3.7 | Ray |
| 102 | shaders_custom_uniform | ![]() |
⭐️⭐️☆☆ | 1.3 | 4.0 | Ray |
| 103 | shaders_postprocessing | ![]() |
⭐️⭐️⭐️☆ | 1.3 | 4.0 | Ray |
| 104 | shaders_palette_switch | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 3.7 | Marco Lizza |
| 105 | shaders_raymarching | ![]() |
⭐️⭐️⭐️⭐️ | 2.0 | 4.2 | Ray |
| 106 | shaders_texture_drawing | ![]() |
⭐️⭐️☆☆ | 2.0 | 3.7 | Michał Ciesielski |
| 107 | shaders_texture_outline | ![]() |
⭐️⭐️⭐️☆ | 4.0 | 4.0 | Samuel Skiff |
| 108 | shaders_texture_waves | ![]() |
⭐️⭐️☆☆ | 2.5 | 3.7 | Anata |
| 109 | shaders_julia_set | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 4.0 | eggmund |
| 110 | shaders_eratosthenes | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 4.0 | ProfJski |
| 111 | shaders_fog | ![]() |
⭐️⭐️⭐️☆ | 2.5 | 3.7 | Chris Camacho |
| 112 | shaders_simple_mask | ![]() |
⭐️⭐️☆☆ | 2.5 | 3.7 | Chris Camacho |
| 113 | shaders_hot_reloading | ![]() |
⭐️⭐️⭐️☆ | 3.0 | 3.5 | Ray |
| 114 | shaders_mesh_instancing | ![]() |
⭐️⭐️⭐️⭐️ | 3.7 | 4.2 | seanpringle |
| 115 | shaders_multi_sample2d | ![]() |
⭐️⭐️☆☆ | 3.5 | 3.5 | Ray |
| 116 | shaders_spotlight | ![]() |
⭐️⭐️☆☆ | 2.5 | 3.7 | Chris Camacho |
category: audio
Examples using raylib audio functionality, including sound/music loading and playing. This functionality is provided by raylib raudio module. Note this module can be used standalone independently of raylib, check raudio_standalone example.
| ## | example | image | difficulty level |
version created |
last version updated |
original developer |
|---|---|---|---|---|---|---|
| 117 | audio_module_playing | ![]() |
⭐️☆☆☆ | 1.5 | 3.5 | Ray |
| 118 | audio_music_stream | ![]() |
⭐️☆☆☆ | 1.3 | 4.2 | Ray |
| 119 | audio_raw_stream | ![]() |
⭐️⭐️⭐️☆ | 1.6 | 4.2 | Ray |
| 120 | audio_sound_loading | ![]() |
⭐️☆☆☆ | 1.1 | 3.5 | Ray |
category: others
Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.
| ## | example | image | difficulty level |
version created |
last version updated |
original developer |
|---|---|---|---|---|---|---|
| 122 | rlgl_standalone | ![]() |
⭐️⭐️⭐️⭐️ | 1.6 | 4.0 | Ray |
| 123 | rlgl_compute_shader | ![]() |
⭐️⭐️⭐️⭐️ | 4.0 | 4.0 | Teddy Astie |
| 124 | easings_testbed | ![]() |
⭐️⭐️⭐️☆ | 3.0 | 3.0 | Juan Miguel López |
| 125 | raylib_opengl_interop | ![]() |
⭐️⭐️⭐️⭐️ | 4.0 | 4.0 | Stephan Soller |
| 126 | embedded_files_loading | ![]() |
⭐️⭐️☆☆ | 3.5 | 3.5 | Kristian Holmgren |
As always contributions are welcome, feel free to send new examples! Here it is an examples template to start with!























































































































