mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-24 01:06:53 +00:00
Add some WIP touch input support
This commit is contained in:
58
Limelight/StreamView.m
Normal file
58
Limelight/StreamView.m
Normal file
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// StreamView.m
|
||||
// Limelight
|
||||
//
|
||||
// Created by Cameron Gutman on 10/19/14.
|
||||
// Copyright (c) 2014 Limelight Stream. All rights reserved.
|
||||
//
|
||||
|
||||
#import "StreamView.h"
|
||||
#include <Limelight.h>
|
||||
|
||||
@implementation StreamView {
|
||||
CGPoint touchLocation;
|
||||
BOOL touchMoved;
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
touchLocation = [touch locationInView:self];
|
||||
touchMoved = false;
|
||||
|
||||
NSLog(@"Touch down");
|
||||
}
|
||||
|
||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
CGPoint currentLocation = [touch locationInView:self];
|
||||
|
||||
NSLog(@"Touch move");
|
||||
|
||||
if (touchLocation.x != currentLocation.x &&
|
||||
touchLocation.y != currentLocation.y)
|
||||
{
|
||||
LiSendMouseMoveEvent(touchLocation.x - currentLocation.x,
|
||||
touchLocation.y - currentLocation.y);
|
||||
|
||||
touchMoved = true;
|
||||
touchLocation = currentLocation;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
NSLog(@"Touch up");
|
||||
|
||||
if (!touchMoved) {
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
||||
|
||||
usleep(50 * 1000);
|
||||
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user