summaryrefslogtreecommitdiff
path: root/sdl.c
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-01-02 19:19:48 +0000
committerrubidium <rubidium@openttd.org>2007-01-02 19:19:48 +0000
commit66bbf336c6af7353ef0aeed58002c46543b30635 (patch)
treead4a63860df2626b22f77e7dac712e958bea54cb /sdl.c
parentccc0a3f4dbf58c005b22341ac8874252924690cd (diff)
downloadopenttd-66bbf336c6af7353ef0aeed58002c46543b30635.tar.xz
(svn r7759) -Merge: makefile rewrite. This merge features:
- A proper ./configure, so everything needs to be configured only once, not for every make. - Usage of makedepend when available. This greatly reduces the time needed for generating the dependencies. - A generator for all project files. There is a single file with sources, which is used to generate Makefiles and the project files for MSVC. - Proper support for OSX universal binaries. - Object files for non-MSVC compiles are also placed in separate directories, making is faster to switch between debug and release compiles and it does not touch the directory with the source files. - Functionality to make a bundle of all needed files for for example a nightly or distribution of a binary with all needed GRFs and language files. Note: as this merge moves almost all files, it is recommended to make a backup of your working copy before updating your working copy.
Diffstat (limited to 'sdl.c')
-rw-r--r--sdl.c139
1 files changed, 0 insertions, 139 deletions
diff --git a/sdl.c b/sdl.c
deleted file mode 100644
index f6474b6e1..000000000
--- a/sdl.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* $Id$ */
-
-#include "stdafx.h"
-
-#ifdef WITH_SDL
-
-#include "openttd.h"
-#include "sdl.h"
-#include <SDL.h>
-
-#ifdef UNIX
-#include <signal.h>
-
-#ifdef __MORPHOS__
- // The system supplied definition of SIG_DFL is wrong on MorphOS
- #undef SIG_DFL
- #define SIG_DFL (void (*)(int))0
-#endif
-#endif
-
-static int _sdl_usage;
-
-#ifdef DYNAMICALLY_LOADED_SDL
-
-#include "win32.h"
-
-#define M(x) x "\0"
-static const char sdl_files[] =
- M("sdl.dll")
- M("SDL_Init")
- M("SDL_InitSubSystem")
- M("SDL_GetError")
- M("SDL_QuitSubSystem")
- M("SDL_UpdateRect")
- M("SDL_UpdateRects")
- M("SDL_SetColors")
- M("SDL_WM_SetCaption")
- M("SDL_ShowCursor")
- M("SDL_FreeSurface")
- M("SDL_PollEvent")
- M("SDL_WarpMouse")
- M("SDL_GetTicks")
- M("SDL_OpenAudio")
- M("SDL_PauseAudio")
- M("SDL_CloseAudio")
- M("SDL_LockSurface")
- M("SDL_UnlockSurface")
- M("SDL_GetModState")
- M("SDL_Delay")
- M("SDL_Quit")
- M("SDL_SetVideoMode")
- M("SDL_EnableKeyRepeat")
- M("SDL_EnableUNICODE")
- M("SDL_VideoDriverName")
- M("SDL_ListModes")
- M("SDL_GetKeyState")
- M("SDL_LoadBMP_RW")
- M("SDL_RWFromFile")
- M("SDL_SetColorKey")
- M("SDL_WM_SetIcon")
- M("SDL_MapRGB")
- M("")
-;
-#undef M
-
-SDLProcs sdl_proc;
-
-static const char *LoadSdlDLL(void)
-{
- if (sdl_proc.SDL_Init != NULL)
- return NULL;
- if (!LoadLibraryList((Function *)(void *)&sdl_proc, sdl_files))
- return "Unable to load sdl.dll";
- return NULL;
-}
-
-#endif // DYNAMICALLY_LOADED_SDL
-
-
-#ifdef UNIX
-static void SdlAbort(int sig)
-{
- /* Own hand-made parachute for the cases of failed assertions. */
- SDL_CALL SDL_Quit();
-
- switch (sig) {
- case SIGSEGV:
- case SIGFPE:
- signal(sig, SIG_DFL);
- raise(sig);
- break;
-
- default:
- break;
- }
-}
-#endif
-
-
-const char* SdlOpen(uint32 x)
-{
-#ifdef DYNAMICALLY_LOADED_SDL
- {
- const char *s = LoadSdlDLL();
- if (s != NULL) return s;
- }
-#endif
- if (_sdl_usage++ == 0) {
- if (SDL_CALL SDL_Init(x) == -1)
- return SDL_CALL SDL_GetError();
- } else if (x != 0) {
- if (SDL_CALL SDL_InitSubSystem(x) == -1)
- return SDL_CALL SDL_GetError();
- }
-
-#ifdef UNIX
- signal(SIGABRT, SdlAbort);
- signal(SIGSEGV, SdlAbort);
- signal(SIGFPE, SdlAbort);
-#endif
-
- return NULL;
-}
-
-void SdlClose(uint32 x)
-{
- if (x != 0)
- SDL_CALL SDL_QuitSubSystem(x);
- if (--_sdl_usage == 0) {
- SDL_CALL SDL_Quit();
- #ifdef UNIX
- signal(SIGABRT, SIG_DFL);
- signal(SIGSEGV, SIG_DFL);
- signal(SIGFPE, SIG_DFL);
- #endif
- }
-}
-
-#endif