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

Pages: [1]
1
General / Real-time inputs, rotate a square.
« on: March 12, 2011, 08:52:00 pm »
Hi.
I have some problems with input, when I try to rotate the square it stops for like 0.1 sec right after I press the key, and then it continue the rotation.

Code: [Select]

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main()
{

sf::RenderWindow Game(sf::VideoMode(640, 480, 32), "Rotate");
Game.SetFramerateLimit(64);

sf::Shape Firkant;

Firkant.AddPoint(300, 300);
Firkant.AddPoint(400, 300);
Firkant.AddPoint(400, 400);
Firkant.AddPoint(300, 400);
Firkant.SetCenter(350.0f,350.0f);
Firkant.Move(300.0f, 200.0f);

const sf::Input& Input = Game.GetInput();

while(Game.IsOpened())
{
sf::Event Event;

while(Game.GetEvent(Event))
{

if (Event.Type == sf::Event::Closed)
Game.Close();

if (Input.IsKeyDown(sf::Key::Down))
Firkant.Rotate(10);
}

Game.Clear();

Game.Draw(Firkant);

Game.Display();
}
return EXIT_SUCCESS;
}

2
General / New to SFML
« on: March 06, 2011, 01:09:50 pm »
Hi!
I just stumbeled across SFML and it seemed like it is an nice litte C++ API. However I am also pretty new to the C++ language, and I am getting some problems with the tutorials that I have been watching. I think it is because I do not really understand the linking stuff. First I watched , and I managed to get that one working. However I can't get this one working , because I'm not really sure what I need to add in the linkers and maybe more important why I need to add the additional stuff.

I'am also wondering what are the main differences between the SFML2 and SFML-1.6?

Pages: [1]
anything