mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Add option "Small Display", useful for large tablets to avoid overlapping touch controls with the screen.
Will later replace with a multiselect of different sizes, or something more advanced like multitouch drag & zoom of the screen to get it exactly where you want it.
This commit is contained in:
parent
737ef1c805
commit
c55578367f
4 changed files with 38 additions and 26 deletions
|
@ -247,8 +247,12 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
||||||
#ifdef BLACKBERRY
|
#ifdef BLACKBERRY
|
||||||
partialStretchDefault = pixel_xres < 1.3 * pixel_yres;
|
partialStretchDefault = pixel_xres < 1.3 * pixel_yres;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// TODO: Replace these settings with a list of options
|
||||||
graphics->Get("PartialStretch", &bPartialStretch, partialStretchDefault);
|
graphics->Get("PartialStretch", &bPartialStretch, partialStretchDefault);
|
||||||
graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
|
graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
|
||||||
|
graphics->Get("SmallDisplay", &bSmallDisplay, false);
|
||||||
|
|
||||||
graphics->Get("TrueColor", &bTrueColor, true);
|
graphics->Get("TrueColor", &bTrueColor, true);
|
||||||
|
|
||||||
graphics->Get("MipMap", &bMipMap, true);
|
graphics->Get("MipMap", &bMipMap, true);
|
||||||
|
@ -555,6 +559,7 @@ void Config::Save() {
|
||||||
#endif
|
#endif
|
||||||
graphics->Set("PartialStretch", bPartialStretch);
|
graphics->Set("PartialStretch", bPartialStretch);
|
||||||
graphics->Set("StretchToDisplay", bStretchToDisplay);
|
graphics->Set("StretchToDisplay", bStretchToDisplay);
|
||||||
|
graphics->Set("SmallDisplay", &bSmallDisplay);
|
||||||
graphics->Set("TrueColor", bTrueColor);
|
graphics->Set("TrueColor", bTrueColor);
|
||||||
graphics->Set("MipMap", bMipMap);
|
graphics->Set("MipMap", bMipMap);
|
||||||
graphics->Set("TexScalingLevel", iTexScalingLevel);
|
graphics->Set("TexScalingLevel", iTexScalingLevel);
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG)
|
int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG)
|
||||||
bool bPartialStretch;
|
bool bPartialStretch;
|
||||||
bool bStretchToDisplay;
|
bool bStretchToDisplay;
|
||||||
|
bool bSmallDisplay; // Useful on large tablets with touch controls to not overlap the image. Temporary setting - will be replaced by more comprehensive display size settings.
|
||||||
bool bVSync;
|
bool bVSync;
|
||||||
int iFrameSkip;
|
int iFrameSkip;
|
||||||
bool bFrameSkipUnthrottle;
|
bool bFrameSkipUnthrottle;
|
||||||
|
|
|
@ -119,35 +119,39 @@ void ConvertFromRGBA8888(u8 *dst, u8 *src, u32 stride, u32 height, GEBufferForma
|
||||||
|
|
||||||
void CenterRect(float *x, float *y, float *w, float *h,
|
void CenterRect(float *x, float *y, float *w, float *h,
|
||||||
float origW, float origH, float frameW, float frameH) {
|
float origW, float origH, float frameW, float frameH) {
|
||||||
|
float outW;
|
||||||
|
float outH;
|
||||||
|
|
||||||
if (g_Config.bStretchToDisplay) {
|
if (g_Config.bStretchToDisplay) {
|
||||||
*x = 0;
|
outW = frameW;
|
||||||
*y = 0;
|
outH = frameH;
|
||||||
*w = frameW;
|
|
||||||
*h = frameH;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float origRatio = origW/origH;
|
|
||||||
float frameRatio = frameW/frameH;
|
|
||||||
|
|
||||||
if (origRatio > frameRatio) {
|
|
||||||
// Image is wider than frame. Center vertically.
|
|
||||||
float scale = origW / frameW;
|
|
||||||
*x = 0.0f;
|
|
||||||
*w = frameW;
|
|
||||||
*h = frameW / origRatio;
|
|
||||||
// Stretch a little bit
|
|
||||||
if (g_Config.bPartialStretch)
|
|
||||||
*h = (frameH + *h) / 2.0f; // (408 + 720) / 2 = 564
|
|
||||||
*y = (frameH - *h) / 2.0f;
|
|
||||||
} else {
|
} else {
|
||||||
// Image is taller than frame. Center horizontally.
|
float origRatio = origW / origH;
|
||||||
float scale = origH / frameH;
|
float frameRatio = frameW / frameH;
|
||||||
*y = 0.0f;
|
if (origRatio > frameRatio) {
|
||||||
*h = frameH;
|
// Image is wider than frame. Center vertically.
|
||||||
*w = frameH * origRatio;
|
outW = frameW;
|
||||||
*x = (frameW - *w) / 2.0f;
|
outH = frameW / origRatio;
|
||||||
|
// Stretch a little bit
|
||||||
|
if (g_Config.bPartialStretch)
|
||||||
|
outH = (frameH + outH) / 2.0f; // (408 + 720) / 2 = 564
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Image is taller than frame. Center horizontally.
|
||||||
|
outW = frameH * origRatio;
|
||||||
|
outH = frameH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_Config.bSmallDisplay) {
|
||||||
|
outW /= 2.0f;
|
||||||
|
outH /= 2.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
*x = (frameW - outW) / 2.0f;
|
||||||
|
*y = (frameH - outH) / 2.0f;
|
||||||
|
*w = outW;
|
||||||
|
*h = outH;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClearBuffer() {
|
static void ClearBuffer() {
|
||||||
|
|
|
@ -128,6 +128,8 @@ void GameSettingsScreen::CreateViews() {
|
||||||
graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange);
|
graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange);
|
||||||
#endif
|
#endif
|
||||||
graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display")));
|
graphicsSettings->Add(new CheckBox(&g_Config.bStretchToDisplay, gs->T("Stretch to Display")));
|
||||||
|
// Small Display: To avoid overlapping touch controls on large tablets. Better control over this will be coming later.
|
||||||
|
graphicsSettings->Add(new CheckBox(&g_Config.bSmallDisplay, gs->T("Small Display")));
|
||||||
if (pixel_xres < pixel_yres * 1.3) // Smaller than 4:3
|
if (pixel_xres < pixel_yres * 1.3) // Smaller than 4:3
|
||||||
graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gs->T("Partial Vertical Stretch")));
|
graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gs->T("Partial Vertical Stretch")));
|
||||||
graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping")));
|
graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping")));
|
||||||
|
|
Loading…
Add table
Reference in a new issue