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
|
||||
partialStretchDefault = pixel_xres < 1.3 * pixel_yres;
|
||||
#endif
|
||||
|
||||
// TODO: Replace these settings with a list of options
|
||||
graphics->Get("PartialStretch", &bPartialStretch, partialStretchDefault);
|
||||
graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
|
||||
graphics->Get("SmallDisplay", &bSmallDisplay, false);
|
||||
|
||||
graphics->Get("TrueColor", &bTrueColor, true);
|
||||
|
||||
graphics->Get("MipMap", &bMipMap, true);
|
||||
|
@ -555,6 +559,7 @@ void Config::Save() {
|
|||
#endif
|
||||
graphics->Set("PartialStretch", bPartialStretch);
|
||||
graphics->Set("StretchToDisplay", bStretchToDisplay);
|
||||
graphics->Set("SmallDisplay", &bSmallDisplay);
|
||||
graphics->Set("TrueColor", bTrueColor);
|
||||
graphics->Set("MipMap", bMipMap);
|
||||
graphics->Set("TexScalingLevel", iTexScalingLevel);
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG)
|
||||
bool bPartialStretch;
|
||||
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;
|
||||
int iFrameSkip;
|
||||
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,
|
||||
float origW, float origH, float frameW, float frameH) {
|
||||
float outW;
|
||||
float outH;
|
||||
|
||||
if (g_Config.bStretchToDisplay) {
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
*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;
|
||||
outW = frameW;
|
||||
outH = frameH;
|
||||
} else {
|
||||
// Image is taller than frame. Center horizontally.
|
||||
float scale = origH / frameH;
|
||||
*y = 0.0f;
|
||||
*h = frameH;
|
||||
*w = frameH * origRatio;
|
||||
*x = (frameW - *w) / 2.0f;
|
||||
float origRatio = origW / origH;
|
||||
float frameRatio = frameW / frameH;
|
||||
if (origRatio > frameRatio) {
|
||||
// Image is wider than frame. Center vertically.
|
||||
outW = frameW;
|
||||
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() {
|
||||
|
|
|
@ -128,6 +128,8 @@ void GameSettingsScreen::CreateViews() {
|
|||
graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange);
|
||||
#endif
|
||||
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
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bPartialStretch, gs->T("Partial Vertical Stretch")));
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bMipMap, gs->T("Mipmapping")));
|
||||
|
|
Loading…
Add table
Reference in a new issue