📄 cpw_joystick.h
字号:
/***************************************************************************/
/* */
/* cpw_joystick.h */
/* */
/* Joystick polling interface. */
/* */
/* Copyright 2001-2002 by */
/* Jim Mathies, */
/* */
/* This file is part of the Cpw project, and may only be used, */
/* modified, and distributed under the terms of the Cpw project */
/* license. By continuing to use, modify, or distribute this file */
/* you indicate that you have read the license and understand and */
/* accept it fully. */
/* */
/* File Platform: cross */
/* */
/***************************************************************************/
#ifndef __cpw_joystick_h__
#define __cpw_joystick_h__
#include "cpw_config.h"
#include "cpw_state.h"
CPW_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Limits Define> */
/* CPW_MAX_JOYSTICKS */
/* */
/* <Description> */
/* The maximum number of joyticks the library supports. */
/* */
#define CPW_MAX_JOYSTICKS 2
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Limits Define> */
/* */
/* <Description> */
/* CPW_JOY_AXES - maximum number of axes a joystick can support */
/* */
/* CPW_JOY_POVS - maximum number of hats a joystick can support */
/* */
/* CPW_JOY_BUTTONS - maximum number of buttons a joystick can support */
/* */
#define CPW_JOY_AXES 5
#define CPW_JOY_POVS 4
#define CPW_JOY_BUTTONS 32
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Define> */
/* */
/* <Description> */
/* Default joystick normalization ranges. */
/* */
#define CPW_JOY_AXISMIN -1000
#define CPW_JOY_AXISMAX 1000
#define CPW_JOY_ROTATIONMIN 0
#define CPW_JOY_ROTATIONMAX 3590
#define CPW_JOY_VELOCITYMIN 0
#define CPW_JOY_VELOCITYMAX 1000
#define CPW_JOY_ACCELMIN 0
#define CPW_JOY_ACCELMAX 1000
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Define> */
/* */
/* <Description> */
/* POV (point of view) hat positions for POV's that support discrete */
/* positional information. */
/* */
#define CPW_POV_CENTERED -1
#define CPW_POV_UP 0
#define CPW_POV_UPRIGHT 4500
#define CPW_POV_RIGHT 9000
#define CPW_POV_DOWNRIGHT 13500
#define CPW_POV_DOWN 18000
#define CPW_POV_DOWNLEFT 22500
#define CPW_POV_LEFT 27000
#define CPW_POV_UPLEFT 31500
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* CpwJoystickCapabilities */
/* */
/* <Description> */
/* */
struct _CpwJoystickCapabilities
{
uint_32 id; /* the joystick id value */
bool axis[CPW_JOY_AXES]; /* x, y, z, u, v axis */
bool rot[CPW_JOY_AXES]; /* axis rotation */
bool variablepov; /* point-of-view hats are variable */
bool pov[CPW_JOY_POVS]; /* point-of-view hats */
bool vel[CPW_JOY_AXES]; /* axis velocity */
bool accel[CPW_JOY_AXES]; /* axis acceleration */
bool force[CPW_JOY_AXES]; /* axis force applied */
bool forcefeedback; /* supports force feedback */
uint_32 numbuttons; /* number of buttons supported */
};
typedef struct _CpwJoystickCapabilities CpwJoystickCapabilities;
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* CpwJoystickRanges */
/* */
/* <Description> */
/* Contained within CpwJoystickList. Allows application to set */
/* custom ranges on certain joystick properties. */
/* */
/* <Fields> */
/* axis - use custom ranges or return device defaults */
/* */
/* rotation - use custom ranges or return device defaults */
/* */
/* velocity - use custom ranges or return device defaults */
/* */
/* accel - use custom ranges or return device defaults */
/* */
/* axismin - defines the minimum value an axis */
/* positional value is normailized to. */
/* */
/* axismax - defines the maximum value an axis */
/* positional value is normailized to. */
/* */
/* rotmin - defines the minimum value an axes rotational */
/* value is normailized to. */
/* */
/* rotmax - defines the maximum value an axes rotational */
/* value is normailized to. */
/* */
/* velmin - defines the minimum value an axes velocity of */
/* movement value is normailized to. */
/* */
/* velmax - defines the maximum value an axes velocity of */
/* movement value is normailized to. */
/* */
/* accelmin - defines the minimum value an axes acceleration of */
/* movement value is normailized to. */
/* */
/* accelmax - defines the maximum value an axes acceleration of */
/* movement value is normailized to. */
/* */
struct _CpwJoystickRanges
{
bool axis; /* use custom axis range values */
int_16 axismin; /* user definable minimum axis normalization value */
int_16 axismax; /* user definable maximum axis normalization value */
bool rotation; /* use custom rotation range values */
int_16 rotmin; /* user definable minimum rotation normalization value. */
int_16 rotmax; /* user definable maximum rotation normalization value. */
bool velocity; /* use custom velocity range values */
int_16 velmin; /* user definable minimum velocity normalization value */
int_16 velmax; /* user definable maximum velocity normalization value */
bool accel; /* use custom accel range values */
int_16 accelmin; /* user definable minimum acceleration normalization value. */
int_16 accelmax; /* user definable maximum acceleration normalization value. */
};
typedef struct _CpwJoystickRanges CpwJoystickRanges;
/* */
/*************************************************************************/
/*************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -