@al8b/screen 0.1.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 +23 -0
- package/dist/core/base-screen.d.mts +84 -0
- package/dist/core/base-screen.d.ts +84 -0
- package/dist/core/base-screen.js +419 -0
- package/dist/core/base-screen.js.map +1 -0
- package/dist/core/base-screen.mjs +396 -0
- package/dist/core/base-screen.mjs.map +1 -0
- package/dist/core/index.d.mts +10 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +1208 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/index.mjs +1183 -0
- package/dist/core/index.mjs.map +1 -0
- package/dist/core/screen.d.mts +15 -0
- package/dist/core/screen.d.ts +15 -0
- package/dist/core/screen.js +1209 -0
- package/dist/core/screen.js.map +1 -0
- package/dist/core/screen.mjs +1184 -0
- package/dist/core/screen.mjs.map +1 -0
- package/dist/drawing/primitives-screen.d.mts +28 -0
- package/dist/drawing/primitives-screen.d.ts +28 -0
- package/dist/drawing/primitives-screen.js +685 -0
- package/dist/drawing/primitives-screen.js.map +1 -0
- package/dist/drawing/primitives-screen.mjs +662 -0
- package/dist/drawing/primitives-screen.mjs.map +1 -0
- package/dist/drawing/sprite-screen.d.mts +41 -0
- package/dist/drawing/sprite-screen.d.ts +41 -0
- package/dist/drawing/sprite-screen.js +853 -0
- package/dist/drawing/sprite-screen.js.map +1 -0
- package/dist/drawing/sprite-screen.mjs +830 -0
- package/dist/drawing/sprite-screen.mjs.map +1 -0
- package/dist/drawing/text-screen.d.mts +19 -0
- package/dist/drawing/text-screen.d.ts +19 -0
- package/dist/drawing/text-screen.js +909 -0
- package/dist/drawing/text-screen.js.map +1 -0
- package/dist/drawing/text-screen.mjs +884 -0
- package/dist/drawing/text-screen.mjs.map +1 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1210 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1184 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tri/index.d.mts +3 -0
- package/dist/tri/index.d.ts +3 -0
- package/dist/tri/index.js +231 -0
- package/dist/tri/index.js.map +1 -0
- package/dist/tri/index.mjs +203 -0
- package/dist/tri/index.mjs.map +1 -0
- package/dist/tri/triangle-screen.d.mts +16 -0
- package/dist/tri/triangle-screen.d.ts +16 -0
- package/dist/tri/triangle-screen.js +1147 -0
- package/dist/tri/triangle-screen.js.map +1 -0
- package/dist/tri/triangle-screen.mjs +1122 -0
- package/dist/tri/triangle-screen.mjs.map +1 -0
- package/dist/tri/ttri.d.mts +71 -0
- package/dist/tri/ttri.d.ts +71 -0
- package/dist/tri/ttri.js +229 -0
- package/dist/tri/ttri.js.map +1 -0
- package/dist/tri/ttri.mjs +203 -0
- package/dist/tri/ttri.mjs.map +1 -0
- package/dist/types/index.d.mts +64 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/core/base-screen.ts
|
|
5
|
+
import { APIErrorCode, createDiagnostic, formatForBrowser, reportRuntimeError } from "@al8b/diagnostics";
|
|
6
|
+
|
|
7
|
+
// src/tri/ttri.ts
|
|
8
|
+
var ZBuffer = class {
|
|
9
|
+
static {
|
|
10
|
+
__name(this, "ZBuffer");
|
|
11
|
+
}
|
|
12
|
+
buffer;
|
|
13
|
+
width;
|
|
14
|
+
height;
|
|
15
|
+
constructor(width, height) {
|
|
16
|
+
this.width = width;
|
|
17
|
+
this.height = height;
|
|
18
|
+
this.buffer = new Float32Array(width * height);
|
|
19
|
+
}
|
|
20
|
+
clear() {
|
|
21
|
+
this.buffer.fill(0);
|
|
22
|
+
}
|
|
23
|
+
get(x, y) {
|
|
24
|
+
return this.buffer[y * this.width + x] || 0;
|
|
25
|
+
}
|
|
26
|
+
set(x, y, z) {
|
|
27
|
+
this.buffer[y * this.width + x] = z;
|
|
28
|
+
}
|
|
29
|
+
resize(width, height) {
|
|
30
|
+
if (this.width !== width || this.height !== height) {
|
|
31
|
+
this.width = width;
|
|
32
|
+
this.height = height;
|
|
33
|
+
this.buffer = new Float32Array(width * height);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/core/base-screen.ts
|
|
39
|
+
var BaseScreen = class {
|
|
40
|
+
static {
|
|
41
|
+
__name(this, "BaseScreen");
|
|
42
|
+
}
|
|
43
|
+
canvas;
|
|
44
|
+
context;
|
|
45
|
+
runtime;
|
|
46
|
+
width;
|
|
47
|
+
height;
|
|
48
|
+
// Drawing state
|
|
49
|
+
alpha = 1;
|
|
50
|
+
pixelated = 1;
|
|
51
|
+
line_width = 1;
|
|
52
|
+
font = "BitCell";
|
|
53
|
+
// Transformations
|
|
54
|
+
translation_x = 0;
|
|
55
|
+
translation_y = 0;
|
|
56
|
+
rotation = 0;
|
|
57
|
+
scale_x = 1;
|
|
58
|
+
scale_y = 1;
|
|
59
|
+
screen_transform = false;
|
|
60
|
+
// Object transformations
|
|
61
|
+
object_rotation = 0;
|
|
62
|
+
object_scale_x = 1;
|
|
63
|
+
object_scale_y = 1;
|
|
64
|
+
anchor_x = 0;
|
|
65
|
+
anchor_y = 0;
|
|
66
|
+
// Blending + font caches
|
|
67
|
+
blending = {};
|
|
68
|
+
font_load_requested = {};
|
|
69
|
+
font_loaded = {};
|
|
70
|
+
// Interface cache
|
|
71
|
+
interfaceCache = null;
|
|
72
|
+
// Cursor management
|
|
73
|
+
cursor = "default";
|
|
74
|
+
cursor_visibility = "auto";
|
|
75
|
+
last_mouse_move = Date.now();
|
|
76
|
+
// 3D helper
|
|
77
|
+
zBuffer;
|
|
78
|
+
constructor(options = {}) {
|
|
79
|
+
this.runtime = options.runtime;
|
|
80
|
+
if (options.canvas) {
|
|
81
|
+
this.canvas = options.canvas;
|
|
82
|
+
if (this.canvas.width === 0 || this.canvas.height === 0) {
|
|
83
|
+
this.canvas.width = options.width || 1080;
|
|
84
|
+
this.canvas.height = options.height || 1920;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
this.canvas = document.createElement("canvas");
|
|
88
|
+
this.canvas.width = options.width || 1080;
|
|
89
|
+
this.canvas.height = options.height || 1920;
|
|
90
|
+
}
|
|
91
|
+
this.initContext();
|
|
92
|
+
this.blending = {
|
|
93
|
+
normal: "source-over",
|
|
94
|
+
additive: "lighter"
|
|
95
|
+
};
|
|
96
|
+
const blendModes = [
|
|
97
|
+
"source-over",
|
|
98
|
+
"source-in",
|
|
99
|
+
"source-out",
|
|
100
|
+
"source-atop",
|
|
101
|
+
"destination-over",
|
|
102
|
+
"destination-in",
|
|
103
|
+
"destination-out",
|
|
104
|
+
"destination-atop",
|
|
105
|
+
"lighter",
|
|
106
|
+
"copy",
|
|
107
|
+
"xor",
|
|
108
|
+
"multiply",
|
|
109
|
+
"screen",
|
|
110
|
+
"overlay",
|
|
111
|
+
"darken",
|
|
112
|
+
"lighten",
|
|
113
|
+
"color-dodge",
|
|
114
|
+
"color-burn",
|
|
115
|
+
"hard-light",
|
|
116
|
+
"soft-light",
|
|
117
|
+
"difference",
|
|
118
|
+
"exclusion",
|
|
119
|
+
"hue",
|
|
120
|
+
"saturation",
|
|
121
|
+
"color",
|
|
122
|
+
"luminosity"
|
|
123
|
+
];
|
|
124
|
+
for (const mode of blendModes) {
|
|
125
|
+
this.blending[mode] = mode;
|
|
126
|
+
}
|
|
127
|
+
this.loadFont(this.font);
|
|
128
|
+
this.zBuffer = new ZBuffer(this.canvas.width, this.canvas.height);
|
|
129
|
+
this.cursor = "default";
|
|
130
|
+
this.canvas.addEventListener("mousemove", () => {
|
|
131
|
+
this.last_mouse_move = Date.now();
|
|
132
|
+
if (this.cursor !== "default" && this.cursor_visibility === "auto") {
|
|
133
|
+
this.cursor = "default";
|
|
134
|
+
this.canvas.style.cursor = "default";
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
this.canvas.addEventListener("contextrestored", () => {
|
|
138
|
+
this.initContext();
|
|
139
|
+
});
|
|
140
|
+
setInterval(() => this.checkMouseCursor(), 1e3);
|
|
141
|
+
this.cursor_visibility = "auto";
|
|
142
|
+
}
|
|
143
|
+
initContext() {
|
|
144
|
+
const ctx = this.canvas.getContext("2d", {
|
|
145
|
+
alpha: false
|
|
146
|
+
});
|
|
147
|
+
if (!ctx) {
|
|
148
|
+
const diagnostic = createDiagnostic(APIErrorCode.E7001);
|
|
149
|
+
const formatted = formatForBrowser(diagnostic);
|
|
150
|
+
reportRuntimeError(this.runtime?.listener, APIErrorCode.E7001, {});
|
|
151
|
+
throw new Error(formatted);
|
|
152
|
+
}
|
|
153
|
+
if (ctx !== this.context) {
|
|
154
|
+
this.context = ctx;
|
|
155
|
+
} else {
|
|
156
|
+
this.context.restore();
|
|
157
|
+
}
|
|
158
|
+
this.context.save();
|
|
159
|
+
this.context.translate(this.canvas.width / 2, this.canvas.height / 2);
|
|
160
|
+
const ratio = Math.min(this.canvas.width / 200, this.canvas.height / 200);
|
|
161
|
+
this.context.scale(ratio, ratio);
|
|
162
|
+
this.width = this.canvas.width / ratio;
|
|
163
|
+
this.height = this.canvas.height / ratio;
|
|
164
|
+
this.context.lineCap = "round";
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Initialize draw state (called before each draw frame)
|
|
168
|
+
*/
|
|
169
|
+
initDraw() {
|
|
170
|
+
this.alpha = 1;
|
|
171
|
+
this.line_width = 1;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Update interface dimensions (called before each draw frame)
|
|
175
|
+
*/
|
|
176
|
+
updateInterface() {
|
|
177
|
+
if (this.interfaceCache) {
|
|
178
|
+
this.interfaceCache.width = this.width;
|
|
179
|
+
this.interfaceCache.height = this.height;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
clear(color) {
|
|
183
|
+
this.context.globalAlpha = 1;
|
|
184
|
+
this.context.globalCompositeOperation = "source-over";
|
|
185
|
+
this.context.fillStyle = color || "#000";
|
|
186
|
+
this.context.strokeStyle = color || "#000";
|
|
187
|
+
this.context.fillRect(-this.width / 2, -this.height / 2, this.width, this.height);
|
|
188
|
+
this.zBuffer.clear();
|
|
189
|
+
}
|
|
190
|
+
setColor(color) {
|
|
191
|
+
if (!color) return;
|
|
192
|
+
if (!Number.isNaN(Number.parseInt(String(color)))) {
|
|
193
|
+
const num = Number.parseInt(String(color));
|
|
194
|
+
const r = Math.floor(num / 100) % 10 / 9 * 255;
|
|
195
|
+
const g = Math.floor(num / 10) % 10 / 9 * 255;
|
|
196
|
+
const b = num % 10 / 9 * 255;
|
|
197
|
+
const c = 4278190080 + (r << 16) + (g << 8) + b;
|
|
198
|
+
const hex = "#" + c.toString(16).substring(2, 8);
|
|
199
|
+
this.context.fillStyle = hex;
|
|
200
|
+
this.context.strokeStyle = hex;
|
|
201
|
+
} else if (typeof color === "string") {
|
|
202
|
+
const isValidColor = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color) || /^rgb\(|^rgba\(|^hsl\(|^hsla\(/.test(color) || /^(red|green|blue|yellow|cyan|magenta|black|white|gray|grey|orange|pink|purple|brown|transparent)$/i.test(color);
|
|
203
|
+
if (!isValidColor) {
|
|
204
|
+
reportRuntimeError(this.runtime?.listener, APIErrorCode.E7003, {
|
|
205
|
+
color
|
|
206
|
+
});
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
this.context.fillStyle = color;
|
|
210
|
+
this.context.strokeStyle = color;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
setAlpha(alpha) {
|
|
214
|
+
this.alpha = alpha;
|
|
215
|
+
}
|
|
216
|
+
setPixelated(pixelated) {
|
|
217
|
+
this.pixelated = pixelated;
|
|
218
|
+
}
|
|
219
|
+
setBlending(blending) {
|
|
220
|
+
const blend = this.blending[blending || "normal"];
|
|
221
|
+
if (!blend) {
|
|
222
|
+
reportRuntimeError(this.runtime?.listener, APIErrorCode.E7007, {
|
|
223
|
+
blendMode: blending
|
|
224
|
+
});
|
|
225
|
+
this.context.globalCompositeOperation = "source-over";
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this.context.globalCompositeOperation = blend;
|
|
229
|
+
}
|
|
230
|
+
setLineWidth(width) {
|
|
231
|
+
this.line_width = width;
|
|
232
|
+
}
|
|
233
|
+
setLineDash(dash) {
|
|
234
|
+
if (!Array.isArray(dash)) {
|
|
235
|
+
this.context.setLineDash([]);
|
|
236
|
+
} else {
|
|
237
|
+
this.context.setLineDash(dash);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
setLinearGradient(x1, y1, x2, y2, c1, c2) {
|
|
241
|
+
const grd = this.context.createLinearGradient(x1, -y1, x2, -y2);
|
|
242
|
+
grd.addColorStop(0, c1);
|
|
243
|
+
grd.addColorStop(1, c2);
|
|
244
|
+
this.context.fillStyle = grd;
|
|
245
|
+
this.context.strokeStyle = grd;
|
|
246
|
+
}
|
|
247
|
+
setRadialGradient(x, y, radius, c1, c2) {
|
|
248
|
+
const grd = this.context.createRadialGradient(x, -y, 0, x, -y, radius);
|
|
249
|
+
grd.addColorStop(0, c1);
|
|
250
|
+
grd.addColorStop(1, c2);
|
|
251
|
+
this.context.fillStyle = grd;
|
|
252
|
+
this.context.strokeStyle = grd;
|
|
253
|
+
}
|
|
254
|
+
setFont(font) {
|
|
255
|
+
this.font = font || "Verdana";
|
|
256
|
+
this.loadFont(this.font);
|
|
257
|
+
}
|
|
258
|
+
loadFont(font = "BitCell") {
|
|
259
|
+
if (this.font_load_requested[font]) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.font_load_requested[font] = true;
|
|
263
|
+
try {
|
|
264
|
+
document.fonts?.load?.(`16pt ${font}`).catch(() => {
|
|
265
|
+
reportRuntimeError(this.runtime?.listener, APIErrorCode.E7006, {
|
|
266
|
+
font
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
} catch {
|
|
270
|
+
reportRuntimeError(this.runtime?.listener, APIErrorCode.E7006, {
|
|
271
|
+
font
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
isFontReady(font = this.font) {
|
|
276
|
+
if (this.font_loaded[font]) {
|
|
277
|
+
return 1;
|
|
278
|
+
}
|
|
279
|
+
try {
|
|
280
|
+
const ready = document.fonts?.check?.(`16pt ${font}`) ?? true;
|
|
281
|
+
if (ready) {
|
|
282
|
+
this.font_loaded[font] = true;
|
|
283
|
+
}
|
|
284
|
+
return ready ? 1 : 0;
|
|
285
|
+
} catch {
|
|
286
|
+
return 1;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
setTranslation(tx, ty) {
|
|
290
|
+
this.translation_x = isFinite(tx) ? tx : 0;
|
|
291
|
+
this.translation_y = isFinite(ty) ? ty : 0;
|
|
292
|
+
this.updateScreenTransform();
|
|
293
|
+
}
|
|
294
|
+
setScale(x, y) {
|
|
295
|
+
this.scale_x = isFinite(x) && x !== 0 ? x : 1;
|
|
296
|
+
this.scale_y = isFinite(y) && y !== 0 ? y : 1;
|
|
297
|
+
this.updateScreenTransform();
|
|
298
|
+
}
|
|
299
|
+
setRotation(rotation) {
|
|
300
|
+
this.rotation = isFinite(rotation) ? rotation : 0;
|
|
301
|
+
this.updateScreenTransform();
|
|
302
|
+
}
|
|
303
|
+
updateScreenTransform() {
|
|
304
|
+
this.screen_transform = this.translation_x !== 0 || this.translation_y !== 0 || this.scale_x !== 1 || this.scale_y !== 1 || this.rotation !== 0;
|
|
305
|
+
}
|
|
306
|
+
setDrawAnchor(ax, ay) {
|
|
307
|
+
this.anchor_x = typeof ax === "number" ? ax : 0;
|
|
308
|
+
this.anchor_y = typeof ay === "number" ? ay : 0;
|
|
309
|
+
}
|
|
310
|
+
setDrawRotation(rotation) {
|
|
311
|
+
this.object_rotation = rotation;
|
|
312
|
+
}
|
|
313
|
+
setDrawScale(x, y = x) {
|
|
314
|
+
this.object_scale_x = x;
|
|
315
|
+
this.object_scale_y = y;
|
|
316
|
+
}
|
|
317
|
+
initDrawOp(x, y, object_transform = true) {
|
|
318
|
+
let res = false;
|
|
319
|
+
if (this.screen_transform) {
|
|
320
|
+
this.context.save();
|
|
321
|
+
res = true;
|
|
322
|
+
this.context.translate(this.translation_x, -this.translation_y);
|
|
323
|
+
this.context.scale(this.scale_x, this.scale_y);
|
|
324
|
+
this.context.rotate(-this.rotation / 180 * Math.PI);
|
|
325
|
+
this.context.translate(x, y);
|
|
326
|
+
}
|
|
327
|
+
if (object_transform && (this.object_rotation !== 0 || this.object_scale_x !== 1 || this.object_scale_y !== 1)) {
|
|
328
|
+
if (!res) {
|
|
329
|
+
this.context.save();
|
|
330
|
+
res = true;
|
|
331
|
+
this.context.translate(x, y);
|
|
332
|
+
}
|
|
333
|
+
if (this.object_rotation !== 0) {
|
|
334
|
+
this.context.rotate(-this.object_rotation / 180 * Math.PI);
|
|
335
|
+
}
|
|
336
|
+
if (this.object_scale_x !== 1 || this.object_scale_y !== 1) {
|
|
337
|
+
this.context.scale(this.object_scale_x, this.object_scale_y);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return res;
|
|
341
|
+
}
|
|
342
|
+
closeDrawOp() {
|
|
343
|
+
this.context.restore();
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Check mouse cursor visibility
|
|
347
|
+
* Auto-hides cursor after 4 seconds of inactivity
|
|
348
|
+
*/
|
|
349
|
+
checkMouseCursor() {
|
|
350
|
+
if (Date.now() > this.last_mouse_move + 4e3 && this.cursor_visibility === "auto") {
|
|
351
|
+
if (this.cursor !== "none") {
|
|
352
|
+
this.cursor = "none";
|
|
353
|
+
this.canvas.style.cursor = "none";
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Set cursor visibility
|
|
359
|
+
*/
|
|
360
|
+
setCursorVisible(visible) {
|
|
361
|
+
this.cursor_visibility = visible ? "default" : "none";
|
|
362
|
+
if (visible) {
|
|
363
|
+
this.cursor = "default";
|
|
364
|
+
this.canvas.style.cursor = "default";
|
|
365
|
+
} else {
|
|
366
|
+
this.cursor = "none";
|
|
367
|
+
this.canvas.style.cursor = "none";
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
getCanvas() {
|
|
371
|
+
return this.canvas;
|
|
372
|
+
}
|
|
373
|
+
getContext() {
|
|
374
|
+
return this.context;
|
|
375
|
+
}
|
|
376
|
+
resize(width, height) {
|
|
377
|
+
if (width && height) {
|
|
378
|
+
if (width <= 0 || height <= 0 || !isFinite(width) || !isFinite(height)) {
|
|
379
|
+
reportRuntimeError(this.runtime?.listener, APIErrorCode.E7002, {
|
|
380
|
+
width,
|
|
381
|
+
height
|
|
382
|
+
});
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
this.canvas.width = width;
|
|
386
|
+
this.canvas.height = height;
|
|
387
|
+
this.initContext();
|
|
388
|
+
this.zBuffer.resize(width, height);
|
|
389
|
+
this.updateInterface();
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
export {
|
|
394
|
+
BaseScreen
|
|
395
|
+
};
|
|
396
|
+
//# sourceMappingURL=base-screen.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/base-screen.ts","../../src/tri/ttri.ts"],"sourcesContent":["import { APIErrorCode, createDiagnostic, formatForBrowser, reportRuntimeError } from \"@al8b/diagnostics\";\nimport { ZBuffer } from \"../tri\";\nimport type { ScreenInterface, ScreenOptions } from \"../types\";\n\n/**\n * BaseScreen encapsulates canvas/context management plus shared drawing state.\n * Feature-specific behaviors (primitives, sprites, text, triangles) extend this class.\n */\nexport class BaseScreen {\n\tprotected canvas: HTMLCanvasElement;\n\tprotected context!: CanvasRenderingContext2D;\n\tprotected runtime: any;\n\n\tpublic width!: number;\n\tpublic height!: number;\n\n\t// Drawing state\n\tprotected alpha = 1;\n\tprotected pixelated = 1;\n\tprotected line_width = 1;\n\tprotected font = \"BitCell\";\n\n\t// Transformations\n\tprotected translation_x = 0;\n\tprotected translation_y = 0;\n\tprotected rotation = 0;\n\tprotected scale_x = 1;\n\tprotected scale_y = 1;\n\tprotected screen_transform = false;\n\n\t// Object transformations\n\tprotected object_rotation = 0;\n\tprotected object_scale_x = 1;\n\tprotected object_scale_y = 1;\n\tprotected anchor_x = 0;\n\tprotected anchor_y = 0;\n\n\t// Blending + font caches\n\tprotected blending: Record<string, string> = {};\n\tprotected font_load_requested: Record<string, boolean> = {};\n\tprotected font_loaded: Record<string, boolean> = {};\n\n\t// Interface cache\n\tprotected interfaceCache: ScreenInterface | null = null;\n\n\t// Cursor management\n\tprotected cursor: string = \"default\";\n\tprotected cursor_visibility: string = \"auto\";\n\tprotected last_mouse_move: number = Date.now();\n\n\t// 3D helper\n\tprotected zBuffer: ZBuffer;\n\n\tconstructor(options: ScreenOptions = {}) {\n\t\tthis.runtime = options.runtime;\n\n\t\tif (options.canvas) {\n\t\t\tthis.canvas = options.canvas;\n\t\t\tif (this.canvas.width === 0 || this.canvas.height === 0) {\n\t\t\t\tthis.canvas.width = options.width || 1080;\n\t\t\t\tthis.canvas.height = options.height || 1920;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.canvas = document.createElement(\"canvas\");\n\t\t\tthis.canvas.width = options.width || 1080;\n\t\t\tthis.canvas.height = options.height || 1920;\n\t\t}\n\n\t\tthis.initContext();\n\n\t\tthis.blending = {\n\t\t\tnormal: \"source-over\",\n\t\t\tadditive: \"lighter\",\n\t\t};\n\n\t\tconst blendModes = [\n\t\t\t\"source-over\",\n\t\t\t\"source-in\",\n\t\t\t\"source-out\",\n\t\t\t\"source-atop\",\n\t\t\t\"destination-over\",\n\t\t\t\"destination-in\",\n\t\t\t\"destination-out\",\n\t\t\t\"destination-atop\",\n\t\t\t\"lighter\",\n\t\t\t\"copy\",\n\t\t\t\"xor\",\n\t\t\t\"multiply\",\n\t\t\t\"screen\",\n\t\t\t\"overlay\",\n\t\t\t\"darken\",\n\t\t\t\"lighten\",\n\t\t\t\"color-dodge\",\n\t\t\t\"color-burn\",\n\t\t\t\"hard-light\",\n\t\t\t\"soft-light\",\n\t\t\t\"difference\",\n\t\t\t\"exclusion\",\n\t\t\t\"hue\",\n\t\t\t\"saturation\",\n\t\t\t\"color\",\n\t\t\t\"luminosity\",\n\t\t];\n\n\t\tfor (const mode of blendModes) {\n\t\t\tthis.blending[mode] = mode;\n\t\t}\n\n\t\tthis.loadFont(this.font);\n\t\tthis.zBuffer = new ZBuffer(this.canvas.width, this.canvas.height);\n\n\t\tthis.cursor = \"default\";\n\n\t\tthis.canvas.addEventListener(\"mousemove\", () => {\n\t\t\tthis.last_mouse_move = Date.now();\n\t\t\tif (this.cursor !== \"default\" && this.cursor_visibility === \"auto\") {\n\t\t\t\tthis.cursor = \"default\";\n\t\t\t\tthis.canvas.style.cursor = \"default\";\n\t\t\t}\n\t\t});\n\n\t\t// When the context is lost and then restored, base transform needs to be reinstated\n\t\tthis.canvas.addEventListener(\"contextrestored\", () => {\n\t\t\tthis.initContext();\n\t\t});\n\n\t\tsetInterval(() => this.checkMouseCursor(), 1000);\n\t\tthis.cursor_visibility = \"auto\";\n\t}\n\n\tprotected initContext(): void {\n\t\tconst ctx = this.canvas.getContext(\"2d\", {\n\t\t\talpha: false,\n\t\t});\n\t\tif (!ctx) {\n\t\t\tconst diagnostic = createDiagnostic(APIErrorCode.E7001);\n\t\t\tconst formatted = formatForBrowser(diagnostic);\n\t\t\treportRuntimeError(this.runtime?.listener, APIErrorCode.E7001, {});\n\n\t\t\tthrow new Error(formatted);\n\t\t}\n\n\t\tif (ctx !== this.context) {\n\t\t\tthis.context = ctx;\n\t\t} else {\n\t\t\tthis.context.restore();\n\t\t}\n\n\t\tthis.context.save();\n\t\tthis.context.translate(this.canvas.width / 2, this.canvas.height / 2);\n\n\t\t// Calculate ratio: Math.min(canvas.width/200, canvas.height/200)\n\t\tconst ratio = Math.min(this.canvas.width / 200, this.canvas.height / 200);\n\t\tthis.context.scale(ratio, ratio);\n\n\t\t// Set logical width/height\n\t\tthis.width = this.canvas.width / ratio;\n\t\tthis.height = this.canvas.height / ratio;\n\t\tthis.context.lineCap = \"round\";\n\t}\n\n\t/**\n\t * Initialize draw state (called before each draw frame)\n\t */\n\tinitDraw(): void {\n\t\tthis.alpha = 1;\n\t\tthis.line_width = 1;\n\t\t// Note: Supersampling not implemented in l8b\n\t\t// If needed, add: if (this.supersampling != this.previous_supersampling) { this.resize(); this.previous_supersampling = this.supersampling; }\n\t}\n\n\t/**\n\t * Update interface dimensions (called before each draw frame)\n\t */\n\tupdateInterface(): void {\n\t\t// Update interface cache if it exists\n\t\tif (this.interfaceCache) {\n\t\t\tthis.interfaceCache.width = this.width;\n\t\t\tthis.interfaceCache.height = this.height;\n\t\t}\n\t}\n\n\tclear(color?: string): void {\n\t\tthis.context.globalAlpha = 1;\n\t\tthis.context.globalCompositeOperation = \"source-over\";\n\t\tthis.context.fillStyle = color || \"#000\";\n\t\tthis.context.strokeStyle = color || \"#000\";\n\t\tthis.context.fillRect(-this.width / 2, -this.height / 2, this.width, this.height);\n\t\tthis.zBuffer.clear();\n\t}\n\n\tsetColor(color: string | number): void {\n\t\tif (!color) return;\n\n\t\tif (!Number.isNaN(Number.parseInt(String(color)))) {\n\t\t\tconst num = Number.parseInt(String(color));\n\t\t\tconst r = ((Math.floor(num / 100) % 10) / 9) * 255;\n\t\t\tconst g = ((Math.floor(num / 10) % 10) / 9) * 255;\n\t\t\tconst b = ((num % 10) / 9) * 255;\n\t\t\tconst c = 0xff000000 + (r << 16) + (g << 8) + b;\n\t\t\tconst hex = \"#\" + c.toString(16).substring(2, 8);\n\t\t\tthis.context.fillStyle = hex;\n\t\t\tthis.context.strokeStyle = hex;\n\t\t} else if (typeof color === \"string\") {\n\t\t\t// Validate color format\n\t\t\tconst isValidColor =\n\t\t\t\t/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color) ||\n\t\t\t\t/^rgb\\(|^rgba\\(|^hsl\\(|^hsla\\(/.test(color) ||\n\t\t\t\t/^(red|green|blue|yellow|cyan|magenta|black|white|gray|grey|orange|pink|purple|brown|transparent)$/i.test(color);\n\n\t\t\tif (!isValidColor) {\n\t\t\t\treportRuntimeError(this.runtime?.listener, APIErrorCode.E7003, { color });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.context.fillStyle = color;\n\t\t\tthis.context.strokeStyle = color;\n\t\t}\n\t}\n\n\tsetAlpha(alpha: number): void {\n\t\tthis.alpha = alpha;\n\t}\n\n\tsetPixelated(pixelated: number): void {\n\t\tthis.pixelated = pixelated;\n\t}\n\n\tsetBlending(blending: string): void {\n\t\tconst blend = this.blending[blending || \"normal\"];\n\n\t\tif (!blend) {\n\t\t\treportRuntimeError(this.runtime?.listener, APIErrorCode.E7007, { blendMode: blending });\n\t\t\t// Fallback to normal blend mode\n\t\t\tthis.context.globalCompositeOperation = \"source-over\";\n\t\t\treturn;\n\t\t}\n\n\t\tthis.context.globalCompositeOperation = blend as GlobalCompositeOperation;\n\t}\n\n\tsetLineWidth(width: number): void {\n\t\tthis.line_width = width;\n\t}\n\n\tsetLineDash(dash: number[] | null): void {\n\t\tif (!Array.isArray(dash)) {\n\t\t\tthis.context.setLineDash([]);\n\t\t} else {\n\t\t\tthis.context.setLineDash(dash);\n\t\t}\n\t}\n\n\tsetLinearGradient(x1: number, y1: number, x2: number, y2: number, c1: string, c2: string): void {\n\t\tconst grd = this.context.createLinearGradient(x1, -y1, x2, -y2);\n\t\tgrd.addColorStop(0, c1);\n\t\tgrd.addColorStop(1, c2);\n\t\tthis.context.fillStyle = grd;\n\t\tthis.context.strokeStyle = grd;\n\t}\n\n\tsetRadialGradient(x: number, y: number, radius: number, c1: string, c2: string): void {\n\t\tconst grd = this.context.createRadialGradient(x, -y, 0, x, -y, radius);\n\t\tgrd.addColorStop(0, c1);\n\t\tgrd.addColorStop(1, c2);\n\t\tthis.context.fillStyle = grd;\n\t\tthis.context.strokeStyle = grd;\n\t}\n\n\tsetFont(font: string): void {\n\t\tthis.font = font || \"Verdana\";\n\t\tthis.loadFont(this.font);\n\t}\n\n\tloadFont(font: string = \"BitCell\"): void {\n\t\tif (this.font_load_requested[font]) {\n\t\t\treturn;\n\t\t}\n\t\tthis.font_load_requested[font] = true;\n\t\ttry {\n\t\t\tdocument.fonts?.load?.(`16pt ${font}`).catch(() => {\n\t\t\t\treportRuntimeError(this.runtime?.listener, APIErrorCode.E7006, { font });\n\t\t\t});\n\t\t} catch {\n\t\t\treportRuntimeError(this.runtime?.listener, APIErrorCode.E7006, { font });\n\t\t}\n\t}\n\n\tisFontReady(font: string = this.font): number {\n\t\tif (this.font_loaded[font]) {\n\t\t\treturn 1;\n\t\t}\n\n\t\ttry {\n\t\t\tconst ready = document.fonts?.check?.(`16pt ${font}`) ?? true;\n\t\t\tif (ready) {\n\t\t\t\tthis.font_loaded[font] = true;\n\t\t\t}\n\t\t\treturn ready ? 1 : 0;\n\t\t} catch {\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\tsetTranslation(tx: number, ty: number): void {\n\t\tthis.translation_x = isFinite(tx) ? tx : 0;\n\t\tthis.translation_y = isFinite(ty) ? ty : 0;\n\t\tthis.updateScreenTransform();\n\t}\n\n\tsetScale(x: number, y: number): void {\n\t\tthis.scale_x = isFinite(x) && x !== 0 ? x : 1;\n\t\tthis.scale_y = isFinite(y) && y !== 0 ? y : 1;\n\t\tthis.updateScreenTransform();\n\t}\n\n\tsetRotation(rotation: number): void {\n\t\tthis.rotation = isFinite(rotation) ? rotation : 0;\n\t\tthis.updateScreenTransform();\n\t}\n\n\tprotected updateScreenTransform(): void {\n\t\tthis.screen_transform =\n\t\t\tthis.translation_x !== 0 ||\n\t\t\tthis.translation_y !== 0 ||\n\t\t\tthis.scale_x !== 1 ||\n\t\t\tthis.scale_y !== 1 ||\n\t\t\tthis.rotation !== 0;\n\t}\n\n\tsetDrawAnchor(ax: number, ay: number): void {\n\t\tthis.anchor_x = typeof ax === \"number\" ? ax : 0;\n\t\tthis.anchor_y = typeof ay === \"number\" ? ay : 0;\n\t}\n\n\tsetDrawRotation(rotation: number): void {\n\t\tthis.object_rotation = rotation;\n\t}\n\n\tsetDrawScale(x: number, y: number = x): void {\n\t\tthis.object_scale_x = x;\n\t\tthis.object_scale_y = y;\n\t}\n\n\tprotected initDrawOp(x: number, y: number, object_transform: boolean = true): boolean {\n\t\tlet res = false;\n\n\t\tif (this.screen_transform) {\n\t\t\tthis.context.save();\n\t\t\tres = true;\n\t\t\tthis.context.translate(this.translation_x, -this.translation_y);\n\t\t\tthis.context.scale(this.scale_x, this.scale_y);\n\t\t\tthis.context.rotate((-this.rotation / 180) * Math.PI);\n\t\t\tthis.context.translate(x, y);\n\t\t}\n\n\t\tif (object_transform && (this.object_rotation !== 0 || this.object_scale_x !== 1 || this.object_scale_y !== 1)) {\n\t\t\tif (!res) {\n\t\t\t\tthis.context.save();\n\t\t\t\tres = true;\n\t\t\t\tthis.context.translate(x, y);\n\t\t\t}\n\n\t\t\tif (this.object_rotation !== 0) {\n\t\t\t\tthis.context.rotate((-this.object_rotation / 180) * Math.PI);\n\t\t\t}\n\n\t\t\tif (this.object_scale_x !== 1 || this.object_scale_y !== 1) {\n\t\t\t\tthis.context.scale(this.object_scale_x, this.object_scale_y);\n\t\t\t}\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tprotected closeDrawOp(): void {\n\t\tthis.context.restore();\n\t}\n\n\t/**\n\t * Check mouse cursor visibility\n\t * Auto-hides cursor after 4 seconds of inactivity\n\t */\n\tprotected checkMouseCursor(): void {\n\t\tif (Date.now() > this.last_mouse_move + 4000 && this.cursor_visibility === \"auto\") {\n\t\t\tif (this.cursor !== \"none\") {\n\t\t\t\tthis.cursor = \"none\";\n\t\t\t\tthis.canvas.style.cursor = \"none\";\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Set cursor visibility\n\t */\n\tsetCursorVisible(visible: boolean): void {\n\t\tthis.cursor_visibility = visible ? \"default\" : \"none\";\n\t\tif (visible) {\n\t\t\tthis.cursor = \"default\";\n\t\t\tthis.canvas.style.cursor = \"default\";\n\t\t} else {\n\t\t\tthis.cursor = \"none\";\n\t\t\tthis.canvas.style.cursor = \"none\";\n\t\t}\n\t}\n\n\tgetCanvas(): HTMLCanvasElement {\n\t\treturn this.canvas;\n\t}\n\n\tgetContext(): CanvasRenderingContext2D {\n\t\treturn this.context;\n\t}\n\n\tresize(width?: number, height?: number): void {\n\t\tif (width && height) {\n\t\t\t// Validate dimensions\n\t\t\tif (width <= 0 || height <= 0 || !isFinite(width) || !isFinite(height)) {\n\t\t\t\treportRuntimeError(this.runtime?.listener, APIErrorCode.E7002, { width, height });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.canvas.width = width;\n\t\t\tthis.canvas.height = height;\n\t\t\tthis.initContext();\n\t\t\tthis.zBuffer.resize(width, height);\n\t\t\t// Update interface cache immediately after resize\n\t\t\tthis.updateInterface();\n\t\t}\n\t}\n}\n","/**\n * TTRI - Textured Triangle Rendering (Software Rasterization)\n *\n * Based on TIC-80's ttri implementation for 3D-style graphics.\n * This is NOT a 3D engine - it's pure 2D pixel manipulation using Canvas 2D API.\n *\n * How it works:\n * 1. Use getImageData() to get pixel buffer\n * 2. Rasterize triangle pixel-by-pixel (barycentric coordinates)\n * 3. Interpolate UV texture coordinates (perspective-correct with 1/z)\n * 4. Sample texture and write to pixel buffer\n * 5. Use putImageData() to update canvas\n *\n * This is software rendering like Doom, Quake software mode, and PlayStation 1.\n * No WebGL, no GPU - just CPU pixel manipulation.\n */\n\nimport type { TileMap as Map } from \"@al8b/map\";\nimport type { Sprite } from \"@al8b/sprites\";\n\nexport interface Vec2 {\n\tx: number;\n\ty: number;\n}\n\nexport interface Vec3 {\n\tx: number;\n\ty: number;\n\tz: number;\n}\n\nexport interface TexVert {\n\tx: number;\n\ty: number;\n\tu: number;\n\tv: number;\n\tz: number;\n}\n\nexport type TextureSource = \"tiles\" | \"map\" | \"screen\";\n\nexport interface TriangleData {\n\tcontext: CanvasRenderingContext2D;\n\twidth: number;\n\theight: number;\n\truntime?: any;\n\tpixelated: boolean;\n}\n\n/**\n * Z-Buffer for depth testing\n */\nexport class ZBuffer {\n\tprivate buffer: Float32Array;\n\tprivate width: number;\n\tprivate height: number;\n\n\tconstructor(width: number, height: number) {\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.buffer = new Float32Array(width * height);\n\t}\n\n\tclear(): void {\n\t\tthis.buffer.fill(0);\n\t}\n\n\tget(x: number, y: number): number {\n\t\treturn this.buffer[y * this.width + x] || 0;\n\t}\n\n\tset(x: number, y: number, z: number): void {\n\t\tthis.buffer[y * this.width + x] = z;\n\t}\n\n\tresize(width: number, height: number): void {\n\t\tif (this.width !== width || this.height !== height) {\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.buffer = new Float32Array(width * height);\n\t\t}\n\t}\n}\n\n/**\n * Edge function for triangle rasterization\n */\nfunction edgeFn(a: Vec2, b: Vec2, c: Vec2): number {\n\treturn (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);\n}\n\n/**\n * Get pixel from sprite/image\n */\nfunction getSpritePixel(\n\tsprite: Sprite | any,\n\tu: number,\n\tv: number,\n\truntime?: any,\n): {\n\tr: number;\n\tg: number;\n\tb: number;\n\ta: number;\n} | null {\n\t// Resolve sprite canvas from object or runtime registry\n\tlet canvas: HTMLCanvasElement | null = null;\n\n\tif (sprite && typeof sprite === \"object\" && sprite.canvas) {\n\t\tcanvas = sprite.canvas;\n\t} else if (typeof sprite === \"string\" && runtime?.sprites) {\n\t\tconst spriteObj = runtime.sprites[sprite];\n\t\tif (spriteObj?.frames?.[0]?.canvas) {\n\t\t\tcanvas = spriteObj.frames[0].canvas;\n\t\t}\n\t}\n\n\tif (!canvas) return null;\n\n\t// Apply texture coordinate wrapping (repeat mode)\n\tconst width = canvas.width;\n\tconst height = canvas.height;\n\tconst x = Math.floor(u) % width;\n\tconst y = Math.floor(v) % height;\n\tconst px = x < 0 ? x + width : x;\n\tconst py = y < 0 ? y + height : y;\n\n\t// Sample pixel color from sprite canvas\n\tconst ctx = canvas.getContext(\"2d\");\n\tif (!ctx) return null;\n\n\ttry {\n\t\tconst imageData = ctx.getImageData(px, py, 1, 1);\n\t\treturn {\n\t\t\tr: imageData.data[0],\n\t\t\tg: imageData.data[1],\n\t\t\tb: imageData.data[2],\n\t\t\ta: imageData.data[3],\n\t\t};\n\t} catch (e) {\n\t\treturn null;\n\t}\n}\n\n/**\n * Get pixel from map\n */\nfunction getMapPixel(\n\tmap: Map | any,\n\tu: number,\n\tv: number,\n\truntime?: any,\n): {\n\tr: number;\n\tg: number;\n\tb: number;\n\ta: number;\n} | null {\n\t// Get map object\n\tlet mapObj: any = null;\n\n\tif (map && typeof map === \"object\" && map.getCanvas) {\n\t\tmapObj = map;\n\t} else if (typeof map === \"string\" && runtime?.maps) {\n\t\tmapObj = runtime.maps[map];\n\t}\n\n\tif (!mapObj) return null;\n\n\t// Get canvas from map\n\tconst canvas = mapObj.getCanvas ? mapObj.getCanvas() : mapObj.canvas;\n\tif (!canvas) return null;\n\n\t// Wrap texture coordinates\n\tconst width = canvas.width;\n\tconst height = canvas.height;\n\tconst x = Math.floor(u) % width;\n\tconst y = Math.floor(v) % height;\n\tconst px = x < 0 ? x + width : x;\n\tconst py = y < 0 ? y + height : y;\n\n\t// Get pixel data\n\tconst ctx = canvas.getContext(\"2d\");\n\tif (!ctx) return null;\n\n\ttry {\n\t\tconst imageData = ctx.getImageData(px, py, 1, 1);\n\t\treturn {\n\t\t\tr: imageData.data[0],\n\t\t\tg: imageData.data[1],\n\t\t\tb: imageData.data[2],\n\t\t\ta: imageData.data[3],\n\t\t};\n\t} catch (e) {\n\t\treturn null;\n\t}\n}\n\n/**\n * Draw textured triangle with perspective correction\n */\nexport function drawTexturedTriangle(\n\tdata: TriangleData,\n\tv0: TexVert,\n\tv1: TexVert,\n\tv2: TexVert,\n\ttexture: Sprite | Map | string | any,\n\ttextureSource: TextureSource = \"tiles\",\n\tzBuffer?: ZBuffer,\n\tuseDepth: boolean = false,\n): void {\n\tconst { context, width, height, runtime, pixelated } = data;\n\n\t// Get bounding box\n\tconst minX = Math.max(0, Math.floor(Math.min(v0.x, v1.x, v2.x)));\n\tconst minY = Math.max(0, Math.floor(Math.min(v0.y, v1.y, v2.y)));\n\tconst maxX = Math.min(width, Math.ceil(Math.max(v0.x, v1.x, v2.x)));\n\tconst maxY = Math.min(height, Math.ceil(Math.max(v0.y, v1.y, v2.y)));\n\n\tif (minX >= maxX || minY >= maxY) return;\n\n\t// Calculate triangle area\n\tconst area = edgeFn(v0, v1, v2);\n\tif (Math.abs(area) < 0.001) return;\n\n\t// Backface culling\n\tif (area < 0) return;\n\n\t// Prepare perspective-correct interpolation\n\tconst useZ = useDepth && v0.z > 0 && v1.z > 0 && v2.z > 0;\n\n\tlet w0 = 1,\n\t\tw1 = 1,\n\t\tw2 = 1;\n\tlet u0 = v0.u,\n\t\tu1 = v1.u,\n\t\tu2 = v2.u;\n\tlet v0v = v0.v,\n\t\tv1v = v1.v,\n\t\tv2v = v2.v;\n\n\tif (useZ) {\n\t\tw0 = 1 / v0.z;\n\t\tw1 = 1 / v1.z;\n\t\tw2 = 1 / v2.z;\n\t\tu0 *= w0;\n\t\tu1 *= w1;\n\t\tu2 *= w2;\n\t\tv0v *= w0;\n\t\tv1v *= w1;\n\t\tv2v *= w2;\n\t}\n\n\t// Get image data for fast pixel manipulation\n\tconst imageData = context.getImageData(minX, minY, maxX - minX, maxY - minY);\n\tconst pixels = imageData.data;\n\n\t// Rasterize\n\tfor (let y = minY; y < maxY; y++) {\n\t\tfor (let x = minX; x < maxX; x++) {\n\t\t\tconst p = {\n\t\t\t\tx: x + 0.5,\n\t\t\t\ty: y + 0.5,\n\t\t\t};\n\n\t\t\t// Calculate barycentric coordinates\n\t\t\tconst w0b = edgeFn(v1, v2, p);\n\t\t\tconst w1b = edgeFn(v2, v0, p);\n\t\t\tconst w2b = edgeFn(v0, v1, p);\n\n\t\t\t// Check if point is inside triangle\n\t\t\tif (w0b >= 0 && w1b >= 0 && w2b >= 0) {\n\t\t\t\t// Normalize barycentric coordinates\n\t\t\t\tconst bary0 = w0b / area;\n\t\t\t\tconst bary1 = w1b / area;\n\t\t\t\tconst bary2 = w2b / area;\n\n\t\t\t\t// Depth test\n\t\t\t\tif (useZ && zBuffer) {\n\t\t\t\t\tconst z = bary0 * v0.z + bary1 * v1.z + bary2 * v2.z;\n\t\t\t\t\tconst currentZ = zBuffer.get(x, y);\n\t\t\t\t\tif (currentZ > 0 && currentZ >= z) continue;\n\t\t\t\t\tzBuffer.set(x, y, z);\n\t\t\t\t}\n\n\t\t\t\t// Interpolate texture coordinates\n\t\t\t\tlet u: number, v: number;\n\n\t\t\t\tif (useZ) {\n\t\t\t\t\tconst w = bary0 * w0 + bary1 * w1 + bary2 * w2;\n\t\t\t\t\tu = (bary0 * u0 + bary1 * u1 + bary2 * u2) / w;\n\t\t\t\t\tv = (bary0 * v0v + bary1 * v1v + bary2 * v2v) / w;\n\t\t\t\t} else {\n\t\t\t\t\tu = bary0 * v0.u + bary1 * v1.u + bary2 * v2.u;\n\t\t\t\t\tv = bary0 * v0.v + bary1 * v1.v + bary2 * v2.v;\n\t\t\t\t}\n\n\t\t\t\t// Sample texture\n\t\t\t\tlet pixel: {\n\t\t\t\t\tr: number;\n\t\t\t\t\tg: number;\n\t\t\t\t\tb: number;\n\t\t\t\t\ta: number;\n\t\t\t\t} | null = null;\n\n\t\t\t\tif (textureSource === \"map\") {\n\t\t\t\t\tpixel = getMapPixel(texture, u, v, runtime);\n\t\t\t\t} else {\n\t\t\t\t\tpixel = getSpritePixel(texture, u, v, runtime);\n\t\t\t\t}\n\n\t\t\t\t// Draw pixel\n\t\t\t\tif (pixel && pixel.a > 0) {\n\t\t\t\t\tconst idx = ((y - minY) * (maxX - minX) + (x - minX)) * 4;\n\t\t\t\t\tpixels[idx] = pixel.r;\n\t\t\t\t\tpixels[idx + 1] = pixel.g;\n\t\t\t\t\tpixels[idx + 2] = pixel.b;\n\t\t\t\t\tpixels[idx + 3] = pixel.a;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Put image data back\n\tcontext.imageSmoothingEnabled = !pixelated;\n\tcontext.putImageData(imageData, minX, minY);\n}\n\n/**\n * Draw solid color triangle\n */\nexport function drawTriangle(context: CanvasRenderingContext2D, v0: Vec2, v1: Vec2, v2: Vec2, color: string): void {\n\tcontext.fillStyle = color;\n\tcontext.beginPath();\n\tcontext.moveTo(v0.x, v0.y);\n\tcontext.lineTo(v1.x, v1.y);\n\tcontext.lineTo(v2.x, v2.y);\n\tcontext.closePath();\n\tcontext.fill();\n}\n\n/**\n * Draw triangle outline\n */\nexport function drawTriangleOutline(\n\tcontext: CanvasRenderingContext2D,\n\tv0: Vec2,\n\tv1: Vec2,\n\tv2: Vec2,\n\tcolor: string,\n\tlineWidth: number = 1,\n): void {\n\tcontext.strokeStyle = color;\n\tcontext.lineWidth = lineWidth;\n\tcontext.beginPath();\n\tcontext.moveTo(v0.x, v0.y);\n\tcontext.lineTo(v1.x, v1.y);\n\tcontext.lineTo(v2.x, v2.y);\n\tcontext.closePath();\n\tcontext.stroke();\n}\n"],"mappings":";;;;AAAA,SAASA,cAAcC,kBAAkBC,kBAAkBC,0BAA0B;;;ACoD9E,IAAMC,UAAN,MAAMA;EApDb,OAoDaA;;;EACJC;EACAC;EACAC;EAER,YAAYD,OAAeC,QAAgB;AAC1C,SAAKD,QAAQA;AACb,SAAKC,SAASA;AACd,SAAKF,SAAS,IAAIG,aAAaF,QAAQC,MAAAA;EACxC;EAEAE,QAAc;AACb,SAAKJ,OAAOK,KAAK,CAAA;EAClB;EA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ASmD,UAAUL,aAAaiG,OAAO;UAAE9I;UAAOC;QAAO,CAAA;AAC/E;MACD;AAEA,WAAKJ,OAAOG,QAAQA;AACpB,WAAKH,OAAOI,SAASA;AACrB,WAAK6B,YAAW;AAChB,WAAKJ,QAAQmH,OAAO7I,OAAOC,MAAAA;AAE3B,WAAK4D,gBAAe;IACrB;EACD;AACD;","names":["APIErrorCode","createDiagnostic","formatForBrowser","reportRuntimeError","ZBuffer","buffer","width","height","Float32Array","clear","fill","get","x","y","set","z","resize","BaseScreen","canvas","context","runtime","width","height","alpha","pixelated","line_width","font","translation_x","translation_y","rotation","scale_x","scale_y","screen_transform","object_rotation","object_scale_x","object_scale_y","anchor_x","anchor_y","blending","font_load_requested","font_loaded","interfaceCache","cursor","cursor_visibility","last_mouse_move","Date","now","zBuffer","options","document","createElement","initContext","normal","additive","blendModes","mode","loadFont","ZBuffer","addEventListener","style","setInterval","checkMouseCursor","ctx","getContext","diagnostic","createDiagnostic","APIErrorCode","E7001","formatted","formatForBrowser","reportRuntimeError","listener","Error","restore","save","translate","ratio","Math","min","scale","lineCap","initDraw","updateInterface","clear","color","globalAlpha","globalCompositeOperation","fillStyle","strokeStyle","fillRect","setColor","Number","isNaN","parseInt","String","num","r","floor","g","b","c","hex","toString","substring","isValidColor","test","E7003","setAlpha","setPixelated","setBlending","blend","E7007","blendMode","setLineWidth","setLineDash","dash","Array","isArray","setLinearGradient","x1","y1","x2","y2","c1","c2","grd","createLinearGradient","addColorStop","setRadialGradient","x","y","radius","createRadialGradient","setFont","fonts","load","catch","E7006","isFontReady","ready","check","setTranslation","tx","ty","isFinite","updateScreenTransform","setScale","setRotation","setDrawAnchor","ax","ay","setDrawRotation","setDrawScale","initDrawOp","object_transform","res","rotate","PI","closeDrawOp","setCursorVisible","visible","getCanvas","resize","E7002"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Screen, Screen as default } from './screen.mjs';
|
|
2
|
+
import '../tri/triangle-screen.mjs';
|
|
3
|
+
import '@al8b/map';
|
|
4
|
+
import '@al8b/sprites';
|
|
5
|
+
import '../drawing/text-screen.mjs';
|
|
6
|
+
import '../drawing/sprite-screen.mjs';
|
|
7
|
+
import '../drawing/primitives-screen.mjs';
|
|
8
|
+
import './base-screen.mjs';
|
|
9
|
+
import '../tri/ttri.mjs';
|
|
10
|
+
import '../types/index.mjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Screen, Screen as default } from './screen.js';
|
|
2
|
+
import '../tri/triangle-screen.js';
|
|
3
|
+
import '@al8b/map';
|
|
4
|
+
import '@al8b/sprites';
|
|
5
|
+
import '../drawing/text-screen.js';
|
|
6
|
+
import '../drawing/sprite-screen.js';
|
|
7
|
+
import '../drawing/primitives-screen.js';
|
|
8
|
+
import './base-screen.js';
|
|
9
|
+
import '../tri/ttri.js';
|
|
10
|
+
import '../types/index.js';
|