mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-13 23:52:55 +00:00
fmt
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
use bevy::{
|
||||
app::{App, Plugin, PostUpdate, Update},
|
||||
asset::{Asset, AssetApp, AssetEvent, Assets, Handle},
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
use std::fmt;
|
||||
|
||||
use bevy::{prelude::*, window::PrimaryWindow};
|
||||
use bevy_inspector_egui::{DefaultInspectorConfigPlugin};
|
||||
use bevy_inspector_egui::DefaultInspectorConfigPlugin;
|
||||
use bevy_mod_picking::debug::DebugPickingMode;
|
||||
use space_editor::{
|
||||
prelude::*,
|
||||
|
||||
+15
-4
@@ -78,9 +78,20 @@ fn log_input_actions(
|
||||
let mod_keys = [AltLeft, AltRight, ShiftLeft, ControlLeft, ControlRight]
|
||||
.into_iter()
|
||||
.collect::<HashSet<_>>();
|
||||
let action_keys = [KeyCode::KeyW, KeyCode::KeyA, KeyCode::KeyS, KeyCode::KeyD, KeyCode::KeyE, KeyCode::KeyQ, KeyCode::Escape, KeyCode::Quote, KeyCode::Delete, KeyCode::KeyF]
|
||||
.into_iter()
|
||||
.collect::<HashSet<_>>();
|
||||
let action_keys = [
|
||||
KeyCode::KeyW,
|
||||
KeyCode::KeyA,
|
||||
KeyCode::KeyS,
|
||||
KeyCode::KeyD,
|
||||
KeyCode::KeyE,
|
||||
KeyCode::KeyQ,
|
||||
KeyCode::Escape,
|
||||
KeyCode::Quote,
|
||||
KeyCode::Delete,
|
||||
KeyCode::KeyF,
|
||||
]
|
||||
.into_iter()
|
||||
.collect::<HashSet<_>>();
|
||||
|
||||
let keys_pressed = ri_keyboard.get_pressed().copied().collect::<HashSet<_>>();
|
||||
let keys_display = keys_pressed
|
||||
@@ -298,7 +309,7 @@ fn translate_fps_camera_events(
|
||||
mut input: EventWriter<InputAction>,
|
||||
) {
|
||||
// Camera Translation (FPS-like)
|
||||
|
||||
|
||||
let wasd_keys = [
|
||||
KeyCode::KeyW,
|
||||
KeyCode::KeyA,
|
||||
|
||||
@@ -44,12 +44,11 @@ pub(super) fn init_resources(
|
||||
mut ra_meshes: ResMut<Assets<Mesh>>,
|
||||
mut ra_mats: ResMut<Assets<GizmoMaterial>>,
|
||||
) {
|
||||
|
||||
let translate_line = ra_meshes.add(Cylinder {
|
||||
radius: 0.03,
|
||||
half_height: 0.4,
|
||||
});
|
||||
|
||||
|
||||
let translate_arrow = ra_meshes.add(Mesh::from(geo::Cone {
|
||||
radius: 0.115,
|
||||
length: 0.4,
|
||||
|
||||
+1
-4
@@ -1,9 +1,6 @@
|
||||
#![allow(clippy::type_complexity, clippy::too_many_arguments)]
|
||||
|
||||
use bevy::{
|
||||
app::PluginGroupBuilder,
|
||||
prelude::*,
|
||||
};
|
||||
use bevy::{app::PluginGroupBuilder, prelude::*};
|
||||
use bevy_mod_picking::DefaultPickingPlugins;
|
||||
use bevy_web_asset::WebAssetPlugin;
|
||||
use scene::ImportSceneEvent;
|
||||
|
||||
+7
-10
@@ -104,10 +104,7 @@ impl Plugin for ScenePlugin {
|
||||
),
|
||||
);
|
||||
|
||||
app.add_systems(
|
||||
PreUpdate,
|
||||
check_loading
|
||||
);
|
||||
app.add_systems(PreUpdate, check_loading);
|
||||
|
||||
//setup default light
|
||||
app.add_systems(Startup, minimal_scene_setup);
|
||||
@@ -185,20 +182,22 @@ pub struct LoadingQueue {
|
||||
}
|
||||
|
||||
fn check_loading(
|
||||
mut frames_without_loading : Local<usize>,
|
||||
mut frames_without_loading: Local<usize>,
|
||||
mut loading_queue: ResMut<LoadingQueue>,
|
||||
mut st_next: ResMut<NextState<SceneState>>,
|
||||
r_scene_state: Res<State<SceneState>>,
|
||||
asset_server: Res<AssetServer>,
|
||||
) {
|
||||
|
||||
info!("Checking loading: {}", *frames_without_loading);
|
||||
// Avoid transitioning from `SceneState::None` directly to `SceneState::Active`.
|
||||
// We will always be initializing the scene with _something_, so if the
|
||||
// `LoadingQueue` is empty when we're in `SceneState::None`, it just means
|
||||
// our startup routine hasn't yet gotten to the point of processing any
|
||||
// `Handle<T>`s.
|
||||
if loading_queue.queue.is_empty() && **r_scene_state == SceneState::Loading && *frames_without_loading > 100 {
|
||||
if loading_queue.queue.is_empty()
|
||||
&& **r_scene_state == SceneState::Loading
|
||||
&& *frames_without_loading > 100
|
||||
{
|
||||
st_next.set(SceneState::Active);
|
||||
return;
|
||||
}
|
||||
@@ -216,9 +215,7 @@ fn check_loading(
|
||||
info!("Loading {} assets", loading_queue.queue.len());
|
||||
|
||||
loading_queue.queue.retain(|h| {
|
||||
if let Some((load_state, dep_load_state, _)) =
|
||||
asset_server.get_load_states(h.id())
|
||||
{
|
||||
if let Some((load_state, dep_load_state, _)) = asset_server.get_load_states(h.id()) {
|
||||
if load_state == LoadState::NotLoaded {
|
||||
not_loaded_count += 1;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
use bevy::{
|
||||
app::AppExit,
|
||||
core_pipeline::{core_3d, prepass::ViewPrepassTextures},
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
use bevy::{
|
||||
asset::LoadState,
|
||||
prelude::*,
|
||||
};
|
||||
use bevy::{asset::LoadState, prelude::*};
|
||||
|
||||
use crate::MainCamera;
|
||||
|
||||
|
||||
@@ -11,9 +11,12 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_json::{self, json, Map as JsonMap, Value as JsonValue};
|
||||
use space_editor::{
|
||||
space_editor_ui::{
|
||||
editor_tab::{EditorTab, EditorTabName}, ui_plugin::EditorUiAppExt
|
||||
editor_tab::{EditorTab, EditorTabName},
|
||||
ui_plugin::EditorUiAppExt,
|
||||
},
|
||||
space_prefab::{
|
||||
component::MeshPrimitive3dPrefab, editor_registry::EditorRegistryExt, save::SaveState,
|
||||
},
|
||||
space_prefab::{component::MeshPrimitive3dPrefab, editor_registry::EditorRegistryExt, save::SaveState},
|
||||
};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
|
||||
+11
-5
@@ -51,7 +51,10 @@ pub mod wasm {
|
||||
use bevy::{prelude::*, render::camera::Viewport};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
use crate::{wasm::{StaticBuffer, WasmMessageBuffer}, MainCamera};
|
||||
use crate::{
|
||||
wasm::{StaticBuffer, WasmMessageBuffer},
|
||||
MainCamera,
|
||||
};
|
||||
|
||||
use super::ViewportSize;
|
||||
|
||||
@@ -66,9 +69,9 @@ pub mod wasm {
|
||||
|
||||
impl Plugin for ViewportPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_event::<ViewportResizeEvent>()
|
||||
.add_systems(PreUpdate,
|
||||
(dispatch_resize_events, sync_window_to_viewport).chain()
|
||||
app.add_event::<ViewportResizeEvent>().add_systems(
|
||||
PreUpdate,
|
||||
(dispatch_resize_events, sync_window_to_viewport).chain(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +98,10 @@ pub mod wasm {
|
||||
fn dispatch_resize_events(mut events: EventWriter<ViewportResizeEvent>) {
|
||||
if let Some(resize) = RESIZE_BUF.take_message() {
|
||||
events.send(ViewportResizeEvent(resize));
|
||||
info!("Dispatch Viewport size: ({:.2}, {:.2})", resize.width, resize.height);
|
||||
info!(
|
||||
"Dispatch Viewport size: ({:.2}, {:.2})",
|
||||
resize.width, resize.height
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user