Lots of NewUI stuff (still experimental), fix back bug with x360 controllers
This commit is contained in:
parent
a3edda0bc7
commit
28ad8dc230
10 changed files with 190 additions and 23 deletions
|
@ -19,12 +19,73 @@
|
|||
#include "i18n/i18n.h"
|
||||
#include "ui/view.h"
|
||||
#include "ui/viewgroup.h"
|
||||
#include "ui/ui_context.h"
|
||||
#include "UI/EmuScreen.h"
|
||||
#include "UI/PluginScreen.h"
|
||||
#include "UI/GameSettingsScreen.h"
|
||||
#include "UI/GameInfoCache.h"
|
||||
#include "UI/MiscScreens.h"
|
||||
#include "Core/Config.h"
|
||||
|
||||
namespace UI {
|
||||
|
||||
// Reads and writes value to determine the current selection.
|
||||
class PopupMultiChoice : public Choice {
|
||||
public:
|
||||
PopupMultiChoice(int *value, const std::string &text, const char **choices, int numChoices,
|
||||
I18NCategory *category, ScreenManager *screenManager, LayoutParams *layoutParams = 0)
|
||||
: Choice(text, "", false, layoutParams), value_(value), choices_(choices), numChoices_(numChoices),
|
||||
category_(category), screenManager_(screenManager) {
|
||||
OnClick.Handle(this, &PopupMultiChoice::HandleClick);
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
virtual void Draw(UIContext &dc);
|
||||
|
||||
private:
|
||||
void UpdateText();
|
||||
EventReturn HandleClick(EventParams &e);
|
||||
|
||||
void ChoiceCallback(int num);
|
||||
|
||||
const char **choices_;
|
||||
int numChoices_;
|
||||
int *value_;
|
||||
ScreenManager *screenManager_;
|
||||
I18NCategory *category_;
|
||||
std::string valueText_;
|
||||
};
|
||||
|
||||
EventReturn PopupMultiChoice::HandleClick(EventParams &e) {
|
||||
std::vector<std::string> choices;
|
||||
for (size_t i = 0; i < numChoices_; i++) {
|
||||
choices.push_back(category_ ? category_->T(choices_[i]) : choices_[i]);
|
||||
}
|
||||
|
||||
Screen *popupScreen = new ListPopupScreen(text_, choices, *value_,
|
||||
std::bind(&PopupMultiChoice::ChoiceCallback, this, placeholder::_1));
|
||||
screenManager_->push(popupScreen);
|
||||
return EVENT_DONE;
|
||||
}
|
||||
|
||||
void PopupMultiChoice::UpdateText() {
|
||||
valueText_ = category_ ? category_->T(choices_[*value_]) : choices_[*value_];
|
||||
}
|
||||
|
||||
void PopupMultiChoice::ChoiceCallback(int num) {
|
||||
*value_ = num;
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
void PopupMultiChoice::Draw(UIContext &dc) {
|
||||
Choice::Draw(dc);
|
||||
dc.Draw()->DrawText(dc.theme->uiFont, valueText_.c_str(), bounds_.x2() - 8, bounds_.centerY(), 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_VCENTER);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GameSettingsScreen::CreateViews() {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
|
||||
|
@ -58,6 +119,7 @@ void GameSettingsScreen::CreateViews() {
|
|||
ViewGroup *graphicsSettings = new LinearLayout(ORIENT_VERTICAL);
|
||||
graphicsSettingsScroll->Add(graphicsSettings);
|
||||
tabHolder->AddTab("Graphics", graphicsSettingsScroll);
|
||||
graphicsSettings->Add(new ItemHeader(gs->T("Features")));
|
||||
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")));
|
||||
|
@ -65,15 +127,47 @@ void GameSettingsScreen::CreateViews() {
|
|||
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.SSAntiAliasing, gs->T("Anti Aliasing")));
|
||||
// graphicsSettings->Add(new CheckBox(&g_Config.iShowFPSCounter, gs->T("Show FPS")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bFramebuffersToMem, gs->T("Read Framebuffer to memory")));
|
||||
graphicsSettings->Add(new ItemHeader(gs->T("Texture filtering")));
|
||||
|
||||
static const char *anisoLevels[] = {
|
||||
"Off", "2 samples", "4 samples", "8 samples", "16 samples"
|
||||
};
|
||||
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iAnisotropyLevel, gs->T("Anisotropic Filtering"), anisoLevels, 5, gs, screenManager()));
|
||||
|
||||
graphicsSettings->Add(new ItemHeader(gs->T("Texture scaling")));
|
||||
|
||||
static const char *texScaleLevels[] = {
|
||||
"bad", "1x", "2x", "3x",
|
||||
#ifndef USING_GLES2
|
||||
"4x", "5x",
|
||||
#endif
|
||||
};
|
||||
//graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingLevel, gs->T("Scale"), anisoLevels, 5, gs, screenManager()));
|
||||
|
||||
static const char *texScaleAlgos[] = {
|
||||
"xBRZ", "Hybrid", "Bicubic", "Hybrid + Bicubic",
|
||||
};
|
||||
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingType, gs->T("Texture Scaling Type"), texScaleAlgos, 4, gs, screenManager()));
|
||||
|
||||
|
||||
|
||||
#ifdef USING_GLES2
|
||||
g_Config.bFramebuffersCPUConvert = g_Config.bFramebuffersToMem;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bAutoSaveSymbolMap, gs->T("VSync")));
|
||||
#endif
|
||||
|
||||
|
||||
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 Choice(a->T("Download Atrac3+ plugin")))->OnClick.Handle(this, &GameSettingsScreen::OnDownloadPlugin);
|
||||
audioSettings->Add(new CheckBox(&g_Config.bEnableSound, a->T("Enable Sound")));
|
||||
audioSettings->Add(new CheckBox(&g_Config.bEnableAtrac3plus, a->T("Enable Atrac3+")));
|
||||
audioSettings->Add(new Choice(a->T("Download Atrac3+ plugin")))->OnClick.Handle(this, &GameSettingsScreen::OnDownloadPlugin);
|
||||
|
||||
ViewGroup *controlsSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
ViewGroup *controlsSettings = new LinearLayout(ORIENT_VERTICAL);
|
||||
|
@ -100,6 +194,45 @@ UI::EventReturn GameSettingsScreen::OnDownloadPlugin(UI::EventParams &e) {
|
|||
void DrawBackground(float alpha);
|
||||
|
||||
void GameSettingsScreen::DrawBackground(UIContext &dc) {
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
|
||||
::DrawBackground(1.0f);
|
||||
}
|
||||
|
||||
void GlobalSettingsScreen::CreateViews() {
|
||||
using namespace UI;
|
||||
root_ = new ScrollView(ORIENT_VERTICAL);
|
||||
|
||||
I18NCategory *g = GetI18NCategory("General");
|
||||
I18NCategory *gs = GetI18NCategory("Graphics");
|
||||
|
||||
LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
|
||||
list->Add(new ItemHeader("General"));
|
||||
list->Add(new CheckBox(&g_Config.bNewUI, gs->T("New UI")));
|
||||
|
||||
static const char *fpsChoices[] = {
|
||||
"None", "Speed", "FPS", "Both"
|
||||
};
|
||||
|
||||
list->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS"), fpsChoices, 4, gs, screenManager()));
|
||||
list->Add(new Choice(gs->T("Language")))->OnClick.Handle(this, &GlobalSettingsScreen::OnLanguage);
|
||||
|
||||
list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &GlobalSettingsScreen::OnBack);
|
||||
}
|
||||
|
||||
UI::EventReturn GlobalSettingsScreen::OnFactoryReset(UI::EventParams &e) {
|
||||
screenManager()->push(new PluginScreen());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GlobalSettingsScreen::OnLanguage(UI::EventParams &e) {
|
||||
screenManager()->push(new NewLanguageScreen());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GlobalSettingsScreen::OnBack(UI::EventParams &e) {
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void GlobalSettingsScreen::DrawBackground(UIContext &dc) {
|
||||
::DrawBackground(1.0f);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue