Write documentation for new canvas module
This commit is contained in:
parent
570f769744
commit
9c067562fa
17 changed files with 434 additions and 196 deletions
|
|
@ -12,7 +12,7 @@ pub fn main() {
|
|||
|
||||
struct Clock {
|
||||
now: LocalTime,
|
||||
clock: canvas::layer::Cached<LocalTime>,
|
||||
clock: canvas::layer::Cache<LocalTime>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
@ -28,7 +28,7 @@ impl Application for Clock {
|
|||
(
|
||||
Clock {
|
||||
now: chrono::Local::now().into(),
|
||||
clock: canvas::layer::Cached::new(),
|
||||
clock: canvas::layer::Cache::new(),
|
||||
},
|
||||
Command::none(),
|
||||
)
|
||||
|
|
@ -91,7 +91,7 @@ impl From<chrono::DateTime<chrono::Local>> for LocalTime {
|
|||
}
|
||||
}
|
||||
|
||||
impl canvas::layer::Drawable for LocalTime {
|
||||
impl canvas::Drawable for LocalTime {
|
||||
fn draw(&self, frame: &mut canvas::Frame) {
|
||||
let center = frame.center();
|
||||
let radius = frame.width().min(frame.height()) / 2.0;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub fn main() {
|
|||
|
||||
struct SolarSystem {
|
||||
state: State,
|
||||
solar_system: canvas::layer::Cached<State>,
|
||||
solar_system: canvas::layer::Cache<State>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
@ -38,7 +38,7 @@ impl Application for SolarSystem {
|
|||
(
|
||||
SolarSystem {
|
||||
state: State::new(),
|
||||
solar_system: canvas::layer::Cached::new(),
|
||||
solar_system: canvas::layer::Cache::new(),
|
||||
},
|
||||
Command::none(),
|
||||
)
|
||||
|
|
@ -125,7 +125,7 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
impl canvas::layer::Drawable for State {
|
||||
impl canvas::Drawable for State {
|
||||
fn draw(&self, frame: &mut canvas::Frame) {
|
||||
use canvas::{Fill, Path, Stroke};
|
||||
use std::f32::consts::PI;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue