Skip to content

Files

Failed to load latest commit information.

Latest commit

 Cannot retrieve latest commit at this time.

History

History
 
 

examples

README.md

Building the Examples

The examples assume you have already built the raylib library in ../src.

With GNU make

  • make builds all examples
  • make [module] builds all examples for a particular module (e.g make 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 build to compile all examples
  • zig 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.

## example image difficulty
level
version
created
last version
updated
original
developer
01 core_basic_window core_basic_window ⭐️☆☆☆ 1.0 1.0 Ray
02 core_input_keys core_input_keys ⭐️☆☆☆ 1.0 1.0 Ray
03 core_input_mouse core_input_mouse ⭐️☆☆☆ 1.0 5.5 Ray
04 core_input_mouse_wheel core_input_mouse_wheel ⭐️☆☆☆ 1.1 1.3 Ray
05 core_input_gamepad core_input_gamepad ⭐️☆☆☆ 1.1 4.2 Ray
06 core_input_multitouch core_input_multitouch ⭐️☆☆☆ 2.1 2.5 Berni
07 core_input_gestures core_input_gestures ⭐️⭐️☆☆ 1.4 4.2 Ray
08 core_input_virtual_controls core_input_virtual_controls ⭐️⭐️☆☆ 5.0 5.0 oblerion
09 core_2d_camera core_2d_camera ⭐️⭐️☆☆ 1.5 3.0 Ray
10 core_2d_camera_mouse_zoom core_2d_camera_mouse_zoom ⭐️⭐️☆☆ 4.2 4.2 Jeffery Myers
11 core_2d_camera_platformer core_2d_camera_platformer ⭐️⭐️⭐️☆ 2.5 3.0 arvyy
12 core_2d_camera_split_screen core_2d_camera_split_screen ⭐️⭐️⭐️⭐️ 4.5 4.5 Gabriel dos Santos Sanches
13 core_3d_camera_mode core_3d_camera_mode ⭐️☆☆☆ 1.0 1.0 Ray
14 core_3d_camera_free core_3d_camera_free ⭐️☆☆☆ 1.3 1.3 Ray
15 core_3d_camera_first_person core_3d_camera_first_person ⭐️⭐️☆☆ 1.3 1.3 Ray
16 core_3d_camera_split_screen core_3d_camera_split_screen ⭐️⭐️⭐️☆ 3.7 4.0 Jeffery Myers
17 core_3d_picking core_3d_picking ⭐️⭐️☆☆ 1.3 4.0 Ray
18 core_world_screen core_world_screen ⭐️⭐️☆☆ 1.3 1.4 Ray
19 core_custom_logging core_custom_logging ⭐️⭐️⭐️☆ 2.5 2.5 Pablo Marcos Oltra
20 core_window_flags core_window_flags ⭐️⭐️⭐️☆ 3.5 3.5 Ray
21 core_window_letterbox core_window_letterbox ⭐️⭐️☆☆ 2.5 4.0 Anata
22 core_window_should_close core_window_should_close ⭐️☆☆☆ 4.2 4.2 Ray
23 core_drop_files core_drop_files ⭐️⭐️☆☆ 1.3 4.2 Ray
24 core_random_values core_random_values ⭐️☆☆☆ 1.1 1.1 Ray
25 core_storage_values core_storage_values ⭐️⭐️☆☆ 1.4 4.2 Ray
26 core_vr_simulator core_vr_simulator ⭐️⭐️⭐️☆ 2.5 4.0 Ray
27 core_loading_thread core_loading_thread ⭐️⭐️⭐️☆ 2.5 3.0 Ray
28 core_scissor_test core_scissor_test ⭐️☆☆☆ 2.5 3.0 Chris Dill
29 core_basic_screen_manager core_basic_screen_manager ⭐️☆☆☆ 4.0 4.0 Ray
30 core_custom_frame_control core_custom_frame_control ⭐️⭐️⭐️⭐️ 4.0 4.0 Ray
31 core_smooth_pixelperfect core_smooth_pixelperfect ⭐️⭐️⭐️☆ 3.7 4.0 Giancamillo Alessandroni
32 core_random_sequence core_random_sequence ⭐️☆☆☆ 5.0 5.0 Dalton Overmyer
33 core_basic_window_web core_basic_window_web ⭐️☆☆☆ 1.3 1.3 Ray
34 core_input_gestures_web core_input_gestures_web ⭐️⭐️☆☆ 4.6-dev 4.6-dev ubkp
35 core_automation_events core_automation_events ⭐️⭐️⭐️☆ 5.0 5.0 Ray
36 core_high_dpi core_high_dpi ⭐️☆☆☆ 5.0 5.0 Jonathan Marler

category: shapes

Examples using raylib shapes drawing functionality, provided by raylib shapes module.

## example image difficulty
level
version
created
last version
updated
original
developer
36 shapes_basic_shapes shapes_basic_shapes ⭐️☆☆☆ 1.0 4.2 Ray
37 shapes_bouncing_ball shapes_bouncing_ball ⭐️☆☆☆ 2.5 2.5 Ray
38 shapes_colors_palette shapes_colors_palette ⭐️⭐️☆☆ 1.0 2.5 Ray
39 shapes_logo_raylib shapes_logo_raylib ⭐️☆☆☆ 1.0 1.0 Ray
40 shapes_logo_raylib_anim shapes_logo_raylib_anim ⭐️⭐️☆☆ 2.5 4.0 Ray
41 shapes_rectangle_scaling shapes_rectangle_scaling ⭐️⭐️☆☆ 2.5 2.5 Vlad Adrian
42 shapes_lines_bezier shapes_lines_bezier ⭐️☆☆☆ 1.7 1.7 Ray
43 shapes_collision_area shapes_collision_area ⭐️⭐️☆☆ 2.5 2.5 Ray
44 shapes_following_eyes shapes_following_eyes ⭐️⭐️☆☆ 2.5 2.5 Ray
45 shapes_easings_ball_anim shapes_easings_ball_anim ⭐️⭐️☆☆ 2.5 2.5 Ray
46 shapes_easings_box_anim shapes_easings_box_anim ⭐️⭐️☆☆ 2.5 2.5 Ray
47 shapes_easings_rectangle_array shapes_easings_rectangle_array ⭐️⭐️⭐️☆ 2.0 2.5 Ray
48 shapes_draw_ring shapes_draw_ring ⭐️⭐️⭐️☆ 2.5 2.5 Vlad Adrian
49 shapes_draw_circle_sector shapes_draw_circle_sector ⭐️⭐️⭐️☆ 2.5 2.5 Vlad Adrian
50 shapes_draw_rectangle_rounded shapes_draw_rectangle_rounded ⭐️⭐️⭐️☆ 2.5 2.5 Vlad Adrian
51 shapes_top_down_lights shapes_top_down_lights ⭐️⭐️⭐️⭐️ 4.2 4.2 Jeffery Myers
52 shapes_rectangle_advanced shapes_rectangle_advanced ⭐️⭐️⭐️⭐️ 5.5 5.5 Everton Jr.
53 shapes_splines_drawing shapes_splines_drawing ⭐️⭐️⭐️☆ 5.0 5.0 Ray

category: textures

Examples using raylib textures functionality, including image/textures loading/generation and drawing, provided by raylib textures modul

## example image difficulty
level
version
created
last version
updated
original
developer
54 textures_logo_raylib textures_logo_raylib ⭐️☆☆☆ 1.0 1.0 Ray
55 textures_srcrec_dstrec textures_srcrec_dstrec ⭐️⭐️⭐️☆ 1.3 1.3 Ray
56 textures_image_drawing textures_image_drawing ⭐️⭐️☆☆ 1.4 1.4 Ray
57 textures_image_generation textures_image_generation ⭐️⭐️☆☆ 1.8 1.8 Wilhem Barbier
58 textures_image_loading textures_image_loading ⭐️☆☆☆ 1.3 1.3 Ray
59 textures_image_processing textures_image_processing ⭐️⭐️⭐️☆ 1.4 3.5 Ray
60 textures_image_text textures_image_text ⭐️⭐️☆☆ 1.8 4.0 Ray
61 textures_to_image textures_to_image ⭐️☆☆☆ 1.3 4.0 Ray
62 textures_raw_data textures_raw_data ⭐️⭐️⭐️☆ 1.3 3.5 Ray
63 textures_particles_blending textures_particles_blending ⭐️☆☆☆ 1.7 3.5 Ray
64 textures_npatch_drawing textures_npatch_drawing ⭐️⭐️⭐️☆ 2.0 2.5 Jorge A. Gomes
65 textures_background_scrolling textures_background_scrolling ⭐️☆☆☆ 2.0 2.5 Ray
66 textures_sprite_anim textures_sprite_anim ⭐️⭐️☆☆ 1.3 1.3 Ray
67 textures_sprite_button textures_sprite_button ⭐️⭐️☆☆ 2.5 2.5 Ray
68 textures_sprite_explosion textures_sprite_explosion ⭐️⭐️☆☆ 2.5 3.5 Ray
69 textures_bunnymark textures_bunnymark ⭐️⭐️⭐️☆ 1.6 2.5 Ray
70 textures_mouse_painting textures_mouse_painting ⭐️⭐️⭐️☆ 3.0 3.0 Chris Dill
71 textures_blend_modes textures_blend_modes ⭐️☆☆☆ 3.5 3.5 Karlo Licudine
72 textures_draw_tiled textures_draw_tiled ⭐️⭐️⭐️☆ 3.0 4.2 Vlad Adrian
73 textures_polygon textures_polygon ⭐️☆☆☆ 3.7 3.7 Chris Camacho
74 textures_fog_of_war textures_fog_of_war ⭐️⭐️⭐️☆ 4.2 4.2 Ray
75 textures_gif_player textures_gif_player ⭐️⭐️⭐️☆ 4.2 4.2 Ray
76 textures_image_kernel textures_image_kernel ⭐️⭐️⭐️⭐️ 1.3 1.3 Karim Salem
77 textures_image_channel textures_image_channel ⭐️⭐️☆☆ 5.1-dev 5.1-dev Bruno Cabral
78 textures_image_rotate textures_image_rotate ⭐️⭐️☆☆ 1.0 1.0 Ray
79 textures_textured_curve textures_textured_curve ⭐️⭐️⭐️☆ 4.5 4.5 Jeffery Myers

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
80 text_raylib_fonts text_raylib_fonts ⭐️☆☆☆ 1.7 3.7 Ray
81 text_font_spritefont text_font_spritefont ⭐️☆☆☆ 1.0 1.0 Ray
82 text_font_filters text_font_filters ⭐️⭐️☆☆ 1.3 4.2 Ray
83 text_font_loading text_font_loading ⭐️☆☆☆ 1.4 3.0 Ray
84 text_font_sdf text_font_sdf ⭐️⭐️⭐️☆ 1.3 4.0 Ray
85 text_format_text text_format_text ⭐️☆☆☆ 1.1 3.0 Ray
86 text_input_box text_input_box ⭐️⭐️☆☆ 1.7 3.5 Ray
87 text_writing_anim text_writing_anim ⭐️⭐️☆☆ 1.4 1.4 Ray
88 text_rectangle_bounds text_rectangle_bounds ⭐️⭐️⭐️⭐️ 2.5 4.0 Vlad Adrian
89 text_unicode text_unicode ⭐️⭐️⭐️⭐️ 2.5 4.0 Vlad Adrian
90 text_draw_3d text_draw_3d ⭐️⭐️⭐️⭐️ 3.5 4.0 Vlad Adrian
91 text_codepoints_loading 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
92 models_animation models_animation ⭐️⭐️☆☆ 2.5 3.5 Culacant
93 models_billboard models_billboard ⭐️⭐️⭐️☆ 1.3 3.5 Ray
94 models_box_collisions models_box_collisions ⭐️☆☆☆ 1.3 3.5 Ray
95 models_cubicmap models_cubicmap ⭐️⭐️☆☆ 1.8 3.5 Ray
96 models_first_person_maze models_first_person_maze ⭐️⭐️☆☆ 2.5 3.5 Ray
97 models_geometric_shapes models_geometric_shapes ⭐️☆☆☆ 1.0 3.5 Ray
98 models_mesh_generation models_mesh_generation ⭐️⭐️☆☆ 1.8 4.0 Ray
99 models_mesh_picking models_mesh_picking ⭐️⭐️⭐️☆ 1.7 4.0 Joel Davis
100 models_loading models_loading ⭐️☆☆☆ 2.0 4.2 Ray
101 models_loading_gltf models_loading_gltf ⭐️☆☆☆ 3.7 4.2 Ray
102 models_loading_vox models_loading_vox ⭐️☆☆☆ 4.0 4.0 Johann Nadalutti
103 models_loading_m3d models_loading_m3d ⭐️⭐️☆☆ 4.5 4.5 bzt
104 models_orthographic_projection models_orthographic_projection ⭐️☆☆☆ 2.0 3.7 Max Danielsson
105 models_point_rendering models_point_rendering ⭐️⭐️⭐️☆ 5.0 5.0 Reese Gallagher
106 models_rlgl_solar_system models_rlgl_solar_system ⭐️⭐️⭐️⭐️ 2.5 4.0 Ray
107 models_yaw_pitch_roll models_yaw_pitch_roll ⭐️⭐️☆☆ 1.8 4.0 Berni
108 models_waving_cubes models_waving_cubes ⭐️⭐️⭐️☆ 2.5 3.7 Codecat
109 models_heightmap models_heightmap ⭐️☆☆☆ 1.8 3.5 Ray
110 models_skybox models_skybox ⭐️⭐️☆☆ 1.8 4.0 Ray
111 models_draw_cube_texture models_draw_cube_texture ⭐️⭐️☆☆ 4.5 4.5 Ray
112 models_gpu_skinning models_gpu_skinning ⭐️⭐️⭐️☆ 4.5 4.5 Daniel Holden
113 models_bone_socket models_bone_socket ⭐️⭐️⭐️⭐️ 4.5 4.5 iP
114 models_tesseract_view models_tesseract_view ⭐️⭐️☆☆ 5.6-dev 5.6-dev Timothy van der Valk

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
115 shaders_basic_lighting shaders_basic_lighting ⭐️⭐️⭐️⭐️ 3.0 4.2 Chris Camacho
116 shaders_model_shader shaders_model_shader ⭐️⭐️☆☆ 1.3 3.7 Ray
117 shaders_shapes_textures shaders_shapes_textures ⭐️⭐️☆☆ 1.7 3.7 Ray
118 shaders_custom_uniform shaders_custom_uniform ⭐️⭐️☆☆ 1.3 4.0 Ray
119 shaders_postprocessing shaders_postprocessing ⭐️⭐️⭐️☆ 1.3 4.0 Ray
120 shaders_palette_switch shaders_palette_switch ⭐️⭐️⭐️☆ 2.5 3.7 Marco Lizza
121 shaders_raymarching shaders_raymarching ⭐️⭐️⭐️⭐️ 2.0 4.2 Ray
122 shaders_texture_drawing shaders_texture_drawing ⭐️⭐️☆☆ 2.0 3.7 Michał Ciesielski
123 shaders_texture_outline shaders_texture_outline ⭐️⭐️⭐️☆ 4.0 4.0 Samuel Skiff
124 shaders_texture_waves shaders_texture_waves ⭐️⭐️☆☆ 2.5 3.7 Anata
125 shaders_julia_set shaders_julia_set ⭐️⭐️⭐️☆ 2.5 4.0 Josh Colclough
126 shaders_eratosthenes shaders_eratosthenes ⭐️⭐️⭐️☆ 2.5 4.0 ProfJski
127 shaders_fog shaders_fog ⭐️⭐️⭐️☆ 2.5 3.7 Chris Camacho
128 shaders_simple_mask shaders_simple_mask ⭐️⭐️☆☆ 2.5 3.7 Chris Camacho
129 shaders_hot_reloading shaders_hot_reloading ⭐️⭐️⭐️☆ 3.0 3.5 Ray
130 shaders_mesh_instancing shaders_mesh_instancing ⭐️⭐️⭐️⭐️ 3.7 4.2 seanpringle
131 shaders_multi_sample2d shaders_multi_sample2d ⭐️⭐️☆☆ 3.5 3.5 Ray
132 shaders_spotlight shaders_spotlight ⭐️⭐️☆☆ 2.5 3.7 Chris Camacho
133 shaders_deferred_render shaders_deferred_render ⭐️⭐️⭐️⭐️ 4.5 4.5 Justin Andreas Lacoste
134 shaders_hybrid_render shaders_hybrid_render ⭐️⭐️⭐️⭐️ 4.2 4.2 Buğra Alptekin Sarı
135 shaders_texture_tiling shaders_texture_tiling ⭐️⭐️☆☆ 4.5 4.5 Luis Almeida
136 shaders_shadowmap shaders_shadowmap ⭐️⭐️⭐️⭐️ 5.0 5.0 TheManTheMythTheGameDev
137 shaders_vertex_displacement shaders_vertex_displacement ⭐️⭐️⭐️☆ 5.0 4.5 Alex ZH
138 shaders_write_depth shaders_write_depth ⭐️⭐️☆☆ 4.2 4.2 Buğra Alptekin Sarı
139 shaders_basic_pbr shaders_basic_pbr ⭐️⭐️⭐️⭐️ 5.0 5.1-dev Afan OLOVCIC
140 shaders_lightmap shaders_lightmap ⭐️⭐️⭐️☆ 4.5 4.5 Jussi Viitala
141 shaders_rounded_rectangle shaders_rounded_rectangle ⭐️⭐️⭐️☆ 5.5 5.5 Anstro Pleuton
142 shaders_view_depth shaders_view_depth ⭐️⭐️⭐️☆ 5.6-dev 5.6-dev Luís Almeida

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
142 audio_module_playing audio_module_playing ⭐️☆☆☆ 1.5 3.5 Ray
143 audio_music_stream audio_music_stream ⭐️☆☆☆ 1.3 4.2 Ray
144 audio_raw_stream audio_raw_stream ⭐️⭐️⭐️☆ 1.6 4.2 Ray
145 audio_sound_loading audio_sound_loading ⭐️☆☆☆ 1.1 3.5 Ray
146 audio_mixed_processor audio_mixed_processor ⭐️⭐️⭐️⭐️ 4.2 4.2 hkc
147 audio_stream_effects audio_stream_effects ⭐️⭐️⭐️⭐️ 4.2 5.0 Ray
148 audio_sound_multi audio_sound_multi ⭐️⭐️☆☆ 4.6 4.6 Jeffery Myers
149 audio_sound_positioning audio_sound_positioning ⭐️⭐️☆☆ 5.5 5.5 Le Juez Victor

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
150 rlgl_standalone rlgl_standalone ⭐️⭐️⭐️⭐️ 1.6 4.0 Ray
151 rlgl_compute_shader rlgl_compute_shader ⭐️⭐️⭐️⭐️ 4.0 4.0 Teddy Astie
152 easings_testbed easings_testbed ⭐️⭐️⭐️☆ 2.5 3.0 Juan Miguel López
153 raylib_opengl_interop raylib_opengl_interop ⭐️⭐️⭐️⭐️ 3.8 4.0 Stephan Soller
154 embedded_files_loading embedded_files_loading ⭐️⭐️☆☆ 3.0 3.5 Kristian Holmgren
155 raymath_vector_angle raymath_vector_angle ⭐️⭐️☆☆ 1.0 4.6 Ray

As always contributions are welcome, feel free to send new examples! Here is an examples template to start with!