like2d 2.7.4 → 2.9.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 +34 -35
- package/dist/core/audio.d.ts +12 -9
- package/dist/core/audio.d.ts.map +1 -1
- package/dist/core/audio.js +7 -4
- package/dist/core/canvas.d.ts +58 -0
- package/dist/core/canvas.d.ts.map +1 -0
- package/dist/core/canvas.js +209 -0
- package/dist/core/events.d.ts +92 -7
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/events.js +20 -0
- package/dist/core/gamepad-mapping.d.ts +57 -18
- package/dist/core/gamepad-mapping.d.ts.map +1 -1
- package/dist/core/gamepad-mapping.js +23 -223
- package/dist/core/gamepad.d.ts +34 -58
- package/dist/core/gamepad.d.ts.map +1 -1
- package/dist/core/gamepad.js +79 -213
- package/dist/core/graphics.d.ts +175 -64
- package/dist/core/graphics.d.ts.map +1 -1
- package/dist/core/graphics.js +294 -198
- package/dist/core/input-state.d.ts +2 -2
- package/dist/core/input-state.d.ts.map +1 -1
- package/dist/core/input.d.ts +22 -15
- package/dist/core/input.d.ts.map +1 -1
- package/dist/core/input.js +25 -37
- package/dist/core/keyboard.d.ts +7 -7
- package/dist/core/keyboard.d.ts.map +1 -1
- package/dist/core/keyboard.js +24 -31
- package/dist/core/like.d.ts +98 -44
- package/dist/core/like.d.ts.map +1 -1
- package/dist/core/like.js +8 -0
- package/dist/core/mouse.d.ts +45 -22
- package/dist/core/mouse.d.ts.map +1 -1
- package/dist/core/mouse.js +90 -78
- package/dist/core/timer.d.ts +2 -5
- package/dist/core/timer.d.ts.map +1 -1
- package/dist/core/timer.js +2 -14
- package/dist/engine.d.ts +61 -11
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +119 -102
- package/dist/index.d.ts +42 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -14
- package/dist/math/index.d.ts +2 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math/index.js +1 -0
- package/dist/math/rect.d.ts +71 -0
- package/dist/math/rect.d.ts.map +1 -0
- package/dist/{core → math}/rect.js +8 -0
- package/dist/math/vector2.d.ts +78 -0
- package/dist/math/vector2.d.ts.map +1 -0
- package/dist/{core → math}/vector2.js +24 -0
- package/dist/prefab-scenes/index.d.ts +7 -0
- package/dist/prefab-scenes/index.d.ts.map +1 -0
- package/dist/prefab-scenes/index.js +6 -0
- package/dist/prefab-scenes/startScreen.d.ts +59 -0
- package/dist/prefab-scenes/startScreen.d.ts.map +1 -0
- package/dist/{scenes/startup.js → prefab-scenes/startScreen.js} +47 -7
- package/dist/scene.d.ts +103 -5
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +28 -1
- package/package.json +18 -2
- package/dist/core/canvas-config.d.ts +0 -22
- package/dist/core/canvas-config.d.ts.map +0 -1
- package/dist/core/canvas-config.js +0 -14
- package/dist/core/canvas-manager.d.ts +0 -25
- package/dist/core/canvas-manager.d.ts.map +0 -1
- package/dist/core/canvas-manager.js +0 -178
- package/dist/core/gamepad-buttons.d.ts +0 -23
- package/dist/core/gamepad-buttons.d.ts.map +0 -1
- package/dist/core/gamepad-buttons.js +0 -36
- package/dist/core/rect.d.ts +0 -26
- package/dist/core/rect.d.ts.map +0 -1
- package/dist/core/vector2.d.ts +0 -26
- package/dist/core/vector2.d.ts.map +0 -1
- package/dist/gamecontrollerdb.txt +0 -2221
- package/dist/scenes/startup.d.ts +0 -18
- package/dist/scenes/startup.d.ts.map +0 -1
|
@@ -1,19 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
declare const buttonMap: readonly [{
|
|
2
|
+
readonly like: "ButtonBottom";
|
|
3
|
+
readonly num: number;
|
|
4
|
+
}, {
|
|
5
|
+
readonly like: "ButtonRight";
|
|
6
|
+
readonly num: 1;
|
|
7
|
+
}, {
|
|
8
|
+
readonly like: "ButtonLeft";
|
|
9
|
+
readonly num: 2;
|
|
10
|
+
}, {
|
|
11
|
+
readonly like: "ButtonTop";
|
|
12
|
+
readonly num: 3;
|
|
13
|
+
}, {
|
|
14
|
+
readonly like: "ButtonL1";
|
|
15
|
+
readonly num: 4;
|
|
16
|
+
}, {
|
|
17
|
+
readonly like: "ButtonR1";
|
|
18
|
+
readonly num: 5;
|
|
19
|
+
}, {
|
|
20
|
+
readonly like: "ButtonL2";
|
|
21
|
+
readonly num: 6;
|
|
22
|
+
}, {
|
|
23
|
+
readonly like: "ButtonR2";
|
|
24
|
+
readonly num: 7;
|
|
25
|
+
}, {
|
|
26
|
+
readonly like: "ButtonMenuLeft";
|
|
27
|
+
readonly num: 8;
|
|
28
|
+
}, {
|
|
29
|
+
readonly like: "ButtonMenuRight";
|
|
30
|
+
readonly num: 9;
|
|
31
|
+
}, {
|
|
32
|
+
readonly like: "ButtonMenuCenter";
|
|
33
|
+
readonly num: 16;
|
|
34
|
+
}, {
|
|
35
|
+
readonly like: "ButtonLeftStick";
|
|
36
|
+
readonly num: 10;
|
|
37
|
+
}, {
|
|
38
|
+
readonly like: "ButtonRightStick";
|
|
39
|
+
readonly num: 11;
|
|
40
|
+
}, {
|
|
41
|
+
readonly like: "DPadUp";
|
|
42
|
+
readonly num: 12;
|
|
43
|
+
}, {
|
|
44
|
+
readonly like: "DPadDown";
|
|
45
|
+
readonly num: 13;
|
|
46
|
+
}, {
|
|
47
|
+
readonly like: "DPadLeft";
|
|
48
|
+
readonly num: 14;
|
|
49
|
+
}, {
|
|
50
|
+
readonly like: "DPadRight";
|
|
51
|
+
readonly num: 15;
|
|
52
|
+
}];
|
|
53
|
+
type extraButton = `Button${number}`;
|
|
54
|
+
export type LikeButton = (typeof buttonMap)[number]["like"] | extraButton;
|
|
55
|
+
export declare const numberToName: Map<number, LikeButton>;
|
|
56
|
+
export declare const nameToNumber: Map<LikeButton, number>;
|
|
57
|
+
export {};
|
|
19
58
|
//# sourceMappingURL=gamepad-mapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gamepad-mapping.d.ts","sourceRoot":"","sources":["../../src/core/gamepad-mapping.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gamepad-mapping.d.ts","sourceRoot":"","sources":["../../src/core/gamepad-mapping.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS;;kBACqB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBhC,CAAC;AAEX,KAAK,WAAW,GAAG,SAAS,MAAM,EAAE,CAAC;AAErC,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAE1E,eAAO,MAAM,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAEhD,CAAC;AACF,eAAO,MAAM,YAAY,EAAE,GAAG,CAAC,UAAU,EAAE,MAAM,CAEhD,CAAC"}
|
|
@@ -1,223 +1,23 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
// Internal database for storing pre-built controller mappings
|
|
25
|
-
class GamepadDatabase {
|
|
26
|
-
constructor() {
|
|
27
|
-
// vendorProductKey -> mapping
|
|
28
|
-
Object.defineProperty(this, "mappings", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
configurable: true,
|
|
31
|
-
writable: true,
|
|
32
|
-
value: new Map()
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(this, "loaded", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true,
|
|
38
|
-
value: false
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
load(dbContent) {
|
|
42
|
-
this.mappings.clear();
|
|
43
|
-
const lines = dbContent.split('\n');
|
|
44
|
-
for (const line of lines) {
|
|
45
|
-
const trimmed = line.trim();
|
|
46
|
-
if (!trimmed || trimmed.startsWith('#')) {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
const mapping = this.parseLine(trimmed);
|
|
50
|
-
if (mapping) {
|
|
51
|
-
// Extract vendor/product from GUID and store mapping
|
|
52
|
-
const guid = line.split(',')[0].toLowerCase().trim();
|
|
53
|
-
const vpKey = this.extractVendorProductKey(guid);
|
|
54
|
-
if (vpKey !== null && !this.mappings.has(vpKey)) {
|
|
55
|
-
this.mappings.set(vpKey, mapping);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
this.loaded = true;
|
|
60
|
-
}
|
|
61
|
-
extractVendorProductKey(guid) {
|
|
62
|
-
if (guid.length < 20)
|
|
63
|
-
return null;
|
|
64
|
-
const vendorHex = guid.substring(8, 12);
|
|
65
|
-
const productHex = guid.substring(16, 20);
|
|
66
|
-
const vendor = parseInt(vendorHex.substring(2, 4) + vendorHex.substring(0, 2), 16);
|
|
67
|
-
const product = parseInt(productHex.substring(2, 4) + productHex.substring(0, 2), 16);
|
|
68
|
-
if (isNaN(vendor) || isNaN(product))
|
|
69
|
-
return null;
|
|
70
|
-
return 0x10000 * vendor + product;
|
|
71
|
-
}
|
|
72
|
-
isLoaded() {
|
|
73
|
-
return this.loaded;
|
|
74
|
-
}
|
|
75
|
-
getMappingCount() {
|
|
76
|
-
return this.mappings.size;
|
|
77
|
-
}
|
|
78
|
-
getMapping(vendor, product) {
|
|
79
|
-
const key = 0x10000 * vendor + product;
|
|
80
|
-
return this.mappings.get(key);
|
|
81
|
-
}
|
|
82
|
-
parseLine(line) {
|
|
83
|
-
const parts = line.split(',');
|
|
84
|
-
if (parts.length < 3) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const name = parts[1].trim();
|
|
88
|
-
const toStandard = new Map();
|
|
89
|
-
// Parse mapping pairs (key:value)
|
|
90
|
-
for (let i = 2; i < parts.length; i++) {
|
|
91
|
-
const part = parts[i].trim();
|
|
92
|
-
if (!part || part.startsWith('platform:'))
|
|
93
|
-
continue;
|
|
94
|
-
const colonIndex = part.indexOf(':');
|
|
95
|
-
if (colonIndex === -1)
|
|
96
|
-
continue;
|
|
97
|
-
const sdlName = part.substring(0, colonIndex).trim();
|
|
98
|
-
const value = part.substring(colonIndex + 1).trim();
|
|
99
|
-
if (!sdlName || !value)
|
|
100
|
-
continue;
|
|
101
|
-
// Only handle button mappings (b0, b1, etc.)
|
|
102
|
-
if (value.startsWith('b')) {
|
|
103
|
-
const controllerIndex = parseInt(value.substring(1), 10);
|
|
104
|
-
const gpIndex = SDL_TO_GP[sdlName];
|
|
105
|
-
if (!isNaN(controllerIndex) && gpIndex !== undefined) {
|
|
106
|
-
toStandard.set(controllerIndex, gpIndex);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return { name, toStandard };
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Singleton instance
|
|
114
|
-
const gamepadDatabase = new GamepadDatabase();
|
|
115
|
-
export class GamepadMapping {
|
|
116
|
-
constructor() {
|
|
117
|
-
Object.defineProperty(this, "dbLoaded", {
|
|
118
|
-
enumerable: true,
|
|
119
|
-
configurable: true,
|
|
120
|
-
writable: true,
|
|
121
|
-
value: false
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
async loadDatabase() {
|
|
125
|
-
if (this.dbLoaded)
|
|
126
|
-
return;
|
|
127
|
-
try {
|
|
128
|
-
const res = await fetch('./gamecontrollerdb.txt');
|
|
129
|
-
if (res.ok) {
|
|
130
|
-
const text = await res.text();
|
|
131
|
-
// Validate it's actually the DB file, not HTML error page
|
|
132
|
-
if (text.startsWith('# Game Controller DB') || text.includes('03000000')) {
|
|
133
|
-
gamepadDatabase.load(text);
|
|
134
|
-
this.dbLoaded = true;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
catch { }
|
|
139
|
-
if (!this.dbLoaded) {
|
|
140
|
-
try {
|
|
141
|
-
// @ts-ignore - Vite handles ?raw imports
|
|
142
|
-
const module = await import('../gamecontrollerdb.txt?raw');
|
|
143
|
-
if (typeof module.default === 'string') {
|
|
144
|
-
gamepadDatabase.load(module.default);
|
|
145
|
-
this.dbLoaded = true;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
catch { }
|
|
149
|
-
}
|
|
150
|
-
if (this.dbLoaded) {
|
|
151
|
-
console.log(`[Gamepad] Loaded ${gamepadDatabase.getMappingCount()} controller mappings`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
loadDatabaseFromText(content) {
|
|
155
|
-
gamepadDatabase.load(content);
|
|
156
|
-
this.dbLoaded = true;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Get button mapping for a specific gamepad
|
|
160
|
-
*/
|
|
161
|
-
getMapping(gamepad) {
|
|
162
|
-
const vp = this.extractVendorProduct(gamepad);
|
|
163
|
-
// If browser provides "standard" mapping, use identity mapping
|
|
164
|
-
if (gamepad.mapping === 'standard') {
|
|
165
|
-
return {
|
|
166
|
-
toStandard: IDENTITY_MAP,
|
|
167
|
-
controllerName: gamepad.id,
|
|
168
|
-
hasMapping: true,
|
|
169
|
-
vendor: vp?.vendor ?? null,
|
|
170
|
-
product: vp?.product ?? null,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
// Look up in database
|
|
174
|
-
if (vp && this.dbLoaded) {
|
|
175
|
-
const dbMapping = gamepadDatabase.getMapping(vp.vendor, vp.product);
|
|
176
|
-
if (dbMapping) {
|
|
177
|
-
return {
|
|
178
|
-
toStandard: dbMapping.toStandard,
|
|
179
|
-
controllerName: dbMapping.name,
|
|
180
|
-
hasMapping: true,
|
|
181
|
-
vendor: vp.vendor,
|
|
182
|
-
product: vp.product,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
// No mapping found - use identity
|
|
187
|
-
return {
|
|
188
|
-
toStandard: IDENTITY_MAP,
|
|
189
|
-
controllerName: gamepad.id,
|
|
190
|
-
hasMapping: false,
|
|
191
|
-
vendor: vp?.vendor ?? null,
|
|
192
|
-
product: vp?.product ?? null,
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
extractVendorProduct(gamepad) {
|
|
196
|
-
const id = gamepad.id;
|
|
197
|
-
const vendorProductMatch = id.match(/Vendor:\s*([0-9a-fA-F]+)\s+Product:\s*([0-9a-fA-F]+)/i);
|
|
198
|
-
if (vendorProductMatch) {
|
|
199
|
-
const vendor = parseInt(vendorProductMatch[1], 16);
|
|
200
|
-
const product = parseInt(vendorProductMatch[2], 16);
|
|
201
|
-
if (!isNaN(vendor) && !isNaN(product)) {
|
|
202
|
-
return { vendor, product };
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
const hexMatch = id.match(/^([0-9a-fA-F]{4})[\s-]+([0-9a-fA-F]{4})/);
|
|
206
|
-
if (hexMatch) {
|
|
207
|
-
const vendor = parseInt(hexMatch[1], 16);
|
|
208
|
-
const product = parseInt(hexMatch[2], 16);
|
|
209
|
-
if (!isNaN(vendor) && !isNaN(product)) {
|
|
210
|
-
return { vendor, product };
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
// Reusable identity map for standard/unmapped controllers
|
|
217
|
-
const IDENTITY_MAP = new Map([
|
|
218
|
-
[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7],
|
|
219
|
-
[8, 8], [9, 9], [10, 10], [11, 11], [12, 12], [13, 13], [14, 14], [15, 15],
|
|
220
|
-
[16, 16], [17, 17], [18, 18], [19, 19],
|
|
221
|
-
]);
|
|
222
|
-
// Singleton instance
|
|
223
|
-
export const gamepadMapping = new GamepadMapping();
|
|
1
|
+
// Friendlier names for the buttons.
|
|
2
|
+
// https://www.w3.org/TR/gamepad/#dfn-standard-gamepad
|
|
3
|
+
const buttonMap = [
|
|
4
|
+
{ like: "ButtonBottom", num: 0 },
|
|
5
|
+
{ like: "ButtonRight", num: 1 },
|
|
6
|
+
{ like: "ButtonLeft", num: 2 },
|
|
7
|
+
{ like: "ButtonTop", num: 3 },
|
|
8
|
+
{ like: "ButtonL1", num: 4 },
|
|
9
|
+
{ like: "ButtonR1", num: 5 },
|
|
10
|
+
{ like: "ButtonL2", num: 6 },
|
|
11
|
+
{ like: "ButtonR2", num: 7 },
|
|
12
|
+
{ like: "ButtonMenuLeft", num: 8 },
|
|
13
|
+
{ like: "ButtonMenuRight", num: 9 },
|
|
14
|
+
{ like: "ButtonMenuCenter", num: 16 },
|
|
15
|
+
{ like: "ButtonLeftStick", num: 10 },
|
|
16
|
+
{ like: "ButtonRightStick", num: 11 },
|
|
17
|
+
{ like: "DPadUp", num: 12 },
|
|
18
|
+
{ like: "DPadDown", num: 13 },
|
|
19
|
+
{ like: "DPadLeft", num: 14 },
|
|
20
|
+
{ like: "DPadRight", num: 15 },
|
|
21
|
+
];
|
|
22
|
+
export const numberToName = new Map(buttonMap.map(({ like, num }) => [num, like]));
|
|
23
|
+
export const nameToNumber = new Map(buttonMap.map(({ like, num }) => [like, num]));
|
package/dist/core/gamepad.d.ts
CHANGED
|
@@ -1,61 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { LikeButton } from './gamepad-mapping';
|
|
2
|
+
import { EngineDispatch } from '../engine';
|
|
3
|
+
export type { LikeButton };
|
|
4
|
+
/** A selector for a gamepad. */
|
|
5
|
+
export type GamepadTarget = number;
|
|
6
|
+
export type ButtonTracker = {
|
|
7
|
+
prev: Set<number>;
|
|
8
|
+
current: Set<number>;
|
|
9
|
+
};
|
|
10
|
+
/** LIKE Gamepad Wrapper
|
|
11
|
+
*
|
|
12
|
+
* - Allows events/callbacks to be sent from joy buttons
|
|
13
|
+
* - Extends stateful API with justPressed
|
|
14
|
+
*
|
|
15
|
+
* # Examples
|
|
16
|
+
*
|
|
17
|
+
* ### Binding events
|
|
18
|
+
* ```ts
|
|
19
|
+
* like.gamepadpressed = (idx: number, _num: number, button: string) => {
|
|
20
|
+
* console.log(`Button ${button} pressed on controller ${idx}`);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class GamepadInternal {
|
|
25
|
+
private dispatch;
|
|
10
26
|
private buttonTrackers;
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
private handleGamepadConnected;
|
|
21
|
-
private handleGamepadDisconnected;
|
|
22
|
-
private handleBlur;
|
|
23
|
-
setCallbacks(callbacks: {
|
|
24
|
-
onConnected?: (gamepad: globalThis.Gamepad) => void;
|
|
25
|
-
onDisconnected?: (gamepadIndex: number) => void;
|
|
26
|
-
}): void;
|
|
27
|
-
dispose(): void;
|
|
28
|
-
init(): Promise<void>;
|
|
29
|
-
private onGamepadConnectedInternal;
|
|
30
|
-
private onGamepadDisconnectedInternal;
|
|
31
|
-
update(): void;
|
|
32
|
-
isConnected(gamepadIndex: number): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Check if a button is currently pressed on a specific gamepad
|
|
35
|
-
* Uses mapped button indices (standard layout)
|
|
36
|
-
*/
|
|
37
|
-
isButtonDown(gamepadIndex: number, buttonIndex: number): boolean;
|
|
38
|
-
isButtonDownOnAny(buttonIndex: number): boolean;
|
|
39
|
-
getPressedButtons(gamepadIndex: number): Set<number>;
|
|
40
|
-
getConnectedGamepads(): number[];
|
|
41
|
-
/**
|
|
42
|
-
* Get the raw Gamepad object for a specific index
|
|
43
|
-
*/
|
|
44
|
-
getGamepad(gamepadIndex: number): globalThis.Gamepad | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Get the button mapping for a specific gamepad
|
|
47
|
-
*/
|
|
48
|
-
getButtonMapping(gamepadIndex: number): ButtonMapping | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Check if a gamepad has a known mapping from the database
|
|
51
|
-
*/
|
|
52
|
-
hasMapping(gamepadIndex: number): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Get the controller name for a specific gamepad
|
|
55
|
-
*/
|
|
56
|
-
getControllerName(gamepadIndex: number): string | undefined;
|
|
57
|
-
getAxis(gamepadIndex: number, axisIndex: number): number;
|
|
58
|
-
getLeftStick(gamepadIndex: number): StickPosition;
|
|
59
|
-
getRightStick(gamepadIndex: number): StickPosition;
|
|
27
|
+
private abort;
|
|
28
|
+
constructor(dispatch: EngineDispatch);
|
|
29
|
+
_update(): void;
|
|
30
|
+
isButtonDown(target: GamepadTarget, buttonRaw: number | LikeButton): boolean | undefined;
|
|
31
|
+
isButtonJustPressed(target: GamepadTarget, buttonRaw: LikeButton): boolean | undefined;
|
|
32
|
+
getGamepad(target: number): Gamepad | null;
|
|
33
|
+
_dispose(): void;
|
|
34
|
+
static getButtonName(button: number | LikeButton): LikeButton;
|
|
35
|
+
static getButtonNumber(button: number | LikeButton): number;
|
|
60
36
|
}
|
|
61
37
|
//# sourceMappingURL=gamepad.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gamepad.d.ts","sourceRoot":"","sources":["../../src/core/gamepad.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"gamepad.d.ts","sourceRoot":"","sources":["../../src/core/gamepad.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA8B,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,gCAAgC;AAChC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACtB,CAAA;AAKD;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAe;IAId,OAAO,CAAC,QAAQ;IAH5B,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,KAAK,CAAyB;gBAElB,QAAQ,EAAE,cAAc;IAwB5C,OAAO,IAAI,IAAI;IA4Bf,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS;IAKxF,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,GAAG,SAAS;IAQtF,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAI1C,QAAQ,IAAI,IAAI;WAIF,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU;WAMtD,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM;CAMnE"}
|