diff options
| author | raysan5 <raysan5@gmail.com> | 2013-11-28 19:59:56 +0100 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2013-11-28 19:59:56 +0100 |
| commit | e9143b8a8d2eb439b01b94c00518db2b59ffb1e7 (patch) | |
| tree | 8539603494a773f852721da1d6f7b19bca0d8f64 /examples/ex08_audio.c | |
| parent | 818e79638b5ff14fdae9f6a162e596bf119f82c5 (diff) | |
| download | raylib-e9143b8a8d2eb439b01b94c00518db2b59ffb1e7.tar.gz raylib-e9143b8a8d2eb439b01b94c00518db2b59ffb1e7.zip | |
Added some functions and Updated examples
View CHANGELOG for details
Diffstat (limited to 'examples/ex08_audio.c')
| -rw-r--r-- | examples/ex08_audio.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/ex08_audio.c b/examples/ex08_audio.c index da39bf73..7f8df55c 100644 --- a/examples/ex08_audio.c +++ b/examples/ex08_audio.c @@ -13,6 +13,7 @@ int main() { +<<<<<<< HEAD int screenWidth = 800; int screenHeight = 450; @@ -28,9 +29,24 @@ int main() bool previousKeyState = currentKeyState; //---------------------------------------------------------- +======= + // Initialization + //-------------------------------------------------------------------------------------- + int screenWidth = 800; + int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "raylib example 08 - audio loading and playing"); + + InitAudioDevice(); // Initialize audio device + + Sound fx = LoadSound("resources/coin.wav"); // Load WAV audio file + //-------------------------------------------------------------------------------------- + +>>>>>>> Added some functions and examples update // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { +<<<<<<< HEAD // Update //----------------------------------------------------- currentKeyState = IsKeyPressed(KEY_SPACE); // Check if Space have been pressed @@ -65,5 +81,33 @@ int main() CloseWindow(); // Close window and OpenGL context //---------------------------------------------------------- +======= + // Update + //---------------------------------------------------------------------------------- + if (IsKeyPressed(KEY_SPACE)) PlaySound(fx); // Play the sound! + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + DrawText("Press SPACE to PLAY the SOUND!", 240, 200, 20, LIGHTGRAY); + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + UnloadSound(fx); // Unload sound data + + CloseAudioDevice(); // Close audio device + + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + +>>>>>>> Added some functions and examples update return 0; }
\ No newline at end of file |
