Added view

This commit is contained in:
2018-10-05 20:11:12 +02:00
parent 52742c8057
commit 9c88169cf0
6 changed files with 112 additions and 33 deletions
+14 -1
View File
@@ -5,8 +5,11 @@ use std::time::{
use sfml::system::Vector2;
use sfml::window::Event;
use sfml::graphics::IntRect;
use sfml::window::Key;
use sfml::graphics::{
IntRect,
View,
};
use engine::scene::Updatable;
use engine::controls::Controls;
@@ -133,6 +136,16 @@ impl Character {
}
}
/// Returns a reference to the controls.
pub fn controls(&self) -> &Option<Controls> {
&self.controls
}
/// Returns a view that looks at the character.
pub fn view(&self) -> View {
View::new(self.position, Vector2::new(24.0 * 16.0, 24.0 * 9.0))
}
}
impl Updatable for Character {