Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Text width, and sound  (Read 14554 times)

0 Members and 1 Guest are viewing this topic.

joelcnz

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Text width, and sound
« 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?

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Text width, and sound
« Reply #1 on: August 25, 2015, 02:58:38 pm »
You may find that this documentation is of some use to you  ;)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Text width, and sound
« Reply #2 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.
DSFML - SFML for the D Programming Language.

joelcnz

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Text width, and sound
« Reply #3 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.  ???

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Text width, and sound
« Reply #4 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.
i.e. getLocalBounds().width
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Text width, and sound
« Reply #5 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
« Last Edit: August 26, 2015, 09:52:56 pm by Jesper Juhl »

joelcnz

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Text width, and sound
« Reply #6 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.

joelcnz

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Text width, and sound
« Reply #7 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
« Last Edit: August 27, 2015, 10:54:30 am by joelcnz »

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Text width, and sound
« Reply #8 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.
DSFML - SFML for the D Programming Language.