PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/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 
  4 Copyright (c) 2006 Chris Snyder 
  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_iPhoneInputManager_H
 24#define OIS_iPhoneInputManager_H
 25
 26#include "OISInputManager.h"
 27#include "OISFactoryCreator.h"
 28#include "iphone/iPhonePrereqs.h"
 29
 30namespace OIS {
 31    class iPhoneAccelerometer;
 32    class iPhoneMultiTouch;
 33}
 34
 35#if __OBJC__
 36#import <UIKit/UIKit.h>
 37
 38@interface InputDelegate : UIView <UIAccelerometerDelegate> {
 39    OIS::iPhoneAccelerometer    *accelerometerObject;
 40    OIS::iPhoneMultiTouch       *touchObject;
 41}
 42
 43@property (assign) OIS::iPhoneAccelerometer     *accelerometerObject;
 44@property (assign) OIS::iPhoneMultiTouch        *touchObject;
 45
 46@end
 47#endif
 48
 49namespace OIS
 50{
 51
 52    class iPhoneInputManager : public InputManager, public FactoryCreator
 53    {
 54    public:
 55        iPhoneInputManager();
 56        virtual ~iPhoneInputManager();
 57        
 58		//InputManager Overrides
 59		/** @copydoc InputManager::_initialize */
 60		void _initialize( ParamList &paramList );
 61
 62		//FactoryCreator Overrides
 63		/** @copydoc FactoryCreator::deviceList */
 64		DeviceList freeDeviceList();
 65
 66		/** @copydoc FactoryCreator::totalDevices */
 67		int totalDevices(Type iType);
 68
 69		/** @copydoc FactoryCreator::freeDevices */
 70		int freeDevices(Type iType);
 71
 72		/** @copydoc FactoryCreator::vendorExist */
 73		bool vendorExist(Type iType, const std::string & vendor);
 74
 75		/** @copydoc FactoryCreator::createObject */
 76		Object* createObject(InputManager* creator, Type iType, bool bufferMode, const std::string & vendor = "");
 77
 78		/** @copydoc FactoryCreator::destroyObject */
 79		void destroyObject(Object* obj);
 80
 81		//Internal Items
 82
 83		//! Internal method, used for flagging multi-touch as available/unavailable for creation
 84		void _setMultiTouchUsed(bool used) { bMultiTouchUsed = used; }
 85
 86        //! Internal method, used for flagging accelerometer as available/unavailable for creation
 87		void _setAccelerometerUsed(bool used) { bAccelerometerUsed = used; }
 88
 89        //! methodfor getting the delegate
 90#if __OBJC__
 91        InputDelegate * _getDelegate() { return mDelegate; }
 92
 93        //! method for getting window
 94        UIWindow * _getWindow() { return mWindow; }
 95#endif
 96
 97    protected:        
 98        void _parseConfigSettings( ParamList& paramList );
 99
100        // iPhone stuff
101#if __OBJC__
102		UIWindow *mWindow;
103        InputDelegate *mDelegate;
104#endif
105
106        // settings
107        bool mHideMouse;
108
109		//! Used to know if we used up multi-touch device
110		bool bMultiTouchUsed;
111
112        //! Used to know if we used up accelerometer
113		bool bAccelerometerUsed;
114
115        bool mIsContentScalingSupported;
116        float mContentScalingFactor;
117    };
118}
119
120#endif