mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-05 07:26:19 +00:00
Improve OSC usability for iPad. Fixes #317
This commit is contained in:
@@ -238,8 +238,22 @@ static float L3_Y;
|
||||
// Start with the default complex layout
|
||||
[self setupComplexControls];
|
||||
|
||||
START_X = _controlArea.size.width * .95 + _controlArea.origin.x;
|
||||
START_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
SELECT_X = _controlArea.size.width * .05 + _controlArea.origin.x;
|
||||
SELECT_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
|
||||
L3_Y = _controlArea.size.height * .85 + _controlArea.origin.y;
|
||||
R3_Y = _controlArea.size.height * .85 + _controlArea.origin.y;
|
||||
|
||||
if (_iPad) {
|
||||
L3_X = _controlArea.size.width * .15 + _controlArea.origin.x;
|
||||
R3_X = _controlArea.size.width * .85 + _controlArea.origin.x;
|
||||
}
|
||||
else {
|
||||
L3_X = _controlArea.size.width * .25 + _controlArea.origin.x;
|
||||
R3_X = _controlArea.size.width * .75 + _controlArea.origin.x;
|
||||
}
|
||||
}
|
||||
|
||||
// For GCGamepad controls we move triggers, start, and select
|
||||
@@ -248,41 +262,21 @@ static float L3_Y;
|
||||
// Start with the default complex layout
|
||||
[self setupComplexControls];
|
||||
|
||||
START_X = _controlArea.size.width * .6 + _controlArea.origin.x;
|
||||
START_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
L2_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
L2_X = _controlArea.size.width * .05 + _controlArea.origin.x;
|
||||
|
||||
SELECT_X = _controlArea.size.width * .4 + _controlArea.origin.x;
|
||||
SELECT_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
R2_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
R2_X = _controlArea.size.width * .95 + _controlArea.origin.x;
|
||||
|
||||
L2_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
L2_X = _controlArea.size.width * .1 + _controlArea.origin.x;
|
||||
|
||||
R2_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
R2_X = _controlArea.size.width * .9 + _controlArea.origin.x;
|
||||
START_X = _controlArea.size.width * .95 + _controlArea.origin.x;
|
||||
START_Y = _controlArea.size.height * .95 + _controlArea.origin.y;
|
||||
SELECT_X = _controlArea.size.width * .05 + _controlArea.origin.x;
|
||||
SELECT_Y = _controlArea.size.height * .95 + _controlArea.origin.y;
|
||||
|
||||
if (_iPad) {
|
||||
START_X = _controlArea.size.width * .75 + _controlArea.origin.x;
|
||||
START_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
|
||||
SELECT_X = _controlArea.size.width * .25 + _controlArea.origin.x;
|
||||
SELECT_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
|
||||
// The analog sticks are kept closer to the sides on iPad
|
||||
LS_CENTER_X = _controlArea.size.width * .18 + _controlArea.origin.x;
|
||||
LS_CENTER_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
RS_CENTER_X = _controlArea.size.width * .82 + _controlArea.origin.x;
|
||||
RS_CENTER_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
} else {
|
||||
START_X = _controlArea.size.width * .6 + _controlArea.origin.x;
|
||||
START_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
|
||||
SELECT_X = _controlArea.size.width * .4 + _controlArea.origin.x;
|
||||
SELECT_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
|
||||
LS_CENTER_X = _controlArea.size.width * .25 + _controlArea.origin.x;
|
||||
LS_CENTER_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
RS_CENTER_X = _controlArea.size.width * .75 + _controlArea.origin.x;
|
||||
RS_CENTER_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
LS_CENTER_X = _controlArea.size.width * .15 + _controlArea.origin.x;
|
||||
RS_CENTER_X = _controlArea.size.width * .85 + _controlArea.origin.x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,10 +285,7 @@ static float L3_Y;
|
||||
// Start with the default complex layout
|
||||
[self setupComplexControls];
|
||||
|
||||
START_X = _controlArea.size.width * .6 + _controlArea.origin.x;
|
||||
START_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
|
||||
SELECT_X = _controlArea.size.width * .4 + _controlArea.origin.x;
|
||||
SELECT_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
|
||||
L2_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
@@ -302,6 +293,20 @@ static float L3_Y;
|
||||
|
||||
R2_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
R2_X = _controlArea.size.width * .9 + _controlArea.origin.x;
|
||||
|
||||
if (_iPad) {
|
||||
// Lower the D-pad and buttons on iPad
|
||||
D_PAD_CENTER_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
BUTTON_CENTER_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
|
||||
// Move Start and Select closer to sides
|
||||
SELECT_X = _controlArea.size.width * .2 + _controlArea.origin.x;
|
||||
START_X = _controlArea.size.width * .8 + _controlArea.origin.x;
|
||||
}
|
||||
else {
|
||||
SELECT_X = _controlArea.size.width * .4 + _controlArea.origin.x;
|
||||
START_X = _controlArea.size.width * .6 + _controlArea.origin.x;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setupComplexControls
|
||||
@@ -315,9 +320,9 @@ static float L3_Y;
|
||||
{
|
||||
// The analog sticks are kept closer to the sides on iPad
|
||||
LS_CENTER_X = _controlArea.size.width * .22 + _controlArea.origin.x;
|
||||
LS_CENTER_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
LS_CENTER_Y = _controlArea.size.height * .80 + _controlArea.origin.y;
|
||||
RS_CENTER_X = _controlArea.size.width * .77 + _controlArea.origin.x;
|
||||
RS_CENTER_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
RS_CENTER_Y = _controlArea.size.height * .80 + _controlArea.origin.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -332,18 +337,24 @@ static float L3_Y;
|
||||
SELECT_X = _controlArea.size.width * .1 + _controlArea.origin.x;
|
||||
SELECT_Y = _controlArea.size.height * .9 + _controlArea.origin.y;
|
||||
|
||||
L1_X = _controlArea.size.width * .1 + _controlArea.origin.x;
|
||||
L1_Y = _controlArea.size.height * .27 + _controlArea.origin.y;
|
||||
L2_X = _controlArea.size.width * .1 + _controlArea.origin.x;
|
||||
L2_Y = _controlArea.size.height * .1 + _controlArea.origin.y;
|
||||
R1_X = _controlArea.size.width * .9 + _controlArea.origin.x;
|
||||
R1_Y = _controlArea.size.height * .27 + _controlArea.origin.y;
|
||||
R2_X = _controlArea.size.width * .9 + _controlArea.origin.x;
|
||||
R2_Y = _controlArea.size.height * .1 + _controlArea.origin.y;
|
||||
L3_X = _controlArea.size.width * .25 + _controlArea.origin.x;
|
||||
L3_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
R3_X = _controlArea.size.width * .75 + _controlArea.origin.x;
|
||||
R3_Y = _controlArea.size.height * .75 + _controlArea.origin.y;
|
||||
|
||||
if (_iPad) {
|
||||
// Move L/R buttons closer to the side on iPad
|
||||
L1_X = _controlArea.size.width * .05 + _controlArea.origin.x;
|
||||
L2_X = _controlArea.size.width * .05 + _controlArea.origin.x;
|
||||
R1_X = _controlArea.size.width * .95 + _controlArea.origin.x;
|
||||
R2_X = _controlArea.size.width * .95 + _controlArea.origin.x;
|
||||
}
|
||||
else {
|
||||
L1_X = _controlArea.size.width * .1 + _controlArea.origin.x;
|
||||
L2_X = _controlArea.size.width * .1 + _controlArea.origin.x;
|
||||
R1_X = _controlArea.size.width * .9 + _controlArea.origin.x;
|
||||
R2_X = _controlArea.size.width * .9 + _controlArea.origin.x;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) drawButtons {
|
||||
@@ -940,7 +951,7 @@ static float L3_Y;
|
||||
|| [self isDeadZone:touch
|
||||
startX:_rightStickBackground.frame.origin.x - 15
|
||||
startY:_rightStickBackground.frame.origin.y - 15
|
||||
endX:_rightStickBackground.frame.origin.x + _rightStickBackground.frame.size.width + 15
|
||||
endX:_rightStickBackground.frame.origin.y + _rightStickBackground.frame.size.width + 15
|
||||
endY:_view.frame.origin.y + _view.frame.size.height];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user