From 3d7d174c70b2d00fd879ade64c5085d4ff34d4aa Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 20 May 2019 16:40:30 +0200 Subject: Review and recompile ALL examples --- examples/src/audio/audio_module_playing.c | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'examples/src/audio/audio_module_playing.c') diff --git a/examples/src/audio/audio_module_playing.c b/examples/src/audio/audio_module_playing.c index 54bfa3d..4aebd1e 100644 --- a/examples/src/audio/audio_module_playing.c +++ b/examples/src/audio/audio_module_playing.c @@ -23,25 +23,25 @@ typedef struct { Color color; } CircleWave; -int main() +int main(void) { // Initialization //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; + const int screenWidth = 800; + const int screenHeight = 450; SetConfigFlags(FLAG_MSAA_4X_HINT); // NOTE: Try to enable MSAA 4X - + InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)"); InitAudioDevice(); // Initialize audio device - + Color colors[14] = { ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE }; - + // Creates ome circles for visual effect CircleWave circles[MAX_CIRCLES]; - + for (int i = MAX_CIRCLES - 1; i >= 0; i--) { circles[i].alpha = 0.0f; @@ -53,7 +53,7 @@ int main() } Music xm = LoadMusicStream("resources/chiptun1.mod"); - + PlayMusicStream(xm); float timePlayed = 0.0f; @@ -68,34 +68,34 @@ int main() // Update //---------------------------------------------------------------------------------- UpdateMusicStream(xm); // Update music buffer with new stream data - + // Restart music playing (stop and play) - if (IsKeyPressed(KEY_SPACE)) + if (IsKeyPressed(KEY_SPACE)) { StopMusicStream(xm); PlayMusicStream(xm); } - - // Pause/Resume music playing + + // Pause/Resume music playing if (IsKeyPressed(KEY_P)) { pause = !pause; - + if (pause) PauseMusicStream(xm); else ResumeMusicStream(xm); } - + // Get timePlayed scaled to bar dimensions timePlayed = GetMusicTimePlayed(xm)/GetMusicTimeLength(xm)*(screenWidth - 40); - + // Color circles animation for (int i = MAX_CIRCLES - 1; (i >= 0) && !pause; i--) { circles[i].alpha += circles[i].speed; circles[i].radius += circles[i].speed*10.0f; - + if (circles[i].alpha > 1.0f) circles[i].speed *= -1; - + if (circles[i].alpha <= 0.0f) { circles[i].alpha = 0.0f; @@ -113,12 +113,12 @@ int main() BeginDrawing(); ClearBackground(RAYWHITE); - + for (int i = MAX_CIRCLES - 1; i >= 0; i--) { DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha)); } - + // Draw time bar DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY); DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON); @@ -131,7 +131,7 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- UnloadMusicStream(xm); // Unload music stream buffers from RAM - + CloseAudioDevice(); // Close audio device (music streaming is automatically stopped) CloseWindow(); // Close window and OpenGL context -- cgit v1.2.3