Fumofumotris/rewrite/c/input.h

55 lines
601 B
C
Raw Normal View History

2024-05-24 05:36:13 +00:00
#include "fumocommon.h"
enum InputType {
BUTTON,
AXIS,
JOYSTICK
};
union InputData {
struct Button {
u64 value;
} but;
struct Axis {
i64 value;
} axis;
struct Joystick {
i32 x;
i32 y;
} js;
};
struct InputRecord {
union InputData data;
nsec time;
u16 scan_code;
u8 type;
bool is_down;
};
struct InputVAxis {
union InputData data;
nsec last_pressed;
nsec last_released;
u8 type;
bool is_down;
bool is_held;
bool is_up;
};
typedef struct InputVBind;
struct InputVBind {
struct InputVBind *link;
struct InputVAxis *v_axis;
union InputData relationship;
};