2001-04-10 21:01:29 +00:00
|
|
|
/*
|
|
|
|
joystick.h
|
|
|
|
|
|
|
|
QuakeForge joystick DPI (driver programming interface)
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Jeff Teunissen <deek@dusknet.dhs.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
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
2001-05-19 23:24:20 +00:00
|
|
|
#ifndef __QF_joystick_h_
|
|
|
|
#define __QF_joystick_h_
|
|
|
|
|
|
|
|
#include <QF/qtypes.h>
|
2001-04-10 21:01:29 +00:00
|
|
|
|
2001-12-28 18:19:23 +00:00
|
|
|
#define JOY_MAX_AXES 8
|
2001-04-11 19:56:01 +00:00
|
|
|
#define JOY_MAX_BUTTONS 16
|
2001-04-10 21:01:29 +00:00
|
|
|
|
2001-05-19 23:24:20 +00:00
|
|
|
extern struct cvar_s *joy_device; // Joystick device name
|
|
|
|
extern struct cvar_s *joy_enable; // Joystick enabling flag
|
|
|
|
extern struct cvar_s *joy_sensitivity; // Joystick sensitivity
|
2001-04-10 21:01:29 +00:00
|
|
|
|
2001-05-19 23:24:20 +00:00
|
|
|
extern qboolean joy_found; // Joystick present?
|
|
|
|
extern qboolean joy_active; // Joystick in use?
|
2001-04-10 21:01:29 +00:00
|
|
|
|
2001-04-11 19:56:01 +00:00
|
|
|
struct joy_axis {
|
2001-05-19 23:24:20 +00:00
|
|
|
struct cvar_s *axis;
|
|
|
|
int current;
|
2001-04-11 19:56:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct joy_button {
|
2001-05-19 23:24:20 +00:00
|
|
|
int old;
|
|
|
|
int current;
|
2001-04-11 19:56:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct joy_axis joy_axes[JOY_MAX_AXES];
|
|
|
|
|
|
|
|
extern struct joy_button joy_buttons[JOY_MAX_BUTTONS];
|
|
|
|
|
2001-04-10 21:01:29 +00:00
|
|
|
/*
|
|
|
|
JOY_Command ()
|
|
|
|
|
|
|
|
Use this function to process joystick button presses and generate key
|
|
|
|
events. It is called inside the IN_Commands () input function, once each
|
|
|
|
frame.
|
|
|
|
|
|
|
|
You should exit this function immediately if either joy_active or
|
|
|
|
joy_enable->int_val are zero.
|
|
|
|
*/
|
|
|
|
void JOY_Command (void);
|
|
|
|
|
|
|
|
/*
|
2001-04-11 07:57:08 +00:00
|
|
|
JOY_Move (usercmd_t *) // FIXME: Not anymore!
|
2001-04-10 21:01:29 +00:00
|
|
|
|
|
|
|
Use this function to process joystick movements to move the player around.
|
|
|
|
|
|
|
|
You should exit this function immediately if either joy_active or
|
|
|
|
joy_enable->int_val are zero.
|
|
|
|
*/
|
2001-04-11 07:57:08 +00:00
|
|
|
void JOY_Move (void);
|
2001-04-10 21:01:29 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
JOY_Init ()
|
|
|
|
|
|
|
|
Use this function to initialize the joystick Cvars, open your joystick
|
|
|
|
device, and get it ready for use. You MUST obey the value of the
|
|
|
|
joy_enable Cvar. Set joy_found if there is a device, and joy_active if
|
|
|
|
you have successfully enabled it.
|
|
|
|
*/
|
|
|
|
void JOY_Init (void);
|
|
|
|
void JOY_Init_Cvars (void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
JOY_Shutdown ()
|
|
|
|
|
|
|
|
Use this function to close the joystick device and tell QuakeForge that it
|
|
|
|
is no longer available. It is called from IN_Init (), but may be called
|
|
|
|
elsewhere to disable the device.
|
|
|
|
*/
|
|
|
|
void JOY_Shutdown (void);
|
2001-04-11 19:56:01 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
JOY_Open ()
|
|
|
|
JOY_Close ()
|
|
|
|
|
2001-05-19 23:24:20 +00:00
|
|
|
OS-specific joystick init/deinit
|
2001-04-11 19:56:01 +00:00
|
|
|
*/
|
|
|
|
int JOY_Open (void);
|
|
|
|
void JOY_Close (void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
JOY_Read ()
|
|
|
|
|
2001-05-19 23:24:20 +00:00
|
|
|
OS-specific joystick reading
|
2001-04-11 19:56:01 +00:00
|
|
|
*/
|
|
|
|
void JOY_Read (void);
|
2001-05-19 23:24:20 +00:00
|
|
|
|
|
|
|
#endif // __QF_joystick_h_
|