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

Pages: [1]
Window / Mouse Button retrive information
« on: December 03, 2012, 01:03:05 pm »

i want to find out if any Mousebutton is Down. Is there a more elegant way of doing it than this?
if(myMouse.isButtonPressed(sf::Mouse::Left) || myMouse.isButtonPressed(sf::Mouse::Right) || ...)  {

Graphics / SFML 2.0 and Custom Shape
« on: November 30, 2012, 01:57:49 pm »
Hi, i tried to implement a Custom Shape:

class Hexagon : public sf::Shape {
                        static std::vector<sf::Vector2f> m_Coordinates;
                        virtual unsigned int getPointCount() const {
                                return 6;

                        virtual sf::Vector2f getPoint(unsigned int index) const {
                                return m_Coordinates[index];

//In the Constructor
        if(m_Coordinates.empty()) {
                //More Details in image /Misc/hex_geometry.jpg
                const float s = 1.f;
                const float h = 0.5f;                   //sin(30°)
                const float r = 0.86602540f;    //cos(30°)

                m_Coordinates.push_back(sf::Vector2f(0.f, -s)); //Top
                m_Coordinates.push_back(sf::Vector2f( +r, -h)); //Top-Right
                m_Coordinates.push_back(sf::Vector2f( +r, +h)); //Bottom-Right
                m_Coordinates.push_back(sf::Vector2f(0.f, +s)); //Bottom
                m_Coordinates.push_back(sf::Vector2f( -r, +h)); //Bottom-Left
                m_Coordinates.push_back(sf::Vector2f( -r, -h)); //Top-Left

                Shape::scale(1000.f, 1000.f);
                Shape::setFillColor(sf::Color(255.f, 0.f, 0.f));
                Shape::setPosition(sf::Vector2f(200.f, 200.f));

but it won't appear if i use
Hexagon myShape;

i scaled it to 1000.f to be sure i can see it...

Pages: [1]