* sdl.c *
***********************************************************/
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
#include "main.h"
#include "misc.h"
atexit(SDL_Quit);
/* open SDL video output device (window or fullscreen mode) */
- if (!SDLSetVideoMode(backbuffer, window))
+ if (!SDLSetVideoMode(backbuffer))
Error(ERR_EXIT, "setting video mode failed");
/* set window and icon title */
SDL_WM_SetCaption(WINDOW_TITLE_STRING, WINDOW_TITLE_STRING);
/* create additional buffer for double-buffering */
-
pix[PIX_DB_BACK] = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
/* SDL cannot directly draw to the visible video framebuffer like X11,
pix[PIX_DB_BACK] = *backbuffer; /* 'backbuffer' is SDL screen buffer */
}
-inline boolean SDLSetVideoMode(DrawBuffer *backbuffer, DrawWindow *window)
+inline boolean SDLSetVideoMode(DrawBuffer *backbuffer)
{
boolean success = TRUE;
SDL_MapRGB(surface->format, color_r, color_g, color_b));
}
-#endif /* USE_SDL_LIBRARY */
+inline boolean SDLInitAudio(void)
+{
+ if (SDL_Init(SDL_INIT_AUDIO) < 0)
+ {
+ Error(ERR_WARN, "SDL_Init() failed: %s", SDL_GetError());
+ return FALSE;
+ }
+
+ if (Mix_OpenAudio(22050, AUDIO_S16, 2, 512) < 0)
+ {
+ Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError());
+ return FALSE;
+ }
+
+ Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4);
+ Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4);
+
+ return TRUE;
+}
+
+#endif /* TARGET_SDL */