2019-10-10 18:21:47 +00:00
|
|
|
/*
|
|
|
|
* 4coder event types
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#if !defined(FCODER_EVENTS_H)
|
|
|
|
#define FCODER_EVENTS_H
|
|
|
|
|
2019-11-07 01:36:30 +00:00
|
|
|
typedef void Custom_Command_Function(struct Application_Links *app);
|
|
|
|
|
2019-10-10 18:21:47 +00:00
|
|
|
typedef u32 Key_Code;
|
|
|
|
typedef u32 Mouse_Code;
|
|
|
|
typedef u32 Core_Code;
|
|
|
|
#include "generated/4coder_event_codes.h"
|
|
|
|
|
2019-10-11 01:40:10 +00:00
|
|
|
typedef u32 Input_Event_Kind;
|
2019-10-10 18:21:47 +00:00
|
|
|
enum{
|
2019-11-22 22:09:52 +00:00
|
|
|
InputEventKind_None,
|
2019-10-10 18:21:47 +00:00
|
|
|
InputEventKind_TextInsert,
|
|
|
|
InputEventKind_KeyStroke,
|
2019-10-11 01:40:10 +00:00
|
|
|
InputEventKind_KeyRelease,
|
2019-10-10 18:21:47 +00:00
|
|
|
InputEventKind_MouseButton,
|
2019-10-11 01:40:10 +00:00
|
|
|
InputEventKind_MouseButtonRelease,
|
2019-10-10 18:21:47 +00:00
|
|
|
InputEventKind_MouseWheel,
|
|
|
|
InputEventKind_MouseMove,
|
|
|
|
InputEventKind_Core,
|
2019-11-07 01:36:30 +00:00
|
|
|
InputEventKind_CustomFunction,
|
2019-11-22 22:09:52 +00:00
|
|
|
|
|
|
|
InputEventKind_COUNT,
|
2019-10-10 18:21:47 +00:00
|
|
|
};
|
|
|
|
|
2019-10-11 01:40:10 +00:00
|
|
|
global_const i32 Input_MaxModifierCount = 8;
|
|
|
|
|
|
|
|
struct Input_Modifier_Set{
|
|
|
|
Key_Code *mods;
|
|
|
|
i32 count;
|
2019-10-10 18:21:47 +00:00
|
|
|
};
|
|
|
|
|
2019-10-11 01:40:10 +00:00
|
|
|
struct Input_Modifier_Set_Fixed{
|
|
|
|
Key_Code mods[Input_MaxModifierCount];
|
|
|
|
i32 count;
|
2019-10-10 18:21:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Input_Event{
|
|
|
|
Input_Event_Kind kind;
|
2019-11-23 01:40:07 +00:00
|
|
|
b32 virtual_event;
|
2019-10-10 18:21:47 +00:00
|
|
|
union{
|
|
|
|
struct{
|
|
|
|
String_Const_u8 string;
|
2019-10-10 20:15:47 +00:00
|
|
|
|
|
|
|
// used internally
|
|
|
|
Input_Event *next_text;
|
|
|
|
b32 blocked;
|
2019-10-10 18:21:47 +00:00
|
|
|
} text;
|
|
|
|
struct{
|
|
|
|
Key_Code code;
|
2019-10-11 01:40:10 +00:00
|
|
|
Input_Modifier_Set modifiers;
|
2019-10-10 20:15:47 +00:00
|
|
|
|
|
|
|
// used internally
|
|
|
|
Input_Event *first_dependent_text;
|
2019-10-10 18:21:47 +00:00
|
|
|
} key;
|
|
|
|
struct{
|
|
|
|
Mouse_Code code;
|
|
|
|
Vec2_i32 p;
|
2019-10-11 01:40:10 +00:00
|
|
|
Input_Modifier_Set modifiers;
|
2019-10-10 18:21:47 +00:00
|
|
|
} mouse;
|
|
|
|
struct{
|
|
|
|
f32 value;
|
|
|
|
Vec2_i32 p;
|
2019-10-11 01:40:10 +00:00
|
|
|
Input_Modifier_Set modifiers;
|
2019-10-10 18:21:47 +00:00
|
|
|
} mouse_wheel;
|
|
|
|
struct{
|
|
|
|
Vec2_i32 p;
|
2019-10-11 01:40:10 +00:00
|
|
|
Input_Modifier_Set modifiers;
|
2019-10-10 18:21:47 +00:00
|
|
|
} mouse_move;
|
|
|
|
struct{
|
|
|
|
Core_Code code;
|
2019-10-14 22:57:47 +00:00
|
|
|
union{
|
|
|
|
String_Const_u8 string;
|
|
|
|
i32 id;
|
|
|
|
struct{
|
|
|
|
String_Const_u8_Array flag_strings;
|
|
|
|
String_Const_u8_Array file_names;
|
|
|
|
};
|
|
|
|
};
|
2019-10-10 18:21:47 +00:00
|
|
|
} core;
|
2019-11-07 01:36:30 +00:00
|
|
|
Custom_Command_Function *custom_func;
|
2019-10-10 18:21:47 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Input_Event_Node{
|
|
|
|
Input_Event_Node *next;
|
|
|
|
Input_Event event;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Input_List{
|
|
|
|
Input_Event_Node *first;
|
|
|
|
Input_Event_Node *last;
|
|
|
|
i32 count;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef u32 Event_Property;
|
|
|
|
enum{
|
2019-11-07 01:36:30 +00:00
|
|
|
EventProperty_AnyKey = 0x0001,
|
|
|
|
EventProperty_Escape = 0x0002,
|
|
|
|
EventProperty_AnyKeyRelease = 0x0004,
|
|
|
|
EventProperty_MouseButton = 0x0008,
|
|
|
|
EventProperty_MouseRelease = 0x0010,
|
|
|
|
EventProperty_MouseWheel = 0x0020,
|
|
|
|
EventProperty_MouseMove = 0x0040,
|
|
|
|
EventProperty_Animate = 0x0080,
|
|
|
|
EventProperty_ViewActivation = 0x0100,
|
|
|
|
EventProperty_TextInsert = 0x0200,
|
|
|
|
EventProperty_AnyFile = 0x0400,
|
|
|
|
EventProperty_Startup = 0x0800,
|
2019-10-14 22:57:47 +00:00
|
|
|
EventProperty_Exit = 0x1000,
|
|
|
|
EventProperty_Clipboard = 0x2000,
|
2019-11-07 01:36:30 +00:00
|
|
|
EventProperty_CustomFunction = 0x4000,
|
2019-10-10 18:21:47 +00:00
|
|
|
};
|
|
|
|
enum{
|
|
|
|
EventPropertyGroup_AnyKeyboardEvent =
|
|
|
|
EventProperty_AnyKey|
|
|
|
|
EventProperty_Escape|
|
2019-10-14 05:27:57 +00:00
|
|
|
EventProperty_AnyKeyRelease|
|
2019-10-10 18:21:47 +00:00
|
|
|
EventProperty_TextInsert,
|
|
|
|
EventPropertyGroup_AnyMouseEvent =
|
2019-10-14 05:27:57 +00:00
|
|
|
EventProperty_MouseButton|
|
|
|
|
EventProperty_MouseRelease|
|
2019-10-10 18:21:47 +00:00
|
|
|
EventProperty_MouseWheel|
|
|
|
|
EventProperty_MouseMove,
|
|
|
|
EventPropertyGroup_AnyUserInput =
|
|
|
|
EventPropertyGroup_AnyKeyboardEvent|
|
|
|
|
EventPropertyGroup_AnyMouseEvent,
|
2020-03-01 01:21:37 +00:00
|
|
|
EventPropertyGroup_AnyCore =
|
2019-10-13 20:17:22 +00:00
|
|
|
EventProperty_Animate|
|
2019-10-14 22:57:47 +00:00
|
|
|
EventProperty_ViewActivation|
|
|
|
|
EventProperty_AnyFile|
|
|
|
|
EventProperty_Startup|
|
|
|
|
EventProperty_Exit|
|
2019-11-07 01:36:30 +00:00
|
|
|
EventProperty_Clipboard|
|
2020-03-01 01:21:37 +00:00
|
|
|
EventProperty_Animate,
|
|
|
|
EventPropertyGroup_Any =
|
|
|
|
EventPropertyGroup_AnyUserInput|
|
|
|
|
EventPropertyGroup_AnyCore|
|
2019-11-07 01:36:30 +00:00
|
|
|
EventProperty_CustomFunction,
|
2019-10-10 18:21:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// BOTTOM
|