switch-examples: Updated Makefile for romfs and updated all audio examples for switch
This commit is contained in:
parent
394c5e178f
commit
6719c57ba8
1 changed files with 85 additions and 49 deletions
|
|
@ -14,6 +14,7 @@
|
|||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
#include <switch.h>
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
|
|
@ -25,12 +26,14 @@ int main(void)
|
|||
const int screenWidth = 1280;
|
||||
const int screenHeight = 720;
|
||||
|
||||
// Initialize resource directory
|
||||
romfsInit();
|
||||
InitWindow(screenWidth, screenHeight, "raylib [audio] example - Multichannel sound playing");
|
||||
|
||||
InitAudioDevice(); // Initialize audio device
|
||||
|
||||
Sound fxWav = LoadSound("resources/sound.wav"); // Load WAV audio file
|
||||
Sound fxOgg = LoadSound("resources/target.ogg"); // Load OGG audio file
|
||||
Sound fxWav = LoadSound("romfs:/resources/sound.wav"); // Load WAV audio file
|
||||
Sound fxOgg = LoadSound("romfs:/resources/target.ogg"); // Load OGG audio file
|
||||
|
||||
SetSoundVolume(fxWav, 0.2f);
|
||||
|
||||
|
|
@ -42,8 +45,8 @@ int main(void)
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KEY_ENTER)) PlaySoundMulti(fxWav); // Play a new wav sound instance
|
||||
if (IsKeyPressed(KEY_SPACE)) PlaySoundMulti(fxOgg); // Play a new ogg sound instance
|
||||
if (IsGamepadButtonPressed(0, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) PlaySoundMulti(fxWav); // Play a new wav sound instance
|
||||
if (IsGamepadButtonPressed(0, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) PlaySoundMulti(fxOgg); // Play a new ogg sound instance
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
|
@ -53,8 +56,8 @@ int main(void)
|
|||
ClearBackground(RAYWHITE);
|
||||
|
||||
DrawText("MULTICHANNEL SOUND PLAYING", 20, 20, 20, GRAY);
|
||||
DrawText("Press SPACE to play new ogg instance!", 200, 120, 20, LIGHTGRAY);
|
||||
DrawText("Press ENTER to play new wav instance!", 200, 180, 20, LIGHTGRAY);
|
||||
DrawText("Press A button to play new ogg instance!", 200, 120, 20, LIGHTGRAY);
|
||||
DrawText("Press B button to play new wav instance!", 200, 180, 20, LIGHTGRAY);
|
||||
|
||||
DrawText(TextFormat("CONCURRENT SOUNDS PLAYING: %02i", GetSoundsPlaying()), 220, 280, 20, RED);
|
||||
|
||||
|
|
@ -74,5 +77,6 @@ int main(void)
|
|||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
romfsExit();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue