rntviewer/src/app_state.h

58 lines
910 B
C
Raw Normal View History

2024-07-10 17:38:16 +00:00
enum Input_Key {
KEY_UP,
KEY_DOWN,
KEY_LEFT,
KEY_RIGHT,
KEY_Q,
KEY_ALT,
KEY_TAB,
KEY_COUNT
};
enum Mouse_Button {
MOUSE_BTN_LEFT,
MOUSE_BTN_RIGHT,
MOUSE_BTN_COUNT
};
enum Mouse_Button_State : u16 {
MOUSE_BTN_STATE_IS_DOWN = 0x1,
MOUSE_BTN_STATE_JUST_PRESSED = 0x2,
MOUSE_BTN_STATE_JUST_RELEASED = 0x4,
};
enum Key_State : u16 {
KEY_STATE_IS_DOWN = 0x1,
KEY_STATE_JUST_PRESSED = 0x2,
KEY_STATE_JUST_RELEASED = 0x4,
};
struct User_Input {
u16 key_state[KEY_COUNT];
u16 mouse_btn_state[MOUSE_BTN_COUNT];
struct { i32 x; i32 y; } mouse_pos;
};
2024-07-10 18:11:42 +00:00
struct Window_Data {
// Real width and height of the window
i32 width;
i32 height;
bool size_just_changed;
f32 desired_aspect_ratio;
};
struct App_State {
Window_Data win_data;
User_Input user_input;
2024-07-10 20:30:49 +00:00
FILE *inspected_file;
u8 *inspected_fmem;
u64 inspected_file_size;
// @Platform: inotify file descriptor
int inot;
2024-07-10 18:11:42 +00:00
};