Select video mode with square pixel size

This commit is contained in:
Sergii Pylypenko
2019-08-31 20:56:32 +03:00
committed by pelya
parent a4ec3f2607
commit d65c932893
4 changed files with 9 additions and 9 deletions

View File

@@ -642,12 +642,6 @@ struct GameOptionsWindow : Window {
case WID_GO_GUI_ZOOM_DROPDOWN:
GfxClearSpriteCache();
_gui_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
switch (_gui_zoom) {
case ZOOM_LVL_OUT_4X - ZOOM_LVL_NORMAL: ChangeResInGame(854, 480); break;
case ZOOM_LVL_OUT_4X - ZOOM_LVL_OUT_2X: ChangeResInGame(1280, 720); break;
case ZOOM_LVL_OUT_4X - ZOOM_LVL_OUT_4X: ChangeResInGame(1920, 1080); break;
default: break;
}
UpdateCursorSize();
UpdateAllVirtCoords();
ReInitAllWindows();

View File

@@ -121,7 +121,7 @@ name = ""resolution""
type = SLE_INT
length = 2
var = _cur_resolution
def = ""854,480""
def = ""1,480""
cat = SC_BASIC
[SDTG_STR]

View File

@@ -251,7 +251,9 @@ static void GetVideoModes()
}
}
_num_resolutions = n;
#if !defined(__ANDROID__) // Android has native screen sizes first, do not sort them
SortResolutions(_num_resolutions);
#endif
}
}
@@ -268,8 +270,14 @@ static void GetAvailableVideoMode(uint *w, uint *h)
/* Use the closest possible resolution */
int best = 0;
uint delta = Delta(_resolutions[0].width, *w) * Delta(_resolutions[0].height, *h);
if (*w <= 1) {
delta = Delta(_resolutions[0].height, *h);
}
for (int i = 1; i != _num_resolutions; ++i) {
uint newdelta = Delta(_resolutions[i].width, *w) * Delta(_resolutions[i].height, *h);
if (*w <= 1) {
newdelta = Delta(_resolutions[i].height, *h);
}
if (newdelta < delta) {
best = i;
delta = newdelta;

View File

@@ -9,5 +9,3 @@
- Create auto-save when the app is put to background, and load it on the next start.
- Select native screen width x 480 resolution on first run.