diff --git a/Cargo.toml b/Cargo.toml index fb427ef803..6030abfe3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,7 +124,7 @@ crossbeam-channel = "0.3.1" derivative = "1.0" fern = { version = "0.5", features = ["colored"] } log = { version = "0.4.6", features = ["serde"] } -rayon = "1.0.2" +rayon = "1.1.0" rustc_version_runtime = "0.1" sentry = "0.15.4" winit = { version = "0.19", features = ["serde", "icon_loading"] } diff --git a/Jenkinsfile b/Jenkinsfile index 442b02841a..e7ddccaf71 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,38 +69,19 @@ pipeline { } } stage('Cargo Clippy') { - parallel { - stage("stable") { - environment { - RUSTFLAGS = "-D warnings" - } - agent { - docker { - image 'amethystrs/builder-linux:stable' - label 'docker' - } - } - steps { - echo 'Running Cargo clippy...' - sh 'cargo clippy --all --all-targets --features "vulkan sdl_controller json saveload"' - } - } - stage("nightly") { - environment { - RUSTFLAGS = "-D warnings" - } - agent { - docker { - image 'amethystrs/builder-linux:nightly' - label 'docker' - } - } - steps { - echo 'Running Cargo clippy...' - sh 'cargo clippy --all --all-targets --features "vulkan sdl_controller json saveload"' - } + environment { + RUSTFLAGS = "-D warnings" + } + agent { + docker { + image 'amethystrs/builder-linux:nightly' + label 'docker' } } + steps { + echo 'Running Cargo clippy...' + sh 'cargo clippy --all --all-targets --features "vulkan sdl_controller json saveload"' + } } // Separate stage for coverage to prevent race condition with the linux test stage (repo lock contention). stage('Coverage') { diff --git a/README.md b/README.md index 8af4576572..86f545cef0 100644 --- a/README.md +++ b/README.md @@ -106,8 +106,17 @@ For a full-blown "Hello World" tutorial check out the [Getting Started][gs] chap [gs]: https://book.amethyst.rs/stable/getting-started.html -There are also many open source games and prototypes being made with Amethyst. See our showcase in the regularly updated [Games Made With Amethyst][gmwa] thread on the community forum for some good sources of inspiration. +### Showcase games +Our official showcase games demonstrate larger, continuously developed game projects made with Amethyst: + +- [Evoli][evoli] - 3D, ecosystem simulator +- [Space Menace][menace] - 2D, action platformer + +For more examples see [Games Made With Amethyst][gmwa] topic on the community forum for some good sources of inspiration. + +[evoli]: https://github.com/amethyst/evoli +[menace]: https://github.com/amethyst/space-menace [gmwa]: https://community.amethyst.rs/t/games-made-with-amethyst/134 ## Dependencies @@ -123,7 +132,7 @@ $ pacman -Sy grep gcc pkgconfig openssl alsa-lib cmake make python3 freetype2 aw ### Debian/Ubuntu ``` -# apt install gcc pkg-config openssl libasound2-dev cmake build-essential python3 libfreetype6-dev libexpat1-dev libxcb-composite0-dev libssl-dev +# apt install gcc pkg-config openssl libasound2-dev cmake build-essential python3 libfreetype6-dev libexpat1-dev libxcb-composite0-dev libssl-dev libx11-dev ``` ### Fedora diff --git a/amethyst_assets/Cargo.toml b/amethyst_assets/Cargo.toml index f00bb65106..186061bd08 100644 --- a/amethyst_assets/Cargo.toml +++ b/amethyst_assets/Cargo.toml @@ -28,7 +28,7 @@ derivative = "1.0" fnv = "1" log = "0.4.6" parking_lot = "0.6" -rayon = "1.0.2" +rayon = "1.1.0" serde = { version = "1", features = ["derive"] } serde_json = { version = "1", optional = true } ron = "0.5" diff --git a/amethyst_core/Cargo.toml b/amethyst_core/Cargo.toml index b168af0a66..f9150ec826 100644 --- a/amethyst_core/Cargo.toml +++ b/amethyst_core/Cargo.toml @@ -24,7 +24,7 @@ amethyst_error = { path = "../amethyst_error", version = "0.1.0" } fnv = "1" log = "0.4.6" num-traits = "0.2.0" -rayon = "1.0.2" +rayon = "1.1.0" serde = { version = "1", features = ["derive"] } specs = { version = "0.15", features = ["shred-derive"] } specs-hierarchy = "0.4" diff --git a/amethyst_core/src/frame_limiter.rs b/amethyst_core/src/frame_limiter.rs index e10a5c8fe0..1fc3a5e8d3 100644 --- a/amethyst_core/src/frame_limiter.rs +++ b/amethyst_core/src/frame_limiter.rs @@ -118,7 +118,7 @@ impl Default for FrameRateLimitStrategy { /// use amethyst::prelude::*; /// use amethyst::core::frame_limiter::FrameRateLimitConfig; /// -/// let config = FrameRateLimitConfig::load("./resources/frame_limiter.ron"); +/// let config = FrameRateLimitConfig::load("./config/frame_limiter.ron"); /// ``` /// /// [`FrameLimiter`]: ./struct.FrameLimiter.html diff --git a/amethyst_core/src/timing.rs b/amethyst_core/src/timing.rs index 5eda031bb2..b5fa828286 100644 --- a/amethyst_core/src/timing.rs +++ b/amethyst_core/src/timing.rs @@ -33,16 +33,22 @@ pub struct Time { impl Time { /// Gets the time difference between frames in seconds. + /// + /// This function should not be used during `fixed_update`s, use `fixed_seconds` instead. pub fn delta_seconds(&self) -> f32 { self.delta_seconds } /// Gets the time difference between frames. + /// + /// This function should not be used during `fixed_update`s, use `fixed_time` instead. pub fn delta_time(&self) -> Duration { self.delta_time } /// Gets the time difference between frames in seconds ignoring the time speed multiplier. + /// + /// This function should not be used during `fixed_update`s. pub fn delta_real_seconds(&self) -> f32 { self.delta_real_seconds } diff --git a/amethyst_gltf/Cargo.toml b/amethyst_gltf/Cargo.toml index aed0427dae..4138bc6a71 100644 --- a/amethyst_gltf/Cargo.toml +++ b/amethyst_gltf/Cargo.toml @@ -24,7 +24,7 @@ amethyst_rendy = { path = "../amethyst_rendy", version = "0.1.0" } err-derive = "0.1" base64 = "0.10" fnv = "1" -gltf = "0.11" +gltf = "0.12" gfx = "0.17" hibitset = { version = "0.5.1", features = ["parallel"] } itertools = "0.7" @@ -33,7 +33,7 @@ mikktspace = { version = "0.1" } serde = { version = "1.0", features = ["derive"] } thread_profiler = { version = "0.3", optional = true } -image = "0.21.0" +image = "0.21.0" derivative = "1.0.2" [features] diff --git a/amethyst_input/src/bindings.rs b/amethyst_input/src/bindings.rs index e058a7da61..df25f7c43f 100644 --- a/amethyst_input/src/bindings.rs +++ b/amethyst_input/src/bindings.rs @@ -39,6 +39,7 @@ use super::{Axis, Button}; /// UsePowerup(PlayerId), /// } /// +/// #[derive(Debug)] /// struct DriverBindingTypes; /// impl BindingTypes for DriverBindingTypes { /// type Axis = AxisBinding; @@ -47,7 +48,7 @@ use super::{Axis, Button}; /// /// type GameBindings = Bindings; /// ``` -/// And the `bindings_config.ron`: +/// And the `bindings.ron`: /// ```ron /// ( /// axes: { diff --git a/amethyst_input/src/bundle.rs b/amethyst_input/src/bundle.rs index 7948c0673f..341d476c25 100644 --- a/amethyst_input/src/bundle.rs +++ b/amethyst_input/src/bundle.rs @@ -15,7 +15,7 @@ use crate::sdl_events_system::ControllerMappings; /// Bundle for adding the `InputHandler`. /// -/// This also adds the Winit EventHandler and the `InputEvent` EventHandler +/// This also adds the Winit EventHandler and the `InputEvent` EventHandler /// where `T::Action` is the type for Actions you have assigned here. /// /// ## Type parameters diff --git a/amethyst_input/src/controller.rs b/amethyst_input/src/controller.rs index 80d027e53c..28edaece26 100644 --- a/amethyst_input/src/controller.rs +++ b/amethyst_input/src/controller.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use crate::event::InputEvent; +use crate::{bindings::BindingTypes, event::InputEvent}; /// Controller axes matching SDL controller model #[derive(Eq, PartialEq, Debug, Copy, Clone, Serialize, Deserialize)] @@ -118,7 +118,10 @@ pub enum ControllerEvent { }, } -impl<'a, T> Into> for &'a ControllerEvent { +impl<'a, T> Into> for &'a ControllerEvent +where + T: BindingTypes, +{ fn into(self) -> InputEvent { use self::ControllerEvent::*; match *self { diff --git a/amethyst_input/src/event.rs b/amethyst_input/src/event.rs index b9f3668430..06ad10061f 100644 --- a/amethyst_input/src/event.rs +++ b/amethyst_input/src/event.rs @@ -1,7 +1,9 @@ +use derivative::Derivative; use serde::{Deserialize, Serialize}; use winit::{MouseButton, VirtualKeyCode}; use super::{ + bindings::BindingTypes, button::Button, controller::{ControllerAxis, ControllerButton}, scroll_direction::ScrollDirection, @@ -11,20 +13,24 @@ use super::{ /// /// Type parameter T is the type assigned to your Actions for your /// InputBundle or InputHandler. -#[derive(PartialEq, Serialize, Deserialize, Debug, Clone)] -pub enum InputEvent { +#[derive(PartialEq, Serialize, Deserialize, Debug, Derivative)] +#[derivative(Clone(bound = ""))] +pub enum InputEvent +where + T: BindingTypes, +{ /// A key was pressed down, sent exactly once per key press. KeyPressed { - /// The `VirtualKeyCode`, used for semantic info. i.e. "W" was pressed + /// `VirtualKeyCode`, used for semantic info. i.e. "W" was pressed key_code: VirtualKeyCode, - /// The scancode, used for positional info. i.e. The third key on the first row was pressed. + /// Scancode, used for positional info. i.e. The third key on the first row was pressed. scancode: u32, }, /// A key was released, sent exactly once per key release. KeyReleased { - /// The `VirtualKeyCode`, used for semantic info. i.e. "W" was released + /// `VirtualKeyCode`, used for semantic info. i.e. "W" was released key_code: VirtualKeyCode, - /// The scancode, used for positional info. i.e. The third key on the first row was released. + /// Scancode, used for positional info. i.e. The third key on the first row was released. scancode: u32, }, /// A unicode character was received by the window. Good for typing. @@ -44,7 +50,8 @@ pub enum InputEvent { /// The amount the cursor moved vertically in pixels. delta_y: f32, }, - /// The mouse device moved. Use this for any use of the mouse that doesn't involve a standard mouse pointer. + /// The mouse device moved. Use this for any use of the mouse that doesn't involve a standard + /// mouse pointer. MouseMoved { /// The amount the mouse moved horizontally. delta_x: f32, @@ -53,7 +60,18 @@ pub enum InputEvent { }, /// The mousewheel was moved in either direction MouseWheelMoved(ScrollDirection), + /// An axis value changed. + /// + /// Note that this variant is used for `BindingTypes::Axis`, not a `ControllerAxis`. + AxisMoved { + /// The axis that moved on the controller. + axis: T::Axis, + /// The amount that the axis moved. + value: f32, + }, /// A controller Axis was moved. + /// + /// Note that this variant is used for a `ControllerAxis`, not `BindingTypes::Axis`. ControllerAxisMoved { /// The id for the controller whose axis moved. which: u32, @@ -90,12 +108,12 @@ pub enum InputEvent { /// /// If a combination is bound to an action, it will be pressed /// if all buttons within are pressed. - ActionPressed(T), + ActionPressed(T::Action), /// The associated action had any related button or combination released. /// /// If a combination is bound to an action, it will be released /// if any of the buttons within is released while all others are pressed. - ActionReleased(T), + ActionReleased(T::Action), /// The associated action has its mouse wheel moved. - ActionWheelMoved(T), + ActionWheelMoved(T::Action), } diff --git a/amethyst_input/src/input_handler.rs b/amethyst_input/src/input_handler.rs index 8eb1f185be..e4b86cf7b6 100644 --- a/amethyst_input/src/input_handler.rs +++ b/amethyst_input/src/input_handler.rs @@ -21,7 +21,10 @@ use winit::{ /// that the key is pressed until it is released again. #[derive(Derivative)] #[derivative(Default(bound = ""), Debug(bound = ""))] -pub struct InputHandler { +pub struct InputHandler +where + T: BindingTypes, +{ /// Maps inputs to actions and axes. pub bindings: Bindings, /// Encodes the VirtualKeyCode and corresponding scancode. @@ -39,7 +42,10 @@ pub struct InputHandler { mouse_wheel_horizontal: f32, } -impl InputHandler { +impl InputHandler +where + T: BindingTypes, +{ /// Creates a new input handler. pub fn new() -> Self { Default::default() @@ -52,7 +58,7 @@ impl InputHandler { pub fn send_event( &mut self, event: &Event, - event_handler: &mut EventChannel>, + event_handler: &mut EventChannel>, hidpi: f32, ) { match *event { @@ -81,6 +87,7 @@ impl InputHandler { .iter() .cloned(), ); + self.send_axis_moved_events_key(event_handler, key_code, scancode); for (action, combinations) in self.bindings.actions.iter() { for combination in combinations.iter().filter(|c| { c.contains(&Button::Key(key_code)) @@ -118,6 +125,7 @@ impl InputHandler { .iter() .cloned(), ); + self.send_axis_moved_events_key(event_handler, key_code, scancode); for (action, combinations) in self.bindings.actions.iter() { for combination in combinations { if combination.contains(&Button::Key(key_code)) @@ -160,6 +168,7 @@ impl InputHandler { .iter() .cloned(), ); + self.send_axis_moved_events_mouse(event_handler, mouse_button); for (action, combinations) in self.bindings.actions.iter() { for combination in combinations .iter() @@ -195,6 +204,7 @@ impl InputHandler { .iter() .cloned(), ); + self.send_axis_moved_events_mouse(event_handler, mouse_button); for (action, combinations) in self.bindings.actions.iter() { for combination in combinations { if combination.contains(&Button::Mouse(mouse_button)) @@ -273,7 +283,7 @@ impl InputHandler { pub fn send_controller_event( &mut self, event: &ControllerEvent, - event_handler: &mut EventChannel>, + event_handler: &mut EventChannel>, ) { use self::ControllerEvent::*; @@ -592,9 +602,9 @@ impl InputHandler { &self, delta_x: f32, delta_y: f32, - event_handler: &mut EventChannel>, + event_handler: &mut EventChannel>, ) { - let mut events = Vec::>::new(); + let mut events = Vec::>::new(); // determine if a horizontal scroll happend let dir_x = match delta_x { @@ -651,6 +661,85 @@ impl InputHandler { // send all collected events event_handler.iter_write(events); } + + fn send_axis_moved_events_key( + &self, + event_handler: &mut EventChannel>, + key_code: VirtualKeyCode, + scancode: u32, + ) { + for (axis, input_axis) in self.bindings.axes.iter() { + if let Axis::Emulated { pos, neg } = input_axis { + let value = self + .axis_value(axis) + .expect("Unreachable: `axis` is from bindings axes."); + match *pos { + Button::Key(key_code_pos) if key_code_pos == key_code => { + event_handler.single_write(AxisMoved { + axis: axis.clone(), + value, + }); + } + Button::ScanCode(scancode_pos) if scancode_pos == scancode => { + event_handler.single_write(AxisMoved { + axis: axis.clone(), + value, + }); + } + _ => {} + } + + match *neg { + Button::Key(key_code_neg) if key_code_neg == key_code => { + event_handler.single_write(AxisMoved { + axis: axis.clone(), + value, + }); + } + Button::ScanCode(scancode_neg) if scancode_neg == scancode => { + event_handler.single_write(AxisMoved { + axis: axis.clone(), + value, + }); + } + _ => {} + } + } + } + } + + fn send_axis_moved_events_mouse( + &self, + event_handler: &mut EventChannel>, + mouse_button: MouseButton, + ) { + for (axis, input_axis) in self.bindings.axes.iter() { + if let Axis::Emulated { pos, neg } = input_axis { + let value = self + .axis_value(axis) + .expect("Unreachable: `axis` is from bindings axes."); + match *pos { + Button::Mouse(mouse_button_pos) if mouse_button_pos == mouse_button => { + event_handler.single_write(AxisMoved { + axis: axis.clone(), + value, + }); + } + _ => {} + } + + match *neg { + Button::Mouse(mouse_button_neg) if mouse_button_neg == mouse_button => { + event_handler.single_write(AxisMoved { + axis: axis.clone(), + value, + }); + } + _ => {} + } + } + } + } } #[cfg(test)] @@ -672,7 +761,7 @@ mod tests { // Release the key and check for a release event of both the key and the action. let mut handler = InputHandler::::new(); - let mut events = EventChannel::>::new(); + let mut events = EventChannel::>::new(); let mut reader = events.register_reader(); handler .bindings @@ -721,7 +810,7 @@ mod tests { // Release the button and check for a release event of both the button and the action. let mut handler = InputHandler::::new(); - let mut events = EventChannel::>::new(); + let mut events = EventChannel::>::new(); let mut reader = events.register_reader(); handler .bindings @@ -764,7 +853,7 @@ mod tests { // Release second key, we should key release and no action release let mut handler = InputHandler::::new(); - let mut events = EventChannel::>::new(); + let mut events = EventChannel::>::new(); let mut reader = events.register_reader(); handler .bindings @@ -850,7 +939,8 @@ mod tests { // Release both and check for 0. let mut handler = InputHandler::::new(); - let mut events = EventChannel::>::new(); + let mut events = EventChannel::>::new(); + let mut reader = events.register_reader(); handler .bindings .insert_axis( @@ -862,14 +952,87 @@ mod tests { ) .unwrap(); assert_eq!(handler.axis_value("test_axis"), Some(0.0)); + handler.send_event(&key_press(104, VirtualKeyCode::Up), &mut events, HIDPI); + + let event_vec = events.read(&mut reader).cloned().collect::>(); + sets_are_equal( + &event_vec, + &[ + InputEvent::AxisMoved { + axis: String::from("test_axis"), + value: 1.0, + }, + InputEvent::KeyPressed { + key_code: VirtualKeyCode::Up, + scancode: 104, + }, + InputEvent::ButtonPressed(Button::Key(VirtualKeyCode::Up)), + InputEvent::ButtonPressed(Button::ScanCode(104)), + ], + ); assert_eq!(handler.axis_value("test_axis"), Some(1.0)); + handler.send_event(&key_release(104, VirtualKeyCode::Up), &mut events, HIDPI); + + let event_vec = events.read(&mut reader).cloned().collect::>(); + sets_are_equal( + &event_vec, + &[ + InputEvent::AxisMoved { + axis: String::from("test_axis"), + value: 0.0, + }, + InputEvent::KeyReleased { + key_code: VirtualKeyCode::Up, + scancode: 104, + }, + InputEvent::ButtonReleased(Button::Key(VirtualKeyCode::Up)), + InputEvent::ButtonReleased(Button::ScanCode(104)), + ], + ); assert_eq!(handler.axis_value("test_axis"), Some(0.0)); + handler.send_event(&key_press(112, VirtualKeyCode::Down), &mut events, HIDPI); + + let event_vec = events.read(&mut reader).cloned().collect::>(); + sets_are_equal( + &event_vec, + &[ + InputEvent::AxisMoved { + axis: String::from("test_axis"), + value: -1.0, + }, + InputEvent::KeyPressed { + key_code: VirtualKeyCode::Down, + scancode: 112, + }, + InputEvent::ButtonPressed(Button::Key(VirtualKeyCode::Down)), + InputEvent::ButtonPressed(Button::ScanCode(112)), + ], + ); assert_eq!(handler.axis_value("test_axis"), Some(-1.0)); + handler.send_event(&key_press(104, VirtualKeyCode::Up), &mut events, HIDPI); + + let event_vec = events.read(&mut reader).cloned().collect::>(); + sets_are_equal( + &event_vec, + &[ + InputEvent::AxisMoved { + axis: String::from("test_axis"), + value: 0.0, + }, + InputEvent::KeyPressed { + key_code: VirtualKeyCode::Up, + scancode: 104, + }, + InputEvent::ButtonPressed(Button::Key(VirtualKeyCode::Up)), + InputEvent::ButtonPressed(Button::ScanCode(104)), + ], + ); assert_eq!(handler.axis_value("test_axis"), Some(0.0)); + handler.send_event(&key_release(104, VirtualKeyCode::Up), &mut events, HIDPI); handler.send_event(&key_release(112, VirtualKeyCode::Down), &mut events, HIDPI); assert_eq!(handler.axis_value("test_axis"), Some(0.0)); @@ -881,7 +1044,7 @@ mod tests { // in iterators let mut handler = InputHandler::::new(); - let mut events = EventChannel::>::new(); + let mut events = EventChannel::>::new(); assert_eq!(handler.keys_that_are_down().next(), None); assert_eq!(handler.scan_codes_that_are_down().next(), None); assert_eq!(handler.mouse_buttons_that_are_down().next(), None); @@ -977,7 +1140,7 @@ mod tests { #[test] fn basic_key_check() { let mut handler = InputHandler::::new(); - let mut events = EventChannel::>::new(); + let mut events = EventChannel::>::new(); assert!(!handler.key_is_down(VirtualKeyCode::Up)); assert!(!handler.scan_code_is_down(104)); assert!(!handler.button_is_down(Button::Key(VirtualKeyCode::Up))); @@ -997,7 +1160,7 @@ mod tests { #[test] fn basic_mouse_check() { let mut handler = InputHandler::::new(); - let mut events = EventChannel::>::new(); + let mut events = EventChannel::>::new(); assert!(!handler.mouse_button_is_down(MouseButton::Left)); assert!(!handler.button_is_down(Button::Mouse(MouseButton::Left))); handler.send_event(&mouse_press(MouseButton::Left), &mut events, HIDPI); @@ -1012,7 +1175,7 @@ mod tests { fn basic_mouse_wheel_check() { use approx::assert_ulps_eq; let mut handler = InputHandler::::new(); - let mut events = EventChannel::>::new(); + let mut events = EventChannel::>::new(); assert_ulps_eq!(handler.mouse_wheel_value(false), 0.0); assert_ulps_eq!(handler.mouse_wheel_value(true), 0.0); handler.send_event(&mouse_wheel(0.0, 5.0), &mut events, HIDPI); diff --git a/amethyst_input/src/sdl_events_system.rs b/amethyst_input/src/sdl_events_system.rs index b54c4902e8..5a5a7d7f9a 100644 --- a/amethyst_input/src/sdl_events_system.rs +++ b/amethyst_input/src/sdl_events_system.rs @@ -65,7 +65,7 @@ pub struct SdlEventsSystem { type SdlEventsData<'a, T> = ( Write<'a, InputHandler>, - Write<'a, EventChannel::Action>>>, + Write<'a, EventChannel>>, ); impl<'a, T: BindingTypes> RunNow<'a> for SdlEventsSystem { @@ -128,7 +128,7 @@ impl SdlEventsSystem { &mut self, event: &Event, handler: &mut InputHandler, - output: &mut EventChannel>, + output: &mut EventChannel>, ) { use self::ControllerEvent::*; @@ -210,7 +210,7 @@ impl SdlEventsSystem { fn initialize_controllers( &mut self, handler: &mut InputHandler, - output: &mut EventChannel>, + output: &mut EventChannel>, ) { use crate::controller::ControllerEvent::ControllerConnected; diff --git a/amethyst_input/src/system.rs b/amethyst_input/src/system.rs index 66dfa88df2..270e5ba347 100644 --- a/amethyst_input/src/system.rs +++ b/amethyst_input/src/system.rs @@ -36,7 +36,7 @@ impl InputSystem { fn process_event( event: &Event, handler: &mut InputHandler, - output: &mut EventChannel>, + output: &mut EventChannel>, hidpi: f32, ) { handler.send_event(event, output, hidpi as f32); @@ -47,7 +47,7 @@ impl<'a, T: BindingTypes> System<'a> for InputSystem { type SystemData = ( Read<'a, EventChannel>, Write<'a, InputHandler>, - Write<'a, EventChannel>>, + Write<'a, EventChannel>>, ReadExpect<'a, ScreenDimensions>, ); diff --git a/amethyst_rendy/Cargo.toml b/amethyst_rendy/Cargo.toml index 9d5fd13c2c..07859ba9c4 100644 --- a/amethyst_rendy/Cargo.toml +++ b/amethyst_rendy/Cargo.toml @@ -22,7 +22,7 @@ lazy_static = "1.3" log = "0.4" palette = { version = "0.4", features = ["serde"] } rendy = { version = "0.3", default-features = false, features = ["base", "wsi-winit", "empty", "mesh-obj", "texture-image", "texture-palette", "serde-1"] } -ron = "0.4" +ron = "0.5" serde = { version = "1", features = ["serde_derive"] } fnv = "1" derivative = "1.0.2" @@ -33,7 +33,7 @@ thread_profiler = { version = "0.3", optional = true } approx = "0.3.2" [dev-dependencies] -rayon = "1.0.2" +rayon = "1.1.0" more-asserts = "0.2.1" criterion = "0.2.11" approx = "0.3" diff --git a/amethyst_rendy/src/shape.rs b/amethyst_rendy/src/shape.rs index fef2784393..640a10e6b1 100644 --- a/amethyst_rendy/src/shape.rs +++ b/amethyst_rendy/src/shape.rs @@ -280,8 +280,15 @@ where Vector3::new(v.normal.x * x, v.normal.y * y, v.normal.z * z).normalize() }) .unwrap_or_else(|| Vector3::from(v.normal)); - let up = Vector3::y(); - let tangent = normal.cross(&up).cross(&normal); + let tangent1 = normal.cross(&Vector3::x()); + let tangent2 = normal.cross(&Vector3::y()); + let tangent = if tangent1.norm_squared() > tangent2.norm_squared() { + tangent1 + } else { + tangent2 + } + .cross(&normal); + ( pos.into(), normal.into(), diff --git a/amethyst_ui/Cargo.toml b/amethyst_ui/Cargo.toml index c96789bf4b..d55c33200b 100644 --- a/amethyst_ui/Cargo.toml +++ b/amethyst_ui/Cargo.toml @@ -35,7 +35,7 @@ winit = { version = "0.19", features = ["serde"] } log = "0.4.6" font-kit = "0.1" paste = "0.1" -rand = "0.6" +rand = "0.7" lazy_static = "1.3" failure = "0.1" glyph_brush = "0.5.0" diff --git a/book/src/appendices/a_config_files.md b/book/src/appendices/a_config_files.md index 7da9d550e0..83a3cbba54 100644 --- a/book/src/appendices/a_config_files.md +++ b/book/src/appendices/a_config_files.md @@ -36,8 +36,8 @@ use std::path::Path; use amethyst::config::Config; ``` -For this project, we'll be placing a `config.ron` file in the same location as the `display_config.ron` and -`input.ron` files (likely the `resources/` folder). +For this project, we'll be placing a `config.ron` file in the same location as the `display.ron` and +`input.ron` files (likely the `config/` folder). ## Chapters diff --git a/book/src/concepts/system.md b/book/src/concepts/system.md index de78c0585a..4f608a07c0 100644 --- a/book/src/concepts/system.md +++ b/book/src/concepts/system.md @@ -91,7 +91,7 @@ However, this approach is pretty rare because most of the time you don't know wh ### Getting all entities with specific components -Most of the time, you will want to perform logic on all entities with a specific components, or even all entities with a selection of components. +Most of the time, you will want to perform logic on all entities with a specific component, or even all entities with a selection of components. This is possible using the `join` method. You may be familiar with joining operations if you have ever worked with databases. The `join` method takes multiple storages, and iterates over all entities that have a component in each of those storages. It works like an "AND" gate. It will return an iterator containing a tuple of all the requested components if they are **ALL** on the same entity. diff --git a/book/src/controlling_system_execution/custom_game_data.md b/book/src/controlling_system_execution/custom_game_data.md index 3b634455b8..8f90cbd0ff 100644 --- a/book/src/controlling_system_execution/custom_game_data.md +++ b/book/src/controlling_system_execution/custom_game_data.md @@ -219,7 +219,7 @@ let game_data = CustomGameDataBuilder::default() .with_base_bundle(RenderBundle::new(pipeline_builder, Some(display_config)))? .with_base_bundle(InputBundle::::new())?; -let mut game = Application::new(resources_directory, Main, game_data)?; +let mut game = Application::new(assets_directory, Main, game_data)?; game.run(); ``` diff --git a/book/src/getting-started.md b/book/src/getting-started.md index c5a7d07b54..99bac3600e 100644 --- a/book/src/getting-started.md +++ b/book/src/getting-started.md @@ -44,14 +44,23 @@ and then run amethyst new ``` -you should get `Cargo.toml`, `src/main.rs` and `resources/display_config.ron`. +you should get `Cargo.toml`, `src/main.rs` and `config/display.ron`. + +### Starter Project + +If you want to get running as quickly as possibly and start playing around with Amethyst, you can also use a starter project. These are specifically made for certain types of games, and will set you up with the groundwork needed to start right away. +The `README.md` file on these will include everything you need to know to run the starter project. + +> **Note:** Right now, the only starter available is for 2D games. This will expand over time, and offer more options for different types of games. + +* [2D Starter](https://github.com/amethyst/amethyst-starter-2d) ### Cargo (Manual) In case you're doing this with `cargo`, here's what you need to do: * Add `amethyst` as dependency in your `Cargo.toml`. -* Create a `resources` folder and put a `display_config.ron` in it. +* Create a `config` folder and put a `display.ron` in it. * (Optional) Copy the code from one of amethyst's examples. ### Important note on versioning @@ -63,7 +72,7 @@ Amethyst is divided in two major versions: > **Note:** You can see which version you're currently looking at by checking the URL in your browser. The book / documentation for `master` contains "master" in the address, - the crates.io version is called "latest". + the crates.io version is called "stable". Depending on the book version that you choose to read, make sure that the amethyst version in your Cargo.toml matches that. diff --git a/book/src/input/handling_input.md b/book/src/input/handling_input.md index 9165cab6e1..11c44233fc 100644 --- a/book/src/input/handling_input.md +++ b/book/src/input/handling_input.md @@ -118,7 +118,7 @@ To add these bindings to the `InputBundle` you simply need to call the `with_bin # use amethyst::{prelude::*, input::*, utils::*}; # fn main() -> amethyst::Result::<()> { let root = application_root_dir()?; -let bindings_config = root.join("resources").join("bindings_config.ron"); +let bindings_config = root.join("config").join("bindings.ron"); let input_bundle = InputBundle::::new() .with_bindings_from_file(bindings_config)?; diff --git a/book/src/pong-tutorial.md b/book/src/pong-tutorial.md index c5abad9bc9..c6d3da3c60 100644 --- a/book/src/pong-tutorial.md +++ b/book/src/pong-tutorial.md @@ -24,13 +24,13 @@ after following all tutorials from 1 to xy. > **Note:** On macOS, you might want to use `"metal"` instead of `"vulkan"`. The main difference between real game code and the example code is where the -`resources` and `assets` folders are located. +`config` and `assets` folders are located. For instance, in the pong_tutorial_01 example we have: ```rust,ignore let display_config_path = - app_root.join("examples/pong_tutorial_01/resources/display_config.ron"); + app_root.join("examples/pong_tutorial_01/config/display.ron"); let assets_dir = app_root.join("examples/assets/"); ``` @@ -38,7 +38,7 @@ let assets_dir = app_root.join("examples/assets/"); But for your own project you'll probably want something like this: ```rust,ignore -let display_config_path = app_root.join("resources/display_config.ron"); +let display_config_path = app_root.join("config/display.ron"); let assets_dir = app_root.join("assets/"); ``` diff --git a/book/src/pong-tutorial/pong-tutorial-01.md b/book/src/pong-tutorial/pong-tutorial-01.md index 18c0aed9bc..ce8390952a 100644 --- a/book/src/pong-tutorial/pong-tutorial-01.md +++ b/book/src/pong-tutorial/pong-tutorial-01.md @@ -128,10 +128,10 @@ from a file. The latter approach is handier, as it allows us to change configura (e.g, the window size) without having to recompile our game every time. Starting the project with `amethyst new` should have automatically generated -`DisplayConfig` data in `resources/display_config.ron`. If you created the +`DisplayConfig` data in `config/display.ron`. If you created the project manually, go ahead and create it now. -In either case, open `display_config.ron` and change its contents to the +In either case, open `display.ron` and change its contents to the following: ```rust,ignore @@ -162,7 +162,7 @@ the display configuration: # # fn main() -> Result<(), Error>{ let app_root = application_root_dir()?; -let display_config_path = app_root.join("resources").join("display_config.ron"); +let display_config_path = app_root.join("config").join("display.ron"); # Ok(()) # } ``` diff --git a/book/src/pong-tutorial/pong-tutorial-02.md b/book/src/pong-tutorial/pong-tutorial-02.md index 3c69d1fb15..4ccfa8691c 100644 --- a/book/src/pong-tutorial/pong-tutorial-02.md +++ b/book/src/pong-tutorial/pong-tutorial-02.md @@ -363,21 +363,6 @@ live with registering the `Paddle` component manually. Let's run the game again. -```text,ignore -thread 'main' panicked at 'Tried to fetch a resource, but the resource does not exist. -Try adding the resource by inserting it manually or using the `setup` method. -``` - -Ah, oops. We forgot something. Turning on the `nightly` feature, we get: - -```text_ignore -thread 'main' panicked at 'Tried to fetch a resource of type "ecs::storage::MaskedStorage", but the resource does not exist. -Try adding the resource by inserting it manually or using the `setup` method.' -``` - -This is the same kind of error as before; this time the `Component` is a -`Transform`, which is used and hence registered by the `TransformSystem`. - Amethyst has a lot of internal systems it uses to keep things running we need to bring into the context of the `World`. For simplicity, these have been grouped into "Bundles" which include related systems and resources. We can @@ -411,7 +396,7 @@ fn main() -> amethyst::Result<()> { # # let app_root = application_root_dir()?; # let display_config_path = -# app_root.join("examples/pong_tutorial_02/resources/display_config.ron"); +# app_root.join("examples/pong_tutorial_02/config/display.ron"); # // ... diff --git a/book/src/pong-tutorial/pong-tutorial-03.md b/book/src/pong-tutorial/pong-tutorial-03.md index fb92907842..d624a9e6ce 100644 --- a/book/src/pong-tutorial/pong-tutorial-03.md +++ b/book/src/pong-tutorial/pong-tutorial-03.md @@ -22,8 +22,8 @@ Let's get started. ## Capturing user input To capture user input, we'll need to introduce a few more files to our game. -Let's start by creating a resource file under the `resources` directory of our -project, called `bindings_config.ron`, which will contain a RON representation +Let's start by creating a config file under the `config` directory of our +project, called `bindings.ron`, which will contain a RON representation of the [amethyst_input::Bindings][doc_bindings] struct: ```ron,ignore @@ -61,12 +61,12 @@ axes we defined. Let's make the following changes to `main.rs`. use amethyst::input::{InputBundle, StringBindings}; # let app_root = application_root_dir()?; -let binding_path = app_root.join("resources").join("bindings_config.ron"); +let binding_path = app_root.join("config").join("bindings.ron"); let input_bundle = InputBundle::::new() .with_bindings_from_file(binding_path)?; -# let path = "./resources/display_config.ron"; +# let path = "./config/display.ron"; # let config = DisplayConfig::load(&path); # let assets_dir = "assets"; # struct Pong; @@ -83,7 +83,7 @@ game.run(); ``` For `InputBundle`, the parameter type determines how `axes` and `actions` -are identified in the `bindings_config.ron` file +are identified in the `bindings.ron` file (in this example, `String`s are used; e.g. `"left_paddle"`). At this point, we're ready to write a system that reads input from the @@ -203,7 +203,7 @@ mod systems; // Import the module fn main() -> amethyst::Result<()> { // --snip-- -# let path = "./resources/display_config.ron"; +# let path = "./config/display.ron"; # let config = DisplayConfig::load(&path); # mod systems { # use amethyst; diff --git a/book/src/pong-tutorial/pong-tutorial-04.md b/book/src/pong-tutorial/pong-tutorial-04.md index 2da622bbd3..b201421ebd 100644 --- a/book/src/pong-tutorial/pong-tutorial-04.md +++ b/book/src/pong-tutorial/pong-tutorial-04.md @@ -320,7 +320,7 @@ as well as adding our new systems to the game data: # use amethyst::window::DisplayConfig; # use amethyst::input::StringBindings; # fn main() -> amethyst::Result<()> { -# let path = "./resources/display_config.ron"; +# let path = "./config/display.ron"; # let config = DisplayConfig::load(&path); # mod systems { # use amethyst; diff --git a/book/src/pong-tutorial/pong-tutorial-05.md b/book/src/pong-tutorial/pong-tutorial-05.md index f1b0b01ed4..81169affdc 100644 --- a/book/src/pong-tutorial/pong-tutorial-05.md +++ b/book/src/pong-tutorial/pong-tutorial-05.md @@ -127,7 +127,7 @@ keep playing after someone scores and log who got the point. # # fn main() -> amethyst::Result<()> { # -# let path = "./resources/display_config.ron"; +# let path = "./config/display.ron"; # let config = DisplayConfig::load(&path); # let input_bundle = amethyst::input::InputBundle::::new(); # diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index b6691e6f12..7cbe8dc3b8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,4 +1,5 @@ # Change Log + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog][kc], and this project adheres to @@ -10,6 +11,7 @@ The format is based on [Keep a Changelog][kc], and this project adheres to ## [Unreleased] ## Breaking changes + * `Float` newtype removed, moved back to `f32` primitive for all values ([#1747]) ### Added @@ -19,9 +21,11 @@ The format is based on [Keep a Changelog][kc], and this project adheres to * Add `add_rectangle`, `add_rotated_rectangle`, `add_box`, `add_rotated_box`, `add_circle`, `add_rotated_circle`, `add_cylinder`, `add_rotated_cylinder` and `add_sphere` functions to `DebugLinesComponent` and the corresponding draw functions to `DebugLines`, to draw simple shapes with debug lines. ([#1766]) +* `InputEvent::AxisMoved` is sent upon button press / release. ([#1512], [#1797]) ### Changed +* Splitted the `/resources` directory of amethyst projects into `/assets` and `/config`. ([#1806]) * Rename FPSCounter, FPSCounterBundle, FPSCounterSystem to FpsCounter, FpsCounterBundle, FpsCounterSystem. ([#1719]) * Add Tint component support for sprites. ([#1756]) * Remove remaining type parameter on GameDataBuilder, add Debug derive to LoggerConfig ([#1758]) @@ -29,14 +33,14 @@ and the corresponding draw functions to `DebugLines`, to draw simple shapes with * Add `load_from_data_async` to Asset Loader. ([#1753]) * Add `SerializableFormat` marker trait which is now needed to be implemented for all the formats that are supposed to be serialized. ([#1720]) * Make the GltfSceneOptions field of GltfSceneFormat public. ([#1791]) - -### Fixed -* Fix stack overflow on serializing `Box>`. ([#1720]) + `InputEvent` now takes in the `BindingTypes` as a type parameter. ([#1797]) ### Fixed +* Fix stack overflow on serializing `Box>`. ([#1720]) * Fix animation unwrap on missing animated component. ([#1773]) +[#1512]: https://github.com/amethyst/amethyst/issues/1512 [#1791]: https://github.com/amethyst/amethyst/pull/1791 [#1766]: https://github.com/amethyst/amethyst/pull/1766 [#1719]: https://github.com/amethyst/amethyst/pull/1719 @@ -48,6 +52,7 @@ and the corresponding draw functions to `DebugLines`, to draw simple shapes with [#1773]: https://github.com/amethyst/amethyst/pull/1773 [#1753]: https://github.com/amethyst/amethyst/pull/1753 [#1720]: https://github.com/amethyst/amethyst/pull/1720 +[#1797]: https://github.com/amethyst/amethyst/pull/1797 ## [0.11.0] - 2019-06 diff --git a/examples/animation/resources/display_config.ron b/examples/animation/config/display.ron similarity index 100% rename from examples/animation/resources/display_config.ron rename to examples/animation/config/display.ron diff --git a/examples/animation/main.rs b/examples/animation/main.rs index bcfe86d90a..6589298204 100644 --- a/examples/animation/main.rs +++ b/examples/animation/main.rs @@ -1,9 +1,8 @@ //! Displays a shaded sphere to the user. -use amethyst::assets::Loader; use amethyst::{ animation::*, - assets::{PrefabLoader, PrefabLoaderSystem, RonFormat}, + assets::{Loader, PrefabLoader, PrefabLoaderSystem, RonFormat}, core::{Transform, TransformBundle}, ecs::prelude::{Entity, ReadExpect, World, WorldExt}, input::{get_key, is_close_requested, is_key_down}, @@ -223,8 +222,8 @@ fn main() -> amethyst::Result<()> { .start(); let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/animation/resources/display_config.ron"); - let resources = app_root.join("examples/assets/"); + let display_config_path = app_root.join("examples/animation/config/display.ron"); + let assets_directory = app_root.join("examples/assets/"); let mut world = World::new(); @@ -249,7 +248,7 @@ fn main() -> amethyst::Result<()> { ExampleGraph::default(), )); let state: Example = Default::default(); - let mut game = Application::new(resources, state, game_data, world)?; + let mut game = Application::new(assets_directory, state, game_data, world)?; game.run(); Ok(()) diff --git a/examples/arc_ball_camera/resources/display_config.ron b/examples/arc_ball_camera/config/display.ron similarity index 100% rename from examples/arc_ball_camera/resources/display_config.ron rename to examples/arc_ball_camera/config/display.ron diff --git a/examples/arc_ball_camera/resources/input.ron b/examples/arc_ball_camera/config/input.ron similarity index 100% rename from examples/arc_ball_camera/resources/input.ron rename to examples/arc_ball_camera/config/input.ron diff --git a/examples/arc_ball_camera/main.rs b/examples/arc_ball_camera/main.rs index a049914ee0..c472c78776 100644 --- a/examples/arc_ball_camera/main.rs +++ b/examples/arc_ball_camera/main.rs @@ -64,14 +64,14 @@ impl SimpleState for ExampleState { } struct CameraDistanceSystem { - event_reader: ReaderId>, + event_reader: ReaderId>, } impl CameraDistanceSystem { pub fn new(mut world: &mut World) -> Self { >::SystemData::setup(&mut world); let event_reader = world - .fetch_mut::>>() + .fetch_mut::>>() .register_reader(); CameraDistanceSystem { event_reader } @@ -80,7 +80,7 @@ impl CameraDistanceSystem { impl<'a> System<'a> for CameraDistanceSystem { type SystemData = ( - Read<'a, EventChannel>>, + Read<'a, EventChannel>>, ReadStorage<'a, Transform>, WriteStorage<'a, ArcBallControlTag>, ); @@ -111,11 +111,10 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; - let resources_directory = app_root.join("examples/assets"); - let display_config_path = - app_root.join("examples/arc_ball_camera/resources/display_config.ron"); + let assets_directory = app_root.join("examples/assets"); + let display_config_path = app_root.join("examples/arc_ball_camera/config/display.ron"); - let key_bindings_path = app_root.join("examples/arc_ball_camera/resources/input.ron"); + let key_bindings_path = app_root.join("examples/arc_ball_camera/config/input.ron"); let mut world = World::new(); @@ -139,8 +138,7 @@ fn main() -> Result<(), Error> { .with_thread_local(RenderingSystem::::new( ExampleGraph::default(), )); - let mut game = - Application::build(resources_directory, ExampleState, world)?.build(game_data)?; + let mut game = Application::build(assets_directory, ExampleState, world)?.build(game_data)?; game.run(); Ok(()) } diff --git a/examples/asset_loading/resources/display_config.ron b/examples/asset_loading/config/display.ron similarity index 100% rename from examples/asset_loading/resources/display_config.ron rename to examples/asset_loading/config/display.ron diff --git a/examples/asset_loading/main.rs b/examples/asset_loading/main.rs index 8b6aef9f13..47d795fa7e 100644 --- a/examples/asset_loading/main.rs +++ b/examples/asset_loading/main.rs @@ -125,10 +125,9 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; // Add our meshes directory to the asset loader. - let resources_directory = app_root.join("examples/assets"); + let assets_directory = app_root.join("examples/assets"); - let display_config_path = - app_root.join("{}/examples/asset_loading/resources/display_config.ron"); + let display_config_path = app_root.join("{}/examples/asset_loading/config/display.ron"); let mut world = World::new(); @@ -142,7 +141,7 @@ fn main() -> Result<(), Error> { .with_thread_local(RenderingSystem::::new( ExampleGraph::default(), )); - let mut game = Application::new(resources_directory, AssetsExample, game_data, world)?; + let mut game = Application::new(assets_directory, AssetsExample, game_data, world)?; game.run(); Ok(()) } diff --git a/examples/auto_fov/resources/display.ron b/examples/auto_fov/config/display.ron similarity index 100% rename from examples/auto_fov/resources/display.ron rename to examples/auto_fov/config/display.ron diff --git a/examples/auto_fov/main.rs b/examples/auto_fov/main.rs index 062d5f5c3e..a8dd7d5cce 100644 --- a/examples/auto_fov/main.rs +++ b/examples/auto_fov/main.rs @@ -51,8 +51,8 @@ fn main() -> Result<(), Error> { amethyst::start_logger(Default::default()); let app_dir = amethyst::utils::application_dir("examples")?; - let display_config_path = app_dir.join("auto_fov/resources/display.ron"); - let assets = app_dir.join("assets"); + let display_config_path = app_dir.join("auto_fov/config/display.ron"); + let assets_directory = app_dir.join("assets"); let mut world = World::new(); @@ -78,7 +78,7 @@ fn main() -> Result<(), Error> { ExampleGraph::default(), )); - let mut game = Application::build(assets, Loading::new(), world)?.build(game_data)?; + let mut game = Application::build(assets_directory, Loading::new(), world)?.build(game_data)?; game.run(); Ok(()) diff --git a/examples/custom_game_data/resources/display_config.ron b/examples/custom_game_data/config/display.ron similarity index 100% rename from examples/custom_game_data/resources/display_config.ron rename to examples/custom_game_data/config/display.ron diff --git a/examples/custom_game_data/main.rs b/examples/custom_game_data/main.rs index 673d9ac24c..7b2409acbf 100644 --- a/examples/custom_game_data/main.rs +++ b/examples/custom_game_data/main.rs @@ -209,8 +209,7 @@ fn main() -> Result<(), Error> { // Add our meshes directory to the asset loader. let asset_dir = app_root.join("examples/assets"); - let display_config_path = - app_root.join("examples/custom_game_data/resources/display_config.ron"); + let display_config_path = app_root.join("examples/custom_game_data/config/display.ron"); let mut world = World::new(); diff --git a/examples/custom_ui/resources/display.ron b/examples/custom_ui/config/display.ron similarity index 100% rename from examples/custom_ui/resources/display.ron rename to examples/custom_ui/config/display.ron diff --git a/examples/custom_ui/main.rs b/examples/custom_ui/main.rs index 85cad5ad9d..fed01ac170 100644 --- a/examples/custom_ui/main.rs +++ b/examples/custom_ui/main.rs @@ -102,8 +102,8 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/custom_ui/resources/display.ron"); - let resources = app_root.join("examples/assets"); + let display_config_path = app_root.join("examples/custom_ui/config/display.ron"); + let assets = app_root.join("examples/assets"); let mut world = World::new(); @@ -121,7 +121,7 @@ fn main() -> amethyst::Result<()> { .with_thread_local(RenderingSystem::::new( ExampleGraph::default(), )); - let mut game = Application::new(resources, Example, game_data, world)?; + let mut game = Application::new(assets, Example, game_data, world)?; game.run(); Ok(()) } diff --git a/examples/debug_lines/resources/display.ron b/examples/debug_lines/config/display.ron similarity index 100% rename from examples/debug_lines/resources/display.ron rename to examples/debug_lines/config/display.ron diff --git a/examples/debug_lines/resources/input.ron b/examples/debug_lines/config/input.ron similarity index 100% rename from examples/debug_lines/resources/input.ron rename to examples/debug_lines/config/input.ron diff --git a/examples/debug_lines/main.rs b/examples/debug_lines/main.rs index cf072b1fec..563b99b451 100644 --- a/examples/debug_lines/main.rs +++ b/examples/debug_lines/main.rs @@ -180,9 +180,9 @@ fn main() -> amethyst::Result<()> { let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/debug_lines/resources/display.ron"); - let key_bindings_path = app_root.join("examples/debug_lines/resources/input.ron"); - let resources = app_root.join("examples/assets/"); + let display_config_path = app_root.join("examples/debug_lines/config/display.ron"); + let key_bindings_path = app_root.join("examples/debug_lines/config/input.ron"); + let assets_directory = app_root.join("examples/assets/"); let fly_control_bundle = FlyControlBundle::::new( Some(String::from("move_x")), @@ -212,7 +212,7 @@ fn main() -> amethyst::Result<()> { ExampleGraph::default(), )); - let mut game = Application::new(resources, ExampleState, game_data, world)?; + let mut game = Application::new(assets_directory, ExampleState, game_data, world)?; game.run(); Ok(()) } diff --git a/examples/debug_lines_ortho/resources/display.ron b/examples/debug_lines_ortho/config/display.ron similarity index 100% rename from examples/debug_lines_ortho/resources/display.ron rename to examples/debug_lines_ortho/config/display.ron diff --git a/examples/debug_lines_ortho/main.rs b/examples/debug_lines_ortho/main.rs index 4e2cd29c6c..3c46ab8076 100644 --- a/examples/debug_lines_ortho/main.rs +++ b/examples/debug_lines_ortho/main.rs @@ -107,8 +107,8 @@ fn main() -> amethyst::Result<()> { let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/debug_lines_ortho/resources/display.ron"); - let resources = app_root.join("examples/assets/"); + let display_config_path = app_root.join("examples/debug_lines_ortho/config/display.ron"); + let assets_directory = app_root.join("examples/assets/"); let mut world = World::new(); @@ -123,7 +123,7 @@ fn main() -> amethyst::Result<()> { ExampleGraph::default(), )); - let mut game = Application::new(resources, ExampleState, game_data, world)?; + let mut game = Application::new(assets_directory, ExampleState, game_data, world)?; game.run(); Ok(()) } diff --git a/examples/fly_camera/resources/display_config.ron b/examples/fly_camera/config/display.ron similarity index 100% rename from examples/fly_camera/resources/display_config.ron rename to examples/fly_camera/config/display.ron diff --git a/examples/fly_camera/resources/input.ron b/examples/fly_camera/config/input.ron similarity index 100% rename from examples/fly_camera/resources/input.ron rename to examples/fly_camera/config/input.ron diff --git a/examples/fly_camera/main.rs b/examples/fly_camera/main.rs index 74a033969d..607bed879c 100644 --- a/examples/fly_camera/main.rs +++ b/examples/fly_camera/main.rs @@ -67,9 +67,11 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; - let resources_directory = app_root.join("examples/assets"); - let display_config_path = app_root.join("examples/fly_camera/resources/display_config.ron"); - let key_bindings_path = app_root.join("examples/fly_camera/resources/input.ron"); + let assets_directory = app_root.join("examples/assets"); + + let display_config_path = app_root.join("examples/fly_camera/config/display.ron"); + + let key_bindings_path = app_root.join("examples/fly_camera/config/input.ron"); let mut world = World::new(); @@ -99,8 +101,7 @@ fn main() -> Result<(), Error> { .with_thread_local(RenderingSystem::::new( ExampleGraph::default(), )); - let mut game = - Application::build(resources_directory, ExampleState, world)?.build(game_data)?; + let mut game = Application::build(assets_directory, ExampleState, world)?.build(game_data)?; game.run(); Ok(()) } diff --git a/examples/gltf/resources/display_config.ron b/examples/gltf/config/display.ron similarity index 100% rename from examples/gltf/resources/display_config.ron rename to examples/gltf/config/display.ron diff --git a/examples/gltf/resources/input.ron b/examples/gltf/config/input.ron similarity index 100% rename from examples/gltf/resources/input.ron rename to examples/gltf/config/input.ron diff --git a/examples/gltf/main.rs b/examples/gltf/main.rs index 9f540dacb6..5e26999fa3 100644 --- a/examples/gltf/main.rs +++ b/examples/gltf/main.rs @@ -189,8 +189,8 @@ fn main() -> Result<(), amethyst::Error> { let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/gltf/resources/display_config.ron"); - let resources_directory = app_root.join("examples/assets/"); + let display_config_path = app_root.join("examples/gltf/config/display.ron"); + let assets_directory = app_root.join("examples/assets/"); let mut world = World::new(); @@ -247,7 +247,7 @@ fn main() -> Result<(), amethyst::Error> { )); let mut game = - Application::build(resources_directory, Example::default(), world)?.build(game_data)?; + Application::build(assets_directory, Example::default(), world)?.build(game_data)?; game.run(); Ok(()) } diff --git a/examples/locale/main.rs b/examples/locale/main.rs index f0e85baa2f..1b80f28ef6 100644 --- a/examples/locale/main.rs +++ b/examples/locale/main.rs @@ -72,11 +72,11 @@ impl SimpleState for Example { fn main() -> Result<(), Error> { amethyst::start_logger(Default::default()); - let resources_directory = application_root_dir()?.join("examples/assets"); + let assets_directory = application_root_dir()?.join("examples/assets"); let game_data = GameDataBuilder::default().with(Processor::::new(), "proc", &[]); - let mut game = Application::new(resources_directory, Example::new(), game_data, World::new())?; + let mut game = Application::new(assets_directory, Example::new(), game_data, World::new())?; game.run(); Ok(()) } diff --git a/examples/material/resources/display_config.ron b/examples/material/config/display.ron similarity index 100% rename from examples/material/resources/display_config.ron rename to examples/material/config/display.ron diff --git a/examples/material/main.rs b/examples/material/main.rs index 57b48692c0..814c2e9ef2 100644 --- a/examples/material/main.rs +++ b/examples/material/main.rs @@ -153,8 +153,8 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/material/resources/display_config.ron"); - let resources = app_root.join("examples/assets/"); + let display_config_path = app_root.join("examples/material/config/display.ron"); + let assets_directory = app_root.join("examples/assets/"); let mut world = World::new(); @@ -168,7 +168,7 @@ fn main() -> amethyst::Result<()> { ExampleGraph::default(), )); - let mut game = Application::new(&resources, Example, game_data, world)?; + let mut game = Application::new(&assets_directory, Example, game_data, world)?; game.run(); Ok(()) } diff --git a/examples/pong/resources/display.ron b/examples/pong/config/display.ron similarity index 100% rename from examples/pong/resources/display.ron rename to examples/pong/config/display.ron diff --git a/examples/pong/resources/input.ron b/examples/pong/config/input.ron similarity index 100% rename from examples/pong/resources/input.ron rename to examples/pong/config/input.ron diff --git a/examples/pong/resources/input_controller.ron b/examples/pong/config/input_controller.ron similarity index 100% rename from examples/pong/resources/input_controller.ron rename to examples/pong/config/input_controller.ron diff --git a/examples/pong/main.rs b/examples/pong/main.rs index fe7e552376..f49c653fbb 100644 --- a/examples/pong/main.rs +++ b/examples/pong/main.rs @@ -48,13 +48,13 @@ fn main() -> amethyst::Result<()> { let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/pong/resources/display.ron"); + let display_config_path = app_root.join("examples/pong/config/display.ron"); let key_bindings_path = { if cfg!(feature = "sdl_controller") { - app_root.join("examples/pong/resources/input_controller.ron") + app_root.join("examples/pong/config/input_controller.ron") } else { - app_root.join("examples/pong/resources/input.ron") + app_root.join("examples/pong/config/input.ron") } }; diff --git a/examples/pong_tutorial_01/resources/display_config.ron b/examples/pong_tutorial_01/config/display.ron similarity index 100% rename from examples/pong_tutorial_01/resources/display_config.ron rename to examples/pong_tutorial_01/config/display.ron diff --git a/examples/pong_tutorial_01/main.rs b/examples/pong_tutorial_01/main.rs index 4f1fa7375a..859bf94647 100644 --- a/examples/pong_tutorial_01/main.rs +++ b/examples/pong_tutorial_01/main.rs @@ -20,8 +20,7 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = - app_root.join("examples/pong_tutorial_01/resources/display_config.ron"); + let display_config_path = app_root.join("examples/pong_tutorial_01/config/display.ron"); let mut world = World::new(); diff --git a/examples/pong_tutorial_02/resources/display_config.ron b/examples/pong_tutorial_02/config/display.ron similarity index 100% rename from examples/pong_tutorial_02/resources/display_config.ron rename to examples/pong_tutorial_02/config/display.ron diff --git a/examples/pong_tutorial_02/main.rs b/examples/pong_tutorial_02/main.rs index b35b557dca..d8eef8377e 100644 --- a/examples/pong_tutorial_02/main.rs +++ b/examples/pong_tutorial_02/main.rs @@ -20,8 +20,7 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = - app_root.join("examples/pong_tutorial_02/resources/display_config.ron"); + let display_config_path = app_root.join("examples/pong_tutorial_02/config/display.ron"); let mut world = World::new(); diff --git a/examples/pong_tutorial_03/resources/bindings_config.ron b/examples/pong_tutorial_03/config/bindings.ron similarity index 100% rename from examples/pong_tutorial_03/resources/bindings_config.ron rename to examples/pong_tutorial_03/config/bindings.ron diff --git a/examples/pong_tutorial_03/resources/display_config.ron b/examples/pong_tutorial_03/config/display.ron similarity index 100% rename from examples/pong_tutorial_03/resources/display_config.ron rename to examples/pong_tutorial_03/config/display.ron diff --git a/examples/pong_tutorial_03/main.rs b/examples/pong_tutorial_03/main.rs index 029ab65ff6..c1d130b213 100644 --- a/examples/pong_tutorial_03/main.rs +++ b/examples/pong_tutorial_03/main.rs @@ -22,8 +22,7 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = - app_root.join("examples/pong_tutorial_03/resources/display_config.ron"); + let display_config_path = app_root.join("examples/pong_tutorial_03/config/display.ron"); let mut world = World::new(); @@ -44,7 +43,7 @@ fn main() -> amethyst::Result<()> { .with_bundle( &mut world, InputBundle::::new().with_bindings_from_file( - app_root.join("examples/pong_tutorial_03/resources/bindings_config.ron"), + app_root.join("examples/pong_tutorial_03/config/bindings.ron"), )?, )? // We have now added our own system, the PaddleSystem, defined in systems/paddle.rs diff --git a/examples/pong_tutorial_04/resources/bindings_config.ron b/examples/pong_tutorial_04/config/bindings.ron similarity index 100% rename from examples/pong_tutorial_04/resources/bindings_config.ron rename to examples/pong_tutorial_04/config/bindings.ron diff --git a/examples/pong_tutorial_04/resources/display_config.ron b/examples/pong_tutorial_04/config/display.ron similarity index 100% rename from examples/pong_tutorial_04/resources/display_config.ron rename to examples/pong_tutorial_04/config/display.ron diff --git a/examples/pong_tutorial_04/main.rs b/examples/pong_tutorial_04/main.rs index 0708d27a12..8328247f4f 100644 --- a/examples/pong_tutorial_04/main.rs +++ b/examples/pong_tutorial_04/main.rs @@ -22,8 +22,7 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = - app_root.join("examples/pong_tutorial_04/resources/display_config.ron"); + let display_config_path = app_root.join("examples/pong_tutorial_04/config/display.ron"); let mut world = World::new(); @@ -44,7 +43,7 @@ fn main() -> amethyst::Result<()> { .with_bundle( &mut world, InputBundle::::new().with_bindings_from_file( - app_root.join("examples/pong_tutorial_04/resources/bindings_config.ron"), + app_root.join("examples/pong_tutorial_04/config/bindings.ron"), )?, )? // We have now added our own systems, defined in the systems module diff --git a/examples/pong_tutorial_05/resources/bindings_config.ron b/examples/pong_tutorial_05/config/bindings.ron similarity index 100% rename from examples/pong_tutorial_05/resources/bindings_config.ron rename to examples/pong_tutorial_05/config/bindings.ron diff --git a/examples/pong_tutorial_05/resources/display_config.ron b/examples/pong_tutorial_05/config/display.ron similarity index 100% rename from examples/pong_tutorial_05/resources/display_config.ron rename to examples/pong_tutorial_05/config/display.ron diff --git a/examples/pong_tutorial_05/main.rs b/examples/pong_tutorial_05/main.rs index 23051df97d..2c9878500e 100644 --- a/examples/pong_tutorial_05/main.rs +++ b/examples/pong_tutorial_05/main.rs @@ -23,8 +23,7 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = - app_root.join("examples/pong_tutorial_05/resources/display_config.ron"); + let display_config_path = app_root.join("examples/pong_tutorial_05/config/display.ron"); let mut world = World::new(); @@ -45,7 +44,7 @@ fn main() -> amethyst::Result<()> { .with_bundle( &mut world, InputBundle::::new().with_bindings_from_file( - app_root.join("examples/pong_tutorial_05/resources/bindings_config.ron"), + app_root.join("examples/pong_tutorial_05/config/bindings.ron"), )?, )? .with_bundle( diff --git a/examples/prefab/resources/display_config.ron b/examples/prefab/config/display.ron similarity index 100% rename from examples/prefab/resources/display_config.ron rename to examples/prefab/config/display.ron diff --git a/examples/prefab/main.rs b/examples/prefab/main.rs index 843044ecbc..345a3f5b3c 100644 --- a/examples/prefab/main.rs +++ b/examples/prefab/main.rs @@ -44,9 +44,9 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; // Add our meshes directory to the asset loader. - let resources_directory = app_root.join("examples/assets"); + let assets_directory = app_root.join("examples/assets"); - let display_config_path = app_root.join("examples/prefab/resources/display_config.ron"); + let display_config_path = app_root.join("examples/prefab/config/display.ron"); let mut world = World::new(); @@ -60,7 +60,7 @@ fn main() -> Result<(), Error> { .with_thread_local(RenderingSystem::::new( ExampleGraph::default(), )); - let mut game = Application::new(resources_directory, AssetsExample, game_data, world)?; + let mut game = Application::new(assets_directory, AssetsExample, game_data, world)?; game.run(); Ok(()) } diff --git a/examples/prefab_adapter/main.rs b/examples/prefab_adapter/main.rs index 8d3af4affa..8cd996c7b3 100644 --- a/examples/prefab_adapter/main.rs +++ b/examples/prefab_adapter/main.rs @@ -174,7 +174,7 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; // Add our meshes directory to the asset loader. - let resources_directory = app_root.join("examples/assets"); + let assets_directory = app_root.join("examples/assets"); let mut world = World::new(); @@ -184,12 +184,7 @@ fn main() -> Result<(), Error> { &[], ); - let mut game = Application::new( - resources_directory, - CustomPrefabState::new(), - game_data, - world, - )?; + let mut game = Application::new(assets_directory, CustomPrefabState::new(), game_data, world)?; game.run(); Ok(()) } diff --git a/examples/prefab_basic/main.rs b/examples/prefab_basic/main.rs index 141f83528a..0462e95769 100644 --- a/examples/prefab_basic/main.rs +++ b/examples/prefab_basic/main.rs @@ -142,19 +142,14 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; // Add our meshes directory to the asset loader. - let resources_directory = app_root.join("examples/assets"); + let assets_directory = app_root.join("examples/assets"); let mut world = World::new(); let game_data = GameDataBuilder::default().with(PrefabLoaderSystem::::new(&mut world), "", &[]); - let mut game = Application::new( - resources_directory, - CustomPrefabState::new(), - game_data, - world, - )?; + let mut game = Application::new(assets_directory, CustomPrefabState::new(), game_data, world)?; game.run(); Ok(()) } diff --git a/examples/prefab_custom/main.rs b/examples/prefab_custom/main.rs index f9729e142f..e83599c1b8 100644 --- a/examples/prefab_custom/main.rs +++ b/examples/prefab_custom/main.rs @@ -183,7 +183,7 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; // Add our meshes directory to the asset loader. - let resources_directory = app_root.join("examples/assets"); + let assets_directory = app_root.join("examples/assets"); let mut world = World::new(); @@ -193,12 +193,7 @@ fn main() -> Result<(), Error> { &[], ); - let mut game = Application::new( - resources_directory, - CustomPrefabState::new(), - game_data, - world, - )?; + let mut game = Application::new(assets_directory, CustomPrefabState::new(), game_data, world)?; game.run(); Ok(()) } diff --git a/examples/prefab_multi/main.rs b/examples/prefab_multi/main.rs index b2c9c9d655..7a544a88bc 100644 --- a/examples/prefab_multi/main.rs +++ b/examples/prefab_multi/main.rs @@ -156,19 +156,14 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; // Add our meshes directory to the asset loader. - let resources_directory = app_root.join("examples/assets"); + let assets_directory = app_root.join("examples/assets"); let mut world = World::new(); let game_data = GameDataBuilder::default().with(PrefabLoaderSystem::::new(&mut world), "", &[]); - let mut game = Application::new( - resources_directory, - CustomPrefabState::new(), - game_data, - world, - )?; + let mut game = Application::new(assets_directory, CustomPrefabState::new(), game_data, world)?; game.run(); Ok(()) } diff --git a/examples/renderable/resources/display_config.ron b/examples/renderable/config/display.ron similarity index 100% rename from examples/renderable/resources/display_config.ron rename to examples/renderable/config/display.ron diff --git a/examples/renderable/main.rs b/examples/renderable/main.rs index b3b9d6762a..339dd2eb3d 100644 --- a/examples/renderable/main.rs +++ b/examples/renderable/main.rs @@ -200,13 +200,13 @@ fn main() -> Result<(), Error> { let app_root = application_root_dir()?; // Add our meshes directory to the asset loader. - let resources_directory = app_root.join("examples").join("assets"); + let assets_directory = app_root.join("examples").join("assets"); let display_config_path = app_root .join("examples") .join("renderable") - .join("resources") - .join("display_config.ron"); + .join("config") + .join("display.ron"); let mut world = World::new(); @@ -232,7 +232,7 @@ fn main() -> Result<(), Error> { ExampleGraph::default(), )); let mut game = - Application::build(resources_directory, Loading::default(), world)?.build(game_data)?; + Application::build(assets_directory, Loading::default(), world)?.build(game_data)?; game.run(); Ok(()) } diff --git a/examples/rendy/resources/display_config.ron b/examples/rendy/config/display.ron similarity index 100% rename from examples/rendy/resources/display_config.ron rename to examples/rendy/config/display.ron diff --git a/examples/rendy/main.rs b/examples/rendy/main.rs index b9deb6b7a6..868038e9d5 100644 --- a/examples/rendy/main.rs +++ b/examples/rendy/main.rs @@ -13,7 +13,7 @@ use amethyst::{ core::{ ecs::{ Component, DenseVecStorage, Entities, Entity, Join, Read, ReadExpect, ReadStorage, - System, SystemData, World, World, Write, WriteStorage, + System, SystemData, World, Write, WriteStorage, }, math::{Unit, UnitQuaternion, Vector3}, Time, Transform, TransformBundle, @@ -563,9 +563,9 @@ fn main() -> amethyst::Result<()> { let display_config_path = app_root .join("examples") .join("rendy") - .join("resources") - .join("display_config.ron"); - let resources = app_root.join("examples").join("assets"); + .join("config") + .join("display.ron"); + let assets_directory = app_root.join("examples").join("assets"); let mut world = World::new(); @@ -668,7 +668,7 @@ fn main() -> amethyst::Result<()> { ExampleGraph::default(), )); - let mut game = Application::new(&resources, Example::new(), game_data, world)?; + let mut game = Application::new(&assets_directory, Example::new(), game_data, world)?; game.run(); Ok(()) } diff --git a/examples/sphere/resources/display_config.ron b/examples/sphere/config/display.ron similarity index 100% rename from examples/sphere/resources/display_config.ron rename to examples/sphere/config/display.ron diff --git a/examples/sphere/main.rs b/examples/sphere/main.rs index 1c83732102..a2c2ede563 100644 --- a/examples/sphere/main.rs +++ b/examples/sphere/main.rs @@ -41,11 +41,10 @@ fn main() -> amethyst::Result<()> { let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/sphere/resources/display_config.ron"); - let resources = app_root.join("examples/assets/"); + let display_config_path = app_root.join("examples/sphere/config/display.ron"); + let assets_directory = app_root.join("examples/assets/"); let mut world = World::new(); - let game_data = GameDataBuilder::default() .with_bundle( &mut world, @@ -56,7 +55,7 @@ fn main() -> amethyst::Result<()> { .with_thread_local(RenderingSystem::::new( ExampleGraph::default(), )); - let mut game = Application::new(resources, Example, game_data, world)?; + let mut game = Application::new(assets_directory, Example, game_data, world)?; game.run(); Ok(()) } diff --git a/examples/spotlights/resources/display_config.ron b/examples/spotlights/config/display.ron similarity index 100% rename from examples/spotlights/resources/display_config.ron rename to examples/spotlights/config/display.ron diff --git a/examples/spotlights/main.rs b/examples/spotlights/main.rs index bde1059822..bde58f1056 100644 --- a/examples/spotlights/main.rs +++ b/examples/spotlights/main.rs @@ -38,8 +38,8 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/spotlights/resources/display_config.ron"); - let resources = app_root.join("examples/assets/"); + let display_config_path = app_root.join("examples/spotlights/config/display.ron"); + let assets_directory = app_root.join("examples/assets/"); let mut world = World::new(); @@ -54,7 +54,7 @@ fn main() -> amethyst::Result<()> { ExampleGraph::default(), )); - let mut game = Application::new(resources, Example, game_data, world)?; + let mut game = Application::new(assets_directory, Example, game_data, world)?; game.run(); Ok(()) } diff --git a/examples/sprite_animation/resources/display_config.ron b/examples/sprite_animation/config/display.ron similarity index 100% rename from examples/sprite_animation/resources/display_config.ron rename to examples/sprite_animation/config/display.ron diff --git a/examples/sprite_animation/main.rs b/examples/sprite_animation/main.rs index aa7780aaf4..4aad61bb8a 100644 --- a/examples/sprite_animation/main.rs +++ b/examples/sprite_animation/main.rs @@ -142,8 +142,7 @@ fn main() -> amethyst::Result<()> { let app_root = application_root_dir()?; let assets_directory = app_root.join("examples/assets/"); - let display_config_path = - app_root.join("examples/sprite_animation/resources/display_config.ron"); + let display_config_path = app_root.join("examples/sprite_animation/config/display.ron"); let mut world = World::new(); diff --git a/examples/sprite_camera_follow/resources/Background.png b/examples/sprite_camera_follow/assets/Background.png similarity index 100% rename from examples/sprite_camera_follow/resources/Background.png rename to examples/sprite_camera_follow/assets/Background.png diff --git a/examples/sprite_camera_follow/resources/Background.ron b/examples/sprite_camera_follow/assets/Background.ron similarity index 100% rename from examples/sprite_camera_follow/resources/Background.ron rename to examples/sprite_camera_follow/assets/Background.ron diff --git a/examples/sprite_camera_follow/resources/Circle_Spritesheet.png b/examples/sprite_camera_follow/assets/Circle_Spritesheet.png similarity index 100% rename from examples/sprite_camera_follow/resources/Circle_Spritesheet.png rename to examples/sprite_camera_follow/assets/Circle_Spritesheet.png diff --git a/examples/sprite_camera_follow/resources/Circle_Spritesheet.ron b/examples/sprite_camera_follow/assets/Circle_Spritesheet.ron similarity index 100% rename from examples/sprite_camera_follow/resources/Circle_Spritesheet.ron rename to examples/sprite_camera_follow/assets/Circle_Spritesheet.ron diff --git a/examples/sprite_camera_follow/resources/display_config.ron b/examples/sprite_camera_follow/config/display.ron similarity index 100% rename from examples/sprite_camera_follow/resources/display_config.ron rename to examples/sprite_camera_follow/config/display.ron diff --git a/examples/sprite_camera_follow/resources/input.ron b/examples/sprite_camera_follow/config/input.ron similarity index 100% rename from examples/sprite_camera_follow/resources/input.ron rename to examples/sprite_camera_follow/config/input.ron diff --git a/examples/sprite_camera_follow/main.rs b/examples/sprite_camera_follow/main.rs index 5517594da1..6c32e6c2e8 100644 --- a/examples/sprite_camera_follow/main.rs +++ b/examples/sprite_camera_follow/main.rs @@ -201,9 +201,8 @@ fn main() -> amethyst::Result<()> { .start(); let app_root = application_root_dir()?; - let assets_directory = app_root.join("examples/sprite_camera_follow/resources"); - let display_config_path = - app_root.join("examples/sprite_camera_follow/resources/display_config.ron"); + let assets_directory = app_root.join("examples/sprite_camera_follow/assets"); + let display_config_path = app_root.join("examples/sprite_camera_follow/config/display.ron"); let mut world = World::new(); @@ -215,8 +214,9 @@ fn main() -> amethyst::Result<()> { .with_bundle(&mut world, TransformBundle::new())? .with_bundle( &mut world, - InputBundle::::new() - .with_bindings_from_file(assets_directory.join("input.ron"))?, + InputBundle::::new().with_bindings_from_file( + app_root.join("examples/sprite_camera_follow/config/input.ron"), + )?, )? .with(MovementSystem, "movement", &[]) .with( diff --git a/examples/sprites_ordered/resources/display_config.ron b/examples/sprites_ordered/config/display.ron similarity index 100% rename from examples/sprites_ordered/resources/display_config.ron rename to examples/sprites_ordered/config/display.ron diff --git a/examples/sprites_ordered/main.rs b/examples/sprites_ordered/main.rs index 09a929a339..6078e0e461 100644 --- a/examples/sprites_ordered/main.rs +++ b/examples/sprites_ordered/main.rs @@ -365,8 +365,7 @@ fn main() -> amethyst::Result<()> { let app_root = application_root_dir()?; - let display_config_path = - app_root.join("examples/sprites_ordered/resources/display_config.ron"); + let display_config_path = app_root.join("examples/sprites_ordered/config/display.ron"); let assets_directory = app_root.join("examples/assets/"); diff --git a/examples/ui/resources/display.ron b/examples/ui/config/display.ron similarity index 100% rename from examples/ui/resources/display.ron rename to examples/ui/config/display.ron diff --git a/examples/ui/main.rs b/examples/ui/main.rs index 318f319f49..283e831b49 100644 --- a/examples/ui/main.rs +++ b/examples/ui/main.rs @@ -132,8 +132,8 @@ fn main() -> amethyst::Result<()> { let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/ui/resources/display.ron"); - let resources = app_root.join("examples/assets"); + let display_config_path = app_root.join("examples/ui/config/display.ron"); + let assets_directory = app_root.join("examples/assets"); let mut world = World::new(); @@ -156,7 +156,7 @@ fn main() -> amethyst::Result<()> { ExampleGraph::default(), )); - let mut game = Application::build(resources, Example::default(), world)? + let mut game = Application::build(assets_directory, Example::default(), world)? // Unlimited FPS .with_frame_limit(FrameRateLimitStrategy::Unlimited, 9999) .build(game_data)?; diff --git a/examples/window/resources/logo.png b/examples/window/assets/logo.png similarity index 100% rename from examples/window/resources/logo.png rename to examples/window/assets/logo.png diff --git a/examples/window/resources/display_config.ron b/examples/window/config/display.ron similarity index 69% rename from examples/window/resources/display_config.ron rename to examples/window/config/display.ron index 0b53971bba..80b30aaf73 100644 --- a/examples/window/resources/display_config.ron +++ b/examples/window/config/display.ron @@ -5,5 +5,5 @@ ( title: "Windowing example", - icon: Some("examples/window/resources/logo.png"), + icon: Some("examples/window/assets/logo.png"), ) diff --git a/examples/window/main.rs b/examples/window/main.rs index 96a5dd880a..dbaf2f7216 100644 --- a/examples/window/main.rs +++ b/examples/window/main.rs @@ -29,7 +29,9 @@ fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = application_root_dir()?; - let display_config_path = app_root.join("examples/window/resources/display_config.ron"); + let display_config_path = app_root.join("examples/window/config/display.ron"); + + let assets_directory = app_root.join("examples/window/assets/"); let mut world = World::new(); @@ -38,7 +40,7 @@ fn main() -> amethyst::Result<()> { WindowBundle::from_config_path(display_config_path), )?; - let mut game = Application::new("./", ExampleState, game_data, world)?; + let mut game = Application::new(assets_directory, ExampleState, game_data, world)?; game.run(); Ok(()) diff --git a/src/state_event.rs b/src/state_event.rs index a5553ac41b..2fdf8787f3 100644 --- a/src/state_event.rs +++ b/src/state_event.rs @@ -1,3 +1,6 @@ +use derivative::Derivative; +use winit::Event; + use crate::{ core::{ ecs::{Read, SystemData, World}, @@ -5,18 +8,18 @@ use crate::{ EventReader, }, derive::EventReader, - input::InputEvent, + input::{BindingTypes, InputEvent, StringBindings}, ui::UiEvent, }; -use winit::Event; /// The enum holding the different types of event that can be received in a `State` in the /// `handle_event` method. -#[derive(Clone, EventReader, Debug)] +#[derive(Debug, Derivative, EventReader)] +#[derivative(Clone(bound = ""))] #[reader(StateEventReader)] -pub enum StateEvent +pub enum StateEvent where - T: Clone + Send + Sync + 'static, + T: BindingTypes, { /// Events sent by the winit window. Window(Event),