This repository has been archived by the owner on Jan 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make all mod.rs files only contain mod declarations
- Loading branch information
Showing
8 changed files
with
63 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use Canvas; | ||
use app::App; | ||
use game_object::GameObject; | ||
use component::Message; | ||
|
||
pub trait Component { | ||
fn receive_message(&mut self, app: &mut App, game_object: &mut GameObject, message: &Message); | ||
fn render_gui(&self, canvas: &mut Canvas, game_object: &GameObject); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use std::any::Any; | ||
use component::Component; | ||
|
||
pub trait ComponentAny: Component + Any { | ||
fn as_any(&self) -> &Any; | ||
fn as_any_mut(&mut self) -> &mut Any; | ||
} | ||
|
||
impl<T> ComponentAny for T | ||
where T: Component + Any | ||
{ | ||
fn as_any(&self) -> &Any { | ||
self | ||
} | ||
|
||
fn as_any_mut(&mut self) -> &mut Any { | ||
self | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use std::any::Any; | ||
|
||
pub enum Message { | ||
Start { key: i32 }, | ||
Update { delta_time: f32 }, | ||
OnDestroy, | ||
OnDetach, | ||
UserMessage(Box<Any>), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,8 @@ | ||
use Canvas; | ||
use app::App; | ||
use game_object::GameObject; | ||
use std::any::Any; | ||
mod message; | ||
pub use self::message::Message; | ||
|
||
pub trait Component { | ||
fn receive_message(&mut self, app: &mut App, game_object: &mut GameObject, message: &Message); | ||
fn render_gui(&self, canvas: &mut Canvas, game_object: &GameObject); | ||
} | ||
mod component; | ||
pub use self::component::Component; | ||
|
||
pub trait ComponentAny: Component + Any { | ||
fn as_any(&self) -> &Any; | ||
fn as_any_mut(&mut self) -> &mut Any; | ||
} | ||
|
||
impl<T> ComponentAny for T | ||
where T: Component + Any | ||
{ | ||
fn as_any(&self) -> &Any { | ||
self | ||
} | ||
|
||
fn as_any_mut(&mut self) -> &mut Any { | ||
self | ||
} | ||
} | ||
|
||
pub enum Message { | ||
Start { key: i32 }, | ||
Update { delta_time: f32 }, | ||
OnDestroy, | ||
OnDetach, | ||
UserMessage(Box<Any>), | ||
} | ||
mod component_any; | ||
pub use self::component_any::ComponentAny; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
pub mod texture; | ||
pub mod sprite_sheet; | ||
|
||
use self::texture::Texture; | ||
use self::sprite_sheet::SpriteSheet; | ||
pub enum Sprite { | ||
Texture(Texture), | ||
SpriteSheet(SpriteSheet), | ||
} | ||
mod sprite; | ||
pub use self::sprite::Sprite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use graphics::Texture; | ||
use graphics::SpriteSheet; | ||
|
||
pub enum Sprite { | ||
Texture(Texture), | ||
SpriteSheet(SpriteSheet), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use input::keyboard::Key; | ||
use input::mouse::MouseButton; | ||
|
||
#[derive(Eq, PartialEq, Copy, Clone, Debug, Serialize, Deserialize)] | ||
pub enum Button { | ||
Keyboard(Key), | ||
Mouse(MouseButton), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters