diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-05-12 16:49:46 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-05-12 16:49:46 +0200 |
commit | afbec09fcf9a57ecb401267f7a4e23b270853e2c (patch) | |
tree | 321c991195d65e330ebc582afc4d2f7e3af4888c /src | |
parent | 2ead486354a2934f3d3e4e2ebb86e95653ee4b23 (diff) | |
parent | 369a0bf7de4d35ac86574ac448fab806420f882f (diff) |
Merge branch 'master' into unlua
Diffstat (limited to 'src')
-rw-r--r-- | src/main-sdl.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/main-sdl.c b/src/main-sdl.c index 840859e9..1b53cfc7 100644 --- a/src/main-sdl.c +++ b/src/main-sdl.c @@ -35,19 +35,13 @@ /************************************************* GLOBAL SDL-ToME PROPERTIES *************************************************/ - -/* Default window properties - used if none are available -from other places*/ -#define DEF_SCREEN_WIDTH 800 -#define DEF_SCREEN_HEIGHT 600 -#define DEF_SCREEN_BPP 16 /*Main window properties that may be loaded at runtime from a preference file or environmental variables. However, default values (defined above) can be used. */ -static int arg_width = DEF_SCREEN_WIDTH; -static int arg_height = DEF_SCREEN_HEIGHT; -static int arg_bpp = DEF_SCREEN_BPP; +static int arg_width = 0; +static int arg_height = 0; +static int arg_bpp = 16; /**************/ @@ -508,7 +502,9 @@ void handleEvent(SDL_Event *event) /* handle quit requests */ DB("Emergency Blit"); redrawAllTerminals(); - /*sdl_quit("Quitting!\n");*/ + save_player(); + save_dungeon(); + sdl_quit("Quitting!\n"); break; } default: @@ -2137,6 +2133,26 @@ errr init_sdl(int argc, char **argv) else videoFlags = SDL_SWSURFACE; + /* Now ready the fonts! */ + + DB("initializing SDL_ttf"); + if(TTF_Init()==-1) { + printf("TTF_Init: %s\n", TTF_GetError()); + sdl_quit("Bah"); + } + + DB("loading font..."); + + /* load and render the font */ + loadAndRenderFont(arg_font_name,arg_font_size); + + /* Make the window a nice default size if none is specified */ + if (arg_width < 1 || arg_height < 1) + { + arg_width = 80 * t_width; + arg_height = 24 * t_height; + } + /* now set the video mode that has been configured */ screen = SDL_SetVideoMode( arg_width, arg_height, arg_bpp, videoFlags ); @@ -2155,19 +2171,6 @@ errr init_sdl(int argc, char **argv) DB("SDL Window Created!"); - /* Now ready the fonts! */ - - DB("initializing SDL_ttf"); - if(TTF_Init()==-1) { - printf("TTF_Init: %s\n", TTF_GetError()); - sdl_quit("Bah"); - } - - DB("loading font..."); - - /* load and render the font */ - loadAndRenderFont(arg_font_name,arg_font_size); - /* Graphics! ---- If graphics are selected, then load graphical tiles! */ if (arg_graphics_type != NO_GRAPHICS) |