mirror of
https://github.com/alexbatalov/fallout1-ce.git
synced 2024-11-20 08:10:40 +00:00
Add support for SCALE_2X (#75)
This commit is contained in:
parent
7bbc6dc29f
commit
55fb75bc77
@ -103,6 +103,7 @@ void reset_mode()
|
||||
static int GNW95_init_mode_ex(int width, int height, int bpp)
|
||||
{
|
||||
bool fullscreen = true;
|
||||
int scale = 1;
|
||||
|
||||
Config resolutionConfig;
|
||||
if (config_init(&resolutionConfig)) {
|
||||
@ -121,11 +122,23 @@ static int GNW95_init_mode_ex(int width, int height, int bpp)
|
||||
if (configGetBool(&resolutionConfig, "MAIN", "WINDOWED", &windowed)) {
|
||||
fullscreen = !windowed;
|
||||
}
|
||||
|
||||
int scaleValue;
|
||||
if (config_get_value(&resolutionConfig, "MAIN", "SCALE_2X", &scaleValue)) {
|
||||
scale = scaleValue + 1; // 0 = 1x, 1 = 2x
|
||||
// Only allow scaling if resulting game resolution is >= 640x480
|
||||
if ((width / scale) < 640 || (height / scale) < 480) {
|
||||
scale = 1;
|
||||
} else {
|
||||
width /= scale;
|
||||
height /= scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
config_exit(&resolutionConfig);
|
||||
}
|
||||
|
||||
if (GNW95_init_window(width, height, fullscreen) == -1) {
|
||||
if (GNW95_init_window(width, height, fullscreen, scale) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -152,7 +165,7 @@ static int GNW95_init_mode(int width, int height)
|
||||
}
|
||||
|
||||
// 0x4CAEDC
|
||||
int GNW95_init_window(int width, int height, bool fullscreen)
|
||||
int GNW95_init_window(int width, int height, bool fullscreen, int scale)
|
||||
{
|
||||
if (gSdlWindow == NULL) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
|
||||
@ -167,7 +180,7 @@ int GNW95_init_window(int width, int height, bool fullscreen)
|
||||
windowFlags |= SDL_WINDOW_FULLSCREEN;
|
||||
}
|
||||
|
||||
gSdlWindow = SDL_CreateWindow(GNW95_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, windowFlags);
|
||||
gSdlWindow = SDL_CreateWindow(GNW95_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width * scale, height * scale, windowFlags);
|
||||
if (gSdlWindow == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ int init_mode_1280_1024();
|
||||
int init_vesa_mode(int mode, int width, int height, int half);
|
||||
int get_start_mode();
|
||||
void reset_mode();
|
||||
int GNW95_init_window(int width, int height, bool fullscreen);
|
||||
int GNW95_init_window(int width, int height, bool fullscreen, int scale);
|
||||
int GNW95_init_DirectDraw(int width, int height, int bpp);
|
||||
void GNW95_reset_mode();
|
||||
void GNW95_SetPaletteEntries(unsigned char* a1, int a2, int a3);
|
||||
|
Loading…
Reference in New Issue
Block a user