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