diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 0422a8a5d3..4316378edb 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -512,7 +512,6 @@ void EmuScreen::render() { UI::LayoutViewHierarchy(*screenManager()->getUIContext(), root_); root_->Draw(*screenManager()->getUIContext()); } - DrawWatermark(); if (!osm.IsEmpty()) { osm.Draw(ui_draw2d); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 8105ec2c56..7bc34cfd7c 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -32,6 +32,7 @@ #include "UI/MenuScreens.h" #include "UI/GameInfoCache.h" #include "UI/GameSettingsScreen.h" +#include "UI/MiscScreens.h" #include "UI/ui_atlas.h" #include "Core/Config.h" #include "GPU/GPUInterface.h" diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index a84f337c2b..6172e0d0f5 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -142,72 +142,6 @@ void DrawBackground(float alpha) { } } -// For private alphas, etc. -void DrawWatermark() { - // ui_draw2d.DrawTextShadow(UBUNTU24, "PRIVATE BUILD", dp_xres / 2, 10, 0xFF0000FF, ALIGN_HCENTER); -} - -void LogoScreen::Next() { - if (bootFilename_.size()) { - screenManager()->switchScreen(new EmuScreen(bootFilename_)); - } else { - if (g_Config.bNewUI) - screenManager()->switchScreen(new MainScreen()); - else - screenManager()->switchScreen(new MenuScreen()); - } -} - -void LogoScreen::update(InputState &input_state) { - frames_++; - if (frames_ > 180 || input_state.pointer_down[0]) { - Next(); - } -} - -void LogoScreen::sendMessage(const char *message, const char *value) { - if (!strcmp(message, "boot")) { - screenManager()->switchScreen(new EmuScreen(value)); - } -} - -void LogoScreen::key(const KeyInput &key) { - if (key.deviceId != DEVICE_ID_MOUSE) { - Next(); - } -} - -void LogoScreen::render() { - float t = (float)frames_ / 60.0f; - - float alpha = t; - if (t > 1.0f) alpha = 1.0f; - float alphaText = alpha; - if (t > 2.0f) alphaText = 3.0f - t; - - UIShader_Prepare(); - UIBegin(UIShader_Get()); - DrawBackground(alpha); - - I18NCategory *c = GetI18NCategory("PSPCredits"); - char temp[256]; - sprintf(temp, "%s Henrik Rydgård", c->T("created", "Created by")); - - ui_draw2d.SetFontScale(1.5f, 1.5f); - ui_draw2d.DrawTextShadow(UBUNTU48, "PPSSPP", dp_xres / 2, dp_yres / 2 - 30, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); - ui_draw2d.SetFontScale(1.0f, 1.0f); - ui_draw2d.DrawTextShadow(UBUNTU24, temp, dp_xres / 2, dp_yres / 2 + 40, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); - ui_draw2d.DrawTextShadow(UBUNTU24, c->T("license", "Free Software under GPL 2.0"), dp_xres / 2, dp_yres / 2 + 70, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); - ui_draw2d.DrawTextShadow(UBUNTU24, "www.ppsspp.org", dp_xres / 2, dp_yres / 2 + 130, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); - if (bootFilename_.size()) { - ui_draw2d.DrawTextShadow(UBUNTU24, bootFilename_.c_str(), dp_xres / 2, dp_yres / 2 + 180, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); - } - - DrawWatermark(); - UIEnd(); -} - - // ================== // Menu Screen // ================== @@ -390,8 +324,6 @@ void MenuScreen::render() { ui_draw2d.SetFontScale(1.0, 1.0); #endif - DrawWatermark(); - UIEnd(); } @@ -582,7 +514,6 @@ void PauseScreen::render() { screenManager()->finishDialog(this, DR_CANCEL); } - DrawWatermark(); UIEnd(); } @@ -2046,140 +1977,3 @@ void FileSelectScreen::render() { UIEnd(); } - -void CreditsScreen::update(InputState &input_state) { - globalUIState = UISTATE_MENU; - if (input_state.pad_buttons_down & PAD_BUTTON_BACK) { - screenManager()->finishDialog(this, DR_OK); - } - frames_++; -} - - -void CreditsScreen::render() { - I18NCategory *c = GetI18NCategory("PSPCredits"); - - const char * credits[] = { - "PPSSPP", - "", - "", - c->T("title", "A fast and portable PSP emulator"), - "", - c->T("created", "Created by"), - "Henrik Rydgård", - "(aka hrydgard, ector)", - "", - "", - c->T("contributors", "Contributors:"), - "unknownbrackets", - "oioitff", - "xsacha", - "raven02", - "tpunix", - "orphis", - "sum2012", - "mikusp", - "aquanull", - "The Dax", - "tmaul", - "artart78", - "ced2911", - "soywiz", - "kovensky", - "xele", - "chaserhjk", - "evilcorn", - "daniel dressler", - "makotech222", - "CPkmn", - "mgaver", - "jeid3", - "cinaera/BeaR", - "jtraynham", - "Kingcom", - "aquanull", - "arnastia", - "lioncash", - "JulianoAmaralChaves", - "", - c->T("written", "Written in C++ for speed and portability"), - "", - "", - c->T("tools", "Free tools used:"), - #ifdef ANDROID - "Android SDK + NDK", - #elif defined(BLACKBERRY) - "Blackberry NDK", - #endif - #if defined(USING_QT_UI) - "Qt", - #else - "SDL", - #endif - "CMake", - "freetype2", - "zlib", - "PSP SDK", - "", - "", - c->T("website", "Check out the website:"), - "www.ppsspp.org", - c->T("list", "compatibility lists, forums, and development info"), - "", - "", - c->T("check", "Also check out Dolphin, the best Wii/GC emu around:"), - "http://www.dolphin-emu.org", - "", - "", - c->T("info1", "PPSSPP is intended for educational purposes only."), - "", - c->T("info2", "Please make sure that you own the rights to any games"), - c->T("info3", "you play by owning the UMD or by buying the digital"), - c->T("info4", "download from the PSN store on your real PSP."), - "", - "", - c->T("info5", "PSP is a trademark by Sony, Inc."), - }; - - // TODO: This is kinda ugly, done on every frame... - char temp[256]; - sprintf(temp, "PPSSPP %s", PPSSPP_GIT_VERSION); - credits[0] = (const char *)temp; - - UIShader_Prepare(); - UIBegin(UIShader_Get()); - DrawBackground(1.0f); - - const int numItems = ARRAY_SIZE(credits); - int itemHeight = 36; - int totalHeight = numItems * itemHeight + dp_yres + 200; - int y = dp_yres - (frames_ % totalHeight); - for (int i = 0; i < numItems; i++) { - float alpha = linearInOut(y+32, 64, dp_yres - 192, 64); - if (alpha > 0.0f) { - UIText(dp_xres/2, y, credits[i], whiteAlpha(alpha), ease(alpha), ALIGN_HCENTER); - } - y += itemHeight; - } - I18NCategory *g = GetI18NCategory("General"); - - if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), 200, 0, g->T("Back"), ALIGN_BOTTOMRIGHT)) { - screenManager()->finishDialog(this, DR_OK); - } - -#ifdef ANDROID -#ifndef GOLD - if (UIButton(GEN_ID, Pos(10, dp_yres - 10), 300, 0, g->T("Buy PPSSPP Gold"), ALIGN_BOTTOMLEFT)) { - LaunchBrowser("market://details?id=org.ppsspp.ppssppgold"); - } -#endif -#else -#ifndef GOLD - if (UIButton(GEN_ID, Pos(10, dp_yres - 10), 300, 0, g->T("Buy PPSSPP Gold"), ALIGN_BOTTOMLEFT)) { - LaunchBrowser("http://central.ppsspp.org/buygold"); - } -#endif -#endif - - UIEnd(); -} diff --git a/UI/MenuScreens.h b/UI/MenuScreens.h index 3f9c000983..de2b61f104 100644 --- a/UI/MenuScreens.h +++ b/UI/MenuScreens.h @@ -25,22 +25,6 @@ #include "ui/ui.h" #include "file/file_util.h" -class LogoScreen : public Screen -{ -public: - LogoScreen(const std::string &bootFilename) - : bootFilename_(bootFilename), frames_(0) {} - void key(const KeyInput &key); - void update(InputState &input); - void render(); - void sendMessage(const char *message, const char *value); - -private: - void Next(); - std::string bootFilename_; - int frames_; -}; - class MenuScreen : public Screen { public: @@ -196,9 +180,7 @@ struct FileSelectScreenOptions { std::map iconMapping; }; - -class FileSelectScreen : public Screen -{ +class FileSelectScreen : public Screen { public: FileSelectScreen(const FileSelectScreenOptions &options); void update(InputState &input); @@ -217,16 +199,3 @@ private: std::string currentDirectory_; std::vector listing_; }; - - -class CreditsScreen : public Screen -{ -public: - CreditsScreen() : frames_(0) {} - void update(InputState &input); - void render(); -private: - int frames_; -}; - -void DrawWatermark(); diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 0456f599e9..38531d9392 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -15,18 +15,26 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "base/display.h" #include "base/colorutil.h" #include "base/timeutil.h" #include "gfx_es2/draw_buffer.h" #include "file/vfs.h" +#include "math/curves.h" #include "i18n/i18n.h" #include "ui/ui_context.h" #include "ui/view.h" #include "ui/viewgroup.h" #include "UI/MiscScreens.h" +#include "UI/MenuScreens.h" +#include "UI/EmuScreen.h" +#include "UI/MainScreen.h" #include "Core/Config.h" +#include "Core/System.h" #include "Core/HLE/sceUtility.h" +#include "ui_atlas.h" + void DrawBackground(float alpha); void UIScreenWithBackground::DrawBackground(UIContext &dc) { @@ -170,3 +178,222 @@ void NewLanguageScreen::OnCompleted() { g_Config.languageIni = oldLang; } } + +void LogoScreen::Next() { + if (bootFilename_.size()) { + screenManager()->switchScreen(new EmuScreen(bootFilename_)); + } else { + if (g_Config.bNewUI) + screenManager()->switchScreen(new MainScreen()); + else + screenManager()->switchScreen(new MenuScreen()); + } +} + +void LogoScreen::update(InputState &input_state) { + UIScreen::update(input_state); + frames_++; + if (frames_ > 180 || input_state.pointer_down[0]) { + Next(); + } +} + +void LogoScreen::sendMessage(const char *message, const char *value) { + if (!strcmp(message, "boot")) { + screenManager()->switchScreen(new EmuScreen(value)); + } +} + +void LogoScreen::key(const KeyInput &key) { + if (key.deviceId != DEVICE_ID_MOUSE) { + Next(); + } +} + +void LogoScreen::render() { + UIScreen::render(); + + UIContext &dc = *screenManager()->getUIContext(); + + dc.Begin(); + float t = (float)frames_ / 60.0f; + + float alpha = t; + if (t > 1.0f) alpha = 1.0f; + float alphaText = alpha; + if (t > 2.0f) alphaText = 3.0f - t; + + ::DrawBackground(alpha); + + I18NCategory *c = GetI18NCategory("PSPCredits"); + char temp[256]; + sprintf(temp, "%s Henrik Rydgård", c->T("created", "Created by")); + + dc.Draw()->SetFontScale(1.5f, 1.5f); + dc.Draw()->DrawTextShadow(UBUNTU48, "PPSSPP", dp_xres / 2, dp_yres / 2 - 30, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); + dc.Draw()->SetFontScale(1.0f, 1.0f); + dc.Draw()->DrawTextShadow(UBUNTU24, temp, dp_xres / 2, dp_yres / 2 + 40, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); + dc.Draw()->DrawTextShadow(UBUNTU24, c->T("license", "Free Software under GPL 2.0"), dp_xres / 2, dp_yres / 2 + 70, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); + dc.Draw()->DrawTextShadow(UBUNTU24, "www.ppsspp.org", dp_xres / 2, dp_yres / 2 + 130, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); + if (bootFilename_.size()) { + ui_draw2d.DrawTextShadow(UBUNTU24, bootFilename_.c_str(), dp_xres / 2, dp_yres / 2 + 180, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); + } + + dc.End(); + dc.Flush(); +} + +void CreditsScreen::CreateViews() { + using namespace UI; + root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT)); + root_->Add(new Button("OK", new AnchorLayoutParams(200, 50, NONE, NONE, 10, 10, false)))->OnClick.Handle(this, &CreditsScreen::OnOK); +} + +UI::EventReturn CreditsScreen::OnOK(UI::EventParams &e) { + screenManager()->finishDialog(this, DR_OK); + return UI::EVENT_DONE; +} + +void CreditsScreen::update(InputState &input_state) { + UIScreen::update(input_state); + globalUIState = UISTATE_MENU; + if (input_state.pad_buttons_down & PAD_BUTTON_BACK) { + screenManager()->finishDialog(this, DR_OK); + } + frames_++; +} + +void CreditsScreen::render() { + UIScreen::render(); + + I18NCategory *c = GetI18NCategory("PSPCredits"); + + const char * credits[] = { + "PPSSPP", + "", + "", + c->T("title", "A fast and portable PSP emulator"), + "", + c->T("created", "Created by"), + "Henrik Rydgård", + "(aka hrydgard, ector)", + "", + "", + c->T("contributors", "Contributors:"), + "unknownbrackets", + "oioitff", + "xsacha", + "raven02", + "tpunix", + "orphis", + "sum2012", + "mikusp", + "aquanull", + "The Dax", + "tmaul", + "artart78", + "ced2911", + "soywiz", + "kovensky", + "xele", + "chaserhjk", + "evilcorn", + "daniel dressler", + "makotech222", + "CPkmn", + "mgaver", + "jeid3", + "cinaera/BeaR", + "jtraynham", + "Kingcom", + "aquanull", + "arnastia", + "lioncash", + "JulianoAmaralChaves", + "", + c->T("written", "Written in C++ for speed and portability"), + "", + "", + c->T("tools", "Free tools used:"), +#ifdef ANDROID + "Android SDK + NDK", +#elif defined(BLACKBERRY) + "Blackberry NDK", +#endif +#if defined(USING_QT_UI) + "Qt", +#else + "SDL", +#endif + "CMake", + "freetype2", + "zlib", + "PSP SDK", + "", + "", + c->T("website", "Check out the website:"), + "www.ppsspp.org", + c->T("list", "compatibility lists, forums, and development info"), + "", + "", + c->T("check", "Also check out Dolphin, the best Wii/GC emu around:"), + "http://www.dolphin-emu.org", + "", + "", + c->T("info1", "PPSSPP is intended for educational purposes only."), + "", + c->T("info2", "Please make sure that you own the rights to any games"), + c->T("info3", "you play by owning the UMD or by buying the digital"), + c->T("info4", "download from the PSN store on your real PSP."), + "", + "", + c->T("info5", "PSP is a trademark by Sony, Inc."), + }; + + // TODO: This is kinda ugly, done on every frame... + char temp[256]; + sprintf(temp, "PPSSPP %s", PPSSPP_GIT_VERSION); + credits[0] = (const char *)temp; + + UIContext &dc = *screenManager()->getUIContext(); + dc.Begin(); + + const int numItems = ARRAY_SIZE(credits); + int itemHeight = 36; + int totalHeight = numItems * itemHeight + dp_yres + 200; + int y = dp_yres - (frames_ % totalHeight); + for (int i = 0; i < numItems; i++) { + float alpha = linearInOut(y+32, 64, dp_yres - 192, 64); + if (alpha > 0.0f) { + dc.Draw()->SetFontScale(ease(alpha), ease(alpha)); + dc.Draw()->DrawText(UBUNTU24, credits[i], dp_xres/2, y, whiteAlpha(alpha), ALIGN_HCENTER); + dc.Draw()->SetFontScale(1.0f, 1.0f); + } + y += itemHeight; + } + /* + I18NCategory *g = GetI18NCategory("General"); + + if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), 200, 0, g->T("Back"), ALIGN_BOTTOMRIGHT)) { + screenManager()->finishDialog(this, DR_OK); + } + +#ifdef ANDROID +#ifndef GOLD + if (UIButton(GEN_ID, Pos(10, dp_yres - 10), 300, 0, g->T("Buy PPSSPP Gold"), ALIGN_BOTTOMLEFT)) { + LaunchBrowser("market://details?id=org.ppsspp.ppssppgold"); + } +#endif +#else +#ifndef GOLD + if (UIButton(GEN_ID, Pos(10, dp_yres - 10), 300, 0, g->T("Buy PPSSPP Gold"), ALIGN_BOTTOMLEFT)) { + LaunchBrowser("http://central.ppsspp.org/buygold"); + } +#endif +#endif + UIEnd(); + */ + + dc.End(); + dc.Flush(); +} diff --git a/UI/MiscScreens.h b/UI/MiscScreens.h index 0b73f55dfb..6d960aa247 100644 --- a/UI/MiscScreens.h +++ b/UI/MiscScreens.h @@ -75,5 +75,36 @@ private: }; +class LogoScreen : public UIScreen { +public: + LogoScreen(const std::string &bootFilename) + : bootFilename_(bootFilename), frames_(0) {} + void key(const KeyInput &key); + void update(InputState &input); + void render(); + void sendMessage(const char *message, const char *value); + virtual void CreateViews() {} + +private: + void Next(); + std::string bootFilename_; + int frames_; +}; + + +class CreditsScreen : public UIDialogScreenWithBackground { +public: + CreditsScreen() : frames_(0) {} + void update(InputState &input); + void render(); + virtual void CreateViews(); + +private: + UI::EventReturn OnOK(UI::EventParams &e); + + int frames_; +}; + + // Utility functions that create various popup screens ListPopupScreen *CreateLanguageScreen(); \ No newline at end of file diff --git a/native b/native index 77fcfd0f20..1be5ce83d7 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 77fcfd0f2058c1acc91c7a68598df259f6628e2f +Subproject commit 1be5ce83d732c4ebf3179ada40ef895586cb875e