Commit 06339159 authored by deuce's avatar deuce
Browse files

Add new ciolib_initial_window_height/ciolib_initial_window_width globals.

These allow setting the initial window size for modes that don't force
integer scaling (ie: SDL).

While we're here, clear a renderer before free()ing the texture to prevent
crashing on some nVidia cards.

Addresses https://sf.net/p/syncterm/feature-requests/17/
parent fb3b74e1
......@@ -82,6 +82,8 @@ CIOLIBEXPORT int hold_update=0;
CIOLIBEXPORT int puttext_can_move=0;
CIOLIBEXPORT int ciolib_reaper=TRUE;
CIOLIBEXPORT char *ciolib_appname=NULL;
CIOLIBEXPORT int ciolib_initial_window_height = -1;
CIOLIBEXPORT int ciolib_initial_window_width = -1;
static int initialized=0;
CIOLIBEXPORT int CIOLIBCALL ciolib_movetext(int sx, int sy, int ex, int ey, int dx, int dy);
......
......@@ -385,6 +385,8 @@ CIOLIBEXPORTVAR int hold_update;
CIOLIBEXPORTVAR int puttext_can_move;
CIOLIBEXPORTVAR int ciolib_reaper;
CIOLIBEXPORTVAR char *ciolib_appname;
CIOLIBEXPORTVAR int ciolib_initial_window_height;
CIOLIBEXPORTVAR int ciolib_initial_window_width;
#define _conio_kbhit() kbhit()
......
......@@ -340,6 +340,14 @@ static int sdl_init_mode(int mode)
vstat.winwidth = ((double)cvstat.winwidth / (cvstat.cols * cvstat.charwidth)) * (vstat.cols * vstat.charwidth);
vstat.winheight = ((double)cvstat.winheight / (cvstat.rows * cvstat.charheight * cvstat.vmultiplier)) * (vstat.rows * vstat.charheight * vstat.vmultiplier);
if (oldcols != vstat.cols) {
if (oldcols == 0) {
if (ciolib_initial_window_width > 0)
vstat.winwidth = ciolib_initial_window_width;
if (ciolib_initial_window_height > 0)
vstat.winheight = ciolib_initial_window_height;
if (vstat.cols == 40)
oldcols = 40;
}
if (oldcols == 40) {
vstat.winwidth /= 2;
vstat.winheight /= 2;
......@@ -569,7 +577,8 @@ static void setup_surfaces_locked(void)
else {
sdl.SetWindowMinimumSize(win, cvstat.charwidth * cvstat.cols, cvstat.charheight * cvstat.rows);
sdl.SetWindowSize(win, cvstat.winwidth, cvstat.winheight);
if (texture)
sdl.RenderClear(renderer);
if (texture)
sdl.DestroyTexture(texture);
texture = sdl.CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, charwidth*cols, charheight*rows);
}
......@@ -928,6 +937,7 @@ void sdl_video_event_thread(void *data)
sdl.GetWindowSize(win, &cvstat.winwidth, &cvstat.winheight);
if (strcmp(newh, sdl.GetHint(SDL_HINT_RENDER_SCALE_QUALITY))) {
sdl.SetHint(SDL_HINT_RENDER_SCALE_QUALITY, newh);
sdl.RenderClear(renderer);
sdl.DestroyTexture(texture);
texture = sdl.CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, cvstat.charwidth*cvstat.cols, cvstat.charheight*cvstat.rows);
bitmap_drv_request_pixels();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment