CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/UI/MiscScreens.h
Views: 1401
// Copyright (c) 2013- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#pragma once1819#include <functional>20#include <map>21#include <string>22#include <vector>2324#include "Common/UI/UIScreen.h"25#include "Common/UI/PopupScreens.h"26#include "Common/File/DirListing.h"27#include "Common/File/Path.h"2829struct ShaderInfo;30struct TextureShaderInfo;3132extern Path boot_filename;33void UIBackgroundInit(UIContext &dc);34void UIBackgroundShutdown();3536inline void NoOpVoidBool(bool) {}3738class BackgroundScreen : public UIScreen {39public:40ScreenRenderFlags render(ScreenRenderMode mode) override;41void sendMessage(UIMessage message, const char *value) override;4243private:44void CreateViews() override {}45const char *tag() const override { return "bg"; }4647Path gamePath_;48};4950// This doesn't have anything to do with the background anymore. It's just a PPSSPP UIScreen51// that knows how handle sendMessage properly. Same for all the below.52class UIScreenWithBackground : public UIScreen {53public:54UIScreenWithBackground() : UIScreen() {}55protected:56void sendMessage(UIMessage message, const char *value) override;57};5859class UIScreenWithGameBackground : public UIScreenWithBackground {60public:61UIScreenWithGameBackground(const Path &gamePath) : UIScreenWithBackground(), gamePath_(gamePath) {}62void sendMessage(UIMessage message, const char *value) override;63protected:64Path gamePath_;6566bool forceTransparent_ = false;67bool darkenGameBackground_ = true;68};6970class UIDialogScreenWithBackground : public UIDialogScreen {71public:72UIDialogScreenWithBackground() : UIDialogScreen() {}73protected:74void sendMessage(UIMessage message, const char *value) override;75void AddStandardBack(UI::ViewGroup *parent);76};7778class UIDialogScreenWithGameBackground : public UIDialogScreenWithBackground {79public:80UIDialogScreenWithGameBackground(const Path &gamePath)81: UIDialogScreenWithBackground(), gamePath_(gamePath) {}82void sendMessage(UIMessage message, const char *value) override;83protected:84Path gamePath_;85};8687class PromptScreen : public UIDialogScreenWithGameBackground {88public:89PromptScreen(const Path& gamePath, std::string_view message, std::string_view yesButtonText, std::string_view noButtonText,90std::function<void(bool)> callback = &NoOpVoidBool);9192void CreateViews() override;9394void TriggerFinish(DialogResult result) override;9596const char *tag() const override { return "Prompt"; }9798private:99UI::EventReturn OnYes(UI::EventParams &e);100UI::EventReturn OnNo(UI::EventParams &e);101102std::string message_;103std::string yesButtonText_;104std::string noButtonText_;105std::function<void(bool)> callback_;106};107108class NewLanguageScreen : public UI::ListPopupScreen {109public:110NewLanguageScreen(std::string_view title);111112const char *tag() const override { return "NewLanguage"; }113114private:115void OnCompleted(DialogResult result) override;116bool ShowButtons() const override { return true; }117std::vector<File::FileInfo> langs_;118};119120class TextureShaderScreen : public UI::ListPopupScreen {121public:122TextureShaderScreen(std::string_view title);123124void CreateViews() override;125126const char *tag() const override { return "TextureShader"; }127128private:129void OnCompleted(DialogResult result) override;130bool ShowButtons() const override { return true; }131std::vector<TextureShaderInfo> shaders_;132};133134enum class AfterLogoScreen {135TO_GAME_SETTINGS,136DEFAULT,137MEMSTICK_SCREEN_INITIAL_SETUP,138};139140class LogoScreen : public UIScreen {141public:142LogoScreen(AfterLogoScreen afterLogoScreen = AfterLogoScreen::DEFAULT);143144bool key(const KeyInput &key) override;145void touch(const TouchInput &touch) override;146void update() override;147void DrawForeground(UIContext &ui) override;148void sendMessage(UIMessage message, const char *value) override;149void CreateViews() override {}150151const char *tag() const override { return "Logo"; }152153private:154void Next();155int frames_ = 0;156double sinceStart_ = 0.0;157bool switched_ = false;158AfterLogoScreen afterLogoScreen_;159};160161class CreditsScreen : public UIDialogScreenWithBackground {162public:163CreditsScreen();164void update() override;165void DrawForeground(UIContext &ui) override;166167void CreateViews() override;168169const char *tag() const override { return "Credits"; }170171private:172UI::EventReturn OnSupport(UI::EventParams &e);173UI::EventReturn OnPPSSPPOrg(UI::EventParams &e);174UI::EventReturn OnPrivacy(UI::EventParams &e);175UI::EventReturn OnForums(UI::EventParams &e);176UI::EventReturn OnDiscord(UI::EventParams &e);177UI::EventReturn OnShare(UI::EventParams &e);178UI::EventReturn OnTwitter(UI::EventParams &e);179180double startTime_ = 0.0;181};182183class SettingInfoMessage : public UI::LinearLayout {184public:185SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp);186187void Show(std::string_view text, const UI::View *refView = nullptr);188189void Draw(UIContext &dc) override;190std::string GetText() const;191192private:193UI::TextView *text_ = nullptr;194double timeShown_ = 0.0;195float cutOffY_;196bool showing_ = false;197};198199uint32_t GetBackgroundColorWithAlpha(const UIContext &dc);200201202