digitalmars.D.learn - Mixing libraries
- Jordan Wilson (10/10) Feb 28 2017 Hello,
- Mike Parker (2/13) Feb 28 2017 No. Entirely up to you.
- bauss (4/15) Mar 01 2017 There is a better binding.
- Mike Parker (8/11) Mar 01 2017 DSFML technically is not a binding (even though it says such on
- Jordan Wilson (9/23) Mar 01 2017 Ah yes, I think you explain the difference between
- Mike Parker (13/21) Mar 01 2017 Yes, that's what wrappers are for :-) Plenty of people have built
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
Feb 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, JordanNo. Entirely up to you.
Feb 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, JordanThere is a better binding. dsfml. You can find it here: http://dsfml.com/
Mar 01 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.
Mar 01 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: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).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.
Mar 01 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.
Mar 01 2017