Skip to content

Commit

Permalink
First attempt at replacement headers. Obviously a long way to go here…
Browse files Browse the repository at this point in the history
…. :)
  • Loading branch information
icculus committed May 24, 2021
1 parent ebcbb11 commit 7a71b8d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,22 @@ If you absolutely must have the real SDL 1.2 ("SDL 1.2 Classic"), please use
the source tree at https://github.com/libsdl-org/SDL-1.2, which occasionally
gets bug fixes but no formal release. But we strongly encourage you not to do
that.

# How to use:

- Build the library. This will need access to SDL2's headers, CMake
( https://cmake.org/ ) and the build tools of your choice. Once built, you
will have a drop-in replacement that can be used with any existing binary
that relies on SDL 1.2. You can copy this library over the existing 1.2 build,
or force it to take priority over a system copy with LD_LIBRARY_PATH, etc.
At runtime, sdl12-compat needs to be able to find a copy of SDL2, so plan to
include it with the library if necessary.

- If you want to build an SDL 1.2 program from source code, we have included
compatibility headers, so that sdl12-compat can completely replace SDL 1.2
at all points. These headers are just the bare minimum needed for source-level
compatibility and don't have a lot of documentation or fanciness at all. The
new headers are also under the zlib license. Note that sdl12-compat itself
does not use these headers, so if you just want the library, you don't need
them.

32 changes: 32 additions & 0 deletions include/SDL/SDL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

#ifdef __BUILDING_SDL12_COMPAT__
#error You should not use these headers to build sdl12-compat. Use the real SDL2 headers instead.
#endif

#ifndef _SDL_H
#define _SDL_H

#endif

/* vi: set ts=4 sw=4 expandtab: */

1 change: 1 addition & 0 deletions src/SDL12_compat_objc.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

/* This file contains some macOS-specific support code */

#define __BUILDING_SDL12_COMPAT__ 1
#include "SDL.h"

#ifdef __MACOSX__
Expand Down
1 change: 1 addition & 0 deletions src/SDL20_include_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
#define INCL_DOSMODULEMGR /* for Dos_LoadModule() & co. */
#endif

#define __BUILDING_SDL12_COMPAT__ 1
#include "SDL.h"
#include "SDL_syswm.h" /* includes windows.h for _WIN32, os2.h for __OS2__ */

Expand Down

0 comments on commit 7a71b8d

Please sign in to comment.