Example project: Bitfighter - SDL 1.2 and 2.0 code running side-by-side

Hi,

I just thought I’d make a short post about finally completing
migration to SDL 2.0 a few weeks ago in our project, Bitfighter
(http://bitfighter.org); an OpenGL, 2D, space combat game.

I am only posting in hopes that it may be of use to anyone wishing to
see some example code. Specifically, we use the SDL input and video
sub-systems for our client.

Bitfighter compiles with both SDL 1.2 and 2.0 on Mac, Windows, and
Linux. It runs with full functionality with both SDL versions (albeit
slightly better with 2.0 and window handling on Mac and Windows.)
Right now we build as default at SDL 2.0 for Mac and Windows, but 1.2
for Linux (until distros start distributing 2.0…)

Our code repository is here:

Specific classes that may be of interest:

zap/Event.cpp
zap/Joystick.cpp
zap/VideoSystem.cpp
zap/Cursor.cpp

Enjoy, scoff, whatever. And thanks for a good library! :slight_smile:
D

Cool, thanks! This should be quite helpful. Bookmarked for later.On Tue, Apr 24, 2012 at 6:52 AM, D B wrote:

Hi,

I just thought I’d make a short post about finally completing
migration to SDL 2.0 a few weeks ago in our project, Bitfighter
(http://bitfighter.org); an OpenGL, 2D, space combat game.

I am only posting in hopes that it may be of use to anyone wishing to
see some example code. Specifically, we use the SDL input and video
sub-systems for our client.

Bitfighter compiles with both SDL 1.2 and 2.0 on Mac, Windows, and
Linux. It runs with full functionality with both SDL versions (albeit
slightly better with 2.0 and window handling on Mac and Windows.)
Right now we build as default at SDL 2.0 for Mac and Windows, but 1.2
for Linux (until distros start distributing 2.0…)

Our code repository is here:

https://code.google.com/p/bitfighter/source/checkout

Specific classes that may be of interest:

zap/Event.cpp
zap/Joystick.cpp
zap/VideoSystem.cpp
zap/Cursor.cpp

Enjoy, scoff, whatever. And thanks for a good library! :slight_smile:
D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Great! thanks
do you know more examples of open source SDL2 games/apps?On Thu, Apr 26, 2012 at 10:47 AM, Ren? Dudfield wrote:

Cool, thanks! This should be quite helpful. Bookmarked for later.

On Tue, Apr 24, 2012 at 6:52 AM, D B wrote:

Hi,

I just thought I’d make a short post about finally completing
migration to SDL 2.0 a few weeks ago in our project, Bitfighter
(http://bitfighter.org); an OpenGL, 2D, space combat game.

I am only posting in hopes that it may be of use to anyone wishing to
see some example code. Specifically, we use the SDL input and video
sub-systems for our client.

Bitfighter compiles with both SDL 1.2 and 2.0 on Mac, Windows, and
Linux. It runs with full functionality with both SDL versions (albeit
slightly better with 2.0 and window handling on Mac and Windows.)
Right now we build as default at SDL 2.0 for Mac and Windows, but 1.2
for Linux (until distros start distributing 2.0…)

Our code repository is here:

https://code.google.com/p/bitfighter/source/checkout

Specific classes that may be of interest:

zap/Event.cpp
zap/Joystick.cpp
zap/VideoSystem.cpp
zap/Cursor.cpp

Enjoy, scoff, whatever. And thanks for a good library! :slight_smile:
D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Great! thanks
do you know more examples of open source SDL2 games/apps?

Adonthell is also written to support both SDL and SDL2, preferring
SDL2 when available.

That’s the SDL backend
https://github.com/ksterker/adonthell/tree/master/src/gfx/sdl
https://github.com/ksterker/adonthell/tree/master/src/input/sdl

And here is SDL2
https://github.com/ksterker/adonthell/tree/master/src/gfx/sdl2
https://github.com/ksterker/adonthell/tree/master/src/input/sdl2

It’s using SDL_mixer for audio, so that code is the same for both SDL and SDL2
https://github.com/ksterker/adonthell/tree/master/src/audio/sdl

KaiOn Thu, Apr 26, 2012 at 9:56 AM, Meir Yanovich wrote:

Hedgewars engine supports SDL2 conditionally: the desktop version
still prefers sdl1.2 libraries while the sdl2 version is used on the
mobile port.
Have a look at http://code.google.com/p/hedgewars/source/browse/hedgewars/SDLh.pas
:slight_smile:

VittorioOn Thu, Apr 26, 2012 at 11:48 AM, Kai Sterker <kai.sterker at gmail.com> wrote:

On Thu, Apr 26, 2012 at 9:56 AM, Meir Yanovich wrote:

Great! thanks
do you know more examples of open source SDL2 games/apps?

Adonthell is also written to support both SDL and SDL2, preferring
SDL2 when available.

That’s the SDL backend
?https://github.com/ksterker/adonthell/tree/master/src/gfx/sdl
?https://github.com/ksterker/adonthell/tree/master/src/input/sdl

And here is SDL2
?https://github.com/ksterker/adonthell/tree/master/src/gfx/sdl2
?https://github.com/ksterker/adonthell/tree/master/src/input/sdl2

It’s using SDL_mixer for audio, so that code is the same for both SDL and SDL2
?https://github.com/ksterker/adonthell/tree/master/src/audio/sdl

Kai


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org