📄 freewrlinputdeviceapp.h
字号:
/* * FreeWRLinputDeviceApp.h * used for a input device driver for FreeWRL, * Copyright (c) 2003 J. "MUFTI" Scheurich, based on * * DuneApp.h * * Copyright (C) 1999 Stephen F. White * * 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 (see the file "COPYING" for details); if * not, write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. */#include "InputDevice.h"#include "Array.h"class FreeWRLinputDeviceApp {public: FreeWRLinputDeviceApp(); InputDevice* getInputDevice(int i) { if ((i<_inputDevices.size()) && (i>=0)) return _inputDevices[i]; else return NULL; } int getNumberInputDevices(void) {return _inputDevices.size();} void setInputDevice(InputDevice* inputdevice) { _inputDevices.append(inputdevice); } int getMaxNumberAxesInputDevices(void) { return _maxNumberAxes; } void accoutMaxNumberAxesInputDevices(void) { int max=0; for (int i=0;i<_inputDevices.size();i++) if (_inputDevices[i]->get_number_axes()>max) max=_inputDevices[i]->get_number_axes(); _maxNumberAxes=max; } // sort inputdevices, so inputdevices with a readdelay // can prepare the read, while other inputdevices // can use the time to read data void sortInputDevices(void); bool has2AxesInputDevices(void) { int ret=0; for (int i=0;i<_inputDevices.size();i++) if (_inputDevices[i]->get_number_axes()==2) return true; return false; } bool has3AxesInputDevices(void) { int ret=0; for (int i=0;i<_inputDevices.size();i++) if (_inputDevices[i]->get_number_axes()==3) return true; return false; }#ifdef HAVE_AFLOCK AflockDevice* getAflockDevice(int i) { if ((i<_aflockDevices.size()) && (i>=0)) return _aflockDevices[i]; else return NULL; } int getNumberAflockDevices(void) {return _aflockDevices.size();} void setAflockDevice(AflockDevice* AflockDevice) { _aflockDevices.append(AflockDevice); } bool ReturnTracker(void) { if (_aflockDevices.size()==0) return(false); else for (int i=0;i<_aflockDevices.size();i++) delete _aflockDevices[i]; return(true); } #else bool ReturnTracker(void) {return false;}#endif void calibrateInputDevices(void) { for (int i=0;i<_inputDevices.size();i++) _inputDevices[i]->set_firstflag(); } void emergency_rescue(void);protected: Array<InputDevice*> _inputDevices;#ifdef HAVE_AFLOCK Array<AflockDevice*>_aflockDevices;#endif int _maxNumberAxes;};extern FreeWRLinputDeviceApp* TheApp;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -