Merge pull request #3002 from raven02/aa

Anrdoid : Add option 'Anti-Aliasing' to new UI
This commit is contained in:
Henrik Rydgård 2013-07-31 09:22:31 -07:00
commit ec9c464057
8 changed files with 62 additions and 25 deletions

View file

@ -101,7 +101,7 @@ void Config::Load(const char *iniFileName)
graphics->Get("RenderingMode", &iRenderingMode, 1); // default is buffered rendering mode
graphics->Get("HardwareTransform", &bHardwareTransform, true);
graphics->Get("TextureFiltering", &iTexFiltering, 1);
graphics->Get("SSAA", &SSAntiAliasing, 0);
graphics->Get("SSAA", &bAntiAliasing, 0);
graphics->Get("VBO", &bUseVBO, false);
graphics->Get("FrameSkip", &iFrameSkip, 0);
graphics->Get("FrameRate", &iFpsLimit, 0);
@ -231,7 +231,7 @@ void Config::Save()
graphics->Set("RenderingMode", iRenderingMode);
graphics->Set("HardwareTransform", bHardwareTransform);
graphics->Set("TextureFiltering", iTexFiltering);
graphics->Set("SSAA", SSAntiAliasing);
graphics->Set("SSAA", bAntiAliasing);
graphics->Set("VBO", bUseVBO);
graphics->Set("FrameSkip", iFrameSkip);
graphics->Set("FrameRate", iFpsLimit);

View file

@ -77,7 +77,7 @@ public:
int iWindowX;
int iWindowY;
int iWindowZoom; // for Windows
bool SSAntiAliasing; // for Windows, too
bool bAntiAliasing; // for Windows, too
bool bVertexCache;
bool bFullScreen;
#ifdef _WIN32

View file

