From d04c9a3f86f3a564e5354bdb235dbd6003f90372 Mon Sep 17 00:00:00 2001 From: Timon Date: Wed, 28 Nov 2018 22:18:53 +0100 Subject: [PATCH 1/4] Removed unnecessary code --- amethyst_network/src/network_socket.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/amethyst_network/src/network_socket.rs b/amethyst_network/src/network_socket.rs index 681dc758b2..a7f530698f 100644 --- a/amethyst_network/src/network_socket.rs +++ b/amethyst_network/src/network_socket.rs @@ -187,12 +187,10 @@ where } for raw_event in self.rx.try_iter() { - let mut matched = false; // Get the NetConnection from the source for net_connection in (&mut net_connections).join() { // We found the origin if net_connection.target == raw_event.source { - matched = true; // Get the event let net_event = deserialize_event::(raw_event.data.as_slice()); match net_event { @@ -204,9 +202,8 @@ where e, raw_event.source ), } - } - if !matched { - println!("Received packet from unknown source"); + } else { + warn!("Received packet from unknown source"); } } } From 19538454a60549d05ee6a0ffd54cef6d7bdc8ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lupien=20=28Jojolepro=29?= Date: Wed, 12 Dec 2018 14:18:42 -0500 Subject: [PATCH 2/4] Fixed wrong reported screen dimensions, and initial screen dimensions (DisplayConfig). --- amethyst_renderer/src/renderer.rs | 8 +++++--- amethyst_renderer/src/system.rs | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/amethyst_renderer/src/renderer.rs b/amethyst_renderer/src/renderer.rs index 7552acd3c0..d2f7cb730d 100644 --- a/amethyst_renderer/src/renderer.rs +++ b/amethyst_renderer/src/renderer.rs @@ -182,16 +182,18 @@ impl RendererBuilder { wb = wb.with_fullscreen(Some(self.events.get_primary_monitor())); } + let hidpi = self.events.get_primary_monitor().get_hidpi_factor(); + if let Some(dimensions) = self.config.dimensions { - wb = wb.with_dimensions(dimensions.into()); + wb = wb.with_dimensions(LogicalSize::from_physical(dimensions, hidpi)); } if let Some(dimensions) = self.config.min_dimensions { - wb = wb.with_min_dimensions(dimensions.into()); + wb = wb.with_min_dimensions(LogicalSize::from_physical(dimensions, hidpi)); } if let Some(dimensions) = self.config.max_dimensions { - wb = wb.with_max_dimensions(dimensions.into()); + wb = wb.with_max_dimensions(LogicalSize::from_physical(dimensions, hidpi)); } self.winit_builder = wb; diff --git a/amethyst_renderer/src/system.rs b/amethyst_renderer/src/system.rs index 4c36cf3a7b..731bb5094e 100644 --- a/amethyst_renderer/src/system.rs +++ b/amethyst_renderer/src/system.rs @@ -127,8 +127,10 @@ where screen_dimensions.dirty = false; } + let hidpi = self.renderer.window().get_hidpi_factor(); + if let Some(size) = self.renderer.window().get_inner_size() { - let (window_width, window_height): (f64, f64) = size.into(); + let (window_width, window_height): (f64, f64) = size.to_physical(hidpi).into(); // Send window size changes to the resource if (window_width, window_height) != (width, height) { @@ -139,7 +141,7 @@ where screen_dimensions.dirty = false; } } - screen_dimensions.update_hidpi_factor(self.renderer.window().get_hidpi_factor()); + screen_dimensions.update_hidpi_factor(hidpi); } fn render(&mut self, (mut event_handler, data): RenderData<'_, P>) { From 3e0ae6466f73ae9506be06e0012d0f9e629a7993 Mon Sep 17 00:00:00 2001 From: Johannes Boczek Date: Wed, 12 Dec 2018 22:24:13 +0100 Subject: [PATCH 3/4] Add example Ron configs to docs --- amethyst_input/src/bindings.rs | 22 ++++++++++++++++++++++ amethyst_renderer/src/config.rs | 16 ++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/amethyst_input/src/bindings.rs b/amethyst_input/src/bindings.rs index afdd85479a..627cd16490 100644 --- a/amethyst_input/src/bindings.rs +++ b/amethyst_input/src/bindings.rs @@ -10,6 +10,28 @@ use super::{Axis, Button}; /// Used for saving and loading input settings. /// /// An action can either be a single button or a combination of them. +/// +/// # Examples +/// +/// Example Ron config file: +/// ```ron +/// ( +/// axes: { +/// "updown": Emulated( +/// pos: Key(Up), +/// neg: Key(Down) +/// ), +/// "leftright": Emulated( +/// pos: Key(Right), +/// neg: Key(Left) +/// ) +/// }, +/// actions: { +/// "fire": [ [Mouse(Left)], [Key(X)] ], // Up to four bindings for one action +/// "reload": [ [Key(LControl), Key(R)] ] // Combinations of two bindings possible +/// } +/// ) +/// ``` #[derive(Derivative, Serialize, Deserialize, Clone)] #[derivative(Default(bound = ""))] pub struct Bindings diff --git a/amethyst_renderer/src/config.rs b/amethyst_renderer/src/config.rs index 4310fb0593..5d1f061315 100644 --- a/amethyst_renderer/src/config.rs +++ b/amethyst_renderer/src/config.rs @@ -3,6 +3,22 @@ use winit::{self, dpi::LogicalSize, WindowBuilder}; /// Structure for holding the renderer configuration. +/// +/// # Examples +/// +/// Example Ron config file: +/// ```ron +/// ( +/// title: "Game title", +/// dimensions: Some((640, 480)), +/// max_dimensions: None, +/// min_dimensions: None, +/// fullscreen: false, +/// multisampling: 0, +/// visibility: true, +/// vsync: true +/// ) +/// ``` #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] pub struct DisplayConfig { /// Name of the application window. From 0e393dca444629dfd3ccaa07257a51dabe3a5264 Mon Sep 17 00:00:00 2001 From: Johannes Boczek Date: Thu, 13 Dec 2018 21:14:30 +0100 Subject: [PATCH 4/4] Fix comment in input Ron example --- amethyst_input/src/bindings.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amethyst_input/src/bindings.rs b/amethyst_input/src/bindings.rs index 627cd16490..2ed65fcfc9 100644 --- a/amethyst_input/src/bindings.rs +++ b/amethyst_input/src/bindings.rs @@ -27,8 +27,8 @@ use super::{Axis, Button}; /// ) /// }, /// actions: { -/// "fire": [ [Mouse(Left)], [Key(X)] ], // Up to four bindings for one action -/// "reload": [ [Key(LControl), Key(R)] ] // Combinations of two bindings possible +/// "fire": [ [Mouse(Left)], [Key(X)] ], // Multiple bindings for one action +/// "reload": [ [Key(LControl), Key(R)] ] // Combinations of multiple bindings possible /// } /// ) /// ```