C++ binding

Well, we have a C# binding.
Sure, the C API works great with C++ out of the box, but there are some
things that could be done more conveniently.
A quick google fails to locate any C++ bindings / wrappers of the C API; so
I wonder if anybody is interested in it.

The benefits of C++:

  • RAII <3
  • Easier to use API for renderers
  • Anything you want to add?

The idea is to make a thin but elegant wrapper that could be (at least
mostly) optimized out by the compiler. This would make programming with SDL
a lot more fun.

If there’s sufficient interest, then I think I’ll work on that.

Google harder and search this mailinglist, I think there are several C++
bindings :wink:

Cheers,
DanielAm 26.02.2014 03:00, schrieb Ivan Rubinson:

Well, we have a C# binding.
Sure, the C API works great with C++ out of the box, but there are some
things that could be done more conveniently.
A quick google fails to locate any C++ bindings / wrappers of the C API;
so I wonder if anybody is interested in it.

The benefits of C++:

  • RAII <3
  • Easier to use API for renderers
  • Anything you want to add?

The idea is to make a thin but elegant wrapper that could be (at least
mostly) optimized out by the compiler. This would make programming with
SDL a lot more fun.

If there’s sufficient interest, then I think I’ll work on that.


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

Are there any actively developed ones?
The best I found has it’s last commit be 1 month ago.On 26 February 2014 04:03, Daniel Gibson wrote:

Google harder and search this mailinglist, I think there are several C++
bindings :wink:

Cheers,
Daniel

Am 26.02.2014 03:00, schrieb Ivan Rubinson:

Well, we have a C# binding.
Sure, the C API works great with C++ out of the box, but there are some
things that could be done more conveniently.
A quick google fails to locate any C++ bindings / wrappers of the C API;
so I wonder if anybody is interested in it.

The benefits of C++:

  • RAII <3
  • Easier to use API for renderers
  • Anything you want to add?

The idea is to make a thin but elegant wrapper that could be (at least
mostly) optimized out by the compiler. This would make programming with
SDL a lot more fun.

If there’s sufficient interest, then I think I’ll work on that.


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

If there was one I would try it out. Maybe you could just convert an sdl
wrapper to an SDL 2 wrapper?

I don’t like unmaintained repositories.On 26 February 2014 06:42, R Manard wrote:

If there was one I would try it out. Maybe you could just convert an sdl
wrapper to an SDL 2 wrapper?


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

I actively develop a c++ interface for SDL2 in SDLU (the sdl utility library – http://bitbucket.org/sdlu/sdlu). I’m from the phone right now, so look in README-CXX for details.

Practically, it’s nothing fancy, just a few classes that wrap SDL_Window, SDL_Renderer, SDL_Texture and SDL_RWops. I recently released SDLU v2.1. Have a look at that :slight_smile:

– Aggelos KolaitisOn 26 ??? 2014, at 4:00 ?.?., Ivan Rubinson wrote:

Well, we have a C# binding.
Sure, the C API works great with C++ out of the box, but there are some things that could be done more conveniently.
A quick google fails to locate any C++ bindings / wrappers of the C API; so I wonder if anybody is interested in it.

The benefits of C++:

  • RAII <3
  • Easier to use API for renderers
  • Anything you want to add?

The idea is to make a thin but elegant wrapper that could be (at least mostly) optimized out by the compiler. This would make programming with SDL a lot more fun.

If there’s sufficient interest, then I think I’ll work on that.


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

In my opinion, C++ has so many established ways and styles to do the same
thing that it is tough for a wrapper to be useful to more than a few
programmers.

You might feel differently, but I say that if your own C++ stuff that
supplements/augments SDL feels good to you, be content for your own sake
until you really think it adds significant value for others. Don’t take
this as an attack on anyone’s work, just my feeling about wrappers where
the C API is compatible.

Jonny D

  • Ivan Rubinson (soryy708 at gmail.com) wrote:

Sure, the C API works great with C++ out of the box, but there are some
things that could be done more conveniently.
A quick google fails to locate any C++ bindings / wrappers of the C API; so
I wonder if anybody is interested in it.

The benefits of C++:

  • RAII <3
  • Easier to use API for renderers
  • Anything you want to add?
  • Better error handling

The idea is to make a thin but elegant wrapper that could be (at least
mostly) optimized out by the compiler. This would make programming with SDL
a lot more fun.

If there’s sufficient interest, then I think I’ll work on that.

You may find my work useful:

it doesn’t currently have completeness as a goal as I’ve only
implemented what I needed myself, however I’ll gladly add functionality
if it’s needed for someone else.

For now, it wraps a (small) subset of window and renderer-related
functions, however with full support for raii, move semantics, error
checking, also with simple testing framework and with some simple
demos. Info on completeness is in the wiki.–
Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D
@Dmitry_Marakasov …: jabber: amdmi3 at jabber.ru http://www.amdmi3.ru

  • Ivan Rubinson (soryy708 at gmail.com) wrote:

Sure, the C API works great with C++ out of the box, but there are some
things that could be done more conveniently.
A quick google fails to locate any C++ bindings / wrappers of the C API; so
I wonder if anybody is interested in it.

The benefits of C++:

  • RAII <3
  • Easier to use API for renderers
  • Anything you want to add?
  • Better error handling

The idea is to make a thin but elegant wrapper that could be (at least
mostly) optimized out by the compiler. This would make programming with SDL
a lot more fun.

If there’s sufficient interest, then I think I’ll work on that.
You may find my work useful:

https://github.com/AMDmi3/libSDL2pp

Hi,

The binding looks great, however I saw that you used raw pointer of
SDL_Window in the Window class. You disable the copy constructor. I
would rather use a std::unique_ptr<> with the custom deleter for that
purpose or better a std::shared_ptr so that Window can be safely copied
and destroyed when required.

Regards,
David.On 26/02/2014 18:42, Dmitry Marakasov wrote: