aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-03-23 07:38:54 +0000
committerAkshay <[email protected]>2021-03-23 07:38:54 +0000
commit66c427ef00014f5939ba23f00fbc7f8fd089b66b (patch)
treea173d27f533ae0ceaa6fa822f725410950d46d4e /src/app.rs
parent6541f29a0eb16ba2a0459376d38466b8563f5d2d (diff)
add invert function and keybinds
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/app.rs b/src/app.rs
index 063f54f..f6e2b96 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -30,28 +30,30 @@ pub enum Mode {
30} 30}
31 31
32pub struct AppState<'ctx> { 32pub 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
52struct Grid { 54pub struct Grid {
53 enabled: bool, 55 pub enabled: bool,
54 color: Color, 56 pub color: Color,
55} 57}
56 58
57impl Grid { 59impl 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();