Some New-UI work (disabled, it's not really ready yet).
This commit is contained in:
parent
3b07090682
commit
bb3c91f8bb
13 changed files with 277 additions and 13 deletions
|
@ -15,4 +15,91 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "UI/GameScreen.h"
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "ui/view.h"
|
||||
#include "ui/viewgroup.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
#include "UI/GameScreen.h"
|
||||
#include "UI/GameSettingsScreen.h"
|
||||
#include "UI/GameInfoCache.h"
|
||||
|
||||
void GameScreen::CreateViews() {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
|
||||
// Information in the top left.
|
||||
// Back button to the bottom left.
|
||||
// Scrolling action menu to the right.
|
||||
using namespace UI;
|
||||
|
||||
Margins actionMenuMargins(0, 100, 15, 0);
|
||||
|
||||
root_ = new LinearLayout(ORIENT_HORIZONTAL);
|
||||
|
||||
ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f));
|
||||
root_->Add(leftColumn);
|
||||
|
||||
if (info) {
|
||||
tvTitle_ = leftColumn->Add(new TextView(0, info->title, ALIGN_LEFT, 1.0f, new AnchorLayoutParams(10, 10, NONE, NONE)));
|
||||
}
|
||||
|
||||
ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
|
||||
root_->Add(rightColumn);
|
||||
|
||||
ViewGroup *rightColumnItems = new LinearLayout(ORIENT_VERTICAL);
|
||||
rightColumn->Add(rightColumnItems);
|
||||
rightColumnItems->Add(new Choice("Play"))->OnClick.Handle(this, &GameScreen::OnPlay);
|
||||
rightColumnItems->Add(new Choice("Game Settings"))->OnClick.Handle(this, &GameScreen::OnGameSettings);
|
||||
rightColumnItems->Add(new Choice("Delete Save Data"))->OnClick.Handle(this, &GameScreen::OnDeleteSaveData);
|
||||
rightColumnItems->Add(new Choice("Delete Game"))->OnClick.Handle(this, &GameScreen::OnDeleteGame);
|
||||
}
|
||||
|
||||
void DrawBackground(float alpha);
|
||||
|
||||
void GameScreen::DrawBackground() {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
::DrawBackground(1.0f);
|
||||
}
|
||||
|
||||
void GameScreen::update(InputState &input) {
|
||||
UIScreen::update(input);
|
||||
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
if (tvTitle_)
|
||||
tvTitle_->SetText(info->title);
|
||||
}
|
||||
|
||||
UI::EventReturn GameScreen::OnPlay(UI::EventParams &e) {
|
||||
screenManager()->switchScreen(new EmuScreen(gamePath_));
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameScreen::OnGameSettings(UI::EventParams &e) {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
if (info && info->paramSFOLoaded) {
|
||||
std::string discID = info->paramSFO.GetValueString("DISC_ID");
|
||||
screenManager()->push(new GameSettingsScreen(gamePath_, discID));
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameScreen::OnDeleteSaveData(UI::EventParams &e) {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
if (info) {
|
||||
// VERY DANGEROUS, must add confirmation dialog before enabling.
|
||||
// info->DeleteAllSaveData();
|
||||
}
|
||||
|
||||
RecreateViews();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameScreen::OnDeleteGame(UI::EventParams &e) {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
if (info) {
|
||||
// VERY DANGEROUS
|
||||
// info->DeleteGame();
|
||||
}
|
||||
|
||||
RecreateViews();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue