cleanup
This commit is contained in:
parent
0cda3fde9d
commit
6ba5576fe0
|
@ -462,7 +462,7 @@ int game_init(const char *name)
|
|||
if (name)
|
||||
game_err_msg(NULL);
|
||||
|
||||
if (gfx_init() || input_init())
|
||||
if (gfx_video_init() || input_init())
|
||||
return -1;
|
||||
|
||||
snd_init(opt_hz);
|
||||
|
@ -565,7 +565,7 @@ void game_done(void)
|
|||
input_clear();
|
||||
snd_done();
|
||||
instead_done();
|
||||
gfx_done();
|
||||
gfx_video_done();
|
||||
curgame_dir = NULL;
|
||||
game_own_theme = 0;
|
||||
// SDL_Quit();
|
||||
|
|
|
@ -473,7 +473,7 @@ Uint32 counter_fn(Uint32 interval, void *p)
|
|||
return interval;
|
||||
}
|
||||
|
||||
int gfx_init(void)
|
||||
int gfx_video_init(void)
|
||||
{
|
||||
char title[4096];
|
||||
|
||||
|
@ -526,7 +526,7 @@ void gfx_update(int x, int y, int w, int h) {
|
|||
SDL_UpdateRect(screen, x, y, w, h);
|
||||
}
|
||||
|
||||
void gfx_done(void)
|
||||
void gfx_video_done(void)
|
||||
{
|
||||
if (icon)
|
||||
SDL_FreeSurface(icon);
|
||||
|
@ -2126,3 +2126,17 @@ void gfx_change_screen(img_t src)
|
|||
game_cursor(CURSOR_ON);
|
||||
SDL_RemoveTimer(han);
|
||||
}
|
||||
|
||||
int gfx_init(void)
|
||||
{
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gfx_done(void)
|
||||
{
|
||||
SDL_Quit();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,10 @@ static inline color_t gfx_col(int r, int g, int b)
|
|||
col.b = b;
|
||||
return col;
|
||||
}
|
||||
|
||||
extern int gfx_init(void);
|
||||
extern void gfx_done(void);
|
||||
|
||||
extern int gfx_parse_color (const char *spec, color_t *def);
|
||||
extern void gfx_flip(void);
|
||||
extern img_t gfx_screen(img_t nscreen);
|
||||
|
@ -36,10 +40,10 @@ extern void gfx_noclip(void);
|
|||
extern void gfx_clip(int x, int y, int w, int h);
|
||||
extern int gfx_width;
|
||||
extern int gfx_height;
|
||||
extern int gfx_init(void);
|
||||
extern int gfx_video_init(void);
|
||||
extern int gfx_setmode(int w, int h, int fs);
|
||||
extern void gfx_update(int x, int y, int w, int h);
|
||||
extern void gfx_done(void);
|
||||
extern void gfx_video_done(void);
|
||||
extern void gfx_clear(int x, int y, int w, int h);
|
||||
extern void gfx_draw(img_t pixmap, int x, int y);
|
||||
extern void gfx_draw_wh(img_t p, int x, int y, int w, int h);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include <SDL.h>
|
||||
#include "externals.h"
|
||||
#include "internals.h"
|
||||
|
||||
|
@ -95,10 +94,8 @@ int main(int argc, char **argv)
|
|||
game_theme_select(DEFAULT_THEME);
|
||||
|
||||
// Initialize SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
|
||||
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
if (gfx_init() < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (game_init(opt_game)) {
|
||||
game_error(opt_game);
|
||||
|
@ -108,7 +105,7 @@ int main(int argc, char **argv)
|
|||
game_done();
|
||||
if (debug_sw)
|
||||
debug_done();
|
||||
SDL_Quit();
|
||||
gfx_done();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue