@cosmoledo/gleam 1.0.0 → 1.0.2
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 +21 -3
- package/dist/gleam.d.ts +526 -62
- package/dist/gleam.esm.js +358 -81
- package/dist/gleam.esm.js.map +3 -3
- package/dist/gleam.js +358 -81
- package/dist/gleam.js.map +3 -3
- package/dist/gleam.min.js +7 -7
- package/dist/gleam.min.js.map +4 -4
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@cosmoledo/gleam)
|
|
4
|
+
[](https://github.com/Cosmoledo/Gleam/actions/workflows/ci.yml)
|
|
5
|
+
[](https://github.com/Cosmoledo/Gleam/blob/main/LICENSE.txt)
|
|
6
|
+
|
|
7
|
+
</div>
|
|
8
|
+
|
|
1
9
|
# Gleam
|
|
2
10
|
|
|
3
|
-
A
|
|
11
|
+
A TypeScript framework for 2D canvas games in the browser.
|
|
4
12
|
|
|
5
13
|
- **G**raphics
|
|
6
14
|
- `CanvasManager` — sizes/clears the canvas and exposes the 2D context
|
|
@@ -30,6 +38,8 @@ Also bundled: asset loaders (`UrlLoaders`, `TiledMap`), `Translator` for localiz
|
|
|
30
38
|
## Contents
|
|
31
39
|
|
|
32
40
|
- [Install](#install)
|
|
41
|
+
- [Examples](#examples)
|
|
42
|
+
- [API reference](#api-reference)
|
|
33
43
|
- [Quick start](#quick-start)
|
|
34
44
|
- [Constraints](#constraints)
|
|
35
45
|
- [How errors surface](#how-errors-surface)
|
|
@@ -46,13 +56,21 @@ npm install @cosmoledo/gleam
|
|
|
46
56
|
Or drop the IIFE bundle into a page and use the `Gleam` global:
|
|
47
57
|
|
|
48
58
|
```html
|
|
49
|
-
<script src="https://
|
|
59
|
+
<script src="https://cdn.jsdelivr.net/npm/@cosmoledo/gleam/dist/gleam.min.js"></script>
|
|
50
60
|
<script>
|
|
51
61
|
const { Game, Settings } = Gleam;
|
|
52
62
|
// ...
|
|
53
63
|
</script>
|
|
54
64
|
```
|
|
55
65
|
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
Live demos: [cosmoledo.github.io/Gleam/examples/](https://cosmoledo.github.io/Gleam/examples/). Source under [`examples/`](https://github.com/Cosmoledo/Gleam/tree/main/examples) — each demo is a single self-contained HTML file that imports the published bundle via jsdelivr, so you can also open them directly with any static server (`npx serve examples`).
|
|
69
|
+
|
|
70
|
+
## API reference
|
|
71
|
+
|
|
72
|
+
Full API reference is generated from the source by [TypeDoc](https://typedoc.org/) and served alongside the examples on Pages: [cosmoledo.github.io/Gleam/](https://cosmoledo.github.io/Gleam/). Regenerate locally with `npm run docs` (outputs to `docs/`, gitignored).
|
|
73
|
+
|
|
56
74
|
## Quick start
|
|
57
75
|
|
|
58
76
|
Add a canvas to the page:
|
|
@@ -64,7 +82,7 @@ Add a canvas to the page:
|
|
|
64
82
|
Subclass `Game`, register the canvas as `MAIN` on the `CanvasManager` instance `canman`, implement `init`/`update`/`draw`, and kick off `preInit()` from the constructor:
|
|
65
83
|
|
|
66
84
|
```ts
|
|
67
|
-
import Game,
|
|
85
|
+
import { Game, CANVAS_TYPES, type SettingsOverrides } from "@cosmoledo/gleam";
|
|
68
86
|
|
|
69
87
|
class MyGame extends Game {
|
|
70
88
|
constructor(overrides: SettingsOverrides = {}) {
|