mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-12 09:38:20 +00:00
Save grid/list status, fix some drawing glitches
This commit is contained in:
parent
e90269a2f0
commit
28e58c3d35
@ -64,6 +64,9 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename)
|
||||
general->Get("MaxRecent", &iMaxRecent, 12);
|
||||
general->Get("ScreenshotsAsPNG", &bScreenshotsAsPNG, false);
|
||||
general->Get("StateSlot", &iCurrentStateSlot, 0);
|
||||
general->Get("GridView1", &bGridView1, true);
|
||||
general->Get("GridView2", &bGridView2, true);
|
||||
general->Get("GridView3", &bGridView3, true);
|
||||
|
||||
// Fix issue from switching from uint (hex in .ini) to int (dec)
|
||||
if (iMaxRecent == 0)
|
||||
@ -239,6 +242,9 @@ void Config::Save()
|
||||
general->Set("EnableCheats", bEnableCheats);
|
||||
general->Set("ScreenshotsAsPNG", bScreenshotsAsPNG);
|
||||
general->Set("StateSlot", iCurrentStateSlot);
|
||||
general->Set("GridView1", bGridView1);
|
||||
general->Set("GridView2", bGridView2);
|
||||
general->Set("GridView3", bGridView3);
|
||||
|
||||
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
|
||||
cpu->Set("Jit", bJit);
|
||||
|
@ -111,6 +111,11 @@ public:
|
||||
bool bShowDebugStats;
|
||||
bool bAccelerometerToAnalogHoriz;
|
||||
|
||||
// The three tabs.
|
||||
bool bGridView1;
|
||||
bool bGridView2;
|
||||
bool bGridView3;
|
||||
|
||||
// Control
|
||||
int iTouchButtonOpacity;
|
||||
float fButtonScale;
|
||||
|
@ -120,7 +120,10 @@ void GameButton::Draw(UIContext &dc) {
|
||||
if (HasFocus())
|
||||
style = down_ ? dc.theme->itemDownStyle : dc.theme->itemFocusedStyle;
|
||||
|
||||
dc.Draw()->Flush();
|
||||
dc.RebindTexture();
|
||||
dc.FillRect(style.background, bounds_);
|
||||
dc.Draw()->Flush();
|
||||
}
|
||||
|
||||
if (texture) {
|
||||
@ -167,16 +170,24 @@ void GameButton::Draw(UIContext &dc) {
|
||||
}
|
||||
dc.Draw()->DrawTexRect(x, y, x+w, y+h, 0, 0, 1, 1, color);
|
||||
dc.Draw()->Flush();
|
||||
dc.RebindTexture();
|
||||
}
|
||||
|
||||
dc.Draw()->Flush();
|
||||
dc.RebindTexture();
|
||||
if (!gridStyle_) {
|
||||
dc.Draw()->DrawText(0, ginfo->title.c_str(), bounds_.x + 150, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
|
||||
} else {
|
||||
dc.Draw()->Flush();
|
||||
dc.PushScissor(bounds_);
|
||||
if (!texture)
|
||||
dc.Draw()->DrawText(0, ginfo->title.c_str(), bounds_.x + 4, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
|
||||
dc.Draw()->DrawText(0, ginfo->title.c_str(), bounds_.x + 150, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
|
||||
dc.Draw()->Flush();
|
||||
dc.PopScissor();
|
||||
} else if (!texture) {
|
||||
dc.Draw()->Flush();
|
||||
dc.PushScissor(bounds_);
|
||||
dc.Draw()->DrawText(0, ginfo->title.c_str(), bounds_.x + 4, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
|
||||
dc.Draw()->Flush();
|
||||
dc.PopScissor();
|
||||
} else {
|
||||
dc.Draw()->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,7 +290,7 @@ void PathBrowser::Navigate(const std::string &path) {
|
||||
|
||||
class GameBrowser : public UI::LinearLayout {
|
||||
public:
|
||||
GameBrowser(std::string path, bool allowBrowsing, std::string lastText, std::string lastLink, UI::LayoutParams *layoutParams = 0);
|
||||
GameBrowser(std::string path, bool allowBrowsing, bool *gridStyle_, std::string lastText, std::string lastLink, UI::LayoutParams *layoutParams = 0);
|
||||
|
||||
UI::Event OnChoice;
|
||||
UI::Event OnHoldChoice;
|
||||
@ -296,21 +307,20 @@ private:
|
||||
|
||||
UI::ViewGroup *gameList_;
|
||||
PathBrowser path_;
|
||||
bool *gridStyle_;
|
||||
bool allowBrowsing_;
|
||||
bool gridStyle_;
|
||||
std::string lastText_;
|
||||
std::string lastLink_;
|
||||
};
|
||||
|
||||
GameBrowser::GameBrowser(std::string path, bool allowBrowsing, std::string lastText, std::string lastLink, UI::LayoutParams *layoutParams)
|
||||
: LinearLayout(UI::ORIENT_VERTICAL, layoutParams), path_(path), allowBrowsing_(allowBrowsing), gameList_(0), lastText_(lastText), lastLink_(lastLink) {
|
||||
GameBrowser::GameBrowser(std::string path, bool allowBrowsing, bool *gridStyle, std::string lastText, std::string lastLink, UI::LayoutParams *layoutParams)
|
||||
: LinearLayout(UI::ORIENT_VERTICAL, layoutParams), path_(path), allowBrowsing_(allowBrowsing), gridStyle_(gridStyle), gameList_(0), lastText_(lastText), lastLink_(lastLink) {
|
||||
using namespace UI;
|
||||
gridStyle_ = true;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
UI::EventReturn GameBrowser::LayoutChange(UI::EventParams &e) {
|
||||
gridStyle_ = e.a == 0 ? true : false;
|
||||
*gridStyle_ = e.a == 0 ? true : false;
|
||||
Refresh();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
@ -340,12 +350,12 @@ void GameBrowser::Refresh() {
|
||||
ChoiceStrip *layoutChoice = topBar->Add(new ChoiceStrip(ORIENT_HORIZONTAL));
|
||||
layoutChoice->AddChoice("Grid");
|
||||
layoutChoice->AddChoice("List");
|
||||
layoutChoice->SetSelection(gridStyle_ ? 0 : 1);
|
||||
layoutChoice->SetSelection(*gridStyle_ ? 0 : 1);
|
||||
layoutChoice->OnChoice.Handle(this, &GameBrowser::LayoutChange);
|
||||
Add(topBar);
|
||||
}
|
||||
|
||||
if (gridStyle_) {
|
||||
if (*gridStyle_) {
|
||||
gameList_ = new UI::GridLayout(UI::GridLayoutSettings(150, 85), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
} else {
|
||||
gameList_ = new UI::LinearLayout(UI::ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
@ -358,7 +368,7 @@ void GameBrowser::Refresh() {
|
||||
|
||||
if (path_.GetPath() == "!RECENT") {
|
||||
for (size_t i = 0; i < g_Config.recentIsos.size(); i++) {
|
||||
gameButtons.push_back(new GameButton(g_Config.recentIsos[i], gridStyle_));
|
||||
gameButtons.push_back(new GameButton(g_Config.recentIsos[i], *gridStyle_));
|
||||
}
|
||||
} else {
|
||||
std::vector<FileInfo> fileInfo;
|
||||
@ -369,7 +379,7 @@ void GameBrowser::Refresh() {
|
||||
if (allowBrowsing_)
|
||||
dirButtons.push_back(new UI::Button(fileInfo[i].name.c_str(), new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)));
|
||||
} else {
|
||||
gameButtons.push_back(new GameButton(fileInfo[i].fullName, gridStyle_, new UI::LinearLayoutParams(gridStyle_ == true ? UI::WRAP_CONTENT : UI::FILL_PARENT, UI::WRAP_CONTENT)));
|
||||
gameButtons.push_back(new GameButton(fileInfo[i].fullName, *gridStyle_, new UI::LinearLayoutParams(*gridStyle_ == true ? UI::WRAP_CONTENT : UI::FILL_PARENT, UI::WRAP_CONTENT)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -441,12 +451,12 @@ void MainScreen::CreateViews() {
|
||||
ScrollView *scrollHomebrew = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
|
||||
GameBrowser *tabRecentGames = new GameBrowser(
|
||||
"!RECENT", false, m->T("How to get games"), "http://www.ppsspp.org/faq.html",
|
||||
"!RECENT", false, &g_Config.bGridView1, m->T("How to get games"), "http://www.ppsspp.org/faq.html",
|
||||
new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
GameBrowser *tabAllGames = new GameBrowser(g_Config.currentDirectory, true,
|
||||
GameBrowser *tabAllGames = new GameBrowser(g_Config.currentDirectory, true, &g_Config.bGridView2,
|
||||
m->T("How to get games"), "http://www.ppsspp.org/faq.html",
|
||||
new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
GameBrowser *tabHomebrew = new GameBrowser(g_Config.memCardDirectory + "PSP/GAME/", false,
|
||||
GameBrowser *tabHomebrew = new GameBrowser(g_Config.memCardDirectory + "PSP/GAME/", false, &g_Config.bGridView3,
|
||||
"", "",
|
||||
new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit 2d6f742694d1de6d58ee99af3707c9592671311b
|
||||
Subproject commit 267f1052611ecf280aad00d1fba650caf3220c24
|
Loading…
x
Reference in New Issue
Block a user