-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
210 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// PassthroughTouchHandler.h | ||
// Moonlight | ||
// | ||
// Created by ZigZagT on 5/20/2024. | ||
// Copyright © 2024 Moonlight Game Streaming Project. All rights reserved. | ||
// | ||
|
||
#import "StreamView.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface PassthroughTouchHandler : UIResponder | ||
|
||
-(id)initWithView:(StreamView*)view; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// | ||
// PassthroughTouchHandler.m | ||
// Moonlight | ||
// | ||
// Created by ZigZagT on 5/20/2024. | ||
// Copyright © 2024 Moonlight Game Streaming Project. All rights reserved. | ||
// | ||
|
||
#import "PassthroughTouchHandler.h" | ||
|
||
#include <Limelight.h> | ||
|
||
@implementation PassthroughTouchHandler { | ||
StreamView* view; | ||
} | ||
|
||
- (id)initWithView:(StreamView*)view { | ||
self = [self init]; | ||
self->view = view; | ||
return self; | ||
} | ||
|
||
|
||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | ||
for (UITouch* touch in touches) { | ||
CGPoint location = [self->view adjustCoordinatesForVideoArea:[touch locationInView:self->view]]; | ||
CGSize videoSize = [self->view getVideoAreaSize]; | ||
LiSendTouchEvent( | ||
LI_TOUCH_EVENT_DOWN, | ||
(uint32_t) (uint64_t) touch, | ||
location.x / videoSize.width, | ||
location.y / videoSize.height, | ||
0, | ||
0, | ||
0, | ||
LI_ROT_UNKNOWN | ||
); | ||
} | ||
} | ||
|
||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { | ||
for (UITouch* touch in touches) { | ||
CGPoint location = [self->view adjustCoordinatesForVideoArea:[touch locationInView:self->view]]; | ||
CGSize videoSize = [self->view getVideoAreaSize]; | ||
LiSendTouchEvent( | ||
LI_TOUCH_EVENT_MOVE, | ||
(uint32_t) (uint64_t) touch, | ||
location.x / videoSize.width, | ||
location.y / videoSize.height, | ||
0, | ||
0, | ||
0, | ||
LI_ROT_UNKNOWN | ||
); | ||
} | ||
} | ||
|
||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { | ||
for (UITouch* touch in touches) { | ||
CGPoint location = [self->view adjustCoordinatesForVideoArea:[touch locationInView:self->view]]; | ||
CGSize videoSize = [self->view getVideoAreaSize]; | ||
LiSendTouchEvent( | ||
LI_TOUCH_EVENT_UP, | ||
(uint32_t) (uint64_t) touch, | ||
location.x / videoSize.width, | ||
location.y / videoSize.height, | ||
0, | ||
0, | ||
0, | ||
LI_ROT_UNKNOWN | ||
); | ||
} | ||
} | ||
|
||
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { | ||
for (UITouch* touch in touches) { | ||
CGPoint location = [self->view adjustCoordinatesForVideoArea:[touch locationInView:self->view]]; | ||
CGSize videoSize = [self->view getVideoAreaSize]; | ||
LiSendTouchEvent( | ||
LI_TOUCH_EVENT_CANCEL, | ||
(uint32_t) (uint64_t) touch, | ||
location.x / videoSize.width, | ||
location.y / videoSize.height, | ||
0, | ||
0, | ||
0, | ||
LI_ROT_UNKNOWN | ||
); | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.