2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
|
|
|
|
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D 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 the Free Software
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
2012-03-12 04:47:04 +00:00
|
|
|
Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
2006-04-13 20:47:06 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
//
|
|
|
|
// Public header for CONTROL.C.
|
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
|
2016-03-14 00:07:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef control_public_h_
|
|
|
|
#define control_public_h_
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2019-10-25 22:32:49 +00:00
|
|
|
#include "tarray.h"
|
2019-10-27 23:24:09 +00:00
|
|
|
#include "inputstate.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
//
|
|
|
|
// DEFINES
|
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
//
|
|
|
|
// TYPEDEFS
|
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
axis_up,
|
|
|
|
axis_down,
|
|
|
|
axis_left,
|
|
|
|
axis_right
|
|
|
|
} axisdirection;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
analog_turning=0,
|
|
|
|
analog_strafing=1,
|
|
|
|
analog_lookingupanddown=2,
|
|
|
|
analog_elevation=3,
|
|
|
|
analog_rolling=4,
|
|
|
|
analog_moving=5,
|
|
|
|
analog_maxtype
|
|
|
|
} analogcontrol;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
controltype_keyboard,
|
|
|
|
controltype_keyboardandmouse,
|
|
|
|
controltype_keyboardandjoystick
|
|
|
|
} controltype;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
controldevice_keyboard,
|
|
|
|
controldevice_mouse,
|
|
|
|
controldevice_joystick
|
|
|
|
} controldevice;
|
|
|
|
|
2019-08-13 09:15:49 +00:00
|
|
|
enum GameControllerButton : int
|
|
|
|
{
|
|
|
|
GAMECONTROLLER_BUTTON_INVALID = -1,
|
|
|
|
GAMECONTROLLER_BUTTON_A,
|
|
|
|
GAMECONTROLLER_BUTTON_B,
|
|
|
|
GAMECONTROLLER_BUTTON_X,
|
|
|
|
GAMECONTROLLER_BUTTON_Y,
|
|
|
|
GAMECONTROLLER_BUTTON_BACK,
|
|
|
|
GAMECONTROLLER_BUTTON_GUIDE,
|
|
|
|
GAMECONTROLLER_BUTTON_START,
|
|
|
|
GAMECONTROLLER_BUTTON_LEFTSTICK,
|
|
|
|
GAMECONTROLLER_BUTTON_RIGHTSTICK,
|
|
|
|
GAMECONTROLLER_BUTTON_LEFTSHOULDER,
|
|
|
|
GAMECONTROLLER_BUTTON_RIGHTSHOULDER,
|
|
|
|
GAMECONTROLLER_BUTTON_DPAD_UP,
|
|
|
|
GAMECONTROLLER_BUTTON_DPAD_DOWN,
|
|
|
|
GAMECONTROLLER_BUTTON_DPAD_LEFT,
|
|
|
|
GAMECONTROLLER_BUTTON_DPAD_RIGHT,
|
|
|
|
GAMECONTROLLER_BUTTON_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
enum GameControllerAxis : int
|
|
|
|
{
|
|
|
|
GAMECONTROLLER_AXIS_INVALID = -1,
|
|
|
|
GAMECONTROLLER_AXIS_LEFTX,
|
|
|
|
GAMECONTROLLER_AXIS_LEFTY,
|
|
|
|
GAMECONTROLLER_AXIS_RIGHTX,
|
|
|
|
GAMECONTROLLER_AXIS_RIGHTY,
|
|
|
|
GAMECONTROLLER_AXIS_TRIGGERLEFT,
|
|
|
|
GAMECONTROLLER_AXIS_TRIGGERRIGHT,
|
|
|
|
GAMECONTROLLER_AXIS_MAX
|
|
|
|
};
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2019-08-14 05:25:22 +00:00
|
|
|
enum class LastSeenInput : unsigned char
|
|
|
|
{
|
|
|
|
Keyboard,
|
|
|
|
Joystick,
|
|
|
|
};
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
//***************************************************************************
|
|
|
|
//
|
|
|
|
// GLOBALS
|
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
|
2018-11-18 18:08:53 +00:00
|
|
|
extern bool CONTROL_Started;
|
|
|
|
extern bool CONTROL_MousePresent;
|
|
|
|
extern bool CONTROL_JoyPresent;
|
|
|
|
extern bool CONTROL_MouseEnabled;
|
|
|
|
extern bool CONTROL_JoystickEnabled;
|
|
|
|
|
2019-08-14 05:25:22 +00:00
|
|
|
extern LastSeenInput CONTROL_LastSeenInput;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
//
|
|
|
|
// PROTOTYPES
|
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
void CONTROL_ClearAssignments( void );
|
|
|
|
void CONTROL_GetInput( ControlInfo *info );
|
2019-11-09 18:15:03 +00:00
|
|
|
|
2018-11-18 18:08:53 +00:00
|
|
|
bool CONTROL_Startup(controltype which, int32_t ( *TimeFunction )( void ), int32_t ticspersecond);
|
2006-04-13 20:47:06 +00:00
|
|
|
void CONTROL_Shutdown( void );
|
|
|
|
|
2017-07-07 22:50:37 +00:00
|
|
|
void CONTROL_MapAnalogAxis(int whichaxis, int whichanalog, controldevice device);
|
2012-11-17 16:48:11 +00:00
|
|
|
void CONTROL_MapDigitalAxis(int32_t whichaxis, int32_t whichfunction, int32_t direction, controldevice device);
|
|
|
|
void CONTROL_SetAnalogAxisScale(int32_t whichaxis, int32_t axisscale, controldevice device);
|
2019-08-14 03:03:57 +00:00
|
|
|
void CONTROL_SetAnalogAxisInvert(int32_t whichaxis, int32_t invert, controldevice device);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2019-08-14 03:03:52 +00:00
|
|
|
void CONTROL_ScanForControllers(void);
|
|
|
|
|
2019-08-13 09:15:58 +00:00
|
|
|
int32_t CONTROL_GetGameControllerDigitalAxisPos(int32_t axis);
|
|
|
|
int32_t CONTROL_GetGameControllerDigitalAxisNeg(int32_t axis);
|
|
|
|
void CONTROL_ClearGameControllerDigitalAxisPos(int32_t axis);
|
|
|
|
void CONTROL_ClearGameControllerDigitalAxisNeg(int32_t axis);
|
|
|
|
|
2012-11-18 15:44:18 +00:00
|
|
|
|
|
|
|
////////// KEY/MOUSE BIND STUFF //////////
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-06-29 10:40:37 +00:00
|
|
|
|
2012-11-18 15:44:18 +00:00
|
|
|
////////////////////
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#endif
|