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