diff options
Diffstat (limited to 'src/app.rs')
-rw-r--r-- | src/app.rs | 44 |
1 files changed, 24 insertions, 20 deletions
@@ -30,28 +30,30 @@ pub enum Mode { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | pub struct AppState<'ctx> { | 32 | pub struct AppState<'ctx> { |
33 | active_color: bool, | 33 | pub active_color: bool, |
34 | brush_size: u8, | 34 | pub brush_size: u8, |
35 | canvas: Canvas<Window>, | 35 | pub canvas: Canvas<Window>, |
36 | context: &'ctx Sdl, | 36 | pub command_box: CommandBox, |
37 | current_operation: Operation, | 37 | pub context: &'ctx Sdl, |
38 | dither_level: u8, | 38 | pub current_operation: Operation, |
39 | grid: Grid, | 39 | pub dither_level: u8, |
40 | last_point: Option<MapPoint>, | 40 | pub grid: Grid, |
41 | mode: Mode, | 41 | pub last_point: Option<MapPoint>, |
42 | mouse: (i32, i32), | 42 | pub lisp_env: Environment, |
43 | pixmap: Pixmap<bool>, | 43 | pub message: Message, |
44 | start: Point, | 44 | pub mode: Mode, |
45 | symmetry: Symmetry, | 45 | pub mouse: (i32, i32), |
46 | ttf_context: &'ctx Sdl2TtfContext, | 46 | pub pixmap: Pixmap<bool>, |
47 | undo_stack: UndoStack<Operation>, | 47 | pub start: Point, |
48 | command_box: CommandBox, | 48 | pub symmetry: Symmetry, |
49 | zoom: u8, | 49 | pub ttf_context: &'ctx Sdl2TtfContext, |
50 | pub undo_stack: UndoStack<Operation>, | ||
51 | pub zoom: u8, | ||
50 | } | 52 | } |
51 | 53 | ||
52 | struct Grid { | 54 | pub struct Grid { |
53 | enabled: bool, | 55 | pub enabled: bool, |
54 | color: Color, | 56 | pub color: Color, |
55 | } | 57 | } |
56 | 58 | ||
57 | impl Grid { | 59 | impl Grid { |
@@ -563,6 +565,8 @@ impl<'ctx> AppState<'ctx> { | |||
563 | Keycode::X => self.change_active_color(), | 565 | Keycode::X => self.change_active_color(), |
564 | // toggle grid | 566 | // toggle grid |
565 | Keycode::Tab => self.toggle_grid(), | 567 | Keycode::Tab => self.toggle_grid(), |
568 | // invert canvas | ||
569 | Keycode::I => self.pixmap.invert(), | ||
566 | // line drawing | 570 | // line drawing |
567 | Keycode::F => { | 571 | Keycode::F => { |
568 | let end: Point = (mouse.x(), mouse.y()).into(); | 572 | let end: Point = (mouse.x(), mouse.y()).into(); |