rusty_engine icon indicating copy to clipboard operation
rusty_engine copied to clipboard

how to change background color of gamewindow

Open indiVar0508 opened this issue 1 year ago • 1 comments

Hi

I was trying to build some game for a deep space, wanted to know , how can i change background color of game? currently i couldn't figure it out

    game.window_settings(Window {
         // background_color: Color::rgb( ... )
        ..Default::default()
    });

Thanks for help

indiVar0508 avatar Jun 15 '24 13:06 indiVar0508

Currently rusty_engine doesn't expose a way to change the background color!

You can work around it by making a solid-color image, loading it as a sprite, scaling it big enough to fill the window, and making sure it is on the bottom layer.

The reason it isn't exposed yet is that the background part is not part of Bevy's Window struct, where we'd kind of expect it to be. The reason it isn't part of the struct is that the "background color" is actually the "clear color" for the camera that is drawing into the window (you can have any number of cameras in Bevy, but Rusty Engine only creates one). I may add functionality to set that it, though. Maybe add it as a method like game.set_background_color(...) 😄 Since I kind of want to do that anyway, I'll leave this issue open as a reminder.

CleanCut avatar Jul 01 '24 22:07 CleanCut