mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-14 17:59:17 -05:00
change d-pad text to shapes (#5557)
This commit is contained in:
@ -51,11 +51,31 @@ int main(void)
|
|||||||
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
|
{ padPosition.x, padPosition.y + buttonRadius*1.5f } // Down
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *buttonLabels[BUTTON_MAX] = {
|
Vector2 arrowTris[4][3] = {
|
||||||
"Y", // Up
|
// Up
|
||||||
"X", // Left
|
{
|
||||||
"B", // Right
|
{ buttonPositions[0].x, buttonPositions[0].y - 12 },
|
||||||
"A" // Down
|
{ buttonPositions[0].x - 9, buttonPositions[0].y + 9 },
|
||||||
|
{ buttonPositions[0].x + 9, buttonPositions[0].y + 9 }
|
||||||
|
},
|
||||||
|
// Left
|
||||||
|
{
|
||||||
|
{ buttonPositions[1].x + 9, buttonPositions[1].y - 9 },
|
||||||
|
{ buttonPositions[1].x - 12, buttonPositions[1].y },
|
||||||
|
{ buttonPositions[1].x + 9, buttonPositions[1].y + 9 }
|
||||||
|
},
|
||||||
|
// Right
|
||||||
|
{
|
||||||
|
{ buttonPositions[2].x + 12, buttonPositions[2].y },
|
||||||
|
{ buttonPositions[2].x - 9, buttonPositions[2].y - 9 },
|
||||||
|
{ buttonPositions[2].x - 9, buttonPositions[2].y + 9 }
|
||||||
|
},
|
||||||
|
// Down
|
||||||
|
{
|
||||||
|
{ buttonPositions[3].x - 9, buttonPositions[3].y - 9 },
|
||||||
|
{ buttonPositions[3].x, buttonPositions[3].y + 12 },
|
||||||
|
{ buttonPositions[3].x + 9, buttonPositions[3].y - 9 }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Color buttonLabelColors[BUTTON_MAX] = {
|
Color buttonLabelColors[BUTTON_MAX] = {
|
||||||
@ -128,9 +148,12 @@ int main(void)
|
|||||||
{
|
{
|
||||||
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
|
DrawCircleV(buttonPositions[i], buttonRadius, (i == pressedButton)? DARKGRAY : BLACK);
|
||||||
|
|
||||||
DrawText(buttonLabels[i],
|
DrawTriangle(
|
||||||
(int)buttonPositions[i].x - 7, (int)buttonPositions[i].y - 8,
|
arrowTris[i][0],
|
||||||
20, buttonLabelColors[i]);
|
arrowTris[i][1],
|
||||||
|
arrowTris[i][2],
|
||||||
|
buttonLabelColors[i]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawText("move the player with D-Pad buttons", 10, 10, 20, DARKGRAY);
|
DrawText("move the player with D-Pad buttons", 10, 10, 20, DARKGRAY);
|
||||||
|
|||||||
Reference in New Issue
Block a user