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 - phufhi

Pages: [1]
1
Graphics / drawing std::map of vertices
« on: October 23, 2012, 09:26:49 pm »
Is there any way to directly draw an std::map of vertexes with sf::RenderWindow?

By using a map instead of an array it's easier to adjust changing vertices.
This is because the positions of the vertices within the map are not dependent on when the vertices were added or changed.
The alternative would be to create a new vertex array every time a vertex changes.

I'm using SFML 2 by the way.

Thanks!

PS. If it's currently not possible, but not too hard to implement, please view this as a feature request  :)

2
General / sf::Clock does not work
« on: September 09, 2012, 03:51:10 pm »
Recently I got the newest version of SFML 2, but I couldn't get sf::Clock to work.
This code produces the error:
#include <SFML/Graphics.hpp>

int main()
{
    sf::Clock clock();
    sf::Time time = clock.getElapsedTime();

    return 0;
}

The compiler tells me this:
error: request for member 'getElapsedTime' in 'clock', which is of non-class type 'sf::Clock()'

note:
This does also not work with <SFML/System.hpp>

3
General / keeping window separated
« on: December 05, 2011, 10:18:02 pm »
Hello,


I am new to SFML, and I have a question about my code (it is for a game I'm making).
Currently, I have not included window in any of my classes. Only my main function has the window.
This leads to event-handling functions that take an events and draw functions that return a shape.
Some objects contain multiple shapes, which have to be drawn with a for loop. If I have multiple of these in a vector, I need two for loops.
My question is: Is this bad programming practice?
I originally thought it would be more organised this way, but I'm not sure if this will make everything more difficult later on.
Also, could it affect performance (speed & memory usage) because of all the passing of events and shapes? Is it worth changing?
I am not that far in the project, and if I will ever change it, now is probably the time.

Thanks in advance :D,


Phu


PS: what about timers? Should I have one central timer and pass it's value or should I have a timer for each object?
PPS: sorry for the many questions. :P

Pages: [1]