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