mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 19:42:45 +00:00
Fix outside of each d-pad button being cut off by the end of the canvas
This commit is contained in:
parent
095556106c
commit
b05c62e141
@ -57,11 +57,42 @@ public class DigitalPad extends VirtualControllerElement {
|
|||||||
(direction & DIGITAL_PAD_DIRECTION_LEFT) > 0 ? pressedColor : normalColor);
|
(direction & DIGITAL_PAD_DIRECTION_LEFT) > 0 ? pressedColor : normalColor);
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
canvas.drawRect(
|
canvas.drawRect(
|
||||||
0, getPercent(getHeight(), 33),
|
paint.getStrokeWidth(), getPercent(getHeight(), 33),
|
||||||
getPercent(getWidth(), 33), getPercent(getHeight(), 66),
|
getPercent(getWidth(), 33), getPercent(getHeight(), 66),
|
||||||
paint
|
paint
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// draw up rect
|
||||||
|
paint.setColor(
|
||||||
|
(direction & DIGITAL_PAD_DIRECTION_UP) > 0 ? pressedColor : normalColor);
|
||||||
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
|
canvas.drawRect(
|
||||||
|
getPercent(getWidth(), 33), paint.getStrokeWidth(),
|
||||||
|
getPercent(getWidth(), 66), getPercent(getHeight(), 33),
|
||||||
|
paint
|
||||||
|
);
|
||||||
|
|
||||||
|
// draw right rect
|
||||||
|
paint.setColor(
|
||||||
|
(direction & DIGITAL_PAD_DIRECTION_RIGHT) > 0 ? pressedColor : normalColor);
|
||||||
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
|
canvas.drawRect(
|
||||||
|
getPercent(getWidth(), 66), getPercent(getHeight(), 33),
|
||||||
|
getWidth()-paint.getStrokeWidth(), getPercent(getHeight(), 66),
|
||||||
|
paint
|
||||||
|
);
|
||||||
|
|
||||||
|
// draw down rect
|
||||||
|
paint.setColor(
|
||||||
|
(direction & DIGITAL_PAD_DIRECTION_DOWN) > 0 ? pressedColor : normalColor);
|
||||||
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
|
canvas.drawRect(
|
||||||
|
getPercent(getWidth(), 33), getPercent(getHeight(), 66),
|
||||||
|
getPercent(getWidth(), 66), getHeight()-paint.getStrokeWidth(),
|
||||||
|
paint
|
||||||
|
);
|
||||||
|
|
||||||
// draw left up line
|
// draw left up line
|
||||||
paint.setColor((
|
paint.setColor((
|
||||||
(direction & DIGITAL_PAD_DIRECTION_LEFT) > 0 &&
|
(direction & DIGITAL_PAD_DIRECTION_LEFT) > 0 &&
|
||||||
@ -70,18 +101,8 @@ public class DigitalPad extends VirtualControllerElement {
|
|||||||
);
|
);
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
canvas.drawLine(
|
canvas.drawLine(
|
||||||
0, getPercent(getHeight(), 33),
|
paint.getStrokeWidth(), getPercent(getHeight(), 33),
|
||||||
getPercent(getWidth(), 33), 0,
|
getPercent(getWidth(), 33), paint.getStrokeWidth(),
|
||||||
paint
|
|
||||||
);
|
|
||||||
|
|
||||||
// draw up rect
|
|
||||||
paint.setColor(
|
|
||||||
(direction & DIGITAL_PAD_DIRECTION_UP) > 0 ? pressedColor : normalColor);
|
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
|
||||||
canvas.drawRect(
|
|
||||||
getPercent(getWidth(), 33), 0,
|
|
||||||
getPercent(getWidth(), 66), getPercent(getHeight(), 33),
|
|
||||||
paint
|
paint
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -93,18 +114,8 @@ public class DigitalPad extends VirtualControllerElement {
|
|||||||
);
|
);
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
canvas.drawLine(
|
canvas.drawLine(
|
||||||
getPercent(getWidth(), 66), 0,
|
getPercent(getWidth(), 66), paint.getStrokeWidth(),
|
||||||
getPercent(getWidth(), 100), getPercent(getHeight(), 33),
|
getWidth() - paint.getStrokeWidth(), getPercent(getHeight(), 33),
|
||||||
paint
|
|
||||||
);
|
|
||||||
|
|
||||||
// draw right rect
|
|
||||||
paint.setColor(
|
|
||||||
(direction & DIGITAL_PAD_DIRECTION_RIGHT) > 0 ? pressedColor : normalColor);
|
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
|
||||||
canvas.drawRect(
|
|
||||||
getPercent(getWidth(), 66), getPercent(getHeight(), 33),
|
|
||||||
getPercent(getWidth(), 100), getPercent(getHeight(), 66),
|
|
||||||
paint
|
paint
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -116,18 +127,8 @@ public class DigitalPad extends VirtualControllerElement {
|
|||||||
);
|
);
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
canvas.drawLine(
|
canvas.drawLine(
|
||||||
getPercent(getWidth(), 100), getPercent(getHeight(), 66),
|
getWidth()-paint.getStrokeWidth(), getPercent(getHeight(), 66),
|
||||||
getPercent(getWidth(), 66), getPercent(getHeight(), 100),
|
getPercent(getWidth(), 66), getHeight()-paint.getStrokeWidth(),
|
||||||
paint
|
|
||||||
);
|
|
||||||
|
|
||||||
// draw down rect
|
|
||||||
paint.setColor(
|
|
||||||
(direction & DIGITAL_PAD_DIRECTION_DOWN) > 0 ? pressedColor : normalColor);
|
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
|
||||||
canvas.drawRect(
|
|
||||||
getPercent(getWidth(), 33), getPercent(getHeight(), 66),
|
|
||||||
getPercent(getWidth(), 66), getPercent(getHeight(), 100),
|
|
||||||
paint
|
paint
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -139,8 +140,8 @@ public class DigitalPad extends VirtualControllerElement {
|
|||||||
);
|
);
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
canvas.drawLine(
|
canvas.drawLine(
|
||||||
getPercent(getWidth(), 33), getPercent(getHeight(), 100),
|
getPercent(getWidth(), 33), getHeight()-paint.getStrokeWidth(),
|
||||||
getPercent(getWidth(), 0), getPercent(getHeight(), 66),
|
paint.getStrokeWidth(), getPercent(getHeight(), 66),
|
||||||
paint
|
paint
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user