@rydr/game-sdk 7.1.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -4
- package/dist/client/PlatformClient.d.ts +14 -7
- package/dist/client/PlatformClient.d.ts.map +1 -1
- package/dist/client/PlatformClient.js.map +1 -1
- package/dist/difficulty/index.d.ts +141 -0
- package/dist/difficulty/index.d.ts.map +1 -0
- package/dist/difficulty/index.js +300 -0
- package/dist/difficulty/index.js.map +1 -0
- package/dist/nav/README.md +1 -1
- package/dist/protocol/version.d.ts +1 -1
- package/dist/protocol/version.js +1 -1
- package/dist/ui/README.md +28 -15
- package/dist/ui/action-diamond.js +1 -1
- package/dist/ui/action-diamond.js.map +1 -1
- package/dist/ui/controller/input-chip.d.ts +2 -1
- package/dist/ui/controller/input-chip.d.ts.map +1 -1
- package/dist/ui/controller/input-chip.js +9 -8
- package/dist/ui/controller/input-chip.js.map +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/keycap.d.ts +51 -20
- package/dist/ui/keycap.d.ts.map +1 -1
- package/dist/ui/keycap.js +94 -28
- package/dist/ui/keycap.js.map +1 -1
- package/dist/ui/{pause-menu.d.ts → option-menu.d.ts} +34 -24
- package/dist/ui/option-menu.d.ts.map +1 -0
- package/dist/ui/{pause-menu.js → option-menu.js} +134 -90
- package/dist/ui/option-menu.js.map +1 -0
- package/dist/ui/showcase/index.js +9 -9
- package/dist/ui/showcase/index.js.map +1 -1
- package/dist/ui/solo-labeled-diamond.js +1 -1
- package/dist/ui/solo-labeled-diamond.js.map +1 -1
- package/dist/ui/styles.js +14 -9
- package/dist/ui/styles.js.map +1 -1
- package/package.json +5 -1
- package/dist/ui/pause-menu.d.ts.map +0 -1
- package/dist/ui/pause-menu.js.map +0 -1
package/dist/ui/keycap.d.ts
CHANGED
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
* KEYCAP — a DOM/CSS keycap of the controller face buttons (zero dependencies), so a game can show
|
|
3
3
|
* "which button to press" in a consistent visual language. Two shapes:
|
|
4
4
|
*
|
|
5
|
-
* • "full" — the classic diamond: the active button enlarged
|
|
5
|
+
* • "full" — the classic diamond: the active button enlarged, the other three small + grey.
|
|
6
6
|
* • "solo" — light variation: JUST the active button (the idle siblings removed).
|
|
7
7
|
*
|
|
8
8
|
* The keycap is a small STATE MACHINE: it can pulse (the bouncing attract animation), show a pressed
|
|
9
|
-
* sink, run a depleting COOLDOWN ring + countdown,
|
|
9
|
+
* sink, run a depleting COOLDOWN ring + countdown, and hide.
|
|
10
|
+
*
|
|
11
|
+
* **Mono by default** — a white face with a dark letter, which is the RYDR look everywhere (the shell
|
|
12
|
+
* draws all of its own chrome that way). The per-button role hues still exist behind
|
|
13
|
+
* `colored: true`, for a deliberately loud isolated affordance or to show the palette itself.
|
|
10
14
|
*
|
|
11
15
|
* Two button families share that machine: `createKeycap` for the A/B/Y/Z face buttons (a letter on
|
|
12
16
|
* the active pip) and `createDpadKeycap` for the UP/DOWN/LEFT/RIGHT directional buttons (a white
|
|
13
17
|
* chevron on a steel-grey pip, rotated per direction). They differ ONLY in the face drawn and the
|
|
14
18
|
* button name the press-wiring listens for; everything else is identical.
|
|
15
19
|
*
|
|
16
|
-
* A third factory, `
|
|
17
|
-
*
|
|
18
|
-
*
|
|
20
|
+
* A third factory, `createButtonKeycap`, covers what's left — the system/options button, the shoulder
|
|
21
|
+
* triggers, the stick clicks — and draws each the way the pad does: `OPTIONS` as a round pip with the
|
|
22
|
+
* pad's ICON (`☰` on Xbox/DualSense, `+` on a Switch Pro), since it's a small round key like the
|
|
23
|
+
* others; the triggers and stick clicks as a text PILL, since those are printed with a word ("LT",
|
|
24
|
+
* "L2", "LS") that no pip sized for one glyph could hold.
|
|
19
25
|
*/
|
|
20
26
|
import type { ButtonName, ButtonEdge } from "../protocol/index.js";
|
|
21
27
|
import { type GlyphSet } from "../protocol/glyphs.js";
|
|
@@ -40,7 +46,12 @@ export interface ButtonSource {
|
|
|
40
46
|
export interface KeycapOptions {
|
|
41
47
|
/** "solo" (default) shows only the active button; "full" shows the 4-button diamond. */
|
|
42
48
|
variant?: KeycapVariant;
|
|
43
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Per-button hue. **Default `false` — mono** (a white face with a dark letter), which is the RYDR
|
|
51
|
+
* look: the shell draws every keycap in its chrome that way, so a coloured cap is the one loud key
|
|
52
|
+
* on the screen. Pass `true` only for a deliberately loud, isolated affordance (or to show the
|
|
53
|
+
* palette itself, as the showcase does).
|
|
54
|
+
*/
|
|
44
55
|
colored?: boolean;
|
|
45
56
|
/** Run the bouncing pulse on the active button (default true). */
|
|
46
57
|
animate?: boolean;
|
|
@@ -55,6 +66,20 @@ export interface KeycapOptions {
|
|
|
55
66
|
* a settings screen, a showcase, a screenshot.
|
|
56
67
|
*/
|
|
57
68
|
glyphSet?: GlyphSet;
|
|
69
|
+
/**
|
|
70
|
+
* Size multiplier for the whole keycap — pip diameter, letter, glyph and (on the pill shape) its
|
|
71
|
+
* height, padding and type. Default `1`.
|
|
72
|
+
*
|
|
73
|
+
* **This is the ONLY sanctioned way to make a keycap smaller.** The kit's rule against restyling
|
|
74
|
+
* stands: don't override the `.rydr-ui-*` sizes and never wrap a cap in `transform: scale()`, which
|
|
75
|
+
* leaves a full-size layout box, blurs the text and breaks any positioning done against it. This
|
|
76
|
+
* option resizes the real geometry instead, so layout stays honest.
|
|
77
|
+
*
|
|
78
|
+
* For **secondary** emphasis only — a hint the rider *may* use (the option menu's `Shortcut` caps ride
|
|
79
|
+
* at `0.65`), never a primary prompt. A prompt telling the rider what to press now stays at `1`: full
|
|
80
|
+
* size is what keeps it legible from a few feet away on a trainer.
|
|
81
|
+
*/
|
|
82
|
+
scale?: number;
|
|
58
83
|
}
|
|
59
84
|
/** A bare keycap with its state setters. */
|
|
60
85
|
export interface Keycap {
|
|
@@ -101,24 +126,30 @@ export interface Keycap {
|
|
|
101
126
|
*/
|
|
102
127
|
export declare function createKeycap(button: DiamondButton, opts?: KeycapOptions): Keycap;
|
|
103
128
|
/**
|
|
104
|
-
* Build a keycap for
|
|
105
|
-
* button (`OPTIONS`
|
|
106
|
-
*
|
|
129
|
+
* Build a keycap for the buttons that carry neither a face letter nor a direction — the system/options
|
|
130
|
+
* button (`OPTIONS`), the shoulder triggers (`LT`/`RT`) and the stick clicks
|
|
131
|
+
* (`LSTICK_PRESS`/`RSTICK_PRESS`) — drawn the way the rider's pad actually draws them:
|
|
132
|
+
*
|
|
133
|
+
* • **`OPTIONS` → a round pip with the pad's ICON** (`☰` on Xbox/DualSense, `+` on a Switch Pro).
|
|
134
|
+
* It is a small round key on every pad, so it gets the same circular pip as the d-pad's chevron and
|
|
135
|
+
* sits in the same visual family as the face buttons.
|
|
136
|
+
* • **everything else → a text PILL** carrying {@link buttonLabel} ("LT" / "L2" / "ZL", "LS" / "L3"),
|
|
137
|
+
* because those buttons really are printed with a *word*, and no word fits a pip sized for one
|
|
138
|
+
* glyph. The trigger hardware isn't round either.
|
|
107
139
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* rule that no letter is ever hardcoded holds here too.
|
|
140
|
+
* Either way the state machine is the pip's, reused verbatim (raised lip, pulse, pressed sink, inert
|
|
141
|
+
* grey), and nothing is hardcoded per brand: the icon comes from {@link SYSTEM_ICON} and the text from
|
|
142
|
+
* {@link buttonLabel}.
|
|
112
143
|
*
|
|
113
|
-
* Steel-grey
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
144
|
+
* Steel-grey (these are never the confirm/back hues), and — unlike the pip factories — the attract
|
|
145
|
+
* pulse is **off** unless asked for: these caps label a shortcut the rider *can* take, not an action
|
|
146
|
+
* being demanded of them. `setCooldown` is accepted for interface parity but draws nothing on the pill:
|
|
147
|
+
* these buttons open menus, they don't gate timed abilities.
|
|
117
148
|
*
|
|
118
|
-
* Pass a face-diamond or d-pad button here and you get its letter
|
|
119
|
-
* {@link createKeycap} / {@link createDpadKeycap}, which draw
|
|
149
|
+
* Pass a face-diamond or d-pad button here and you get its letter in a pill — legal, but prefer
|
|
150
|
+
* {@link createKeycap} / {@link createDpadKeycap}, which draw those buttons' real shapes.
|
|
120
151
|
*/
|
|
121
|
-
export declare function
|
|
152
|
+
export declare function createButtonKeycap(button: ButtonName, opts?: KeycapOptions): Keycap;
|
|
122
153
|
/**
|
|
123
154
|
* Build a bare directional (UP/DOWN/LEFT/RIGHT) keycap. Identical state machine to {@link createKeycap}
|
|
124
155
|
* — solo/full, pulse, pressed, cooldown ring — only the active button shows a WHITE chevron (rotated
|
package/dist/ui/keycap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keycap.d.ts","sourceRoot":"","sources":["../../src/ui/keycap.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"keycap.d.ts","sourceRoot":"","sources":["../../src/ui/keycap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAkC,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtF,+FAA+F;AAC/F,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,cAAc,GAAG,cAAc,GAAG,eAAe,CAAC;AAC7F,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACzD,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAC5C,8CAA8C;AAC9C,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,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AE,aAAkB,GAAG,MAAM,CAEpF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,aAAkB,GAAG,MAAM,CAgCvF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,GAAE,aAAkB,GAAG,MAAM,CAEjF"}
|
package/dist/ui/keycap.js
CHANGED
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
* KEYCAP — a DOM/CSS keycap of the controller face buttons (zero dependencies), so a game can show
|
|
3
3
|
* "which button to press" in a consistent visual language. Two shapes:
|
|
4
4
|
*
|
|
5
|
-
* • "full" — the classic diamond: the active button enlarged
|
|
5
|
+
* • "full" — the classic diamond: the active button enlarged, the other three small + grey.
|
|
6
6
|
* • "solo" — light variation: JUST the active button (the idle siblings removed).
|
|
7
7
|
*
|
|
8
8
|
* The keycap is a small STATE MACHINE: it can pulse (the bouncing attract animation), show a pressed
|
|
9
|
-
* sink, run a depleting COOLDOWN ring + countdown,
|
|
9
|
+
* sink, run a depleting COOLDOWN ring + countdown, and hide.
|
|
10
|
+
*
|
|
11
|
+
* **Mono by default** — a white face with a dark letter, which is the RYDR look everywhere (the shell
|
|
12
|
+
* draws all of its own chrome that way). The per-button role hues still exist behind
|
|
13
|
+
* `colored: true`, for a deliberately loud isolated affordance or to show the palette itself.
|
|
10
14
|
*
|
|
11
15
|
* Two button families share that machine: `createKeycap` for the A/B/Y/Z face buttons (a letter on
|
|
12
16
|
* the active pip) and `createDpadKeycap` for the UP/DOWN/LEFT/RIGHT directional buttons (a white
|
|
13
17
|
* chevron on a steel-grey pip, rotated per direction). They differ ONLY in the face drawn and the
|
|
14
18
|
* button name the press-wiring listens for; everything else is identical.
|
|
15
19
|
*
|
|
16
|
-
* A third factory, `
|
|
17
|
-
*
|
|
18
|
-
*
|
|
20
|
+
* A third factory, `createButtonKeycap`, covers what's left — the system/options button, the shoulder
|
|
21
|
+
* triggers, the stick clicks — and draws each the way the pad does: `OPTIONS` as a round pip with the
|
|
22
|
+
* pad's ICON (`☰` on Xbox/DualSense, `+` on a Switch Pro), since it's a small round key like the
|
|
23
|
+
* others; the triggers and stick clicks as a text PILL, since those are printed with a word ("LT",
|
|
24
|
+
* "L2", "LS") that no pip sized for one glyph could hold.
|
|
19
25
|
*/
|
|
20
26
|
import { buttonLabel, DEFAULT_GLYPH_SET } from "../protocol/glyphs.js";
|
|
21
27
|
import { injectCss } from "./styles.js";
|
|
@@ -70,6 +76,29 @@ const ROT = { top: 0, rgt: 90, bot: 180, lft: 270 };
|
|
|
70
76
|
const CHEVRON = `<polyline points="5,15 12,8 19,15" fill="none" stroke="currentColor" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/>`;
|
|
71
77
|
/** Background tone of a directional keycap's active pip ("acier" / steel-grey); the glyph stays white. */
|
|
72
78
|
const DPAD_TONE = "#566273";
|
|
79
|
+
/**
|
|
80
|
+
* The ICON a pad prints on its system button, per family — because the button itself is a small round
|
|
81
|
+
* key, drawn with a symbol rather than lettered: `☰` on an Xbox pad's Menu button and on a DualSense's
|
|
82
|
+
* Options button, `+` on a Switch Pro. Only the RYDR-historic Zwift pad has no such button at all, and
|
|
83
|
+
* it borrows the hamburger.
|
|
84
|
+
*
|
|
85
|
+
* This is the ICON, not the NAME: prose still says "press Menu" / "press Options" / "press +" via
|
|
86
|
+
* {@link buttonLabel}, which stays the single home for a button's printed *text*. A button with an
|
|
87
|
+
* entry here is drawn as a round pip like the d-pad's chevron; one without (the shoulder triggers, the
|
|
88
|
+
* stick clicks) falls back to a text pill, because those really are printed with a word.
|
|
89
|
+
*/
|
|
90
|
+
const SYSTEM_ICON = (() => {
|
|
91
|
+
const HAMBURGER = `<g fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round">` +
|
|
92
|
+
`<line x1="6" y1="8" x2="18" y2="8"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="6" y1="16" x2="18" y2="16"/></g>`;
|
|
93
|
+
const PLUS = `<g fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round">` +
|
|
94
|
+
`<line x1="12" y1="6" x2="12" y2="18"/><line x1="6" y1="12" x2="18" y2="12"/></g>`;
|
|
95
|
+
return {
|
|
96
|
+
xbox: { OPTIONS: HAMBURGER },
|
|
97
|
+
playstation: { OPTIONS: HAMBURGER },
|
|
98
|
+
nintendo: { OPTIONS: PLUS },
|
|
99
|
+
zwift: { OPTIONS: HAMBURGER },
|
|
100
|
+
};
|
|
101
|
+
})();
|
|
73
102
|
const PIP = 20, PIP_ACTIVE = 38, LETTER_FONT = 23;
|
|
74
103
|
const NEUTRAL_ACTIVE = "#ffffff"; // mono active button: white face (the letter stays dark)
|
|
75
104
|
const INACTIVE = "#3a424e"; // the idle siblings in a full diamond
|
|
@@ -80,14 +109,29 @@ const INACTIVE = "#3a424e"; // the idle siblings in a full diamond
|
|
|
80
109
|
* A factory rather than a constant because the letter depends on which controller is paired; the set
|
|
81
110
|
* is resolved once when the keycap is built. See {@link buttonLabel}.
|
|
82
111
|
*/
|
|
83
|
-
const letterFaceFor = (set) => (pos, active) => {
|
|
112
|
+
const letterFaceFor = (set) => (pos, active, size) => {
|
|
84
113
|
const lt = document.createElement("span");
|
|
85
114
|
lt.className = "rydr-ui-pip-letter";
|
|
115
|
+
// Sized from the pip it sits on, not from the constant, so a `scale`d cap keeps the same
|
|
116
|
+
// letter-to-key proportion. At the default pip this is exactly LETTER_FONT.
|
|
86
117
|
if (active)
|
|
87
|
-
lt.style.fontSize = `${LETTER_FONT}px`;
|
|
118
|
+
lt.style.fontSize = `${(size * LETTER_FONT) / PIP_ACTIVE}px`;
|
|
88
119
|
lt.textContent = buttonLabel(set, BUTTON_AT[pos]);
|
|
89
120
|
return lt;
|
|
90
121
|
};
|
|
122
|
+
/** System face — the white icon the pad prints on that button (see {@link SYSTEM_ICON}). */
|
|
123
|
+
const iconFaceFor = (svgBody) => (_pos, active, size) => {
|
|
124
|
+
if (!active)
|
|
125
|
+
return null;
|
|
126
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
127
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
128
|
+
svg.setAttribute("width", String(Math.round(size * 0.62)));
|
|
129
|
+
svg.setAttribute("height", String(Math.round(size * 0.62)));
|
|
130
|
+
svg.setAttribute("class", "rydr-ui-pip-glyph");
|
|
131
|
+
svg.style.color = "#ffffff"; // white icon on the steel pip, exactly like the chevron
|
|
132
|
+
svg.innerHTML = svgBody;
|
|
133
|
+
return svg;
|
|
134
|
+
};
|
|
91
135
|
/** Directional face — a white chevron (only on the active button; siblings stay blank). */
|
|
92
136
|
const chevronFace = (pos, active, size) => {
|
|
93
137
|
if (!active)
|
|
@@ -122,19 +166,22 @@ function makePip(active, color, pos, size, animate, face) {
|
|
|
122
166
|
return pip;
|
|
123
167
|
}
|
|
124
168
|
/** Build the keycap for `activePos`; returns the element + a reference to the active pip (for state). */
|
|
125
|
-
function buildPips(activePos, variant, colored, animate, face, accent) {
|
|
169
|
+
function buildPips(activePos, variant, colored, animate, face, scale, accent) {
|
|
126
170
|
const diamond = document.createElement("div");
|
|
127
171
|
diamond.className = "rydr-ui-diamond";
|
|
128
172
|
// `accent` (used by the directional keycap) overrides the per-button hue with a fixed tone.
|
|
129
173
|
const activeColor = accent ?? (colored ? COLOR[activePos] : NEUTRAL_ACTIVE);
|
|
174
|
+
// Every dimension below derives from these two, so `scale` resizes the real geometry (and the faces,
|
|
175
|
+
// which size themselves off the pip they're drawn on) rather than transforming a full-size box.
|
|
176
|
+
const pipIdle = PIP * scale, pipActive = PIP_ACTIVE * scale;
|
|
130
177
|
if (variant === "solo") {
|
|
131
|
-
diamond.style.width = diamond.style.height = `${
|
|
132
|
-
const pip = makePip(true, activeColor, activePos,
|
|
178
|
+
diamond.style.width = diamond.style.height = `${pipActive}px`;
|
|
179
|
+
const pip = makePip(true, activeColor, activePos, pipActive, animate, face);
|
|
133
180
|
pip.style.left = pip.style.top = "0px";
|
|
134
181
|
diamond.appendChild(pip);
|
|
135
182
|
return { el: diamond, activePip: pip };
|
|
136
183
|
}
|
|
137
|
-
const ri =
|
|
184
|
+
const ri = pipIdle / 2, Ra = pipActive / 2, r0 = Ra, D = r0 + ri;
|
|
138
185
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
139
186
|
const pts = {};
|
|
140
187
|
for (const k of ["top", "lft", "rgt", "bot"]) {
|
|
@@ -169,9 +216,13 @@ function build(activePos, pressName, face, opts, accent) {
|
|
|
169
216
|
injectCss();
|
|
170
217
|
const variant = opts.variant ?? "solo";
|
|
171
218
|
const animate = opts.animate ?? true;
|
|
172
|
-
const colored = opts.colored ??
|
|
173
|
-
const
|
|
219
|
+
const colored = opts.colored ?? false; // mono is the RYDR look — see KeycapOptions.colored
|
|
220
|
+
const scale = opts.scale ?? 1;
|
|
221
|
+
const { el, activePip } = buildPips(activePos, variant, colored, animate, face, scale, accent);
|
|
174
222
|
const num = activePip.querySelector(".rydr-ui-cd-num");
|
|
223
|
+
// The countdown's type lives in CSS; scale it with the pip so a small cap's number still fits inside.
|
|
224
|
+
if (num && scale !== 1)
|
|
225
|
+
num.style.fontSize = `${18 * scale}px`;
|
|
175
226
|
const setPressed = (on) => activePip.classList.toggle("pressed", on);
|
|
176
227
|
// wire to real controller input: pressed while THIS button is held (down → pressed, up → released)
|
|
177
228
|
const off = opts.press?.onButton((e) => { if (e.name === pressName)
|
|
@@ -209,29 +260,44 @@ export function createKeycap(button, opts = {}) {
|
|
|
209
260
|
return build(POS_OF[button], button, letterFaceFor(resolveGlyphSet(opts)), opts);
|
|
210
261
|
}
|
|
211
262
|
/**
|
|
212
|
-
* Build a keycap for
|
|
213
|
-
* button (`OPTIONS`
|
|
214
|
-
*
|
|
263
|
+
* Build a keycap for the buttons that carry neither a face letter nor a direction — the system/options
|
|
264
|
+
* button (`OPTIONS`), the shoulder triggers (`LT`/`RT`) and the stick clicks
|
|
265
|
+
* (`LSTICK_PRESS`/`RSTICK_PRESS`) — drawn the way the rider's pad actually draws them:
|
|
266
|
+
*
|
|
267
|
+
* • **`OPTIONS` → a round pip with the pad's ICON** (`☰` on Xbox/DualSense, `+` on a Switch Pro).
|
|
268
|
+
* It is a small round key on every pad, so it gets the same circular pip as the d-pad's chevron and
|
|
269
|
+
* sits in the same visual family as the face buttons.
|
|
270
|
+
* • **everything else → a text PILL** carrying {@link buttonLabel} ("LT" / "L2" / "ZL", "LS" / "L3"),
|
|
271
|
+
* because those buttons really are printed with a *word*, and no word fits a pip sized for one
|
|
272
|
+
* glyph. The trigger hardware isn't round either.
|
|
215
273
|
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* rule that no letter is ever hardcoded holds here too.
|
|
274
|
+
* Either way the state machine is the pip's, reused verbatim (raised lip, pulse, pressed sink, inert
|
|
275
|
+
* grey), and nothing is hardcoded per brand: the icon comes from {@link SYSTEM_ICON} and the text from
|
|
276
|
+
* {@link buttonLabel}.
|
|
220
277
|
*
|
|
221
|
-
* Steel-grey
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
278
|
+
* Steel-grey (these are never the confirm/back hues), and — unlike the pip factories — the attract
|
|
279
|
+
* pulse is **off** unless asked for: these caps label a shortcut the rider *can* take, not an action
|
|
280
|
+
* being demanded of them. `setCooldown` is accepted for interface parity but draws nothing on the pill:
|
|
281
|
+
* these buttons open menus, they don't gate timed abilities.
|
|
225
282
|
*
|
|
226
|
-
* Pass a face-diamond or d-pad button here and you get its letter
|
|
227
|
-
* {@link createKeycap} / {@link createDpadKeycap}, which draw
|
|
283
|
+
* Pass a face-diamond or d-pad button here and you get its letter in a pill — legal, but prefer
|
|
284
|
+
* {@link createKeycap} / {@link createDpadKeycap}, which draw those buttons' real shapes.
|
|
228
285
|
*/
|
|
229
|
-
export function
|
|
286
|
+
export function createButtonKeycap(button, opts = {}) {
|
|
287
|
+
const set = resolveGlyphSet(opts);
|
|
288
|
+
const icon = SYSTEM_ICON[SYSTEM_ICON[set] ? set : DEFAULT_GLYPH_SET][button];
|
|
289
|
+
// A button the pad draws with a symbol is a ROUND KEY: reuse the pip machinery (solo variant, steel
|
|
290
|
+
// tone, icon face). `activePos` only picks the hue and the sibling layout, neither of which a solo
|
|
291
|
+
// accented pip uses — "bot" is an inert placeholder, not a claim about where the button sits.
|
|
292
|
+
if (icon)
|
|
293
|
+
return build("bot", button, iconFaceFor(icon), { ...opts, variant: "solo", animate: opts.animate ?? false }, DPAD_TONE);
|
|
230
294
|
injectCss();
|
|
231
295
|
const el = document.createElement("span");
|
|
232
296
|
el.className = "rydr-ui-cap" + (opts.animate ?? false ? " anim" : "");
|
|
233
297
|
el.style.setProperty("--c", DPAD_TONE);
|
|
234
|
-
|
|
298
|
+
if (opts.scale != null && opts.scale !== 1)
|
|
299
|
+
el.style.setProperty("--s", String(opts.scale));
|
|
300
|
+
el.textContent = buttonLabel(set, button);
|
|
235
301
|
const setPressed = (on) => { el.classList.toggle("pressed", on); };
|
|
236
302
|
const off = opts.press?.onButton((e) => { if (e.name === button)
|
|
237
303
|
setPressed(e.edge === "down"); });
|
package/dist/ui/keycap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keycap.js","sourceRoot":"","sources":["../../src/ui/keycap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAiB,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAmBxC;;;;;;;;;;;GAWG;AACH,SAAS,eAAe,CAAC,IAAmB;IAC1C,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACxC,MAAM,QAAQ,GAAI,IAAI,CAAC,KAA0E,EAAE,QAAQ,EAAE,OAAO,CAAC;IACrH,OAAO,QA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CAAC;QACrE,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;QACxD,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjE,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,2DAA2D;QAClF,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;KACzC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAc,EAAE,OAAsB,EAAE;IACvE,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* OPTION MENU — the in-game menu every RYDR game shares, opened by the game's own `OPTIONS` button.
|
|
3
3
|
*
|
|
4
4
|
* This is the GAME's menu, deliberately distinct from the PLATFORM's overlay (which the shell opens on
|
|
5
5
|
* `MENU` / `M` / phone MENU and which never reaches a game — see `ButtonName`). The platform overlay
|
|
6
6
|
* carries the rider's concerns: activity, hardware, volume, exit. This one carries the *game's*:
|
|
7
7
|
* resume, restart, back to your own menu. It deliberately quotes the platform overlay's visual language
|
|
8
|
-
* — dim + blurred backdrop, frosted rows, the staggered "warp" entrance — so
|
|
8
|
+
* — dim + blurred backdrop, frosted rows, the staggered "warp" entrance — so it reads as a RYDR
|
|
9
9
|
* surface one level shallower than the platform's, rather than as a second, unrelated menu.
|
|
10
10
|
*
|
|
11
|
-
* const
|
|
11
|
+
* const menu = mountOptionMenu(document.body, {
|
|
12
12
|
* session,
|
|
13
13
|
* title: "Split Racing",
|
|
14
14
|
* canOpen: () => phase === "playing", // the game decides WHEN it may open
|
|
@@ -23,16 +23,28 @@
|
|
|
23
23
|
* `Resume` is prepended for free, so the shortest useful menu is no items at all.
|
|
24
24
|
*
|
|
25
25
|
* **Everything the rider reads is in the GAME's font.** The title and every row inherit the host's
|
|
26
|
-
* font-family (override with the `font` option or the `--rydr-
|
|
26
|
+
* font-family (override with the `font` option or the `--rydr-option-font` custom property), because
|
|
27
27
|
* this menu belongs to the game, not to the shell — the one exception being the keycaps, which keep
|
|
28
28
|
* their standard RYDR type because they are pictures of the rider's physical controller.
|
|
29
29
|
*
|
|
30
|
+
* Inheritance being the mechanism, the host page has to actually DECLARE a font: with nothing setting
|
|
31
|
+
* `font-family` up the tree, this renders in the browser default (Times). Every real game sets a body
|
|
32
|
+
* font, so it costs nothing — but a menu that looks like a legal document is that, not a bug here.
|
|
33
|
+
*
|
|
30
34
|
* **What it does NOT do: stop your game.** No library can — your loop, timers and physics are yours.
|
|
31
35
|
* The menu tells you when it opens and closes; freeze there. What it *does* guarantee is that a game
|
|
32
36
|
* which keeps running cannot be *driven* while the rider is in the menu: it takes the controller over
|
|
33
37
|
* for the duration (`session.grabInput`), so your `onButton` handlers go quiet, `isDown`/`stick` read
|
|
34
|
-
* resting, and anything held is released first.
|
|
35
|
-
*
|
|
38
|
+
* resting, and anything held is released first.
|
|
39
|
+
*
|
|
40
|
+
* **It also does NOT touch the trainer.** Opening this menu leaves the activity state exactly as the
|
|
41
|
+
* game left it — a rider who opens it mid-run keeps the resistance they were riding. That is
|
|
42
|
+
* deliberate: this menu is a transient overlay over LIVE gameplay, not a screen the rider navigated
|
|
43
|
+
* to, and they are still on the bike with their legs turning. Dropping to the eased menu resistance
|
|
44
|
+
* and snapping back on `Resume` would change the difficulty of the very run they are deciding
|
|
45
|
+
* whether to restart. (Contrast the PLATFORM overlay, which is the shell's own and does ease.)
|
|
46
|
+
* A game that genuinely wants easing here can still do it itself in `onOpen`/`onClose` —
|
|
47
|
+
* `session.setActivity("menu")` / `("playing")` — which is more flexible than an option anyway.
|
|
36
48
|
*
|
|
37
49
|
* A row may advertise a `shortcut` — the button the rider can press *in-game* to do the same thing
|
|
38
50
|
* (`Restart · Shortcut [Y]`). Binding that shortcut during play stays the game's own job; the menu
|
|
@@ -41,12 +53,14 @@
|
|
|
41
53
|
import type { ButtonEdge, ButtonName, GlyphSet } from "../protocol/index.js";
|
|
42
54
|
import { type NavCue } from "../nav/spatial-nav.js";
|
|
43
55
|
/**
|
|
44
|
-
* The slice of a `PlatformSession` the menu uses. A real session satisfies
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
56
|
+
* The slice of a `PlatformSession` the menu uses — input, and nothing else. A real session satisfies
|
|
57
|
+
* it structurally, and `grabInput` is optional so a stand-in (a showcase double, a test) works too:
|
|
58
|
+
* without it the menu simply can't quiet the game's own input.
|
|
59
|
+
*
|
|
60
|
+
* Deliberately no `setActivity`. The menu does not touch the trainer (see the header), so asking for
|
|
61
|
+
* that capability would advertise a power it no longer uses.
|
|
48
62
|
*/
|
|
49
|
-
export interface
|
|
63
|
+
export interface OptionMenuSession {
|
|
50
64
|
onButton(cb: (e: {
|
|
51
65
|
name: ButtonName;
|
|
52
66
|
edge: ButtonEdge;
|
|
@@ -55,10 +69,9 @@ export interface PauseMenuSession {
|
|
|
55
69
|
name: ButtonName;
|
|
56
70
|
edge: ButtonEdge;
|
|
57
71
|
}) => void): () => void;
|
|
58
|
-
setActivity?(state: "playing" | "menu"): void;
|
|
59
72
|
}
|
|
60
73
|
/** One row of the menu. */
|
|
61
|
-
export interface
|
|
74
|
+
export interface OptionMenuItem {
|
|
62
75
|
/** The row's text — keep it short (it's read from a few feet away): "Restart", "Back to menu". */
|
|
63
76
|
label: string;
|
|
64
77
|
/** Run when the rider picks the row (with `A`, a click, or the row's `shortcut`). */
|
|
@@ -79,13 +92,13 @@ export interface PauseMenuItem {
|
|
|
79
92
|
* is to close first, so the action runs on a resumed game with input already handed back. */
|
|
80
93
|
keepOpen?: boolean;
|
|
81
94
|
}
|
|
82
|
-
export interface
|
|
95
|
+
export interface OptionMenuOptions {
|
|
83
96
|
/** The platform session — for input, the trainer-easing hint, and the rider's controller lettering. */
|
|
84
|
-
session?:
|
|
97
|
+
session?: OptionMenuSession;
|
|
85
98
|
/** The game's name, printed big at the top in the game's own font. */
|
|
86
99
|
title: string;
|
|
87
100
|
/** The rows after `Resume`. Replaceable at any time with `setItems`. */
|
|
88
|
-
items?:
|
|
101
|
+
items?: OptionMenuItem[];
|
|
89
102
|
/** Which button opens (and closes) the menu. Default `"OPTIONS"` — the game's own menu button. */
|
|
90
103
|
openButton?: ButtonName;
|
|
91
104
|
/**
|
|
@@ -96,9 +109,6 @@ export interface PauseMenuOptions {
|
|
|
96
109
|
canOpen?: () => boolean;
|
|
97
110
|
/** Label of the free first row. Default `"Resume"`. */
|
|
98
111
|
resumeLabel?: string;
|
|
99
|
-
/** Declare `"menu"` to the shell while open and `"playing"` on close (eases trainer resistance).
|
|
100
|
-
* Default `true`. Turn it off only if the game manages activity state itself around the menu. */
|
|
101
|
-
activity?: boolean;
|
|
102
112
|
/** Take the controller over while open via `session.grabInput` (default `true`). Off = the game keeps
|
|
103
113
|
* receiving input behind the menu, which it must then ignore itself. */
|
|
104
114
|
captureInput?: boolean;
|
|
@@ -114,7 +124,7 @@ export interface PauseMenuOptions {
|
|
|
114
124
|
/** The menu closed (resume, back, the backdrop, or a row that ran) — unfreeze here. */
|
|
115
125
|
onClose?: () => void;
|
|
116
126
|
}
|
|
117
|
-
export interface
|
|
127
|
+
export interface OptionMenu {
|
|
118
128
|
/** The overlay root (mounted in the host; hidden while closed). */
|
|
119
129
|
root: HTMLElement;
|
|
120
130
|
/** Open it (no-op if already open or `canOpen` refuses). Returns whether it opened. */
|
|
@@ -125,7 +135,7 @@ export interface PauseMenu {
|
|
|
125
135
|
toggle(): boolean;
|
|
126
136
|
isOpen(): boolean;
|
|
127
137
|
/** Replace the rows after `Resume` (rebuilt live if the menu is open). */
|
|
128
|
-
setItems(items:
|
|
138
|
+
setItems(items: OptionMenuItem[]): void;
|
|
129
139
|
/** Change the big title. */
|
|
130
140
|
setTitle(title: string): void;
|
|
131
141
|
/**
|
|
@@ -137,8 +147,8 @@ export interface PauseMenu {
|
|
|
137
147
|
dispose(): void;
|
|
138
148
|
}
|
|
139
149
|
/**
|
|
140
|
-
* Mount the
|
|
150
|
+
* Mount the option menu (hidden until opened). Appended to `host` — normally `document.body`, so the
|
|
141
151
|
* overlay covers the game whatever the DOM under it looks like.
|
|
142
152
|
*/
|
|
143
|
-
export declare function
|
|
144
|
-
//# sourceMappingURL=
|
|
153
|
+
export declare function mountOptionMenu(host: HTMLElement, opts: OptionMenuOptions): OptionMenu;
|
|
154
|
+
//# sourceMappingURL=option-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option-menu.d.ts","sourceRoot":"","sources":["../../src/ui/option-menu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAoB,KAAK,MAAM,EAAmB,MAAM,uBAAuB,CAAC;AAYvF;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC9E,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC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