[1195] | 1 | /* |
---|
| 2 | The zlib/libpng License |
---|
| 3 | |
---|
| 4 | Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com) |
---|
| 5 | |
---|
| 6 | This software is provided 'as-is', without any express or implied warranty. In no event will |
---|
| 7 | the authors be held liable for any damages arising from the use of this software. |
---|
| 8 | |
---|
| 9 | Permission is granted to anyone to use this software for any purpose, including commercial |
---|
| 10 | applications, and to alter it and redistribute it freely, subject to the following |
---|
| 11 | restrictions: |
---|
| 12 | |
---|
| 13 | 1. The origin of this software must not be misrepresented; you must not claim that |
---|
| 14 | you wrote the original software. If you use this software in a product, |
---|
| 15 | an acknowledgment in the product documentation would be appreciated but is |
---|
| 16 | not required. |
---|
| 17 | |
---|
| 18 | 2. Altered source versions must be plainly marked as such, and must not be |
---|
| 19 | misrepresented as being the original software. |
---|
| 20 | |
---|
| 21 | 3. This notice may not be removed or altered from any source distribution. |
---|
| 22 | */ |
---|
| 23 | #ifndef OIS_Object_H |
---|
| 24 | #define OIS_Object_H |
---|
| 25 | |
---|
| 26 | #include "OISPrereqs.h" |
---|
| 27 | #include "OISInterface.h" |
---|
| 28 | |
---|
| 29 | namespace OIS |
---|
| 30 | { |
---|
| 31 | /** The base class of all input types. */ |
---|
| 32 | class _OISExport Object |
---|
| 33 | { |
---|
| 34 | public: |
---|
| 35 | virtual ~Object() {} |
---|
| 36 | |
---|
| 37 | /** @remarks Get the type of device */ |
---|
| 38 | Type type() const { return mType; } |
---|
| 39 | |
---|
| 40 | /** @remarks Get the vender string name */ |
---|
| 41 | const std::string& vendor() const { return mVendor; } |
---|
| 42 | |
---|
| 43 | /** @remarks Get buffered mode - true is buffered, false otherwise */ |
---|
| 44 | virtual bool buffered() const { return mBuffered; } |
---|
| 45 | |
---|
| 46 | /** @remarks Returns this input object's creator */ |
---|
[1349] | 47 | InputManager* getCreator() const { return mCreator; } |
---|
[1195] | 48 | |
---|
| 49 | /** @remarks Sets buffered mode */ |
---|
| 50 | virtual void setBuffered(bool buffered) = 0; |
---|
| 51 | |
---|
| 52 | /** @remarks Used for updating call once per frame before checking state or to update events */ |
---|
| 53 | virtual void capture() = 0; |
---|
| 54 | |
---|
| 55 | /** @remarks This may/may not) differentiate the different controllers based on (for instance) a port number (useful for console InputManagers) */ |
---|
| 56 | virtual int getID() const {return mDevID;} |
---|
| 57 | |
---|
| 58 | /** |
---|
| 59 | @remarks |
---|
| 60 | If available, get an interface to write to some devices. |
---|
| 61 | Examples include, turning on and off LEDs, ForceFeedback, etc |
---|
| 62 | @param type |
---|
| 63 | The type of interface you are looking for |
---|
| 64 | */ |
---|
| 65 | virtual Interface* queryInterface(Interface::IType type) = 0; |
---|
| 66 | |
---|
| 67 | /** @remarks Internal... Do not call this directly. */ |
---|
| 68 | virtual void _initialize() = 0; |
---|
| 69 | |
---|
| 70 | protected: |
---|
| 71 | Object(const std::string &vendor, Type iType, bool buffered, |
---|
| 72 | int devID, InputManager* creator) : |
---|
| 73 | mVendor(vendor), |
---|
| 74 | mType(iType), |
---|
| 75 | mBuffered(buffered), |
---|
| 76 | mDevID(devID), |
---|
| 77 | mCreator(creator) {} |
---|
| 78 | |
---|
| 79 | //! Vendor name if applicable/known |
---|
| 80 | std::string mVendor; |
---|
| 81 | |
---|
| 82 | //! Type of controller object |
---|
| 83 | Type mType; |
---|
| 84 | |
---|
| 85 | //! Buffered flag |
---|
| 86 | bool mBuffered; |
---|
| 87 | |
---|
| 88 | //! Not fully implemented yet |
---|
| 89 | int mDevID; |
---|
| 90 | |
---|
| 91 | //! The creator who created this object |
---|
| 92 | InputManager* mCreator; |
---|
| 93 | }; |
---|
| 94 | } |
---|
| 95 | #endif |
---|