/src/ois/includes/iphone/iPhoneInputManager.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 120 lines · 53 code · 27 blank · 40 comment · 0 complexity · d3252ff248bb18d6bf698aca3bf29ba9 MD5 · raw file

  1. /*
  2. The zlib/libpng License
  3. Copyright (c) 2006 Chris Snyder
  4. This software is provided 'as-is', without any express or implied warranty. In no event will
  5. the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose, including commercial
  7. applications, and to alter it and redistribute it freely, subject to the following
  8. restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not claim that
  10. you wrote the original software. If you use this software in a product,
  11. an acknowledgment in the product documentation would be appreciated but is
  12. not required.
  13. 2. Altered source versions must be plainly marked as such, and must not be
  14. misrepresented as being the original software.
  15. 3. This notice may not be removed or altered from any source distribution.
  16. */
  17. #ifndef OIS_iPhoneInputManager_H
  18. #define OIS_iPhoneInputManager_H
  19. #include "OISInputManager.h"
  20. #include "OISFactoryCreator.h"
  21. #include "iphone/iPhonePrereqs.h"
  22. namespace OIS {
  23. class iPhoneAccelerometer;
  24. class iPhoneMultiTouch;
  25. }
  26. #if __OBJC__
  27. #import <UIKit/UIKit.h>
  28. @interface InputDelegate : UIView <UIAccelerometerDelegate> {
  29. OIS::iPhoneAccelerometer *accelerometerObject;
  30. OIS::iPhoneMultiTouch *touchObject;
  31. }
  32. @property (assign) OIS::iPhoneAccelerometer *accelerometerObject;
  33. @property (assign) OIS::iPhoneMultiTouch *touchObject;
  34. @end
  35. #endif
  36. namespace OIS
  37. {
  38. class iPhoneInputManager : public InputManager, public FactoryCreator
  39. {
  40. public:
  41. iPhoneInputManager();
  42. virtual ~iPhoneInputManager();
  43. //InputManager Overrides
  44. /** @copydoc InputManager::_initialize */
  45. void _initialize( ParamList &paramList );
  46. //FactoryCreator Overrides
  47. /** @copydoc FactoryCreator::deviceList */
  48. DeviceList freeDeviceList();
  49. /** @copydoc FactoryCreator::totalDevices */
  50. int totalDevices(Type iType);
  51. /** @copydoc FactoryCreator::freeDevices */
  52. int freeDevices(Type iType);
  53. /** @copydoc FactoryCreator::vendorExist */
  54. bool vendorExist(Type iType, const std::string & vendor);
  55. /** @copydoc FactoryCreator::createObject */
  56. Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string & vendor = "");
  57. /** @copydoc FactoryCreator::destroyObject */
  58. void destroyObject(Object* obj);
  59. //Internal Items
  60. //! Internal method, used for flagging multi-touch as available/unavailable for creation
  61. void _setMultiTouchUsed(bool used) { bMultiTouchUsed = used; }
  62. //! Internal method, used for flagging accelerometer as available/unavailable for creation
  63. void _setAccelerometerUsed(bool used) { bAccelerometerUsed = used; }
  64. //! methodfor getting the delegate
  65. #if __OBJC__
  66. InputDelegate * _getDelegate() { return mDelegate; }
  67. //! method for getting window
  68. UIWindow * _getWindow() { return mWindow; }
  69. #endif
  70. protected:
  71. void _parseConfigSettings( ParamList& paramList );
  72. // iPhone stuff
  73. #if __OBJC__
  74. UIWindow *mWindow;
  75. InputDelegate *mDelegate;
  76. #endif
  77. // settings
  78. bool mHideMouse;
  79. //! Used to know if we used up multi-touch device
  80. bool bMultiTouchUsed;
  81. //! Used to know if we used up accelerometer
  82. bool bAccelerometerUsed;
  83. bool mIsContentScalingSupported;
  84. float mContentScalingFactor;
  85. };
  86. }
  87. #endif