Pausing rendering, warnings cleanup, more statistics
This commit is contained in:
+10
-3
@@ -3,7 +3,7 @@ mod player;
|
||||
pub mod world;
|
||||
use std::time::Instant;
|
||||
use crate::renderer::content_view::ContentView;
|
||||
use cgmath::{SquareMatrix, Point3, InnerSpace};
|
||||
use cgmath::Point3;
|
||||
use winit::event::Event;
|
||||
use crate::renderer::{camera::CameraTransform};
|
||||
use player::Player;
|
||||
@@ -16,6 +16,7 @@ pub enum GameState {
|
||||
}
|
||||
|
||||
pub struct Game {
|
||||
state: GameState,
|
||||
player: Player,
|
||||
world: World
|
||||
}
|
||||
@@ -23,6 +24,7 @@ pub struct Game {
|
||||
impl Game {
|
||||
pub fn new(content: &mut dyn ContentView) -> Self {
|
||||
let mut app = Self {
|
||||
state: GameState::Paused,
|
||||
player: Player::new(),
|
||||
world: World::new("default".to_string())
|
||||
};
|
||||
@@ -62,7 +64,7 @@ impl Game {
|
||||
self.player.camera_controller.handle_input(event);
|
||||
}
|
||||
|
||||
pub fn update_state(&mut self, requested_state: GameState) -> GameState {
|
||||
pub fn update_state(&mut self, requested_state: GameState) -> &GameState {
|
||||
match requested_state {
|
||||
GameState::Paused => {
|
||||
self.player.camera_controller.set_enabled(false);
|
||||
@@ -73,7 +75,12 @@ impl Game {
|
||||
};
|
||||
|
||||
// Currently we are not preventing any state changes, just return requested state
|
||||
requested_state
|
||||
self.state = requested_state;
|
||||
&self.state
|
||||
}
|
||||
|
||||
pub fn get_state(&self) -> &GameState {
|
||||
&self.state
|
||||
}
|
||||
|
||||
pub fn update_camera(&mut self, delta: f32, camera_transform: &mut dyn CameraTransform) {
|
||||
|
||||
Reference in New Issue
Block a user