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