]> icculus.org git repositories - btb/d2x.git/blob - arch/sdl/init.c
This commit was manufactured by cvs2svn to create tag 'd2x-0_1_3'.
[btb/d2x.git] / arch / sdl / init.c
1 /*
2  * $Source: /cvs/cvsroot/d2x/arch/sdl/init.c,v $
3  * $Revision: 1.9 $
4  * $Author: bradleyb $
5  * $Date: 2002-07-16 22:37:14 $
6  *
7  * SDL architecture support
8  *
9  * $Log: not supported by cvs2svn $
10  * Revision 1.8  2001/12/03 02:45:02  bradleyb
11  * fix formatting
12  *
13  * Revision 1.7  2001/12/03 02:43:02  bradleyb
14  * lots of makefile fixes, and sdl joystick stuff
15  *
16  * Revision 1.6  2001/11/14 03:56:16  bradleyb
17  * SDL joystick stuff
18  *
19  * Revision 1.5  2001/10/31 07:41:54  bradleyb
20  * Sync with d1x
21  *
22  * Revision 1.4  2001/10/19 09:45:02  bradleyb
23  * Moved arch/sdl_* to arch/sdl
24  *
25  * Revision 1.4  2001/01/29 13:35:09  bradleyb
26  * Fixed build system, minor fixes
27  *
28  */
29
30 #ifdef HAVE_CONFIG_H
31 #include <conf.h>
32 #endif
33
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include <SDL/SDL.h>
37 #include "text.h"
38 #include "event.h"
39 #include "error.h"
40 #include "args.h"
41 #include "digi.h"
42
43 extern void d_mouse_init();
44
45 void sdl_close()
46 {
47         SDL_Quit();
48 }
49
50 void arch_sdl_init()
51 {
52         // Initialise the library
53         if (SDL_Init(SDL_INIT_JOYSTICK
54 #if defined(SDL_VIDEO) || defined(SDL_GL_VIDEO)
55                                  | SDL_INIT_VIDEO
56 #endif
57         ) < 0) {
58                 Error("SDL library initialisation failed: %s.",SDL_GetError());
59         }
60 #ifdef SDL_INPUT
61         if (!FindArg("-nomouse"))
62                 d_mouse_init();
63 #endif
64         if (!FindArg("-nosound"))
65                 digi_init();
66         atexit(sdl_close);
67 }