diff options
Diffstat (limited to 'client/src/state.rs')
-rw-r--r-- | client/src/state.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/client/src/state.rs b/client/src/state.rs index a658f51..c3d8eb1 100644 --- a/client/src/state.rs +++ b/client/src/state.rs @@ -14,7 +14,9 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -use crate::{camera::Camera, download::Downloader, network::Network, renderer::Renderer}; +use crate::{ + audio::Audio, camera::Camera, download::Downloader, network::Network, renderer::Renderer, +}; use anyhow::{Context, Result}; use glam::{Vec2, Vec3}; use log::{info, warn}; @@ -34,6 +36,7 @@ pub struct State<'a> { pub tree: SceneTree, pub camera: Camera, pub input_state: InputState, + pub audio: Audio, pub prefab_index: Arc<PrefabIndex>, pub prefab_index_res_loaded: Option<Resource<PrefabIndex>>, @@ -54,6 +57,7 @@ impl<'a> State<'a> { info!("new state"); let downloader = Arc::new(Downloader::new(ResourceStore::new_env()?)); Ok(Self { + audio: Audio::new()?, camera: Camera::new(), network: Network::new(conn).into(), tree: SceneTree::default(), @@ -133,6 +137,8 @@ impl<'a> State<'a> { let dt = (now - self.input_state.time).as_secs_f32(); self.input_state.time = now; + self.audio.update(); + self.camera .update(self.input_state.move_dir, self.input_state.mouse_acc, dt); self.input_state.mouse_acc = Vec2::ZERO; |