started implementing on-screen controls
- directional pad works - a,b,x,y work
@ -27,6 +27,7 @@
|
||||
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 */; };
|
||||
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 */; };
|
||||
@ -106,6 +107,8 @@
|
||||
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>"; };
|
||||
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>"; };
|
||||
@ -392,6 +395,8 @@
|
||||
FB89460B19F646E200339C8A /* ControllerSupport.m */,
|
||||
FB89460C19F646E200339C8A /* StreamView.h */,
|
||||
FB89460D19F646E200339C8A /* StreamView.m */,
|
||||
FB4678EB1A50C40900377732 /* OnScreenControls.h */,
|
||||
FB4678EC1A50C40900377732 /* OnScreenControls.m */,
|
||||
);
|
||||
path = Input;
|
||||
sourceTree = "<group>";
|
||||
@ -768,6 +773,7 @@
|
||||
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 */,
|
||||
FB89462A19F646E200339C8A /* ControllerSupport.m in Sources */,
|
||||
|
23
Limelight/Images.xcassets/AButton.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "a_button.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "a_button-1.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "a_button-2.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/AButton.imageset/a_button-1.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
Limelight/Images.xcassets/AButton.imageset/a_button-2.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
Limelight/Images.xcassets/AButton.imageset/a_button.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
23
Limelight/Images.xcassets/BButton.imageset/Contents.json
vendored
Normal file
@ -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"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/BButton.imageset/b_button-1.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
Limelight/Images.xcassets/BButton.imageset/b_button-2.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
Limelight/Images.xcassets/BButton.imageset/b_button.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
23
Limelight/Images.xcassets/DownButton.imageset/Contents.json
vendored
Normal file
@ -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"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/DownButton.imageset/down-1.png
vendored
Normal file
After Width: | Height: | Size: 455 B |
BIN
Limelight/Images.xcassets/DownButton.imageset/down-2.png
vendored
Normal file
After Width: | Height: | Size: 455 B |
BIN
Limelight/Images.xcassets/DownButton.imageset/down.png
vendored
Normal file
After Width: | Height: | Size: 455 B |
23
Limelight/Images.xcassets/LeftButton.imageset/Contents.json
vendored
Normal file
@ -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"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/LeftButton.imageset/left-1.png
vendored
Normal file
After Width: | Height: | Size: 525 B |
BIN
Limelight/Images.xcassets/LeftButton.imageset/left-2.png
vendored
Normal file
After Width: | Height: | Size: 525 B |
BIN
Limelight/Images.xcassets/LeftButton.imageset/left.png
vendored
Normal file
After Width: | Height: | Size: 525 B |
23
Limelight/Images.xcassets/RightButton.imageset/Contents.json
vendored
Normal file
@ -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"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/RightButton.imageset/right-1.png
vendored
Normal file
After Width: | Height: | Size: 549 B |
BIN
Limelight/Images.xcassets/RightButton.imageset/right-2.png
vendored
Normal file
After Width: | Height: | Size: 549 B |
BIN
Limelight/Images.xcassets/RightButton.imageset/right.png
vendored
Normal file
After Width: | Height: | Size: 549 B |
23
Limelight/Images.xcassets/UpButton.imageset/Contents.json
vendored
Normal file
@ -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"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/UpButton.imageset/up-1.png
vendored
Normal file
After Width: | Height: | Size: 452 B |
BIN
Limelight/Images.xcassets/UpButton.imageset/up-2.png
vendored
Normal file
After Width: | Height: | Size: 452 B |
BIN
Limelight/Images.xcassets/UpButton.imageset/up.png
vendored
Normal file
After Width: | Height: | Size: 452 B |
23
Limelight/Images.xcassets/XButton.imageset/Contents.json
vendored
Normal file
@ -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"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/XButton.imageset/x_button-1.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Limelight/Images.xcassets/XButton.imageset/x_button-2.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Limelight/Images.xcassets/XButton.imageset/x_button.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
23
Limelight/Images.xcassets/YButton.imageset/Contents.json
vendored
Normal file
@ -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"
|
||||
}
|
||||
}
|
BIN
Limelight/Images.xcassets/YButton.imageset/y_button-1.png
vendored
Normal file
After Width: | Height: | Size: 969 B |
BIN
Limelight/Images.xcassets/YButton.imageset/y_button-2.png
vendored
Normal file
After Width: | Height: | Size: 969 B |
BIN
Limelight/Images.xcassets/YButton.imageset/y_button.png
vendored
Normal file
After Width: | Height: | Size: 969 B |
16
Limelight/Input/OnScreenControls.h
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// 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
|
||||
|
||||
- (id) initWithView:(UIView*)view;
|
||||
- (void) handleTouchDownEvent:(UIEvent*)event;
|
||||
- (void) handleTouchUpEvent:(UIEvent*) event;
|
||||
@end
|
193
Limelight/Input/OnScreenControls.m
Normal file
@ -0,0 +1,193 @@
|
||||
//
|
||||
// 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 {
|
||||
UIView* _view;
|
||||
BOOL shouldDrawControls;
|
||||
CALayer* _aButton;
|
||||
CALayer* _bButton;
|
||||
CALayer* _xButton;
|
||||
CALayer* _yButton;
|
||||
CALayer* _upButton;
|
||||
CALayer* _downButton;
|
||||
CALayer* _leftButton;
|
||||
CALayer* _rightButton;
|
||||
|
||||
short buttonFlags;
|
||||
short leftStickX, leftStickY;
|
||||
short rightStickX, rightStickY;
|
||||
char leftTrigger, rightTrigger;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
- (id) initWithView:(UIView*)view {
|
||||
self = [self init];
|
||||
_view = view;
|
||||
shouldDrawControls = YES;
|
||||
|
||||
D_PAD_CENTER_X = _view.frame.size.width * .15;
|
||||
D_PAD_CENTER_Y = _view.frame.size.height * .75;
|
||||
BUTTON_CENTER_X = _view.frame.size.width * .85;
|
||||
BUTTON_CENTER_Y = _view.frame.size.height * .75;
|
||||
|
||||
[self drawButtons];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) drawButtons {
|
||||
// create A button
|
||||
_aButton = [CALayer layer];
|
||||
_aButton.frame = CGRectMake(BUTTON_CENTER_X - BUTTON_SIZE / 2, BUTTON_CENTER_Y + BUTTON_DIST, BUTTON_SIZE, BUTTON_SIZE);
|
||||
_aButton.contents = (id) [UIImage imageNamed:@"AButton"].CGImage;
|
||||
[_view.layer addSublayer:_aButton];
|
||||
|
||||
// create B button
|
||||
_bButton = [CALayer layer];
|
||||
_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 = [CALayer layer];
|
||||
_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 = [CALayer layer];
|
||||
_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 = [CALayer layer];
|
||||
_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 = [CALayer layer];
|
||||
_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 = [CALayer layer];
|
||||
_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 = [CALayer layer];
|
||||
_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)handleTouchDownEvent:(UIEvent*)event {
|
||||
for (UITouch* touch in [event allTouches]) {
|
||||
CGPoint touchLocation = [touch locationInView:_view];
|
||||
|
||||
if ([_aButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(A_FLAG, 1);
|
||||
} else if ([_bButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(B_FLAG, 1);
|
||||
} else if ([_xButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(X_FLAG, 1);
|
||||
} else if ([_yButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(Y_FLAG, 1);
|
||||
} else if ([_upButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(UP_FLAG, 1);
|
||||
} else if ([_downButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(DOWN_FLAG, 1);
|
||||
} else if ([_leftButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(LEFT_FLAG, 1);
|
||||
} else if ([_rightButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(RIGHT_FLAG, 1);
|
||||
}
|
||||
/*
|
||||
|
||||
UPDATE_BUTTON(LB_FLAG, gamepad.leftShoulder.pressed);
|
||||
UPDATE_BUTTON(RB_FLAG, gamepad.rightShoulder.pressed);
|
||||
|
||||
leftStickX = gamepad.leftThumbstick.xAxis.value * 0x7FFE;
|
||||
leftStickY = gamepad.leftThumbstick.yAxis.value * 0x7FFE;
|
||||
|
||||
rightStickX = gamepad.rightThumbstick.xAxis.value * 0x7FFE;
|
||||
rightStickY = gamepad.rightThumbstick.yAxis.value * 0x7FFE;
|
||||
|
||||
leftTrigger = gamepad.leftTrigger.value * 0xFF;
|
||||
rightTrigger = gamepad.rightTrigger.value * 0xFF;
|
||||
*/
|
||||
// We call LiSendControllerEvent while holding a lock to prevent
|
||||
// multiple simultaneous calls since this function isn't thread safe.
|
||||
}
|
||||
LiSendControllerEvent(buttonFlags, leftTrigger, rightTrigger,
|
||||
leftStickX, leftStickY, rightStickX, rightStickY);
|
||||
}
|
||||
|
||||
- (void)handleTouchUpEvent:(UIEvent*)event {
|
||||
|
||||
for (UITouch* touch in [event allTouches]) {
|
||||
CGPoint touchLocation = [touch locationInView:_view];
|
||||
|
||||
if ([_aButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(A_FLAG, 0);
|
||||
} else if ([_bButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(B_FLAG, 0);
|
||||
} else if ([_xButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(X_FLAG, 0);
|
||||
} else if ([_yButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(Y_FLAG, 0);
|
||||
} else if ([_upButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(UP_FLAG, 0);
|
||||
} else if ([_downButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(DOWN_FLAG, 0);
|
||||
} else if ([_leftButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(LEFT_FLAG, 0);
|
||||
} else if ([_rightButton.presentationLayer hitTest:touchLocation]) {
|
||||
UPDATE_BUTTON(RIGHT_FLAG, 0);
|
||||
}
|
||||
/*
|
||||
UPDATE_BUTTON(LB_FLAG, gamepad.leftShoulder.pressed);
|
||||
UPDATE_BUTTON(RB_FLAG, gamepad.rightShoulder.pressed);
|
||||
|
||||
leftStickX = gamepad.leftThumbstick.xAxis.value * 0x7FFE;
|
||||
leftStickY = gamepad.leftThumbstick.yAxis.value * 0x7FFE;
|
||||
|
||||
rightStickX = gamepad.rightThumbstick.xAxis.value * 0x7FFE;
|
||||
rightStickY = gamepad.rightThumbstick.yAxis.value * 0x7FFE;
|
||||
|
||||
leftTrigger = gamepad.leftTrigger.value * 0xFF;
|
||||
rightTrigger = gamepad.rightTrigger.value * 0xFF;
|
||||
*/
|
||||
// We call LiSendControllerEvent while holding a lock to prevent
|
||||
// multiple simultaneous calls since this function isn't thread safe.
|
||||
}
|
||||
LiSendControllerEvent(buttonFlags, leftTrigger, rightTrigger,
|
||||
leftStickX, leftStickY, rightStickX, rightStickY);
|
||||
}
|
||||
|
||||
|
||||
@end
|
@ -10,4 +10,6 @@
|
||||
|
||||
@interface StreamView : UIView
|
||||
|
||||
- (void) setupOnScreenControls;
|
||||
|
||||
@end
|
||||
|
@ -8,17 +8,23 @@
|
||||
|
||||
#import "StreamView.h"
|
||||
#include <Limelight.h>
|
||||
#import "OnScreenControls.h"
|
||||
|
||||
@implementation StreamView {
|
||||
CGPoint touchLocation;
|
||||
BOOL touchMoved;
|
||||
OnScreenControls* onScreenControls;
|
||||
}
|
||||
|
||||
- (void) setupOnScreenControls {
|
||||
onScreenControls = [[OnScreenControls alloc] initWithView:self];
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
UITouch *touch = [[event allTouches] anyObject];
|
||||
touchLocation = [touch locationInView:self];
|
||||
touchMoved = false;
|
||||
|
||||
[onScreenControls handleTouchDownEvent:event];
|
||||
NSLog(@"Touch down");
|
||||
}
|
||||
|
||||
@ -53,8 +59,7 @@
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||
NSLog(@"Touch up");
|
||||
|
||||
|
||||
[onScreenControls handleTouchUpEvent:event];
|
||||
if (!touchMoved) {
|
||||
if ([[event allTouches] count] == 2) {
|
||||
NSLog(@"Sending right mouse button press");
|
||||
|
@ -10,6 +10,7 @@
|
||||
#import "CryptoManager.h"
|
||||
#import "HttpManager.h"
|
||||
#import "Utils.h"
|
||||
#import "OnScreenControls.h"
|
||||
|
||||
@implementation StreamManager {
|
||||
StreamConfiguration* _config;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#import "VideoDecoderRenderer.h"
|
||||
#import "StreamManager.h"
|
||||
#import "ControllerSupport.h"
|
||||
#import "StreamView.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@ -63,6 +64,7 @@
|
||||
[self.stageLabel setText:@"Waiting for first frame..."];
|
||||
[self.stageLabel sizeToFit];
|
||||
});
|
||||
[(StreamView*)self.view setupOnScreenControls];
|
||||
}
|
||||
|
||||
- (void)connectionTerminated:(long)errorCode {
|
||||
|