Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce3f046ae8 | ||
|
|
d4cd8d3bba | ||
|
|
57bf748877 | ||
|
|
d134ff83d6 | ||
|
|
f0b145c01a | ||
|
|
5aeedb894a | ||
|
|
ee61dc9a59 | ||
|
|
a52b20ee52 | ||
|
|
f209670c1a | ||
|
|
168eac17eb | ||
|
|
417f1e02bc | ||
|
|
3eee684961 | ||
|
|
e8c8f4f8e9 | ||
|
|
0e2765ad86 | ||
|
|
40d6ab91cf | ||
|
|
c96a77f1aa | ||
|
|
ece113787d | ||
|
|
cb93486bb0 | ||
|
|
809a660506 | ||
|
|
7b0a383ad0 | ||
|
|
2cb1acc611 | ||
|
|
d6d30f021d | ||
|
|
4a08288d0d | ||
|
|
5c488cf4aa | ||
|
|
c7b6011806 | ||
|
|
af4a833806 | ||
|
|
87a6d2f656 | ||
|
|
0ee9b87742 | ||
|
|
5968d511b2 | ||
|
|
20561ae64f | ||
|
|
600e71223c | ||
|
|
d5c12a3eb6 | ||
|
|
35dc4a7de3 | ||
|
|
582dda5727 | ||
|
|
c05949c43b | ||
|
|
e913d26ca6 | ||
|
|
427e8f67fc | ||
|
|
79e51defe1 | ||
|
|
5f800b7901 | ||
|
|
c3b44a32d5 | ||
|
|
539e120167 | ||
|
|
a924d63750 |
@@ -27,6 +27,11 @@
|
||||
FB290DC419B2E98F004C83CF /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FB290DC319B2E98F004C83CF /* libxml2.dylib */; };
|
||||
FB290E7919B37D81004C83CF /* iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FB290E7819B37D81004C83CF /* iPad.storyboard */; };
|
||||
FB290E7B19B38036004C83CF /* iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FB290E7A19B38036004C83CF /* iPhone.storyboard */; };
|
||||
FB4678ED1A50C40900377732 /* OnScreenControls.m in Sources */ = {isa = PBXBuildFile; fileRef = FB4678EC1A50C40900377732 /* OnScreenControls.m */; };
|
||||
FB4678FA1A55FFAD00377732 /* DiscoveryManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FB4678F91A55FFAD00377732 /* DiscoveryManager.m */; };
|
||||
FB4678FF1A565DAC00377732 /* WakeOnLanManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FB4678FE1A565DAC00377732 /* WakeOnLanManager.m */; };
|
||||
FB4679011A57048000377732 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FB4679001A57048000377732 /* CoreFoundation.framework */; };
|
||||
FB6549561A57907E001C8F39 /* DiscoveryWorker.m in Sources */ = {isa = PBXBuildFile; fileRef = FB6549551A57907E001C8F39 /* DiscoveryWorker.m */; };
|
||||
FB7E794419C8B71B00A15F68 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FB7E794319C8B71B00A15F68 /* libiconv.dylib */; };
|
||||
FB89462819F646E200339C8A /* CryptoManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FB89460619F646E200339C8A /* CryptoManager.m */; };
|
||||
FB89462919F646E200339C8A /* mkcert.c in Sources */ = {isa = PBXBuildFile; fileRef = FB89460719F646E200339C8A /* mkcert.c */; };
|
||||
@@ -39,7 +44,6 @@
|
||||
FB89463019F646E200339C8A /* StreamConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = FB89461919F646E200339C8A /* StreamConfiguration.m */; };
|
||||
FB89463119F646E200339C8A /* StreamManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FB89461B19F646E200339C8A /* StreamManager.m */; };
|
||||
FB89463219F646E200339C8A /* VideoDecoderRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = FB89461D19F646E200339C8A /* VideoDecoderRenderer.m */; };
|
||||
FB89463319F646E200339C8A /* Computer.m in Sources */ = {isa = PBXBuildFile; fileRef = FB89462019F646E200339C8A /* Computer.m */; };
|
||||
FB89463419F646E200339C8A /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = FB89462219F646E200339C8A /* Utils.m */; };
|
||||
FB89463519F646E200339C8A /* MainFrameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FB89462519F646E200339C8A /* MainFrameViewController.m */; };
|
||||
FB89463619F646E200339C8A /* StreamFrameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FB89462719F646E200339C8A /* StreamFrameViewController.m */; };
|
||||
@@ -106,6 +110,16 @@
|
||||
FB290DC319B2E98F004C83CF /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
|
||||
FB290E7819B37D81004C83CF /* iPad.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = iPad.storyboard; sourceTree = SOURCE_ROOT; };
|
||||
FB290E7A19B38036004C83CF /* iPhone.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = iPhone.storyboard; sourceTree = SOURCE_ROOT; };
|
||||
FB4678EB1A50C40900377732 /* OnScreenControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnScreenControls.h; sourceTree = "<group>"; };
|
||||
FB4678EC1A50C40900377732 /* OnScreenControls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnScreenControls.m; sourceTree = "<group>"; };
|
||||
FB4678F21A51BDCB00377732 /* Limelight 0.3.0.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Limelight 0.3.0.xcdatamodel"; sourceTree = "<group>"; };
|
||||
FB4678F81A55FFAD00377732 /* DiscoveryManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiscoveryManager.h; sourceTree = "<group>"; };
|
||||
FB4678F91A55FFAD00377732 /* DiscoveryManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DiscoveryManager.m; sourceTree = "<group>"; };
|
||||
FB4678FD1A565DAC00377732 /* WakeOnLanManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WakeOnLanManager.h; sourceTree = "<group>"; };
|
||||
FB4678FE1A565DAC00377732 /* WakeOnLanManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WakeOnLanManager.m; sourceTree = "<group>"; };
|
||||
FB4679001A57048000377732 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
||||
FB6549541A57907E001C8F39 /* DiscoveryWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiscoveryWorker.h; sourceTree = "<group>"; };
|
||||
FB6549551A57907E001C8F39 /* DiscoveryWorker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DiscoveryWorker.m; sourceTree = "<group>"; };
|
||||
FB7E794319C8B71B00A15F68 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; };
|
||||
FB89460519F646E200339C8A /* CryptoManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoManager.h; sourceTree = "<group>"; };
|
||||
FB89460619F646E200339C8A /* CryptoManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CryptoManager.m; sourceTree = "<group>"; };
|
||||
@@ -129,8 +143,6 @@
|
||||
FB89461B19F646E200339C8A /* StreamManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StreamManager.m; sourceTree = "<group>"; };
|
||||
FB89461C19F646E200339C8A /* VideoDecoderRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoDecoderRenderer.h; sourceTree = "<group>"; };
|
||||
FB89461D19F646E200339C8A /* VideoDecoderRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VideoDecoderRenderer.m; sourceTree = "<group>"; };
|
||||
FB89461F19F646E200339C8A /* Computer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Computer.h; sourceTree = "<group>"; };
|
||||
FB89462019F646E200339C8A /* Computer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Computer.m; sourceTree = "<group>"; };
|
||||
FB89462119F646E200339C8A /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
|
||||
FB89462219F646E200339C8A /* Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utils.m; sourceTree = "<group>"; };
|
||||
FB89462419F646E200339C8A /* MainFrameViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainFrameViewController.h; sourceTree = "<group>"; };
|
||||
@@ -258,6 +270,7 @@
|
||||
FB290CF819B2C406004C83CF /* CoreData.framework in Frameworks */,
|
||||
FB290CF619B2C406004C83CF /* UIKit.framework in Frameworks */,
|
||||
FB290CF219B2C406004C83CF /* Foundation.framework in Frameworks */,
|
||||
FB4679011A57048000377732 /* CoreFoundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -305,6 +318,7 @@
|
||||
FB290CF019B2C406004C83CF /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FB4679001A57048000377732 /* CoreFoundation.framework */,
|
||||
FBD349571A003F05002D2A60 /* libsqlite3.dylib */,
|
||||
FB89468F19F6AFB800339C8A /* libs */,
|
||||
FB7E794319C8B71B00A15F68 /* libiconv.dylib */,
|
||||
@@ -392,6 +406,8 @@
|
||||
FB89460B19F646E200339C8A /* ControllerSupport.m */,
|
||||
FB89460C19F646E200339C8A /* StreamView.h */,
|
||||
FB89460D19F646E200339C8A /* StreamView.m */,
|
||||
FB4678EB1A50C40900377732 /* OnScreenControls.h */,
|
||||
FB4678EC1A50C40900377732 /* OnScreenControls.m */,
|
||||
);
|
||||
path = Input;
|
||||
sourceTree = "<group>";
|
||||
@@ -407,6 +423,12 @@
|
||||
FB89461419F646E200339C8A /* PairManager.m */,
|
||||
FBD3494119FC9C04002D2A60 /* AppManager.h */,
|
||||
FBD3494219FC9C04002D2A60 /* AppManager.m */,
|
||||
FB4678FD1A565DAC00377732 /* WakeOnLanManager.h */,
|
||||
FB4678FE1A565DAC00377732 /* WakeOnLanManager.m */,
|
||||
FB4678F81A55FFAD00377732 /* DiscoveryManager.h */,
|
||||
FB4678F91A55FFAD00377732 /* DiscoveryManager.m */,
|
||||
FB6549541A57907E001C8F39 /* DiscoveryWorker.h */,
|
||||
FB6549551A57907E001C8F39 /* DiscoveryWorker.m */,
|
||||
);
|
||||
path = Network;
|
||||
sourceTree = "<group>";
|
||||
@@ -429,8 +451,6 @@
|
||||
FB89461E19F646E200339C8A /* Utility */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FB89461F19F646E200339C8A /* Computer.h */,
|
||||
FB89462019F646E200339C8A /* Computer.m */,
|
||||
FBDE86E719F82315001C18A8 /* App.h */,
|
||||
FBDE86E819F82315001C18A8 /* App.m */,
|
||||
FB89462119F646E200339C8A /* Utils.h */,
|
||||
@@ -752,8 +772,8 @@
|
||||
FB290D0419B2C406004C83CF /* AppDelegate.m in Sources */,
|
||||
FB89463419F646E200339C8A /* Utils.m in Sources */,
|
||||
FBDE86E619F82297001C18A8 /* UIAppView.m in Sources */,
|
||||
FB89463319F646E200339C8A /* Computer.m in Sources */,
|
||||
FB89462F19F646E200339C8A /* Connection.m in Sources */,
|
||||
FB4678FF1A565DAC00377732 /* WakeOnLanManager.m in Sources */,
|
||||
FB89462919F646E200339C8A /* mkcert.c in Sources */,
|
||||
FBDE86E019F7A837001C18A8 /* UIComputerView.m in Sources */,
|
||||
FBDE86E919F82315001C18A8 /* App.m in Sources */,
|
||||
@@ -763,13 +783,16 @@
|
||||
FB89462C19F646E200339C8A /* HttpManager.m in Sources */,
|
||||
FB89462D19F646E200339C8A /* MDNSManager.m in Sources */,
|
||||
FB89462B19F646E200339C8A /* StreamView.m in Sources */,
|
||||
FB4678FA1A55FFAD00377732 /* DiscoveryManager.m in Sources */,
|
||||
FBD3495B1A004411002D2A60 /* Host.m in Sources */,
|
||||
FB89463519F646E200339C8A /* MainFrameViewController.m in Sources */,
|
||||
FB89463619F646E200339C8A /* StreamFrameViewController.m in Sources */,
|
||||
FB89462819F646E200339C8A /* CryptoManager.m in Sources */,
|
||||
FB89462E19F646E200339C8A /* PairManager.m in Sources */,
|
||||
FB4678ED1A50C40900377732 /* OnScreenControls.m in Sources */,
|
||||
FB290D0019B2C406004C83CF /* main.m in Sources */,
|
||||
FBD3494319FC9C04002D2A60 /* AppManager.m in Sources */,
|
||||
FB6549561A57907E001C8F39 /* DiscoveryWorker.m in Sources */,
|
||||
FB89462A19F646E200339C8A /* ControllerSupport.m in Sources */,
|
||||
FBD349621A0089F6002D2A60 /* DataManager.m in Sources */,
|
||||
FB89463119F646E200339C8A /* StreamManager.m in Sources */,
|
||||
@@ -1026,9 +1049,10 @@
|
||||
FB290D0519B2C406004C83CF /* Limelight.xcdatamodeld */ = {
|
||||
isa = XCVersionGroup;
|
||||
children = (
|
||||
FB4678F21A51BDCB00377732 /* Limelight 0.3.0.xcdatamodel */,
|
||||
FB290D0619B2C406004C83CF /* Limelight.xcdatamodel */,
|
||||
);
|
||||
currentVersion = FB290D0619B2C406004C83CF /* Limelight.xcdatamodel */;
|
||||
currentVersion = FB4678F21A51BDCB00377732 /* Limelight 0.3.0.xcdatamodel */;
|
||||
path = Limelight.xcdatamodeld;
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
|
||||
@@ -13,5 +13,6 @@
|
||||
@property NSString* appId;
|
||||
@property NSString* appName;
|
||||
@property UIImage* appImage;
|
||||
@property BOOL isRunning;
|
||||
|
||||
@end
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
#import "HttpManager.h"
|
||||
|
||||
@implementation App
|
||||
@synthesize appId, appName, appImage;
|
||||
@synthesize appId, appName, appImage, isRunning;
|
||||
|
||||
@end
|
||||
|
||||
@@ -104,7 +104,10 @@ static NSOperationQueue* mainQueue;
|
||||
|
||||
NSError *error = nil;
|
||||
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
|
||||
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
|
||||
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
|
||||
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
|
||||
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error]) {
|
||||
/*
|
||||
Replace this implementation with code to handle the error appropriately.
|
||||
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
|
||||
@property (strong, nonatomic) AppDelegate* appDelegate;
|
||||
|
||||
- (void) saveSettingsWithBitrate:(NSInteger)bitrate framerate:(NSInteger)framerate height:(NSInteger)height width:(NSInteger)width;
|
||||
- (void) saveSettingsWithBitrate:(NSInteger)bitrate framerate:(NSInteger)framerate height:(NSInteger)height width:(NSInteger)width onscreenControls:(NSInteger)onscreenControls;
|
||||
- (Settings*) retrieveSettings;
|
||||
- (NSArray*) retrieveHosts;
|
||||
- (void) saveHosts;
|
||||
- (Host*) createHost:(NSString*)name hostname:(NSString*)address;
|
||||
- (Host*) createHost;
|
||||
- (void) removeHost:(Host*)host;
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
#import "DataManager.h"
|
||||
|
||||
@implementation DataManager
|
||||
static NSInteger DEFAULT_BITRATE = 10000;
|
||||
static NSInteger DEFAULT_FRAMERATE = 60;
|
||||
static NSInteger DEFAULT_HEIGHT = 720;
|
||||
static NSInteger DEFAULT_WIDTH = 1280;
|
||||
|
||||
- (id) init {
|
||||
self = [super init];
|
||||
@@ -20,12 +16,14 @@ static NSInteger DEFAULT_WIDTH = 1280;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) saveSettingsWithBitrate:(NSInteger)bitrate framerate:(NSInteger)framerate height:(NSInteger)height width:(NSInteger)width {
|
||||
- (void) saveSettingsWithBitrate:(NSInteger)bitrate framerate:(NSInteger)framerate height:(NSInteger)height width:(NSInteger)width onscreenControls:(NSInteger)onscreenControls {
|
||||
Settings* settingsToSave = [self retrieveSettings];
|
||||
settingsToSave.framerate = [NSNumber numberWithInteger:framerate];
|
||||
settingsToSave.bitrate = [NSNumber numberWithInteger:bitrate];
|
||||
settingsToSave.height = [NSNumber numberWithInteger:height];
|
||||
settingsToSave.width = [NSNumber numberWithInteger:width];
|
||||
settingsToSave.onscreenControls = [NSNumber numberWithInteger:onscreenControls];
|
||||
|
||||
NSError* error;
|
||||
if (![[self.appDelegate managedObjectContext] save:&error]) {
|
||||
NSLog(@"ERROR: Unable to save settings to database");
|
||||
@@ -40,10 +38,6 @@ static NSInteger DEFAULT_WIDTH = 1280;
|
||||
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Settings" inManagedObjectContext:[self.appDelegate managedObjectContext]];
|
||||
Settings* settings = [[Settings alloc] initWithEntity:entity insertIntoManagedObjectContext:[self.appDelegate managedObjectContext]];
|
||||
|
||||
settings.framerate = [NSNumber numberWithInteger:DEFAULT_FRAMERATE];
|
||||
settings.bitrate = [NSNumber numberWithInteger:DEFAULT_BITRATE];
|
||||
settings.height = [NSNumber numberWithInteger:DEFAULT_HEIGHT];
|
||||
settings.width = [NSNumber numberWithInteger:DEFAULT_WIDTH];
|
||||
return settings;
|
||||
} else {
|
||||
// we should only ever have 1 settings object stored
|
||||
@@ -51,15 +45,16 @@ static NSInteger DEFAULT_WIDTH = 1280;
|
||||
}
|
||||
}
|
||||
|
||||
- (Host*) createHost:(NSString*)name hostname:(NSString*)address {
|
||||
- (Host*) createHost {
|
||||
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Host" inManagedObjectContext:[self.appDelegate managedObjectContext]];
|
||||
Host* host = [[Host alloc] initWithEntity:entity insertIntoManagedObjectContext:[self.appDelegate managedObjectContext]];
|
||||
|
||||
host.name = name;
|
||||
host.address = address;
|
||||
return host;
|
||||
}
|
||||
|
||||
- (void) removeHost:(Host*)host {
|
||||
[[self.appDelegate managedObjectContext] deleteObject:host];
|
||||
}
|
||||
|
||||
- (void) saveHosts {
|
||||
NSError* error;
|
||||
if (![[self.appDelegate managedObjectContext] save:&error]) {
|
||||
|
||||
@@ -8,11 +8,17 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
#import "Utils.h"
|
||||
|
||||
@interface Host : NSManagedObject
|
||||
|
||||
@property (nonatomic, retain) NSString * address;
|
||||
@property (nonatomic, retain) NSString * name;
|
||||
@property (nonatomic, retain) NSString * address;
|
||||
@property (nonatomic, retain) NSString * localAddress;
|
||||
@property (nonatomic, retain) NSString * externalAddress;
|
||||
@property (nonatomic, retain) NSString * uuid;
|
||||
@property (nonatomic, retain) NSString * mac;
|
||||
@property (nonatomic) BOOL online;
|
||||
@property (nonatomic) PairState pairState;
|
||||
|
||||
@end
|
||||
|
||||
@@ -11,7 +11,13 @@
|
||||
|
||||
@implementation Host
|
||||
|
||||
@dynamic address;
|
||||
@dynamic name;
|
||||
@dynamic address;
|
||||
@dynamic localAddress;
|
||||
@dynamic externalAddress;
|
||||
@dynamic uuid;
|
||||
@dynamic mac;
|
||||
@dynamic pairState;
|
||||
@synthesize online;
|
||||
|
||||
@end
|
||||
|
||||
@@ -16,5 +16,6 @@
|
||||
@property (nonatomic, retain) NSNumber * framerate;
|
||||
@property (nonatomic, retain) NSNumber * height;
|
||||
@property (nonatomic, retain) NSNumber * width;
|
||||
@property (nonatomic, retain) NSNumber * onscreenControls;
|
||||
|
||||
@end
|
||||
|
||||
@@ -15,5 +15,6 @@
|
||||
@dynamic framerate;
|
||||
@dynamic height;
|
||||
@dynamic width;
|
||||
@dynamic onscreenControls;
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "limelight_computer_add_1x.png"
|
||||
"filename" : "a_button.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "limelight_computer_add_2x.png"
|
||||
"filename" : "a_button-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "limelight_computer_add_3x.png"
|
||||
"filename" : "a_button-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 25 KiB |
@@ -2,7 +2,8 @@
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
"scale" : "1x",
|
||||
"filename" : "limelight_computer_add_icon_1x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
@@ -11,7 +12,8 @@
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
"scale" : "3x",
|
||||
"filename" : "limelight_computer_add_icon_3x.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "b_button.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "b_button-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "b_button-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "down.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "down-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "down-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 455 B |
|
After Width: | Height: | Size: 455 B |
|
After Width: | Height: | Size: 455 B |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "L1-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "L1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "L1-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "L2.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "L2-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "L2-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "left.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "left-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "left-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 525 B |
|
After Width: | Height: | Size: 525 B |
|
After Width: | Height: | Size: 525 B |
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Limelight-logo.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
"scale" : "1x",
|
||||
"filename" : "limelight_no_app_image_1x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
@@ -11,7 +12,8 @@
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
"scale" : "3x",
|
||||
"filename" : "limelight_no_app_image_3x.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "R1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "R1-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "R1-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "R2-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "R2.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "R2-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "right.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "right-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "right-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 549 B |
|
After Width: | Height: | Size: 549 B |
|
After Width: | Height: | Size: 549 B |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "select_button-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "select_button.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "select_button-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 735 B |
|
After Width: | Height: | Size: 735 B |
|
After Width: | Height: | Size: 735 B |
@@ -2,7 +2,8 @@
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
"scale" : "1x",
|
||||
"filename" : "settings_1x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
@@ -11,7 +12,8 @@
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
"scale" : "3x",
|
||||
"filename" : "settings_3x.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "start_button-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "start_button.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "start_button-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 774 B |
|
After Width: | Height: | Size: 774 B |
|
After Width: | Height: | Size: 774 B |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "stick_inner-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "stick_inner.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "stick_inner-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "stick_outer-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "stick_outer.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "stick_outer-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "up-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "up.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "up-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 452 B |
|
After Width: | Height: | Size: 452 B |
|
After Width: | Height: | Size: 452 B |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "x_button-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "x_button.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "x_button-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "y_button.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "y_button-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "y_button-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 969 B |
|
After Width: | Height: | Size: 969 B |
|
After Width: | Height: | Size: 969 B |
@@ -25,7 +25,7 @@ static NSLock *controllerStreamLock;
|
||||
GCController *controller = [GCController controllers][i];
|
||||
|
||||
if (controller != NULL) {
|
||||
printf("Controller connected!\n");
|
||||
NSLog(@"Controller connected!");
|
||||
controller.controllerPausedHandler = ^(GCController *controller) {
|
||||
// We call LiSendControllerEvent while holding a lock to prevent
|
||||
// multiple simultaneous calls since this function isn't thread safe.
|
||||
@@ -117,7 +117,7 @@ static NSLock *controllerStreamLock;
|
||||
[ControllerSupport registerControllerCallbacks];
|
||||
}];
|
||||
self.disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidDisconnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
printf("Controller disconnected!\n");
|
||||
NSLog(@"Controller disconnected!");
|
||||
}];
|
||||
|
||||
[ControllerSupport registerControllerCallbacks];
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// OnScreenControls.h
|
||||
// Limelight
|
||||
//
|
||||
// Created by Diego Waxemberg on 12/28/14.
|
||||
// Copyright (c) 2014 Limelight Stream. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface OnScreenControls : NSObject
|
||||
|
||||
typedef NS_ENUM(NSInteger, OnScreenControlsLevel) {
|
||||
OnScreenControlsLevelOff,
|
||||
OnScreenControlsLevelSimple,
|
||||
OnScreenControlsLevelFull
|
||||
};
|
||||
|
||||
- (id) initWithView:(UIView*)view;
|
||||
- (BOOL) handleTouchDownEvent:(UIEvent*)event;
|
||||
- (BOOL) handleTouchUpEvent:(UIEvent*) event;
|
||||
- (BOOL) handleTouchMovedEvent:(UIEvent*)event;
|
||||
- (void) setLevel:(OnScreenControlsLevel)level;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,561 @@
|
||||
//
|
||||
// OnScreenControls.m
|
||||
// Limelight
|
||||
//
|
||||
// Created by Diego Waxemberg on 12/28/14.
|
||||
// Copyright (c) 2014 Limelight Stream. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OnScreenControls.h"
|
||||
#include "Limelight.h"
|
||||
|
||||
#define UPDATE_BUTTON(x, y) (buttonFlags = \
|
||||
(y) ? (buttonFlags | (x)) : (buttonFlags & ~(x)))
|
||||
|
||||
@implementation OnScreenControls {
|
||||
CALayer* _aButton;
|
||||
CALayer* _bButton;
|
||||
CALayer* _xButton;
|
||||
CALayer* _yButton;
|
||||
CALayer* _upButton;
|
||||
CALayer* _downButton;
|
||||
CALayer* _leftButton;
|
||||
CALayer* _rightButton;
|
||||
CALayer* _leftStickBackground;
|
||||
CALayer* _leftStick;
|
||||
CALayer* _rightStickBackground;
|
||||
CALayer* _rightStick;
|
||||
CALayer* _startButton;
|
||||
CALayer* _selectButton;
|
||||
CALayer* _r1Button;
|
||||
CALayer* _r2Button;
|
||||
CALayer* _l1Button;
|
||||
CALayer* _l2Button;
|
||||
|
||||
short buttonFlags;
|
||||
short leftStickX, leftStickY;
|
||||
short rightStickX, rightStickY;
|
||||
char leftTrigger, rightTrigger;
|
||||
|
||||
UITouch* _aTouch;
|
||||
UITouch* _bTouch;
|
||||
UITouch* _xTouch;
|
||||
UITouch* _yTouch;
|
||||
UITouch* _upTouch;
|
||||
UITouch* _downTouch;
|
||||
UITouch* _leftTouch;
|
||||
UITouch* _rightTouch;
|
||||
UITouch* _lsTouch;
|
||||
UITouch* _rsTouch;
|
||||
UITouch* _startTouch;
|
||||
UITouch* _selectTouch;
|
||||
UITouch* _r1Touch;
|
||||
UITouch* _r2Touch;
|
||||
UITouch* _l1Touch;
|
||||
UITouch* _l2Touch;
|
||||
|
||||
UIView* _view;
|
||||
OnScreenControlsLevel _level;
|
||||
}
|
||||
|
||||
static const float BUTTON_SIZE = 50;
|
||||
static const float BUTTON_DIST = 20;
|
||||
static float BUTTON_CENTER_X;
|
||||
static float BUTTON_CENTER_Y;
|
||||
|
||||
static const float D_PAD_SHORT = 50;
|
||||
static const float D_PAD_LONG = 65;
|
||||
static const float D_PAD_DIST = 15;
|
||||
static float D_PAD_CENTER_X;
|
||||
static float D_PAD_CENTER_Y;
|
||||
|
||||
static const float STICK_INNER_SIZE = 80;
|
||||
static const float STICK_OUTER_SIZE = 120;
|
||||
static const float STICK_DEAD_ZONE = .1;
|
||||
static float LS_CENTER_X;
|
||||
static float LS_CENTER_Y;
|
||||
static float RS_CENTER_X;
|
||||
static float RS_CENTER_Y;
|
||||
|
||||
static const float START_WIDTH = 50;
|
||||
static const float START_HEIGHT = 30;
|
||||
static float START_X;
|
||||
static float START_Y;
|
||||
|
||||
static const float SELECT_WIDTH = 50;
|
||||
static const float SELECT_HEIGHT = 30;
|
||||
static float SELECT_X;
|
||||
static float SELECT_Y;
|
||||
|
||||
static const float BUMPER_SIZE = 70;
|
||||
static const float TRIGGER_SIZE = 80;
|
||||
|
||||
static float R1_X;
|
||||
static float R1_Y;
|
||||
static float R2_X;
|
||||
static float R2_Y;
|
||||
static float L1_X;
|
||||
static float L1_Y;
|
||||
static float L2_X;
|
||||
static float L2_Y;
|
||||
|
||||
- (id) initWithView:(UIView*)view {
|
||||
self = [self init];
|
||||
_view = view;
|
||||
|
||||
D_PAD_CENTER_X = _view.frame.size.width * .15;
|
||||
D_PAD_CENTER_Y = _view.frame.size.height * .55;
|
||||
BUTTON_CENTER_X = _view.frame.size.width * .85;
|
||||
BUTTON_CENTER_Y = _view.frame.size.height * .55;
|
||||
|
||||
LS_CENTER_X = _view.frame.size.width * .35;
|
||||
LS_CENTER_Y = _view.frame.size.height * .75;
|
||||
RS_CENTER_X = _view.frame.size.width * .65;
|
||||
RS_CENTER_Y = _view.frame.size.height * .75;
|
||||
|
||||
START_X = _view.frame.size.width * .55;
|
||||
START_Y = _view.frame.size.height * .1;
|
||||
SELECT_X = _view.frame.size.width * .45;
|
||||
SELECT_Y = _view.frame.size.height * .1;
|
||||
|
||||
L1_X = _view.frame.size.width * .15;
|
||||
L1_Y = _view.frame.size.height * .25;
|
||||
L2_X = _view.frame.size.width * .15;
|
||||
L2_Y = _view.frame.size.height * .1;
|
||||
R1_X = _view.frame.size.width * .85;
|
||||
R1_Y = _view.frame.size.height * .25;
|
||||
R2_X = _view.frame.size.width * .85;
|
||||
R2_Y = _view.frame.size.height * .1;
|
||||
|
||||
_aButton = [CALayer layer];
|
||||
_bButton = [CALayer layer];
|
||||
_xButton = [CALayer layer];
|
||||
_yButton = [CALayer layer];
|
||||
_upButton = [CALayer layer];
|
||||
_downButton = [CALayer layer];
|
||||
_leftButton = [CALayer layer];
|
||||
_rightButton = [CALayer layer];
|
||||
_l1Button = [CALayer layer];
|
||||
_r1Button = [CALayer layer];
|
||||
_l2Button = [CALayer layer];
|
||||
_r2Button = [CALayer layer];
|
||||
_startButton = [CALayer layer];
|
||||
_selectButton = [CALayer layer];
|
||||
_leftStickBackground = [CALayer layer];
|
||||
_rightStickBackground = [CALayer layer];
|
||||
_leftStick = [CALayer layer];
|
||||
_rightStick = [CALayer layer];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) setLevel:(OnScreenControlsLevel)level {
|
||||
_level = level;
|
||||
[self updateControls];
|
||||
}
|
||||
|
||||
- (void) updateControls {
|
||||
switch (_level) {
|
||||
case OnScreenControlsLevelOff:
|
||||
[self hideButtons];
|
||||
[self hideBumpers];
|
||||
[self hideTriggers];
|
||||
[self hideStartSelect];
|
||||
[self hideSticks];
|
||||
break;
|
||||
case OnScreenControlsLevelSimple:
|
||||
[self drawTriggers];
|
||||
[self drawStartSelect];
|
||||
[self hideButtons];
|
||||
[self hideBumpers];
|
||||
[self hideSticks];
|
||||
break;
|
||||
case OnScreenControlsLevelFull:
|
||||
[self drawButtons];
|
||||
[self drawStartSelect];
|
||||
[self drawBumpers];
|
||||
[self drawTriggers];
|
||||
[self drawSticks];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) drawButtons {
|
||||
// create A button
|
||||
_aButton.contents = (id) [UIImage imageNamed:@"AButton"].CGImage;
|
||||
_aButton.frame = CGRectMake(BUTTON_CENTER_X - BUTTON_SIZE / 2, BUTTON_CENTER_Y + BUTTON_DIST, BUTTON_SIZE, BUTTON_SIZE);
|
||||
[_view.layer addSublayer:_aButton];
|
||||
|
||||
// create B button
|
||||
_bButton.frame = CGRectMake(BUTTON_CENTER_X + BUTTON_DIST, BUTTON_CENTER_Y - BUTTON_SIZE / 2, BUTTON_SIZE, BUTTON_SIZE);
|
||||
_bButton.contents = (id) [UIImage imageNamed:@"BButton"].CGImage;
|
||||
[_view.layer addSublayer:_bButton];
|
||||
|
||||
// create X Button
|
||||
_xButton.frame = CGRectMake(BUTTON_CENTER_X - BUTTON_DIST - BUTTON_SIZE, BUTTON_CENTER_Y - BUTTON_SIZE / 2, BUTTON_SIZE, BUTTON_SIZE);
|
||||
_xButton.contents = (id) [UIImage imageNamed:@"XButton"].CGImage;
|
||||
[_view.layer addSublayer:_xButton];
|
||||
|
||||
// create Y Button
|
||||
_yButton.frame = CGRectMake(BUTTON_CENTER_X - BUTTON_SIZE / 2, BUTTON_CENTER_Y - BUTTON_DIST - BUTTON_SIZE, BUTTON_SIZE, BUTTON_SIZE);
|
||||
_yButton.contents = (id) [UIImage imageNamed:@"YButton"].CGImage;
|
||||
[_view.layer addSublayer:_yButton];
|
||||
|
||||
// create Down button
|
||||
_downButton.frame = CGRectMake(D_PAD_CENTER_X - D_PAD_SHORT / 2, D_PAD_CENTER_Y + D_PAD_DIST, D_PAD_SHORT, D_PAD_LONG);
|
||||
_downButton.contents = (id) [UIImage imageNamed:@"DownButton"].CGImage;
|
||||
[_view.layer addSublayer:_downButton];
|
||||
|
||||
// create Right button
|
||||
_rightButton.frame = CGRectMake(D_PAD_CENTER_X + D_PAD_DIST, D_PAD_CENTER_Y - D_PAD_SHORT / 2, D_PAD_LONG, D_PAD_SHORT);
|
||||
_rightButton.contents = (id) [UIImage imageNamed:@"RightButton"].CGImage;
|
||||
[_view.layer addSublayer:_rightButton];
|
||||
|
||||
// create Up button
|
||||
_upButton.frame = CGRectMake(D_PAD_CENTER_X - D_PAD_SHORT / 2, D_PAD_CENTER_Y - D_PAD_DIST - D_PAD_LONG, D_PAD_SHORT, D_PAD_LONG);
|
||||
_upButton.contents = (id) [UIImage imageNamed:@"UpButton"].CGImage;
|
||||
[_view.layer addSublayer:_upButton];
|
||||
|
||||
// create Left button
|
||||
_leftButton.frame = CGRectMake(D_PAD_CENTER_X - D_PAD_DIST - D_PAD_LONG, D_PAD_CENTER_Y - D_PAD_SHORT / 2, D_PAD_LONG, D_PAD_SHORT);
|
||||
_leftButton.contents = (id) [UIImage imageNamed:@"LeftButton"].CGImage;
|
||||
[_view.layer addSublayer:_leftButton];
|
||||
}
|
||||
|
||||
- (void) drawStartSelect {
|
||||
// create Start button
|
||||
_startButton.frame = CGRectMake(START_X - START_WIDTH / 2, START_Y - START_HEIGHT / 2, START_WIDTH, START_HEIGHT);
|
||||
_startButton.contents = (id) [UIImage imageNamed:@"StartButton"].CGImage;
|
||||
[_view.layer addSublayer:_startButton];
|
||||
|
||||
// create Select button
|
||||
_selectButton.frame = CGRectMake(SELECT_X - SELECT_WIDTH / 2, SELECT_Y - SELECT_HEIGHT / 2, SELECT_WIDTH, SELECT_HEIGHT);
|
||||
_selectButton.contents = (id) [UIImage imageNamed:@"SelectButton"].CGImage;
|
||||
[_view.layer addSublayer:_selectButton];
|
||||
}
|
||||
|
||||
- (void) drawBumpers {
|
||||
// create L1 button
|
||||
_l1Button.frame = CGRectMake(L1_X - BUMPER_SIZE / 2, L1_Y - BUMPER_SIZE / 2, BUMPER_SIZE, BUMPER_SIZE);
|
||||
_l1Button.contents = (id) [UIImage imageNamed:@"L1"].CGImage;
|
||||
[_view.layer addSublayer:_l1Button];
|
||||
|
||||
// create R1 button
|
||||
_r1Button.frame = CGRectMake(R1_X - BUMPER_SIZE / 2, R1_Y - BUMPER_SIZE / 2, BUMPER_SIZE, BUMPER_SIZE);
|
||||
_r1Button.contents = (id) [UIImage imageNamed:@"R1"].CGImage;
|
||||
[_view.layer addSublayer:_r1Button];
|
||||
}
|
||||
|
||||
- (void) drawTriggers {
|
||||
// create L2 button
|
||||
_l2Button.frame = CGRectMake(L2_X - TRIGGER_SIZE / 2, L2_Y - TRIGGER_SIZE / 2, TRIGGER_SIZE, TRIGGER_SIZE);
|
||||
_l2Button.contents = (id) [UIImage imageNamed:@"L2"].CGImage;
|
||||
[_view.layer addSublayer:_l2Button];
|
||||
|
||||
// create R2 button
|
||||
_r2Button.frame = CGRectMake(R2_X - TRIGGER_SIZE / 2, R2_Y - TRIGGER_SIZE / 2, TRIGGER_SIZE, TRIGGER_SIZE);
|
||||
_r2Button.contents = (id) [UIImage imageNamed:@"R2"].CGImage;
|
||||
[_view.layer addSublayer:_r2Button];
|
||||
}
|
||||
|
||||
- (void) drawSticks {
|
||||
// create left analog stick
|
||||
_leftStickBackground.frame = CGRectMake(LS_CENTER_X - STICK_OUTER_SIZE / 2, LS_CENTER_Y - STICK_OUTER_SIZE / 2, STICK_OUTER_SIZE, STICK_OUTER_SIZE);
|
||||
_leftStickBackground.contents = (id) [UIImage imageNamed:@"StickOuter"].CGImage;
|
||||
[_view.layer addSublayer:_leftStickBackground];
|
||||
|
||||
_leftStick = [CALayer layer];
|
||||
_leftStick.frame = CGRectMake(LS_CENTER_X - STICK_INNER_SIZE / 2, LS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||
_leftStick.contents = (id) [UIImage imageNamed:@"StickInner"].CGImage;
|
||||
[_view.layer addSublayer:_leftStick];
|
||||
|
||||
// create right analog stick
|
||||
_rightStickBackground.frame = CGRectMake(RS_CENTER_X - STICK_OUTER_SIZE / 2, RS_CENTER_Y - STICK_OUTER_SIZE / 2, STICK_OUTER_SIZE, STICK_OUTER_SIZE);
|
||||
_rightStickBackground.contents = (id) [UIImage imageNamed:@"StickOuter"].CGImage;
|
||||
[_view.layer addSublayer:_rightStickBackground];
|
||||
|
||||
_rightStick = [CALayer layer];
|
||||
_rightStick.frame = CGRectMake(RS_CENTER_X - STICK_INNER_SIZE / 2, RS_CENTER_Y - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||
_rightStick.contents = (id) [UIImage imageNamed:@"StickInner"].CGImage;
|
||||
[_view.layer addSublayer:_rightStick];
|
||||
}
|
||||
|
||||
- (void) hideButtons {
|
||||
[_aButton removeFromSuperlayer];
|
||||
[_bButton removeFromSuperlayer];
|
||||
[_xButton removeFromSuperlayer];
|
||||
[_yButton removeFromSuperlayer];
|
||||
[_upButton removeFromSuperlayer];
|
||||
[_downButton removeFromSuperlayer];
|
||||
[_leftButton removeFromSuperlayer];
|
||||
[_rightButton removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (void) hideStartSelect {
|
||||
[_startButton removeFromSuperlayer];
|
||||
[_selectButton removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (void) hideBumpers {
|
||||
[_l1Button removeFromSuperlayer];
|
||||
[_r1Button removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (void) hideTriggers {
|
||||
[_l2Button removeFromSuperlayer];
|
||||
[_r2Button removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (void) hideSticks {
|
||||
[_leftStickBackground removeFromSuperlayer];
|
||||
[_rightStickBackground removeFromSuperlayer];
|
||||
[_leftStick removeFromSuperlayer];
|
||||
[_rightStick removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (BOOL) handleTouchMovedEvent:(UIEvent*)event {
|
||||
BOOL shouldSendPacket = false;
|
||||
BOOL buttonTouch = false;
|
||||
float rsMaxX = RS_CENTER_X + STICK_OUTER_SIZE / 2;
|
||||
float rsMaxY = RS_CENTER_Y + STICK_OUTER_SIZE / 2;
|
||||
float rsMinX = RS_CENTER_X - STICK_OUTER_SIZE / 2;
|
||||
float rsMinY = RS_CENTER_Y - STICK_OUTER_SIZE / 2;
|
||||
float lsMaxX = LS_CENTER_X + STICK_OUTER_SIZE / 2;
|
||||
float lsMaxY = LS_CENTER_Y + STICK_OUTER_SIZE / 2;
|
||||
float lsMinX = LS_CENTER_X - STICK_OUTER_SIZE / 2;
|
||||
float lsMinY = LS_CENTER_Y - STICK_OUTER_SIZE / 2;
|
||||
|
||||
for (UITouch* touch in [event allTouches]) {
|
||||
CGPoint touchLocation = [touch locationInView:_view];
|
||||
float xLoc = touchLocation.x;
|
||||
float yLoc = touchLocation.y;
|
||||
if (touch == _lsTouch) {
|
||||
if (xLoc > lsMaxX) xLoc = lsMaxX;
|
||||
if (xLoc < lsMinX) xLoc = lsMinX;
|
||||
if (yLoc > lsMaxY) yLoc = lsMaxY;
|
||||
if (yLoc < lsMinY) yLoc = lsMinY;
|
||||
|
||||
_leftStick.frame = CGRectMake(xLoc - STICK_INNER_SIZE / 2, yLoc - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||
|
||||
float xStickVal = (xLoc - LS_CENTER_X) / (lsMaxX - LS_CENTER_X);
|
||||
float yStickVal = (yLoc - LS_CENTER_Y) / (lsMaxY - LS_CENTER_Y);
|
||||
|
||||
if (fabsf(xStickVal) < STICK_DEAD_ZONE) xStickVal = 0;
|
||||
if (fabsf(yStickVal) < STICK_DEAD_ZONE) yStickVal = 0;
|
||||
|
||||
leftStickX = 0x7FFE * xStickVal;
|
||||
leftStickY = 0x7FFE * -yStickVal;
|
||||
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _rsTouch) {
|
||||
if (xLoc > rsMaxX) xLoc = rsMaxX;
|
||||
if (xLoc < rsMinX) xLoc = rsMinX;
|
||||
if (yLoc > rsMaxY) yLoc = rsMaxY;
|
||||
if (yLoc < rsMinY) yLoc = rsMinY;
|
||||
|
||||
_rightStick.frame = CGRectMake(xLoc - STICK_INNER_SIZE / 2, yLoc - STICK_INNER_SIZE / 2, STICK_INNER_SIZE, STICK_INNER_SIZE);
|
||||
|
||||
float xStickVal = (xLoc - RS_CENTER_X) / (rsMaxX - RS_CENTER_X);
|
||||
float yStickVal = (yLoc - RS_CENTER_Y) / (rsMaxY - RS_CENTER_Y);
|
||||
|
||||
if (fabsf(xStickVal) < STICK_DEAD_ZONE) xStickVal = 0;
|
||||
if (fabsf(yStickVal) < STICK_DEAD_ZONE) yStickVal = 0;
|
||||
|
||||
rightStickX = 0x7FFE * xStickVal;
|
||||
rightStickY = 0x7FFE * -yStickVal;
|
||||
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _aTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _bTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _xTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _yTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _upTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _downTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _leftTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _rightTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _startTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _selectTouch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _l1Touch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _r1Touch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _l2Touch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _r2Touch) {
|
||||
buttonTouch = true;
|
||||
}
|
||||
}
|
||||
if (shouldSendPacket) {
|
||||
LiSendControllerEvent(buttonFlags, leftTrigger, rightTrigger,
|
||||
leftStickX, leftStickY, rightStickX, rightStickY);
|
||||
}
|
||||
return shouldSendPacket || buttonTouch;
|
||||
}
|
||||
|
||||
- (BOOL)handleTouchDownEvent:(UIEvent*)event {
|
||||
BOOL shouldSendPacket = false;
|
||||
for (UITouch* touch in [event allTouches]) {
|
||||
CGPoint touchLocation = [touch locationInView:_view];
|
||||
|
||||
if ([_aButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(A_FLAG, 1);
|
||||
_aTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_bButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(B_FLAG, 1);
|
||||
_bTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_xButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(X_FLAG, 1);
|
||||
_xTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_yButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(Y_FLAG, 1);
|
||||
_yTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_upButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(UP_FLAG, 1);
|
||||
_upTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_downButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(DOWN_FLAG, 1);
|
||||
_downTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_leftButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(LEFT_FLAG, 1);
|
||||
_leftTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_rightButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(RIGHT_FLAG, 1);
|
||||
_rightTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_startButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(PLAY_FLAG, 1);
|
||||
_startTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_selectButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(BACK_FLAG, 1);
|
||||
_selectTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_l1Button.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(LB_FLAG, 1);
|
||||
_l1Touch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_r1Button.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(RB_FLAG, 1);
|
||||
_r1Touch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_l2Button.presentationLayer hitTest:touchLocation]) {
|
||||
leftTrigger = 1 * 0xFF;
|
||||
_l2Touch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_r2Button.presentationLayer hitTest:touchLocation]) {
|
||||
rightTrigger = 1 * 0xFF;
|
||||
_r2Touch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_leftStick.presentationLayer hitTest:touchLocation]) {
|
||||
_lsTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
} else if ([_rightStick.presentationLayer hitTest:touchLocation]) {
|
||||
_rsTouch = touch;
|
||||
shouldSendPacket = true;
|
||||
}
|
||||
}
|
||||
if (shouldSendPacket) {
|
||||
LiSendControllerEvent(buttonFlags, leftTrigger, rightTrigger,
|
||||
leftStickX, leftStickY, rightStickX, rightStickY);
|
||||
}
|
||||
return shouldSendPacket;
|
||||
}
|
||||
|
||||
- (BOOL)handleTouchUpEvent:(UIEvent*)event {
|
||||
BOOL shouldSendPacket = false;
|
||||
for (UITouch* touch in [event allTouches]) {
|
||||
if (touch == _aTouch) {
|
||||
UPDATE_BUTTON(A_FLAG, 0);
|
||||
_aTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _bTouch) {
|
||||
UPDATE_BUTTON(B_FLAG, 0);
|
||||
_bTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _xTouch) {
|
||||
UPDATE_BUTTON(X_FLAG, 0);
|
||||
_xTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _yTouch) {
|
||||
UPDATE_BUTTON(Y_FLAG, 0);
|
||||
_yTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _upTouch) {
|
||||
UPDATE_BUTTON(UP_FLAG, 0);
|
||||
_upTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _downTouch) {
|
||||
UPDATE_BUTTON(DOWN_FLAG, 0);
|
||||
_downTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _leftTouch) {
|
||||
UPDATE_BUTTON(LEFT_FLAG, 0);
|
||||
_leftTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _rightTouch) {
|
||||
UPDATE_BUTTON(RIGHT_FLAG, 0);
|
||||
_rightTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _startTouch) {
|
||||
UPDATE_BUTTON(PLAY_FLAG, 0);
|
||||
_startTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _selectTouch) {
|
||||
UPDATE_BUTTON(BACK_FLAG, 0);
|
||||
_selectTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _l1Touch) {
|
||||
UPDATE_BUTTON(LB_FLAG, 0);
|
||||
_l1Touch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _r1Touch) {
|
||||
UPDATE_BUTTON(RB_FLAG, 0);
|
||||
_r1Touch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _l2Touch) {
|
||||
leftTrigger = 0 * 0xFF;
|
||||
_l2Touch = nil;
|
||||
shouldSendPacket = true;
|
||||
} else if (touch == _r2Touch) {
|
||||
rightTrigger = 0 * 0xFF;
|
||||
_r2Touch = nil;
|
||||
shouldSendPacket = true;
|
||||
} 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);
|
||||
leftStickX = 0 * 0x7FFE;
|
||||
leftStickY = 0 * 0x7FFE;
|
||||
shouldSendPacket = true;
|
||||
_lsTouch = nil;
|
||||
} 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);
|
||||
rightStickX = 0 * 0x7FFE;
|
||||
rightStickY = 0 * 0x7FFE;
|
||||
_rsTouch = nil;
|
||||
shouldSendPacket = true;
|
||||
}
|
||||
}
|
||||
if (shouldSendPacket) {
|
||||
LiSendControllerEvent(buttonFlags, leftTrigger, rightTrigger,
|
||||
leftStickX, leftStickY, rightStickX, rightStickY);
|
||||
}
|
||||
return shouldSendPacket;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -10,4 +10,6 @@
|
||||
|
||||
@interface StreamView : UIView
|
||||
|
||||
- (void) setupOnScreenControls;
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,47 +8,88 @@
|
||||
|
||||
#import "StreamView.h"
|
||||
#include <Limelight.h>
|
||||
#import "OnScreenControls.h"
|
||||
#import "DataManager.h"
|
||||
|
||||
@implementation StreamView {
|
||||
CGPoint touchLocation;
|
||||
BOOL touchMoved;
|
||||
OnScreenControls* onScreenControls;
|
||||
}
|
||||
|
||||
- (void) setupOnScreenControls {
|
||||
onScreenControls = [[OnScreenControls alloc] initWithView:self];
|
||||
DataManager* dataMan = [[DataManager alloc] init];
|
||||
OnScreenControlsLevel level = (OnScreenControlsLevel)[[dataMan retrieveSettings].onscreenControls integerValue];
|
||||
NSLog(@"Setting on-screen controls level: %d", (int)level);
|
||||
[onScreenControls setLevel:level];
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
touchLocation = [touch locationInView:self];
|
||||
touchMoved = false;
|
||||
|
||||
printf("Touch down\n");
|
||||
}
|
||||
|
||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
CGPoint currentLocation = [touch locationInView:self];
|
||||
|
||||
if (touchLocation.x != currentLocation.x ||
|
||||
touchLocation.y != currentLocation.y)
|
||||
{
|
||||
LiSendMouseMoveEvent(currentLocation.x - touchLocation.x,
|
||||
currentLocation.y - touchLocation.y );
|
||||
|
||||
touchMoved = true;
|
||||
touchLocation = currentLocation;
|
||||
NSLog(@"Touch down");
|
||||
if (![onScreenControls handleTouchDownEvent:event]) {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
touchLocation = [touch locationInView:self];
|
||||
touchMoved = false;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
printf("Touch up\n");
|
||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
if (![onScreenControls handleTouchMovedEvent:event]) {
|
||||
if ([[event allTouches] count] == 1) {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
CGPoint currentLocation = [touch locationInView:self];
|
||||
|
||||
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;
|
||||
touchLocation = avgLocation;
|
||||
}
|
||||
}
|
||||
|
||||
if (!touchMoved) {
|
||||
printf("Sending left mouse button press\n");
|
||||
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
||||
|
||||
// Wait 100 ms to simulate a real button press
|
||||
usleep(100 * 1000);
|
||||
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||
}
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
NSLog(@"Touch up");
|
||||
if (![onScreenControls handleTouchUpEvent:event]) {
|
||||
if (!touchMoved) {
|
||||
if ([[event allTouches] count] == 2) {
|
||||
NSLog(@"Sending right mouse button press");
|
||||
|
||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
||||
|
||||
// Wait 100 ms to simulate a real button press
|
||||
usleep(100 * 1000);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.1.0</string>
|
||||
<string>0.3.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>9</string>
|
||||
<string>1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>_XCCurrentVersionName</key>
|
||||
<string>Limelight.xcdatamodel</string>
|
||||
<string>Limelight 0.3.0.xcdatamodel</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||