diff options
author | 2019-10-03 00:01:45 +0200 | |
---|---|---|
committer | 2019-10-03 00:01:45 +0200 | |
commit | e1b9d42bf1443ae4958aa9303255ef19c635debb (patch) | |
tree | a7b7615dabc328a90300488ab8623740417277c8 /examples/tour/src/iced_ggez/renderer.rs | |
parent | 67d3fe67f312c4dfe9fe4af0f0cbc7cb23c30072 (diff) | |
download | iced-e1b9d42bf1443ae4958aa9303255ef19c635debb.tar.gz iced-e1b9d42bf1443ae4958aa9303255ef19c635debb.tar.bz2 iced-e1b9d42bf1443ae4958aa9303255ef19c635debb.zip |
Start `iced_winit` and `iced_wgpu`
Diffstat (limited to 'examples/tour/src/iced_ggez/renderer.rs')
-rw-r--r-- | examples/tour/src/iced_ggez/renderer.rs | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/examples/tour/src/iced_ggez/renderer.rs b/examples/tour/src/iced_ggez/renderer.rs deleted file mode 100644 index c0e6d559..00000000 --- a/examples/tour/src/iced_ggez/renderer.rs +++ /dev/null @@ -1,77 +0,0 @@ -mod button; -mod checkbox; -mod debugger; -mod image; -mod radio; -mod slider; -mod text; - -use ggez::graphics::{ - self, spritebatch::SpriteBatch, Font, Image, MeshBuilder, -}; -use ggez::Context; - -pub use image::Cache; - -pub struct Renderer<'a> { - pub context: &'a mut Context, - pub images: &'a mut image::Cache, - pub sprites: SpriteBatch, - pub spritesheet: Image, - pub font: Font, - font_size: f32, - debug_mesh: Option<MeshBuilder>, -} - -impl<'a> Renderer<'a> { - pub fn new( - context: &'a mut Context, - images: &'a mut image::Cache, - spritesheet: Image, - font: Font, - ) -> Renderer<'a> { - Renderer { - context, - images, - sprites: SpriteBatch::new(spritesheet.clone()), - spritesheet, - font, - font_size: 20.0, - debug_mesh: None, - } - } - - pub fn flush(&mut self) { - graphics::draw( - self.context, - &self.sprites, - graphics::DrawParam::default(), - ) - .expect("Draw sprites"); - - graphics::draw_queued_text( - self.context, - graphics::DrawParam::default(), - Default::default(), - graphics::FilterMode::Linear, - ) - .expect("Draw text"); - - if let Some(debug_mesh) = self.debug_mesh.take() { - let mesh = - debug_mesh.build(self.context).expect("Build debug mesh"); - - graphics::draw(self.context, &mesh, graphics::DrawParam::default()) - .expect("Draw debug mesh"); - } - } -} - -pub fn into_color(color: iced_native::Color) -> graphics::Color { - graphics::Color { - r: color.r, - g: color.g, - b: color.b, - a: color.a, - } -} |