Added view
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user