From 630201017b1748450d17df7fede0a337e572475a Mon Sep 17 00:00:00 2001 From: Siddharth Date: Mon, 7 Oct 2013 21:46:02 +0530 Subject: [PATCH 1/4] save states with data on them are now highlighted --- UI/MainScreen.cpp | 12 ++++++++++++ UI/NativeApp.cpp | 3 +++ 2 files changed, 15 insertions(+) diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 3459fe928d..83a9691ac4 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -202,6 +202,10 @@ void GameButton::Draw(UIContext &dc) { dc.RebindTexture(); } +class SaveChoice : public UI::Choice{ + +}; + // Abstraction above path that lets you navigate easily. // "/" is a special path that means the root of the file system. On Windows, // listing this will yield drives. @@ -723,14 +727,22 @@ void GamePauseScreen::CreateViews() { leftColumn->Add(leftColumnItems); saveSlots_ = leftColumnItems->Add(new ChoiceStrip(ORIENT_HORIZONTAL, new LinearLayoutParams(300, WRAP_CONTENT))); + saveSlots_->AddChoice(" 1 "); saveSlots_->AddChoice(" 2 "); saveSlots_->AddChoice(" 3 "); saveSlots_->AddChoice(" 4 "); saveSlots_->AddChoice(" 5 "); + saveSlots_->SetSelection(g_Config.iCurrentStateSlot); saveSlots_->OnChoice.Handle(this, &GamePauseScreen::OnStateSelected); + for(int i = 0; i < 5; i++){ + if(SaveState::HasSaveInSlot(i)){ + saveSlots_->HighlightChoice(i); + } + } + saveStateButton_ = leftColumnItems->Add(new Choice(i->T("Save State"))); saveStateButton_->OnClick.Handle(this, &GamePauseScreen::OnSaveState); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 40a29057f2..a0ad52637b 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -451,11 +451,14 @@ void NativeInitGraphics() { ui_theme.itemDownStyle.fgColor = 0xFFFFFFFF; ui_theme.itemDisabledStyle.background = UI::Drawable(0x55E0D4AF); ui_theme.itemDisabledStyle.fgColor = 0xFFcccccc; + ui_theme.itemHighlightedStyle.background = UI::Drawable(0x22edc24c); + ui_theme.itemHighlightedStyle.fgColor = 0xFFbd9939; ui_theme.buttonStyle = ui_theme.itemStyle; ui_theme.buttonFocusedStyle = ui_theme.itemFocusedStyle; ui_theme.buttonDownStyle = ui_theme.itemDownStyle; ui_theme.buttonDisabledStyle = ui_theme.itemDisabledStyle; + ui_theme.buttonHighlightedStyle = ui_theme.itemHighlightedStyle; ui_theme.popupTitle.fgColor = 0xFFE3BE59; ui_draw2d.Init(); From 34f71098215132e192bd92bc4fbadf61b429bf09 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Mon, 7 Oct 2013 21:58:00 +0530 Subject: [PATCH 2/4] removed SaveChoice class (was useless) --- UI/MainScreen.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 83a9691ac4..a8abcbdf01 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -202,10 +202,6 @@ void GameButton::Draw(UIContext &dc) { dc.RebindTexture(); } -class SaveChoice : public UI::Choice{ - -}; - // Abstraction above path that lets you navigate easily. // "/" is a special path that means the root of the file system. On Windows, // listing this will yield drives. From 4dba847ea40243f7d54b32d84a1c0838a2f2fc55 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Tue, 8 Oct 2013 19:08:50 +0530 Subject: [PATCH 3/4] Uses StickyChoice's Highlight() to highlight save slots in use --- UI/MainScreen.cpp | 25 ++++++++++++++----------- UI/NativeApp.cpp | 4 ++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index a8abcbdf01..4a7f8c4ba4 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -48,6 +48,8 @@ #include #endif +#include + #ifdef _WIN32 namespace MainWindow { void BrowseAndBoot(std::string defaultPath, bool browseDirectory = false); @@ -707,6 +709,8 @@ GamePauseScreen::~GamePauseScreen() { } void GamePauseScreen::CreateViews() { + static const int NUM_SAVESLOTS = 5; + using namespace UI; Margins actionMenuMargins(0, 100, 15, 0); I18NCategory *gs = GetI18NCategory("Graphics"); @@ -721,24 +725,23 @@ void GamePauseScreen::CreateViews() { ViewGroup *leftColumnItems = new LinearLayout(ORIENT_VERTICAL); leftColumn->Add(leftColumnItems); - saveSlots_ = leftColumnItems->Add(new ChoiceStrip(ORIENT_HORIZONTAL, new LinearLayoutParams(300, WRAP_CONTENT))); - saveSlots_->AddChoice(" 1 "); - saveSlots_->AddChoice(" 2 "); - saveSlots_->AddChoice(" 3 "); - saveSlots_->AddChoice(" 4 "); - saveSlots_->AddChoice(" 5 "); - saveSlots_->SetSelection(g_Config.iCurrentStateSlot); - saveSlots_->OnChoice.Handle(this, &GamePauseScreen::OnStateSelected); - - for(int i = 0; i < 5; i++){ - if(SaveState::HasSaveInSlot(i)){ + for (int i = 0; i < NUM_SAVESLOTS; i++){ + std::stringstream saveSlotText; + saveSlotText<<" "<AddChoice(saveSlotText.str()); + + if (SaveState::HasSaveInSlot(i)) { saveSlots_->HighlightChoice(i); } } + saveSlots_->SetSelection(g_Config.iCurrentStateSlot); + saveSlots_->OnChoice.Handle(this, &GamePauseScreen::OnStateSelected); + saveStateButton_ = leftColumnItems->Add(new Choice(i->T("Save State"))); saveStateButton_->OnClick.Handle(this, &GamePauseScreen::OnSaveState); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index a0ad52637b..f98cbce6fc 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -451,8 +451,8 @@ void NativeInitGraphics() { ui_theme.itemDownStyle.fgColor = 0xFFFFFFFF; ui_theme.itemDisabledStyle.background = UI::Drawable(0x55E0D4AF); ui_theme.itemDisabledStyle.fgColor = 0xFFcccccc; - ui_theme.itemHighlightedStyle.background = UI::Drawable(0x22edc24c); - ui_theme.itemHighlightedStyle.fgColor = 0xFFbd9939; + ui_theme.itemHighlightedStyle.background = UI::Drawable(0xFFbdBB39); + ui_theme.itemHighlightedStyle.fgColor = 0xFFFFFFFF; ui_theme.buttonStyle = ui_theme.itemStyle; ui_theme.buttonFocusedStyle = ui_theme.itemFocusedStyle; From bb66c442e5097801dffce92dd574338beaa3edb1 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Tue, 8 Oct 2013 19:22:21 +0530 Subject: [PATCH 4/4] less obnoxious color --- UI/NativeApp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index f98cbce6fc..68db3042d7 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -451,7 +451,7 @@ void NativeInitGraphics() { ui_theme.itemDownStyle.fgColor = 0xFFFFFFFF; ui_theme.itemDisabledStyle.background = UI::Drawable(0x55E0D4AF); ui_theme.itemDisabledStyle.fgColor = 0xFFcccccc; - ui_theme.itemHighlightedStyle.background = UI::Drawable(0xFFbdBB39); + ui_theme.itemHighlightedStyle.background = UI::Drawable(0x55bdBB39); ui_theme.itemHighlightedStyle.fgColor = 0xFFFFFFFF; ui_theme.buttonStyle = ui_theme.itemStyle;