PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/src/ois/includes/iphone/iPhoneAccelerometer.h

https://bitbucket.org/cabalistic/ogredeps/
C++ Header | 50 lines | 31 code | 14 blank | 5 comment | 0 complexity | 3bfa8943af38a28854d39aa4313ab040 MD5 | raw file
 1#ifndef OIS_iPhoneAccelerometer_H
 2#define OIS_iPhoneAccelerometer_H
 3
 4#include "OISJoystick.h"
 5#include "iphone/iPhonePrereqs.h"
 6
 7#import <UIKit/UIKit.h>
 8@class iPhoneAccelerometerDelegate;
 9
10class JoyStickState;
11
12namespace OIS
13{
14	class iPhoneAccelerometer : public JoyStick
15    {
16	public:
17		iPhoneAccelerometer(InputManager* creator, bool buffered);
18		virtual ~iPhoneAccelerometer();
19		
20		/** @copydoc Object::setBuffered */
21		virtual void setBuffered(bool buffered);
22
23        void setUpdateInterval(float interval) { 
24            mUpdateInterval = interval;
25            [[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0f / mUpdateInterval)];
26        }
27        
28        Vector3 getAccelerometerVector3(void) { return mState.mVectors[0]; }
29		/** @copydoc Object::capture */
30		virtual void capture();
31
32		/** @copydoc Object::queryInterface */
33		virtual Interface* queryInterface(Interface::IType type) {return 0;}
34
35		/** @copydoc Object::_initialize */
36		virtual void _initialize();
37
38        void didAccelerate(UIAcceleration *acceleration);
39
40    protected:
41        iPhoneAccelerometerDelegate *accelerometerDelegate;
42
43        /** The update frequency of the accelerometer.  Represented in times per second. */
44        float mUpdateInterval;
45        Vector3 mTempState;
46	};
47}
48
49
50#endif // OIS_iPhoneAccelerometer_H