-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Renderer Trait, enum and builder fn
Fixes #12
- Loading branch information
Showing
5 changed files
with
42 additions
and
4 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
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
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
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ pub use legion; | |
pub mod application; | ||
pub mod config; | ||
pub mod utils; | ||
pub mod renderer; |
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 miniquad::Context; | ||
use legion::{World, Resources}; | ||
|
||
/// Trait to implement in order to create a renderer to use in a `Scion` application | ||
pub trait ScionRenderer { | ||
/// The draw method is called each frame | ||
fn draw(&mut self, context: &mut Context, world: &mut World, resource: &mut Resources); | ||
} | ||
|
||
/// Type of renderer to use to render the game. | ||
pub enum RendererType { | ||
Scion2D, | ||
Custom(Box<dyn ScionRenderer>) | ||
} | ||
|
||
impl Default for RendererType{ | ||
fn default() -> Self { | ||
RendererType::Scion2D | ||
} | ||
} |