Merge branch 'master' of github.com:limelight-stream/limelight-ios
@ -384,15 +384,15 @@
|
||||
FB290CFA19B2C406004C83CF /* Supporting Files */,
|
||||
FB290D0219B2C406004C83CF /* AppDelegate.h */,
|
||||
FB290D0319B2C406004C83CF /* AppDelegate.m */,
|
||||
FBDE86DE19F7A837001C18A8 /* UIComputerView.h */,
|
||||
FBDE86DF19F7A837001C18A8 /* UIComputerView.m */,
|
||||
FBDE86E419F82297001C18A8 /* UIAppView.h */,
|
||||
FBDE86E519F82297001C18A8 /* UIAppView.m */,
|
||||
FB290E7819B37D81004C83CF /* iPad.storyboard */,
|
||||
FB290E7A19B38036004C83CF /* iPhone.storyboard */,
|
||||
FB89463719F6473800339C8A /* Launch Screen.xib */,
|
||||
FB290D0819B2C406004C83CF /* Images.xcassets */,
|
||||
FB290D0519B2C406004C83CF /* Limelight.xcdatamodeld */,
|
||||
FBDE86DE19F7A837001C18A8 /* UIComputerView.h */,
|
||||
FBDE86DF19F7A837001C18A8 /* UIComputerView.m */,
|
||||
FBDE86E419F82297001C18A8 /* UIAppView.h */,
|
||||
FBDE86E519F82297001C18A8 /* UIAppView.m */,
|
||||
);
|
||||
path = Limelight;
|
||||
sourceTree = "<group>";
|
||||
|
BIN
Limelight/Images.xcassets/L1.imageset/L1-1.png
vendored
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 50 KiB |
BIN
Limelight/Images.xcassets/L1.imageset/L1-2.png
vendored
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 50 KiB |
BIN
Limelight/Images.xcassets/L1.imageset/L1.png
vendored
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 50 KiB |
BIN
Limelight/Images.xcassets/L2.imageset/L2-1.png
vendored
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 60 KiB |
BIN
Limelight/Images.xcassets/L2.imageset/L2-2.png
vendored
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 60 KiB |
BIN
Limelight/Images.xcassets/L2.imageset/L2.png
vendored
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 60 KiB |
23
Limelight/Images.xcassets/L3.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "L3.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "L3-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "L3-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/L3.imageset/L3-1.png
vendored
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
Limelight/Images.xcassets/L3.imageset/L3-2.png
vendored
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
Limelight/Images.xcassets/L3.imageset/L3.png
vendored
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
Limelight/Images.xcassets/R1.imageset/R1-1.png
vendored
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 60 KiB |
BIN
Limelight/Images.xcassets/R1.imageset/R1-2.png
vendored
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 60 KiB |
BIN
Limelight/Images.xcassets/R1.imageset/R1.png
vendored
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 60 KiB |
BIN
Limelight/Images.xcassets/R2.imageset/R2-1.png
vendored
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 68 KiB |
BIN
Limelight/Images.xcassets/R2.imageset/R2-2.png
vendored
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 68 KiB |
BIN
Limelight/Images.xcassets/R2.imageset/R2.png
vendored
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 68 KiB |
23
Limelight/Images.xcassets/R3.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "R3.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "R3-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "R3-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/R3.imageset/R3-1.png
vendored
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
Limelight/Images.xcassets/R3.imageset/R3-2.png
vendored
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
Limelight/Images.xcassets/R3.imageset/R3.png
vendored
Normal file
After Width: | Height: | Size: 91 KiB |
@ -30,8 +30,10 @@
|
||||
CALayer* _selectButton;
|
||||
CALayer* _r1Button;
|
||||
CALayer* _r2Button;
|
||||
CALayer* _r3Button;
|
||||
CALayer* _l1Button;
|
||||
CALayer* _l2Button;
|
||||
CALayer* _l3Button;
|
||||
|
||||
UITouch* _aTouch;
|
||||
UITouch* _bTouch;
|
||||
@ -47,8 +49,16 @@
|
||||
UITouch* _selectTouch;
|
||||
UITouch* _r1Touch;
|
||||
UITouch* _r2Touch;
|
||||
UITouch* _r3Touch;
|
||||
UITouch* _l1Touch;
|
||||
UITouch* _l2Touch;
|
||||
UITouch* _l3Touch;
|
||||
|
||||
NSDate* l3TouchStart;
|
||||
NSDate* r3TouchStart;
|
||||
|
||||
BOOL l3Set;
|
||||
BOOL r3Set;
|
||||
|
||||
UIView* _view;
|
||||
OnScreenControlsLevel _level;
|
||||
@ -67,6 +77,7 @@ static const float D_PAD_DIST = 15;
|
||||
static float D_PAD_CENTER_X;
|
||||
static float D_PAD_CENTER_Y;
|
||||
|
||||
static const double STICK_CLICK_RATE = 100;
|
||||
static const float STICK_INNER_SIZE = 80;
|
||||
static const float STICK_OUTER_SIZE = 120;
|
||||
static const float STICK_DEAD_ZONE = .1;
|
||||
@ -85,17 +96,22 @@ 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 const float BUMPER_SIZE = 45;
|
||||
static const float TRIGGER_SIZE = 60;
|
||||
static const float L3R3_SIZE = 80;
|
||||
|
||||
static float R1_X;
|
||||
static float R1_Y;
|
||||
static float R2_X;
|
||||
static float R2_Y;
|
||||
static float R3_X;
|
||||
static float R3_Y;
|
||||
static float L1_X;
|
||||
static float L1_Y;
|
||||
static float L2_X;
|
||||
static float L2_Y;
|
||||
static float L3_X;
|
||||
static float L3_Y;
|
||||
|
||||
- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport {
|
||||
self = [self init];
|
||||
@ -114,6 +130,8 @@ static float L2_Y;
|
||||
_r1Button = [CALayer layer];
|
||||
_l2Button = [CALayer layer];
|
||||
_r2Button = [CALayer layer];
|
||||
_l3Button = [CALayer layer];
|
||||
_r3Button = [CALayer layer];
|
||||
_startButton = [CALayer layer];
|
||||
_selectButton = [CALayer layer];
|
||||
_leftStickBackground = [CALayer layer];
|
||||
@ -137,6 +155,7 @@ static float L2_Y;
|
||||
[self hideTriggers];
|
||||
[self hideStartSelect];
|
||||
[self hideSticks];
|
||||
[self hideL3R3];
|
||||
break;
|
||||
case OnScreenControlsLevelAutoGCGamepad:
|
||||
// GCGamepad is missing triggers, both analog sticks,
|
||||
@ -148,7 +167,7 @@ static float L2_Y;
|
||||
[self drawTriggers];
|
||||
[self drawStartSelect];
|
||||
[self drawSticks];
|
||||
// TODO: Draw L3 and R3 buttons
|
||||
[self drawL3R3];
|
||||
break;
|
||||
case OnScreenControlsLevelAutoGCExtendedGamepad:
|
||||
// GCExtendedGamepad is missing R3, L3, and select
|
||||
@ -159,7 +178,7 @@ static float L2_Y;
|
||||
[self hideTriggers];
|
||||
[self drawStartSelect];
|
||||
[self hideSticks];
|
||||
// TODO: Draw L3 and R3 buttons
|
||||
[self drawL3R3];
|
||||
break;
|
||||
case OnScreenControlsLevelSimple:
|
||||
[self setupSimpleControls];
|
||||
@ -169,6 +188,7 @@ static float L2_Y;
|
||||
[self hideButtons];
|
||||
[self hideBumpers];
|
||||
[self hideSticks];
|
||||
[self hideL3R3];
|
||||
break;
|
||||
case OnScreenControlsLevelFull:
|
||||
[self setupComplexControls];
|
||||
@ -178,6 +198,7 @@ static float L2_Y;
|
||||
[self drawBumpers];
|
||||
[self drawTriggers];
|
||||
[self drawSticks];
|
||||
[self hideL3R3]; // Full controls don't need these they have the sticks
|
||||
break;
|
||||
default:
|
||||
NSLog(@"Unknown on-screen controls level: %d", (int)_level);
|
||||
@ -192,8 +213,6 @@ static float L2_Y;
|
||||
|
||||
START_Y = _view.frame.size.height * .9;
|
||||
SELECT_Y = _view.frame.size.height * .9;
|
||||
|
||||
// TODO: Position L3 and R3 at the bottom of the screen
|
||||
}
|
||||
|
||||
// For GCGamepad controls we move triggers, start, and select
|
||||
@ -244,6 +263,10 @@ static float L2_Y;
|
||||
R1_Y = _view.frame.size.height * .25;
|
||||
R2_X = _view.frame.size.width * .85;
|
||||
R2_Y = _view.frame.size.height * .1;
|
||||
L3_X = _view.frame.size.width * .25;
|
||||
L3_Y = _view.frame.size.height * .85;
|
||||
R3_X = _view.frame.size.width * .75;
|
||||
R3_Y = _view.frame.size.height * .85;
|
||||
}
|
||||
|
||||
- (void) drawButtons {
|
||||
@ -330,7 +353,6 @@ static float L2_Y;
|
||||
_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];
|
||||
@ -340,12 +362,25 @@ static float L2_Y;
|
||||
_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) drawL3R3 {
|
||||
_l3Button.frame = CGRectMake(L3_X - L3R3_SIZE / 2, L3_Y - L3R3_SIZE / 2, L3R3_SIZE, L3R3_SIZE);
|
||||
_l3Button.contents = (id) [UIImage imageNamed:@"L3"].CGImage;
|
||||
_l3Button.cornerRadius = L3R3_SIZE / 2;
|
||||
_l3Button.borderColor = [UIColor colorWithRed:15.f/255 green:160.f/255 blue:40.f/255 alpha:1.f].CGColor;
|
||||
[_view.layer addSublayer:_l3Button];
|
||||
|
||||
_r3Button.frame = CGRectMake(R3_X - L3R3_SIZE / 2, R3_Y - L3R3_SIZE / 2, L3R3_SIZE, L3R3_SIZE);
|
||||
_r3Button.contents = (id) [UIImage imageNamed:@"R3"].CGImage;
|
||||
_r3Button.cornerRadius = L3R3_SIZE / 2;
|
||||
_r3Button.borderColor = [UIColor colorWithRed:15.f/255 green:160.f/255 blue:40.f/255 alpha:1.f].CGColor;
|
||||
[_view.layer addSublayer:_r3Button];
|
||||
}
|
||||
|
||||
- (void) hideButtons {
|
||||
[_aButton removeFromSuperlayer];
|
||||
[_bButton removeFromSuperlayer];
|
||||
@ -379,6 +414,11 @@ static float L2_Y;
|
||||
[_rightStick removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (void) hideL3R3 {
|
||||
[_l3Button removeFromSuperlayer];
|
||||
[_r3Button removeFromSuperlayer];
|
||||
}
|
||||
|
||||
- (BOOL) handleTouchMovedEvent:touches {
|
||||
BOOL updated = false;
|
||||
BOOL buttonTouch = false;
|
||||
@ -457,6 +497,10 @@ static float L2_Y;
|
||||
buttonTouch = true;
|
||||
} else if (touch == _r2Touch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _l3Touch) {
|
||||
buttonTouch = true;
|
||||
} else if (touch == _r3Touch) {
|
||||
buttonTouch = true;
|
||||
}
|
||||
}
|
||||
if (updated) {
|
||||
@ -527,10 +571,50 @@ static float L2_Y;
|
||||
[_controllerSupport updateRightTrigger:0xFF];
|
||||
_r2Touch = touch;
|
||||
updated = true;
|
||||
} else if ([_l3Button.presentationLayer hitTest:touchLocation]) {
|
||||
if (l3Set) {
|
||||
[_controllerSupport clearButtonFlag:LS_CLK_FLAG];
|
||||
_l3Button.borderWidth = 0.0f;
|
||||
} else {
|
||||
[_controllerSupport setButtonFlag:LS_CLK_FLAG];
|
||||
_l3Button.borderWidth = 2.0f;
|
||||
}
|
||||
l3Set = !l3Set;
|
||||
_l3Touch = touch;
|
||||
updated = true;
|
||||
} else if ([_r3Button.presentationLayer hitTest:touchLocation]) {
|
||||
if (r3Set) {
|
||||
[_controllerSupport clearButtonFlag:RS_CLK_FLAG];
|
||||
_r3Button.borderWidth = 0.0f;
|
||||
} else {
|
||||
[_controllerSupport setButtonFlag:RS_CLK_FLAG];
|
||||
_r3Button.borderWidth = 2.0f;
|
||||
}
|
||||
r3Set = !r3Set;
|
||||
_r3Touch = touch;
|
||||
updated = true;
|
||||
} else if ([_leftStick.presentationLayer hitTest:touchLocation]) {
|
||||
if (l3TouchStart != nil) {
|
||||
// Find elapsed time and convert to milliseconds
|
||||
// Use (-) modifier to conversion since receiver is earlier than now
|
||||
double l3TouchTime = [l3TouchStart timeIntervalSinceNow] * -1000.0;
|
||||
if (l3TouchTime < STICK_CLICK_RATE) {
|
||||
[_controllerSupport setButtonFlag:LS_CLK_FLAG];
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
_lsTouch = touch;
|
||||
stickTouch = true;
|
||||
} else if ([_rightStick.presentationLayer hitTest:touchLocation]) {
|
||||
if (r3TouchStart != nil) {
|
||||
// Find elapsed time and convert to milliseconds
|
||||
// Use (-) modifier to conversion since receiver is earlier than now
|
||||
double r3TouchTime = [r3TouchStart timeIntervalSinceNow] * -1000.0;
|
||||
if (r3TouchTime < STICK_CLICK_RATE) {
|
||||
[_controllerSupport setButtonFlag:RS_CLK_FLAG];
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
_rsTouch = touch;
|
||||
stickTouch = true;
|
||||
}
|
||||
@ -603,11 +687,15 @@ static float L2_Y;
|
||||
} 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);
|
||||
[_controllerSupport updateLeftStick:0 y:0];
|
||||
updated = true;
|
||||
[_controllerSupport clearButtonFlag:LS_CLK_FLAG];
|
||||
l3TouchStart = [NSDate date];
|
||||
_lsTouch = nil;
|
||||
updated = true;
|
||||
} 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);
|
||||
[_controllerSupport updateRightStick:0 y:0];
|
||||
[_controllerSupport clearButtonFlag:RS_CLK_FLAG];
|
||||
r3TouchStart = [NSDate date];
|
||||
_rsTouch = nil;
|
||||
updated = true;
|
||||
}
|
||||
|
@ -30,7 +30,6 @@
|
||||
NSLog(@"Setting manual on-screen controls level: %d", (int)level);
|
||||
[onScreenControls setLevel:level];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
|