5 Commits

Author SHA1 Message Date
  Ray c991f9e89f Merge branch 'master' of https://github.com/raysan5/raylib 1 week ago
  Ray 8f3cabcf76 Update rcore.c 1 week ago
  Hugo 2b051afb29
[examples] `shapes_kaleidoscope` rewind, forward & reset buttons (#5369) 1 week ago
  Ray 3d9129e3b4 Update rexm.rc 1 week ago
  Ray 80ed6eadb8 REXM: RENAME: `audio_fft_spectrum_visualizer` -> `audio_spectrum_visualizer` 1 week ago
13 changed files with 78 additions and 33 deletions
Split View
  1. +1
    -1
      examples/Makefile
  2. +6
    -5
      examples/Makefile.Web
  3. +2
    -2
      examples/README.md
  4. +2
    -2
      examples/audio/audio_spectrum_visualizer.c
  5. +0
    -0
      examples/audio/audio_spectrum_visualizer.png
  6. +1
    -1
      examples/examples_list.txt
  7. +56
    -11
      examples/shapes/shapes_kaleidoscope.c
  8. BIN
      examples/shapes/shapes_kaleidoscope.png
  9. +3
    -3
      projects/VS2022/examples/audio_spectrum_visualizer.vcxproj
  10. +1
    -1
      projects/VS2022/raylib.sln
  11. +1
    -2
      src/rcore.c
  12. +1
    -1
      tools/rexm/reports/examples_validation.md
  13. +4
    -4
      tools/rexm/rexm.rc

+ 1
- 1
examples/Makefile View File

@ -708,7 +708,6 @@ SHADERS = \
shaders/shaders_vertex_displacement
AUDIO = \
audio/audio_fft_spectrum_visualizer \
audio/audio_mixed_processor \
audio/audio_module_playing \
audio/audio_music_stream \
@ -716,6 +715,7 @@ AUDIO = \
audio/audio_sound_loading \
audio/audio_sound_multi \
audio/audio_sound_positioning \
audio/audio_spectrum_visualizer \
audio/audio_stream_effects
OTHERS = \

+ 6
- 5
examples/Makefile.Web View File

@ -696,7 +696,6 @@ SHADERS = \
shaders/shaders_vertex_displacement
AUDIO = \
audio/audio_fft_spectrum_visualizer \
audio/audio_mixed_processor \
audio/audio_module_playing \
audio/audio_music_stream \
@ -704,6 +703,7 @@ AUDIO = \
audio/audio_sound_loading \
audio/audio_sound_multi \
audio/audio_sound_positioning \
audio/audio_spectrum_visualizer \
audio/audio_stream_effects
# Default target entry
@ -1471,10 +1471,6 @@ shaders/shaders_vertex_displacement: shaders/shaders_vertex_displacement.c
--preload-file shaders/resources/shaders/glsl100/vertex_displacement.fs@resources/shaders/glsl100/vertex_displacement.fs
# Compile AUDIO examples
audio/audio_fft_spectrum_visualizer: audio/audio_fft_spectrum_visualizer.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file audio/resources/country.mp3@resources/country.mp3
audio/audio_mixed_processor: audio/audio_mixed_processor.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file audio/resources/country.mp3@resources/country.mp3 \
@ -1503,6 +1499,11 @@ audio/audio_sound_positioning: audio/audio_sound_positioning.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file audio/resources/coin.wav@resources/coin.wav
audio/audio_spectrum_visualizer: audio/audio_spectrum_visualizer.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file audio/resources/shaders/glsl100/fft.fs@resources/shaders/glsl100/fft.fs \
--preload-file audio/resources/country.mp3@resources/country.mp3
audio/audio_stream_effects: audio/audio_stream_effects.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file audio/resources/country.mp3@resources/country.mp3

+ 2
- 2
examples/README.md View File

@ -260,7 +260,7 @@ Examples using raylib audio functionality, including sound/music loading and pla
| [audio_stream_effects](audio/audio_stream_effects.c) | <img src="audio/audio_stream_effects.png" alt="audio_stream_effects" width="80"> | ⭐⭐⭐⭐️ | 4.2 | 5.0 | [Ramon Santamaria](https://github.com/raysan5) |
| [audio_sound_multi](audio/audio_sound_multi.c) | <img src="audio/audio_sound_multi.png" alt="audio_sound_multi" width="80"> | ⭐⭐☆☆ | 5.0 | 5.0 | [Jeffery Myers](https://github.com/JeffM2501) |
| [audio_sound_positioning](audio/audio_sound_positioning.c) | <img src="audio/audio_sound_positioning.png" alt="audio_sound_positioning" width="80"> | ⭐⭐☆☆ | 5.5 | 5.5 | [Le Juez Victor](https://github.com/Bigfoot71) |
| [audio_fft_spectrum_visualizer](audio/audio_fft_spectrum_visualizer.c) | <img src="audio/audio_fft_spectrum_visualizer.png" alt="audio_fft_spectrum_visualizer" width="80"> | ⭐⭐⭐☆ | 6.0 | 5.6-dev | [IANN](https://github.com/meisei4) |
| [audio_spectrum_visualizer](audio/audio_spectrum_visualizer.c) | <img src="audio/audio_spectrum_visualizer.png" alt="audio_spectrum_visualizer" width="80"> | ⭐⭐⭐☆ | 6.0 | 5.6-dev | [IANN](https://github.com/meisei4) |
### category: others [6]
@ -276,4 +276,4 @@ Examples showing raylib misc functionality that does not fit in other categories
| [web_basic_window](others/web_basic_window.c) | <img src="others/web_basic_window.png" alt="web_basic_window" width="80"> | ⭐☆☆☆ | 5.6-dev | 5.6-dev | [Ramon Santamaria](https://github.com/raysan5) |
Some example missing? As always, contributions are welcome, feel free to send new examples!
Here is an[examples template](examples_template.c) with instructions to start with!
Here is an [examples template](examples_template.c) with instructions to start with!

examples/audio/audio_fft_spectrum_visualizer.c → examples/audio/audio_spectrum_visualizer.c View File

@ -1,6 +1,6 @@
/*******************************************************************************************
*
* raylib [audio] example - fft spectrum visualizer
* raylib [audio] example - spectrum visualizer
*
* Example complexity rating: [] 3/4
*
@ -78,7 +78,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [audio] example - fft spectrum visualizer");
InitWindow(screenWidth, screenHeight, "raylib [audio] example - spectrum visualizer");
Image fftImage = GenImageColor(BUFFER_SIZE, TEXTURE_HEIGHT, WHITE);
Texture2D fftTexture = LoadTextureFromImage(fftImage);

examples/audio/audio_fft_spectrum_visualizer.png → examples/audio/audio_spectrum_visualizer.png View File


+ 1
- 1
examples/examples_list.txt View File

@ -200,7 +200,7 @@ audio;audio_mixed_processor;★★★★;4.2;4.2;2023;2025;"hkc";@hatkidchan
audio;audio_stream_effects;★★★★;4.2;5.0;2022;2025;"Ramon Santamaria";@raysan5
audio;audio_sound_multi;★★☆☆;5.0;5.0;2023;2025;"Jeffery Myers";@JeffM2501
audio;audio_sound_positioning;★★☆☆;5.5;5.5;2025;2025;"Le Juez Victor";@Bigfoot71
audio;audio_fft_spectrum_visualizer;★★★☆;6.0;5.6-dev;2025;2025;"IANN";@meisei4
audio;audio_spectrum_visualizer;★★★☆;6.0;5.6-dev;2025;2025;"IANN";@meisei4
others;rlgl_standalone;★★★★;1.6;4.0;2014;2025;"Ramon Santamaria";@raysan5
others;rlgl_compute_shader;★★★★;4.0;4.0;2021;2025;"Teddy Astie";@tsnake41
others;easings_testbed;★★★☆;2.5;3.0;2019;2025;"Juan Miguel López";@flashback-fx

+ 56
- 11
examples/shapes/shapes_kaleidoscope.c View File

@ -16,7 +16,10 @@
********************************************************************************************/
#include "raylib.h"
#include <string.h>
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"
#include "raymath.h"
#define MAX_DRAW_LINES 8192
@ -47,6 +50,9 @@ int main(void)
int symmetry = 6;
float angle = 360.0f/(float)symmetry;
float thickness = 3.0f;
Rectangle resetButtonRec = { screenWidth - 55, 5, 50, 25 };
Rectangle backButtonRec = { screenWidth - 55, screenHeight - 30, 25, 25 };
Rectangle nextButtonRec = { screenWidth - 30, screenHeight - 30, 25, 25 };
Vector2 mousePos = { 0 };
Vector2 prevMousePos = { 0 };
Vector2 scaleVector = { 1.0f, -1.0f };
@ -58,7 +64,11 @@ int main(void)
camera.rotation = 0.0f;
camera.zoom = 1.0f;
int lineCounter = 0;
int currentLineCounter = 0;
int totalLineCounter = 0;
int resetButtonClicked = false;
int backButtonClicked = false;
int nextButtonClicked = false;
SetTargetFPS(20);
//--------------------------------------------------------------------------------------
@ -74,24 +84,47 @@ int main(void)
Vector2 lineStart = Vector2Subtract(mousePos, offset);
Vector2 lineEnd = Vector2Subtract(prevMousePos, offset);
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
if (
IsMouseButtonDown(MOUSE_LEFT_BUTTON)
&& (CheckCollisionPointRec(mousePos, resetButtonRec) == false)
&& (CheckCollisionPointRec(mousePos, backButtonRec) == false)
&& (CheckCollisionPointRec(mousePos, nextButtonRec) == false)
)
{
for (int s = 0; (s < symmetry) && (lineCounter < (MAX_DRAW_LINES - 1)); s++)
for (int s = 0; (s < symmetry) && (totalLineCounter < (MAX_DRAW_LINES - 1)); s++)
{
lineStart = Vector2Rotate(lineStart, angle*DEG2RAD);
lineEnd = Vector2Rotate(lineEnd, angle*DEG2RAD);
// Store mouse line
lines[lineCounter].start = lineStart;
lines[lineCounter].end = lineEnd;
lines[totalLineCounter].start = lineStart;
lines[totalLineCounter].end = lineEnd;
// Store reflective line
lines[lineCounter + 1].start = Vector2Multiply(lineStart, scaleVector);
lines[lineCounter + 1].end = Vector2Multiply(lineEnd, scaleVector);
lines[totalLineCounter + 1].start = Vector2Multiply(lineStart, scaleVector);
lines[totalLineCounter + 1].end = Vector2Multiply(lineEnd, scaleVector);
lineCounter += 2;
totalLineCounter += 2;
currentLineCounter = totalLineCounter;
}
}
if (resetButtonClicked)
{
memset(&lines, 0, sizeof(Line)*MAX_DRAW_LINES);
currentLineCounter = 0;
totalLineCounter = 0;
}
if (backButtonClicked && (currentLineCounter > 0))
{
currentLineCounter -= 1;
}
if (nextButtonClicked && (currentLineCounter < MAX_DRAW_LINES) && ((currentLineCounter + 1) <= totalLineCounter))
{
currentLineCounter += 1;
}
//----------------------------------------------------------------------------------
// Draw
@ -99,19 +132,31 @@ int main(void)
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode2D(camera);
for (int s = 0; s < symmetry; s++)
{
for (int i = 0; i < lineCounter; i += 2)
for (int i = 0; i < currentLineCounter; i += 2)
{
DrawLineEx(lines[i].start, lines[i].end, thickness, BLACK);
DrawLineEx(lines[i + 1].start, lines[i + 1].end, thickness, BLACK);
}
}
EndMode2D();
DrawText(TextFormat("LINES: %i/%i", lineCounter, MAX_DRAW_LINES), 10, screenHeight - 30, 20, MAROON);
if ((currentLineCounter - 1) < 0) GuiDisable();
backButtonClicked = GuiButton(backButtonRec, "<");
GuiEnable();
if ((currentLineCounter + 1) > totalLineCounter) GuiDisable();
nextButtonClicked = GuiButton(nextButtonRec, ">");
GuiEnable();
resetButtonClicked = GuiButton(resetButtonRec, "Reset");
DrawText(TextFormat("LINES: %i/%i", currentLineCounter, MAX_DRAW_LINES), 10, screenHeight - 30, 20, MAROON);
DrawFPS(10, 10);
EndDrawing();

BIN
examples/shapes/shapes_kaleidoscope.png View File

Before After
Width: 798  |  Height: 448  |  Size: 38 KiB Width: 800  |  Height: 450  |  Size: 81 KiB

projects/VS2022/examples/audio_fft_spectrum_visualizer.vcxproj → projects/VS2022/examples/audio_spectrum_visualizer.vcxproj View File

@ -53,9 +53,9 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{2B3CED91-973F-4936-9DD4-CC8B1C8ACC68}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>audio_fft_spectrum_visualizer</RootNamespace>
<RootNamespace>audio_spectrum_visualizer</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>audio_fft_spectrum_visualizer</ProjectName>
<ProjectName>audio_spectrum_visualizer</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -553,7 +553,7 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\examples\audio\audio_fft_spectrum_visualizer.c" />
<ClCompile Include="..\..\..\examples\audio\audio_spectrum_visualizer.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\examples\examples.rc" />

+ 1
- 1
projects/VS2022/raylib.sln View File

@ -411,7 +411,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_compute_hash", "exampl
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_screen_buffer", "examples\textures_screen_buffer.vcxproj", "{4E9D2828-EE83-40C8-97E0-137EEDFBAAAD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audio_fft_spectrum_visualizer", "examples\audio_fft_spectrum_visualizer.vcxproj", "{2B3CED91-973F-4936-9DD4-CC8B1C8ACC68}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audio_spectrum_visualizer", "examples\audio_spectrum_visualizer.vcxproj", "{2B3CED91-973F-4936-9DD4-CC8B1C8ACC68}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_directional_billboard", "examples\models_directional_billboard.vcxproj", "{30011884-25EE-42C9-BB15-888CAFB1AA6E}"
EndProject

+ 1
- 2
src/rcore.c View File

@ -2315,8 +2315,7 @@ const char *GetApplicationDirectory(void)
#elif defined(__FreeBSD__)
size_t size = sizeof(appD
ir);
size_t size = sizeof(appDir);
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
if (sysctl(mib, 4, appDir, &size, NULL, 0) == 0)

+ 1
- 1
tools/rexm/reports/examples_validation.md View File

@ -213,7 +213,7 @@ Example elements validated:
| audio_stream_effects | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| audio_sound_multi | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| audio_sound_positioning | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| audio_fft_spectrum_visualizer | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| audio_spectrum_visualizer | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| rlgl_standalone | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| rlgl_compute_shader | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| easings_testbed | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |

+ 4
- 4
tools/rexm/rexm.rc View File

@ -6,8 +6,8 @@ PRODUCTVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
//BLOCK "080904E4" // English UK
BLOCK "040904E4" // English US
//BLOCK "080904E4" // English UK
BLOCK "040904E4" // English US
BEGIN
VALUE "CompanyName", "Ramon Santamaria"
VALUE "FileDescription", "rexm | raylib examples manager"
@ -21,7 +21,7 @@ BEGIN
END
BLOCK "VarFileInfo"
BEGIN
//VALUE "Translation", 0x809, 1252 // English UK
VALUE "Translation", 0x409, 1252 // English US
//VALUE "Translation", 0x809, 1252 // English UK
VALUE "Translation", 0x409, 1252 // English US
END
END

Loading…
Cancel
Save