8f38768e65
build for others, namely those that also include <Debug.h> * This fixes the remaining problems of building Pe under Haiku. * Those files need a giant style cleanup... Fredrik, time to have a look at our style guide :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26931 a95241bf-73f2-0310-859d-f6bbb57e9c96
138 lines
3.2 KiB
C++
138 lines
3.2 KiB
C++
/********************************************************************************
|
|
/
|
|
/ File: Joystick.h
|
|
/
|
|
/ Description: Joystick port class header.
|
|
/
|
|
/ Copyright 1996-98, Be Incorporated, All Rights Reserved.
|
|
/
|
|
********************************************************************************/
|
|
|
|
|
|
#ifndef _JOYSTICK_H
|
|
#define _JOYSTICK_H
|
|
|
|
#include <BeBuild.h>
|
|
#include <SupportDefs.h>
|
|
#include <OS.h>
|
|
|
|
class BList;
|
|
class BString;
|
|
struct entry_ref;
|
|
struct _extended_joystick;
|
|
class _BJoystickTweaker;
|
|
|
|
typedef struct _joystick_info {
|
|
char module_name[64];
|
|
char controller_name[64];
|
|
int16 num_axes;
|
|
int16 num_buttons;
|
|
int16 num_hats;
|
|
uint32 num_sticks;
|
|
bool calibration_enable;
|
|
bigtime_t max_latency;
|
|
} joystick_info;
|
|
|
|
/* -----------------------------------------------------------------------*/
|
|
class BJoystick {
|
|
|
|
public:
|
|
BJoystick();
|
|
virtual ~BJoystick();
|
|
|
|
status_t Open(const char *portName); /* always goes for enhanced mode */
|
|
status_t Open(const char *portName, bool enter_enhanced);
|
|
void Close(void);
|
|
|
|
status_t Update(void);
|
|
status_t SetMaxLatency(
|
|
bigtime_t max_latency);
|
|
|
|
bigtime_t timestamp;
|
|
int16 horizontal;
|
|
int16 vertical;
|
|
bool button1; /* NOTE: true == off */
|
|
bool button2;
|
|
|
|
int32 CountDevices();
|
|
status_t GetDeviceName(int32 n, char * name,
|
|
size_t bufSize = B_OS_NAME_LENGTH);
|
|
|
|
/* if you care about more than just the first two axes/buttons, here's where you go */
|
|
bool EnterEnhancedMode(
|
|
const entry_ref * ref = NULL);
|
|
int32 CountSticks();
|
|
int32 CountAxes();
|
|
int32 CountHats();
|
|
int32 CountButtons();
|
|
status_t GetAxisValues(
|
|
int16 * out_values,
|
|
int32 for_stick = 0); /* CountAxes() elements */
|
|
status_t GetHatValues(
|
|
uint8 * out_hats,
|
|
int32 for_stick = 0);
|
|
uint32 ButtonValues(
|
|
int32 for_stick = 0); /* NOTE: Buttons() are 1 == on */
|
|
status_t GetAxisNameAt(
|
|
int32 index,
|
|
BString * out_name);
|
|
status_t GetHatNameAt(
|
|
int32 index,
|
|
BString * out_name);
|
|
status_t GetButtonNameAt(
|
|
int32 index,
|
|
BString * out_name);
|
|
status_t GetControllerModule(
|
|
BString * out_name);
|
|
status_t GetControllerName(
|
|
BString * out_name);
|
|
|
|
bool IsCalibrationEnabled();
|
|
status_t EnableCalibration(
|
|
bool calibrates = true);
|
|
|
|
/* -----------------------------------------------------------------------*/
|
|
|
|
protected:
|
|
|
|
virtual void Calibrate(
|
|
struct _extended_joystick * reading);
|
|
|
|
private:
|
|
friend class _BJoystickTweaker;
|
|
//friend class JoyCalib; //Added from Zeta
|
|
|
|
// struct _joystick_info;
|
|
|
|
void ScanDevices(
|
|
bool use_disabled = false);
|
|
status_t gather_enhanced_info(
|
|
const entry_ref * ref = NULL);
|
|
status_t save_config(
|
|
const entry_ref * ref = NULL);
|
|
|
|
void _ReservedJoystick1();
|
|
virtual void _ReservedJoystick2();
|
|
virtual void _ReservedJoystick3();
|
|
|
|
bool _mBeBoxMode;
|
|
bool _mReservedBool;
|
|
int ffd;
|
|
BList * _fDevices;
|
|
_joystick_info * m_info;
|
|
char * m_dev_name;
|
|
#if !_PR3_COMPATIBLE_ //if statment added from Zeta
|
|
virtual status_t _Reserved_Joystick_4(void *, ...);
|
|
virtual status_t _Reserved_Joystick_5(void *, ...);
|
|
virtual status_t _Reserved_Joystick_6(void *, ...);
|
|
uint32 _reserved_Joystick_[10];
|
|
#endif
|
|
|
|
#if DEBUG
|
|
public:
|
|
static FILE *sLogFile;
|
|
#endif
|
|
};
|
|
|
|
#endif
|