summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/README.md4
-rw-r--r--examples/pokedex/src/main.rs11
2 files changed, 10 insertions, 5 deletions
diff --git a/examples/README.md b/examples/README.md
index 32ccf724..10c28cf5 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -118,7 +118,7 @@ cargo run --package <example>
[Ghostscript Tiger]: https://commons.wikimedia.org/wiki/File:Ghostscript_Tiger.svg
## [Coffee]
-Since [Iced was born in May], it has been powering the user interfaces in
+Since [Iced was born in May 2019], it has been powering the user interfaces in
[Coffee], an experimental 2D game engine.
@@ -128,6 +128,6 @@ Since [Iced was born in May], it has been powering the user interfaces in
</a>
</div>
-[Iced was born in May]: https://github.com/hecrj/coffee/pull/35
+[Iced was born in May 2019]: https://github.com/hecrj/coffee/pull/35
[`ui` module]: https://docs.rs/coffee/0.3.2/coffee/ui/index.html
[Coffee]: https://github.com/hecrj/coffee
diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs
index 187e5dee..f432f0fc 100644
--- a/examples/pokedex/src/main.rs
+++ b/examples/pokedex/src/main.rs
@@ -1,6 +1,6 @@
use iced::{
button, futures, image, Align, Application, Button, Column, Command,
- Container, Element, Image, Length, Row, Settings, Text,
+ Container, Element, Length, Row, Settings, Text,
};
pub fn main() -> iced::Result {
@@ -112,16 +112,20 @@ struct Pokemon {
name: String,
description: String,
image: image::Handle,
+ image_viewer: image::viewer::State,
}
impl Pokemon {
const TOTAL: u16 = 807;
- fn view(&self) -> Element<Message> {
+ fn view(&mut self) -> Element<Message> {
Row::new()
.spacing(20)
.align_items(Align::Center)
- .push(Image::new(self.image.clone()))
+ .push(image::Viewer::new(
+ &mut self.image_viewer,
+ self.image.clone(),
+ ))
.push(
Column::new()
.spacing(20)
@@ -200,6 +204,7 @@ impl Pokemon {
.map(|c| if c.is_control() { ' ' } else { c })
.collect(),
image,
+ image_viewer: image::viewer::State::new(),
})
}