2021-11-03 10:02:39 +00:00
|
|
|
/*
|
|
|
|
imt.h
|
|
|
|
|
|
|
|
Input Mapping Table management
|
|
|
|
|
|
|
|
Copyright (C) 2001 Zephaniah E. Hull <warp@babylon.d2dc.net>
|
|
|
|
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
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __QF_input_imt_h
|
|
|
|
#define __QF_input_imt_h
|
|
|
|
|
|
|
|
#ifndef __QFCC__
|
|
|
|
|
|
|
|
#include "QF/darray.h"
|
2021-11-08 02:20:04 +00:00
|
|
|
#include "QF/qtypes.h"
|
2021-11-03 10:02:39 +00:00
|
|
|
|
|
|
|
#include "QF/input/binding.h"
|
|
|
|
|
|
|
|
/** Input Mapping Table
|
|
|
|
*/
|
|
|
|
typedef struct imt_s {
|
|
|
|
struct imt_s *next; ///< list of tables attached to key_dest
|
|
|
|
struct imt_s *chain; ///< fallback table if input not bound
|
|
|
|
const char *name; ///< for user interaction
|
|
|
|
int written;
|
|
|
|
struct DARRAY_TYPE (in_axisbinding_t *) axis_bindings;
|
|
|
|
struct DARRAY_TYPE (in_buttonbinding_t *) button_bindings;
|
|
|
|
} imt_t;
|
|
|
|
|
|
|
|
typedef struct in_context_s {
|
2021-11-08 06:38:26 +00:00
|
|
|
const char *name;
|
2021-11-03 10:02:39 +00:00
|
|
|
imt_t *imts;
|
|
|
|
imt_t **imt_tail;
|
|
|
|
imt_t *active_imt;
|
|
|
|
imt_t *default_imt;
|
2021-11-08 02:20:04 +00:00
|
|
|
struct cbuf_s *cbuf;
|
2021-11-03 10:02:39 +00:00
|
|
|
} in_context_t;
|
|
|
|
|
2021-11-09 13:23:57 +00:00
|
|
|
int IMT_GetAxisBlock (int num_axes);
|
|
|
|
int IMT_GetButtonBlock (int num_buttons);
|
2021-11-08 06:38:26 +00:00
|
|
|
int IMT_CreateContext (const char *name);
|
2021-11-11 06:43:07 +00:00
|
|
|
int IMT_GetContext (void) __attribute__ ((pure));
|
2021-11-08 02:20:04 +00:00
|
|
|
void IMT_SetContext (int ctx);
|
|
|
|
void IMT_SetContextCbuf (int ctx, struct cbuf_s *cbuf);
|
2021-11-03 10:02:39 +00:00
|
|
|
imt_t *IMT_FindIMT (const char *name);
|
|
|
|
int IMT_CreateIMT (int context, const char *imt_name,
|
|
|
|
const char *chain_imt_name);
|
2021-11-08 07:54:52 +00:00
|
|
|
void IMT_BindAxis (imt_t *imt, int axis, const char *binding);
|
|
|
|
void IMT_BindButton (imt_t *imt, int button, const char *binding);
|
2021-11-08 02:20:04 +00:00
|
|
|
qboolean IMT_ProcessAxis (int axis, int value);
|
|
|
|
qboolean IMT_ProcessButton (int button, int state);
|
2021-11-08 07:54:52 +00:00
|
|
|
void IMT_Init (void);
|
2021-11-03 10:02:39 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif//__QF_input_imt_h
|