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.


Topics - alwayslearning

Pages: [1]
1
Graphics / Looking for a better design for drawing sprites in order.
« on: April 21, 2010, 11:02:20 pm »
The problem is, code execution order does not guarantee sprites will be drawn in order without some sort of method to track their levels, sort the sprites, and then drawing them.

What are your ways of doing this?

My method:
If the drawables need to be rendered they are added to a draw vector (only happens when set view == true, not every frame)
At the end of each frame, drawables on vector are sorted (std::sort), then merged with an in-order drawables list.
Then the list is iterated through executing windows::draw()

By the end, the draw list contains all the drawables rendered last frame in order, removing the need to continually adding, sorting sprites every frame.


If a drawable is no longer visible, it is removed from the list.
I use a map to do this rather than iterate through the list looking for the drawable.

2
Graphics / sf::string [1.6] is there a built in way to find height?
« on: April 14, 2010, 01:28:53 am »
What I am looking for is a means to finding the height where it includes the tail parts of symbols like q,p,g, etc.  The only way I can see doing that is to push all possible symbols onto the string and getting it from the rect.  Which doesn't sound like the right way to go about it.

Is there a simpler way?

3
Graphics / [solved]sf::events::TextEvent question
« on: April 13, 2010, 12:49:44 am »
Defined within TextEvent is Uint32 Unicode.

Is there an std type that can natively support the that type in the form of a string?  I'm currently using std::wstring, but warnings are making me cast to wchar_t when saving the event data to the wstring.  Or is wstring the best option?

I just want to make sure I'm not accidently casting away valid data.

4
Graphics / Question about sf::string 1.6
« on: April 11, 2010, 09:09:51 pm »
Firstly, I'd like to say, sfml is quite good.  I was using HGE and decided to make the switch last week and haven't had a single regret.

I have a few questions though.
Is there a way to modify the colors of individual characters within a sf::string?

Is there a trivial method to retrieve the widest character of font set at a specific size?

And lastly a trivial method of allowing me to edit strings?  Such as insert and remove characters? (otherwise, I'd have to use a std::list<char> to do it).

Thanks in advance.

Pages: [1]