Assorted UI cleanups. Add a bunch of little image files that may be used in the Ouya port later.

This commit is contained in:
Henrik Rydgard committed 2013-07-15 17:41:24 +02:00
1 parent 2054e46c1f
commit 09a7bd08fa
43 files changed
+158 -122

No files matched your search

+1
View File
@@ -1101,6 +1101,7 @@ set(NativeAppSource
android/jni/TestRunner.cpp
UI/GameInfoCache.cpp
UI/MainScreen.cpp
UI/MiscScreens.cpp
UI/MenuScreens.cpp
UI/GameScreen.cpp
UI/GameSettingsScreen.cpp
+3 -3
View File
@@ -50,6 +50,7 @@
#include "UI/MenuScreens.h"
#include "UI/EmuScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/MiscScreens.h"
EmuScreen::EmuScreen(const std::string &filename) : invalid_(true) {
CheckGLExtensions();
@@ -349,9 +350,8 @@ static const struct { int from, to; } legacy_touch_mapping[12] = {
void EmuScreen::update(InputState &input) {
globalUIState = UISTATE_INGAME;
if (errorMessage_.size()) {
screenManager()->push(new ErrorScreen(
"Error loading file",
errorMessage_));
screenManager()->push(new PromptScreen(
"Error loading file: " + errorMessage_, "OK", ""));
errorMessage_ = "";
return;
}
+1 -39
View File
@@ -26,6 +26,7 @@
#include "UI/GameSettingsScreen.h"
#include "UI/GameInfoCache.h"
#include "UI/MenuScreens.h"
#include "UI/MiscScreens.h"
#include "UI/MainScreen.h"
void GameScreen::CreateViews() {
@@ -172,42 +173,3 @@ void GameScreen::CallbackDeleteGame(bool yes) {
}
}
void DrawBackground(float alpha);
void PromptScreen::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
}
void PromptScreen::CreateViews() {
// 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 TextView(0, message_, ALIGN_LEFT, 1.0f, new AnchorLayoutParams(10, 10, NONE, NONE)));
ViewGroup *rightColumnItems = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
root_->Add(rightColumnItems);
rightColumnItems->Add(new Choice(yesButtonText_))->OnClick.Handle(this, &PromptScreen::OnYes);
if (noButtonText_ != "")
rightColumnItems->Add(new Choice(noButtonText_))->OnClick.Handle(this, &PromptScreen::OnNo);
}
UI::EventReturn PromptScreen::OnYes(UI::EventParams &e) {
callback_(true);
screenManager()->finishDialog(this, DR_OK);
return UI::EVENT_DONE;
}
UI::EventReturn PromptScreen::OnNo(UI::EventParams &e) {
callback_(false);
screenManager()->finishDialog(this, DR_CANCEL);
return UI::EVENT_DONE;
}
-22
View File
@@ -52,25 +52,3 @@ private:
UI::TextView *tvGameSize_;
UI::TextView *tvSaveDataSize_;
};
inline void NoOpVoidBool(bool) {}
class PromptScreen : public UIScreen {
public:
PromptScreen(std::string message, std::string yesButtonText, std::string noButtonText, std::function<void(bool)> callback)
: message_(message), yesButtonText_(yesButtonText), noButtonText_(noButtonText), callback_(callback) {}
virtual void CreateViews();
protected:
virtual void DrawBackground(UIContext &dc);
private:
UI::EventReturn OnYes(UI::EventParams &e);
UI::EventReturn OnNo(UI::EventParams &e);
std::string message_;
std::string yesButtonText_;
std::string noButtonText_;
std::function<void(bool)> callback_;
};
+18 -6
View File
@@ -58,7 +58,8 @@ private:
void GameButton::Draw(UIContext &dc) {
GameInfo *ginfo = g_gameInfoCache.GetInfo(gamePath_, false);
Texture *texture = 0;
u32 color = 0;
u32 color = 0, shadowColor = 0;
if (ginfo->iconTexture) {
texture = ginfo->iconTexture;
} else {
@@ -72,6 +73,7 @@ void GameButton::Draw(UIContext &dc) {
if (texture) {
color = whiteAlpha(ease((time_now_d() - ginfo->timeIconWasLoaded) * 2));
shadowColor = blackAlpha(ease((time_now_d() - ginfo->timeIconWasLoaded) * 2));
float tw = texture->Width();
float th = texture->Height();
@@ -88,12 +90,17 @@ void GameButton::Draw(UIContext &dc) {
// Render button
int dropsize = 10;
if (texture) {
if (txOffset) {
dropsize = 3;
y += txOffset * 2;
if (HasFocus()) {
// dc.Draw()->DrawImage4Grid(I_DROP_SHADOW, x - dropsize, y, x+w + dropsize, y+h+dropsize*1.5, alphaMul(color, 0.5f), 1.0f);
// dc.Draw()->Flush();
} else {
if (txOffset) {
dropsize = 3;
y += txOffset * 2;
}
dc.Draw()->DrawImage4Grid(I_DROP_SHADOW, x - dropsize, y, x+w + dropsize, y+h+dropsize*1.5, alphaMul(shadowColor, 0.5f), 1.0f);
dc.Draw()->Flush();
}
dc.Draw()->DrawImage4Grid(I_DROP_SHADOW, x - dropsize, y, x+w + dropsize, y+h+dropsize*1.5, alphaMul(color, 0.5f), 1.0f);
dc.Draw()->Flush();
}
if (texture) {
@@ -377,6 +384,11 @@ UI::EventReturn MainScreen::OnCredits(UI::EventParams &e) {
}
UI::EventReturn MainScreen::OnSupport(UI::EventParams &e) {
#ifdef ANDROID
LaunchBrowser("market://details?id=org.ppsspp.ppssppgold");
#else
LaunchBrowser("http://central.ppsspp.org/buygold");
#endif
return UI::EVENT_DONE;
}
+9 -32
View File
@@ -1985,7 +1985,7 @@ void FileSelectScreen::render() {
void CreditsScreen::update(InputState &input_state) {
globalUIState = UISTATE_MENU;
if (input_state.pad_buttons_down & PAD_BUTTON_BACK) {
screenManager()->switchScreen(new MenuScreen());
screenManager()->finishDialog(this, DR_OK);
}
frames_++;
}
@@ -2104,40 +2104,17 @@ void CreditsScreen::render() {
#ifdef ANDROID
#ifndef GOLD
if (UIButton(GEN_ID, Pos(10, dp_yres - 10), 200, 0, g->T("Buy PPSSPP Gold"), ALIGN_BOTTOMLEFT)) {
sendMessage("launchBrowser", "market://details?id=org.ppsspp.ppssppgold");
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();
}
void ErrorScreen::update(InputState &input_state) {
if (input_state.pad_buttons_down & PAD_BUTTON_BACK) {
screenManager()->finishDialog(this, DR_OK);
}
}
void ErrorScreen::render()
{
UIShader_Prepare();
UIBegin(UIShader_Get());
DrawBackground(1.0f);
I18NCategory *ge = GetI18NCategory("Error");
ui_draw2d.SetFontScale(1.5f, 1.5f);
ui_draw2d.DrawTextShadow(UBUNTU24, ge->T(errorTitle_.c_str()), dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER);
ui_draw2d.SetFontScale(1.0f, 1.0f);
ui_draw2d.DrawTextShadow(UBUNTU24, ge->T(errorMessage_.c_str()), 40, 120, 0xFFFFFFFF, ALIGN_LEFT);
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);
}
UIEnd();
}
-16
View File
@@ -39,7 +39,6 @@ private:
int frames_;
};
class MenuScreen : public Screen
{
public:
@@ -209,19 +208,4 @@ private:
int frames_;
};
// Dialog box, meant to be pushed
class ErrorScreen : public Screen
{
public:
ErrorScreen(const std::string &errorTitle, const std::string &errorMessage) : errorTitle_(errorTitle), errorMessage_(errorMessage) {}
void update(InputState &input);
void render();
private:
std::string errorTitle_;
std::string errorMessage_;
};
void DrawWatermark();
+64
View File
@@ -0,0 +1,64 @@
// 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 "base/colorutil.h"
#include "base/timeutil.h"
#include "gfx_es2/draw_buffer.h"
#include "ui/ui_context.h"
#include "ui/view.h"
#include "ui/viewgroup.h"
#include "UI/MiscScreens.h"
void DrawBackground(float alpha);
void PromptScreen::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
}
void PromptScreen::CreateViews() {
// 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 TextView(0, message_, ALIGN_LEFT, 1.0f, new AnchorLayoutParams(10, 10, NONE, NONE)));
ViewGroup *rightColumnItems = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(300, FILL_PARENT, actionMenuMargins));
root_->Add(rightColumnItems);
rightColumnItems->Add(new Choice(yesButtonText_))->OnClick.Handle(this, &PromptScreen::OnYes);
if (noButtonText_ != "")
rightColumnItems->Add(new Choice(noButtonText_))->OnClick.Handle(this, &PromptScreen::OnNo);
}
UI::EventReturn PromptScreen::OnYes(UI::EventParams &e) {
callback_(true);
screenManager()->finishDialog(this, DR_OK);
return UI::EVENT_DONE;
}
UI::EventReturn PromptScreen::OnNo(UI::EventParams &e) {
callback_(false);
screenManager()->finishDialog(this, DR_CANCEL);
return UI::EVENT_DONE;
}
+46
View File
@@ -0,0 +1,46 @@
// 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 "base/functional.h"
#include "ui/ui_screen.h"
inline void NoOpVoidBool(bool) {}
class PromptScreen : public UIScreen {
public:
PromptScreen(std::string message, std::string yesButtonText, std::string noButtonText)
: message_(message), yesButtonText_(yesButtonText), noButtonText_(noButtonText) {
callback_ = &NoOpVoidBool;
}
PromptScreen(std::string message, std::string yesButtonText, std::string noButtonText, std::function<void(bool)> callback)
: message_(message), yesButtonText_(yesButtonText), noButtonText_(noButtonText), callback_(callback) {}
virtual void CreateViews();
protected:
virtual void DrawBackground(UIContext &dc);
private:
UI::EventReturn OnYes(UI::EventParams &e);
UI::EventReturn OnNo(UI::EventParams &e);
std::string message_;
std::string yesButtonText_;
std::string noButtonText_;
std::function<void(bool)> callback_;
};
+1
View File
@@ -553,6 +553,7 @@ void NativeTouch(const TouchInput &touch) {
}
void NativeKey(const KeyInput &key) {
g_buttonTracker.Process(key);
if (screenManager)
screenManager->key(key);
}
+2
View File
@@ -26,6 +26,7 @@
<ClCompile Include="GameSettingsScreen.cpp" />
<ClCompile Include="MainScreen.cpp" />
<ClCompile Include="MenuScreens.cpp" />
<ClCompile Include="MiscScreens.cpp" />
<ClCompile Include="NativeApp.cpp" />
<ClCompile Include="OnScreenDisplay.cpp" />
<ClCompile Include="PluginScreen.cpp" />
@@ -40,6 +41,7 @@
<ClInclude Include="GameSettingsScreen.h" />
<ClInclude Include="MainScreen.h" />
<ClInclude Include="MenuScreens.h" />
<ClInclude Include="MiscScreens.h" />
<ClInclude Include="OnScreenDisplay.h" />
<ClInclude Include="PluginScreen.h" />
<ClInclude Include="UIShader.h" />
+6
View File
@@ -25,6 +25,9 @@
<ClCompile Include="MainScreen.cpp">
<Filter>Screens</Filter>
</ClCompile>
<ClCompile Include="MiscScreens.cpp">
<Filter>Screens</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GameInfoCache.h" />
@@ -50,6 +53,9 @@
<ClInclude Include="MainScreen.h">
<Filter>Screens</Filter>
</ClInclude>
<ClInclude Include="MiscScreens.h">
<Filter>Screens</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Screens">
+5 -3
View File
@@ -570,7 +570,7 @@ namespace MainWindow
if (globalUIState == UISTATE_PAUSEMENU)
{
NativeMessageReceived("run", "");
if (disasmWindow[0])
if (disasmWindow[0])
SendMessage(disasmWindow[0]->GetDlgHandle(), WM_COMMAND, IDC_GO, 0);
}
else if (Core_IsStepping()) //It is paused, then continue to run
@@ -896,13 +896,15 @@ namespace MainWindow
if (raw->data.keyboard.Message == WM_KEYDOWN || raw->data.keyboard.Message == WM_SYSKEYDOWN) {
key.flags = KEY_DOWN;
key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)];
if (key.keyCode)
if (key.keyCode) {
NativeKey(key);
}
} else if (raw->data.keyboard.Message == WM_KEYUP) {
key.flags = KEY_UP;
key.keyCode = windowsTransTable[GetTrueVKey(raw->data.keyboard)];
if (key.keyCode)
if (key.keyCode) {
NativeKey(key);
}
}
}
}
+1
View File
@@ -133,6 +133,7 @@ LOCAL_SRC_FILES := \
$(SRC)/UI/EmuScreen.cpp \
$(SRC)/UI/MenuScreens.cpp \
$(SRC)/UI/MainScreen.cpp \
$(SRC)/UI/MiscScreens.cpp \
$(SRC)/UI/UIShader.cpp \
$(SRC)/UI/GamepadEmu.cpp \
$(SRC)/UI/GameInfoCache.cpp \
+1 -1
Submodule native updated: 693944a0a5...7151e4c06e.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1001 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB