This commit is contained in:
raysan5 2013-11-28 21:13:10 +01:00
parent e9143b8a8d
commit 6f9d7db4ad
4 changed files with 26 additions and 243 deletions

View file

@ -1,11 +1,11 @@
/*******************************************************************************************
*
* raylib example 08 - Audio loading and playing
* raylib example 08 - Audio loading and playing
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
@ -13,23 +13,6 @@
int main()
{
<<<<<<< HEAD
int screenWidth = 800;
int screenHeight = 450;
// Initialization
//---------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib example 08 - audio loading and playing");
InitAudioDevice(); // Initialize audio device
Sound fx = LoadSound("resources/coin.wav"); // Load WAV audio file
bool currentKeyState = false;
bool previousKeyState = currentKeyState;
//----------------------------------------------------------
=======
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
@ -42,46 +25,9 @@ int main()
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
while (!WindowShouldClose()) // Detect window close button or ESC key
{
<<<<<<< HEAD
// Update
//-----------------------------------------------------
currentKeyState = IsKeyPressed(KEY_SPACE); // Check if Space have been pressed
if (currentKeyState != previousKeyState)
{
if (currentKeyState) PlaySound(fx); // Play the sound!
previousKeyState = currentKeyState;
}
//-----------------------------------------------------
// Draw
//-----------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Press SPACE to PLAY the SOUND!", 240, 200, 20, 1, LIGHTGRAY);
EndDrawing();
//-----------------------------------------------------
}
// De-Initialization
//---------------------------------------------------------
UnloadSound(fx); // Unload sound data
CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context
//----------------------------------------------------------
=======
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE)) PlaySound(fx); // Play the sound!
@ -108,6 +54,5 @@ int main()
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
>>>>>>> Added some functions and examples update
return 0;
}