SFML community forums
Bindings - other languages => D => Topic started by: joelcnz on August 25, 2015, 07:46:35 am
-
I'm using OSX. And have the less recommended DSFML (what do I call it?). And don't seem to have sound.
How do I get the width of a Text object's text?
-
You may find that this documentation (http://www.sfml-dev.org/documentation/2.3.1/classsf_1_1Text.php#a8a766ea03a1b8899cd1542765771a4ae) is of some use to you ;)
-
I'm using OSX. And have the less recommended DSFML (what do I call it?). And don't seem to have sound.
I'm not sure what you mean by this. Are you talking about the master branch and not the rc branch?
How do I get the width of a Text object's text?
Hapax is right about this one. That function should work.
-
I can't seem to get sound working on my version of DSFML? :(
What's an example with the bounding box? I can't figure it out. ???
-
What's an example with the bounding box? I can't figure it out. ???
The FloatRect that getLocalBounds() returns has a member called width (http://www.sfml-dev.org/documentation/2.3.1/classsf_1_1Rect.php#a4dd5b9d4333bebbc51bd309298fd500f).
i.e. getLocalBounds().width
-
I can't seem to get sound working on my version of DSFML? :(
Perhaps you could provide a bit more information.
Like; what SFML version are you using? Do you get any errors/warnings during compilation/runtime (check the console)? Does sound work for other applications?
Could you provide a complete and minimal example program that shows the problem that people can test (see: http://sscce.org/ )?
Also see http://www.catb.org/esr/faqs/smart-questions.html
-
Thanks for the replies.
I've gotten the object width et. working, thanks Hapax;
I mean to reply later, Jesper Juhl, thanks.
-
I'm using SFML 2.0 (going by the dynamic link files).
I got sound working! I added a import (import dsfml.audio) and added a dependency in the dub.json ("dsfml:audio": "~master").
I get this with the programs that work:
Joels-MacBook-Pro:AudioTest joelcnz$ dub
WARNING: A deprecated branch based version specification is used for the dependency dsfml:audio. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
WARNING: A deprecated branch based version specification is used for the dependency dsfml:graphics. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
Target dsfml:system ~master is up to date. Use --force to rebuild.
Building dsfml:audio ~master configuration "library", build type debug.
Running dmd...
Target dsfml:window ~master is up to date. Use --force to rebuild.
Target dsfml:graphics ~master is up to date. Use --force to rebuild.
Building dsfml-audio ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
Running ./dsfml-audio
-
I got sound working! I added a import (import dsfml.audio) and added a dependency in the dub.json ("dsfml:audio": "~master").
That'll do it. ;)
Those dub warnings are caused by using "master" directly, but with the next release I'll start tagging the repository with the version number. That should make it happy.