Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: White Window "flash" Screen - Windows 10  (Read 3540 times)

0 Members and 1 Guest are viewing this topic.

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
White Window "flash" Screen - Windows 10
« on: July 28, 2017, 05:03:24 pm »
When I create RenderWindow in OS Windows 10 - during some begin frames I see white color Window...
How to avoid this "flash effect", or change default window color while construct ?
« Last Edit: August 03, 2017, 11:42:33 am by Redee »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10044
    • View Profile
    • development blog
    • Email
Re: White Window Screen - Windows 10
« Reply #1 on: July 28, 2017, 05:11:05 pm »
You can clear/display once right after construction of the window and before you load all the resources and stuff.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: White Window Screen - Windows 10
« Reply #2 on: July 28, 2017, 09:03:58 pm »
no help - test yourself !!! and U will see..........
its some API windows settings........
how to tweak this I don't know

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: White Window Screen - Windows 10
« Reply #3 on: July 28, 2017, 09:07:40 pm »
at Windows XP I remember was VOID screen but at Win10 White....
If U don't want test I can understand this.... some time, some investigate, some test, some fix....

Hapax

  • Hero Member
  • *****
  • Posts: 3047
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: White Window Screen - Windows 10
« Reply #4 on: July 28, 2017, 09:54:43 pm »
Normally, a window being created is a time when a user will allow minor imperfections. A little flash of white would seem perfectly acceptable to most end-users.

A few approaches to consider:

Reduce the time that the white appears.
Immediately clear and display the window after creation (as mentioned already by eXpl0it3r:
sf::RenderWindow window(sf::VideoMode(800, 600), "");
window.clear();
window.display();
This most likely will not remove the flash completely.

Animate the flash.
Spend a small amount of time fading from white to which ever colour you wish.
This does draw attention to its colour but also removes any sudden flicker in the eye.

Use a more direct approach.
Use OS-specific functions to control the window.
This may require creating the window manually and then "giving it to SFML" however it may be possible to just use an SFML window and apply OS-specific functions to it using its handle.

Create small and resize.
Just an hypothesis: create a window of size 1x1 (likely white but only a pixel), clear and display as mentioned earlier, then resize the window and clear and display again...
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: White Window Screen - Windows 10
« Reply #5 on: July 30, 2017, 11:37:02 pm »
Thank You.
Using last method still see "flash" - but much smaller white Rectangle at top-Left window corner.
Just about 110 x 20 px.

And some code to do this >>

Vector2u w_sZe(800, 600);
RenderWindow win;
win.create(VideoMode(0, 0), "My111");
Vector2i w_Pos = win.getPosition();
w_Pos.x -= w_sZe.x / 2;
w_Pos.y -= w_sZe.y / 2;
win.setPosition(w_Pos);
win.setSize(w_sZe);
« Last Edit: July 31, 2017, 12:07:08 am by Redee »

Hapax

  • Hero Member
  • *****
  • Posts: 3047
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: White Window Screen - Windows 10
« Reply #6 on: July 31, 2017, 12:26:05 pm »
The final method would only really work if the window is borderless since the plan is to make it a single pixel and therefore not noticable. However, if it's borderless, changing it to bordered would require recreating the window so it doesn't help.

If the flash is still bothering you, you could move the window off the desktop immediately (changing its position should be very fast) and then reposition it once it's ready:
        sf::RenderWindow window(sf::VideoMode(800, 600), "No White Window Flash", sf::Style::Default);
        const sf::Vector2i windowPosition{ window.getPosition() };
        window.setPosition({ -2000, -2000 });
        window.clear();
        window.display();
        window.setPosition(windowPosition);
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10044
    • View Profile
    • development blog
    • Email
Re: White Window Screen - Windows 10
« Reply #7 on: July 31, 2017, 12:51:10 pm »
In my opinion you're spending way too much time on something that's not even remotely important. Have you ever started any games, especially ones from AAA studios? They all open awkwardly for a few seconds.

I bet there are a lot more important features to work on for your game/application. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: White Window "flash" Screen - Windows 10
« Reply #8 on: August 03, 2017, 10:14:51 am »
eXpl0it3r in my opinion and opinion of Hapax its Very important - to not shock players eyes....
Hapax last method NOT work because need say to Window position on screen during Init window from OS.... but.... its maybe REAL logic to avoid "flash" and completely remove....
But its Wrong hack way ))...........
Thank You for Solutions !!!

SFML Team need to improve creation RenderWindow and do VOID screen background during Window creating from OS to avoid "flash white effect".....

YEEEEEEEEEEAAAAAAAAAAAHHHHH I found how AVOID !!!!!!!!!!!!!!!! ))))))))
Few seconds and U will see code....

RenderWindow win;
win.create(VideoMode(800, 600), "My111");
Vector2i w_Pos = win.getPosition();
win.setPosition(Vector2i(-700500, -700500));
win.clear();
win.display();
win.setPosition(w_Pos);
win.clear();
win.display();
« Last Edit: August 03, 2017, 11:44:27 am by Redee »

Hapax

  • Hero Member
  • *****
  • Posts: 3047
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: White Window "flash" Screen - Windows 10
« Reply #9 on: August 04, 2017, 10:42:25 pm »
Not sure that I agree with it being that important, to be fair.
Normally, a window being created is a time when a user will allow minor imperfections. A little flash of white would seem perfectly acceptable to most end-users.
If the flash is still bothering you

I found how AVOID !!!!!!!!!!!!!!!!
[...]
(click to show/hide)
How is this different from what I suggested?
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: White Window "flash" Screen - Windows 10
« Reply #10 on: August 05, 2017, 04:11:13 pm »
Thx, some modifications +2 strings... to your solution...

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: White Window "flash" Screen - Windows 10
« Reply #11 on: February 08, 2018, 01:35:47 pm »
Final Solution to complete remove flash.

RenderWindow win;
Event ev;
Vector2i win_Pos_Scr;
const unsigned win_sZe_Origin_X = 600;
const unsigned win_sZe_Origin_Y = 550;

win.create(VideoMode(win_sZe_Origin_X, win_sZe_Origin_Y), "ReJewel", Style::Default);
win_Pos_Scr = win.getPosition();
win.setPosition(Vector2i(-700500, -700500));

// here need do trick with resize window
win.setSize(Vector2u(1, 1));
win.setSize(Vector2u(win_sZe_Origin_X, win_sZe_Origin_Y));

win.clear();
win.display();
win.setPosition(win_Pos_Scr);

// skip to not parse resize event
while (win.pollEvent(ev)) {}
« Last Edit: February 08, 2018, 02:35:32 pm by Redee »

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: White Window "flash" Screen - Windows 10
« Reply #12 on: February 22, 2020, 05:14:09 pm »
Much easier is edit WindowImplWin32.cpp
And compile system, then window

////////////////////////////////////////////////////////////
void WindowImplWin32::registerWindowClass()
{
    // ...
    //windowClass.hbrBackground = 0;
    windowClass.hbrBackground = CreateSolidBrush(RGB(0,0,0));
    // ...
}