@myeiter/mcy-web 0.0.1
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/License.txt +21 -0
- package/README.md +1 -0
- package/dist/app/app.d.ts +3 -0
- package/dist/app/app.d.ts.map +1 -0
- package/dist/app/app.js +19 -0
- package/dist/app/app.js.map +1 -0
- package/dist/app/drawing.d.ts +35 -0
- package/dist/app/drawing.d.ts.map +1 -0
- package/dist/app/drawing.js +173 -0
- package/dist/app/drawing.js.map +1 -0
- package/dist/app/input.d.ts +164 -0
- package/dist/app/input.d.ts.map +1 -0
- package/dist/app/input.js +266 -0
- package/dist/app/input.js.map +1 -0
- package/dist/backend.d.ts +48 -0
- package/dist/backend.d.ts.map +1 -0
- package/dist/backend.js +198 -0
- package/dist/backend.js.map +1 -0
- package/dist/core/containers.d.ts +3 -0
- package/dist/core/containers.d.ts.map +1 -0
- package/dist/core/containers.js +17 -0
- package/dist/core/containers.js.map +1 -0
- package/dist/core/core.d.ts +7 -0
- package/dist/core/core.d.ts.map +1 -0
- package/dist/core/core.js +23 -0
- package/dist/core/core.js.map +1 -0
- package/dist/core/error.d.ts +6 -0
- package/dist/core/error.d.ts.map +1 -0
- package/dist/core/error.js +26 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/math.d.ts +20 -0
- package/dist/core/math.d.ts.map +1 -0
- package/dist/core/math.js +48 -0
- package/dist/core/math.js.map +1 -0
- package/dist/core/serialization.d.ts +10 -0
- package/dist/core/serialization.d.ts.map +1 -0
- package/dist/core/serialization.js +86 -0
- package/dist/core/serialization.js.map +1 -0
- package/dist/core/string.d.ts +8 -0
- package/dist/core/string.d.ts.map +1 -0
- package/dist/core/string.js +47 -0
- package/dist/core/string.js.map +1 -0
- package/dist/core/time.d.ts +5 -0
- package/dist/core/time.d.ts.map +1 -0
- package/dist/core/time.js +32 -0
- package/dist/core/time.js.map +1 -0
- package/dist/misc.d.ts +2 -0
- package/dist/misc.d.ts.map +1 -0
- package/dist/misc.js +3 -0
- package/dist/misc.js.map +1 -0
- package/package.json +69 -0
package/License.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Michael Yeiter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This is a personal set of utilities I use for my own project.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAe,SAAS,CAAA"}
|
package/dist/app/app.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./drawing"), exports);
|
|
18
|
+
__exportStar(require("./input"), exports);
|
|
19
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,0CAAwB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { V2 } from "../core/math";
|
|
2
|
+
export declare enum RectAlign {
|
|
3
|
+
NONE = 0,
|
|
4
|
+
LEFT_BOTTOM = 1,
|
|
5
|
+
LEFT_MIDDLE = 2,
|
|
6
|
+
LEFT_TOP = 3,
|
|
7
|
+
CENTER_TOP = 4,
|
|
8
|
+
CENTER_BOTTOM = 5,
|
|
9
|
+
RIGHT_BOTTOM = 6,
|
|
10
|
+
RIGHT_MIDDLE = 7,
|
|
11
|
+
RIGHT_TOP = 8,
|
|
12
|
+
CENTER_MIDDLE = 9
|
|
13
|
+
}
|
|
14
|
+
export type Rect = {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
w: number;
|
|
18
|
+
h: number;
|
|
19
|
+
align: RectAlign;
|
|
20
|
+
};
|
|
21
|
+
export declare function RectClone(rect: Rect): Rect;
|
|
22
|
+
export declare function RectCloneWithPos(rect: Rect, x: number, y: number): Rect;
|
|
23
|
+
export declare function DrawRect(ctx: CanvasRenderingContext2D, rect: Rect): void;
|
|
24
|
+
export declare function RectNormalizded(rect: Rect): Rect;
|
|
25
|
+
export declare function PositionInRectBounds(pos: V2, rect: Rect): boolean;
|
|
26
|
+
export declare function DebugDrawBoundingBoxInRecursion(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, level: number, showLevel0?: boolean): void;
|
|
27
|
+
export declare function DebugDrawBounds(ctx: CanvasRenderingContext2D, bounds: Rect, color: string): void;
|
|
28
|
+
export declare function DrawLineV2(ctx: CanvasRenderingContext2D, startPos: V2, endPos: V2): void;
|
|
29
|
+
export declare function DrawLine(ctx: CanvasRenderingContext2D, x1: number, y1: number, x2: number, y2: number, lineWidth: number): void;
|
|
30
|
+
export declare function FillBoundingRect(ctx: CanvasRenderingContext2D, bounds: Rect, color: string): void;
|
|
31
|
+
export declare function DrawLineArrow(ctx: CanvasRenderingContext2D, x1: number, y1: number, x2: number, y2: number, headLength: number, thickness: number): void;
|
|
32
|
+
export declare class DrawingException extends Error {
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=drawing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawing.d.ts","sourceRoot":"","sources":["../../src/app/drawing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAEhC,oBAAY,SAAS;IAEjB,IAAI,IAAA;IACJ,WAAW,IAAA;IACX,WAAW,IAAA;IACX,QAAQ,IAAA;IACR,UAAU,IAAA;IACV,aAAa,IAAA;IACb,YAAY,IAAA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AAM,QASxH;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,wBAAwB,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,QAM1F;AAED,wBAAgB,aAAa,CACzB,GAAG,EAAE,wBAAwB,EAC7B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAClB,IAAI,CAqCN;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAE3B,OAAO,EAAE,MAAM;CAI9B"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DrawingException = exports.RectAlign = void 0;
|
|
4
|
+
exports.RectClone = RectClone;
|
|
5
|
+
exports.RectCloneWithPos = RectCloneWithPos;
|
|
6
|
+
exports.DrawRect = DrawRect;
|
|
7
|
+
exports.RectNormalizded = RectNormalizded;
|
|
8
|
+
exports.PositionInRectBounds = PositionInRectBounds;
|
|
9
|
+
exports.DebugDrawBoundingBoxInRecursion = DebugDrawBoundingBoxInRecursion;
|
|
10
|
+
exports.DebugDrawBounds = DebugDrawBounds;
|
|
11
|
+
exports.DrawLineV2 = DrawLineV2;
|
|
12
|
+
exports.DrawLine = DrawLine;
|
|
13
|
+
exports.FillBoundingRect = FillBoundingRect;
|
|
14
|
+
exports.DrawLineArrow = DrawLineArrow;
|
|
15
|
+
var RectAlign;
|
|
16
|
+
(function (RectAlign) {
|
|
17
|
+
RectAlign[RectAlign["NONE"] = 0] = "NONE";
|
|
18
|
+
RectAlign[RectAlign["LEFT_BOTTOM"] = 1] = "LEFT_BOTTOM";
|
|
19
|
+
RectAlign[RectAlign["LEFT_MIDDLE"] = 2] = "LEFT_MIDDLE";
|
|
20
|
+
RectAlign[RectAlign["LEFT_TOP"] = 3] = "LEFT_TOP";
|
|
21
|
+
RectAlign[RectAlign["CENTER_TOP"] = 4] = "CENTER_TOP";
|
|
22
|
+
RectAlign[RectAlign["CENTER_BOTTOM"] = 5] = "CENTER_BOTTOM";
|
|
23
|
+
RectAlign[RectAlign["RIGHT_BOTTOM"] = 6] = "RIGHT_BOTTOM";
|
|
24
|
+
RectAlign[RectAlign["RIGHT_MIDDLE"] = 7] = "RIGHT_MIDDLE";
|
|
25
|
+
RectAlign[RectAlign["RIGHT_TOP"] = 8] = "RIGHT_TOP";
|
|
26
|
+
RectAlign[RectAlign["CENTER_MIDDLE"] = 9] = "CENTER_MIDDLE";
|
|
27
|
+
})(RectAlign || (exports.RectAlign = RectAlign = {}));
|
|
28
|
+
function RectClone(rect) {
|
|
29
|
+
let result = {
|
|
30
|
+
x: rect.x,
|
|
31
|
+
y: rect.y,
|
|
32
|
+
w: rect.w,
|
|
33
|
+
h: rect.h,
|
|
34
|
+
align: rect.align,
|
|
35
|
+
};
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
function RectCloneWithPos(rect, x, y) {
|
|
39
|
+
let result = {
|
|
40
|
+
x: 0,
|
|
41
|
+
y: 0,
|
|
42
|
+
w: 0,
|
|
43
|
+
h: 0,
|
|
44
|
+
align: rect.align,
|
|
45
|
+
};
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
function DrawRect(ctx, rect) {
|
|
49
|
+
const adjustedRect = RectNormalizded(rect);
|
|
50
|
+
ctx.fillRect(adjustedRect.x, adjustedRect.y, adjustedRect.w, adjustedRect.h);
|
|
51
|
+
}
|
|
52
|
+
function RectNormalizded(rect) {
|
|
53
|
+
let result = RectClone(rect);
|
|
54
|
+
switch (result.align) {
|
|
55
|
+
case RectAlign.NONE:
|
|
56
|
+
break;
|
|
57
|
+
case RectAlign.LEFT_BOTTOM:
|
|
58
|
+
rect.y -= rect.h;
|
|
59
|
+
break;
|
|
60
|
+
case RectAlign.LEFT_MIDDLE:
|
|
61
|
+
rect.y -= rect.h / 2;
|
|
62
|
+
break;
|
|
63
|
+
case RectAlign.LEFT_TOP:
|
|
64
|
+
break;
|
|
65
|
+
case RectAlign.CENTER_TOP:
|
|
66
|
+
rect.x -= rect.w / 2;
|
|
67
|
+
break;
|
|
68
|
+
case RectAlign.CENTER_BOTTOM:
|
|
69
|
+
rect.x -= rect.w / 2;
|
|
70
|
+
rect.y -= rect.h;
|
|
71
|
+
break;
|
|
72
|
+
case RectAlign.RIGHT_BOTTOM:
|
|
73
|
+
rect.x -= rect.w;
|
|
74
|
+
rect.y -= rect.h;
|
|
75
|
+
break;
|
|
76
|
+
case RectAlign.RIGHT_MIDDLE:
|
|
77
|
+
rect.x -= rect.w;
|
|
78
|
+
rect.y -= rect.h / 2;
|
|
79
|
+
break;
|
|
80
|
+
case RectAlign.RIGHT_TOP:
|
|
81
|
+
rect.x -= rect.w;
|
|
82
|
+
break;
|
|
83
|
+
case RectAlign.CENTER_MIDDLE:
|
|
84
|
+
rect.x -= rect.w / 2;
|
|
85
|
+
rect.y -= rect.h / 2;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
rect.align = RectAlign.LEFT_TOP;
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
function PositionInRectBounds(pos, rect) {
|
|
92
|
+
let result = pos.x >= rect.x && pos.x <= rect.x + rect.x
|
|
93
|
+
&& pos.y >= rect.y && pos.y <= rect.y + rect.y;
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
function DebugDrawBoundingBoxInRecursion(ctx, x, y, w, h, level, showLevel0 = true) {
|
|
97
|
+
if (level == 0 && !showLevel0)
|
|
98
|
+
return;
|
|
99
|
+
ctx.save();
|
|
100
|
+
if (level == 0)
|
|
101
|
+
ctx.strokeStyle = "red";
|
|
102
|
+
else if (level == 1)
|
|
103
|
+
ctx.strokeStyle = "orange";
|
|
104
|
+
else if (level == 1)
|
|
105
|
+
ctx.strokeStyle = "blue";
|
|
106
|
+
else if (level == 1)
|
|
107
|
+
ctx.strokeStyle = "green";
|
|
108
|
+
else
|
|
109
|
+
ctx.strokeStyle = "purple";
|
|
110
|
+
ctx.strokeRect(x, y, w, h);
|
|
111
|
+
ctx.restore();
|
|
112
|
+
}
|
|
113
|
+
function DebugDrawBounds(ctx, bounds, color) {
|
|
114
|
+
ctx.save();
|
|
115
|
+
ctx.strokeStyle = color;
|
|
116
|
+
ctx.strokeRect(bounds.x, bounds.y, bounds.w, bounds.h);
|
|
117
|
+
ctx.restore();
|
|
118
|
+
}
|
|
119
|
+
function DrawLineV2(ctx, startPos, endPos) {
|
|
120
|
+
ctx.beginPath(); // Start a new path
|
|
121
|
+
ctx.moveTo(startPos.x, startPos.y);
|
|
122
|
+
ctx.lineTo(endPos.x, endPos.y);
|
|
123
|
+
ctx.stroke();
|
|
124
|
+
}
|
|
125
|
+
function DrawLine(ctx, x1, y1, x2, y2, lineWidth) {
|
|
126
|
+
ctx.save();
|
|
127
|
+
ctx.lineWidth = lineWidth;
|
|
128
|
+
ctx.beginPath(); // Start a new path
|
|
129
|
+
ctx.moveTo(x1, y1);
|
|
130
|
+
ctx.lineTo(x2, y2);
|
|
131
|
+
ctx.stroke();
|
|
132
|
+
ctx.restore();
|
|
133
|
+
}
|
|
134
|
+
function FillBoundingRect(ctx, bounds, color) {
|
|
135
|
+
ctx.save();
|
|
136
|
+
ctx.fillStyle = color;
|
|
137
|
+
ctx.fillRect(bounds.x, bounds.y, bounds.x, bounds.y);
|
|
138
|
+
ctx.restore();
|
|
139
|
+
}
|
|
140
|
+
function DrawLineArrow(ctx, x1, y1, x2, y2, headLength, thickness) {
|
|
141
|
+
// Calculate angle of the line
|
|
142
|
+
const dx = x2 - x1;
|
|
143
|
+
const dy = y2 - y1;
|
|
144
|
+
const angle = Math.atan2(dy, dx);
|
|
145
|
+
// Save current context so we don't accidentally affect other drawings
|
|
146
|
+
ctx.save();
|
|
147
|
+
// Set line style
|
|
148
|
+
ctx.lineWidth = thickness;
|
|
149
|
+
// ctx.lineJoin = 'round';
|
|
150
|
+
// ctx.lineCap = 'round';
|
|
151
|
+
// Draw main line
|
|
152
|
+
ctx.beginPath();
|
|
153
|
+
ctx.moveTo(x1, y1);
|
|
154
|
+
ctx.lineTo(x2, y2);
|
|
155
|
+
ctx.stroke();
|
|
156
|
+
// Draw arrowhead
|
|
157
|
+
ctx.beginPath();
|
|
158
|
+
ctx.moveTo(x2, y2);
|
|
159
|
+
ctx.lineTo(x2 - headLength * Math.cos(angle - Math.PI / 6), y2 - headLength * Math.sin(angle - Math.PI / 6));
|
|
160
|
+
ctx.lineTo(x2 - headLength * Math.cos(angle + Math.PI / 6), y2 - headLength * Math.sin(angle + Math.PI / 6));
|
|
161
|
+
ctx.lineTo(x2, y2); // Close back to the tip
|
|
162
|
+
ctx.stroke();
|
|
163
|
+
ctx.fill();
|
|
164
|
+
ctx.restore();
|
|
165
|
+
}
|
|
166
|
+
class DrawingException extends Error {
|
|
167
|
+
constructor(message) {
|
|
168
|
+
super(message);
|
|
169
|
+
this.name = "DrawException";
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
exports.DrawingException = DrawingException;
|
|
173
|
+
//# sourceMappingURL=drawing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawing.js","sourceRoot":"","sources":["../../src/app/drawing.ts"],"names":[],"mappings":";;;AA0BA,8BAWC;AAED,4CAWC;AAED,4BAIC;AAED,0CAwCC;AAED,oDAKC;AAED,0EAmBC;AAED,0CAOC;AAED,gCAMC;AAED,4BASC;AAED,4CAMC;AAED,sCA6CC;AA/MD,IAAY,SAaX;AAbD,WAAY,SAAS;IAEjB,yCAAI,CAAA;IACJ,uDAAW,CAAA;IACX,uDAAW,CAAA;IACX,iDAAQ,CAAA;IACR,qDAAU,CAAA;IACV,2DAAa,CAAA;IACb,yDAAY,CAAA;IACZ,yDAAY,CAAA;IACZ,mDAAS,CAAA;IACT,2DAAa,CAAA;AAEjB,CAAC,EAbW,SAAS,yBAAT,SAAS,QAapB;AAW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
|
|
|
1
|
+
import { V2 } from "../core/math";
|
|
2
|
+
export declare enum KeyCode {
|
|
3
|
+
A = "a",
|
|
4
|
+
B = "b",
|
|
5
|
+
C = "c",
|
|
6
|
+
D = "d",
|
|
7
|
+
E = "e",
|
|
8
|
+
F = "f",
|
|
9
|
+
G = "g",
|
|
10
|
+
H = "h",
|
|
11
|
+
I = "i",
|
|
12
|
+
J = "j",
|
|
13
|
+
K = "k",
|
|
14
|
+
L = "l",
|
|
15
|
+
M = "m",
|
|
16
|
+
N = "n",
|
|
17
|
+
O = "o",
|
|
18
|
+
P = "p",
|
|
19
|
+
Q = "q",
|
|
20
|
+
R = "r",
|
|
21
|
+
S = "s",
|
|
22
|
+
T = "t",
|
|
23
|
+
U = "u",
|
|
24
|
+
V = "v",
|
|
25
|
+
W = "w",
|
|
26
|
+
X = "x",
|
|
27
|
+
Y = "y",
|
|
28
|
+
Z = "z",
|
|
29
|
+
Digit0 = "0",
|
|
30
|
+
Digit1 = "1",
|
|
31
|
+
Digit2 = "2",
|
|
32
|
+
Digit3 = "3",
|
|
33
|
+
Digit4 = "4",
|
|
34
|
+
Digit5 = "5",
|
|
35
|
+
Digit6 = "6",
|
|
36
|
+
Digit7 = "7",
|
|
37
|
+
Digit8 = "8",
|
|
38
|
+
Digit9 = "9",
|
|
39
|
+
F1 = "F1",
|
|
40
|
+
F2 = "F2",
|
|
41
|
+
F3 = "F3",
|
|
42
|
+
F4 = "F4",
|
|
43
|
+
F5 = "F5",
|
|
44
|
+
F6 = "F6",
|
|
45
|
+
F7 = "F7",
|
|
46
|
+
F8 = "F8",
|
|
47
|
+
F9 = "F9",
|
|
48
|
+
F10 = "F10",
|
|
49
|
+
F11 = "F11",
|
|
50
|
+
F12 = "F12",
|
|
51
|
+
ArrowUp = "ArrowUp",
|
|
52
|
+
ArrowDown = "ArrowDown",
|
|
53
|
+
ArrowLeft = "ArrowLeft",
|
|
54
|
+
ArrowRight = "ArrowRight",
|
|
55
|
+
ShiftLeft = "Shift",
|
|
56
|
+
ControlLeft = "Control",
|
|
57
|
+
AltLeft = "Alt",
|
|
58
|
+
MetaLeft = "Meta",
|
|
59
|
+
Space = " ",
|
|
60
|
+
Enter = "Enter",
|
|
61
|
+
Escape = "Escape",
|
|
62
|
+
Tab = "Tab",
|
|
63
|
+
Backspace = "Backspace",
|
|
64
|
+
MouseLeft = "MouseLeft",
|
|
65
|
+
MouseRight = "MouseRight",
|
|
66
|
+
MouseMiddle = "MouseMiddle",
|
|
67
|
+
Period = ".",
|
|
68
|
+
Dash = "-",
|
|
69
|
+
Underscore = "_",
|
|
70
|
+
Equals = "=",
|
|
71
|
+
Plus = "+"
|
|
72
|
+
}
|
|
73
|
+
export declare const KeyKeyCodeMap: {
|
|
74
|
+
a: number;
|
|
75
|
+
b: number;
|
|
76
|
+
c: number;
|
|
77
|
+
d: number;
|
|
78
|
+
e: number;
|
|
79
|
+
f: number;
|
|
80
|
+
g: number;
|
|
81
|
+
h: number;
|
|
82
|
+
i: number;
|
|
83
|
+
j: number;
|
|
84
|
+
k: number;
|
|
85
|
+
l: number;
|
|
86
|
+
m: number;
|
|
87
|
+
n: number;
|
|
88
|
+
o: number;
|
|
89
|
+
p: number;
|
|
90
|
+
q: number;
|
|
91
|
+
r: number;
|
|
92
|
+
s: number;
|
|
93
|
+
t: number;
|
|
94
|
+
u: number;
|
|
95
|
+
v: number;
|
|
96
|
+
w: number;
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
z: number;
|
|
100
|
+
"0": number;
|
|
101
|
+
"1": number;
|
|
102
|
+
"2": number;
|
|
103
|
+
"3": number;
|
|
104
|
+
"4": number;
|
|
105
|
+
"5": number;
|
|
106
|
+
"6": number;
|
|
107
|
+
"7": number;
|
|
108
|
+
"8": number;
|
|
109
|
+
"9": number;
|
|
110
|
+
F1: number;
|
|
111
|
+
F2: number;
|
|
112
|
+
F3: number;
|
|
113
|
+
F4: number;
|
|
114
|
+
F5: number;
|
|
115
|
+
F6: number;
|
|
116
|
+
F7: number;
|
|
117
|
+
F8: number;
|
|
118
|
+
F9: number;
|
|
119
|
+
F10: number;
|
|
120
|
+
F11: number;
|
|
121
|
+
F12: number;
|
|
122
|
+
ArrowUp: number;
|
|
123
|
+
ArrowDown: number;
|
|
124
|
+
ArrowLeft: number;
|
|
125
|
+
ArrowRight: number;
|
|
126
|
+
Shift: number;
|
|
127
|
+
Control: number;
|
|
128
|
+
Alt: number;
|
|
129
|
+
Meta: number;
|
|
130
|
+
" ": number;
|
|
131
|
+
Enter: number;
|
|
132
|
+
Escape: number;
|
|
133
|
+
Tab: number;
|
|
134
|
+
Backspace: number;
|
|
135
|
+
MouseLeft: number;
|
|
136
|
+
MouseRight: number;
|
|
137
|
+
MouseMiddle: number;
|
|
138
|
+
".": number;
|
|
139
|
+
"-": number;
|
|
140
|
+
_: number;
|
|
141
|
+
"=": number;
|
|
142
|
+
"+": number;
|
|
143
|
+
};
|
|
144
|
+
export declare class InputClass {
|
|
145
|
+
keysDown: Set<string>;
|
|
146
|
+
keysDownThisFrame: Array<string>;
|
|
147
|
+
keysUpThisFrame: Set<string>;
|
|
148
|
+
mouseDown: boolean;
|
|
149
|
+
mouseDownThisFrame: boolean;
|
|
150
|
+
mouseUpThisFrame: boolean;
|
|
151
|
+
mouseX: number;
|
|
152
|
+
mouseY: number;
|
|
153
|
+
constructor(target?: HTMLElement | Window);
|
|
154
|
+
ClearThisFramePresses(): void;
|
|
155
|
+
KeyDown(key: KeyCode): boolean;
|
|
156
|
+
KeyDownThisFrame(key: KeyCode): boolean;
|
|
157
|
+
KeyUpThisFrame(key: KeyCode): boolean;
|
|
158
|
+
MouseDown(): boolean;
|
|
159
|
+
MouseDownThisFrame(): boolean;
|
|
160
|
+
MouseUpThisFrame(): boolean;
|
|
161
|
+
MousePosInCanvas(canvas: HTMLCanvasElement): V2;
|
|
162
|
+
}
|
|
163
|
+
export declare const InputWin: InputClass;
|
|
164
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,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