mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-18 22:50:54 +00:00
added L3/R3 support to full on-screen controls
This commit is contained in:
@@ -384,15 +384,15 @@
|
|||||||
FB290CFA19B2C406004C83CF /* Supporting Files */,
|
FB290CFA19B2C406004C83CF /* Supporting Files */,
|
||||||
FB290D0219B2C406004C83CF /* AppDelegate.h */,
|
FB290D0219B2C406004C83CF /* AppDelegate.h */,
|
||||||
FB290D0319B2C406004C83CF /* AppDelegate.m */,
|
FB290D0319B2C406004C83CF /* AppDelegate.m */,
|
||||||
|
FBDE86DE19F7A837001C18A8 /* UIComputerView.h */,
|
||||||
|
FBDE86DF19F7A837001C18A8 /* UIComputerView.m */,
|
||||||
|
FBDE86E419F82297001C18A8 /* UIAppView.h */,
|
||||||
|
FBDE86E519F82297001C18A8 /* UIAppView.m */,
|
||||||
FB290E7819B37D81004C83CF /* iPad.storyboard */,
|
FB290E7819B37D81004C83CF /* iPad.storyboard */,
|
||||||
FB290E7A19B38036004C83CF /* iPhone.storyboard */,
|
FB290E7A19B38036004C83CF /* iPhone.storyboard */,
|
||||||
FB89463719F6473800339C8A /* Launch Screen.xib */,
|
FB89463719F6473800339C8A /* Launch Screen.xib */,
|
||||||
FB290D0819B2C406004C83CF /* Images.xcassets */,
|
FB290D0819B2C406004C83CF /* Images.xcassets */,
|
||||||
FB290D0519B2C406004C83CF /* Limelight.xcdatamodeld */,
|
FB290D0519B2C406004C83CF /* Limelight.xcdatamodeld */,
|
||||||
FBDE86DE19F7A837001C18A8 /* UIComputerView.h */,
|
|
||||||
FBDE86DF19F7A837001C18A8 /* UIComputerView.m */,
|
|
||||||
FBDE86E419F82297001C18A8 /* UIAppView.h */,
|
|
||||||
FBDE86E519F82297001C18A8 /* UIAppView.m */,
|
|
||||||
);
|
);
|
||||||
path = Limelight;
|
path = Limelight;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|||||||
@@ -50,6 +50,9 @@
|
|||||||
UITouch* _l1Touch;
|
UITouch* _l1Touch;
|
||||||
UITouch* _l2Touch;
|
UITouch* _l2Touch;
|
||||||
|
|
||||||
|
NSDate* l3TouchStart;
|
||||||
|
NSDate* r3TouchStart;
|
||||||
|
|
||||||
UIView* _view;
|
UIView* _view;
|
||||||
OnScreenControlsLevel _level;
|
OnScreenControlsLevel _level;
|
||||||
|
|
||||||
@@ -67,6 +70,7 @@ static const float D_PAD_DIST = 15;
|
|||||||
static float D_PAD_CENTER_X;
|
static float D_PAD_CENTER_X;
|
||||||
static float D_PAD_CENTER_Y;
|
static float D_PAD_CENTER_Y;
|
||||||
|
|
||||||
|
static const double STICK_CLICK_RATE = 100;
|
||||||
static const float STICK_INNER_SIZE = 80;
|
static const float STICK_INNER_SIZE = 80;
|
||||||
static const float STICK_OUTER_SIZE = 120;
|
static const float STICK_OUTER_SIZE = 120;
|
||||||
static const float STICK_DEAD_ZONE = .1;
|
static const float STICK_DEAD_ZONE = .1;
|
||||||
@@ -528,9 +532,27 @@ static float L2_Y;
|
|||||||
_r2Touch = touch;
|
_r2Touch = touch;
|
||||||
updated = true;
|
updated = true;
|
||||||
} else if ([_leftStick.presentationLayer hitTest:touchLocation]) {
|
} else if ([_leftStick.presentationLayer hitTest:touchLocation]) {
|
||||||
|
if (l3TouchStart != nil) {
|
||||||
|
// Find elapsed time and convert to milliseconds
|
||||||
|
// Use (-) modifier to conversion since receiver is earlier than now
|
||||||
|
double l3TouchTime = [l3TouchStart timeIntervalSinceNow] * -1000.0;
|
||||||
|
if (l3TouchTime < STICK_CLICK_RATE) {
|
||||||
|
[_controllerSupport setButtonFlag:LS_CLK_FLAG];
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
_lsTouch = touch;
|
_lsTouch = touch;
|
||||||
stickTouch = true;
|
stickTouch = true;
|
||||||
} else if ([_rightStick.presentationLayer hitTest:touchLocation]) {
|
} else if ([_rightStick.presentationLayer hitTest:touchLocation]) {
|
||||||
|
if (r3TouchStart != nil) {
|
||||||
|
// Find elapsed time and convert to milliseconds
|
||||||
|
// Use (-) modifier to conversion since receiver is earlier than now
|
||||||
|
double r3TouchTime = [r3TouchStart timeIntervalSinceNow] * -1000.0;
|
||||||
|
if (r3TouchTime < STICK_CLICK_RATE) {
|
||||||
|
[_controllerSupport setButtonFlag:RS_CLK_FLAG];
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
_rsTouch = touch;
|
_rsTouch = touch;
|
||||||
stickTouch = true;
|
stickTouch = true;
|
||||||
}
|
}
|
||||||
@@ -603,11 +625,15 @@ static float L2_Y;
|
|||||||
} else if (touch == _lsTouch) {
|
} else if (touch == _lsTouch) {
|
||||||
_leftStick.frame = CGRectMake(LS_CENTER_X - STICK_INNER_SIZE / 2, LS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
_leftStick.frame = CGRectMake(LS_CENTER_X - STICK_INNER_SIZE / 2, LS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||||
[_controllerSupport updateLeftStick:0 y:0];
|
[_controllerSupport updateLeftStick:0 y:0];
|
||||||
updated = true;
|
[_controllerSupport clearButtonFlag:LS_CLK_FLAG];
|
||||||
|
l3TouchStart = [NSDate date];
|
||||||
_lsTouch = nil;
|
_lsTouch = nil;
|
||||||
|
updated = true;
|
||||||
} else if (touch == _rsTouch) {
|
} else if (touch == _rsTouch) {
|
||||||
_rightStick.frame = CGRectMake(RS_CENTER_X - STICK_INNER_SIZE / 2, RS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
_rightStick.frame = CGRectMake(RS_CENTER_X - STICK_INNER_SIZE / 2, RS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||||
[_controllerSupport updateRightStick:0 y:0];
|
[_controllerSupport updateRightStick:0 y:0];
|
||||||
|
[_controllerSupport clearButtonFlag:RS_CLK_FLAG];
|
||||||
|
r3TouchStart = [NSDate date];
|
||||||
_rsTouch = nil;
|
_rsTouch = nil;
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
NSLog(@"Setting manual on-screen controls level: %d", (int)level);
|
NSLog(@"Setting manual on-screen controls level: %d", (int)level);
|
||||||
[onScreenControls setLevel:level];
|
[onScreenControls setLevel:level];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
|
|||||||
Reference in New Issue
Block a user