textmode.js 0.6.0-beta.1 → 0.6.0-beta.3
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/dist/textmode.esm.js +2496 -2472
- package/dist/textmode.esm.min.js +2579 -2555
- package/dist/textmode.umd.js +11 -11
- package/dist/textmode.umd.min.js +11 -11
- package/dist/types/errors/ErrorHandler.d.ts +6 -1
- package/dist/types/rendering/webgl/batching/InstanceAttributeBinder.d.ts +6 -6
- package/dist/types/rendering/webgl/batching/InstanceBatch.d.ts +3 -3
- package/dist/types/rendering/webgl/batching/InstanceBuffer.d.ts +9 -9
- package/dist/types/rendering/webgl/batching/InstanceWriter.d.ts +2 -2
- package/dist/types/rendering/webgl/core/Framebuffer.d.ts +3 -3
- package/dist/types/textmode/Textmodifier.d.ts +1 -6
- package/dist/types/textmode/interfaces/ITextmodifier.d.ts +13 -10
- package/dist/types/textmode/loadables/TextmodeImage.d.ts +26 -0
- package/dist/types/textmode/loadables/TextmodeSource.d.ts +14 -14
- package/dist/types/textmode/loadables/TextmodeVideo.d.ts +29 -1
- package/dist/types/textmode/loadables/font/TextmodeFont.d.ts +3 -0
- package/dist/types/textmode/loading/LoadingPhaseTracker.d.ts +8 -8
- package/dist/types/textmode/loading/LoadingScreenManager.d.ts +49 -8
- package/dist/types/textmode/loading/LoadingScreenState.d.ts +11 -11
- package/dist/types/textmode/loading/LoadingScreenTheme.d.ts +3 -3
- package/dist/types/textmode/loading/LoadingScreenTransition.d.ts +5 -5
- package/dist/types/textmode/loading/index.d.ts +1 -1
- package/dist/types/textmode/managers/PluginManager.d.ts +6 -1
- package/dist/types/textmode/mixins/interfaces/IRenderingMixin.d.ts +218 -179
- package/package.json +1 -1
|
@@ -33,11 +33,11 @@ export declare class InstanceAttributeBinder {
|
|
|
33
33
|
*
|
|
34
34
|
* @param newCapacity New capacity in number of instances
|
|
35
35
|
*/
|
|
36
|
-
recreateBuffer(newCapacity: number): void;
|
|
36
|
+
$recreateBuffer(newCapacity: number): void;
|
|
37
37
|
/**
|
|
38
38
|
* Get the current GPU buffer capacity in instances.
|
|
39
39
|
*/
|
|
40
|
-
get capacity(): number;
|
|
40
|
+
get $capacity(): number;
|
|
41
41
|
/**
|
|
42
42
|
* Upload instance data to GPU buffer.
|
|
43
43
|
*
|
|
@@ -55,7 +55,7 @@ export declare class InstanceAttributeBinder {
|
|
|
55
55
|
* @param data Float32Array containing instance data to upload
|
|
56
56
|
* @param instanceCount Number of instances in the data
|
|
57
57
|
*/
|
|
58
|
-
upload(data: Float32Array, instanceCount: number): void;
|
|
58
|
+
$upload(data: Float32Array, instanceCount: number): void;
|
|
59
59
|
/**
|
|
60
60
|
* Get cached attribute locations for a shader program.
|
|
61
61
|
* Queries locations once per program and caches them for performance.
|
|
@@ -73,15 +73,15 @@ export declare class InstanceAttributeBinder {
|
|
|
73
73
|
*
|
|
74
74
|
* @param shader The shader program to bind attributes for
|
|
75
75
|
*/
|
|
76
|
-
bindAttributes(shader: GLShader): void;
|
|
76
|
+
$bindAttributes(shader: GLShader): void;
|
|
77
77
|
/**
|
|
78
78
|
* Unbind instance attributes to clean up WebGL state.
|
|
79
79
|
*
|
|
80
80
|
* @param shader The shader program to unbind attributes for
|
|
81
81
|
*/
|
|
82
|
-
unbindAttributes(shader: GLShader): void;
|
|
82
|
+
$unbindAttributes(shader: GLShader): void;
|
|
83
83
|
/**
|
|
84
84
|
* Dispose of WebGL resources.
|
|
85
85
|
*/
|
|
86
|
-
dispose(): void;
|
|
86
|
+
$dispose(): void;
|
|
87
87
|
}
|
|
@@ -49,15 +49,15 @@ export declare class InstanceBatch {
|
|
|
49
49
|
/**
|
|
50
50
|
* Get the current number of instances in the batch.
|
|
51
51
|
*/
|
|
52
|
-
get count(): number;
|
|
52
|
+
get $count(): number;
|
|
53
53
|
/**
|
|
54
54
|
* Check if the batch is empty.
|
|
55
55
|
*/
|
|
56
|
-
get isEmpty(): boolean;
|
|
56
|
+
get $isEmpty(): boolean;
|
|
57
57
|
/**
|
|
58
58
|
* Clear all instances from the batch.
|
|
59
59
|
*/
|
|
60
|
-
clear(): void;
|
|
60
|
+
$clear(): void;
|
|
61
61
|
/**
|
|
62
62
|
* Bind instance buffer and configure vertex attributes for instanced rendering.
|
|
63
63
|
* @param shader The shader program to bind attributes for
|
|
@@ -28,14 +28,14 @@ export declare class InstanceBuffer {
|
|
|
28
28
|
*
|
|
29
29
|
* @param requiredInstances Number of instances that need to fit
|
|
30
30
|
*/
|
|
31
|
-
ensureCapacity(requiredInstances: number): void;
|
|
31
|
+
$ensureCapacity(requiredInstances: number): void;
|
|
32
32
|
/**
|
|
33
33
|
* Get write pointer for direct buffer writing.
|
|
34
34
|
* Returns the current buffer and offset for zero-allocation writes.
|
|
35
35
|
*
|
|
36
36
|
* @returns Object containing buffer reference and current write offset
|
|
37
37
|
*/
|
|
38
|
-
getWritePointer(): {
|
|
38
|
+
$getWritePointer(): {
|
|
39
39
|
buffer: Float32Array;
|
|
40
40
|
offset: number;
|
|
41
41
|
};
|
|
@@ -45,12 +45,12 @@ export declare class InstanceBuffer {
|
|
|
45
45
|
*
|
|
46
46
|
* @param floatsWritten Number of floats written (should be FLOATS_PER_INSTANCE)
|
|
47
47
|
*/
|
|
48
|
-
commitWrite(floatsWritten: number): void;
|
|
48
|
+
$commitWrite(floatsWritten: number): void;
|
|
49
49
|
/**
|
|
50
50
|
* Reset buffer to empty state.
|
|
51
51
|
* Does not deallocate memory, just resets write pointer.
|
|
52
52
|
*/
|
|
53
|
-
reset(): void;
|
|
53
|
+
$reset(): void;
|
|
54
54
|
/**
|
|
55
55
|
* Get a subarray of the buffer containing used data.
|
|
56
56
|
*
|
|
@@ -58,21 +58,21 @@ export declare class InstanceBuffer {
|
|
|
58
58
|
* @param end Ending float index (default: current write position)
|
|
59
59
|
* @returns Float32Array view of the specified range
|
|
60
60
|
*/
|
|
61
|
-
subarray(start?: number, end?: number): Float32Array;
|
|
61
|
+
$subarray(start?: number, end?: number): Float32Array;
|
|
62
62
|
/**
|
|
63
63
|
* Get the number of instances currently in the buffer.
|
|
64
64
|
*/
|
|
65
|
-
get instanceCount(): number;
|
|
65
|
+
get $instanceCount(): number;
|
|
66
66
|
/**
|
|
67
67
|
* Get the current buffer capacity in instances.
|
|
68
68
|
*/
|
|
69
|
-
get capacity(): number;
|
|
69
|
+
get $capacity(): number;
|
|
70
70
|
/**
|
|
71
71
|
* Get the current write index in floats.
|
|
72
72
|
*/
|
|
73
|
-
get writeIndex(): number;
|
|
73
|
+
get $writeIndex(): number;
|
|
74
74
|
/**
|
|
75
75
|
* Check if buffer is empty.
|
|
76
76
|
*/
|
|
77
|
-
get isEmpty(): boolean;
|
|
77
|
+
get $isEmpty(): boolean;
|
|
78
78
|
}
|
|
@@ -62,9 +62,9 @@ export declare class InstanceWriter {
|
|
|
62
62
|
* @param data Instance write data
|
|
63
63
|
* @returns Index of the written instance
|
|
64
64
|
*/
|
|
65
|
-
writeInstance(data: InstanceWriteData): number;
|
|
65
|
+
$writeInstance(data: InstanceWriteData): number;
|
|
66
66
|
/**
|
|
67
67
|
* Get the current number of instances written.
|
|
68
68
|
*/
|
|
69
|
-
get instanceCount(): number;
|
|
69
|
+
get $instanceCount(): number;
|
|
70
70
|
}
|
|
@@ -14,13 +14,13 @@ export type FramebufferOptions = {
|
|
|
14
14
|
depth?: boolean;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* Options for creating a framebuffer.
|
|
17
|
+
* Options for creating a framebuffer. If not specified, width and height default to the current textmode grid size.
|
|
18
18
|
*/
|
|
19
19
|
export type TextmodeFramebufferOptions = {
|
|
20
20
|
/** Width of the framebuffer in grid cells */
|
|
21
|
-
width
|
|
21
|
+
width?: number;
|
|
22
22
|
/** Height of the framebuffer in grid cells */
|
|
23
|
-
height
|
|
23
|
+
height?: number;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* Framebuffer class for managing offscreen rendering targets initialized via {@link Textmodifier.createFramebuffer}.
|
|
@@ -31,22 +31,18 @@ declare const Textmodifier_base: {
|
|
|
31
31
|
export declare class Textmodifier extends Textmodifier_base implements ITextmodifier {
|
|
32
32
|
_renderer: GLRenderer;
|
|
33
33
|
_font: TextmodeFont;
|
|
34
|
-
_loadingFont: TextmodeFont;
|
|
35
34
|
_canvas: TextmodeCanvas;
|
|
36
35
|
_grid: TextmodeGrid;
|
|
37
|
-
_loadingGrid: TextmodeGrid;
|
|
38
36
|
_animationController: AnimationController;
|
|
39
37
|
_mouseManager: MouseManager;
|
|
40
38
|
_touchManager: TouchManager;
|
|
41
39
|
_keyboardManager: KeyboardManager;
|
|
40
|
+
_loading: LoadingScreenManager;
|
|
42
41
|
_textmodeDrawFramebuffer: GLFramebuffer;
|
|
43
|
-
_loadingDrawFramebuffer: GLFramebuffer;
|
|
44
42
|
_textmodeConversionShader: Shader;
|
|
45
43
|
_textmodeFramebuffer: GLFramebuffer;
|
|
46
|
-
_loadingFramebuffer: GLFramebuffer;
|
|
47
44
|
_presentShader: Shader;
|
|
48
45
|
private _pluginManager;
|
|
49
|
-
_loading: LoadingScreenManager;
|
|
50
46
|
private _destroyRequested;
|
|
51
47
|
private _isRenderingFrame;
|
|
52
48
|
private _isDisposed;
|
|
@@ -74,7 +70,6 @@ export declare class Textmodifier extends Textmodifier_base implements ITextmodi
|
|
|
74
70
|
resizeCanvas(width: number, height: number): void;
|
|
75
71
|
destroy(): void;
|
|
76
72
|
private _performDestroy;
|
|
77
|
-
/** Callbacks */
|
|
78
73
|
setup(callback: () => void | Promise<void>): void;
|
|
79
74
|
draw(callback: () => void): void;
|
|
80
75
|
windowResized(callback: () => void): void;
|
|
@@ -75,14 +75,16 @@ export interface ITextmodifier extends IRenderingMixin, IFontMixin, IAnimationMi
|
|
|
75
75
|
* const rows = textmodifier.grid.rows;
|
|
76
76
|
*
|
|
77
77
|
* // Initialize any variables that depend on grid size
|
|
78
|
-
*
|
|
79
|
-
*
|
|
78
|
+
* rectWidth = Math.floor(cols / 3);
|
|
79
|
+
* rectHeight = Math.floor(rows / 2);
|
|
80
80
|
* });
|
|
81
81
|
*
|
|
82
82
|
* // Draw callback - called every frame
|
|
83
83
|
* textmodifier.draw(() => {
|
|
84
84
|
* textmodifier.background(128);
|
|
85
|
-
* textmodifier.
|
|
85
|
+
* textmodifier.char('A');
|
|
86
|
+
* textmodifier.rotateZ(textmodifier.frameCount * 2);
|
|
87
|
+
* textmodifier.rect(rectWidth, rectHeight);
|
|
86
88
|
* });
|
|
87
89
|
* ```
|
|
88
90
|
*/
|
|
@@ -123,16 +125,17 @@ export interface ITextmodifier extends IRenderingMixin, IFontMixin, IAnimationMi
|
|
|
123
125
|
* ```javascript
|
|
124
126
|
* // Create a standalone textmodifier instance
|
|
125
127
|
* const t = textmode.create({
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
+
* width: window.innerWidth,
|
|
129
|
+
* height: window.innerHeight,
|
|
128
130
|
* });
|
|
129
131
|
*
|
|
130
132
|
* // Draw callback to update content
|
|
131
133
|
* t.draw(() => {
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
134
|
+
* // Set background color
|
|
135
|
+
* t.background(128);
|
|
136
|
+
* t.char('A');
|
|
137
|
+
* t.rotateZ(t.frameCount * 2);
|
|
138
|
+
* t.rect(16, 16);
|
|
136
139
|
* });
|
|
137
140
|
*
|
|
138
141
|
* // Set up window resize callback
|
|
@@ -140,7 +143,7 @@ export interface ITextmodifier extends IRenderingMixin, IFontMixin, IAnimationMi
|
|
|
140
143
|
* // Resize the canvas to match window size
|
|
141
144
|
* t.resizeCanvas(window.innerWidth, window.innerHeight);
|
|
142
145
|
* });
|
|
143
|
-
*
|
|
146
|
+
* ```
|
|
144
147
|
*/
|
|
145
148
|
windowResized(callback: () => void): void;
|
|
146
149
|
/**
|
|
@@ -8,6 +8,32 @@ import { TextmodeSource } from './TextmodeSource';
|
|
|
8
8
|
* An image uploaded currently runs through an adjustable brightness-converter that converts
|
|
9
9
|
* the original image into a textmode representation using characters.
|
|
10
10
|
* Those adjustable options are available via chainable methods on this class.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```javascript
|
|
14
|
+
* const t = textmode.create({
|
|
15
|
+
* width: 800,
|
|
16
|
+
* height: 600,
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* let img;
|
|
20
|
+
*
|
|
21
|
+
* t.setup(async () => {
|
|
22
|
+
* img = await t.loadImage('https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800&q=80');
|
|
23
|
+
* img.characters(" .:-=+*#%@");
|
|
24
|
+
* // ... other adjustments like img.flipX(boolean), img.cellColorMode('sampled' | 'fixed'), etc.
|
|
25
|
+
* // (can also be chained or updated during runtime)
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* t.draw(() => {
|
|
29
|
+
* t.background(0);
|
|
30
|
+
*
|
|
31
|
+
* if (img) {
|
|
32
|
+
* // Draw the loaded image
|
|
33
|
+
* t.image(img);
|
|
34
|
+
* }
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
11
37
|
*/
|
|
12
38
|
export declare class TextmodeImage extends TextmodeSource {
|
|
13
39
|
private constructor();
|
|
@@ -32,7 +32,7 @@ export declare abstract class TextmodeSource {
|
|
|
32
32
|
* Dispose of the underlying WebGL texture. Subclasses may extend for additional cleanup.
|
|
33
33
|
* @ignore
|
|
34
34
|
*/
|
|
35
|
-
dispose(): void;
|
|
35
|
+
$dispose(): void;
|
|
36
36
|
/**
|
|
37
37
|
* Set the invert flag, swapping character and cell colors when enabled.
|
|
38
38
|
* @param v Invert flag
|
|
@@ -71,31 +71,31 @@ export declare abstract class TextmodeSource {
|
|
|
71
71
|
cellColorMode(mode: 'sampled' | 'fixed'): this;
|
|
72
72
|
/**
|
|
73
73
|
* Defines the character color when {@link charColorMode} is `'fixed'`.
|
|
74
|
-
* @param colorOrGray A grayscale value or TextmodeColor
|
|
75
|
-
* @param g
|
|
76
|
-
* @param b
|
|
77
|
-
* @param a
|
|
74
|
+
* @param colorOrGray A grayscale value (0-255), hex string ('#RGB', '#RRGGBB', '#RRGGBBAA'), or TextmodeColor instance
|
|
75
|
+
* @param g Green component (0-255) if using RGB format
|
|
76
|
+
* @param b Blue component (0-255) if using RGB format
|
|
77
|
+
* @param a Alpha component (0-255) if using RGBA format
|
|
78
78
|
* @returns This instance for chaining.
|
|
79
79
|
*/
|
|
80
80
|
charColor(colorOrGray: number | string | TextmodeColor, g?: number, b?: number, a?: number): this;
|
|
81
81
|
/**
|
|
82
82
|
* Defines the cell color when {@link cellColorMode} is `'fixed'`.
|
|
83
|
-
* @param colorOrGray A grayscale value or TextmodeColor
|
|
84
|
-
* @param g
|
|
85
|
-
* @param b
|
|
86
|
-
* @param a
|
|
83
|
+
* @param colorOrGray A grayscale value (0-255), hex string ('#RGB', '#RRGGBB', '#RRGGBBAA'), or TextmodeColor instance
|
|
84
|
+
* @param g Green component (0-255) if using RGB format
|
|
85
|
+
* @param b Blue component (0-255) if using RGB format
|
|
86
|
+
* @param a Alpha component (0-255) if using RGBA format
|
|
87
87
|
* @returns This instance for chaining.
|
|
88
88
|
*/
|
|
89
89
|
cellColor(colorOrGray: number | string | TextmodeColor, g?: number, b?: number, a?: number): this;
|
|
90
90
|
/**
|
|
91
91
|
* Defines the background color used for transparent pixels.
|
|
92
|
-
* @param colorOrGray A grayscale value or TextmodeColor
|
|
93
|
-
* @param g
|
|
94
|
-
* @param b
|
|
95
|
-
* @param a
|
|
92
|
+
* @param colorOrGray A grayscale value (0-255), hex string ('#RGB', '#RRGGBB', '#RRGGBBAA'), or TextmodeColor instance
|
|
93
|
+
* @param g Green component (0-255) if using RGB format
|
|
94
|
+
* @param b Blue component (0-255) if using RGB format
|
|
95
|
+
* @param a Alpha component (0-255) if using RGBA format
|
|
96
96
|
* @returns This instance for chaining.
|
|
97
97
|
*/
|
|
98
|
-
background(colorOrGray: number | TextmodeColor, g?: number, b?: number, a?: number): this;
|
|
98
|
+
background(colorOrGray: number | TextmodeColor | string, g?: number, b?: number, a?: number): this;
|
|
99
99
|
/**
|
|
100
100
|
* Define the characters to use for brightness mapping as a string.
|
|
101
101
|
* Maximum length is 64; excess characters are ignored.
|
|
@@ -47,6 +47,34 @@ export interface TextmodeVideoOptions {
|
|
|
47
47
|
* A video uploaded currently runs through an adjustable brightness-converter that converts
|
|
48
48
|
* the video frames into a textmode representation using characters.
|
|
49
49
|
* Those adjustable options are available via chainable methods on this class.
|
|
50
|
+
* ```javascript
|
|
51
|
+
* const t = textmode.create({
|
|
52
|
+
* width: 800,
|
|
53
|
+
* height: 600,
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* let video;
|
|
57
|
+
*
|
|
58
|
+
* t.setup(async () => {
|
|
59
|
+
* video = await t.loadVideo('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4');
|
|
60
|
+
* // Start playback and enable looping so the video keeps playing
|
|
61
|
+
* video.play();
|
|
62
|
+
* video.loop();
|
|
63
|
+
*
|
|
64
|
+
* video.characters(" .:-=+*#%@");
|
|
65
|
+
* // ... other adjustments like video.flipX(boolean), video.cellColorMode('sampled' | 'fixed'), etc.
|
|
66
|
+
* // (can also be chained or updated during runtime)
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* t.draw(() => {
|
|
70
|
+
* t.background(0);
|
|
71
|
+
*
|
|
72
|
+
* if (video) {
|
|
73
|
+
* // Draw the loaded video
|
|
74
|
+
* t.image(video);
|
|
75
|
+
* }
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
50
78
|
*/
|
|
51
79
|
export declare class TextmodeVideo extends TextmodeSource {
|
|
52
80
|
private _videoElement;
|
|
@@ -74,7 +102,7 @@ export declare class TextmodeVideo extends TextmodeSource {
|
|
|
74
102
|
* Dispose of GPU resources and cleanup video element.
|
|
75
103
|
* @ignore
|
|
76
104
|
*/
|
|
77
|
-
dispose(): void;
|
|
105
|
+
$dispose(): void;
|
|
78
106
|
/**
|
|
79
107
|
* Update the texture with the current video frame if needed.
|
|
80
108
|
* For preloaded videos, this returns the appropriate frame texture.
|
|
@@ -7,6 +7,9 @@ import type { TyprFont, GlyphData } from './typr/types.ts';
|
|
|
7
7
|
*
|
|
8
8
|
* This class coordinates font loading, character extraction, texture atlas creation,
|
|
9
9
|
* and provides character information.
|
|
10
|
+
*
|
|
11
|
+
* The font used by your {@link Textmodifier} instance is accessible via
|
|
12
|
+
* the {@link Textmodifier.font} property.
|
|
10
13
|
*/
|
|
11
14
|
export declare class TextmodeFont {
|
|
12
15
|
private _font;
|
|
@@ -9,12 +9,12 @@ export declare class LoadingPhaseTracker {
|
|
|
9
9
|
private _totalWeight;
|
|
10
10
|
private _lastReportedProgress;
|
|
11
11
|
private _onProgressChange?;
|
|
12
|
-
get totalWeight(): number;
|
|
13
|
-
get progress(): number;
|
|
14
|
-
setProgressChangeCallback(callback: (progress: number) => void): void;
|
|
15
|
-
createPhase(label: string, weight?: number): string;
|
|
16
|
-
updatePhaseProgress(id: string, progress: number): void;
|
|
17
|
-
completePhase(id: string): void;
|
|
18
|
-
failPhase(id: string): void;
|
|
19
|
-
snapshotPhases(): LoadingPhaseSnapshot[];
|
|
12
|
+
get $totalWeight(): number;
|
|
13
|
+
get $progress(): number;
|
|
14
|
+
$setProgressChangeCallback(callback: (progress: number) => void): void;
|
|
15
|
+
$createPhase(label: string, weight?: number): string;
|
|
16
|
+
$updatePhaseProgress(id: string, progress: number): void;
|
|
17
|
+
$completePhase(id: string): void;
|
|
18
|
+
$failPhase(id: string): void;
|
|
19
|
+
$snapshotPhases(): LoadingPhaseSnapshot[];
|
|
20
20
|
}
|
|
@@ -10,10 +10,18 @@ export declare class LoadingScreenManager {
|
|
|
10
10
|
private readonly _stateMachine;
|
|
11
11
|
private readonly _phaseTracker;
|
|
12
12
|
private readonly _transition;
|
|
13
|
+
private readonly _loadingAnimationController;
|
|
14
|
+
private _loadingFont;
|
|
15
|
+
private _loadingGrid;
|
|
16
|
+
private _loadingDrawFramebuffer;
|
|
17
|
+
private _loadingFramebuffer;
|
|
13
18
|
private _renderer;
|
|
14
19
|
private _palette;
|
|
15
20
|
private _theme;
|
|
16
21
|
private _startTime;
|
|
22
|
+
private _loadingFrameCount;
|
|
23
|
+
private _isRendering;
|
|
24
|
+
private _isInitialized;
|
|
17
25
|
/**
|
|
18
26
|
* Initializes a new LoadingScreenManager.
|
|
19
27
|
* @param textmodifier Textmodifier instance to render on.
|
|
@@ -22,11 +30,40 @@ export declare class LoadingScreenManager {
|
|
|
22
30
|
* @ignore
|
|
23
31
|
*/
|
|
24
32
|
constructor(textmodifier: Textmodifier, opts: LoadingScreenOptions | undefined, canvasBackground: RGBA | null);
|
|
33
|
+
/**
|
|
34
|
+
* Initialize loading screen resources (font, grid, framebuffers).
|
|
35
|
+
* Must be called after the renderer is ready.
|
|
36
|
+
* @param fontSource Optional font source for the loading screen
|
|
37
|
+
* @ignore
|
|
38
|
+
*/
|
|
39
|
+
$initialize(fontSource?: string): Promise<void>;
|
|
25
40
|
/**
|
|
26
41
|
* Indicates whether the loading screen should render this frame.
|
|
27
42
|
* @ignore
|
|
28
43
|
*/
|
|
29
|
-
get shouldRender(): boolean;
|
|
44
|
+
get $shouldRender(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Start the independent loading screen animation loop.
|
|
47
|
+
* This runs independently of the user's animation loop.
|
|
48
|
+
* @ignore
|
|
49
|
+
*/
|
|
50
|
+
$start(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Stop the independent loading screen animation loop.
|
|
53
|
+
* @ignore
|
|
54
|
+
*/
|
|
55
|
+
$stop(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Handle canvas resize during loading.
|
|
58
|
+
* Updates grid and framebuffers to match new canvas dimensions.
|
|
59
|
+
* @ignore
|
|
60
|
+
*/
|
|
61
|
+
$resize(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Dispose of the loading screen manager and clean up resources.
|
|
64
|
+
* @ignore
|
|
65
|
+
*/
|
|
66
|
+
$dispose(): void;
|
|
30
67
|
/**
|
|
31
68
|
* Get the current overall loading progress (0-1).
|
|
32
69
|
*
|
|
@@ -111,7 +148,7 @@ export declare class LoadingScreenManager {
|
|
|
111
148
|
* Finish the loading process.
|
|
112
149
|
* @ignore
|
|
113
150
|
*/
|
|
114
|
-
finish(): void;
|
|
151
|
+
$finish(): void;
|
|
115
152
|
private _notifyComplete;
|
|
116
153
|
private _onCompleteCallback?;
|
|
117
154
|
/**
|
|
@@ -119,7 +156,7 @@ export declare class LoadingScreenManager {
|
|
|
119
156
|
* @param callback The callback function to invoke.
|
|
120
157
|
* @ignore
|
|
121
158
|
*/
|
|
122
|
-
setOnComplete(callback: () => void): void;
|
|
159
|
+
$setOnComplete(callback: () => void): void;
|
|
123
160
|
/**
|
|
124
161
|
* Report an error that occurred during loading.
|
|
125
162
|
* @param error The error message or `Error` object.
|
|
@@ -148,18 +185,22 @@ export declare class LoadingScreenManager {
|
|
|
148
185
|
*/
|
|
149
186
|
error(error: Error | string): void;
|
|
150
187
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* @
|
|
188
|
+
* Independent render loop for the loading screen.
|
|
189
|
+
* This runs on its own animation controller, separate from user animation.
|
|
190
|
+
* @ignore
|
|
191
|
+
*/
|
|
192
|
+
private _renderLoadingFrame;
|
|
193
|
+
/**
|
|
194
|
+
* Performs the actual rendering of the loading screen.
|
|
154
195
|
* @ignore
|
|
155
196
|
*/
|
|
156
|
-
|
|
197
|
+
private _performRender;
|
|
157
198
|
/**
|
|
158
199
|
* Update the background color used in the loading screen theme.
|
|
159
200
|
* @param color The new background color.
|
|
160
201
|
* @ignore
|
|
161
202
|
*/
|
|
162
|
-
updateBackgroundColor(color: RGBA | null): void;
|
|
203
|
+
$updateBackgroundColor(color: RGBA | null): void;
|
|
163
204
|
private _resolveRenderer;
|
|
164
205
|
/**
|
|
165
206
|
* Renders the library branding tag at the bottom left of the loading screen.
|
|
@@ -8,15 +8,15 @@ export declare class LoadingScreenStateMachine {
|
|
|
8
8
|
private _errorMessage;
|
|
9
9
|
private _errorDetails;
|
|
10
10
|
constructor(initialState?: LoadingScreenState);
|
|
11
|
-
get state(): LoadingScreenState;
|
|
12
|
-
get isEnabled(): boolean;
|
|
13
|
-
get shouldRender(): boolean;
|
|
14
|
-
get errorMessage(): string;
|
|
15
|
-
get errorDetails(): string;
|
|
16
|
-
activate(): void;
|
|
17
|
-
finish(): void;
|
|
18
|
-
startTransition(): void;
|
|
19
|
-
completeTransition(): void;
|
|
20
|
-
setError(error: Error | string): void;
|
|
21
|
-
disable(): void;
|
|
11
|
+
get $state(): LoadingScreenState;
|
|
12
|
+
get $isEnabled(): boolean;
|
|
13
|
+
get $shouldRender(): boolean;
|
|
14
|
+
get $errorMessage(): string;
|
|
15
|
+
get $errorDetails(): string;
|
|
16
|
+
$activate(): void;
|
|
17
|
+
$finish(): void;
|
|
18
|
+
$startTransition(): void;
|
|
19
|
+
$completeTransition(): void;
|
|
20
|
+
$setError(error: Error | string): void;
|
|
21
|
+
$disable(): void;
|
|
22
22
|
}
|
|
@@ -8,14 +8,14 @@ import type { TextmodeColor } from '../TextmodeColor';
|
|
|
8
8
|
* @returns The resolved loading screen theme.
|
|
9
9
|
* @ignore
|
|
10
10
|
*/
|
|
11
|
-
export declare function resolveTheme(options: LoadingScreenOptions, background: [number, number, number, number] | null): LoadingScreenTheme;
|
|
11
|
+
export declare function $resolveTheme(options: LoadingScreenOptions, background: [number, number, number, number] | null): LoadingScreenTheme;
|
|
12
12
|
/**
|
|
13
13
|
* Resolves the default color palette based on the theme mode.
|
|
14
14
|
* @param theme The loading screen theme.
|
|
15
15
|
* @returns An array of color strings representing the default palette.
|
|
16
16
|
* @ignore
|
|
17
17
|
*/
|
|
18
|
-
export declare function resolveDefaultPalette(theme: LoadingScreenTheme): string[];
|
|
18
|
+
export declare function $resolveDefaultPalette(theme: LoadingScreenTheme): string[];
|
|
19
19
|
/**
|
|
20
20
|
* Resolves an array of color inputs into TextmodeColor instances.
|
|
21
21
|
* @param inputs Input colors as numbers, strings, or TextmodeColor instances.
|
|
@@ -23,4 +23,4 @@ export declare function resolveDefaultPalette(theme: LoadingScreenTheme): string
|
|
|
23
23
|
* @returns An array of TextmodeColor instances.
|
|
24
24
|
* @ignore
|
|
25
25
|
*/
|
|
26
|
-
export declare function resolveColorInputs(inputs: (number | string | TextmodeColor)[], textmodifier: Textmodifier): TextmodeColor[];
|
|
26
|
+
export declare function $resolveColorInputs(inputs: (number | string | TextmodeColor)[], textmodifier: Textmodifier): TextmodeColor[];
|
|
@@ -9,9 +9,9 @@ export declare class LoadingScreenTransition {
|
|
|
9
9
|
private _transitionType;
|
|
10
10
|
private _transitionDuration;
|
|
11
11
|
constructor(transitionType: TransitionType, transitionDuration: number);
|
|
12
|
-
get opacity(): number;
|
|
13
|
-
get isTransitioning(): boolean;
|
|
14
|
-
start(): void;
|
|
15
|
-
update(): boolean;
|
|
16
|
-
reset(): void;
|
|
12
|
+
get $opacity(): number;
|
|
13
|
+
get $isTransitioning(): boolean;
|
|
14
|
+
$start(): void;
|
|
15
|
+
$update(): boolean;
|
|
16
|
+
$reset(): void;
|
|
17
17
|
}
|
|
@@ -2,5 +2,5 @@ export { LoadingScreenManager } from './LoadingScreenManager';
|
|
|
2
2
|
export { LoadingPhaseTracker } from './LoadingPhaseTracker';
|
|
3
3
|
export { LoadingScreenStateMachine } from './LoadingScreenState';
|
|
4
4
|
export { LoadingScreenTransition } from './LoadingScreenTransition';
|
|
5
|
-
export { resolveTheme, resolveDefaultPalette, resolveColorInputs } from './LoadingScreenTheme';
|
|
5
|
+
export { $resolveTheme as resolveTheme, $resolveDefaultPalette as resolveDefaultPalette, $resolveColorInputs as resolveColorInputs } from './LoadingScreenTheme';
|
|
6
6
|
export type { LoadingPhaseSnapshot, LoadingScreenOptions, LoadingScreenRendererContext, LoadingPhaseHandle, LoadingScreenTheme, LoadingScreenState } from './types';
|
|
@@ -17,7 +17,7 @@ export interface TextmodePluginAPI {
|
|
|
17
17
|
grid: TextmodeGrid;
|
|
18
18
|
/** The canvas used by the Textmodifier instance. */
|
|
19
19
|
canvas: TextmodeCanvas;
|
|
20
|
-
/** The framebuffer the user draws to. */
|
|
20
|
+
/** The framebuffer the user draws to with 3 render targets. */
|
|
21
21
|
drawFramebuffer: GLFramebuffer;
|
|
22
22
|
/** The framebuffer containing the ASCII representation.<br/>
|
|
23
23
|
* This framebuffer only has a single render target. */
|
|
@@ -35,6 +35,11 @@ export interface TextmodePluginAPI {
|
|
|
35
35
|
* A plugin interface for extending the functionality of a {@link Textmodifier} instance.
|
|
36
36
|
*
|
|
37
37
|
* Users can create plugins by implementing this interface.
|
|
38
|
+
*
|
|
39
|
+
* @note
|
|
40
|
+
* Plugins are currently experimental and the API may change in future releases.
|
|
41
|
+
* For now, it has been integrated to outsource export features to `textmode.export.js`.
|
|
42
|
+
* Documentation and examples will be provided as the plugin system matures.
|
|
38
43
|
*/
|
|
39
44
|
export interface TextmodePlugin {
|
|
40
45
|
/** Unique name for the plugin. */
|