mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Some New-UI work (disabled, it's not really ready yet).
This commit is contained in:
parent
3b07090682
commit
bb3c91f8bb
@ -1053,6 +1053,8 @@ set(NativeAppSource
|
||||
android/jni/TestRunner.cpp
|
||||
UI/GameInfoCache.cpp
|
||||
UI/MenuScreens.cpp
|
||||
UI/GameScreen.cpp
|
||||
UI/GameSettingsScreen.cpp
|
||||
UI/GamepadEmu.cpp
|
||||
UI/UIShader.cpp
|
||||
UI/OnScreenDisplay.cpp
|
||||
|
@ -149,6 +149,7 @@ public:
|
||||
lock_guard lock(info_->lock);
|
||||
info_->paramSFO.ReadSFO(sfoData, sfoSize);
|
||||
info_->title = info_->paramSFO.GetValueString("TITLE");
|
||||
info_->paramSFOLoaded = true;
|
||||
}
|
||||
delete [] sfoData;
|
||||
|
||||
@ -192,6 +193,7 @@ public:
|
||||
lock_guard lock(info_->lock);
|
||||
info_->paramSFO.ReadSFO((const u8 *)paramSFOcontents.data(), paramSFOcontents.size());
|
||||
info_->title = info_->paramSFO.GetValueString("TITLE");
|
||||
info_->paramSFOLoaded = true;
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
class GameInfo {
|
||||
public:
|
||||
GameInfo() : fileType(FILETYPE_UNKNOWN), iconTexture(NULL), pic0Texture(NULL), pic1Texture(NULL) {}
|
||||
GameInfo() : fileType(FILETYPE_UNKNOWN), iconTexture(NULL), pic0Texture(NULL), pic1Texture(NULL), paramSFOLoaded(false) {}
|
||||
|
||||
bool DeleteGame(); // Better be sure what you're doing when calling this.
|
||||
bool DeleteAllSaveData();
|
||||
@ -56,6 +56,7 @@ public:
|
||||
std::string title; // for easy access, also available in paramSFO.
|
||||
EmuFileType fileType;
|
||||
ParamSFOData paramSFO;
|
||||
bool paramSFOLoaded;
|
||||
|
||||
// Pre read the data, create a texture the next time (GL thread..)
|
||||
std::string iconTextureData;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -17,4 +17,32 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// Game screen: Contains options such as
|
||||
#include "ui/ui_screen.h"
|
||||
|
||||
// Game screen: Allows you to start a game, delete saves, delete the game,
|
||||
// set game specific settings, etc.
|
||||
// Uses GameInfoCache heavily to implement the functionality.
|
||||
|
||||
class GameScreen : public UIScreen {
|
||||
public:
|
||||
GameScreen(std::string gamePath) : gamePath_(gamePath) {}
|
||||
|
||||
virtual void update(InputState &input);
|
||||
|
||||
protected:
|
||||
virtual void CreateViews();
|
||||
virtual void DrawBackground();
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
UI::EventReturn OnPlay(UI::EventParams &e);
|
||||
UI::EventReturn OnGameSettings(UI::EventParams &e);
|
||||
UI::EventReturn OnDeleteSaveData(UI::EventParams &e);
|
||||
UI::EventReturn OnDeleteGame(UI::EventParams &e);
|
||||
|
||||
std::string gamePath_;
|
||||
|
||||
// As we load metadata in the background, we need to be able to update these after the fact.
|
||||
UI::TextView *tvTitle_;
|
||||
UI::TextView *tvGameSize_;
|
||||
};
|
88
UI/GameSettingsScreen.cpp
Normal file
88
UI/GameSettingsScreen.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
// Copyright (c) 2013- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "gfx_es2/draw_buffer.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "ui/view.h"
|
||||
#include "ui/viewgroup.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
#include "UI/PluginScreen.h"
|
||||
#include "UI/GameSettingsScreen.h"
|
||||
#include "UI/GameInfoCache.h"
|
||||
#include "Core/Config.h"
|
||||
|
||||
void GameSettingsScreen::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;
|
||||
|
||||
I18NCategory *g = GetI18NCategory("General");
|
||||
I18NCategory *gs = GetI18NCategory("Graphics");
|
||||
|
||||
Margins actionMenuMargins(0, 0, 15, 0);
|
||||
|
||||
root_ = new LinearLayout(ORIENT_HORIZONTAL);
|
||||
|
||||
ViewGroup *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f));
|
||||
root_->Add(leftColumn);
|
||||
|
||||
leftColumn->Add(new Spacer(new LinearLayoutParams(1.0)));
|
||||
leftColumn->Add(new Choice("Back"))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
|
||||
TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 200, new LinearLayoutParams(600, FILL_PARENT, actionMenuMargins));
|
||||
root_->Add(tabHolder);
|
||||
|
||||
|
||||
// TODO: These currently point to global settings, not game specific ones.
|
||||
|
||||
ViewGroup *graphicsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
ViewGroup *graphicsSettings = new LinearLayout(ORIENT_VERTICAL);
|
||||
graphicsSettingsScroll->Add(graphicsSettings);
|
||||
tabHolder->AddTab("Graphics", graphicsSettingsScroll);
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bLinearFiltering, gs->T("Linear Filtering")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bBufferedRendering, gs->T("Buffered Rendering")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bDisplayFramebuffer, gs->T("Display Raw Framebuffer")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bUseVBO, gs->T("Stream VBO")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bUseMediaEngine, gs->T("Use Media Engine")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.SSAntiAliasing, gs->T("Anti Aliasing")));
|
||||
|
||||
ViewGroup *audioSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
ViewGroup *audioSettings = new LinearLayout(ORIENT_VERTICAL);
|
||||
audioSettingsScroll->Add(audioSettings);
|
||||
tabHolder->AddTab("Audio", audioSettingsScroll);
|
||||
audioSettings->Add(new CheckBox(&g_Config.bEnableSound, "Enable Sound"));
|
||||
audioSettings->Add(new CheckBox(&g_Config.bEnableAtrac3plus, "Enable Atrac3+"));
|
||||
audioSettings->Add(new Choice("Download Atrac3+ plugin"))->OnClick.Handle(this, &GameSettingsScreen::OnDownloadPlugin);
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnDownloadPlugin(UI::EventParams &e) {
|
||||
screenManager()->push(new PluginScreen());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void DrawBackground(float alpha);
|
||||
|
||||
void GameSettingsScreen::DrawBackground() {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
::DrawBackground(1.0f);
|
||||
}
|
42
UI/GameSettingsScreen.h
Normal file
42
UI/GameSettingsScreen.h
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2013- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui/ui_screen.h"
|
||||
|
||||
|
||||
// Per-game settings screen - enables you to configure graphic options, control options, etc
|
||||
// per game.
|
||||
class GameSettingsScreen : public UIScreen {
|
||||
public:
|
||||
GameSettingsScreen(std::string gamePath, std::string gameID) : gamePath_(gamePath), gameID_(gameID) {}
|
||||
|
||||
protected:
|
||||
virtual void CreateViews();
|
||||
virtual void DrawBackground();
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
UI::EventReturn OnDownloadPlugin(UI::EventParams &e);
|
||||
|
||||
std::string gamePath_, gameID_;
|
||||
|
||||
// As we load metadata in the background, we need to be able to update these after the fact.
|
||||
UI::TextView *tvTitle_;
|
||||
UI::TextView *tvGameSize_;
|
||||
};
|
@ -55,6 +55,7 @@
|
||||
#include "Core/HLE/sceUtility.h"
|
||||
|
||||
#include "UI/MenuScreens.h"
|
||||
#include "UI/GameScreen.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
#include "UI/PluginScreen.h"
|
||||
|
||||
@ -307,12 +308,16 @@ void MenuScreen::render() {
|
||||
}
|
||||
if (UITextureButton(ctx, (int)GEN_ID_LOOP(i), vgrid_recent, textureButtonWidth, textureButtonHeight, ginfo->iconTexture, ALIGN_LEFT, color, I_DROP_SHADOW)) {
|
||||
UIEnd();
|
||||
|
||||
// To try some new UI, enable this.
|
||||
//screenManager()->switchScreen(new GameScreen(g_Config.recentIsos[i]));
|
||||
screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i]));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (UIButton((int)GEN_ID_LOOP(i), vgrid_recent, textureButtonWidth, textureButtonHeight, filename.c_str(), ALIGN_LEFT)) {
|
||||
UIEnd();
|
||||
//screenManager()->switchScreen(new GameScreen(g_Config.recentIsos[i]));
|
||||
screenManager()->switchScreen(new EmuScreen(g_Config.recentIsos[i]));
|
||||
return;
|
||||
}
|
||||
|
@ -392,20 +392,19 @@ void NativeInitGraphics() {
|
||||
ui_theme.checkOn = I_CHECKEDBOX;
|
||||
ui_theme.checkOff = I_SQUARE;
|
||||
ui_theme.whiteImage = SOLIDWHITE;
|
||||
ui_theme.buttonStyle.bgColor = 0xFFFFFFFF;
|
||||
ui_theme.buttonStyle.background = UI::Drawable(UI::DRAW_4GRID, I_BUTTON);
|
||||
ui_theme.buttonStyle.fgColor = 0xFFFFFFFF;
|
||||
ui_theme.buttonStyle.image = I_BUTTON;
|
||||
ui_theme.buttonFocusedStyle.bgColor = 0xFFe0e0e0;
|
||||
ui_theme.buttonFocusedStyle.background = UI::Drawable(UI::DRAW_4GRID, I_BUTTON, 0xFFe0e0e0);
|
||||
ui_theme.buttonFocusedStyle.fgColor = 0xFFFFFFFF;
|
||||
ui_theme.buttonFocusedStyle.image = I_BUTTON_SELECTED;
|
||||
ui_theme.buttonDownStyle.bgColor = 0xFFFFFFFF;
|
||||
ui_theme.buttonDownStyle.background = UI::Drawable(UI::DRAW_4GRID, I_BUTTON_SELECTED, 0xFFFFFFFF);
|
||||
ui_theme.buttonDownStyle.fgColor = 0xFFFFFFFF;
|
||||
ui_theme.buttonDownStyle.image = I_BUTTON_SELECTED;
|
||||
ui_theme.buttonDisabledStyle.bgColor = 0xFF404040;
|
||||
ui_theme.buttonDisabledStyle.background = UI::Drawable(UI::DRAW_4GRID, I_BUTTON, 0xFF404040);
|
||||
ui_theme.buttonDisabledStyle.fgColor = 0xFF707070;
|
||||
ui_theme.buttonDisabledStyle.image = I_BUTTON;
|
||||
ui_theme.itemFocusedStyle.bgColor = 0xFF808080;
|
||||
ui_theme.itemDownStyle.bgColor = 0xFFFFc080;
|
||||
ui_theme.itemStyle.background = UI::Drawable(0x55000000);
|
||||
ui_theme.itemStyle.fgColor = 0xFFFFFFFF;
|
||||
ui_theme.itemFocusedStyle.background = UI::Drawable(0xCC909080);
|
||||
ui_theme.itemDownStyle.background = UI::Drawable(0xFFFFc080);
|
||||
ui_theme.itemDownStyle.fgColor = 0xFF000000;
|
||||
|
||||
ui_draw2d.Init();
|
||||
|
@ -23,6 +23,7 @@
|
||||
<ClCompile Include="GameInfoCache.cpp" />
|
||||
<ClCompile Include="GamepadEmu.cpp" />
|
||||
<ClCompile Include="GameScreen.cpp" />
|
||||
<ClCompile Include="GameSettingsScreen.cpp" />
|
||||
<ClCompile Include="MenuScreens.cpp" />
|
||||
<ClCompile Include="NativeApp.cpp" />
|
||||
<ClCompile Include="OnScreenDisplay.cpp" />
|
||||
@ -35,6 +36,7 @@
|
||||
<ClInclude Include="GameInfoCache.h" />
|
||||
<ClInclude Include="GamepadEmu.h" />
|
||||
<ClInclude Include="GameScreen.h" />
|
||||
<ClInclude Include="GameSettingsScreen.h" />
|
||||
<ClInclude Include="MenuScreens.h" />
|
||||
<ClInclude Include="OnScreenDisplay.h" />
|
||||
<ClInclude Include="PluginScreen.h" />
|
||||
|
@ -19,6 +19,9 @@
|
||||
<ClCompile Include="GameScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GameSettingsScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="GameInfoCache.h" />
|
||||
@ -38,6 +41,9 @@
|
||||
<ClInclude Include="GameScreen.h">
|
||||
<Filter>Screens</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GameSettingsScreen.h">
|
||||
<Filter>Screens</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Screens">
|
||||
|
@ -137,6 +137,8 @@ LOCAL_SRC_FILES := \
|
||||
$(SRC)/UI/GameInfoCache.cpp \
|
||||
$(SRC)/UI/OnScreenDisplay.cpp \
|
||||
$(SRC)/UI/PluginScreen.cpp \
|
||||
$(SRC)/UI/GameScreen.cpp \
|
||||
$(SRC)/UI/GameSettingsScreen.cpp \
|
||||
$(SRC)/native/android/app-android.cpp \
|
||||
$(SRC)/ext/disarm.cpp \
|
||||
$(SRC)/ext/libkirk/AES.c \
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit 8e5890a7e28af03f237eafaaa25e7a10d16899da
|
||||
Subproject commit 166acebeffb5b90efc0e40704943731aedee9969
|
Loading…
Reference in New Issue
Block a user