fuzzyworld

explodorama / files / src / ui / padLayouts.ts

padLayouts.ts

Blame: the commit that last changed each line · file · history

92cc4ee3 2026-11-02 Pavel Safronov1/**
2 * Where the buttons sit on each controller family's picture (assets/controller-art/), generated by
3 * tools/make-pad-layouts.py from measurements of the drawings; do not edit by hand. The pictures are
4 * line drawings from OpenGameArt's "Controller style 1 / 3 / 5", CC BY 4.0 (see README Attribution).
5 * Units: a box `width` x `height` (1000 wide) covering the picture; `x`, `y` are the centre of a
6 * part, `r` its radius, `w` and `h` a shoulder button's size. Generic pads use the Xbox one.
7 */
8export interface PadDot { x: number; y: number; r: number }
9export interface PadBox { x: number; y: number; w: number; h: number }
10export interface PadLayout {
11 /** The picture's file name in assets/controller-art/. */
12 image: string
13 width: number
14 height: number
15 dpad: PadDot
16 rstick: PadDot
17 /** Start / Options / Menu / Plus. */
18 start: PadDot
19 /** The four face buttons by their place on the pad. */
20 face: { top: PadDot; left: PadDot; right: PadDot; bottom: PadDot }
21 l: PadBox
22 r: PadBox
23}
24
25export const PAD_LAYOUTS: Record<'xbox' | 'playstation' | 'nintendo', PadLayout> = {
26 "xbox": {
27 "image": "padart-xbox.png",
28 "width": 1000,
29 "height": 676.4,
30 "dpad": {
31 "x": 375.7,
32 "y": 363.7,
33 "r": 81.2
34 },
35 "rstick": {
36 "x": 627.0,
37 "y": 357.4,
38 "r": 81.2
39 },
40 "start": {
41 "x": 570.8,
42 "y": 209.2,
43 "r": 23.4
44 },
45 "face": {
46 "top": {
47 "x": 750.3,
48 "y": 142.0,
49 "r": 32.8
50 },
51 "left": {
52 "x": 683.1,
53 "y": 209.2,
54 "r": 32.8
55 },
56 "right": {
57 "x": 817.4,
58 "y": 209.2,
59 "r": 32.8
60 },
61 "bottom": {
62 "x": 750.3,
63 "y": 276.3,
64 "r": 32.8
65 }
66 },
67 "l": {
68 "x": 243.0,
69 "y": 43.7,
70 "w": 78.0,
71 "h": 25.0
72 },
73 "r": {
74 "x": 758.1,
75 "y": 43.7,
76 "w": 78.0,
77 "h": 25.0
78 }
79 },
80 "playstation": {
81 "image": "padart-playstation.png",
82 "width": 1000,
83 "height": 674.7,
84 "dpad": {
85 "x": 195.8,
86 "y": 197.8,
87 "r": 81.3
88 },
89 "rstick": {
90 "x": 656.6,
91 "y": 331.8,
92 "r": 60.2
93 },
94 "start": {
95 "x": 727.4,
96 "y": 89.4,
97 "r": 16.6
98 },
99 "face": {
100 "top": {
101 "x": 804.2,
102 "y": 127.0,
103 "r": 33.1
104 },
105 "left": {
106 "x": 733.4,
107 "y": 197.8,
108 "r": 33.1
109 },
110 "right": {
111 "x": 876.5,
112 "y": 197.8,
113 "r": 33.1
114 },
115 "bottom": {
116 "x": 804.2,
117 "y": 268.6,
118 "r": 33.1
119 }
120 },
121 "l": {
122 "x": 165.7,
123 "y": 20.1,
124 "w": 60.2,
125 "h": 18.1
126 },
127 "r": {
128 "x": 834.3,
129 "y": 20.1,
130 "w": 60.2,
131 "h": 18.1
132 }
133 },
134 "nintendo": {
135 "image": "padart-nintendo.png",
136 "width": 1000,
137 "height": 704.4,
138 "dpad": {
139 "x": 348.0,
140 "y": 351.2,
141 "r": 71.5
142 },
143 "rstick": {
144 "x": 627.6,
145 "y": 351.2,
146 "r": 57.2
147 },
148 "start": {
149 "x": 621.3,
150 "y": 143.0,
151 "r": 20.7
152 },
153 "face": {
154 "top": {
155 "x": 757.9,
156 "y": 151.0,
157 "r": 33.4
158 },
159 "left": {
160 "x": 680.1,
161 "y": 217.7,
162 "r": 33.4
163 },
164 "right": {
165 "x": 834.2,
166 "y": 217.7,
167 "r": 33.4
168 },
169 "bottom": {
170 "x": 757.9,
171 "y": 282.8,
172 "r": 33.4
173 }
174 },
175 "l": {
176 "x": 205.0,
177 "y": 57.2,
178 "w": 95.3,
179 "h": 22.2
180 },
181 "r": {
182 "x": 792.9,
183 "y": 57.2,
184 "w": 95.3,
185 "h": 22.2
186 }
187 }
188}