// // RbxInputView.h // Roblox iOS Shared Code // // Created by Ben Tkacheff on 10/25/13. // Copyright (c) 2013 ROBLOX. All rights reserved. // #pragma once #import #import #import "ControlComponent.h" #include "v8datamodel/TouchInputService.h" #include "v8datamodel/UserInputService.h" @class RbxInputView; typedef std::vector KeycodeInputs; typedef boost::unordered_map BufferedGamepadState; typedef boost::unordered_map BufferedGamepadStates; static boost::mutex ControllerBufferMutex; @interface RbxInputView : ControlComponent { G3D::Vector2int16 windowSize; // Gesture Input // each direction needs its own recognizer, nice... UISwipeGestureRecognizer *swipeRightRecognizer; UISwipeGestureRecognizer *swipeLeftRecognizer; UISwipeGestureRecognizer *swipeUpRecognizer; UISwipeGestureRecognizer *swipeDownRecognizer; UITapGestureRecognizer *tapRecognizer; UITapGestureRecognizer *twoFingerTapRecognizer; UITapGestureRecognizer *threeFingerTapRecognizer; UIRotationGestureRecognizer* rotationRecognizer; UILongPressGestureRecognizer* longPressRecognizer; UIPinchGestureRecognizer *pinchRecognizer; UIPanGestureRecognizer *panRecognizer; // Touch Input boost::unordered_map > touchInputMap; NSMutableArray* storedTouches; // Motion Input CMMotionManager *motionManager; NSOperationQueue *motionQueue; CMAttitude* refAttitude; // Controller Input bool paused; std::map controllersConnectedMap; BufferedGamepadStates controllerBufferMap; // DataModel service references weak_ptr weakTouchInputService; } - (id) init: (CGRect)frame; // any init that requires use of a datamodel or its services, put in this function - (void) datamodelInit; // Basic Input handling -(void) sendTouchEvent:(UITouch*) touch; -(void) sendTouchEvent:(UITouch*) touch shouldOverride:(BOOL) shouldOverride overrideState:(UITouchPhase) overrideState; -(void) cancelAllTouches; -(void) basicGestureConfig:(UIGestureRecognizer*) gesture; // Gesture handlers -(void) twoFingerPinch:(UIPinchGestureRecognizer *)recognizer; -(void) tapGesture:(UITapGestureRecognizer*) recognizer; -(void) swipeGesture:(UISwipeGestureRecognizer*)recognizer; -(void) longPressGesture:(UILongPressGestureRecognizer*) recognizer; -(void) panGesture:(UIPanGestureRecognizer*) recognizer; -(RBX::UserInputService::SwipeDirection) getRbxSwipeDirection:(UISwipeGestureRecognizerDirection) uiSwipeDirection; // Motion Stuff -(void) startMotionUpdates; +(BOOL) isGyroscopeAvailable; // Controller Stuff -(void) gcControllerConnected:(NSNotification*) notification; -(void) gcControllerDisconnected:(NSNotification*) notification; @end