create-dreamer-app 1.0.9 → 1.0.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Disco Dreamer reference
|
|
2
2
|
|
|
3
|
-
A practical guide to building browser games with `discodreamer`. Examples use the public API in version 1.0.
|
|
3
|
+
A practical guide to building browser games with `discodreamer`. Examples use the public API in version 1.0.7 and TypeScript with JSX.
|
|
4
4
|
|
|
5
5
|
## How a game runs
|
|
6
6
|
|
|
@@ -147,12 +147,13 @@ The sprite's position is its unrotated top-left corner. Images are cached by URL
|
|
|
147
147
|
|
|
148
148
|
### `Text`
|
|
149
149
|
|
|
150
|
-
Draws
|
|
150
|
+
Draws left-aligned, top-aligned text in the supplied `color`, or white by default. Uses `sans-serif` unless a font family is supplied.
|
|
151
151
|
|
|
152
152
|
| Prop | Default | Purpose |
|
|
153
153
|
| --- | --- | --- |
|
|
154
154
|
| `value` | Required | Text string to draw |
|
|
155
155
|
| `x`, `y`, `z` | `0` | Position and sibling draw order |
|
|
156
|
+
| `color` | `"white"` | Text fill color as a canvas color string, such as `"red"` or `"#ff00ff"` |
|
|
156
157
|
| `fontSize` | `25` | Font size in pixels |
|
|
157
158
|
| `font` | `""` (renders as `sans-serif`) | Font family name, such as a name registered with `addCustomFont` |
|
|
158
159
|
| `width` | `Infinity` | Maximum canvas text draw width |
|
|
@@ -161,7 +162,7 @@ A finite `width` limits the canvas text draw width; it does not create wrapping
|
|
|
161
162
|
|
|
162
163
|
```tsx
|
|
163
164
|
<Text x={16} y={16} value="Score: 10" fontSize={24} />
|
|
164
|
-
<Text x={16} y={48} value="Custom font" font="PixelFont" fontSize={32} />
|
|
165
|
+
<Text x={16} y={48} value="Custom font" font="PixelFont" fontSize={32} color="#ff00ff" />
|
|
165
166
|
```
|
|
166
167
|
|
|
167
168
|
## Custom fonts
|