Browse Source

Callbacks::draw() must not mutate the state

master
Astro 1 year ago
parent
commit
6eb7c31406
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      examples/example00.rs
  2. 1
    1
      src/lib.rs

+ 1
- 1
examples/example00.rs View File

@@ -9,7 +9,7 @@ impl Callbacks for Example {
9 9
     }
10 10
     fn handle_event(&mut self, ev: Event) {}
11 11
     fn update(&mut self) {}
12
-    fn draw(&mut self, graphics: &mut Graphics) {}
12
+    fn draw(&self, graphics: &mut Graphics) {}
13 13
     fn clean_up(self) {}
14 14
 }
15 15
 

+ 1
- 1
src/lib.rs View File

@@ -21,7 +21,7 @@ pub trait Callbacks {
21 21
     }
22 22
     fn handle_event(&mut self, ev: Event);
23 23
     fn update(&mut self);
24
-    fn draw(&mut self, graphics: &mut Graphics);
24
+    fn draw(&self, graphics: &mut Graphics);
25 25
     fn clean_up(self);
26 26
 }
27 27
 

Loading…
Cancel
Save