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

Author Topic: Just discovered this and converted to it, but...  (Read 5012 times)

0 Members and 1 Guest are viewing this topic.

Celtic Minstrel

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Just discovered this and converted to it, but...
« on: June 19, 2012, 07:44:08 am »
Not entirely sure if this is the right area of the forum to post this in...

So, I discovered the existence of this a day or two ago as a substitute for SDL, when I was looking into ways of improving rendering speed (I was rendering a lot of tiles per frame and the time for rendering was quite a bit longer than the time I had allotted for a frame; I did try optimizing my rendering within SDL first, and then tried OpenGL with SDL, but the first didn't help much and I had strange problems with OpenGL). Converting the project from SDL to SFML was quite an undertaking, and was not entirely straightforward, but it did at least improve the rendering speed even though my drawing is still pretty inefficient (I'm currently creating and immediately discarding around 500 or so Sprites per frame in the "blit" function I used to make the transition easier; I might look into using a VertexArray later for the tiles that don't change often).

However, I noticed a couple of missing features in the library (none of which are absolutely essential for me, fortunately), and I also had some problems linking with it. (I'm using the SFML 2.0 latest development snapshot from the downloads page.)

A new project with the Xcode templates worked fine, but my existing project could not locate a number of SFML symbols. I compared my project settings with the template settings, and eventually figured out that the key was in the standard C++ library; the templates linked against GCC's C++ library, whereas I was linking against LLVM's C++ library for the C++11 support. Once I had figured this out it wasn't too hard to rebuild SFML with the other library (by setting the CMAKE_CXX_FLAGS variable to -stdlib=libc++ when building), but I was wondering if this might become an option in the prebuilt libraries anytime soon?

Some of the keys I was handling with SDL are not supported in SFML. These are the enter key on the numeric keypad, and the clear key in the same area (which would be num lock on a Windows keyboard). I noticed the numpad equals and period keys are also missing, as well as caps lock and one or two others (older Apple keyboards have a Help key, for example). Also, while I don't really need this, you only support function keys up to 15; I have 19 function keys (I use an Apple flat extended keyboard, with an Fn key in place of Help/Insert). I only really care about Enter and Clear/NumLock, though. And, uh, this is just an aesthetic thing, but calling Backspace "Back" threw me off for a few moments.

While I don't especially need it at this point, it would be nice to add a Strikethrough style to the Text class. There's already an Underline, and strikethrough is almost the same as underline for rendering (just a line in a different place). And speaking of the Text class, it seems to strip leading and trailing whitespace from the input string, which led to a whole lot of issues with my formatted text rendering (with embedded images, even) until I wrote a workaround to account for it. I don't think it should strip whitespace like this.

One other thing... a lot of the classes have many attributes, but only one or two of them can be specified in the constructor, so it would be nice to make the setXYZ functions return (*this) so that you can chain calls. For example:
Code: [Select]
Text text = Text("my string").setSize(16).setColor(blue).setStyle(Text::Bold);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Just discovered this and converted to it, but...
« Reply #1 on: June 19, 2012, 08:13:02 am »
Your questions are already answered, either on this forum or in the task tracker.

Quote
One other thing... a lot of the classes have many attributes, but only one or two of them can be specified in the constructor, so it would be nice to make the setXYZ functions return (*this) so that you can chain calls.
What's the problem with
Text text("my string"); text.setSize(16); text.setColor(blue); text.setStyle(Text::Bold);
?

Allowing chained calls is a very specific feature, and to me "many attributes" is not a valid arguments for adding it to a class.
Laurent Gomila - SFML developer

Celtic Minstrel

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Just discovered this and converted to it, but...
« Reply #2 on: June 19, 2012, 08:45:33 am »
Your questions are already answered, either on this forum or in the task tracker.
Even the C++ library one? I was searching for quite awhile for clues towards that issue and didn't find anything mentioning anything to point me towards the actual solution.

Quote
One other thing... a lot of the classes have many attributes, but only one or two of them can be specified in the constructor, so it would be nice to make the setXYZ functions return (*this) so that you can chain calls.
What's the problem with
Text text("my string"); text.setSize(16); text.setColor(blue); text.setStyle(Text::Bold);
?

Allowing chained calls is a very specific feature, and to me "many attributes" is not a valid arguments for adding it to a class.

I suppose it's mostly just personal preference really. I generally prefer to initialize my objects all at once. But of course the existing method works fine, and is what I'm doing anyway.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Just discovered this and converted to it, but...
« Reply #3 on: June 19, 2012, 08:57:36 am »
Quote
Even the C++ library one?
You mean the -stdlib=libc++ thing? I don't know, I'm not in charge of OS X stuff :D
Laurent Gomila - SFML developer

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Just discovered this and converted to it, but...
« Reply #4 on: June 19, 2012, 03:04:07 pm »
Quote
A new project with the Xcode templates worked fine, but my existing project could not locate a number of SFML symbols. I compared my project settings with the template settings, and eventually figured out that the key was in the standard C++ library; the templates linked against GCC's C++ library, whereas I was linking against LLVM's C++ library for the C++11 support. Once I had figured this out it wasn't too hard to rebuild SFML with the other library (by setting the CMAKE_CXX_FLAGS variable to -stdlib=libc++ when building), but I was wondering if this might become an option in the prebuilt libraries anytime soon?

Thanks for pointing it out; I was unaware of such compilation errors. However, I don't think I'll provide a customized version of SFML for that. It would confuse people who don't know the difference and those who want to use libc++ can easily recompile SFML.

When clang & libc++ are set as default compiler & standard lib by Apple I'll see what should be done.

Unless you have good arguments against my decision, of course.  ;)
SFML / OS X developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Just discovered this and converted to it, but...
« Reply #5 on: June 19, 2012, 05:20:16 pm »
And, uh, this is just an aesthetic thing, but calling Backspace "Back" threw me off for a few moments.
That's true, why was it called like this? I think it's rarely enough used to justify the length. And as we're still in RC, it's no problem to change that :P
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Just discovered this and converted to it, but...
« Reply #6 on: June 19, 2012, 06:04:23 pm »
Quote
why was it called like this?
I just didn't know that there was such a difference between both in english ;D
Laurent Gomila - SFML developer

Celtic Minstrel

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Just discovered this and converted to it, but...
« Reply #7 on: June 19, 2012, 07:50:33 pm »
When clang & libc++ are set as default compiler & standard lib by Apple I'll see what should be done.

Unless you have good arguments against my decision, of course.  ;)
Nah, I more or less expected an answer like this. Would it be worth mentioning somewhere in the Xcode and compiling tutorials, though?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Just discovered this and converted to it, but...
« Reply #8 on: June 19, 2012, 08:15:30 pm »
Yes, that would make sens.
SFML / OS X developer

 

anything