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

Pages: [1]
1
Graphics / Re: drawing std::map of vertices
« on: October 23, 2012, 09:43:23 pm »
Thanks, I'll probably use the alternative option then  ;)

2
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  :)

3
General / Re: sf::Clock does not work
« on: September 09, 2012, 03:59:59 pm »
Thanks, this works!
I have no idea how I missed this (it's in the documentation and my previous programs)...

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

5
Graphics / Drawing from class
« on: December 26, 2011, 02:54:02 pm »
I believe drawing fron other classes is done by passing a renderwindow pointer to the function that draws the sprites. Then you simply do: Renderwindow->draw(sprite);
As for mouse events, you should check the sfml documentation. It depends on the version of sfml (even though they are fairly similar).

6
General / SFML 2.0 GetInput()
« on: December 23, 2011, 06:13:16 pm »
Thanks, Laurent!
I am new to sfml and relatively new to programming.
I did not know you could get the coordinates this way!

7
General / SFML 2.0 GetInput()
« on: December 23, 2011, 05:38:33 pm »
You can find the equivalent code for sf::input in the sfml 2 documentation.

However, I would like to know why GetMouseX() and GetMouseY() have been replaced with GetPosition(), which returns a "Vector2i". It seems to me that this is less convenient.

8
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]
anything