Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Input.hpp

Go to the documentation of this file.
00001 /****************************************************************************\ 00002 * VRVis * 00003 * http://vrvis.sourceforge.net * 00004 * (C) 2004 by Alex Loeffler * 00005 * mailto:aloeffler@users.sourceforge.net * 00006 **************************************************************************** 00007 * License * 00008 * * 00009 * This library is free software; you can redistribute it and/or modify it * 00010 * under the terms of the GNU Library General Public License as published * 00011 * by the Free Software Foundation, version 2. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, but * 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Library General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Library General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00021 \****************************************************************************/ 00022 00023 #ifndef INPUT_HPP 00024 #define INPUT_HPP 00025 00026 #include <map> 00027 #include <queue> 00028 #include <string> 00029 #include <vector> 00030 #include <gadget/Type/AnalogInterface.h> 00031 #include <gadget/Type/DigitalInterface.h> 00032 #include <gadget/Type/PositionInterface.h> 00033 #include "Common.hpp" 00034 00035 namespace vrvis 00036 { 00037 00038 class ActionSet; 00039 class ConfigReader; 00040 00042 class Input 00043 { 00044 // ================================================================== PUBLIC 00045 00046 public: 00047 00048 // ----------------------------------------------- Constructor & Destructor. 00050 00052 Input(const std::string& crConfigFilename); 00054 ~Input(void); 00055 00057 // -------------------------------------------------- Read-only Data Access. 00059 00061 const float& getBGColor(int colorIndex) const; 00063 const gmtl::Point3f& getDrawOrigin(void); 00065 const gmtl::Point3f& getWandPos(void); 00067 const gmtl::Point3f& getHeadPos(void); 00068 00070 // ---------------------------------------------- Read-Write Matrix Handles. 00072 00074 gmtl::Matrix44f& getTransRotMatrixHandle(void); 00076 gmtl::Matrix44f& getScaleMatrixHandle(void); 00077 00079 // ------------------------------------------------------------- ActionSets. 00081 00083 ActionSet* createActionSet(const std::string& crName); 00085 ActionSet* createDefaultActionSet(void); 00087 void changeActiveActionSet(void); 00088 00090 // ----------------------------------------------------------------- Update. 00092 00094 void update(void); 00095 00097 // ================================================================= PRIVATE 00098 00099 private: 00100 00101 // --------------------------------------------------------------- Typedefs. 00102 00104 typedef std::map<std::string, std::string> StringMap; 00106 typedef std::vector<std::string> StringVector; 00108 typedef std::vector<gadget::AnalogInterface*> AnalogVector; 00110 typedef std::vector<gadget::DigitalInterface*> DigitalVector; 00112 typedef std::queue<ActionSet*> ActionSetQueue; 00113 00114 // ---------------------------------------------------- Member Construction. 00116 00118 static gmtl::Point3f* constructDrawOrigin(ConfigReader* pCr); 00120 static float* constructBGColor(ConfigReader* pCr); 00122 static gmtl::Matrix44f* constructTransRotMatrix(gmtl::Point3f* pDrawOrigin); 00124 static void initMaxTexSize(ConfigReader* pCr); 00125 00127 // ------------------------------------------------------------ Device Init. 00129 00131 static void initAnalogDevices(StringMap& rMap, 00132 AnalogVector& rAnalogVec); 00133 00135 static void initDigitalDevices(StringMap& rMap, 00136 DigitalVector& rDigitalVec, 00137 gadget::DigitalInterface** ppChangeButton); 00138 00140 // ----------------------------------------------------------------- Errors. 00142 00144 static void exitWithConfigFileError(const std::string& crErrorKey); 00145 00147 // ---------------------------------------------------------------- Members. 00149 00151 gadget::PositionInterface mHead; 00153 gadget::PositionInterface mWand; 00155 AnalogVector mAnalogs; 00157 DigitalVector mButtons; 00159 gadget::DigitalInterface* mpActionSetChangeButton; 00160 00163 00165 ActionSetQueue mActionSetQueue; 00166 00169 00171 ConfigReader* mpConfigReader; 00173 gmtl::Point3f* mpDrawOrigin; 00175 float* mpBGColor; 00177 gmtl::Matrix44f* mpTransRotMatrix; 00179 gmtl::Matrix44f* mpScaleMatrix; 00180 00183 00185 gmtl::Point3f* mpHeadPos; 00187 gmtl::Point3f* mpWandPos; 00188 00190 // --------------------------------------------------------- Static Members. 00191 00193 static gmtl::Point3f* spOrigin; 00195 static const int scMaxAnalogDevices; 00197 static const int scMaxDigitalDevices; 00198 }; 00199 00200 } // End namespace. 00201 00202 #endif // INPUT_HPP 00203

Generated on Tue Sep 21 07:31:08 2004 for VRVis by doxygen 1.3.8