@ -83,7 +83,7 @@ void EmuScreen::bootGame(const std::string &filename) {
coreParam.outputHeight = dp_yres;
coreParam.pixelWidth = pixel_xres;
coreParam.pixelHeight = pixel_yres;
if (g_Config.SSAntiAliasing) {
if (g_Config.bAntiAliasing) {
coreParam.renderWidth *= 2;
coreParam.renderHeight *= 2;
}

View file

@ -29,6 +29,10 @@
#include "Core/Config.h"
#include "android/jni/TestRunner.h"
#include "GPU/GPUInterface.h"
#include "base/colorutil.h"
#include "base/timeutil.h"
#include "math/curves.h"
namespace UI {
@ -200,6 +204,7 @@ void GameSettingsScreen::CreateViews() {
static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering", "Read Framebuffers To Memory(GPU)"};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gs->T("Mode"), renderingMode, 0, 3, gs, screenManager()));
#endif
graphicsSettings->Add(new CheckBox(&g_Config.bAntiAliasing, gs->T("Anti-Aliasing")));
graphicsSettings->Add(new ItemHeader(gs->T("Features")));
graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTransform, gs->T("Hardware Transform")));
graphicsSettings->Add(new CheckBox(&g_Config.bVertexCache, gs->T("Vertex Cache")));
@ -275,6 +280,35 @@ void GameSettingsScreen::CreateViews() {
systemSettings->Add(new PopupMultiChoice(&g_Config.iButtonPreference, gs->T("Button Preference"), buttonPref, 1, 2, s, screenManager()));
}
void DrawBackground(float alpha);
void GameSettingsScreen::DrawBackground(UIContext &dc) {
GameInfo *ginfo = g_gameInfoCache.GetInfo(gamePath_, true);
dc.Flush();
dc.RebindTexture();
::DrawBackground(1.0f);
dc.Flush();
if (ginfo && ginfo->pic1Texture) {
ginfo->pic1Texture->Bind(0);
uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 3)) & 0xFFc0c0c0;
dc.Draw()->DrawTexRect(0,0,dp_xres, dp_yres, 0,0,1,1,color);
dc.Flush();
dc.RebindTexture();
}
/*
if (ginfo && ginfo->pic0Texture) {
ginfo->pic0Texture->Bind(0);
// Pic0 is drawn in the bottom right corner, overlaying pic1.
float sizeX = dp_xres / 480 * ginfo->pic0Texture->Width();
float sizeY = dp_yres / 272 * ginfo->pic0Texture->Height();
uint32_t color = whiteAlpha(ease((time_now_d() - ginfo->timePic1WasLoaded) * 2)) & 0xFFc0c0c0;
ui_draw2d.DrawTexRect(dp_xres - sizeX, dp_yres - sizeY, dp_xres, dp_yres, 0,0,1,1,color);
ui_draw2d.Flush();
dc.RebindTexture();
}*/
}
void GameSettingsScreen::update(InputState &input) {
UIScreen::update(input);
g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0;

View file

@ -30,6 +30,7 @@ public:
protected:
virtual void CreateViews();
virtual void DrawBackground(UIContext &dc);
private:
std::string gamePath_, gameID_;

View file

@ -952,7 +952,7 @@ void GraphicsScreenP1::render() {
#endif
UICheckBox(GEN_ID, x, y += stride, gs->T("Mipmapping"), ALIGN_TOPLEFT, &g_Config.bMipMap);
UICheckBox(GEN_ID, x, y += stride, gs->T("AA", "Anti-Aliasing"), ALIGN_TOPLEFT, &g_Config.SSAntiAliasing);
UICheckBox(GEN_ID, x, y += stride, gs->T("AA", "Anti-Aliasing"), ALIGN_TOPLEFT, &g_Config.bAntiAliasing);
#ifdef _WIN32
//bool Vsync = g_Config.iVSyncInterval != 0;
@ -1701,12 +1701,12 @@ void KeyMappingScreen::render() {
#define KeyBtn(x, y, symbol) \
if (UIButton(GEN_ID, Pos(x, y), 60, 0, KeyMap::NameKeyFromPspButton(currentMap_, symbol).c_str(), \
if (UIButton(GEN_ID, Pos(x, y), 90, 0, KeyMap::NameKeyFromPspButton(currentMap_, symbol).c_str(), \
ALIGN_TOPLEFT)) {\
screenManager()->push(new KeyMappingNewKeyDialog(symbol, currentMap_), 0); \
UIReset(); \
} \
UIText(0, Pos(x+30, y+50), KeyMap::NameDeviceFromPspButton(currentMap_, symbol).c_str(), 0xFFFFFFFF, 0.78f, ALIGN_HCENTER); \
UIText(0, Pos(x+30, y+50), KeyMap::NameDeviceFromPspButton(currentMap_, symbol).c_str(), 0xFFFFFFFF, 0.7f, ALIGN_HCENTER); \
UIText(0, Pos(x+30, y+80), KeyMap::GetPspButtonName(symbol).c_str(), 0xFFFFFFFF, 0.5f, ALIGN_HCENTER); \
@ -1719,31 +1719,33 @@ void KeyMappingScreen::render() {
int left = 30;
KeyBtn(left, 30, CTRL_LTRIGGER);
int top = 100;
KeyBtn(left+hlfpad, top, CTRL_UP); // ^
KeyBtn(left, top+hlfpad, CTRL_LEFT);// <
KeyBtn(left+pad, top+hlfpad, CTRL_RIGHT); // >
KeyBtn(left+hlfpad, top+pad, CTRL_DOWN); // v
int top = 120;
KeyBtn(left+hlfpad, top, CTRL_UP); // Up
KeyBtn(left, top+hlfpad, CTRL_LEFT);// Left
KeyBtn(left+pad, top+hlfpad, CTRL_RIGHT); // Right
KeyBtn(left+hlfpad, top+pad, CTRL_DOWN); // Down
top = 10;
left = 250;
KeyBtn(left+hlfpad, top, VIRTKEY_AXIS_Y_MAX); // ^
KeyBtn(left, top+hlfpad, VIRTKEY_AXIS_X_MIN);// <
KeyBtn(left+pad, top+hlfpad, VIRTKEY_AXIS_X_MAX); // >
KeyBtn(left+hlfpad, top+pad, VIRTKEY_AXIS_Y_MIN); // v
top = 100;
KeyBtn(left+hlfpad, top, VIRTKEY_AXIS_Y_MAX); // Analog Up
KeyBtn(left, top+hlfpad, VIRTKEY_AXIS_X_MIN);// Analog Left
KeyBtn(left+pad, top+hlfpad, VIRTKEY_AXIS_X_MAX); // Analog Right
KeyBtn(left+hlfpad, top+pad, VIRTKEY_AXIS_Y_MIN); // Analog Down
left = 500;
top = 120;
left = 480;
KeyBtn(left+hlfpad, top, CTRL_TRIANGLE); // Triangle
KeyBtn(left, top+hlfpad, CTRL_SQUARE); // Square
KeyBtn(left+pad, top+hlfpad, CTRL_CIRCLE); // Circle
KeyBtn(left+hlfpad, top+pad, CTRL_CROSS); // Cross
left = 610;
KeyBtn(left, 30, CTRL_RTRIGGER);
top += pad;
top += pad + 50;
left = 250;
KeyBtn(left, top, CTRL_SELECT);
KeyBtn(left + pad, top, CTRL_START);
KeyBtn(left, top, CTRL_SELECT); // Select
KeyBtn(left + pad, top, CTRL_START); //Start
top = 10;
left = 720;

View file

@ -186,7 +186,7 @@ namespace MainWindow
// Round up to a zoom factor for the render size.
int zoom = (rc.right - rc.left + 479) / 480;
if (g_Config.SSAntiAliasing) zoom *= 2;
if (g_Config.bAntiAliasing) zoom *= 2;
PSP_CoreParameter().renderWidth = 480 * zoom;
PSP_CoreParameter().renderHeight = 272 * zoom;
PSP_CoreParameter().outputWidth = 480 * zoom;
@ -1007,7 +1007,7 @@ namespace MainWindow
break;
case ID_OPTIONS_SIMPLE2XSSAA:
g_Config.SSAntiAliasing = !g_Config.SSAntiAliasing;
g_Config.bAntiAliasing = !g_Config.bAntiAliasing;
ResizeDisplay(true);
break;
@ -1187,7 +1187,7 @@ namespace MainWindow
CHECKITEM(ID_OPTIONS_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats);
CHECKITEM(ID_OPTIONS_HARDWARETRANSFORM, g_Config.bHardwareTransform);
CHECKITEM(ID_OPTIONS_FASTMEMORY, g_Config.bFastMemory);
CHECKITEM(ID_OPTIONS_SIMPLE2XSSAA, g_Config.SSAntiAliasing);
CHECKITEM(ID_OPTIONS_SIMPLE2XSSAA, g_Config.bAntiAliasing);
CHECKITEM(ID_OPTIONS_STRETCHDISPLAY, g_Config.bStretchToDisplay);
CHECKITEM(ID_EMULATION_RUNONLOAD, g_Config.bAutoRun);
CHECKITEM(ID_OPTIONS_USEVBO, g_Config.bUseVBO);

View file

@ -407,7 +407,7 @@ BEGIN
MENUITEM "&Vertex Cache", ID_OPTIONS_VERTEXCACHE
MENUITEM "&Stream VBO", ID_OPTIONS_USEVBO
MENUITEM "&MipMapping", ID_OPTIONS_MIPMAP
MENUITEM "2x SSAA", ID_OPTIONS_SIMPLE2XSSAA
MENUITEM "Anti-Aliasing", ID_OPTIONS_SIMPLE2XSSAA
MENUITEM "VS&ync", ID_OPTIONS_VSYNC
MENUITEM SEPARATOR
MENUITEM "Show &FPS", ID_OPTIONS_SHOWFPS