2019-10-30 14:28:02 +00:00
|
|
|
#define FOLDHAUS_INPUT_COMMAND_PROC(name) void name(app_state* State, input_entry Event, mouse_state Mouse)
|
2019-07-19 20:56:21 +00:00
|
|
|
typedef FOLDHAUS_INPUT_COMMAND_PROC(input_command_proc);
|
|
|
|
|
2019-11-02 17:29:51 +00:00
|
|
|
// NOTE(Peter): Helper function so I don't have to remember the parameters to this define
|
|
|
|
#define ExecFoldhausCommand(cmd) cmd(State, Event, Mouse)
|
|
|
|
|
2019-11-01 16:09:05 +00:00
|
|
|
enum input_command_flags
|
|
|
|
{
|
|
|
|
Command_Began = 1 << 0,
|
|
|
|
Command_Held = 1 << 1,
|
|
|
|
Command_Ended = 1 << 2,
|
|
|
|
};
|
|
|
|
|
2019-11-02 14:02:11 +00:00
|
|
|
#define Command_Any Command_Began | Command_Held | Command_Ended
|
|
|
|
|
2019-07-19 20:56:21 +00:00
|
|
|
// TODO(Peter): At the moment these are all key press commands. Need a way to differentiate between
|
|
|
|
// press and hold. Probably add a second array to input_command_Registry
|
|
|
|
struct input_command
|
|
|
|
{
|
|
|
|
key_code Key;
|
|
|
|
key_code Mdfr;
|
2019-11-02 17:29:51 +00:00
|
|
|
b32 Flags;
|
2019-07-19 20:56:21 +00:00
|
|
|
input_command_proc* Proc;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct input_command_registry
|
|
|
|
{
|
|
|
|
input_command* Commands;
|
|
|
|
s32 Size;
|
|
|
|
s32 Used;
|
|
|
|
|
|
|
|
input_command_proc* MouseWheelCommand;
|
|
|
|
};
|
2019-10-30 14:28:02 +00:00
|
|
|
|
|
|
|
struct command_queue_entry
|
|
|
|
{
|
|
|
|
input_command Command;
|
|
|
|
input_entry Event;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct input_command_queue
|
|
|
|
{
|
|
|
|
s32 Size;
|
|
|
|
s32 Used;
|
|
|
|
command_queue_entry* Commands;
|
|
|
|
};
|