Add a builtin to get keydown.

This commit is contained in:
Bill Currie 2016-01-10 13:33:05 +09:00
parent bf40f0126e
commit f163e35f21
3 changed files with 11 additions and 0 deletions

View file

@ -40,6 +40,13 @@
#include "QF/progs.h"
#include "QF/zone.h"
static void
bi_Key_keydown (progs_t *pr)
{
int keynum = P_INT (pr, 0);
R_INT (pr) = keydown[keynum];
}
/*
bi_Key_SetBinding
@ -151,6 +158,7 @@ bi_Key_StringToKeynum (progs_t *pr)
}
static builtin_t builtins[] = {
{"Key_keydown", bi_Key_keydown, -1},
{"Key_SetBinding", bi_Key_SetBinding, -1},
{"Key_LookupBinding", bi_Key_LookupBinding, -1},
{"Key_CountBinding", bi_Key_CountBinding, -1},

View file

@ -2,6 +2,8 @@
#define __ruamoko_key_h
#include "QF/keys.h"
@extern int Key_keydown (int keynum);
@extern string Key_SetBinding (string imt, int keynum, string binding);
@extern int Key_LookupBinding (string imt, int bindnum, string binding);
@extern int Key_CountBinding (string imt, string binding);

View file

@ -1,5 +1,6 @@
#include "key.h"
int Key_keydown (int keynum) = #0;
string (string imt, int keynum, string binding) Key_SetBinding = #0;
int (string imt, int bindnum, string binding) Key_LookupBinding = #0;
int (string imt, string binding) Key_CountBinding = #0;