From ed561d7f70f37f441b686540a822d77cf9f7d15c Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Thu, 4 Jun 2020 23:49:36 -0700 Subject: [PATCH] break up input examples --- Cargo.toml | 16 +++++++++---- .../{input_keyboard.rs => keyboard_input.rs} | 12 ++++++---- examples/input/keyboard_input_events.rs | 24 +++++++++++++++++++ examples/input/mouse_input.rs | 19 +++++++++++++++ .../{input_mouse.rs => mouse_input_events.rs} | 17 +++---------- 5 files changed, 65 insertions(+), 23 deletions(-) rename examples/input/{input_keyboard.rs => keyboard_input.rs} (87%) create mode 100644 examples/input/keyboard_input_events.rs create mode 100644 examples/input/mouse_input.rs rename examples/input/{input_mouse.rs => mouse_input_events.rs} (68%) diff --git a/Cargo.toml b/Cargo.toml index 8eeaaa45b3..d176a76302 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -152,12 +152,20 @@ name = "ecs_guide" path = "examples/ecs/ecs_guide.rs" [[example]] -name = "input_mouse" -path = "examples/input/input_mouse.rs" +name = "mouse_input" +path = "examples/input/mouse_input.rs" [[example]] -name = "input_keyboard" -path = "examples/input/input_keyboard.rs" +name = "mouse_input_events" +path = "examples/input/mouse_input_events.rs" + +[[example]] +name = "keyboard_input" +path = "examples/input/keyboard_input.rs" + +[[example]] +name = "keyboard_input_events" +path = "examples/input/keyboard_input_events.rs" [[example]] name = "load_scene" diff --git a/examples/input/input_keyboard.rs b/examples/input/keyboard_input.rs similarity index 87% rename from examples/input/input_keyboard.rs rename to examples/input/keyboard_input.rs index 35f517cce6..62c37e4911 100644 --- a/examples/input/input_keyboard.rs +++ b/examples/input/keyboard_input.rs @@ -1,5 +1,7 @@ -use bevy::{input::keyboard::KeyCode, prelude::*}; -use bevy_input::Input; +use bevy::{ + input::{keyboard::KeyCode, Input}, + prelude::*, +}; fn main() { App::build() @@ -9,7 +11,7 @@ fn main() { .run(); } -/// moves our cube left when the "left" key is pressed. moves it right when the "right" key is pressed +/// This system moves our cube left when the "left" key is pressed and moves it right when the "right" key is pressed fn move_on_input( world: &mut SubWorld, time: Res