[ruamoko] Add bindings for the main IMT functions

IMT_SetContextCbuf is not bound as that requires cbuf to be bound.
However, imt contexts can be created, fetched and set.
This commit is contained in:
Bill Currie 2021-12-22 15:03:26 +09:00
parent 241785e952
commit f3918471d5
3 changed files with 32 additions and 0 deletions

View file

@ -363,6 +363,25 @@ bi_IN_LoadConfig (progs_t *pr)
IN_LoadConfig (Plist_GetItem (pr, P_INT (pr, 0)));
}
static void
bi_IMT_CreateContext (progs_t *pr)
{
const char *name = P_GSTRING (pr, 0);
R_INT (pr) = IMT_CreateContext (name);
}
static void
bi_IMT_GetContext (progs_t *pr)
{
R_INT (pr) = IMT_GetContext ();
}
static void
bi_IMT_SetContext (progs_t *pr)
{
IMT_SetContext (P_INT (pr, 0));
}
static void
secured (progs_t *pr)
{
@ -415,6 +434,11 @@ static builtin_t builtins[] = {
rua_IN_AxisAddListener_method, -1},
{"IN_AxisRemoveListener|^{tag in_axis_s=}(@@:.)@",
rua_IN_AxisRemoveListener_method, -1},
bi(IMT_CreateContext),
bi(IMT_GetContext),
bi(IMT_SetContext),
{0}
};

View file

@ -38,4 +38,8 @@ typedef void (*axis_listener_t) (void *data, in_axis_t *axis);//FIXME const
@overload void IN_AxisAddListener (in_axis_t *axis, IMP listener, id obj);
@overload void IN_AxisRemoveListener (in_axis_t *axis, IMP listener, id obj);
int IMT_CreateContext (string name);
int IMT_GetContext (void);
void IMT_SetContext (int ctx);
#endif//__ruamoko_input_h

View file

@ -36,3 +36,7 @@ void IN_ButtonRemoveListener (in_button_t *button, IMP listener, id obj) = #0;
void IN_AxisAddListener (in_axis_t *axis, IMP listener, id obj) = #0;
@overload
void IN_AxisRemoveListener (in_axis_t *axis, IMP listener, id obj) = #0;
int IMT_CreateContext (string name) = #0;
int IMT_GetContext (void) = #0;
void IMT_SetContext (int ctx) = #0;