Thread overview
Mixing libraries
Feb 28, 2017
Jordan Wilson
Feb 28, 2017
Mike Parker
Mar 01, 2017
bauss
Mar 02, 2017
Mike Parker
Mar 02, 2017
Jordan Wilson
Mar 02, 2017
Mike Parker
February 28, 2017
Hello,

Been trying to learn the Simple Fast Multimedia Library (SFML) using the Derelict bindings, and noticed some functionality is offered by both SFML and the std library (for example, sfClock and sfMutex).

Is there a general design principle of, say, use the std library whenever possible and only SFML when I have too? Or should I try to be consistent and use SFML library whenever possible?

Thanks,

Jordan
February 28, 2017
On Tuesday, 28 February 2017 at 20:08:25 UTC, Jordan Wilson wrote:
> Hello,
>
> Been trying to learn the Simple Fast Multimedia Library (SFML) using the Derelict bindings, and noticed some functionality is offered by both SFML and the std library (for example, sfClock and sfMutex).
>
> Is there a general design principle of, say, use the std library whenever possible and only SFML when I have too? Or should I try to be consistent and use SFML library whenever possible?
>
> Thanks,
>
> Jordan

No. Entirely up to you.

March 01, 2017
On Tuesday, 28 February 2017 at 20:08:25 UTC, Jordan Wilson wrote:
> Hello,
>
> Been trying to learn the Simple Fast Multimedia Library (SFML) using the Derelict bindings, and noticed some functionality is offered by both SFML and the std library (for example, sfClock and sfMutex).
>
> Is there a general design principle of, say, use the std library whenever possible and only SFML when I have too? Or should I try to be consistent and use SFML library whenever possible?
>
> Thanks,
>
> Jordan

There is a better binding.

dsfml.

You can find it here: http://dsfml.com/
March 02, 2017
On Wednesday, 1 March 2017 at 16:12:06 UTC, bauss wrote:

>
> There is a better binding.
>
> dsfml.
>
> You can find it here: http://dsfml.com/

DSFML technically is not a binding (even though it says such on the web site). It's a wrapper that D-ifies the SFML API. The SFML functions are not callable directly, as they are all declared privately. DerelictSFML is strictly a binding, with no attempt to wrap anything. A wrapper like DSFML could be implemented on top of DerelictSFML.

So yes, it's better if what you really want is a wrapper.
March 02, 2017
On Thursday, 2 March 2017 at 01:02:39 UTC, Mike Parker wrote:
> On Wednesday, 1 March 2017 at 16:12:06 UTC, bauss wrote:
>
>>
>> There is a better binding.
>>
>> dsfml.
>>
>> You can find it here: http://dsfml.com/
>
> DSFML technically is not a binding (even though it says such on the web site). It's a wrapper that D-ifies the SFML API. The SFML functions are not callable directly, as they are all declared privately. DerelictSFML is strictly a binding, with no attempt to wrap anything. A wrapper like DSFML could be implemented on top of DerelictSFML.
>
> So yes, it's better if what you really want is a wrapper.

Ah yes, I think you explain the difference between wrapper/binding in one of the Derelict docs.

I'm currently working through a ebook on Game Dev with SFML...the examples are all C++.
I don't have any trouble translating it to the equivalent C bindings (so far anyway), but perhaps in the long run using dsfml will be easier (for example, I found using Iup4d easier than the straight C Iup bindings).
March 02, 2017
On Thursday, 2 March 2017 at 02:27:03 UTC, Jordan Wilson wrote:

>
> Ah yes, I think you explain the difference between wrapper/binding in one of the Derelict docs.
>
> I'm currently working through a ebook on Game Dev with SFML...the examples are all C++.
> I don't have any trouble translating it to the equivalent C bindings (so far anyway), but perhaps in the long run using dsfml will be easier (for example, I found using Iup4d easier than the straight C Iup bindings).

Yes, that's what wrappers are for :-) Plenty of people have built wrappers on top of the Derelict bindings. I have my own little SDL and GLFW wrappers I use for throw away projects. Makes the code cleaner and easier on the eyes (C APIs can be ugly).

Jeremy did a great job with DSFML. When I first implemented DerelictSFML, there was a DMD bug on Linux 64-bit that caused crashes when passing structs to functions by value, which bits of the CSFML API require. That made the binding effectively unusable on Linux. Jeremy implemented his own C binding (DSFML-C) which eliminated the pass-by-value bits and then built DSFML on top of that. IIRC the bug has been fixed since then, so I don't know if DSFML is using CSFML directly now or not.