1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
extern crate crossterm;
use crossterm::event::{DisableMouseCapture, EnableMouseCapture};
use crossterm::execute;

extern crate std;
use std::io::Write;

#[derive(Clone, Copy)]
pub enum UserEvent {
  Continue,
  Exit,
  Generate,
  GenerationError,
  GridName,
  GridNumberError,
  LogOverflow,
  RenameGrid,
  SetBrushColor,
  SetGenerationNumber,
  SetTextureFormat,
  Shutdown,
  SwitchGridsError,
  SwitchGridsOrder,
  UnavailableThread,
}

pub fn disable_mouse_capture(stdout: &mut std::io::Stdout) {
  execute!(stdout, DisableMouseCapture).unwrap();
}

pub fn enable_mouse_capture(stdout: &mut std::io::Stdout) {
  execute!(stdout, EnableMouseCapture).unwrap();
}