SFML community forums
Bindings - other languages => D => Topic started by: Trass3r on December 28, 2009, 04:23:03 pm
-
Just to let you know, Derelict now includes bindings to v1.5 of the C API.
http://www.dsource.org/forums/viewtopic.php?t=4932
Remember that this is not a wrapper like DSFML, only the necessary function definitions etc. needed to directly use the C API from D.
-
What's the difference between a wrapper and bindings ?
-
What's the difference between a wrapper and bindings ?
AFAIK a wrapper will take care of some things for you, e.g. initialization/cleaning, conversion between specific types from C to D and vice-versa. With a binding, you have to do these things yourself. But correct me if I'm wrong, Trass3r :)
-
A binding is more or less a port of the header file to D so you can use the API.
A wrapper adds a layer on top of that to make it easier to use it, usually creating an OOP-based access model.
-
Can you show a striking example (or more) with SFML ? I have difficulties understanding what's so different about this.
-
CSFML needs to "flatten" the API because C doesn't understand OOP. So it creates single functions like Sprite_SetX(Sprite* this, x)
A binding simply makes these C functions accessible from D by making the necessary function definitions.
DSFML "converts" this flat API back to an OO one so that you again have a Sprite class with methods and so on
-
Are these bindings compatible with 1.6 or will I need to revert to the previous package?
-
Derelict still focuses on 1.x until 2.0 is finally released.
1.5 or 1.6 shouldn't make that much of a difference since it is a bugfix release mostly.