aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2017-12-02 15:55:07 +0000
committerHarry Jeffery <harry@exec64.co.uk>2017-12-02 15:55:20 +0000
commit8f3d69f3e83560b168cc43afc57ca52126b81c8d (patch)
tree8ad1d3cd0608413a86eb3fd76daf81596d52efa0 /src
parentd6992c20800d2f9dc579274690ab8350bdccf60a (diff)
downloadimv-8f3d69f3e83560b168cc43afc57ca52126b81c8d.tar.gz
Add options for window width and height
Fixes #120
Diffstat (limited to 'src')
-rw-r--r--src/imv.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/imv.c b/src/imv.c
index f664081..9bbd492 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -51,6 +51,8 @@ struct imv {
bool quit;
bool loading;
bool fullscreen;
+ int initial_width;
+ int initial_height;
bool overlay_enabled;
enum upscaling_method upscaling_method;
bool stay_fullscreen_on_focus_loss;
@@ -147,6 +149,8 @@ struct imv *imv_create(void)
imv->quit = false;
imv->loading = false;
imv->fullscreen = false;
+ imv->initial_width = 1280;
+ imv->initial_height = 720;
imv->overlay_enabled = false;
imv->upscaling_method = UPSCALING_LINEAR;
imv->stay_fullscreen_on_focus_loss = false;
@@ -651,16 +655,11 @@ static bool setup_window(struct imv *imv)
imv->sdl_init = true;
- /* width and height arbitrarily chosen. Perhaps there's a smarter way to
- * set this */
- const int width = 1280;
- const int height = 720;
-
imv->window = SDL_CreateWindow(
"imv",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
- width, height,
+ imv->initial_width, imv->initial_height,
SDL_WINDOW_RESIZABLE);
if(!imv->window) {
@@ -955,6 +954,15 @@ static int handle_ini_value(void *user, const char *section, const char *name,
return 1;
}
+ if(!strcmp(name, "width")) {
+ imv->initial_width = strtol(value, NULL, 10);
+ return 1;
+ }
+ if(!strcmp(name, "height")) {
+ imv->initial_height = strtol(value, NULL, 10);
+ return 1;
+ }
+
if(!strcmp(name, "overlay")) {
imv->overlay_enabled = parse_bool(value);
return 1;