mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-14 17:35:34 -04:00
Added interactive titlebar!
This commit is contained in:
parent
f21e26eaa3
commit
246e628df8
4 changed files with 2043 additions and 1985 deletions
|
@ -106,6 +106,7 @@ SystemStatusView::SystemStatusView(
|
|||
&backdrop,
|
||||
&button_back,
|
||||
&title,
|
||||
&button_title,
|
||||
&button_speaker,
|
||||
&button_stealth,
|
||||
//&button_textentry,
|
||||
|
@ -138,6 +139,10 @@ SystemStatusView::SystemStatusView(
|
|||
if (this->on_back)
|
||||
this->on_back();
|
||||
};
|
||||
|
||||
button_title.on_select = [this](ImageButton&) {
|
||||
this->on_title();
|
||||
};
|
||||
|
||||
button_speaker.on_select = [this](ImageButton&) {
|
||||
this->on_speaker();
|
||||
|
@ -194,8 +199,23 @@ void SystemStatusView::refresh() {
|
|||
}
|
||||
|
||||
void SystemStatusView::set_back_enabled(bool new_value) {
|
||||
button_back.set_foreground(new_value ? Color::white() : Color::dark_grey());
|
||||
button_back.set_focusable(new_value);
|
||||
|
||||
if(new_value){
|
||||
add_child(&button_back);
|
||||
}
|
||||
else{
|
||||
remove_child(&button_back);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemStatusView::set_title_image_enabled(bool new_value) {
|
||||
|
||||
if(new_value){
|
||||
add_child(&button_title);
|
||||
}
|
||||
else{
|
||||
remove_child(&button_title);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemStatusView::set_title(const std::string new_value) {
|
||||
|
@ -282,6 +302,10 @@ void SystemStatusView::on_camera() {
|
|||
}
|
||||
}
|
||||
|
||||
void SystemStatusView::on_title() {
|
||||
nav_.push<AboutView>();
|
||||
}
|
||||
|
||||
/* Navigation ************************************************************/
|
||||
|
||||
bool NavigationView::is_top() const {
|
||||
|
@ -515,8 +539,11 @@ SystemView::SystemView(
|
|||
});
|
||||
navigation_view.on_view_changed = [this](const View& new_view) {
|
||||
this->status_view.set_back_enabled(!this->navigation_view.is_top());
|
||||
this->status_view.set_title_image_enabled(this->navigation_view.is_top());
|
||||
this->status_view.set_dirty();
|
||||
this->status_view.set_title(new_view.title());
|
||||
};
|
||||
|
||||
|
||||
// portapack::persistent_memory::set_playdead_sequence(0x8D1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue