Skip to content

Commit

Permalink
Fixed some lints
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed Feb 23, 2024
1 parent b4b36f9 commit 0799670
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 42 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ openxr = { workspace = true, features = [ "mint", "static" ] }
ndk-context = "0.1"
jni = "0.20"

[dev-dependencies]
color-eyre.workspace = true

[[example]]
name = "xr"
path = "examples/xr.rs"
Expand Down
54 changes: 14 additions & 40 deletions examples/demo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
use std::{f32::consts::PI, ops::Mul, time::Duration};
mod setup;

use std::time::Duration;

use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
ecs::schedule::ScheduleLabel,
input::{keyboard::KeyCode, ButtonInput},
log::info,
math::primitives::{Capsule3d, Cuboid},
prelude::{
bevy_main, default, shape, App, Assets, Color, Commands, Component, Entity, Event,
EventReader, EventWriter, FixedUpdate, Gizmos, GlobalTransform, IntoSystemConfigs,
IntoSystemSetConfigs, Mesh, PbrBundle, PostUpdate, Quat, Query, Res, ResMut, Resource,
Schedule, SpatialBundle, StandardMaterial, Startup, Transform, Update, Vec3, Vec3Swizzles,
With, Without, World,
bevy_main, default, App, Assets, Color, Commands, Component, Entity, Event, EventReader,
EventWriter, FixedUpdate, GlobalTransform, IntoSystemConfigs, IntoSystemSetConfigs, Mesh,
PbrBundle, PostUpdate, Query, Res, ResMut, Resource, Schedule, SpatialBundle,
StandardMaterial, Startup, Transform, Update, Vec3, With, Without, World,
},
render::mesh::Meshable,
time::{Fixed, Time, Timer, TimerMode},
transform::TransformSystem,
};
use bevy_oxr::{
graphics::{extensions::XrExtensions, XrAppInfo, XrPreferdBlendMode},
graphics::{extensions::XrExtensions, XrAppInfo},
input::XrInput,
resources::{XrFrameState, XrInstance, XrSession},
xr_init::{xr_only, XrStatus},
resources::{XrFrameState, XrSession},
xr_init::xr_only,
xr_input::{
actions::XrActionSets,
debug_gizmos::OpenXrDebugRenderer,
Expand All @@ -34,29 +34,12 @@ use bevy_oxr::{
},
oculus_touch::OculusController,
prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig},
trackers::{
OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker,
OpenXRTrackingRoot,
},
trackers::{OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker},
Hand,
},
DefaultXrPlugins,
};

// fn input_stuff(
// keys: Res<Input<KeyCode>>,
// status: Res<XrEnableStatus>,
// mut request: EventWriter<XrEnableRequest>,
// ) {
// if keys.just_pressed(KeyCode::Space) {
// match status.into_inner() {
// XrEnableStatus::Enabled => request.send(XrEnableRequest::TryDisable),
// XrEnableStatus::Disabled => request.send(XrEnableRequest::TryEnable),
// }
// }
// }

mod setup;
use crate::setup::setup_scene;
use bevy_rapier3d::prelude::*;

Expand Down Expand Up @@ -376,7 +359,6 @@ fn update_physics_hands(
)>,
hand_query: Query<(&Transform, &HandBone, &Hand), Without<PhysicsHandBone>>,
time: Res<Time>,
mut gizmos: Gizmos,
) {
let matching = MatchingType::VelocityMatching;
//sanity check do we even have hands?
Expand Down Expand Up @@ -532,13 +514,6 @@ fn get_start_and_end_entities(
};
}

fn get_hand_res(res: &Res<'_, HandsResource>, hand: Hand) -> HandResource {
match hand {
Hand::Left => res.left.clone(),
Hand::Right => res.right.clone(),
}
}

#[derive(Event, Default)]
pub struct SpawnCubeRequest;

Expand All @@ -549,7 +524,6 @@ fn request_cube_spawn(
oculus_controller: Res<OculusController>,
frame_state: Res<XrFrameState>,
xr_input: Res<XrInput>,
instance: Res<XrInstance>,
session: Res<XrSession>,
mut writer: EventWriter<SpawnCubeRequest>,
time: Res<Time>,
Expand Down Expand Up @@ -580,7 +554,7 @@ fn cube_spawner(
mut materials: ResMut<Assets<StandardMaterial>>,
mut events: EventReader<SpawnCubeRequest>,
) {
for request in events.read() {
for _request in events.read() {
// cube
commands.spawn((
PbrBundle {
Expand All @@ -607,15 +581,15 @@ fn prototype_interaction_input(
xr_input: Res<XrInput>,
session: Res<XrSession>,
mut right_interactor_query: Query<
(&mut XRInteractorState),
&mut XRInteractorState,
(
With<XRDirectInteractor>,
With<OpenXRRightController>,
Without<OpenXRLeftController>,
),
>,
mut left_interactor_query: Query<
(&mut XRInteractorState),
&mut XRInteractorState,
(
With<XRDirectInteractor>,
With<OpenXRLeftController>,
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub enum Backend {
#[derive(Resource)]
struct DoPipelinedRendering;

fn clean_resources_render(mut cmds: &mut World) {
fn clean_resources_render(cmds: &mut World) {
// let session = cmds.remove_resource::<XrSession>().unwrap();
cmds.remove_resource::<XrSession>();
cmds.remove_resource::<XrResolution>();
Expand All @@ -207,7 +207,7 @@ fn clean_resources_render(mut cmds: &mut World) {
// }
warn!("Cleanup Resources Render");
}
fn clean_resources(mut cmds: &mut World) {
fn clean_resources(cmds: &mut World) {
cmds.remove_resource::<XrSession>();
cmds.remove_resource::<XrResolution>();
cmds.remove_resource::<XrFormat>();
Expand Down

0 comments on commit 0799670

Please sign in to comment.