Compare commits

..
7 Commits
8 changed files with 87 additions and 34 deletions

No files matched your search

Binary file not shown.
+46 -18
View File
@@ -19,36 +19,64 @@
touchLocation = [touch locationInView:self]; touchLocation = [touch locationInView:self];
touchMoved = false; touchMoved = false;
printf("Touch down\n"); NSLog(@"Touch down");
} }
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint currentLocation = [touch locationInView:self];
if (touchLocation.x != currentLocation.x || if ([[event allTouches] count] == 1) {
touchLocation.y != currentLocation.y) UITouch *touch = [[event allTouches] anyObject];
{ CGPoint currentLocation = [touch locationInView:self];
LiSendMouseMoveEvent(currentLocation.x - touchLocation.x,
currentLocation.y - touchLocation.y ); if (touchLocation.x != currentLocation.x ||
touchLocation.y != currentLocation.y)
{
LiSendMouseMoveEvent(currentLocation.x - touchLocation.x,
currentLocation.y - touchLocation.y );
touchMoved = true;
touchLocation = currentLocation;
}
} else if ([[event allTouches] count] == 2) {
CGPoint firstLocation = [[[[event allTouches] allObjects] objectAtIndex:0] locationInView:self];
CGPoint secondLocation = [[[[event allTouches] allObjects] objectAtIndex:1] locationInView:self];
CGPoint avgLocation = CGPointMake((firstLocation.x + secondLocation.x) / 2, (firstLocation.y + secondLocation.y) / 2);
if (touchLocation.y != avgLocation.y) {
LiSendScrollEvent(avgLocation.y - touchLocation.y);
}
touchMoved = true; touchMoved = true;
touchLocation = currentLocation; touchLocation = avgLocation;
} }
} }
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
printf("Touch up\n"); NSLog(@"Touch up");
if (!touchMoved) { if (!touchMoved) {
printf("Sending left mouse button press\n"); if ([[event allTouches] count] == 2) {
NSLog(@"Sending right mouse button press");
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
// Wait 100 ms to simulate a real button press
usleep(100 * 1000); // Wait 100 ms to simulate a real button press
usleep(100 * 1000);
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
} else {
NSLog(@"Sending left mouse button press");
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
// Wait 100 ms to simulate a real button press
usleep(100 * 1000);
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
}
} }
} }
+2 -2
View File
@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.2.1</string> <string>0.2.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>2</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.games</string> <string>public.app-category.games</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
+16
View File
@@ -28,4 +28,20 @@
return self; return self;
} }
- (BOOL)isEqual:(id)object {
if ([object isKindOfClass:[Computer class]]) {
return [self.hostName isEqual:[object valueForKey:@"hostName"]];
} else {
return NO;
}
}
- (NSUInteger)hash {
NSUInteger prime = 31;
NSUInteger result = 1;
result = prime * result + (self.hostName == nil ? 0 : [self.hostName hash]);
return result;
}
@end @end
@@ -30,6 +30,8 @@
UIAlertView* _pairAlert; UIAlertView* _pairAlert;
UIScrollView* hostScrollView; UIScrollView* hostScrollView;
UIScrollView* appScrollView; UIScrollView* appScrollView;
int currentPosition;
} }
static NSString* deviceName = @"roth"; static NSString* deviceName = @"roth";
static NSMutableSet* hostList; static NSMutableSet* hostList;
@@ -147,6 +149,10 @@ static StreamConfiguration* streamConfig;
streamConfig.height = [streamSettings.height intValue]; streamConfig.height = [streamSettings.height intValue];
streamConfig.width = [streamSettings.width intValue]; streamConfig.width = [streamSettings.width intValue];
if (currentPosition != FrontViewPositionLeft) {
[[self revealViewController] revealToggle:self];
}
[self performSegueWithIdentifier:@"createStreamFrame" sender:nil]; [self performSegueWithIdentifier:@"createStreamFrame" sender:nil];
} }
@@ -155,6 +161,7 @@ static StreamConfiguration* streamConfig;
if (position == FrontViewPositionLeft) { if (position == FrontViewPositionLeft) {
[(SettingsViewController*)[revealController rearViewController] saveSettings]; [(SettingsViewController*)[revealController rearViewController] saveSettings];
} }
currentPosition = position;
} }
- (void)viewDidLoad - (void)viewDidLoad
@@ -164,17 +171,20 @@ static StreamConfiguration* streamConfig;
// Change button color // Change button color
_settingsSidebarButton.tintColor = [UIColor colorWithRed:.2 green:.9 blue:0.f alpha:1.f]; _settingsSidebarButton.tintColor = [UIColor colorWithRed:.2 green:.9 blue:0.f alpha:1.f];
// Set the side bar button action. When it's tapped, it'll show up the sidebar. // Set the side bar button action. When it's tapped, it'll show the sidebar.
_settingsSidebarButton.target = self.revealViewController; _settingsSidebarButton.target = self.revealViewController;
_settingsSidebarButton.action = @selector(revealToggle:); _settingsSidebarButton.action = @selector(revealToggle:);
// Set the gesture // Set the gesture
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer]; [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
// Get callbacks associated with the viewController
[self.revealViewController setDelegate:self]; [self.revealViewController setDelegate:self];
//NSArray* streamConfigVals = [[NSArray alloc] initWithObjects:@"1280x720 (30Hz)", @"1280x720 (60Hz)", @"1920x1080 (30Hz)", @"1920x1080 (60Hz)",nil]; // Set the current position to the center
currentPosition = FrontViewPositionLeft;
// Set up crypto
_opQueue = [[NSOperationQueue alloc] init]; _opQueue = [[NSOperationQueue alloc] init];
[CryptoManager generateKeyPairUsingSSl]; [CryptoManager generateKeyPairUsingSSl];
_uniqueId = [CryptoManager getUniqueID]; _uniqueId = [CryptoManager getUniqueID];
@@ -29,8 +29,8 @@
[self.stageLabel setText:@"Starting App"]; [self.stageLabel setText:@"Starting App"];
[self.stageLabel sizeToFit]; [self.stageLabel sizeToFit];
self.stageLabel.center = CGPointMake(self.view.frame.size.width / 2, self.stageLabel.center.y); self.stageLabel.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2);
self.spinner.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2 - self.stageLabel.frame.size.height - self.spinner.frame.size.height);
[UIApplication sharedApplication].idleTimerDisabled = YES; [UIApplication sharedApplication].idleTimerDisabled = YES;
_controllerSupport = [[ControllerSupport alloc] init]; _controllerSupport = [[ControllerSupport alloc] init];
@@ -62,7 +62,6 @@
[self.spinner stopAnimating]; [self.spinner stopAnimating];
[self.stageLabel setText:@"Waiting for first frame..."]; [self.stageLabel setText:@"Waiting for first frame..."];
[self.stageLabel sizeToFit]; [self.stageLabel sizeToFit];
self.stageLabel.center = CGPointMake(self.view.frame.size.width / 2, self.stageLabel.center.y);
}); });
} }
+2 -2
View File
@@ -130,7 +130,7 @@
<scene sceneID="RuD-qk-7nb"> <scene sceneID="RuD-qk-7nb">
<objects> <objects>
<viewController storyboardIdentifier="MainFrame" id="OIm-0n-i9v" customClass="StreamFrameViewController" sceneMemberID="viewController"> <viewController storyboardIdentifier="MainFrame" id="OIm-0n-i9v" customClass="StreamFrameViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="VPm-Ae-rc4" userLabel="RenderView" customClass="StreamView"> <view key="view" multipleTouchEnabled="YES" contentMode="scaleToFill" id="VPm-Ae-rc4" userLabel="RenderView" customClass="StreamView">
<rect key="frame" x="0.0" y="0.0" width="1024" height="768"/> <rect key="frame" x="0.0" y="0.0" width="1024" height="768"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
@@ -165,7 +165,7 @@
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="Settings" width="17" height="17"/> <image name="Settings" width="25" height="25"/>
</resources> </resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics"> <simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="lightContent"/> <simulatedStatusBarMetrics key="statusBar" statusBarStyle="lightContent"/>
+7 -7
View File
@@ -132,21 +132,21 @@
<scene sceneID="5Eb-q2-vjt"> <scene sceneID="5Eb-q2-vjt">
<objects> <objects>
<viewController id="mI3-9F-XwU" customClass="StreamFrameViewController" sceneMemberID="viewController"> <viewController id="mI3-9F-XwU" customClass="StreamFrameViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="eir-e9-IPE" customClass="StreamView"> <view key="view" multipleTouchEnabled="YES" contentMode="scaleToFill" id="eir-e9-IPE" customClass="StreamView">
<rect key="frame" x="0.0" y="0.0" width="568" height="320"/> <rect key="frame" x="0.0" y="0.0" width="568" height="320"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="white" id="0vm-Iv-K4b">
<rect key="frame" x="274" y="150" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</activityIndicatorView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Stage" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2HK-Z5-4Ch"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Stage" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2HK-Z5-4Ch">
<rect key="frame" x="262" y="178" width="45" height="21"/> <rect key="frame" x="262" y="149" width="45" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="white" id="0vm-Iv-K4b">
<rect key="frame" x="274" y="121" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</activityIndicatorView>
</subviews> </subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</view> </view>
@@ -166,7 +166,7 @@
</scene> </scene>
</scenes> </scenes>
<resources> <resources>
<image name="Settings" width="17" height="17"/> <image name="Settings" width="25" height="25"/>
</resources> </resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics"> <simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/> <simulatedStatusBarMetrics key="statusBar"/>