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

Author Topic: sf::Sleep doesn't do it's job on SFML 2  (Read 4337 times)

0 Members and 1 Guest are viewing this topic.

BorisDieKlinge

  • Newbie
  • *
  • Posts: 15
    • View Profile
sf::Sleep doesn't do it's job on SFML 2
« on: July 13, 2011, 04:45:29 am »
Due to the fact that SFML 1.6. didn't work on my PC anymore because of the known conflict with the ATI GraphicsCard Driver...
http://www.sfml-dev.org/forum/viewtopic.php?t=4550&highlight=
...i have to use SFML 2 since i don't want to use old drivers.

So I compiled the files for dynamic linking according to the "Tutorials for Version 2.0"

I use MS C++ 2010.
I compiled the example from "Compiling your first program":
http://www.sfml-dev.org/tutorials/1.6/start-vc.php

My Problem is that sf::Sleep doesn't do it's job.
There isn't a compiler error. Well there WAS a warning saying something like flout isn't the same as sf::Unit32. But this warning magically disappeared.

I can execute the Program und it shows me:
0, 1, 1, 1, 2, 2, 3, 4, 4, 4, 4, 4, 4, 4

Not what you would expect. Furthermore it shows me all this numbers right at the start since sf::Sleep doesn't do it's job.
    -may be because of this float != sf::Unit32 thing?




When I try to compile the "Graphics - Drawing simple shapes" graphics-shape.cpp  it tells me that "GetEvent" is not a element of "sf::RenderWindow" and it doesn't compile.

When I delete some of this lines it tells me that  "SetOutlineWidth" isn't a element of "sf::Shape". When I delete this line too it leaves me with:

Code: [Select]

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <iostream>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML Shapes");

// Clear screen
        App.Clear();

        // Draw predefined shapes
        App.Draw(sf::Shape::Line(10, 10, 710, 100, 15, sf::Color::Red));
        App.Draw(sf::Shape::Circle(200, 200, 100, sf::Color::Yellow, 10, sf::Color::Blue));
        App.Draw(sf::Shape::Rectangle(350, 200, 600, 350, sf::Color::Green));

        // Build a custom convex shape
        sf::Shape Polygon;
        Polygon.AddPoint(0, -50,  sf::Color(255, 0, 0),     sf::Color(0, 128, 128));
        Polygon.AddPoint(50, 0,   sf::Color(255, 85, 85),   sf::Color(0, 128, 128));
        Polygon.AddPoint(50, 50,  sf::Color(255, 170, 170), sf::Color(0, 128, 128));
        Polygon.AddPoint(0, 100,  sf::Color(255, 255, 255), sf::Color(0, 128, 128));
        Polygon.AddPoint(-50, 50, sf::Color(255, 170, 170), sf::Color(0, 128, 128));
        Polygon.AddPoint(-50, 0,  sf::Color(255, 85, 85),   sf::Color(0, 128, 128));

        // Disable filling and enable the outline
        Polygon.EnableFill(false);
        Polygon.EnableOutline(true);

        // We can still use the functions common to all SFML drawable objects
        Polygon.SetColor(sf::Color(255, 255, 255, 200));
        Polygon.Move(300, 300);
        Polygon.Scale(3, 2);
        Polygon.Rotate(45);

        // Draw it
        App.Draw(Polygon);

        // Finally, display the rendered frame on screen
        App.Display();

    return EXIT_SUCCESS;
}



This actually compiles and also runns. I can see that it draws all the Shapes as it is supposed to.

What could be the problem?
Could it be that I made a mistake when i compiled SFML2?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Sleep doesn't do it's job on SFML 2
« Reply #1 on: July 13, 2011, 07:45:45 am »
Many things have changed in SFML 2, so you should look at the online documentation. sf::Sleep now takes an integer number of milliseconds, GetEvent is PollEvent, etc...
Laurent Gomila - SFML developer

BorisDieKlinge

  • Newbie
  • *
  • Posts: 15
    • View Profile
sf::Sleep doesn't do it's job on SFML 2
« Reply #2 on: July 13, 2011, 12:16:57 pm »
I see. That's cool.
Thank you.

 

anything