2001-08-09 22:35:41 +00:00
|
|
|
/*
|
|
|
|
in_event.h
|
|
|
|
|
|
|
|
input event handling
|
|
|
|
|
|
|
|
Copyright (C) 2001 Bill Currie <bill@taniwha.org>
|
|
|
|
|
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2001/8/9
|
|
|
|
|
|
|
|
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_in_event_h
|
|
|
|
#define __QF_in_event_h
|
|
|
|
|
|
|
|
#include "QF/qtypes.h"
|
|
|
|
#include "QF/joystick.h" // needed for JOY_MAX_AXES
|
|
|
|
|
|
|
|
typedef struct {
|
2021-08-30 05:40:19 +00:00
|
|
|
int x, y;
|
2001-08-09 22:35:41 +00:00
|
|
|
unsigned int buttons;
|
|
|
|
} IE_mouse_event_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int key_code;
|
|
|
|
qboolean pressed;
|
|
|
|
} IE_key_event_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2021-08-30 05:40:19 +00:00
|
|
|
int devid;
|
|
|
|
int axis;
|
|
|
|
int value;
|
|
|
|
} IE_axis_event_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int devid;
|
|
|
|
int button;
|
|
|
|
int state;
|
|
|
|
} IE_button_event_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int devid;
|
|
|
|
} IE_device_event_t;
|
2001-08-09 22:35:41 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
ie_none,
|
2001-08-09 23:43:13 +00:00
|
|
|
ie_gain_focus,
|
|
|
|
ie_lose_focus,
|
2021-08-30 05:40:19 +00:00
|
|
|
ie_add_device,
|
|
|
|
ie_remove_device,
|
2001-08-09 22:35:41 +00:00
|
|
|
ie_mouse,
|
|
|
|
ie_key,
|
2021-08-30 05:40:19 +00:00
|
|
|
ie_axis,
|
|
|
|
ie_button,
|
2001-08-09 22:35:41 +00:00
|
|
|
} IE_event_type;
|
|
|
|
|
|
|
|
typedef struct {
|
2021-08-30 05:40:19 +00:00
|
|
|
IE_event_type type;
|
|
|
|
uint64_t when;
|
2001-08-09 22:35:41 +00:00
|
|
|
union {
|
2021-08-30 05:40:19 +00:00
|
|
|
IE_mouse_event_t mouse;
|
|
|
|
IE_key_event_t key;
|
|
|
|
IE_axis_event_t axis;
|
|
|
|
IE_button_event_t button;
|
|
|
|
IE_device_event_t device;
|
|
|
|
};
|
2001-08-09 22:35:41 +00:00
|
|
|
} IE_event_t;
|
2003-04-08 19:20:48 +00:00
|
|
|
|
2021-08-30 05:40:19 +00:00
|
|
|
typedef int ie_handler_t (const IE_event_t *, void *data);
|
|
|
|
|
2001-08-09 23:16:54 +00:00
|
|
|
int IE_Send_Event (const IE_event_t *event);
|
2021-08-30 05:40:19 +00:00
|
|
|
int IE_Add_Handler (ie_handler_t *event_handler, void *data);
|
2001-08-09 22:35:41 +00:00
|
|
|
void IE_Remove_Handler (int handle);
|
|
|
|
void IE_Set_Focus (int handle);
|
|
|
|
|
|
|
|
#endif//__QF_in_event_h
|