mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-15 21:21:45 +00:00
fixed multitouch issue with on-screen controls
This commit is contained in:
@@ -17,9 +17,9 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
- (id) initWithView:(UIView*)view;
|
- (id) initWithView:(UIView*)view;
|
||||||
- (BOOL) handleTouchDownEvent:(UIEvent*)event;
|
- (BOOL) handleTouchDownEvent:(NSSet*)touches;
|
||||||
- (BOOL) handleTouchUpEvent:(UIEvent*) event;
|
- (BOOL) handleTouchUpEvent:(NSSet*)touches;
|
||||||
- (BOOL) handleTouchMovedEvent:(UIEvent*)event;
|
- (BOOL) handleTouchMovedEvent:(NSSet*)touches;
|
||||||
- (void) setLevel:(OnScreenControlsLevel)level;
|
- (void) setLevel:(OnScreenControlsLevel)level;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ static float L2_Y;
|
|||||||
[_rightStick removeFromSuperlayer];
|
[_rightStick removeFromSuperlayer];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) handleTouchMovedEvent:(UIEvent*)event {
|
- (BOOL) handleTouchMovedEvent:touches {
|
||||||
BOOL shouldSendPacket = false;
|
BOOL shouldSendPacket = false;
|
||||||
BOOL buttonTouch = false;
|
BOOL buttonTouch = false;
|
||||||
float rsMaxX = RS_CENTER_X + STICK_OUTER_SIZE / 2;
|
float rsMaxX = RS_CENTER_X + STICK_OUTER_SIZE / 2;
|
||||||
@@ -325,7 +325,7 @@ static float L2_Y;
|
|||||||
float lsMinX = LS_CENTER_X - STICK_OUTER_SIZE / 2;
|
float lsMinX = LS_CENTER_X - STICK_OUTER_SIZE / 2;
|
||||||
float lsMinY = LS_CENTER_Y - STICK_OUTER_SIZE / 2;
|
float lsMinY = LS_CENTER_Y - STICK_OUTER_SIZE / 2;
|
||||||
|
|
||||||
for (UITouch* touch in [event allTouches]) {
|
for (UITouch* touch in touches) {
|
||||||
CGPoint touchLocation = [touch locationInView:_view];
|
CGPoint touchLocation = [touch locationInView:_view];
|
||||||
float xLoc = touchLocation.x;
|
float xLoc = touchLocation.x;
|
||||||
float yLoc = touchLocation.y;
|
float yLoc = touchLocation.y;
|
||||||
@@ -402,9 +402,9 @@ static float L2_Y;
|
|||||||
return shouldSendPacket || buttonTouch;
|
return shouldSendPacket || buttonTouch;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)handleTouchDownEvent:(UIEvent*)event {
|
- (BOOL)handleTouchDownEvent:touches {
|
||||||
BOOL shouldSendPacket = false;
|
BOOL shouldSendPacket = false;
|
||||||
for (UITouch* touch in [event allTouches]) {
|
for (UITouch* touch in touches) {
|
||||||
CGPoint touchLocation = [touch locationInView:_view];
|
CGPoint touchLocation = [touch locationInView:_view];
|
||||||
|
|
||||||
if ([_aButton.presentationLayer hitTest:touchLocation]) {
|
if ([_aButton.presentationLayer hitTest:touchLocation]) {
|
||||||
@@ -478,9 +478,9 @@ static float L2_Y;
|
|||||||
return shouldSendPacket;
|
return shouldSendPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)handleTouchUpEvent:(UIEvent*)event {
|
- (BOOL)handleTouchUpEvent:touches {
|
||||||
BOOL shouldSendPacket = false;
|
BOOL shouldSendPacket = false;
|
||||||
for (UITouch* touch in [event allTouches]) {
|
for (UITouch* touch in touches) {
|
||||||
if (touch == _aTouch) {
|
if (touch == _aTouch) {
|
||||||
UPDATE_BUTTON(A_FLAG, 0);
|
UPDATE_BUTTON(A_FLAG, 0);
|
||||||
_aTouch = nil;
|
_aTouch = nil;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
NSLog(@"Touch down");
|
NSLog(@"Touch down");
|
||||||
if (![onScreenControls handleTouchDownEvent:event]) {
|
if (![onScreenControls handleTouchDownEvent:touches]) {
|
||||||
UITouch *touch = [[event allTouches] anyObject];
|
UITouch *touch = [[event allTouches] anyObject];
|
||||||
touchLocation = [touch locationInView:self];
|
touchLocation = [touch locationInView:self];
|
||||||
touchMoved = false;
|
touchMoved = false;
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
if (![onScreenControls handleTouchMovedEvent:event]) {
|
if (![onScreenControls handleTouchMovedEvent:touches]) {
|
||||||
if ([[event allTouches] count] == 1) {
|
if ([[event allTouches] count] == 1) {
|
||||||
UITouch *touch = [[event allTouches] anyObject];
|
UITouch *touch = [[event allTouches] anyObject];
|
||||||
CGPoint currentLocation = [touch locationInView:self];
|
CGPoint currentLocation = [touch locationInView:self];
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
NSLog(@"Touch up");
|
NSLog(@"Touch up");
|
||||||
if (![onScreenControls handleTouchUpEvent:event]) {
|
if (![onScreenControls handleTouchUpEvent:touches]) {
|
||||||
if (!touchMoved) {
|
if (!touchMoved) {
|
||||||
if ([[event allTouches] count] == 2) {
|
if ([[event allTouches] count] == 2) {
|
||||||
NSLog(@"Sending right mouse button press");
|
NSLog(@"Sending right mouse button press");
|
||||||
|
|||||||
Reference in New Issue
Block a user