Skip to main content

e2rcore/interface/
i_ui.rs

1#[derive(Clone, Debug, Copy)]
2pub enum KeyCode {
3    Num1,
4    Num2,
5    Num3,
6    Num4,
7    Num5,
8    Num6,
9    Num7,
10    Num8,
11    Num9,
12    Num0,
13    A,
14    B,
15    C,
16    D,
17    E,
18    F,
19    G,
20    H,
21    I,
22    J,
23    K,
24    L,
25    M,
26    N,
27    O,
28    P,
29    Q,
30    R,
31    S,
32    T,
33    U,
34    V,
35    W,
36    X,
37    Y,
38    Z,
39    Capital,
40    Colon,
41    Comma,
42    Escape,
43    F1,
44    F2,
45    F3,
46    F4,
47    F5,
48    F6,
49    F7,
50    F8,
51    F9,
52    F10,
53    F11,
54    F12,
55    F13,
56    F14,
57    F15,
58    Left,
59    Up,
60    Right,
61    Down,
62    Back,
63    Return,
64    Space,
65    LAlt,
66    LBracket,
67    LControl,
68    LMenu,
69    LShift,
70    LWin,
71    Period,
72    RAlt,
73    RBracket,
74    RControl,
75    RShift,
76    Semicolon,
77    Slash,
78    Tab,
79    Close,
80    MouseL,
81    MouseR,
82}
83
84#[derive(Clone, Debug, Copy)]
85pub enum State {
86    Press,
87    Release,
88}
89
90#[derive(Clone, Debug, Copy)]
91pub enum Coord {
92    X,
93    Y,
94    Z,
95}
96
97#[derive(Clone, Debug, Copy)]
98pub enum InputFiltered {
99    Button{ key: KeyCode, state: State },
100    MouseCoord( Coord, f32 ),
101    MouseCoord2( f32, f32 ),
102    Ignored,
103}
104
105pub trait IUi{
106
107    type EventInput;
108    type EventInputFiltered;
109
110    fn new() -> Self where Self: Sized;
111
112    fn process_input_events( & mut self, e: & [ Self::EventInput ], win_offset: (i32,i32), win_size: (u32,u32) ) -> Vec< Self::EventInputFiltered >;
113}