diff --git a/examples/README.md b/examples/README.md index 1857e5cf8..f1d011ccf 100644 --- a/examples/README.md +++ b/examples/README.md @@ -58,7 +58,7 @@ Examples using raylib[core](../src/rcore.c) platform functionality like window c | [core_smooth_pixelperfect](core/core_smooth_pixelperfect.c) | core_smooth_pixelperfect | ⭐⭐⭐☆ | 3.7 | 4.0 | [Giancamillo Alessandroni](https://github.com/NotManyIdeasDev) | | [core_random_sequence](core/core_random_sequence.c) | core_random_sequence | ⭐☆☆☆ | 5.0 | 5.0 | [Dalton Overmyer](https://github.com/REDl3east) | | [core_automation_events](core/core_automation_events.c) | core_automation_events | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) | -| [core_high_dpi](core/core_high_dpi.c) | core_high_dpi | ⭐☆☆☆ | 5.0 | 5.0 | [Jonathan Marler](https://github.com/marler8997) | +| [core_high_dpi](core/core_high_dpi.c) | core_high_dpi | ⭐⭐☆☆ | 5.0 | 5.0 | [Jonathan Marler](https://github.com/marler8997) | ### category: shapes [20] @@ -84,7 +84,7 @@ Examples using raylib shapes drawing functionality, provided by raylib [shapes]( | [shapes_top_down_lights](shapes/shapes_top_down_lights.c) | shapes_top_down_lights | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [Jeffery Myers](https://github.com/JeffM2501) | | [shapes_rectangle_advanced](shapes/shapes_rectangle_advanced.c) | shapes_rectangle_advanced | ⭐⭐⭐⭐️ | 5.5 | 5.5 | [Everton Jr.](https://github.com/evertonse) | | [shapes_splines_drawing](shapes/shapes_splines_drawing.c) | shapes_splines_drawing | ⭐⭐⭐☆ | 5.0 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) | -| [shapes_digital_clock](shapes/shapes_digital_clock.c) | shapes_digital_clock | ⭐⭐☆☆ | 5.5 | 5.5 | [Hamza RAHAL](https://github.com/rhmz-rhl) | +| [shapes_digital_clock](shapes/shapes_digital_clock.c) | shapes_digital_clock | ⭐⭐☆☆ | 5.5 | 5.6 | [Hamza RAHAL](https://github.com/rhmz-rhl) | | [shapes_double_pendulum](shapes/shapes_double_pendulum.c) | shapes_double_pendulum | ⭐⭐☆☆ | 5.5 | 5.5 | [JoeCheong](https://github.com/Joecheong2006) | ### category: textures [26] diff --git a/examples/audio/audio_music_stream.c b/examples/audio/audio_music_stream.c index c0028a033..fe4590463 100644 --- a/examples/audio/audio_music_stream.c +++ b/examples/audio/audio_music_stream.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [audio] example - music playing (streaming) +* raylib [audio] example - music streaming * * Example complexity rating: [★☆☆☆] 1/4 * @@ -25,7 +25,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)"); + InitWindow(screenWidth, screenHeight, "raylib [audio] example - music streaming"); InitAudioDevice(); // Initialize audio device diff --git a/examples/core/core_high_dpi.c b/examples/core/core_high_dpi.c index 636442401..346e41993 100644 --- a/examples/core/core_high_dpi.c +++ b/examples/core/core_high_dpi.c @@ -2,12 +2,16 @@ * * raylib [core] example - high dpi * -* Example complexity rating: [★☆☆☆] e/4 +* Example complexity rating: [★★☆☆] 2/4 +* +* Example originally created with raylib 5.5-dev, last time updated with raylib 5.6-dev +* +* Example contributed by Jonathan Marler (@marler8997) and reviewed by Ramon Santamaria (@raysan5) * * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * BSD-like license that allows static linking with closed source software * -* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5) +* Copyright (c) 2025 Jonathan Marler (@marler8997) * ********************************************************************************************/ diff --git a/examples/core/core_input_virtual_controls.c b/examples/core/core_input_virtual_controls.c index 6a4946655..0f4553eac 100644 --- a/examples/core/core_input_virtual_controls.c +++ b/examples/core/core_input_virtual_controls.c @@ -6,10 +6,8 @@ * * Example originally created with raylib 5.0, last time updated with raylib 5.0 * -* Example create by GreenSnakeLinux (@GreenSnakeLinux), -* lighter by oblerion (@oblerion) and -* reviewed by Ramon Santamaria (@raysan5) and -* improved by danilwhale (@danilwhale) +* Example contributed by GreenSnakeLinux (@GreenSnakeLinux), +* reviewed by Ramon Santamaria (@raysan5), oblerion (@oblerion) and danilwhale (@danilwhale) * * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * BSD-like license that allows static linking with closed source software @@ -19,6 +17,7 @@ ********************************************************************************************/ #include "raylib.h" + #include typedef enum { @@ -45,24 +44,21 @@ int main(void) Vector2 padPosition = { 100, 350 }; float buttonRadius = 30; - Vector2 buttonPositions[BUTTON_MAX] = - { + Vector2 buttonPositions[BUTTON_MAX] = { { padPosition.x,padPosition.y - buttonRadius*1.5f }, // Up { padPosition.x - buttonRadius*1.5f, padPosition.y }, // Left { padPosition.x + buttonRadius*1.5f, padPosition.y }, // Right { padPosition.x, padPosition.y + buttonRadius*1.5f } // Down }; - const char *buttonLabels[BUTTON_MAX] = - { + const char *buttonLabels[BUTTON_MAX] = { "Y", // Up "X", // Left "B", // Right "A" // Down }; - Color buttonLabelColors[BUTTON_MAX] = - { + Color buttonLabelColors[BUTTON_MAX] = { YELLOW, // Up BLUE, // Left RED, // Right @@ -83,22 +79,15 @@ int main(void) { // Update //-------------------------------------------------------------------------- - if ((GetTouchPointCount() > 0)) - { - // Use touch position - inputPosition = GetTouchPosition(0); - } - else - { - // Use mouse position - inputPosition = GetMousePosition(); - } + if ((GetTouchPointCount() > 0)) inputPosition = GetTouchPosition(0); // Use touch position + else inputPosition = GetMousePosition(); // Use mouse position // Reset pressed button to none pressedButton = BUTTON_NONE; // Make sure user is pressing left mouse button if they're from desktop - if ((GetTouchPointCount() > 0) || ((GetTouchPointCount() == 0) && IsMouseButtonDown(MOUSE_BUTTON_LEFT))) + if ((GetTouchPointCount() > 0) || + ((GetTouchPointCount() == 0) && IsMouseButtonDown(MOUSE_BUTTON_LEFT))) { // Find nearest D-Pad button to the input position for (int i = 0; i < BUTTON_MAX; i++) @@ -123,8 +112,8 @@ int main(void) case BUTTON_DOWN: playerPosition.y += playerSpeed*GetFrameTime(); break; default: break; }; - //-------------------------------------------------------------------------- + // Draw //-------------------------------------------------------------------------- BeginDrawing(); @@ -157,4 +146,3 @@ int main(void) return 0; } - diff --git a/examples/examples_list.txt b/examples/examples_list.txt index bd4073038..2450f46ac 100644 --- a/examples/examples_list.txt +++ b/examples/examples_list.txt @@ -41,7 +41,7 @@ core;core_custom_frame_control;⭐️⭐️⭐️⭐️;4.0;4.0;"Ramon Santamari core;core_smooth_pixelperfect;⭐️⭐️⭐️☆;3.7;4.0;"Giancamillo Alessandroni";@NotManyIdeasDev core;core_random_sequence;⭐️☆☆☆;5.0;5.0;"Dalton Overmyer";@REDl3east core;core_automation_events;⭐️⭐️⭐️☆;5.0;5.0;"Ramon Santamaria";@raysan5 -core;core_high_dpi;⭐️☆☆☆;5.0;5.0;"Jonathan Marler";@marler8997 +core;core_high_dpi;⭐️⭐️☆☆;5.0;5.0;"Jonathan Marler";@marler8997 shapes;shapes_basic_shapes;⭐️☆☆☆;1.0;4.2;"Ramon Santamaria";@raysan5 shapes;shapes_bouncing_ball;⭐️☆☆☆;2.5;2.5;"Ramon Santamaria";@raysan5 shapes;shapes_colors_palette;⭐️⭐️☆☆;1.0;2.5;"Ramon Santamaria";@raysan5 @@ -60,7 +60,7 @@ shapes;shapes_draw_rectangle_rounded;⭐️⭐️⭐️☆;2.5;2.5;"Vlad Adrian" shapes;shapes_top_down_lights;⭐️⭐️⭐️⭐️;4.2;4.2;"Jeffery Myers";@JeffM2501 shapes;shapes_rectangle_advanced;⭐️⭐️⭐️⭐️;5.5;5.5;"Everton Jr.";@evertonse shapes;shapes_splines_drawing;⭐️⭐️⭐️☆;5.0;5.0;"Ramon Santamaria";@raysan5 -shapes;shapes_digital_clock;⭐️⭐️☆☆;5.5;5.5;"Hamza RAHAL";@rhmz-rhl +shapes;shapes_digital_clock;⭐️⭐️☆☆;5.5;5.6;"Hamza RAHAL";@rhmz-rhl shapes;shapes_double_pendulum;⭐️⭐️☆☆;5.5;5.5;"JoeCheong";@Joecheong2006 textures;textures_logo_raylib;⭐️☆☆☆;1.0;1.0;"Ramon Santamaria";@raysan5 textures;textures_srcrec_dstrec;⭐️⭐️⭐️☆;1.3;1.3;"Ramon Santamaria";@raysan5 diff --git a/examples/models/models_loading_m3d.c b/examples/models/models_loading_m3d.c index 9851e3cbf..e8c779de8 100644 --- a/examples/models/models_loading_m3d.c +++ b/examples/models/models_loading_m3d.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [models] example - model loading m3d +* raylib [models] example - models loading m3d * * Example complexity rating: [★★☆☆] 2/4 * @@ -31,7 +31,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [models] example - model loading m3d"); + InitWindow(screenWidth, screenHeight, "raylib [models] example - models loading m3d"); // Define the camera to look into our 3d world Camera camera = { 0 }; diff --git a/examples/shapes/shapes_digital_clock.c b/examples/shapes/shapes_digital_clock.c index 20c43ed7b..82b8ee6bd 100644 --- a/examples/shapes/shapes_digital_clock.c +++ b/examples/shapes/shapes_digital_clock.c @@ -4,7 +4,7 @@ * * Example complexity rating: [★★☆☆] 2/4 * -* Example originally created with raylib 5.5, last time updated with raylib 5.5 +* Example originally created with raylib 5.5, last time updated with raylib 5.6-dev * * Example contributed by Hamza RAHAL (@hmz-rhl) and reviewed by Ramon Santamaria (@raysan5) * diff --git a/examples/text/resources/shaders/glsl120/alpha_discard.fs b/examples/text/resources/shaders/glsl120/alpha_discard.fs new file mode 100644 index 000000000..345d99181 --- /dev/null +++ b/examples/text/resources/shaders/glsl120/alpha_discard.fs @@ -0,0 +1,18 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +void main() +{ + vec4 texelColor = texture2D(texture0, fragTexCoord); + + if (texelColor.a == 0.0) discard; + + gl_FragColor = texelColor*fragColor*colDiffuse; +} diff --git a/examples/text/resources/shaders/glsl120/sdf.fs b/examples/text/resources/shaders/glsl120/sdf.fs new file mode 100644 index 000000000..2d99f20ed --- /dev/null +++ b/examples/text/resources/shaders/glsl120/sdf.fs @@ -0,0 +1,23 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add your custom variables here +const float smoothing = 1.0/16.0; + +void main() +{ + // Texel color fetching from texture sampler + // NOTE: Calculate alpha using signed distance field (SDF) + float distance = texture2D(texture0, fragTexCoord).a; + float alpha = smoothstep(0.5 - smoothing, 0.5 + smoothing, distance); + + // Calculate final fragment color + gl_FragColor = vec4(fragColor.rgb, fragColor.a*alpha); +} diff --git a/examples/text/text_unicode_ranges.c b/examples/text/text_unicode_ranges.c index 4c887f3f8..bf6f21c0a 100644 --- a/examples/text/text_unicode_ranges.c +++ b/examples/text/text_unicode_ranges.c @@ -17,7 +17,7 @@ #include "raylib.h" -#include +#include // Required for: calloc(), free() //-------------------------------------------------------------------------------------- // Module Functions Declaration @@ -199,5 +199,6 @@ static void AddCodepointRange(Font *font, const char *fontPath, int start, int s UnloadFont(*font); *font = LoadFontEx(fontPath, 32, updatedCodepoints, updatedCodepointCount); + RL_FREE(updatedCodepoints); } diff --git a/tools/rexm/examples_report.md b/tools/rexm/examples_report.md index ef7c6f9c2..958eff304 100644 --- a/tools/rexm/examples_report.md +++ b/tools/rexm/examples_report.md @@ -105,14 +105,14 @@ Example elements validated: | text_font_spritefont | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_font_filters | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_font_loading | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| text_font_sdf | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| text_font_sdf | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_format_text | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_input_box | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_writing_anim | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_rectangle_bounds | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_unicode_emojis | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_unicode_ranges | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| text_3d_drawing | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| text_3d_drawing | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_codepoints_loading | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_animation | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_billboard_rendering | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | diff --git a/tools/rexm/examples_report_issues.md b/tools/rexm/examples_report_issues.md index 599bd74f2..a41286953 100644 --- a/tools/rexm/examples_report_issues.md +++ b/tools/rexm/examples_report_issues.md @@ -23,9 +23,7 @@ Example elements validated: | core_input_virtual_controls | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | core_high_dpi | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shapes_digital_clock | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| text_font_sdf | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_unicode_ranges | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| text_3d_drawing | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_codepoints_loading | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_loading_m3d | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_texture_outline | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |