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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jukka

Pages: [1]
1
Graphics / Re: SFML Text bounding box & descenders
« on: November 06, 2015, 09:11:16 pm »
Huh, just upgraded to 2.3.2 and it seems to have been fixed. My bad, thanks!

(thread can be deleted if needed)

2
Graphics / SFML Text bounding box & descenders
« on: November 06, 2015, 06:38:46 pm »
Using SFML 2.1, I can visualise the global bounding box of a text object by doing:

    // "text" is an sf::Text object, "rec" is an sf::RectangleShape
    sf::FloatRect textBounds = text.getGlobalBounds();
    rec.setPosition(textBounds.left, textBounds.top);

    sf::Vector2f recSize(textBounds.width, textBounds.height);
    rec.setSize(recSize);
 

Setting the font to arial, font size to 50, setting the rectangle to red and rendering with text "abc" gives:



which seems correct (though the box is one pixel too high and wide which is not a massive problem).

When using capital letters, the bounding box adapts fine:



though the C seems one pixel too low oddly - again not a big deal.

A problem appears when using a "descender" letter - ie. a letter which hangs below the bottom of the text line like g, p or q:



it can't seem to handle the bounding box correctly. If I change the size so that:

sf::Vector2f recSize(textBounds.width, text.getCharacterSize());
 

then it is handled better:



But I can't use this method all the time because if the text doesn't have descenders, the bounding box is too big:



So, what's going on here? Am I using the wrong method to get an accurate bounding box for text? Or am I forced to use some ugly hack to check the text string for descenders and change the rectangle size accordingly? If that is the case it seems like SFML should handle that internally.

3
General discussions / Re: beginner mobile platform questions
« on: January 07, 2015, 11:33:35 am »
OK, thanks for the replies guys!

4
General discussions / beginner mobile platform questions
« on: January 05, 2015, 11:43:39 am »
Forgive these noob questions from someone who knows nothing about android/iOS. I have used SFML to make a couple of old game clones and it's really fun to use. I'm wondering whether to continue to invest time with the end goal of releasing games for mobiles....

1) Could the same SFML game code be used to compiled for android and ios, without platform-dependent changes required?

2) I realise the support is experimental at the moment and maybe contains bugs, but could anyone make a tentative guess about when SFML will support mobile platforms in a stable manner? e.g. in a year's time could I release a professional standard stable game for android & iOS using SFML ?

Thanks a lot

Pages: [1]