summaryrefslogtreecommitdiffstats
path: root/examples/tour/renderer.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-09-19 15:01:12 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-09-19 15:01:12 +0200
commitf9de39ddaa3020a9585b1648afb0ead45dfd7aa9 (patch)
tree04289787e353b4b059354d22ce53f2b79464431c /examples/tour/renderer.rs
parentdd093c79d7da84675be648c7df2ebfc85b5039f2 (diff)
downloadiced-f9de39ddaa3020a9585b1648afb0ead45dfd7aa9.tar.gz
iced-f9de39ddaa3020a9585b1648afb0ead45dfd7aa9.tar.bz2
iced-f9de39ddaa3020a9585b1648afb0ead45dfd7aa9.zip
Unify `web` and `ggez` tour examples :tada:
Diffstat (limited to '')
-rw-r--r--examples/tour/src/iced_ggez/renderer.rs (renamed from examples/tour/renderer.rs)20
1 files changed, 17 insertions, 3 deletions
diff --git a/examples/tour/renderer.rs b/examples/tour/src/iced_ggez/renderer.rs
index 8746dd96..e3181eaa 100644
--- a/examples/tour/renderer.rs
+++ b/examples/tour/src/iced_ggez/renderer.rs
@@ -11,8 +11,11 @@ use ggez::graphics::{
};
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,
@@ -20,14 +23,16 @@ pub struct Renderer<'a> {
debug_mesh: Option<MeshBuilder>,
}
-impl Renderer<'_> {
+impl<'a> Renderer<'a> {
pub fn new(
- context: &mut Context,
+ context: &'a mut Context,
+ images: &'a mut image::Cache,
spritesheet: Image,
font: Font,
- ) -> Renderer {
+ ) -> Renderer<'a> {
Renderer {
context,
+ images,
sprites: SpriteBatch::new(spritesheet.clone()),
spritesheet,
font,
@@ -61,3 +66,12 @@ impl Renderer<'_> {
}
}
}
+
+pub fn into_color(color: iced::Color) -> graphics::Color {
+ graphics::Color {
+ r: color.r,
+ g: color.g,
+ b: color.b,
+ a: color.a,
+ }
+}