void AnalogTestScreen::CreateViews() { using namespace UI; I18NCategory *di = GetI18NCategory("Dialog"); root_ = new LinearLayout(ORIENT_VERTICAL); LinearLayout *theTwo = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(1.0f)); int axis1, device1, dir1; int axis2, device2, dir2; if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_X_MAX, &device1, &axis1, &dir1)) axis1 = -1; if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_Y_MAX, &device2, &axis2, &dir2)) axis2 = -1; theTwo->Add(new JoystickHistoryView(axis1, device1, dir1, axis2, device2, dir2, new LinearLayoutParams(1.0f))); if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_RIGHT_X_MAX, &device1, &axis1, &dir1)) axis1 = -1; if (!KeyMap::AxisFromPspButton(VIRTKEY_AXIS_RIGHT_Y_MAX, &device2, &axis2, &dir2)) axis2 = -1; theTwo->Add(new JoystickHistoryView(axis1, device1, dir1, axis2, device2, dir2, new LinearLayoutParams(1.0f))); root_->Add(theTwo); lastLastKeyEvent_ = root_->Add(new TextView("-", new LayoutParams(FILL_PARENT, WRAP_CONTENT))); lastLastKeyEvent_->SetTextColor(0x80FFFFFF); // semi-transparent lastKeyEvent_ = root_->Add(new TextView("-", new LayoutParams(FILL_PARENT, WRAP_CONTENT))); root_->Add(new Button(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); }
void CwCheatScreen::CreateViews() { using namespace UI; I18NCategory *k = GetI18NCategory("CwCheats"); I18NCategory *d = GetI18NCategory("Dialog"); CreateCodeList(); g_Config.bReloadCheats = true; root_ = new LinearLayout(ORIENT_HORIZONTAL); Margins actionMenuMargins(50, -15, 15, 0); LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(400, FILL_PARENT)); leftColumn->Add(new ItemHeader(k->T("Options"))); leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); //leftColumn->Add(new Choice(k->T("Add Cheat")))->OnClick.Handle(this, &CwCheatScreen::OnAddCheat); leftColumn->Add(new Choice(k->T("Import Cheats")))->OnClick.Handle(this, &CwCheatScreen::OnImportCheat); #if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) leftColumn->Add(new Choice(k->T("Edit Cheat File")))->OnClick.Handle(this, &CwCheatScreen::OnEditCheatFile); #endif leftColumn->Add(new Choice(k->T("Enable/Disable All")))->OnClick.Handle(this, &CwCheatScreen::OnEnableAll); leftColumn->Add(new PopupSliderChoice(&g_Config.iCwCheatRefreshRate, 1, 1000, k->T("Refresh Rate"), 1, screenManager())); ScrollView *rightScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(0.5f)); rightScroll->SetScrollToTop(false); LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, actionMenuMargins)); LayoutParams *layout = new LayoutParams(500, 50, LP_PLAIN); rightScroll->Add(rightColumn); root_->Add(leftColumn); root_->Add(rightScroll); rightColumn->Add(new ItemHeader(k->T("Cheats"))); for (size_t i = 0; i < formattedList_.size(); i++) { name = formattedList_[i].c_str(); rightColumn->Add(new CheatCheckBox(&bEnableCheat[i], k->T(name), ""))->OnClick.Handle(this, &CwCheatScreen::OnCheckBox); } }
void DevMenu::CreatePopupContents(UI::ViewGroup *parent) { using namespace UI; I18NCategory *dev = GetI18NCategory("Developer"); I18NCategory *sy = GetI18NCategory("System"); ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); LinearLayout *items = new LinearLayout(ORIENT_VERTICAL); #if !defined(MOBILE_DEVICE) items->Add(new Choice(dev->T("Log View")))->OnClick.Handle(this, &DevMenu::OnLogView); #endif items->Add(new Choice(dev->T("Logging Channels")))->OnClick.Handle(this, &DevMenu::OnLogConfig); items->Add(new Choice(sy->T("Developer Tools")))->OnClick.Handle(this, &DevMenu::OnDeveloperTools); items->Add(new Choice(dev->T("Jit Compare")))->OnClick.Handle(this, &DevMenu::OnJitCompare); items->Add(new Choice(dev->T("Shader Viewer")))->OnClick.Handle(this, &DevMenu::OnShaderView); items->Add(new Choice(dev->T("Toggle Freeze")))->OnClick.Handle(this, &DevMenu::OnFreezeFrame); items->Add(new Choice(dev->T("Dump Frame GPU Commands")))->OnClick.Handle(this, &DevMenu::OnDumpFrame); items->Add(new Choice(dev->T("Toggle Audio Debug")))->OnClick.Handle(this, &DevMenu::OnToggleAudioDebug); #ifdef USE_PROFILER items->Add(new CheckBox(&g_Config.bShowFrameProfiler, dev->T("Frame Profiler"), "")); #endif scroll->Add(items); parent->Add(scroll); RingbufferLogListener *ring = LogManager::GetInstance()->GetRingbufferListener(); if (ring) { ring->SetEnabled(true); } }
void GameMenuScene::setupConfigButtons(LinearLayout* parentLayout) { SvgButton* infoButton = new SvgButton("ge_button_information", this); SvgButton* rewardsButton = new SvgButton("ge_button_rewards", this); SvgButton* configButton = new SvgButton("ge_button_config", this); LinearLayout* configButtonLayout = new LinearLayout(Qt::Horizontal); configButtonLayout->addItem(infoButton, 1.0 / 3.0); configButtonLayout->addItem(rewardsButton, 1.0 / 3.0); configButtonLayout->addItem(configButton, 1.0 / 3.0); parentLayout->addLayout( configButtonLayout, 1.0 / 6.0 ); infoButton->setPaddings(0.15, 0.0, 0.15, 0.4); rewardsButton->setPaddings(0.15, 0.2, 0.15, 0.2); configButton->setPaddings(0.15, 0.4, 0.15, 0.0); infoButton->alignCenter(); rewardsButton->alignCenter(); configButton->alignCenter(); connect(infoButton, SIGNAL(pressed()), this, SLOT(infoButtonPressed())); connect(rewardsButton, SIGNAL(pressed()), this, SLOT(rewardsButtonPressed())); connect(configButton, SIGNAL(pressed()), this, SLOT(configButtonPressed())); // ToDo: implement these buttons, disabled meanwhile infoButton->setEnabled(false); rewardsButton->setEnabled(false); configButton->setEnabled(false); }
void GlobalSettingsScreen::CreateViews() { using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL); enableReports_ = g_Config.sReportHost != ""; I18NCategory *g = GetI18NCategory("General"); I18NCategory *gs = GetI18NCategory("Graphics"); LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->Add(new ItemHeader(g->T("General"))); list->Add(new CheckBox(&g_Config.bNewUI, gs->T("Enable New UI"))); list->Add(new CheckBox(&enableReports_, gs->T("Enable Compatibility Server Reports"))); #ifndef ANDROID // Need to move the cheat config dir somewhere where it can be read/written on android list->Add(new CheckBox(&g_Config.bEnableCheats, gs->T("Enable Cheats"))); #endif #ifdef _WIN32 // Screenshot functionality is not yet available on non-Windows list->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, gs->T("Screenshots as PNG"))); #endif // TODO: Come up with a way to display a keyboard for mobile users, // so until then, this is Windows/Desktop only. #ifdef _WIN32 list->Add(new Choice(g->T("Change Nickname")))->OnClick.Handle(this, &GlobalSettingsScreen::OnChangeNickname); #endif list->Add(new Choice(gs->T("System Language")))->OnClick.Handle(this, &GlobalSettingsScreen::OnLanguage); list->Add(new Choice(gs->T("Developer Tools")))->OnClick.Handle(this, &GlobalSettingsScreen::OnDeveloperTools); list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &GlobalSettingsScreen::OnBack); }
void ImportExportFilesScreen::CreateViews() { using namespace UI; root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f)); root_->Add(leftColumn); AddStopServerBack(root_); TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 225, new AnchorLayoutParams(10, 0, 10, 0, false)); root_->Add(tabHolder); ViewGroup *deviceSpecsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *deviceSpecs = new LinearLayout(ORIENT_VERTICAL); deviceSpecs->SetSpacing(0); deviceSpecsScroll->Add(deviceSpecs); tabHolder->AddTab("Information", deviceSpecsScroll); deviceSpecs->Add(new ItemHeader("Web Server")); char const* websiteUrl = WebServiceControl(true); if(websiteUrl == NULL) { deviceSpecs->Add(new InfoItem("Website", "N/A")); deviceSpecs->Add(new InfoItem("Your device needs to be connected to a WiFi network", "")); deviceSpecs->Add(new InfoItem("to continue! Go back and reopen to try again.", "")); } else { deviceSpecs->Add(new InfoItem("Website", websiteUrl)); deviceSpecs->Add(new InfoItem("Visit the URL above on your computer to easily", "")); deviceSpecs->Add(new InfoItem("transfer ROMs and game saves.", "")); } }
GameMenuScene::GameMenuScene(Stage* stage, QGraphicsItem* parent) : Scene(mapSceneName(sceneGameMenu), stage, parent) { setBackground("gm_background"); LinearLayout* leftLayout = new LinearLayout(Qt::Vertical); Actor* gameTitle = new Actor("ge_game_title", this); gameTitle->setPaddings(0.1); leftLayout->addItem(gameTitle, 0.2); LinearLayout* centralLayout = new LinearLayout(Qt::Horizontal); leftLayout->addLayout(centralLayout, 0.8); Actor* robot = new Actor("ge_robot", this); robot->setPaddings(0.2); centralLayout->addItem(robot, 0.5); robot->alignCenter(); centralLayout->addStretch(0.5); LinearLayout* rightLayout = new LinearLayout(Qt::Vertical); setupButtons(rightLayout); LinearLayout* globalLayout = new LinearLayout(Qt::Horizontal); globalLayout->addLayout(leftLayout, 0.7); globalLayout->addLayout(rightLayout, 0.3); setLayout(globalLayout); // This is the last scene loaded QSettings settings; settings.setValue( sk("Application/LastScene"), sceneName ); }
void ControlMappingScreen::CreateViews() { using namespace UI; mappers_.clear(); I18NCategory *k = GetI18NCategory("KeyMapping"); I18NCategory *d = GetI18NCategory("Dialog"); root_ = new LinearLayout(ORIENT_HORIZONTAL); LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT)); leftColumn->Add(new Choice(k->T("Clear All")))->OnClick.Handle(this, &ControlMappingScreen::OnClearMapping); leftColumn->Add(new Choice(k->T("Default All")))->OnClick.Handle(this, &ControlMappingScreen::OnDefaultMapping); if (KeyMap::GetSeenPads().size()) { leftColumn->Add(new Choice(k->T("Autoconfigure")))->OnClick.Handle(this, &ControlMappingScreen::OnAutoConfigure); } leftColumn->Add(new Choice(k->T("Test Analogs")))->OnClick.Handle(this, &ControlMappingScreen::OnTestAnalogs); leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f))); leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); rightScroll_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll_->SetScrollToTop(false); LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll_->Add(rightColumn); root_->Add(leftColumn); root_->Add(rightScroll_); std::vector<KeyMap::KeyMap_IntStrPair> mappableKeys = KeyMap::GetMappableKeys(); for (size_t i = 0; i < mappableKeys.size(); i++) { ControlMapper *mapper = rightColumn->Add(new ControlMapper(this, mappableKeys[i].key, mappableKeys[i].name, screenManager(), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); mappers_.push_back(mapper); } }
void SystemInfoScreen::CreateViews() { // NOTE: Do not translate this section. It will change a lot and will be impossible to keep up. using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT)); LinearLayout *scroll = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); root_->Add(scroll); scroll->Add(new ItemHeader("System Information")); scroll->Add(new InfoItem("System Name :", System_GetName())); scroll->Add(new InfoItem("GPU Vendor :", (char *)glGetString(GL_VENDOR))); scroll->Add(new InfoItem("GPU Model :", (char *)glGetString(GL_RENDERER))); scroll->Add(new ItemHeader("OpenGL ES 2.0 Extensions")); std::vector<std::string> exts; SplitString(g_all_gl_extensions, ' ', exts); for (size_t i = 0; i < exts.size(); i++) { scroll->Add(new TextView(exts[i])); } scroll->Add(new ItemHeader("EGL Extensions")); exts.clear(); SplitString(g_all_egl_extensions, ' ', exts); for (size_t i = 0; i < exts.size(); i++) { scroll->Add(new TextView(exts[i])); } }
void SliderFloatPopupScreen::CreatePopupContents(UI::ViewGroup *parent) { using namespace UI; sliderValue_ = *value_; LinearLayout *lin = parent->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(UI::Margins(10, 5)))); slider_ = new SliderFloat(&sliderValue_, minValue_, maxValue_, new LinearLayoutParams(1.0f)); lin->Add(slider_); lin->Add(new Button(" - "))->OnClick.Handle(this, &SliderFloatPopupScreen::OnDecrease); lin->Add(new Button(" + "))->OnClick.Handle(this, &SliderFloatPopupScreen::OnIncrease); // slider_ = parent->Add(new SliderFloat(&sliderValue_, minValue_, maxValue_, new LinearLayoutParams(UI::Margins(10, 5)))); UI::SetFocusedView(slider_); }
void TextEditPopupScreen::CreatePopupContents(UI::ViewGroup *parent) { using namespace UI; textEditValue_ = *value_; LinearLayout *lin = parent->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams((UI::Size)300, WRAP_CONTENT))); edit_ = new TextEdit(textEditValue_, placeholder_, new LinearLayoutParams(1.0f)); edit_->SetMaxLen(maxLen_); lin->Add(edit_); UI::SetFocusedView(edit_); }
void DeveloperToolsScreen::CreateViews() { using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL); I18NCategory *g = GetI18NCategory("General"); I18NCategory *d = GetI18NCategory("Developer"); LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->Add(new ItemHeader(g->T("General"))); list->Add(new Choice(d->T("Run CPU Tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests); list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &DeveloperToolsScreen::OnBack); }
void GameScreen::CreateViews() { GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE); I18NCategory *d = GetI18NCategory("Dialog"); I18NCategory *ga = GetI18NCategory("Game"); // 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); leftColumn->Add(new Choice(d->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle(this, &GameScreen::OnSwitchBack); if (info) { texvGameIcon_ = leftColumn->Add(new TextureView(0, IS_DEFAULT, new AnchorLayoutParams(144 * 2, 80 * 2, 10, 10, NONE, NONE))); tvTitle_ = leftColumn->Add(new TextView(info->title, ALIGN_LEFT, false, new AnchorLayoutParams(10, 200, NONE, NONE))); // This one doesn't need to be updated. leftColumn->Add(new TextView(gamePath_, ALIGN_LEFT, true, new AnchorLayoutParams(10, 250, NONE, NONE))); tvGameSize_ = leftColumn->Add(new TextView("...", ALIGN_LEFT, true, new AnchorLayoutParams(10, 290, NONE, NONE))); tvSaveDataSize_ = leftColumn->Add(new TextView("...", ALIGN_LEFT, true, new AnchorLayoutParams(10, 320, NONE, NONE))); tvInstallDataSize_ = leftColumn->Add(new TextView("", ALIGN_LEFT, true, new AnchorLayoutParams(10, 350, NONE, NONE))); tvRegion_ = leftColumn->Add(new TextView("", ALIGN_LEFT, true, new AnchorLayoutParams(10, 380, NONE, NONE))); } ViewGroup *rightColumn = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins)); root_->Add(rightColumn); LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL); rightColumnItems->SetSpacing(0.0f); rightColumn->Add(rightColumnItems); Choice *play = new Choice(ga->T("Play")); rightColumnItems->Add(play)->OnClick.Handle(this, &GameScreen::OnPlay); rightColumnItems->Add(new Choice(ga->T("Game Settings")))->OnClick.Handle(this, &GameScreen::OnGameSettings); std::vector<std::string> saveDirs = info->GetSaveDataDirectories(); if (saveDirs.size()) { rightColumnItems->Add(new Choice(ga->T("Delete Save Data")))->OnClick.Handle(this, &GameScreen::OnDeleteSaveData); } rightColumnItems->Add(new Choice(ga->T("Delete Game")))->OnClick.Handle(this, &GameScreen::OnDeleteGame); if (host->CanCreateShortcut()) { rightColumnItems->Add(new Choice(ga->T("Create Shortcut")))->OnClick.Handle(this, &GameScreen::OnCreateShortcut); } if (isRecentGame(gamePath_)) { rightColumnItems->Add(new Choice(ga->T("Remove From Recent")))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent); } #ifdef _WIN32 rightColumnItems->Add(new Choice(ga->T("Show In Folder")))->OnClick.Handle(this, &GameScreen::OnShowInFolder); #endif UI::SetFocusedView(play); }
void CwCheatScreen::CreateViews() { using namespace UI; std::vector<std::string> formattedList; I18NCategory *k = GetI18NCategory("CwCheats"); I18NCategory *d = GetI18NCategory("Dialog"); formattedList = CreateCodeList(); g_Config.bReloadCheats = true; root_ = new LinearLayout(ORIENT_HORIZONTAL); Margins actionMenuMargins(50, -15, 15, 0); LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(400, FILL_PARENT)); leftColumn->Add(new ItemHeader(k->T("Options"))); leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle<CwCheatScreen>(this, &CwCheatScreen::OnBack); //leftColumn->Add(new Choice(k->T("Add Cheat")))->OnClick.Handle<CwCheatScreen>(this, &CwCheatScreen::OnAddCheat); leftColumn->Add(new Choice(k->T("Import Cheats")))->OnClick.Handle<CwCheatScreen>(this, &CwCheatScreen::OnImportCheat); leftColumn->Add(new Choice(k->T("Enable/Disable All")))->OnClick.Handle<CwCheatScreen>(this, &CwCheatScreen::OnEnableAll); ScrollView *rightScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(0.5f)); rightScroll->SetScrollToTop(false); LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, actionMenuMargins)); LayoutParams *layout = new LayoutParams(500, 50, LP_PLAIN); rightScroll->Add(rightColumn); root_->Add(leftColumn); root_->Add(rightScroll); rightColumn->Add(new ItemHeader(k->T("Cheats"))); for (size_t i = 0; i < formattedList.size(); i++) { name = formattedList[i].c_str(); rightColumn->Add(new CheatCheckBox(&bEnableCheat[i], k->T(name), ""))->OnClick.Handle(this, &CwCheatScreen::OnCheckBox); } }
void ShaderViewScreen::CreateViews() { using namespace UI; I18NCategory *di = GetI18NCategory("Dialog"); LinearLayout *layout = new LinearLayout(ORIENT_VERTICAL); root_ = layout; layout->Add(new TextView(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SHORT_DESC))); ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0)); layout->Add(scroll); LinearLayout *lineLayout = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); lineLayout->SetSpacing(0.0); scroll->Add(lineLayout); std::vector<std::string> lines; SplitString(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SOURCE_CODE), '\n', lines); for (auto line : lines) { lineLayout->Add(new TextView(line, FLAG_DYNAMIC_ASCII, true)); } layout->Add(new Button(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); }
void ControlMappingScreen::CreateViews() { using namespace UI; I18NCategory *k = GetI18NCategory("KeyMapping"); I18NCategory *d = GetI18NCategory("Dialog"); root_ = new LinearLayout(ORIENT_HORIZONTAL); LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT)); leftColumn->Add(new Choice(k->T("Clear All")))->OnClick.Handle(this, &ControlMappingScreen::OnClearMapping); leftColumn->Add(new Choice(k->T("Default All")))->OnClick.Handle(this, &ControlMappingScreen::OnDefaultMapping); leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f))); leftColumn->Add(new Choice(d->T("Back")))->OnClick.Handle(this, &ControlMappingScreen::OnBack); /* ChoiceStrip *mode = leftColumn->Add(new ChoiceStrip(ORIENT_VERTICAL)); mode->AddChoice("Replace"); mode->AddChoice("Add"); */ ScrollView *rightScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll->SetScrollToTop(false); LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll->Add(rightColumn); root_->Add(leftColumn); root_->Add(rightScroll); std::vector<KeyMap::KeyMap_IntStrPair> mappableKeys = KeyMap::GetMappableKeys(); for (size_t i = 0; i < mappableKeys.size(); i++) { rightColumn->Add(new ControlMapper(mappableKeys[i].key, mappableKeys[i].name, screenManager(), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); } }
void GlobalSettingsScreen::CreateViews() { using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL); enableReports_ = g_Config.sReportHost != ""; 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("Enable New UI"))); list->Add(new CheckBox(&enableReports_, gs->T("Enable Error Reporting"))); list->Add(new CheckBox(&g_Config.bEnableCheats, gs->T("Enable Cheats"))); list->Add(new CheckBox(&g_Config.bScreenshotsAsPNG, gs->T("Screenshots as PNG"))); list->Add(new Choice(gs->T("Control Mapping")))->OnClick.Handle(this, &GlobalSettingsScreen::OnControlMapping); list->Add(new Choice(gs->T("System Language")))->OnClick.Handle(this, &GlobalSettingsScreen::OnLanguage); list->Add(new Choice(gs->T("Developer Tools")))->OnClick.Handle(this, &GlobalSettingsScreen::OnDeveloperTools); list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &GlobalSettingsScreen::OnBack); }
void ShaderListScreen::CreateViews() { using namespace UI; I18NCategory *di = GetI18NCategory("Dialog"); LinearLayout *layout = new LinearLayout(ORIENT_VERTICAL); root_ = layout; tabs_ = new TabHolder(ORIENT_HORIZONTAL, 40, new LinearLayoutParams(1.0)); layout->Add(tabs_); layout->Add(new Button(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); for (size_t i = 0; i < ARRAY_SIZE(shaderTypes); i++) { ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0)); LinearLayout *shaderList = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); ListShaders(shaderTypes[i].type, shaderList); scroll->Add(shaderList); tabs_->AddTab(shaderTypes[i].name, scroll); } }
void PluginScreen::CreateViews() { I18NCategory *p = GetI18NCategory("Plugin"); // Build the UI. using namespace UI; root_ = new LinearLayout(ORIENT_VERTICAL); Margins textMargins(20,17); Margins buttonMargins(10,10); root_->Add(new TextView(UBUNTU24, p->T("Atrac3+ Audio Support"), ALIGN_HCENTER, 1.5f, new LinearLayoutParams(textMargins))); ViewGroup *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0)); LinearLayout *scrollContents = new LinearLayout(ORIENT_VERTICAL); root_->Add(scroll); scroll->Add(scrollContents); tvDescription_ = scrollContents->Add(new TextView(0, "Looking for download...", ALIGN_LEFT, 1.0f, new LinearLayoutParams(textMargins))); const char *legalityNotice = p->T("Origins are dubious", "* Mai's Atrac3+ decoder is currently required\n" "for background audio and voice in many games.\n" "Please note that the origins of this code are dubious.\n" "Choose More Information for more information."); scrollContents->Add(new TextView(0, legalityNotice, ALIGN_LEFT, 0.65f, new LinearLayoutParams(textMargins) )); progress_ = root_->Add(new ProgressBar()); progress_->SetVisibility(V_GONE); ViewGroup *buttonBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(buttonMargins)); root_->Add(buttonBar); buttonBack_ = new Button(p->T("Back"), new LinearLayoutParams(1.0)); buttonBar->Add(buttonBack_)->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); buttonDownload_ = new Button(p->T("Download and install"), new LinearLayoutParams(1.0)); buttonDownload_->SetEnabled(false); buttonBar->Add(buttonDownload_)->OnClick.Handle(this, &PluginScreen::OnDownload); buttonBar->Add(new Button(p->T("More Information"), new LinearLayoutParams(1.0)))->OnClick.Handle(this, &PluginScreen::OnInformation); }
PauseDialog::PauseDialog() { LinearLayout* layout = new LinearLayout(LinearLayout::Direction::Vertical, this); Button* buttonContinue = new Button("Continue"); buttonContinue->resize(BUTTON_WINDTH, BUTTON_HEIGHT); buttonContinue->clicked.connect([&]() { this->close(); }); layout->appendChild(buttonContinue); Button* buttonSave = new Button("Save game"); buttonSave->resize(BUTTON_WINDTH, BUTTON_HEIGHT); buttonSave->clicked.connect([&]() { this->close(); World::save(); }); layout->appendChild(buttonSave); Button* buttonLoad = new Button("Load game"); buttonLoad->resize(BUTTON_WINDTH, BUTTON_HEIGHT); buttonLoad->clicked.connect([&]() { this->close(); Window::get()->pushScreen(std::make_shared<LoadWorldScreen>()); }); layout->appendChild(buttonLoad); Button* buttonSettings = new Button("Settings"); buttonSettings->resize(BUTTON_WINDTH, BUTTON_HEIGHT); buttonSettings->clicked.connect([&]() { this->close(); Window::get()->pushScreen(std::make_shared<SettingsScreen>()); }); layout->appendChild(buttonSettings); Button* buttonMenu = new Button("Menu"); buttonMenu->resize(BUTTON_WINDTH, BUTTON_HEIGHT); buttonMenu->clicked.connect([&]() { this->close(); Window::get()->pushScreen(std::make_shared<MenuScreen>()); }); layout->appendChild(buttonMenu); Button* buttonExit = new Button("Exit"); buttonExit->resize(BUTTON_WINDTH, BUTTON_HEIGHT); buttonExit->clicked.connect([&]() { Game::quit(); }); layout->appendChild(buttonExit); resizeToContent(); Window::get()->getCurrentScreen()->pause(); }
void ControlMapper::Refresh() { Clear(); using namespace UI; LinearLayout *root = Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); root->Add(new Choice(keyName_, new LinearLayoutParams(200, WRAP_CONTENT)))->OnClick.Handle(this, &ControlMapper::OnReplaceAll); LinearLayout *rightColumn = root->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); std::vector<KeyDef> mappings; KeyMap::KeyFromPspButton(pspKey_, &mappings); for (size_t i = 0; i < mappings.size(); i++) { std::string deviceName = GetDeviceName(mappings[i].deviceId); std::string keyName = KeyMap::GetKeyOrAxisName(mappings[i].keyCode); int image = -1; LinearLayout *row = rightColumn->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); Choice *c = row->Add(new Choice(deviceName + "." + keyName, new LinearLayoutParams(1.0f))); char tagbuf[16]; sprintf(tagbuf, "%i", i); c->SetTag(tagbuf); c->OnClick.Handle(this, &ControlMapper::OnReplace); Choice *d = row->Add(new Choice("X")); d->SetTag(tagbuf); d->OnClick.Handle(this, &ControlMapper::OnDelete); row->Add(new Choice("+"))->OnClick.Handle(this, &ControlMapper::OnAdd); } if (mappings.size() == 0) { // look like an empty line rightColumn->Add(new Choice("", new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)))->OnClick.Handle(this, &ControlMapper::OnAdd); } }
EventReturn RatingChoice::OnChoiceClick(EventParams &e) { // Unstick the other choices that weren't clicked. int total = TotalChoices(); for (int i = 0; i < total; i++) { auto v = group_->GetViewByIndex(i); if (v != e.v) { static_cast<StickyChoice *>(v)->Release(); } else { *value_ = i; } } EventParams e2; e2.v = e.v; e2.a = *value_; // Dispatch immediately (we're already on the UI thread as we're in an event handler). OnChoice.Dispatch(e2); return EVENT_DONE; }
void LogScreen::CreateViews() { using namespace UI; I18NCategory *di = GetI18NCategory("Dialog"); LinearLayout *outer = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); root_ = outer; scroll_ = outer->Add(new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0))); LinearLayout *bottom = outer->Add(new LinearLayout(ORIENT_HORIZONTAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT))); bottom->Add(new Button(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack); cmdLine_ = bottom->Add(new TextEdit("", "Command Line", new LinearLayoutParams(1.0))); cmdLine_->OnEnter.Handle(this, &LogScreen::OnSubmit); bottom->Add(new Button(di->T("Submit")))->OnClick.Handle(this, &LogScreen::OnSubmit); vert_ = scroll_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); vert_->SetSpacing(0); UpdateLog(); }
void GlobalSettingsScreen::CreateViews() { using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL); enableReports_ = g_Config.sReportHost != ""; 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"))); list->Add(new CheckBox(&enableReports_, gs->T("Enable error reporting"))); static const char *fpsChoices[] = { "None", "Speed", "FPS", "Both" }; list->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS"), fpsChoices, 0, 4, gs, screenManager())); list->Add(new Choice(gs->T("Language")))->OnClick.Handle(this, &GlobalSettingsScreen::OnLanguage); list->Add(new Choice(gs->T("Developer Tools")))->OnClick.Handle(this, &GlobalSettingsScreen::OnDeveloperTools); list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &GlobalSettingsScreen::OnBack); }
void ControlMappingScreen::CreateViews() { using namespace UI; mappers_.clear(); I18NCategory *km = GetI18NCategory("KeyMapping"); root_ = new LinearLayout(ORIENT_HORIZONTAL); LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, Margins(10, 0, 0, 10))); leftColumn->Add(new Choice(km->T("Clear All")))->OnClick.Handle(this, &ControlMappingScreen::OnClearMapping); leftColumn->Add(new Choice(km->T("Default All")))->OnClick.Handle(this, &ControlMappingScreen::OnDefaultMapping); std::string sysName = System_GetProperty(SYSPROP_NAME); // If there's a builtin controller, restore to default should suffice. No need to conf the controller on top. if (!KeyMap::HasBuiltinController(sysName) && KeyMap::GetSeenPads().size()) { leftColumn->Add(new Choice(km->T("Autoconfigure")))->OnClick.Handle(this, &ControlMappingScreen::OnAutoConfigure); } leftColumn->Add(new Choice(km->T("Test Analogs")))->OnClick.Handle(this, &ControlMappingScreen::OnTestAnalogs); leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f))); AddStandardBack(leftColumn); rightScroll_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll_->SetTag("ControlMapping"); rightScroll_->SetScrollToTop(false); LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)); rightScroll_->Add(rightColumn); root_->Add(leftColumn); root_->Add(rightScroll_); std::vector<KeyMap::KeyMap_IntStrPair> mappableKeys = KeyMap::GetMappableKeys(); for (size_t i = 0; i < mappableKeys.size(); i++) { ControlMapper *mapper = rightColumn->Add(new ControlMapper(this, mappableKeys[i].key, mappableKeys[i].name, screenManager(), new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); mappers_.push_back(mapper); } }
void PopupScreen::CreateViews() { using namespace UI; UIContext &dc = *screenManager()->getUIContext(); AnchorLayout *anchor = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); anchor->Overflow(false); root_ = anchor; float yres = screenManager()->getUIContext()->GetBounds().h; box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(550, FillVertical() ? yres - 30 : WRAP_CONTENT, dc.GetBounds().centerX(), dc.GetBounds().centerY(), NONE, NONE, true)); root_->Add(box_); box_->SetBG(UI::Drawable(0xFF303030)); box_->SetHasDropShadow(true); View *title = new PopupHeader(title_); box_->Add(title); CreatePopupContents(box_); root_->SetDefaultFocusView(box_); if (ShowButtons() && !button1_.empty()) { // And the two buttons at the bottom. LinearLayout *buttonRow = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(200, WRAP_CONTENT)); buttonRow->SetSpacing(0); Margins buttonMargins(5, 5); // Adjust button order to the platform default. #if defined(_WIN32) defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f, buttonMargins))); defaultButton_->OnClick.Handle(this, &PopupScreen::OnOK); if (!button2_.empty()) buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Handle(this, &PopupScreen::OnCancel); #else if (!button2_.empty()) buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f)))->OnClick.Handle(this, &PopupScreen::OnCancel); defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f))); defaultButton_->OnClick.Handle(this, &PopupScreen::OnOK); #endif box_->Add(buttonRow); } }
void DeveloperToolsScreen::CreateViews() { using namespace UI; root_ = new ScrollView(ORIENT_VERTICAL); enableLogging_ = g_Config.bEnableLogging; I18NCategory *g = GetI18NCategory("General"); I18NCategory *d = GetI18NCategory("Developer"); I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *a = GetI18NCategory("Audio"); LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); list->Add(new ItemHeader(g->T("General"))); list->Add(new Choice(g->T("System Information")))->OnClick.Handle(this, &DeveloperToolsScreen::OnSysInfo); list->Add(new Choice(d->T("Run CPU Tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests); #ifndef __SYMBIAN32__ list->Add(new CheckBox(&g_Config.bSoftwareRendering, gs->T("Software Rendering", "Software Rendering (experimental)"))); #endif list->Add(new CheckBox(&enableLogging_, d->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged); list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &DeveloperToolsScreen::OnBack); }
void SliderPopupScreen::CreatePopupContents(UI::ViewGroup *parent) { using namespace UI; sliderValue_ = *value_; LinearLayout *vert = parent->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(UI::Margins(10, 10)))); slider_ = new Slider(&sliderValue_, minValue_, maxValue_, new LinearLayoutParams(UI::Margins(10, 10))); slider_->OnChange.Handle(this, &SliderPopupScreen::OnSliderChange); vert->Add(slider_); LinearLayout *lin = vert->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(UI::Margins(10, 10)))); lin->Add(new Button(" - "))->OnClick.Handle(this, &SliderPopupScreen::OnDecrease); lin->Add(new Button(" + "))->OnClick.Handle(this, &SliderPopupScreen::OnIncrease); char temp[64]; sprintf(temp, "%d", sliderValue_); edit_ = new TextEdit(temp, "", new LinearLayoutParams(10.0f)); edit_->SetMaxLen(16); edit_->OnTextChange.Handle(this, &SliderPopupScreen::OnTextChange); changing_ = false; lin->Add(edit_); if (!units_.empty()) lin->Add(new TextView(units_, new LinearLayoutParams(10.0f))); if (IsFocusMovementEnabled()) UI::SetFocusedView(slider_); }
SaveSlotView::SaveSlotView(const std::string &gameFilename, int slot, UI::LayoutParams *layoutParams) : UI::LinearLayout(UI::ORIENT_HORIZONTAL, layoutParams), slot_(slot), gamePath_(gameFilename) { using namespace UI; screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, SaveState::SCREENSHOT_EXTENSION); PrioritizedWorkQueue *wq = g_gameInfoCache->WorkQueue(); Add(new Spacer(5)); AsyncImageFileView *fv = Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, wq, new UI::LayoutParams(82 * 2, 47 * 2))); fv->SetOverlayText(StringFromFormat("%d", slot_ + 1)); I18NCategory *pa = GetI18NCategory("Pause"); LinearLayout *buttons = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)); buttons->SetSpacing(2.0); Add(buttons); saveStateButton_ = buttons->Add(new Button(pa->T("Save State"), new LinearLayoutParams(0.0, G_VCENTER))); saveStateButton_->OnClick.Handle(this, &SaveSlotView::OnSaveState); fv->OnClick.Handle(this, &SaveSlotView::OnScreenshotClick); if (SaveState::HasSaveInSlot(gamePath_, slot)) { loadStateButton_ = buttons->Add(new Button(pa->T("Load State"), new LinearLayoutParams(0.0, G_VCENTER))); loadStateButton_->OnClick.Handle(this, &SaveSlotView::OnLoadState); std::string dateStr = SaveState::GetSlotDateAsString(gamePath_, slot_); std::vector<std::string> dateStrs; SplitString(dateStr, ' ', dateStrs); if (!dateStrs.empty() && !dateStrs[0].empty()) { LinearLayout *strs = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)); Add(strs); for (size_t i = 0; i < dateStrs.size(); i++) { strs->Add(new TextView(dateStrs[i], new LinearLayoutParams(0.0, G_VCENTER)))->SetShadow(true); } } } else { fv->SetFilename(""); } }
void PopupScreen::CreateViews() { using namespace UI; root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(550, FillVertical() ? dp_yres - 30 : WRAP_CONTENT, dp_xres / 2, dp_yres / 2, NONE, NONE, true)); root_->Add(box_); box_->SetBG(UI::Drawable(0xFF303030)); box_->SetHasDropShadow(true); View *title = new PopupHeader(title_); box_->Add(title); CreatePopupContents(box_); if (ShowButtons() && !button1_.empty()) { // And the two buttons at the bottom. LinearLayout *buttonRow = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(200, WRAP_CONTENT)); buttonRow->SetSpacing(0); Margins buttonMargins(5, 5); // Adjust button order to the platform default. #if defined(_WIN32) buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Handle(this, &PopupScreen::OnOK); if (!button2_.empty()) buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Handle(this, &PopupScreen::OnCancel); #else if (!button2_.empty()) buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f)))->OnClick.Handle(this, &PopupScreen::OnCancel); buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f)))->OnClick.Handle(this, &PopupScreen::OnOK); #endif box_->Add(buttonRow); } }