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

Author Topic: Shapes  (Read 3623 times)

0 Members and 1 Guest are viewing this topic.

Alex

  • Newbie
  • *
  • Posts: 2
    • View Profile
Shapes
« on: March 29, 2008, 10:33:00 pm »
So, I'm trying to use the new Shape class in the latest sfml svn, but I don't seem to be able to get anything to show up. Here's the test code I'm using to try to get it working. What am I doing wrong here?

Code: [Select]

#include <SFML/Graphics.hpp>
int main()
{
        // Create the main rendering window
        sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
        // Create line
        sf::Shape beam;
        beam.Line(65.f, 68.f, 400.f, 400.f, 20.f, sf::Color(255, 0, 255));
        // Start loop
        bool Running = true;
        while (Running)
        {
                // Process events
                sf::Event Event;
                while (App.GetEvent(Event))
                {
                        // Close window : exit
                        if (Event.Type == sf::Event::Closed)
                                Running = false;
                }
                App.Draw(beam);
                // Display window contents on screen
                App.Display();
        }
        return EXIT_SUCCESS;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Shapes
« Reply #1 on: March 30, 2008, 07:15:08 am »
Line, Circle and Rectangle are static helper functions to get predefined shapes.
Code: [Select]
sf::Shape beam = sf::Shape::Line(...);
Laurent Gomila - SFML developer

Alex

  • Newbie
  • *
  • Posts: 2
    • View Profile
Shapes
« Reply #2 on: March 30, 2008, 07:49:32 am »
Ohh, that makes sense. Thanks!

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
Shapes
« Reply #3 on: March 30, 2008, 10:56:43 am »
The same error I did the first time I tried to use shapes :)

 

anything