mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-04 16:31:30 +00:00
[ruamoko] Wrap some more input functions
IN_UpdateAxis (for nice handling of axis updates, especially relative motion for mice) and IN_Binding_HandleEvent because registering an event handler blocks qwaq's internall call to IN_Binding_HandleEvent.
This commit is contained in:
parent
d409e595a8
commit
1bcc4dddb6
3 changed files with 24 additions and 0 deletions
|
@ -154,6 +154,14 @@ bi_IN_ProcessEvents (progs_t *pr, void *_res)
|
|||
IN_ProcessEvents ();
|
||||
}
|
||||
|
||||
static void
|
||||
bi_IN_UpdateAxis (progs_t *pr, void *_res)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
in_axis_t *axis = &P_STRUCT (pr, in_axis_t, 0);
|
||||
R_FLOAT(pr) = IN_UpdateAxis (axis);
|
||||
}
|
||||
|
||||
static void
|
||||
bi_IN_ClearStates (progs_t *pr, void *_res)
|
||||
{
|
||||
|
@ -491,6 +499,14 @@ bi_IMT_SetContext (progs_t *pr, void *_res)
|
|||
IMT_SetContext (P_INT (pr, 0));
|
||||
}
|
||||
|
||||
static void
|
||||
bi_IN_Binding_HandleEvent (progs_t *pr, void *_res)
|
||||
{
|
||||
qfZoneScoped (true);
|
||||
auto ie_event = (struct IE_event_s *) P_GPOINTER (pr, 0);
|
||||
IN_Binding_HandleEvent (ie_event);
|
||||
}
|
||||
|
||||
static void
|
||||
secured (progs_t *pr, void *_res)
|
||||
{
|
||||
|
@ -528,6 +544,7 @@ static builtin_t builtins[] = {
|
|||
bi(IN_GetAxisNumber, 2, p(int), p(string)),
|
||||
bi(IN_GetButtonNumber, 2, p(int), p(string)),
|
||||
bi(IN_ProcessEvents, 0),
|
||||
bi(IN_UpdateAxis, 1, p(ptr)),
|
||||
bi(IN_ClearStates, 0),
|
||||
bi(IN_GetAxisInfo, 3, p(int), p(int), p(ptr)),
|
||||
bi(IN_GetButtonInfo, 3, p(int), p(int), p(ptr)),
|
||||
|
@ -552,6 +569,8 @@ static builtin_t builtins[] = {
|
|||
bi(IMT_GetContext, 0),
|
||||
bi(IMT_SetContext, 1, p(int)),
|
||||
|
||||
bi(IN_Binding_HandleEvent, 1, p(ptr)),
|
||||
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ string IN_GetButtonName (int devid, int button);
|
|||
int IN_GetAxisNumber (int devid, string axis);
|
||||
int IN_GetButtonNumber (int devid, string button);
|
||||
void IN_ProcessEvents (void);
|
||||
float IN_UpdateAxis (in_axis_t *axis);
|
||||
void IN_ClearStates (void);
|
||||
int IN_GetAxisInfo (int devid, int axis, in_axisinfo_t *info);
|
||||
int IN_GetButtonInfo (int devid, int button, in_buttoninfo_t *info);
|
||||
|
@ -43,5 +44,6 @@ typedef void (*axis_listener_t) (void *data, in_axis_t *axis);//FIXME const
|
|||
int IMT_CreateContext (string name);
|
||||
int IMT_GetContext (void);
|
||||
void IMT_SetContext (int ctx);
|
||||
/*bool*/int IN_Binding_HandleEvent (/*const*/ struct IE_event_s *ie_event);
|
||||
|
||||
#endif//__ruamoko_input_h
|
||||
|
|
|
@ -14,6 +14,7 @@ string IN_GetButtonName (int devid, int button) = #0;
|
|||
int IN_GetAxisNumber (int devid, string axis) = #0;
|
||||
int IN_GetButtonNumber (int devid, string button) = #0;
|
||||
void IN_ProcessEvents (void) = #0;
|
||||
float IN_UpdateAxis (in_axis_t *axis) = #0;
|
||||
void IN_ClearStates (void) = #0;
|
||||
int IN_GetAxisInfo (int devid, int axis, in_axisinfo_t *info) = #0;
|
||||
int IN_GetButtonInfo (int devid, int button, in_buttoninfo_t *info) = #0;
|
||||
|
@ -42,6 +43,8 @@ int IMT_CreateContext (string name) = #0;
|
|||
int IMT_GetContext (void) = #0;
|
||||
void IMT_SetContext (int ctx) = #0;
|
||||
|
||||
/*bool*/int IN_Binding_HandleEvent (/*const*/ struct IE_event_s *ie_event) = #0;
|
||||
|
||||
#define IE_EVENT(event) #event,
|
||||
string ie_event_names[] = {
|
||||
#include "QF/input/event_names.h"
|
||||
|
|
Loading…
Reference in a new issue