diff options
| author | Raymond Hogenson <rhogenson@posteo.net> | 2018-08-20 09:10:49 -0400 |
|---|---|---|
| committer | Raymond Hogenson <rhogenson@posteo.net> | 2018-08-20 09:10:49 -0400 |
| commit | 2d0f2d8ce0dffcacb34aa6ce1388d1b46e1005ad (patch) | |
| tree | 4ca51b9788d678444b9e22509ccd4bdcaad5ee2d /src/state.rs | |
| parent | edb8bd8c4db2df1dee62cbd23f6ca3111a75c67e (diff) | |
| download | stallman-shooter-2d0f2d8ce0dffcacb34aa6ce1388d1b46e1005ad.tar.zst | |
Move assets directly into the binary
Wow rust has a built-in operation for moving binary assets into a file!
That's so cool! Rust is the best language in the world! Does C++ have
this?
Diffstat (limited to 'src/state.rs')
| -rw-r--r-- | src/state.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/state.rs b/src/state.rs index d80c550..820c1e4 100644 --- a/src/state.rs +++ b/src/state.rs @@ -57,7 +57,8 @@ impl<T: StraightBullet> Bullet for T { self.set_real_y(real_y + d_y); } fn delete(&mut self) { - self.set_real_x(-10.); + /* TODO: maybe a more robust way of deleting */ + self.set_real_x(-1000.); } } @@ -120,7 +121,7 @@ pub trait Positioned { fn outside(&self) -> bool { let x = self.x(); let y = self.y(); - x < 0 || x > constants::X_DIM as i32 || y < 0 || y > constants::Y_DIM as i32 + x < -100 || x > constants::X_DIM as i32 + 100 || y < -100 || y > constants::Y_DIM as i32 + 100 } } @@ -136,7 +137,7 @@ impl Positioned for PBullet { } } -pub trait Drawable : Positioned { +pub trait Drawable: Positioned { fn center() -> (u32, u32); fn draw(&self, canvas: &mut sdl2::render::WindowCanvas, texture: &sdl2::render::Texture) { let tw = texture.query().width; |
