mirror of
https://github.com/Maschell/hid_to_vpad.git
synced 2024-11-27 16:54:14 +01:00
Added function to reload the UI
This commit is contained in:
parent
b7d5e68026
commit
f749160fd4
@ -90,6 +90,9 @@ s32 Application::exec(){
|
|||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::reloadUI(){
|
||||||
|
reloadUIflag = true;
|
||||||
|
}
|
||||||
void Application::fadeOut(){
|
void Application::fadeOut(){
|
||||||
GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color){ 0, 0, 0, 255 });
|
GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color){ 0, 0, 0, 255 });
|
||||||
|
|
||||||
@ -149,26 +152,29 @@ void Application::executeThread(void){
|
|||||||
GuiText::setPresetFont(fontSystem);
|
GuiText::setPresetFont(fontSystem);
|
||||||
|
|
||||||
log_printf("Application::executeThread(line %d): Initialize main window\n",__LINE__);
|
log_printf("Application::executeThread(line %d): Initialize main window\n",__LINE__);
|
||||||
|
reloadUIflag = true;
|
||||||
|
bgMusic->SetLoop(true);
|
||||||
|
bgMusic->SetVolume(50);
|
||||||
|
while(reloadUIflag){
|
||||||
|
reloadUIflag = false;
|
||||||
|
exitCode = EXIT_RELAUNCH_ON_LOAD;
|
||||||
|
loadLanguageFromConfig();
|
||||||
mainWindow = MainWindow::getInstance(video->getTvWidth(), video->getTvHeight());
|
mainWindow = MainWindow::getInstance(video->getTvWidth(), video->getTvHeight());
|
||||||
|
|
||||||
bgMusic->SetLoop(true);
|
|
||||||
bgMusic->Play();
|
|
||||||
bgMusic->SetVolume(50);
|
|
||||||
|
|
||||||
log_printf("Application::executeThread(line %d): Entering main loop\n",__LINE__);
|
log_printf("Application::executeThread(line %d): Entering main loop\n",__LINE__);
|
||||||
|
exitApplication = false;
|
||||||
//! main GX2 loop (60 Hz cycle with max priority on core 1)
|
//! main GX2 loop (60 Hz cycle with max priority on core 1)
|
||||||
while(!exitApplication)
|
while(!exitApplication && !reloadUIflag){
|
||||||
{
|
|
||||||
|
if(!bgMusic->IsPlaying() && CSettings::getValueAsBool(CSettings::MusicActivated)) bgMusic->Play();
|
||||||
|
if(bgMusic->IsPlaying() && !CSettings::getValueAsBool(CSettings::MusicActivated)) bgMusic->Pause();
|
||||||
|
|
||||||
//! Read out inputs
|
//! Read out inputs
|
||||||
for(s32 i = 0; i < 5; i++)
|
for(s32 i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
if(controller[i]->update(video->getTvWidth(), video->getTvHeight()) == false)
|
if(controller[i]->update(video->getTvWidth(), video->getTvHeight()) == false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(controller[i]->data.buttons_d & VPAD_BUTTON_PLUS){
|
if(controller[i]->data.buttons_d & VPAD_BUTTON_PLUS){
|
||||||
exitCode = APPLICATION_CLOSE_APPLY;
|
exitCode = APPLICATION_CLOSE_APPLY;
|
||||||
exitApplication = true;
|
exitApplication = true;
|
||||||
@ -179,7 +185,6 @@ void Application::executeThread(void){
|
|||||||
exitApplication = true;
|
exitApplication = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! update controller states
|
//! update controller states
|
||||||
mainWindow->update(controller[i]);
|
mainWindow->update(controller[i]);
|
||||||
}
|
}
|
||||||
@ -211,10 +216,10 @@ void Application::executeThread(void){
|
|||||||
//! and avoid blocking the GUI thread
|
//! and avoid blocking the GUI thread
|
||||||
AsyncDeleter::triggerDeleteProcess();
|
AsyncDeleter::triggerDeleteProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
fadeOut();
|
fadeOut();
|
||||||
|
|
||||||
MainWindow::destroyInstance();
|
MainWindow::destroyInstance();
|
||||||
|
}
|
||||||
|
|
||||||
delete fontSystem;
|
delete fontSystem;
|
||||||
delete video;
|
delete video;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
s32 exec(void);
|
s32 exec(void);
|
||||||
void fadeOut(void);
|
void fadeOut(void);
|
||||||
|
|
||||||
|
void reloadUI(void);
|
||||||
|
|
||||||
void quit(s32 code) {
|
void quit(s32 code) {
|
||||||
exitCode = code;
|
exitCode = code;
|
||||||
exitApplication = true;
|
exitApplication = true;
|
||||||
@ -70,6 +72,8 @@ private:
|
|||||||
|
|
||||||
void loadLanguageFromConfig();
|
void loadLanguageFromConfig();
|
||||||
|
|
||||||
|
bool reloadUIflag = false;
|
||||||
|
|
||||||
GuiSound *bgMusic;
|
GuiSound *bgMusic;
|
||||||
CVideo *video;
|
CVideo *video;
|
||||||
MainWindow *mainWindow;
|
MainWindow *mainWindow;
|
||||||
|
Loading…
Reference in New Issue
Block a user