Update crates.

Fmt.
Clippy.
This commit is contained in:
2017-11-21 09:50:59 +01:00
parent ec42cb33e0
commit ac57e9ee38
13 changed files with 320 additions and 194 deletions

View File

@@ -1,7 +1,8 @@
use sdl2::rect::Rect;
use sdl2::render::Renderer;
use sdl2::render::Canvas;
use sdl2::video::Window;
use component::{Updatable, Renderable};
use component::{Renderable, Updatable};
pub struct GameObject<'a> {
@@ -9,8 +10,8 @@ pub struct GameObject<'a> {
pub y: f32,
pub w: u32,
pub h: u32,
pub dx: f32, // TODO moved to PlayerPhysicsComponent
pub dy: f32, // TODO moved to PlayerPhysicsComponent
pub dx: f32, // TODO moved to PlayerPhysicsComponent
pub dy: f32, // TODO moved to PlayerPhysicsComponent
pub gravity: f32, // TODO moved to PlayerPhysicsComponent
pub on_ground: bool,
physics: Box<Updatable + 'a>,
@@ -18,11 +19,12 @@ pub struct GameObject<'a> {
}
impl<'a> GameObject<'a> {
pub fn new(x: f32,
y: f32,
physics: Box<Updatable + 'a>,
graphics: Box<Renderable + 'a>)
-> GameObject<'a> {
pub fn new(
x: f32,
y: f32,
physics: Box<Updatable + 'a>,
graphics: Box<Renderable + 'a>,
) -> GameObject<'a> {
GameObject {
x: x,
y: y,
@@ -43,7 +45,7 @@ impl<'a> GameObject<'a> {
}
#[inline]
pub fn render(&self, elapsed: f64, renderer: &mut Renderer, destination: &Rect) {
pub fn render(&self, elapsed: f64, renderer: &mut Canvas<Window>, destination: &Rect) {
self.graphics.render(self, elapsed, renderer, destination);
}