mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-22 18:26:39 +00:00
GameCardTab: fix drawing issues while switching views through the LayerView class.
This commit is contained in:
parent
e79767ef38
commit
c90251a52b
2 changed files with 17 additions and 10 deletions
|
@ -37,7 +37,9 @@ namespace nxdt::views
|
||||||
GameCardStatus gc_status = GameCardStatus_NotInserted;
|
GameCardStatus gc_status = GameCardStatus_NotInserted;
|
||||||
|
|
||||||
ErrorFrame *error_frame = nullptr;
|
ErrorFrame *error_frame = nullptr;
|
||||||
|
|
||||||
brls::List *list = nullptr;
|
brls::List *list = nullptr;
|
||||||
|
brls::ListItem *placeholder = nullptr;
|
||||||
|
|
||||||
std::vector<brls::View*> views;
|
std::vector<brls::View*> views;
|
||||||
int view_index = -1;
|
int view_index = -1;
|
||||||
|
|
|
@ -30,15 +30,18 @@ namespace nxdt::views
|
||||||
{
|
{
|
||||||
/* Add error frame. */
|
/* Add error frame. */
|
||||||
this->error_frame = new ErrorFrame("No gamecard inserted.");
|
this->error_frame = new ErrorFrame("No gamecard inserted.");
|
||||||
this->addLayer(this->error_frame);
|
this->addLayerWrapper(this->error_frame);
|
||||||
|
|
||||||
/* Add list. */
|
/* Add list. */
|
||||||
this->list = new brls::List();
|
this->list = new brls::List();
|
||||||
this->list->addView(new brls::ListItem("Placeholder"));
|
this->placeholder = new brls::ListItem("Placeholder");
|
||||||
this->addLayer(this->list);
|
this->list->addView(this->placeholder);
|
||||||
|
this->addLayerWrapper(this->list);
|
||||||
|
|
||||||
/* Setup gamecard status task. */
|
/* Setup gamecard status task. */
|
||||||
this->gc_status_task_sub = this->gc_status_task->RegisterListener([this](GameCardStatus gc_status) {
|
this->gc_status_task_sub = this->gc_status_task->RegisterListener([this](GameCardStatus gc_status) {
|
||||||
|
if (gc_status < GameCardStatus_InsertedAndInfoLoaded) this->changeLayerWrapper(this->error_frame);
|
||||||
|
|
||||||
switch(gc_status)
|
switch(gc_status)
|
||||||
{
|
{
|
||||||
case GameCardStatus_NotInserted:
|
case GameCardStatus_NotInserted:
|
||||||
|
@ -62,15 +65,12 @@ namespace nxdt::views
|
||||||
"Please check the logfile and report this issue to " APP_AUTHOR ".");
|
"Please check the logfile and report this issue to " APP_AUTHOR ".");
|
||||||
break;
|
break;
|
||||||
case GameCardStatus_InsertedAndInfoLoaded:
|
case GameCardStatus_InsertedAndInfoLoaded:
|
||||||
this->changeLayer(1);
|
this->changeLayerWrapper(this->list);
|
||||||
this->list->invalidate(true);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gc_status < GameCardStatus_InsertedAndInfoLoaded) this->changeLayer(0);
|
|
||||||
|
|
||||||
this->gc_status = gc_status;
|
this->gc_status = gc_status;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,9 @@ namespace nxdt::views
|
||||||
{
|
{
|
||||||
/* Unregister gamecard task listener. */
|
/* Unregister gamecard task listener. */
|
||||||
this->gc_status_task->UnregisterListener(this->gc_status_task_sub);
|
this->gc_status_task->UnregisterListener(this->gc_status_task_sub);
|
||||||
|
|
||||||
|
/* Clear views vector. */
|
||||||
|
if (this->views.size()) this->views.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameCardTab::addLayerWrapper(brls::View* view)
|
void GameCardTab::addLayerWrapper(brls::View* view)
|
||||||
|
@ -101,11 +104,13 @@ namespace nxdt::views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == -1 || index == this->view_index) return;
|
if (index == -1) return;
|
||||||
|
|
||||||
|
/* TODO: check all ListItem elements using a loop. */
|
||||||
|
if (brls::Application::getCurrentFocus() == this->placeholder) brls::Application::onGamepadButtonPressed(GLFW_GAMEPAD_BUTTON_DPAD_LEFT, false);
|
||||||
|
|
||||||
//reinterpret_cast<brls::TabFrame*>(this->getParent())->onCancel();
|
|
||||||
this->changeLayer(index);
|
this->changeLayer(index);
|
||||||
|
this->invalidate(true);
|
||||||
this->view_index = index;
|
this->view_index = index;
|
||||||
view->invalidate(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue