textmode.js 0.2.1-beta.8 → 0.3.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/README.md +25 -22
- package/dist/textmode.esm.js +1322 -1048
- package/dist/textmode.esm.min.js +1330 -1056
- package/dist/textmode.umd.js +8 -8
- package/dist/textmode.umd.min.js +8 -8
- package/dist/types/index.d.ts +2 -0
- package/dist/types/rendering/webgl/Framebuffer.d.ts +1 -1
- package/dist/types/textmode/TextmodeImage.d.ts +4 -4
- package/dist/types/textmode/Textmodifier.d.ts +7 -4
- package/dist/types/textmode/managers/KeyboardManager.d.ts +2 -0
- package/dist/types/textmode/managers/MouseManager.d.ts +19 -1
- package/dist/types/textmode/managers/TouchManager.d.ts +225 -0
- package/dist/types/textmode/managers/index.d.ts +12 -4
- package/dist/types/textmode/mixins/KeyboardMixin.d.ts +3 -2
- package/dist/types/textmode/mixins/MouseMixin.d.ts +23 -6
- package/dist/types/textmode/mixins/RenderingMixin.d.ts +4 -2
- package/dist/types/textmode/mixins/TextmodifierMixin.d.ts +5 -2
- package/dist/types/textmode/mixins/TouchMixin.d.ts +191 -0
- package/dist/types/textmode/mixins/index.d.ts +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,25 +10,40 @@
|
|
|
10
10
|
|
|
11
11
|
</div>
|
|
12
12
|
|
|
13
|
-
textmode.js is a lightweight creative-coding library for real‑time ASCII and textmode graphics in the browser. It combines a grid‑based API with a modern `WebGL2` pipeline, multiple render targets, and aggressive instanced rendering to deliver smooth, high‑performance rendering.
|
|
13
|
+
textmode.js is a free, lightweight, and framework-agnostic creative-coding library for real‑time ASCII and textmode graphics in the browser. It combines a grid‑based API with a modern [`WebGL2`](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext) pipeline, multiple render targets, and aggressive instanced rendering to deliver smooth, high‑performance rendering.
|
|
14
14
|
|
|
15
15
|
The library is designed to be easy to use and accessible to developers of all skill levels. Whether you're a seasoned developer or just starting out, `textmode.js` provides a simple and intuitive API that makes it easy to create stunning textmode art and animations.
|
|
16
16
|
|
|
17
|
-
Key ideas in one sentence: you draw with simple shape calls; under the hood we batch instances and write to a special framebuffer with five render targets; a conversion pass maps those buffers to a crisp grid of characters on the canvas.
|
|
18
|
-
|
|
19
17
|
## Features
|
|
18
|
+
|
|
20
19
|
- Real‑time* ASCII/textmode rendering with a simple drawing API
|
|
21
20
|
- `WebGL2` pipeline with [Multiple Render Targets (MRT)](https://en.wikipedia.org/wiki/Multiple_Render_Targets) for rich per‑cell data
|
|
22
21
|
- Instanced rendering and batching for low draw call counts
|
|
23
|
-
- Font system with runtime font loading and dynamic sizing
|
|
22
|
+
- Font system with runtime font loading and dynamic sizing *(supports TTF/OTF/WOFF)*
|
|
24
23
|
- Author custom filter shaders in [`GLSL ES 3.00`](https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf) for advanced effects
|
|
25
24
|
- Flexible exporting: TXT, SVG, and raster images *(PNG/JPG/WebP)*
|
|
26
25
|
- Animation loop control: `frameRate`, `loop`/`noLoop`, `redraw`, `frameCount`, etc.
|
|
26
|
+
- Framework-agnostic: Use `textmode.js` with any canvas-based framework or library
|
|
27
27
|
- Zero dependencies, written in TypeScript, with comprehensive type definitions
|
|
28
28
|
|
|
29
29
|
> [!NOTE]
|
|
30
30
|
> *Performance depends on the complexity of your scene and device capabilities. Consider authoring filter shaders for complex effects at low cost.
|
|
31
31
|
|
|
32
|
+
## Try it online first
|
|
33
|
+
|
|
34
|
+
Before installing anything locally, you can try `textmode.js` directly in your browser using our dedicated web editor:
|
|
35
|
+
|
|
36
|
+
🌐 **[editor.textmode.art](https://editor.textmode.art)**
|
|
37
|
+
|
|
38
|
+
The web editor is specifically designed for `textmode.js` and provides:
|
|
39
|
+
- ✨ **Zero setup required** - Start coding immediately
|
|
40
|
+
- 🚀 **Live preview** - See your creations in real-time
|
|
41
|
+
- 💾 **Save & share** - Export your sketches and share with others
|
|
42
|
+
- 📚 **Built-in examples** - Learn from interactive examples
|
|
43
|
+
- 🔧 **Full API access** - All `textmode.js` features available
|
|
44
|
+
|
|
45
|
+
The web editor is perfect for learning, prototyping, or creating quick experiments without any local setup!
|
|
46
|
+
|
|
32
47
|
## Installation
|
|
33
48
|
|
|
34
49
|
### Prerequisites
|
|
@@ -47,10 +62,10 @@ To get started with `textmode.js`, you'll need:
|
|
|
47
62
|
|
|
48
63
|
| Bundle type | File size | Font included? | Best for |
|
|
49
64
|
|-------------|-----------|---------------|----------|
|
|
50
|
-
| **Standard UMD** (`textmode.umd.js`) | ~
|
|
51
|
-
| **Standard ESM** (`textmode.esm.js`) | ~
|
|
52
|
-
| **Minified UMD** (`textmode.umd.min.js`) | ~
|
|
53
|
-
| **Minified ESM** (`textmode.esm.min.js`) | ~
|
|
65
|
+
| **Standard UMD** (`textmode.umd.js`) | ~94kB | ✅ [UrsaFont](https://ursafrank.itch.io/ursafont) embedded | Quick setup, prototyping |
|
|
66
|
+
| **Standard ESM** (`textmode.esm.js`) | ~121kB | ✅ [UrsaFont](https://ursafrank.itch.io/ursafont) embedded | Quick setup, prototyping |
|
|
67
|
+
| **Minified UMD** (`textmode.umd.min.js`) | ~96kB | ❌ Requires external font | Custom fonts |
|
|
68
|
+
| **Minified ESM** (`textmode.esm.min.js`) | ~113kB | ❌ Requires external font | Custom fonts |
|
|
54
69
|
|
|
55
70
|
**Choose standard bundles for:**
|
|
56
71
|
- Quick setup with no additional configuration
|
|
@@ -62,7 +77,7 @@ To get started with `textmode.js`, you'll need:
|
|
|
62
77
|
> [!NOTE]
|
|
63
78
|
> Apart from the font inclusion, both bundle types are functionally identical and equally minified.
|
|
64
79
|
|
|
65
|
-
|
|
80
|
+
#### UMD
|
|
66
81
|
|
|
67
82
|
To use `textmode.js` in a UMD environment, download the latest `umd` build from the [**GitHub releases page**](https://github.com/humanbydefinition/textmode.js/releases/) or import it directly from a CDN like [**jsDelivr**](https://www.jsdelivr.com/package/npm/textmode.js). The library is distributed as a single JavaScript file, which you can include in your project by adding the following script tag to your HTML file:
|
|
68
83
|
|
|
@@ -113,7 +128,7 @@ t.windowResized(() => {
|
|
|
113
128
|
});
|
|
114
129
|
```
|
|
115
130
|
|
|
116
|
-
|
|
131
|
+
#### ESM
|
|
117
132
|
|
|
118
133
|
To use `textmode.js` in an ESM environment, you can install it via `npm`:
|
|
119
134
|
|
|
@@ -171,18 +186,6 @@ t.windowResized(() => {
|
|
|
171
186
|
});
|
|
172
187
|
```
|
|
173
188
|
|
|
174
|
-
## Verification
|
|
175
|
-
|
|
176
|
-
To verify your installation is working correctly, try this simple test:
|
|
177
|
-
|
|
178
|
-
```javascript
|
|
179
|
-
// Test if textmode.js is available
|
|
180
|
-
console.log('textmode.js version:', textmode.version);
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
> [!NOTE]
|
|
184
|
-
> If you see the version number printed in the console, your installation was successful!
|
|
185
|
-
|
|
186
189
|
## Next steps
|
|
187
190
|
|
|
188
191
|
Now that you have `textmode.js` set up, you can start creating your textmode art projects! Going forward, here are some resources to help you get the most out of the library:
|