Hi, firstly the code:
#include <iostream>
#include <sstream>
#include <SFML/Graphics.hpp>
using namespace std;
template <class T>
inline static string toString (const T& t) {
std::stringstream ss;
ss << t;
return ss.str();
}
int main() {
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML OpenGL");
sf::Clock Clock;
glClearColor(0.f, 0.f, 0.f, 0.f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
sf::Event Event;
sf::String fpsDisplay;
fpsDisplay.SetFont(sf::Font::GetDefaultFont());
fpsDisplay.Move(10,10);
App.SetFramerateLimit(60);
App.UseVerticalSync(true);
while (App.IsOpened()) {
fpsDisplay.SetText("FPS: " + toString(1/App.GetFrameTime()));
//cout << (1/App.GetFrameTime()) << endl;
while (App.GetEvent(Event)) {
//Irrelevant. An empty event polling will still cause a drop
if (Event.Type == sf::Event::Closed) {App.Close();}
}
App.SetActive();
glClear(GL_COLOR_BUFFER_BIT);
App.Draw(fpsDisplay);
App.Display();
}
return EXIT_SUCCESS;
}
Now, if I move my mouse wildly around in the window (just moving the mouse, not pressing anything), the frame rate drops from 60 to ~35-45. Is there a way around this or to fix this?
I don't want my game slowing down cause the user accidentally moves the mouse across the screen lol
Setup: SFML 1.5, VS Studio 2008, C++, Windows 7 64Bit
Thank you very much