Re: Mixing libraries

2017-03-01 Thread Mike Parker via Digitalmars-d-learn

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.


Re: Mixing libraries

2017-03-01 Thread Jordan Wilson via Digitalmars-d-learn

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).


Re: Mixing libraries

2017-03-01 Thread Mike Parker via Digitalmars-d-learn

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.


Re: Mixing libraries

2017-03-01 Thread bauss via Digitalmars-d-learn

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/


Re: Mixing libraries

2017-02-28 Thread Mike Parker via Digitalmars-d-learn

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.



Mixing libraries

2017-02-28 Thread Jordan Wilson via Digitalmars-d-learn

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