mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +01:00
Fixed playing of select sound; it was not tested for completion before
launching the game.
This commit is contained in:
parent
668b8badd9
commit
c90b8990df
@ -1085,7 +1085,7 @@ void Page::initializeFonts()
|
||||
}
|
||||
|
||||
|
||||
void Page::launchEnter()
|
||||
void Page::playSelect()
|
||||
{
|
||||
if(selectSoundChunk_)
|
||||
{
|
||||
@ -1094,6 +1094,16 @@ void Page::launchEnter()
|
||||
}
|
||||
|
||||
|
||||
bool Page::isSelectPlaying()
|
||||
{
|
||||
if ( selectSoundChunk_ )
|
||||
{
|
||||
return selectSoundChunk_->isPlaying();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Page::reallocateMenuSpritePoints()
|
||||
{
|
||||
for(std::vector<ScrollingList *>::iterator it = activeMenu_.begin(); it != activeMenu_.end(); it++)
|
||||
|
||||
@ -89,7 +89,8 @@ public:
|
||||
void allocateGraphicsMemory();
|
||||
void deInitializeFonts( );
|
||||
void initializeFonts( );
|
||||
void launchEnter();
|
||||
void playSelect();
|
||||
bool isSelectPlaying();
|
||||
std::string getCollectionName();
|
||||
void setMinShowTime(float value);
|
||||
float getMinShowTime();
|
||||
|
||||
@ -136,9 +136,7 @@ int RetroFE::initialize( void *context )
|
||||
void RetroFE::launchEnter( )
|
||||
{
|
||||
|
||||
// Play launch sound
|
||||
currentPage_->launchEnter( );
|
||||
|
||||
// Disable window focus
|
||||
SDL_SetWindowGrab(SDL::getWindow(), SDL_FALSE);
|
||||
|
||||
// Free the textures, and optionally take down SDL
|
||||
@ -615,13 +613,14 @@ void RetroFE::run( )
|
||||
|
||||
// Launching game; start onGameEnter animation
|
||||
case RETROFE_LAUNCH_ENTER:
|
||||
currentPage_->enterGame( );
|
||||
currentPage_->enterGame( ); // Start onGameEnter animation
|
||||
currentPage_->playSelect( ); // Play launch sound
|
||||
state = RETROFE_LAUNCH_REQUEST;
|
||||
break;
|
||||
|
||||
// Wait for onGameEnter animation to finish; launch game; start onGameExit animation
|
||||
case RETROFE_LAUNCH_REQUEST:
|
||||
if ( currentPage_->isIdle( ) )
|
||||
if ( currentPage_->isIdle( ) && !currentPage_->isSelectPlaying( ) )
|
||||
{
|
||||
nextPageItem_ = currentPage_->getSelectedItem( );
|
||||
launchEnter( );
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
Sound::Sound(std::string file, std::string altfile)
|
||||
: file_(file)
|
||||
, chunk_(NULL)
|
||||
, channel_(-1)
|
||||
{
|
||||
if(!allocate())
|
||||
{
|
||||
@ -45,7 +46,7 @@ void Sound::play()
|
||||
{
|
||||
if(chunk_)
|
||||
{
|
||||
(void)Mix_PlayChannel(-1, chunk_, 0);
|
||||
channel_ = Mix_PlayChannel(-1, chunk_, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +55,8 @@ bool Sound::free()
|
||||
if(chunk_)
|
||||
{
|
||||
Mix_FreeChunk(chunk_);
|
||||
chunk_ = NULL;
|
||||
chunk_ = NULL;
|
||||
channel_ = -1;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -69,3 +71,9 @@ bool Sound::allocate()
|
||||
|
||||
return (chunk_ != NULL);
|
||||
}
|
||||
|
||||
|
||||
bool Sound::isPlaying()
|
||||
{
|
||||
return (channel_ != -1) && Mix_Playing(channel_);
|
||||
}
|
||||
|
||||
@ -25,7 +25,9 @@ public:
|
||||
void play();
|
||||
bool allocate();
|
||||
bool free();
|
||||
bool isPlaying();
|
||||
private:
|
||||
std::string file_;
|
||||
Mix_Chunk *chunk_;
|
||||
Mix_Chunk *chunk_;
|
||||
int channel_;
|
||||
};
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
std::string retrofe_version_major = "0";
|
||||
std::string retrofe_version_minor = "8";
|
||||
std::string retrofe_version_build = "13";
|
||||
std::string retrofe_version_build = "14";
|
||||
|
||||
|
||||
std::string Version::getString( )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user