summaryrefslogtreecommitdiffstats
path: root/examples/solar_system
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-30 18:00:15 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-30 18:10:15 +0200
commitc4c5216e3b69d732b0518d510f95675a4ba7010b (patch)
tree25e14890319bbab46aeb5133ef1c694959b9f694 /examples/solar_system
parent6e9ab1cd6f5358d323040379e3aadbed2cc4f7f8 (diff)
downloadiced-c4c5216e3b69d732b0518d510f95675a4ba7010b.tar.gz
iced-c4c5216e3b69d732b0518d510f95675a4ba7010b.tar.bz2
iced-c4c5216e3b69d732b0518d510f95675a4ba7010b.zip
Allow passing external state to `Application::new`
Diffstat (limited to 'examples/solar_system')
-rw-r--r--examples/solar_system/src/main.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs
index 4c239806..1967b7c5 100644
--- a/examples/solar_system/src/main.rs
+++ b/examples/solar_system/src/main.rs
@@ -7,8 +7,8 @@
//!
//! [1]: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations#An_animated_solar_system
use iced::{
- canvas, executor, Application, Canvas, Color, Command, Container, Element,
- Length, Point, Settings, Size, Subscription, Vector,
+ canvas, executor, window, Application, Canvas, Color, Command, Container,
+ Element, Length, Point, Settings, Size, Subscription, Vector,
};
use std::time::Instant;
@@ -33,8 +33,9 @@ enum Message {
impl Application for SolarSystem {
type Executor = executor::Default;
type Message = Message;
+ type Flags = ();
- fn new() -> (Self, Command<Message>) {
+ fn new(_flags: ()) -> (Self, Command<Message>) {
(
SolarSystem {
state: State::new(),
@@ -95,7 +96,7 @@ impl State {
pub fn new() -> State {
let now = Instant::now();
- let (width, height) = Settings::default().window.size;
+ let (width, height) = window::Settings::default().size;
State {
start: now,