Replies: 1 comment 2 replies
-
This behavior isn't specific to If you are using Windows, then this discussion is probably relevant: https://stackoverflow.com/questions/69715610/how-to-initialize-the-background-color-of-win32-app-to-something-other-than-whit Based on an idea in that thread, you can defer visibility of the window pretty easily: diff --git a/examples/minimal-tao/src/main.rs b/examples/minimal-tao/src/main.rs
index cf88501..8833e92 100644
--- a/examples/minimal-tao/src/main.rs
+++ b/examples/minimal-tao/src/main.rs
@@ -4,7 +4,7 @@
use log::error;
use pixels::{Error, Pixels, SurfaceTexture};
use tao::dpi::LogicalSize;
-use tao::event::{Event, KeyEvent, WindowEvent};
+use tao::event::{Event, KeyEvent, StartCause, WindowEvent};
use tao::event_loop::{ControlFlow, EventLoop};
use tao::keyboard::KeyCode;
use tao::menu::{MenuBar, MenuItem};
@@ -38,6 +38,7 @@ fn main() -> Result<(), Error> {
.with_menu(menu)
.with_inner_size(size)
.with_min_inner_size(size)
+ .with_visible(false)
.build(&event_loop)
.unwrap()
};
@@ -51,6 +52,7 @@ fn main() -> Result<(), Error> {
event_loop.run(move |event, _, control_flow| {
match event {
+ Event::NewEvents(StartCause::Init) => window.set_visible(true),
Event::WindowEvent { event, .. } => match event {
// Close events
WindowEvent::CloseRequested This seems to hide the flash of white background in both normal and fullscreen display modes. One of the side effects of deferring the visibility like this is that it changes the way the window animates. Maybe there is a way to reimplement the animation if you need it. You might be required to use platform-specific libraries to do so. |
Beta Was this translation helpful? Give feedback.
-
Hi,
When you run the
minimal-tao
example it starts all white in windowed mode, before rendering starts.However, if you change the example to full screen, most of the screen is the black border color and what seems to be the unsized pixel buffer is all white, before the example starts rendering the moving box.
It would be nice if the buffer matched the border color and even better if you can set an initial startup color.
Is this possible?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions