
SDL 2.0.0 is out after many years in development - lifthrasiir
http://lists.libsdl.org/pipermail/sdl-libsdl.org/2013-August/089854.html
======
munchor
Lately I started using SFML instead of SDL for C++ Game Development. However,
I'll still use SDL on future projects I hope. It's a brilliant library, so
compact and portable that the games you write will be able to be compiled to a
lot of platforms, even high school graphing calculators[1].

The SDL development still impresses me and 2.0.0 is a major milestone and
multiple windows, new OpenGL, touch support, Android and iOS support are here
to keep SDL alive with all the new frameworks and "engines". I hope it does
well!

[1]:
[http://www.omnimaga.org/index.php?topic=12378.0](http://www.omnimaga.org/index.php?topic=12378.0)

~~~
winter_blue
I really like SFML, I've been using for a small game project of mine as well.
The API is just nice and beautiful.

I was wondering how SDL 2.0 stacks up against SFML? Does anyone know much
about it?

I'm only doing 2D game development, so SDL's " _simple 2D rendering API that
can use Direct3D, OpenGL, OpenGL ES, or software rendering behind the scenes_
" is perfect for my needs. However it needs to support two basic things:

* Rotation (additional matrix transformation like scaling & shearing would be nice as as well)

* Transparency (being able to apply a color filter not necessarily limited to the alpha channel, like an RGBA filter would be nicer)

Does it support the above? (I'm guessing it does -- just want to be sure.)

Also, I know Android/iOS support for SFML is in the pipeline, but the fact
that it's not ready yet is another reason it might be good to switch to SDL 2.

~~~
lifthrasiir
Yes. SDL_RenderCopyEx and SDL_SetTextureAlphaMod is what you want.

~~~
winter_blue
Ah, thanks. SDL_RenderCopyEx seems like a very versatile function[1]. The 2D
Accelerated Rendering doc[2] seems to cover all my basic 2D rendering needs.
The wiki[3] is really nice, and I like the page listing APIs by category[4].

I think I'm going to switch to SDL, primarily for the Android/iOS support!

[1]
[http://wiki.libsdl.org/moin.fcg/SDL_RenderCopyEx](http://wiki.libsdl.org/moin.fcg/SDL_RenderCopyEx)

[2]
[http://wiki.libsdl.org/moin.fcg/CategoryRender](http://wiki.libsdl.org/moin.fcg/CategoryRender)

[3] [http://wiki.libsdl.org/moin.fcg/](http://wiki.libsdl.org/moin.fcg/)

[4]
[http://wiki.libsdl.org/moin.fcg/APIByCategory](http://wiki.libsdl.org/moin.fcg/APIByCategory)

------
chrisballinger
Looks like they changed their license from LGPL to zlib as well. I wonder if
this will increase adoption, or if it just was so Valve could use it in Steam
for Linux.

~~~
scoopr
Also pretty much required to get applications sdl to ios/android store.

~~~
tadfisher
The Play Store is pretty much license-agnostic. At least there is no policy
preventing GPL works that I know of.

~~~
rsynnott
While the FSF discourages use of the Android marketplace, they do say there's
no specific GPL conflict. Compliance is potentially a bit more of a pain for
the developer, of course; strictly speaking they have to make sure the LGPL-
covered code is available for download for three years after distribution
ends. They also strictly speaking have to provide a mechanism to re-assemble
the app; example here:
[http://sparrowmailapp.com/lgpl.php](http://sparrowmailapp.com/lgpl.php)
(though note that a lot of people just don't bother).

------
EzGraphs
From the About:

"Simple DirectMedia Layer is a cross-platform development library designed to
provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog and many
Humble Bundle games."

[http://www.libsdl.org/index.php](http://www.libsdl.org/index.php)

~~~
reidrac
Oh, yes. New website!

------
bloodorange
I remember using SDL more than a decade ago and in general it was a pleasant
experience. My only gripe was that it needs to hijacked the main loop.

Nevertheless, I will give it a shot again.

Good work Sam!

~~~
lifthrasiir
SDL_main is no longer mandatory (though it is still there); #define-ing
SDL_MAIN_HANDLED and calling SDL_SetMainReady once before SDL_Init is
sufficient now.

Edit: Ah, if the main loop you refer is SDL_Event loop, as exDM69 said, SDL
always supported passive event functions that can be called at your original
idle function. SDL 2.0 adds an active event watcher (SDL_AddEventWatch etc.)
as an alternative though.

~~~
pgz
That's great news, I always felt the whole SDL_main thing to be quite evil.

~~~
exDM69
> That's great news, I always felt the whole SDL_main thing to be quite evil.

Evil or not, it solves a practical problem that you would have to work around
if SDL did not. And AFAIK, you have always had the option of not using
SDL_main if you wish to solve the problem on your own.

On desktop platforms the program entry point is pretty easy to solve (main vs.
WinMain) with an SDL_main-style macro or command line args on win32 compilers.
But when you start working with iOS and Android, it gets more hairy.

~~~
pgz
On OS X main was wrapped in a function that made it work with the Finder
(manipulating an argv containing --psn).

It was annoying to me because I worked on a application that did the same
thing internally and where SDL was not a hard dependency. But well, it's not
that bad as I make it sound.

------
frozenport
I never understood SDL vs OpenGL. As somebody who does OpenGL why should I use
SDL?

~~~
mahmud
Isn't SDL the simplest, most portable way to use OpenGL?

OpenGL by itself is useless, it just does 3D graphics, and its GLUT library is
too bare-bones to be of much use. SDL is a good, portable chassis for OpenGL
application that don't need native GUI integration. An SDL OpenGL app will
compile and run almost anywhere, with minimal fuss. Compare that to using
OpenGL contexts inside platform-specific toolkits.

~~~
angersock
GLFW is an excellent library:

[http://www.glfw.org/](http://www.glfw.org/)

It's very, very barebones (just enough to GL up to do a thing), but it's quite
good in that role.

~~~
cfrss
Unfortunately, it is not yet available on Android and iOS. Also
[http://www.glfw.org/faq.html#12__what_is_glfw_not](http://www.glfw.org/faq.html#12__what_is_glfw_not)

~~~
eropple
The amount of code necessary to wire up a well-written application into iOS
and Android is pretty minor. I'd rather do that where I can't use GLFW (I
mean, GLEW does most of the hard work anyway, and that _is_ portable). GLFW
epitomizes a good library for this stuff, in that it's minimal and minimizes
the amount of stuff you have to wrestle with when writing C++; on the other
hand, SDL forces you to come to grips with its weight and its own dubious
design decisions (and a _lot_ of plumbing code to make it sane in C++).

When wrapping OpenGL code myself, at least the dubious design decisions are my
own and I understand them intuitively.

------
dkersten
I used SDL 2 after Sam's "please use SDL 2 and report problems" email about 2
or 3 years ago and it was a pleasant experience and a much needed upgrade over
SDL 1 (though most of the docs were still incomplete). So this announcement
makes me happy.

------
SteveDeFacto
I have been using SDL2 for awhile now and it is a great library. It was
definitely not ready until now though. I still need to rewrite my game engine
to work with the current version. I am happy to hear this will be the last
rewrite though!

------
0xdeadbeefbabe
How does android and ios support work? What is the process for compiling and
using it from an objective C (ios) or java (android)?

------
thecodemonkey
Woo! I have been using SDL for years to build all sorts of projects (games,
touch screen interfaces, etc.).

But as others here have noted I migrated over to use SFML, mainly because of
its nice object-oriented implementation as well as the additional convenience
features such as rotation and better alpha support.

------
batiste
Great library. Simple to use and efficient. I have been using it for some
time. I have created a little TMX file reader aiming at game development. C is
hard but fun:

[https://github.com/batiste/sdl2-game-
loop](https://github.com/batiste/sdl2-game-loop)

------
jamesmiller5
Thought I'd share this comprehensive 36 chapter SDL game programming tutorial
series, though it is for SDL 1.
[http://lazyfoo.net/SDL_tutorials/](http://lazyfoo.net/SDL_tutorials/)

------
zokier
I wonder how SDL 2D rendering capabilities compare to SFML, now that they both
are OpenGL accelerated.

------
Aardwolf
Awesome work, I'm looking forward to use it! I always liked the combination of
SDL+OpenGL. Clipboard support is also very exciting because using X for that
in Linux is a nightmare :)

------
telephonetemp
If I start a new multimedia project today and aim to support the widest range
of devices should I use this version of SDL or 1.x?

~~~
aktau
Use SDL2, much better and official support for mobile platforms. The only
platforms that were killed in SDL2 are old ones like MacOS9 etc.

------
shmerl
What about OpenGL 4.x support? OpenGL 3.x is not enough already.

------
ambrop7
Let me guess: it's still impossible to minimize a full screen game on Linux or
alt-tab etc., and the joystick will still not be recognized if you plug it in
after the game starts.

~~~
exDM69
> Let me guess: it's still impossible to minimize a full screen game on Linux
> or alt-tab etc.

You can hardly blame SDL for this, games are not really what X11 was designed
for. Setting up full screen and asking for exclusive access to the keyboard
will prevent the window manager from doing anything to it.

My solution for this problem: use a window manager that can full screen any
window and switch back.

> and the joystick will still not be recognized if you plug it in after the
> game starts.

To be fair, 99% of AAA games don't support joystick hotplugging either. It's
really annoying.

Since you have not checked whether this is actually the situation and do not
properly understand the other components in the equation, I find your attitude
offensive.

~~~
ambrop7
> You can hardly blame SDL for this, games are not really what X11 was
> designed for.

It's funny how the Windows version of the game usually works just fine in
Wine, minimization and window switching included.

> Setting up full screen and asking for exclusive access to the keyboard will
> prevent the window manager from doing anything to it.

Then why are they asking for exclusive access to the keyboard in the first
place? X has rich input protocols (XInput2 was recently designed).

> Since you have not checked whether this is actually the situation

True, but I have read the changelog, and it doesn't mention any of these two
annoying problems to be fixed. Part of the reason I made this comment is to
see if someone else knows whether they were fixed.

~~~
anonymous
IIRC, there was a presentation by Valve where they complained that even if you
don't do a keyboard grab, some window managers do it for you when you request
a fullscreen window.

For an SDL2-using game, I tried BrütalLegend and alt-tab works as you'd expect
when using OpenBox. I usually just run games in a separate X server with just
OpenBox to isolate them from messing with my main desktop. Plus, they can't
block ctrl+alt+F7.

