mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-14 08:50:58 +00:00
e81d690b51
This refactors (as such) keys.c so that it no longer depends on console or gib, and pulls keys out of video targets. The eventual plan is to move all high-level general input handling into libQFinput, and probably low-level (eg, /dev/input handling for joysticks etc on Linux). Fixes #8
77 lines
1.6 KiB
C
77 lines
1.6 KiB
C
/*
|
|
gib_keys.c
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
Copyright (C) 2002 Brian Koropoff <brianhk@cs.washington.edu>
|
|
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to:
|
|
|
|
Free Software Foundation, Inc.
|
|
59 Temple Place - Suite 330
|
|
Boston, MA 02111-1307, USA
|
|
|
|
*/
|
|
#ifdef HAVE_CONFIG_H
|
|
# include "config.h"
|
|
#endif
|
|
|
|
#ifdef HAVE_STRING_H
|
|
# include <string.h>
|
|
#endif
|
|
#ifdef HAVE_STRINGS_H
|
|
# include <strings.h>
|
|
#endif
|
|
|
|
#include "QF/cbuf.h"
|
|
#include "QF/cmd.h"
|
|
#include "QF/keys.h"
|
|
#include "QF/sys.h"
|
|
#include "QF/gib.h"
|
|
|
|
#include "compat.h"
|
|
#include "old_keys.h"
|
|
|
|
static void
|
|
Key_GIB_Bind_Get_f (void)
|
|
{
|
|
const char *key, *cmd;
|
|
imt_t *imt;
|
|
int k;
|
|
|
|
if (GIB_Argc () != 2) {
|
|
GIB_USAGE ("key");
|
|
return;
|
|
}
|
|
|
|
key = OK_TranslateKeyName (GIB_Argv (1));
|
|
|
|
if ((k = Key_StringToKeynum (key)) == -1) {
|
|
GIB_Error ("bind", "bind::get: invalid key %s", key);
|
|
return;
|
|
}
|
|
|
|
imt = Key_FindIMT ("imt_mod");
|
|
if (!imt || !(cmd = Key_GetBinding (imt, k)))
|
|
GIB_Return ("");
|
|
else
|
|
GIB_Return (cmd);
|
|
}
|
|
|
|
void
|
|
GIB_Key_Init (void)
|
|
{
|
|
GIB_Builtin_Add ("bind::get", Key_GIB_Bind_Get_f);
|
|
}
|