Hey guys, I encountered a bit of an issue. I want to create a new renderWindow so I can manipulate images, but when I do it the screen flashes. It is different depending on the main window style (none, closed or fullscreen).
None/closed: the screen flashes for a really short (but noticeable) time and then regains focus
Fullscreen: the screen goes white for a really short (but noticeable) time and then regains focus
Both of them are a little bit annoying, but the fullscreen it is even worse, as the screen goes white for a moment.
I think it is because the new renderWindow gets the focus as it is a new window, but I don't know how to solve it. Tried using setVisible(false) but didn't work out as I wanted.
Minimal code:#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
//RenderWindow mainWindow(VideoMode(1680, 1050, 32), "SFML Windowed Fullscreen", sf::Style::None);
//RenderWindow mainWindow(VideoMode(1280, 720, 32), "SFML Windowed", sf::Style::Close);
RenderWindow mainWindow(VideoMode(1680, 1050, 32), "SFML Fullscreen", sf::Style::Fullscreen);
while (mainWindow.isOpen()){
Event event;
while (mainWindow.pollEvent(event)){
if (event.type == Event::KeyPressed && event.key.code == Keyboard::Escape){
mainWindow.close();
}
if(event.type == Event::KeyPressed && event.key.code == Keyboard::F){
RenderWindow newWindow(sf::VideoMode(320, 128, 32), "Creating character", sf::Style::None);
///do stuff with the newWindow, and then it is useless
newWindow.close();
}
}
mainWindow.clear();
///draw main window stuff
mainWindow.display();
}
return 0;
}
Note: My monitor goes up to 1680x1050, so that is my max resolution.
Any help, or hunches apprecieated!