switch between built-in & controller gyros
This commit is contained in:
1 parent
3cbdba78d6
commit
578ad81b8a
7 files changed
+460
-249
No files matched your search
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import "StreamConfiguration.h"
|
||||
#import "Controller.h"
|
||||
#import "VoidController.h"
|
||||
|
||||
@class OnScreenControls;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
- (void)gamepadPresenceChanged;
|
||||
- (void)mousePresenceChanged;
|
||||
- (void)streamExitRequested;
|
||||
- (void)automaticallyStartSendingBuiltinGyroEvents;
|
||||
- (void)automaticallyStartSendingGyroEvents;
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,20 +27,20 @@
|
||||
|
||||
-(void) initAutoOnScreenControlMode:(OnScreenControls*)osc;
|
||||
-(void) cleanup;
|
||||
-(Controller*) getOscController;
|
||||
-(VoidController*) getOscController;
|
||||
|
||||
-(void) updateLeftStick:(Controller*)controller x:(short)x y:(short)y;
|
||||
-(void) updateRightStick:(Controller*)controller x:(short)x y:(short)y;
|
||||
-(void) updateLeftStick:(VoidController*)controller x:(short)x y:(short)y;
|
||||
-(void) updateRightStick:(VoidController*)controller x:(short)x y:(short)y;
|
||||
|
||||
-(void) updateLeftTrigger:(Controller*)controller left:(unsigned char)left;
|
||||
-(void) updateRightTrigger:(Controller*)controller right:(unsigned char)right;
|
||||
-(void) updateTriggers:(Controller*)controller left:(unsigned char)left right:(unsigned char)right;
|
||||
-(void) updateLeftTrigger:(VoidController*)controller left:(unsigned char)left;
|
||||
-(void) updateRightTrigger:(VoidController*)controller right:(unsigned char)right;
|
||||
-(void) updateTriggers:(VoidController*)controller left:(unsigned char)left right:(unsigned char)right;
|
||||
|
||||
-(void) updateButtonFlags:(Controller*)controller flags:(int)flags;
|
||||
-(void) setButtonFlag:(Controller*)controller flags:(int)flags;
|
||||
-(void) clearButtonFlag:(Controller*)controller flags:(int)flags;
|
||||
-(void) updateButtonFlags:(VoidController*)controller flags:(int)flags;
|
||||
-(void) setButtonFlag:(VoidController*)controller flags:(int)flags;
|
||||
-(void) clearButtonFlag:(VoidController*)controller flags:(int)flags;
|
||||
|
||||
-(void) updateFinished:(Controller*)controller;
|
||||
-(void) updateFinished:(VoidController*)controller;
|
||||
|
||||
-(void) rumble:(unsigned short)controllerNumber lowFreqMotor:(unsigned short)lowFreqMotor highFreqMotor:(unsigned short)highFreqMotor;
|
||||
-(void) rumbleTriggers:(uint16_t)controllerNumber leftTrigger:(uint16_t)leftTrigger rightTrigger:(uint16_t)rightTrigger;
|
||||
|
||||
+426
-222
File diff suppressed because it is too large.
Load diff
@@ -11,7 +11,7 @@
|
||||
|
||||
#import "OnScreenControls.h"
|
||||
#import "CustomTapGestureRecognizer.h"
|
||||
#import "Controller.h"
|
||||
#import "VoidController.h"
|
||||
#include "Limelight.h"
|
||||
#if !TARGET_OS_TV
|
||||
#import <CoreMotion/CoreMotion.h>
|
||||
@@ -70,7 +70,7 @@ static NSSet *validPositionButtonNames;
|
||||
BOOL _visible;
|
||||
|
||||
ControllerSupport *_controllerSupport;
|
||||
Controller *_controller;
|
||||
VoidController *_controller;
|
||||
NSMutableArray* _deadTouches;
|
||||
BOOL _swapABXY;
|
||||
BOOL _largerStickLR1;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
@import CoreMotion;
|
||||
#endif
|
||||
|
||||
@interface Controller : NSObject
|
||||
@interface VoidController : NSObject
|
||||
|
||||
typedef struct {
|
||||
float lastX;
|
||||
@@ -64,11 +64,13 @@ typedef NS_ENUM(NSInteger, ControllerDeviceBatteryState) {
|
||||
@property (nonatomic) float lastBatteryLevel;
|
||||
|
||||
@property (nonatomic) BOOL reportedArrival;
|
||||
@property (nonatomic) Controller* _Nullable mergedWithController;
|
||||
@property (nonatomic) VoidController* _Nullable mergedWithController;
|
||||
|
||||
@property(nonatomic, strong) NSMutableSet* _Nullable motionTypes;
|
||||
@property(nonatomic, assign) uint16_t reportRateHz;
|
||||
@property(nonatomic, assign) uint16_t controllerNumber;
|
||||
@property(nonatomic, assign) BOOL hasAccelerometer;
|
||||
@property(nonatomic, assign) BOOL hasGyroscope;
|
||||
|
||||
|
||||
@end
|
||||
@@ -6,8 +6,8 @@
|
||||
// Copyright © 2019 Moonlight Game Streaming Project. All rights reserved.
|
||||
//
|
||||
|
||||
#include "Controller.h"
|
||||
#include "VoidController.h"
|
||||
|
||||
@implementation Controller
|
||||
@implementation VoidController
|
||||
|
||||
@end
|
||||
@@ -57,6 +57,7 @@
|
||||
StreamView *_streamView;
|
||||
UIScrollView *_scrollView;
|
||||
BOOL _userIsInteracting;
|
||||
bool viewJustLoaded;
|
||||
CGSize _keyboardSize;
|
||||
UIWindow *_extWindow;
|
||||
UIView *_streamVideoRenderView;
|
||||
@@ -195,7 +196,10 @@
|
||||
[self->_streamView disableOnScreenControls]; //don't know why but this must be called outside the streamview class, just put it here. execute in streamview class cause hang
|
||||
[self.mainFrameViewcontroller reloadStreamConfig]; // reload streamconfig
|
||||
|
||||
[_controllerSupport updateConfig:self.streamConfig delegate:self];// reload controllerSupport obj, this is mandatory for OSC reload,especially when the stream view is launched without OSC
|
||||
NSLog(@"viewJustloaded: %d", viewJustLoaded);
|
||||
if(!viewJustLoaded) [_controllerSupport updateConfig:self.streamConfig delegate:self];
|
||||
else viewJustLoaded = false;
|
||||
// reload controllerSupport obj, this is mandatory for OSC reload,especially when the stream view is launched without OSC
|
||||
[_streamView setupStreamView:_controllerSupport interactionDelegate:self config:self.streamConfig streamFrameTopLayerView:self.view]; //reinitiate setupStreamView process.
|
||||
// we got self.view passed to streamView class as the topLayerView, will be useful in many cases
|
||||
[self->_streamView reloadOnScreenControlsRealtimeWith:(ControllerSupport*)_controllerSupport
|
||||
@@ -215,7 +219,7 @@
|
||||
NSLog(@"streamview gestures: %d", (uint32_t)[_streamView.gestureRecognizers count]);
|
||||
}
|
||||
|
||||
-(void)automaticallyStartSendingBuiltinGyroEvents{
|
||||
-(void)automaticallyStartSendingGyroEvents{
|
||||
[_controllerSupport updateConfig:self.streamConfig delegate:self];// reload controllerSupport obj, this is mandatory for OSC reload,especially when the stream view is launched without OSC
|
||||
}
|
||||
|
||||
@@ -347,6 +351,7 @@
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
viewJustLoaded = true;
|
||||
[super viewDidLoad];
|
||||
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
|
||||
Reference in new issue
Block a user