Feature: don't cap bevy framerate when out of focus #52
15
src/main.rs
15
src/main.rs
@@ -27,7 +27,7 @@ use bevy::render::settings::{Backends, RenderCreation, WgpuSettings};
|
||||
use bevy::render::{RenderDebugFlags, RenderPlugin};
|
||||
use bevy::scene::ScenePlugin;
|
||||
use bevy::window::{CompositeAlphaMode, PresentMode};
|
||||
use bevy::winit::{WakeUp, WinitPlugin};
|
||||
use bevy::winit::{WakeUp, WinitPlugin, WinitSettings, UpdateMode};
|
||||
use bevy_dmabuf::import::DmabufImportPlugin;
|
||||
use bevy_mod_openxr::action_set_attaching::OxrActionAttachingPlugin;
|
||||
use bevy_mod_openxr::action_set_syncing::OxrActionSyncingPlugin;
|
||||
@@ -315,10 +315,10 @@ fn bevy_loop(
|
||||
.async_compute
|
||||
.on_thread_spawn = Some(enter_runtime_context.clone());
|
||||
plugins = plugins.set(task_pool_plugin);
|
||||
if args.flatscreen
|
||||
let flatscreenmode = args.flatscreen
|
||||
|| std::env::var_os("DISPLAY").is_some_and(|s| !s.is_empty())
|
||||
|| std::env::var_os("WAYLAND_DISPLAY").is_some_and(|s| !s.is_empty())
|
||||
{
|
||||
|| std::env::var_os("WAYLAND_DISPLAY").is_some_and(|s| !s.is_empty());
|
||||
if flatscreenmode {
|
||||
let mut plugin = WinitPlugin::<WakeUp>::default();
|
||||
plugin.run_on_any_thread = true;
|
||||
plugins = plugins
|
||||
@@ -378,6 +378,13 @@ fn bevy_loop(
|
||||
}),
|
||||
|
|
||||
);
|
||||
|
||||
if flatscreenmode {
|
||||
app.insert_resource(WinitSettings {
|
||||
focused_mode: UpdateMode::Continuous,
|
||||
unfocused_mode: UpdateMode::Continuous,
|
||||
});
|
||||
}
|
||||
|
||||
app.add_plugins(bevy_sk::hand::HandPlugin);
|
||||
// app.add_plugins(HandGizmosPlugin);
|
||||
app.world_mut().resource_mut::<AmbientLight>().brightness = 1000.0;
|
||||
|
||||
Reference in New Issue
Block a user
i don't think there's a reason to gate this behind flatscreen mode? i think it would be better to just insert that resource always
If not in flatscreen mode bevy_oxr already inserts this resource:
https://github.com/awtterpip/bevy_oxr/blob/main/crates/bevy_openxr/src/openxr/init.rs