1
General / Custom cursor has low fps
« on: March 05, 2009, 04:11:05 pm »
I was searching this forum for a while but still didn't find answer to this question. I made simple program that has custom cursor(sprite moved to mouse position every frame) and when i move mouse it laggs(refreshes slowly). What am I doing wrong?
Code: [Select]
#include "SFML/Graphics.hpp"
int main(int charc, char* argv[])
{
sf::RenderWindow screen(sf::VideoMode(800, 600, 32), "asd");
sf::Event event;
screen.SetFramerateLimit(60);
screen.ShowMouseCursor(false);
sf::Sprite cur;
cur.SetScale(10.f, 10.f);
cur.SetColor(sf::Color::Red);
while (screen.IsOpened())
{
while (screen.GetEvent(event))
{
if (event.Type == sf::Event::Closed) screen.Close();
}
cur.SetPosition(screen.GetInput().GetMouseX(), screen.GetInput().GetMouseY() );
screen.Clear(sf::Color::Black);
screen.Draw(cur);
screen.Display();
}
return 0;
}