mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
Separate event for controller movement from pointer raw movement
This commit is contained in:
parent
89725e4676
commit
c4e8729034
@ -316,6 +316,7 @@ static void OnInit(void) {
|
|||||||
|
|
||||||
Camera.Active = &cam_FirstPerson;
|
Camera.Active = &cam_FirstPerson;
|
||||||
Event_Register_(&PointerEvents.RawMoved, NULL, OnRawMovement);
|
Event_Register_(&PointerEvents.RawMoved, NULL, OnRawMovement);
|
||||||
|
Event_Register_(&ControllerEvents.RawMoved, NULL, OnRawMovement);
|
||||||
Event_Register_(&UserEvents.HackPermsChanged, NULL, OnHacksChanged);
|
Event_Register_(&UserEvents.HackPermsChanged, NULL, OnHacksChanged);
|
||||||
|
|
||||||
#ifdef CC_BUILD_WIN
|
#ifdef CC_BUILD_WIN
|
||||||
|
@ -13,6 +13,7 @@ struct _ChatEventsList ChatEvents;
|
|||||||
struct _WindowEventsList WindowEvents;
|
struct _WindowEventsList WindowEvents;
|
||||||
struct _InputEventsList InputEvents;
|
struct _InputEventsList InputEvents;
|
||||||
struct _PointerEventsList PointerEvents;
|
struct _PointerEventsList PointerEvents;
|
||||||
|
struct _ControllerEventsList ControllerEvents;
|
||||||
struct _NetEventsList NetEvents;
|
struct _NetEventsList NetEvents;
|
||||||
|
|
||||||
void Event_Register(struct Event_Void* handlers, void* obj, Event_Void_Callback handler) {
|
void Event_Register(struct Event_Void* handlers, void* obj, Event_Void_Callback handler) {
|
||||||
@ -107,6 +108,8 @@ void Event_UnregisterAll(void) {
|
|||||||
PointerEvents.Up.Count = 0;
|
PointerEvents.Up.Count = 0;
|
||||||
PointerEvents.RawMoved.Count = 0;
|
PointerEvents.RawMoved.Count = 0;
|
||||||
|
|
||||||
|
ControllerEvents.RawMoved.Count = 0;
|
||||||
|
|
||||||
NetEvents.Connected.Count = 0;
|
NetEvents.Connected.Count = 0;
|
||||||
NetEvents.Disconnected.Count = 0;
|
NetEvents.Disconnected.Count = 0;
|
||||||
NetEvents.PluginMessageReceived.Count = 0;
|
NetEvents.PluginMessageReceived.Count = 0;
|
||||||
|
@ -193,6 +193,10 @@ CC_VAR extern struct _PointerEventsList {
|
|||||||
struct Event_RawMove RawMoved; /* Raw pointer position changed (Arg is delta) */
|
struct Event_RawMove RawMoved; /* Raw pointer position changed (Arg is delta) */
|
||||||
} PointerEvents;
|
} PointerEvents;
|
||||||
|
|
||||||
|
CC_VAR extern struct _ControllerEventsList {
|
||||||
|
struct Event_RawMove RawMoved; /* Raw analog controller movement (Arg is delta) */
|
||||||
|
} ControllerEvents;
|
||||||
|
|
||||||
CC_VAR extern struct _NetEventsList {
|
CC_VAR extern struct _NetEventsList {
|
||||||
struct Event_Void Connected; /* Connection to a server was established */
|
struct Event_Void Connected; /* Connection to a server was established */
|
||||||
struct Event_Void Disconnected; /* Connection to the server was lost */
|
struct Event_Void Disconnected; /* Connection to the server was lost */
|
||||||
|
@ -115,7 +115,7 @@ static void ProcessJoystickInput(circlePosition* pos, double delta) {
|
|||||||
if (Math_AbsI(pos->dx) <= 16) pos->dx = 0;
|
if (Math_AbsI(pos->dx) <= 16) pos->dx = 0;
|
||||||
if (Math_AbsI(pos->dy) <= 16) pos->dy = 0;
|
if (Math_AbsI(pos->dy) <= 16) pos->dy = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, pos->dx * scale, -pos->dy * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, pos->dx * scale, -pos->dy * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessTouchInput(int mods) {
|
static void ProcessTouchInput(int mods) {
|
||||||
|
@ -201,7 +201,7 @@ static void HandleController(cont_state_t* state, double delta) {
|
|||||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx * scale, dy * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, dx * scale, dy * scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ static void ProcessPAD_RightJoystick(double delta) {
|
|||||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx * scale, -dy * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, dx * scale, -dy * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessPAD_Buttons(void) {
|
static void ProcessPAD_Buttons(void) {
|
||||||
@ -317,7 +317,7 @@ static void ProcessClassic_RightJoystick(struct joystick_t* js, double delta) {
|
|||||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx * scale, -dy * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, dx * scale, -dy * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessClassicButtons(int mods) {
|
static void ProcessClassicButtons(int mods) {
|
||||||
|
@ -104,7 +104,7 @@ static void ProcessAnalogInput(joypad_inputs_t* inputs, double delta) {
|
|||||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx * scale, -dy * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, dx * scale, -dy * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_ProcessEvents(double delta) {
|
void Window_ProcessEvents(double delta) {
|
||||||
|
@ -125,7 +125,7 @@ static void HandleJoystick_Right(int x, int y, double delta) {
|
|||||||
if (Math_AbsI(x) <= 8) x = 0;
|
if (Math_AbsI(x) <= 8) x = 0;
|
||||||
if (Math_AbsI(y) <= 8) y = 0;
|
if (Math_AbsI(y) <= 8) y = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, x * scale, y * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, x * scale, y * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessPadInput(double delta, struct padButtonStatus* pad) {
|
static void ProcessPadInput(double delta, struct padButtonStatus* pad) {
|
||||||
|
@ -277,7 +277,7 @@ static void HandleJoystick_Right(int x, int y, double delta) {
|
|||||||
if (Math_AbsI(x) <= 32) x = 0;
|
if (Math_AbsI(x) <= 32) x = 0;
|
||||||
if (Math_AbsI(y) <= 32) y = 0;
|
if (Math_AbsI(y) <= 32) y = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, x * scale, y * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, x * scale, y * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessPadInput(double delta, padData* pad) {
|
static void ProcessPadInput(double delta, padData* pad) {
|
||||||
|
@ -93,7 +93,7 @@ static void ProcessCircleInput(SceCtrlData* pad, double delta) {
|
|||||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx * scale, dy * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, dx * scale, dy * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_ProcessEvents(double delta) {
|
void Window_ProcessEvents(double delta) {
|
||||||
|
@ -122,7 +122,7 @@ static void ProcessRCircleInput(SceCtrlData* pad, double delta) {
|
|||||||
if (Math_AbsI(dx) <= 8) dx = 0;
|
if (Math_AbsI(dx) <= 8) dx = 0;
|
||||||
if (Math_AbsI(dy) <= 8) dy = 0;
|
if (Math_AbsI(dy) <= 8) dy = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, dx * scale, dy * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, dx * scale, dy * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessTouchPress(int x, int y) {
|
static void ProcessTouchPress(int x, int y) {
|
||||||
|
@ -561,7 +561,7 @@ static void ProcessGamepadCamera(float x, float y, double delta) {
|
|||||||
if (y >= -0.1 && y <= 0.1) y = 0;
|
if (y >= -0.1 && y <= 0.1) y = 0;
|
||||||
if (x == 0 && y == 0) return;
|
if (x == 0 && y == 0) return;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, x * scale, y * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, x * scale, y * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessGamepadMovement(float x, float y) {
|
static void ProcessGamepadMovement(float x, float y) {
|
||||||
|
@ -156,7 +156,7 @@ static void HandleJoystick_Right(int x, int y, double delta) {
|
|||||||
if (Math_AbsI(x) <= 256) x = 0;
|
if (Math_AbsI(x) <= 256) x = 0;
|
||||||
if (Math_AbsI(y) <= 256) y = 0;
|
if (Math_AbsI(y) <= 256) y = 0;
|
||||||
|
|
||||||
Event_RaiseRawMove(&PointerEvents.RawMoved, x * scale, -y * scale);
|
Event_RaiseRawMove(&ControllerEvents.RawMoved, x * scale, -y * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_ProcessEvents(double delta) {
|
void Window_ProcessEvents(double delta) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user