SFML community forums

Bindings - other languages => D => Topic started by: joelcnz on August 25, 2015, 07:46:35 am

Title: Text width, and sound
Post 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?
Title: Re: Text width, and sound
Post by: Hapax on August 25, 2015, 02:58:38 pm
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  ;)
Title: Re: Text width, and sound
Post by: Jebbs on August 25, 2015, 07:25:32 pm
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?

Quote
How do I get the width of a Text object's text?

Hapax is right about this one. That function should work.
Title: Re: Text width, and sound
Post by: joelcnz on August 26, 2015, 10:04:22 am
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.  ???
Title: Re: Text width, and sound
Post by: Hapax on August 26, 2015, 08:09:46 pm
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
Title: Re: Text width, and sound
Post by: Jesper Juhl on August 26, 2015, 09:51:25 pm
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
Title: Re: Text width, and sound
Post by: joelcnz on August 27, 2015, 03:13:12 am
Thanks for the replies.

I've gotten the object width et. working, thanks Hapax;

I mean to reply later, Jesper Juhl, thanks.
Title: Re: Text width, and sound
Post by: joelcnz on August 27, 2015, 09:39:42 am
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
Title: Re: Text width, and sound
Post by: Jebbs on August 27, 2015, 05:31:47 pm
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.