Hello,
I created a new Window, with nothing drawn on it. The problem is that, when I move the window it moves sluggishly.
Problem occurs on Linux (Archlinux/Manjaro), my device has 2 graphics cards: integrated (intel hd 4000) and dedicated (NVidia GT650m).
I tested the same code on another device, also Linux Manjaro. I think that device has only 1 integrated card though. My program worked there and when I moved the window it was snappy and responsive.
EDIT: Also, note that other windows (for example Firefox) on my system work just fine. But when I run my program, moving them is slow too.
Code below, don't mind class name - it was only a test.
main.cpp:
int main()
{
KeyboardInput keyInput {};
keyInput.beginWaitingOnInput();
return 0;
}
KeyboardInput.cpp:
#include "SFML/Window/Keyboard.hpp"
#include "SFML/Window.hpp"
void getUserInput()
{
sf::Window window(sf::VideoMode(800, 600), "Window Title");
while(window.isOpen()) //to be moved elsewhere
{
sf::Event event;
while(window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
window.close();
}
window.display();
}
while(true) //to be used later
{
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
{
Game::gameState = GameState::Quit;
break;
}
}
}
KeyboardInput::~KeyboardInput()
{
if(inputThread.joinable())
inputThread.join();
}
void KeyboardInput::beginWaitingOnInput()
{
inputThread = std::thread{getUserInput};
}
What could be a problem here?