start in full screen with mouse grabbed
This commit is contained in:
parent
43004caffc
commit
a7321f73fb
17
src/main.rs
17
src/main.rs
|
@ -1,5 +1,10 @@
|
||||||
use bevy::{
|
use bevy::{
|
||||||
asset::LoadState,
|
asset::LoadState,
|
||||||
|
window::{
|
||||||
|
Window,
|
||||||
|
WindowMode,
|
||||||
|
PrimaryWindow,
|
||||||
|
},
|
||||||
core_pipeline::Skybox,
|
core_pipeline::Skybox,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
render::{
|
render::{
|
||||||
|
@ -35,8 +40,17 @@ const CUBEMAPS: &[(&str, CompressedImageFormats)] = &[
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
fn setup(
|
||||||
|
mut commands: Commands,
|
||||||
|
asset_server: Res<AssetServer>,
|
||||||
|
mut windows: Query<&mut Window, With<PrimaryWindow>>
|
||||||
|
) {
|
||||||
let skybox_handle = asset_server.load(CUBEMAPS[0].0);
|
let skybox_handle = asset_server.load(CUBEMAPS[0].0);
|
||||||
|
for mut window in &mut windows {
|
||||||
|
window.cursor.grab_mode = CursorGrabMode::Locked;
|
||||||
|
window.cursor.visible = false;
|
||||||
|
window.mode = WindowMode::Fullscreen;
|
||||||
|
}
|
||||||
// camera
|
// camera
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Camera3dBundle {
|
Camera3dBundle {
|
||||||
|
@ -233,6 +247,7 @@ fn run_camera_controller(
|
||||||
controller.yaw = yaw;
|
controller.yaw = yaw;
|
||||||
controller.pitch = pitch;
|
controller.pitch = pitch;
|
||||||
controller.initialized = true;
|
controller.initialized = true;
|
||||||
|
*toggle_cursor_grab = true;
|
||||||
info!("{}", *controller);
|
info!("{}", *controller);
|
||||||
}
|
}
|
||||||
if !controller.enabled {
|
if !controller.enabled {
|
||||||
|
|
Loading…
Reference in a new issue