@dryanovski/gamefoo 0.0.1 → 0.2.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/dist/core/animate.d.ts +129 -0
- package/dist/core/animate.d.ts.map +1 -0
- package/dist/core/asset.d.ts +59 -0
- package/dist/core/asset.d.ts.map +1 -0
- package/dist/core/behaviour.d.ts +118 -0
- package/dist/core/behaviour.d.ts.map +1 -1
- package/dist/core/behaviours/collidable.d.ts +203 -4
- package/dist/core/behaviours/collidable.d.ts.map +1 -1
- package/dist/core/behaviours/control.d.ts +51 -3
- package/dist/core/behaviours/control.d.ts.map +1 -1
- package/dist/core/behaviours/healtkit.d.ts +120 -3
- package/dist/core/behaviours/healtkit.d.ts.map +1 -1
- package/dist/core/behaviours/sprite_render.d.ts +141 -0
- package/dist/core/behaviours/sprite_render.d.ts.map +1 -0
- package/dist/core/camera.d.ts +101 -0
- package/dist/core/camera.d.ts.map +1 -1
- package/dist/core/engine.d.ts +377 -15
- package/dist/core/engine.d.ts.map +1 -1
- package/dist/core/fonts/font_bitmap.d.ts +156 -0
- package/dist/core/fonts/font_bitmap.d.ts.map +1 -0
- package/dist/core/fonts/font_bitmap_prebuild.d.ts +102 -0
- package/dist/core/fonts/font_bitmap_prebuild.d.ts.map +1 -0
- package/dist/core/fonts/internal/font_3x5.d.ts +76 -0
- package/dist/core/fonts/internal/font_3x5.d.ts.map +1 -0
- package/dist/core/fonts/internal/font_4x6.d.ts +76 -0
- package/dist/core/fonts/internal/font_4x6.d.ts.map +1 -0
- package/dist/core/fonts/internal/font_5x5.d.ts +79 -0
- package/dist/core/fonts/internal/font_5x5.d.ts.map +1 -0
- package/dist/core/fonts/internal/font_6x8.d.ts +76 -0
- package/dist/core/fonts/internal/font_6x8.d.ts.map +1 -0
- package/dist/core/fonts/internal/font_8x13.d.ts +76 -0
- package/dist/core/fonts/internal/font_8x13.d.ts.map +1 -0
- package/dist/core/fonts/internal/font_8x8.d.ts +76 -0
- package/dist/core/fonts/internal/font_8x8.d.ts.map +1 -0
- package/dist/core/game_object_register.d.ts +101 -1
- package/dist/core/game_object_register.d.ts.map +1 -1
- package/dist/core/input.d.ts +131 -0
- package/dist/core/input.d.ts.map +1 -1
- package/dist/core/sprite.d.ts +232 -0
- package/dist/core/sprite.d.ts.map +1 -0
- package/dist/core/utils/perlin_noise.d.ts +136 -0
- package/dist/core/utils/perlin_noise.d.ts.map +1 -0
- package/dist/core/world.d.ts +147 -0
- package/dist/core/world.d.ts.map +1 -1
- package/dist/debug/monitor.d.ts +12 -0
- package/dist/debug/monitor.d.ts.map +1 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/log.d.ts +33 -0
- package/dist/decorators/log.d.ts.map +1 -0
- package/dist/entities/dynamic_entity.d.ts +82 -0
- package/dist/entities/dynamic_entity.d.ts.map +1 -1
- package/dist/entities/entity.d.ts +216 -11
- package/dist/entities/entity.d.ts.map +1 -1
- package/dist/entities/player.d.ts +76 -0
- package/dist/entities/player.d.ts.map +1 -1
- package/dist/entities/text.d.ts +52 -0
- package/dist/entities/text.d.ts.map +1 -0
- package/dist/index.d.ts +29 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -604
- package/dist/index.js.map +3 -15
- package/dist/subsystems/camera_system.d.ts +25 -0
- package/dist/subsystems/camera_system.d.ts.map +1 -0
- package/dist/subsystems/collision_system.d.ts +16 -0
- package/dist/subsystems/collision_system.d.ts.map +1 -0
- package/dist/subsystems/monitor_system.d.ts +17 -0
- package/dist/subsystems/monitor_system.d.ts.map +1 -0
- package/dist/subsystems/object_system.d.ts +18 -0
- package/dist/subsystems/object_system.d.ts.map +1 -0
- package/dist/subsystems/types.d.ts +40 -0
- package/dist/subsystems/types.d.ts.map +1 -0
- package/dist/types.d.ts +140 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +25 -11
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in 3x5 pixel bitmap font.
|
|
3
|
+
*
|
|
4
|
+
* Each character is a 3-pixel-wide, 5-pixel-tall glyph stored as an
|
|
5
|
+
* array of 5 integers. Each integer is a bitmask where bit 2
|
|
6
|
+
* (MSB) corresponds to the leftmost pixel and bit 0 to the rightmost.
|
|
7
|
+
*
|
|
8
|
+
* Ultra-compact, great for HUDs and tiny labels.
|
|
9
|
+
*
|
|
10
|
+
* Supported characters: uppercase A–Z, lowercase a–z, digits 0–9,
|
|
11
|
+
* and common punctuation / special characters.
|
|
12
|
+
*
|
|
13
|
+
* @category Fonts
|
|
14
|
+
* @since 0.2.0
|
|
15
|
+
* @internal
|
|
16
|
+
*
|
|
17
|
+
* @example Reading a glyph
|
|
18
|
+
* ```ts
|
|
19
|
+
* import FONT_3x5 from "./font_3x5";
|
|
20
|
+
*
|
|
21
|
+
* const letterA = FONT_3x5["A"];
|
|
22
|
+
* // 2, 5, 7, 5, 5
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
/** Catalogue name used by {@link FontBitmap} to look up this font. */
|
|
26
|
+
export declare const FONT_3x5_NAME = "3x5";
|
|
27
|
+
/**
|
|
28
|
+
* Glyph width in pixels (excluding spacing).
|
|
29
|
+
* @defaultValue `3`
|
|
30
|
+
*/
|
|
31
|
+
export declare const FONT_3x5_WIDTH = 3;
|
|
32
|
+
/**
|
|
33
|
+
* Glyph height in pixels.
|
|
34
|
+
* @defaultValue `5`
|
|
35
|
+
*/
|
|
36
|
+
export declare const FONT_3x5_HEIGHT = 5;
|
|
37
|
+
/**
|
|
38
|
+
* Horizontal spacing between glyphs in pixels.
|
|
39
|
+
* @defaultValue `1`
|
|
40
|
+
*/
|
|
41
|
+
export declare const FONT_3x5_SPACING = 1;
|
|
42
|
+
/**
|
|
43
|
+
* Complete set of supported characters as a single string.
|
|
44
|
+
*/
|
|
45
|
+
export declare const FONT_3x5_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz !?.,:;-+*/\\()[]<>=#%&@^_'\"`~|$";
|
|
46
|
+
/**
|
|
47
|
+
* Glyph data keyed by character.
|
|
48
|
+
*
|
|
49
|
+
* Each value is a 5-element `number[]` where each entry is a 3-bit
|
|
50
|
+
* row bitmask (bit 2 = leftmost pixel, bit 0 = rightmost pixel).
|
|
51
|
+
*
|
|
52
|
+
* @see {@link FontBitmap} — consumes this data for rendering
|
|
53
|
+
*/
|
|
54
|
+
export declare const FONT_3x5: Record<string, number[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Complete metadata object for the 3x5 font, used by the
|
|
57
|
+
* {@link FontBitmap} catalogue at module load time.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export declare const metadata: {
|
|
62
|
+
/** Catalogue name. */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Cell width including spacing (3 + 1 = 4). */
|
|
65
|
+
width: number;
|
|
66
|
+
/** Cell height (5). */
|
|
67
|
+
height: number;
|
|
68
|
+
/** Inter-glyph spacing (1). */
|
|
69
|
+
spacing: number;
|
|
70
|
+
/** Supported character string. */
|
|
71
|
+
chars: string;
|
|
72
|
+
/** Glyph bitmask data. */
|
|
73
|
+
data: Record<string, number[]>;
|
|
74
|
+
};
|
|
75
|
+
export default FONT_3x5;
|
|
76
|
+
//# sourceMappingURL=font_3x5.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font_3x5.d.ts","sourceRoot":"","sources":["../../../../src/core/fonts/internal/font_3x5.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,sEAAsE;AACtE,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,cAAc,oGACwE,CAAC;AAEpG;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CA8F7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;IACnB,sBAAsB;;IAEtB,gDAAgD;;IAEhD,uBAAuB;;IAEvB,+BAA+B;;IAE/B,kCAAkC;;IAElC,0BAA0B;;CAE3B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in 4x6 pixel bitmap font.
|
|
3
|
+
*
|
|
4
|
+
* Each character is a 4-pixel-wide, 6-pixel-tall glyph stored as an
|
|
5
|
+
* array of 6 integers. Each integer is a bitmask where bit 3
|
|
6
|
+
* (MSB) corresponds to the leftmost pixel and bit 0 to the rightmost.
|
|
7
|
+
*
|
|
8
|
+
* Small but readable, good for status bars.
|
|
9
|
+
*
|
|
10
|
+
* Supported characters: uppercase A–Z, lowercase a–z, digits 0–9,
|
|
11
|
+
* and common punctuation / special characters.
|
|
12
|
+
*
|
|
13
|
+
* @category Fonts
|
|
14
|
+
* @since 0.2.0
|
|
15
|
+
* @internal
|
|
16
|
+
*
|
|
17
|
+
* @example Reading a glyph
|
|
18
|
+
* ```ts
|
|
19
|
+
* import FONT_4x6 from "./font_4x6";
|
|
20
|
+
*
|
|
21
|
+
* const letterA = FONT_4x6["A"];
|
|
22
|
+
* // 6, 9, 9, 15, 9, 9
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
/** Catalogue name used by {@link FontBitmap} to look up this font. */
|
|
26
|
+
export declare const FONT_4x6_NAME = "4x6";
|
|
27
|
+
/**
|
|
28
|
+
* Glyph width in pixels (excluding spacing).
|
|
29
|
+
* @defaultValue `4`
|
|
30
|
+
*/
|
|
31
|
+
export declare const FONT_4x6_WIDTH = 4;
|
|
32
|
+
/**
|
|
33
|
+
* Glyph height in pixels.
|
|
34
|
+
* @defaultValue `6`
|
|
35
|
+
*/
|
|
36
|
+
export declare const FONT_4x6_HEIGHT = 6;
|
|
37
|
+
/**
|
|
38
|
+
* Horizontal spacing between glyphs in pixels.
|
|
39
|
+
* @defaultValue `1`
|
|
40
|
+
*/
|
|
41
|
+
export declare const FONT_4x6_SPACING = 1;
|
|
42
|
+
/**
|
|
43
|
+
* Complete set of supported characters as a single string.
|
|
44
|
+
*/
|
|
45
|
+
export declare const FONT_4x6_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz !?.,:;-+*/\\()[]{}<>=#%&@^_'\"`~|$";
|
|
46
|
+
/**
|
|
47
|
+
* Glyph data keyed by character.
|
|
48
|
+
*
|
|
49
|
+
* Each value is a 6-element `number[]` where each entry is a 4-bit
|
|
50
|
+
* row bitmask (bit 3 = leftmost pixel, bit 0 = rightmost pixel).
|
|
51
|
+
*
|
|
52
|
+
* @see {@link FontBitmap} — consumes this data for rendering
|
|
53
|
+
*/
|
|
54
|
+
export declare const FONT_4x6: Record<string, number[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Complete metadata object for the 4x6 font, used by the
|
|
57
|
+
* {@link FontBitmap} catalogue at module load time.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export declare const metadata: {
|
|
62
|
+
/** Catalogue name. */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Cell width including spacing (4 + 1 = 5). */
|
|
65
|
+
width: number;
|
|
66
|
+
/** Cell height (6). */
|
|
67
|
+
height: number;
|
|
68
|
+
/** Inter-glyph spacing (1). */
|
|
69
|
+
spacing: number;
|
|
70
|
+
/** Supported character string. */
|
|
71
|
+
chars: string;
|
|
72
|
+
/** Glyph bitmask data. */
|
|
73
|
+
data: Record<string, number[]>;
|
|
74
|
+
};
|
|
75
|
+
export default FONT_4x6;
|
|
76
|
+
//# sourceMappingURL=font_4x6.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font_4x6.d.ts","sourceRoot":"","sources":["../../../../src/core/fonts/internal/font_4x6.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,sEAAsE;AACtE,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,cAAc,sGAC0E,CAAC;AAEtG;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAgG7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;IACnB,sBAAsB;;IAEtB,gDAAgD;;IAEhD,uBAAuB;;IAEvB,+BAA+B;;IAE/B,kCAAkC;;IAElC,0BAA0B;;CAE3B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in 5x5 pixel bitmap font.
|
|
3
|
+
*
|
|
4
|
+
* Each character is a 5-pixel-wide, 5-pixel-tall glyph stored as an
|
|
5
|
+
* array of five integers. Each integer is a bitmask where bit 4
|
|
6
|
+
* (MSB) corresponds to the leftmost pixel and bit 0 to the rightmost.
|
|
7
|
+
*
|
|
8
|
+
* Supported characters: `A–Z`, `0–9`, and space.
|
|
9
|
+
*
|
|
10
|
+
* @category Fonts
|
|
11
|
+
* @since 0.1.0
|
|
12
|
+
* @internal
|
|
13
|
+
*
|
|
14
|
+
* @example Reading a glyph
|
|
15
|
+
* ```ts
|
|
16
|
+
* import FONT_5x5 from "./font_5x5";
|
|
17
|
+
*
|
|
18
|
+
* const letterA = FONT_5x5["A"];
|
|
19
|
+
* // [14, 17, 31, 17, 17]
|
|
20
|
+
* //
|
|
21
|
+
* // .###. = 0b01110 = 14
|
|
22
|
+
* // #...# = 0b10001 = 17
|
|
23
|
+
* // ##### = 0b11111 = 31
|
|
24
|
+
* // #...# = 0b10001 = 17
|
|
25
|
+
* // #...# = 0b10001 = 17
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
/** Catalogue name used by {@link FontBitmap} to look up this font. */
|
|
29
|
+
export declare const FONT_5x5_NAME = "5x5";
|
|
30
|
+
/**
|
|
31
|
+
* Glyph width in pixels (excluding spacing).
|
|
32
|
+
* @defaultValue `5`
|
|
33
|
+
*/
|
|
34
|
+
export declare const FONT_5x5_WIDTH = 5;
|
|
35
|
+
/**
|
|
36
|
+
* Glyph height in pixels.
|
|
37
|
+
* @defaultValue `5`
|
|
38
|
+
*/
|
|
39
|
+
export declare const FONT_5x5_HEIGHT = 5;
|
|
40
|
+
/**
|
|
41
|
+
* Horizontal spacing between glyphs in pixels.
|
|
42
|
+
* @defaultValue `1`
|
|
43
|
+
*/
|
|
44
|
+
export declare const FONT_5x5_SPACING = 1;
|
|
45
|
+
/**
|
|
46
|
+
* Complete set of supported characters as a single string.
|
|
47
|
+
*/
|
|
48
|
+
export declare const FONT_5x5_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789";
|
|
49
|
+
/**
|
|
50
|
+
* Glyph data keyed by character.
|
|
51
|
+
*
|
|
52
|
+
* Each value is a 5-element `number[]` where each entry is a 5-bit
|
|
53
|
+
* row bitmask (bit 4 = leftmost pixel, bit 0 = rightmost pixel).
|
|
54
|
+
*
|
|
55
|
+
* @see {@link FontBitmap} — consumes this data for rendering
|
|
56
|
+
*/
|
|
57
|
+
export declare const FONT_5x5: Record<string, number[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Complete metadata object for the 5x5 font, used by the
|
|
60
|
+
* {@link FontBitmap} catalogue at module load time.
|
|
61
|
+
*
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export declare const metadata: {
|
|
65
|
+
/** Catalogue name. */
|
|
66
|
+
name: string;
|
|
67
|
+
/** Cell width including spacing (5 + 1 = 6). */
|
|
68
|
+
width: number;
|
|
69
|
+
/** Cell height (5). */
|
|
70
|
+
height: number;
|
|
71
|
+
/** Inter-glyph spacing (1). */
|
|
72
|
+
spacing: number;
|
|
73
|
+
/** Supported character string. */
|
|
74
|
+
chars: string;
|
|
75
|
+
/** Glyph bitmask data. */
|
|
76
|
+
data: Record<string, number[]>;
|
|
77
|
+
};
|
|
78
|
+
export default FONT_5x5;
|
|
79
|
+
//# sourceMappingURL=font_5x5.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font_5x5.d.ts","sourceRoot":"","sources":["../../../../src/core/fonts/internal/font_5x5.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,sEAAsE;AACtE,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,cAAc,0CAA0C,CAAC;AAEtE;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAmD7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;IACnB,sBAAsB;;IAEtB,gDAAgD;;IAEhD,uBAAuB;;IAEvB,+BAA+B;;IAE/B,kCAAkC;;IAElC,0BAA0B;;CAE3B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in 6x8 pixel bitmap font.
|
|
3
|
+
*
|
|
4
|
+
* Each character is a 6-pixel-wide, 8-pixel-tall glyph stored as an
|
|
5
|
+
* array of 8 integers. Each integer is a bitmask where bit 5
|
|
6
|
+
* (MSB) corresponds to the leftmost pixel and bit 0 to the rightmost.
|
|
7
|
+
*
|
|
8
|
+
* Classic arcade and console aesthetic.
|
|
9
|
+
*
|
|
10
|
+
* Supported characters: uppercase A–Z, lowercase a–z, digits 0–9,
|
|
11
|
+
* and common punctuation / special characters.
|
|
12
|
+
*
|
|
13
|
+
* @category Fonts
|
|
14
|
+
* @since 0.2.0
|
|
15
|
+
* @internal
|
|
16
|
+
*
|
|
17
|
+
* @example Reading a glyph
|
|
18
|
+
* ```ts
|
|
19
|
+
* import FONT_6x8 from "./font_6x8";
|
|
20
|
+
*
|
|
21
|
+
* const letterA = FONT_6x8["A"];
|
|
22
|
+
* // 12, 18, 33, 33, 63, 33, 33, 0
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
/** Catalogue name used by {@link FontBitmap} to look up this font. */
|
|
26
|
+
export declare const FONT_6x8_NAME = "6x8";
|
|
27
|
+
/**
|
|
28
|
+
* Glyph width in pixels (excluding spacing).
|
|
29
|
+
* @defaultValue `6`
|
|
30
|
+
*/
|
|
31
|
+
export declare const FONT_6x8_WIDTH = 6;
|
|
32
|
+
/**
|
|
33
|
+
* Glyph height in pixels.
|
|
34
|
+
* @defaultValue `8`
|
|
35
|
+
*/
|
|
36
|
+
export declare const FONT_6x8_HEIGHT = 8;
|
|
37
|
+
/**
|
|
38
|
+
* Horizontal spacing between glyphs in pixels.
|
|
39
|
+
* @defaultValue `1`
|
|
40
|
+
*/
|
|
41
|
+
export declare const FONT_6x8_SPACING = 1;
|
|
42
|
+
/**
|
|
43
|
+
* Complete set of supported characters as a single string.
|
|
44
|
+
*/
|
|
45
|
+
export declare const FONT_6x8_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz !?.,:;-+*/\\()[]{}<>=#%&@^_'\"`~|$";
|
|
46
|
+
/**
|
|
47
|
+
* Glyph data keyed by character.
|
|
48
|
+
*
|
|
49
|
+
* Each value is a 8-element `number[]` where each entry is a 6-bit
|
|
50
|
+
* row bitmask (bit 5 = leftmost pixel, bit 0 = rightmost pixel).
|
|
51
|
+
*
|
|
52
|
+
* @see {@link FontBitmap} — consumes this data for rendering
|
|
53
|
+
*/
|
|
54
|
+
export declare const FONT_6x8: Record<string, number[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Complete metadata object for the 6x8 font, used by the
|
|
57
|
+
* {@link FontBitmap} catalogue at module load time.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export declare const metadata: {
|
|
62
|
+
/** Catalogue name. */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Cell width including spacing (6 + 1 = 7). */
|
|
65
|
+
width: number;
|
|
66
|
+
/** Cell height (8). */
|
|
67
|
+
height: number;
|
|
68
|
+
/** Inter-glyph spacing (1). */
|
|
69
|
+
spacing: number;
|
|
70
|
+
/** Supported character string. */
|
|
71
|
+
chars: string;
|
|
72
|
+
/** Glyph bitmask data. */
|
|
73
|
+
data: Record<string, number[]>;
|
|
74
|
+
};
|
|
75
|
+
export default FONT_6x8;
|
|
76
|
+
//# sourceMappingURL=font_6x8.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font_6x8.d.ts","sourceRoot":"","sources":["../../../../src/core/fonts/internal/font_6x8.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,sEAAsE;AACtE,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,cAAc,sGAC0E,CAAC;AAEtG;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAgG7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;IACnB,sBAAsB;;IAEtB,gDAAgD;;IAEhD,uBAAuB;;IAEvB,+BAA+B;;IAE/B,kCAAkC;;IAElC,0BAA0B;;CAE3B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in 8x13 pixel bitmap font.
|
|
3
|
+
*
|
|
4
|
+
* Each character is a 8-pixel-wide, 13-pixel-tall glyph stored as an
|
|
5
|
+
* array of 13 integers. Each integer is a bitmask where bit 7
|
|
6
|
+
* (MSB) corresponds to the leftmost pixel and bit 0 to the rightmost.
|
|
7
|
+
*
|
|
8
|
+
* Tall, elegant glyphs for dialogue boxes and UI.
|
|
9
|
+
*
|
|
10
|
+
* Supported characters: uppercase A–Z, lowercase a–z, digits 0–9,
|
|
11
|
+
* and common punctuation / special characters.
|
|
12
|
+
*
|
|
13
|
+
* @category Fonts
|
|
14
|
+
* @since 0.2.0
|
|
15
|
+
* @internal
|
|
16
|
+
*
|
|
17
|
+
* @example Reading a glyph
|
|
18
|
+
* ```ts
|
|
19
|
+
* import FONT_8x13 from "./font_8x13";
|
|
20
|
+
*
|
|
21
|
+
* const letterA = FONT_8x13["A"];
|
|
22
|
+
* // 0, 0, 24, 36, 66, 66, 126, 66, 66, 66, 0, 0, 0
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
/** Catalogue name used by {@link FontBitmap} to look up this font. */
|
|
26
|
+
export declare const FONT_8x13_NAME = "8x13";
|
|
27
|
+
/**
|
|
28
|
+
* Glyph width in pixels (excluding spacing).
|
|
29
|
+
* @defaultValue `8`
|
|
30
|
+
*/
|
|
31
|
+
export declare const FONT_8x13_WIDTH = 8;
|
|
32
|
+
/**
|
|
33
|
+
* Glyph height in pixels.
|
|
34
|
+
* @defaultValue `13`
|
|
35
|
+
*/
|
|
36
|
+
export declare const FONT_8x13_HEIGHT = 13;
|
|
37
|
+
/**
|
|
38
|
+
* Horizontal spacing between glyphs in pixels.
|
|
39
|
+
* @defaultValue `1`
|
|
40
|
+
*/
|
|
41
|
+
export declare const FONT_8x13_SPACING = 1;
|
|
42
|
+
/**
|
|
43
|
+
* Complete set of supported characters as a single string.
|
|
44
|
+
*/
|
|
45
|
+
export declare const FONT_8x13_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz !?.,:;-+*/\\()[]{}<>=#%&@^_'\"`~|$";
|
|
46
|
+
/**
|
|
47
|
+
* Glyph data keyed by character.
|
|
48
|
+
*
|
|
49
|
+
* Each value is a 13-element `number[]` where each entry is a 8-bit
|
|
50
|
+
* row bitmask (bit 7 = leftmost pixel, bit 0 = rightmost pixel).
|
|
51
|
+
*
|
|
52
|
+
* @see {@link FontBitmap} — consumes this data for rendering
|
|
53
|
+
*/
|
|
54
|
+
export declare const FONT_8x13: Record<string, number[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Complete metadata object for the 8x13 font, used by the
|
|
57
|
+
* {@link FontBitmap} catalogue at module load time.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export declare const metadata: {
|
|
62
|
+
/** Catalogue name. */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Cell width including spacing (8 + 1 = 9). */
|
|
65
|
+
width: number;
|
|
66
|
+
/** Cell height (13). */
|
|
67
|
+
height: number;
|
|
68
|
+
/** Inter-glyph spacing (1). */
|
|
69
|
+
spacing: number;
|
|
70
|
+
/** Supported character string. */
|
|
71
|
+
chars: string;
|
|
72
|
+
/** Glyph bitmask data. */
|
|
73
|
+
data: Record<string, number[]>;
|
|
74
|
+
};
|
|
75
|
+
export default FONT_8x13;
|
|
76
|
+
//# sourceMappingURL=font_8x13.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font_8x13.d.ts","sourceRoot":"","sources":["../../../../src/core/fonts/internal/font_8x13.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,sEAAsE;AACtE,eAAO,MAAM,cAAc,SAAS,CAAC;AAErC;;;GAGG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,eAAe,sGACyE,CAAC;AAEtG;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAgG9C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;IACnB,sBAAsB;;IAEtB,gDAAgD;;IAEhD,wBAAwB;;IAExB,+BAA+B;;IAE/B,kCAAkC;;IAElC,0BAA0B;;CAE3B,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in 8x8 pixel bitmap font.
|
|
3
|
+
*
|
|
4
|
+
* Each character is a 8-pixel-wide, 8-pixel-tall glyph stored as an
|
|
5
|
+
* array of 8 integers. Each integer is a bitmask where bit 7
|
|
6
|
+
* (MSB) corresponds to the leftmost pixel and bit 0 to the rightmost.
|
|
7
|
+
*
|
|
8
|
+
* Chunky square glyphs, ideal at 2× or 4× scale.
|
|
9
|
+
*
|
|
10
|
+
* Supported characters: uppercase A–Z, lowercase a–z, digits 0–9,
|
|
11
|
+
* and common punctuation / special characters.
|
|
12
|
+
*
|
|
13
|
+
* @category Fonts
|
|
14
|
+
* @since 0.2.0
|
|
15
|
+
* @internal
|
|
16
|
+
*
|
|
17
|
+
* @example Reading a glyph
|
|
18
|
+
* ```ts
|
|
19
|
+
* import FONT_8x8 from "./font_8x8";
|
|
20
|
+
*
|
|
21
|
+
* const letterA = FONT_8x8["A"];
|
|
22
|
+
* // 24, 36, 66, 66, 126, 66, 66, 0
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
/** Catalogue name used by {@link FontBitmap} to look up this font. */
|
|
26
|
+
export declare const FONT_8x8_NAME = "8x8";
|
|
27
|
+
/**
|
|
28
|
+
* Glyph width in pixels (excluding spacing).
|
|
29
|
+
* @defaultValue `8`
|
|
30
|
+
*/
|
|
31
|
+
export declare const FONT_8x8_WIDTH = 8;
|
|
32
|
+
/**
|
|
33
|
+
* Glyph height in pixels.
|
|
34
|
+
* @defaultValue `8`
|
|
35
|
+
*/
|
|
36
|
+
export declare const FONT_8x8_HEIGHT = 8;
|
|
37
|
+
/**
|
|
38
|
+
* Horizontal spacing between glyphs in pixels.
|
|
39
|
+
* @defaultValue `1`
|
|
40
|
+
*/
|
|
41
|
+
export declare const FONT_8x8_SPACING = 1;
|
|
42
|
+
/**
|
|
43
|
+
* Complete set of supported characters as a single string.
|
|
44
|
+
*/
|
|
45
|
+
export declare const FONT_8x8_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz !?.,:;-+*/\\()[]{}<>=#%&@^_'\"`~|$";
|
|
46
|
+
/**
|
|
47
|
+
* Glyph data keyed by character.
|
|
48
|
+
*
|
|
49
|
+
* Each value is a 8-element `number[]` where each entry is a 8-bit
|
|
50
|
+
* row bitmask (bit 7 = leftmost pixel, bit 0 = rightmost pixel).
|
|
51
|
+
*
|
|
52
|
+
* @see {@link FontBitmap} — consumes this data for rendering
|
|
53
|
+
*/
|
|
54
|
+
export declare const FONT_8x8: Record<string, number[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Complete metadata object for the 8x8 font, used by the
|
|
57
|
+
* {@link FontBitmap} catalogue at module load time.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export declare const metadata: {
|
|
62
|
+
/** Catalogue name. */
|
|
63
|
+
name: string;
|
|
64
|
+
/** Cell width including spacing (8 + 1 = 9). */
|
|
65
|
+
width: number;
|
|
66
|
+
/** Cell height (8). */
|
|
67
|
+
height: number;
|
|
68
|
+
/** Inter-glyph spacing (1). */
|
|
69
|
+
spacing: number;
|
|
70
|
+
/** Supported character string. */
|
|
71
|
+
chars: string;
|
|
72
|
+
/** Glyph bitmask data. */
|
|
73
|
+
data: Record<string, number[]>;
|
|
74
|
+
};
|
|
75
|
+
export default FONT_8x8;
|
|
76
|
+
//# sourceMappingURL=font_8x8.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font_8x8.d.ts","sourceRoot":"","sources":["../../../../src/core/fonts/internal/font_8x8.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,sEAAsE;AACtE,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,cAAc,sGAC0E,CAAC;AAEtG;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAgG7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;IACnB,sBAAsB;;IAEtB,gDAAgD;;IAEhD,uBAAuB;;IAEvB,+BAA+B;;IAE/B,kCAAkC;;IAElC,0BAA0B;;CAE3B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,11 +1,111 @@
|
|
|
1
1
|
import type { GameObject } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Central registry that stores and manages all non-player
|
|
4
|
+
* {@link GameObject | game objects} within the engine.
|
|
5
|
+
*
|
|
6
|
+
* Objects are keyed by their `id` property, so each ID must be unique.
|
|
7
|
+
* The {@link Engine} delegates per-frame `update` and `render` calls to
|
|
8
|
+
* this register.
|
|
9
|
+
*
|
|
10
|
+
* @category Core
|
|
11
|
+
* @since 0.1.0
|
|
12
|
+
*
|
|
13
|
+
* @example Registering and retrieving objects
|
|
14
|
+
* ```ts
|
|
15
|
+
* const register = new GameObjectRegister();
|
|
16
|
+
*
|
|
17
|
+
* register.register(tree);
|
|
18
|
+
* register.register(rock);
|
|
19
|
+
*
|
|
20
|
+
* const found = register.get("tree"); // Entity | undefined
|
|
21
|
+
* console.log(register.has("rock")); // true
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example Bulk update / render
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Called internally by Engine each frame:
|
|
27
|
+
* register.updateAll(deltaTime);
|
|
28
|
+
* register.renderAll(ctx);
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see {@link Engine.attachObjects} — convenience method that delegates here
|
|
32
|
+
*/
|
|
2
33
|
export default class GameObjectRegister {
|
|
34
|
+
/**
|
|
35
|
+
* Internal map from entity ID to its {@link GameObject} instance.
|
|
36
|
+
*/
|
|
3
37
|
private objects;
|
|
38
|
+
private _cache;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a game object to the registry.
|
|
41
|
+
*
|
|
42
|
+
* If an object with the same `id` already exists it will be
|
|
43
|
+
* silently overwritten.
|
|
44
|
+
*
|
|
45
|
+
* @param object - The game object to register.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* register.register(new Crate("crate_1", 200, 150, 32, 32));
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
4
52
|
register(object: GameObject): void;
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves a registered object by its unique ID.
|
|
55
|
+
*
|
|
56
|
+
* @param id - The ID of the object to find.
|
|
57
|
+
* @returns The matching {@link GameObject}, or `undefined` if not found.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const crate = register.get("crate_1");
|
|
62
|
+
* if (crate) crate.x += 10;
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
5
65
|
get(id: string): GameObject | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Checks whether an object with the given ID is registered.
|
|
68
|
+
*
|
|
69
|
+
* @param id - The ID to look up.
|
|
70
|
+
* @returns `true` if the registry contains the object.
|
|
71
|
+
*/
|
|
6
72
|
has(id: string): boolean;
|
|
7
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Returns all registered objects as an array.
|
|
75
|
+
*
|
|
76
|
+
* Make sure to also cache the objects
|
|
77
|
+
*
|
|
78
|
+
* @since 0.2.0
|
|
79
|
+
*
|
|
80
|
+
* @returns An array of all {@link GameObject} instances in the registry.
|
|
81
|
+
*/
|
|
82
|
+
toArray(): GameObject[];
|
|
83
|
+
/**
|
|
84
|
+
* Returns all registered objects that pass the supplied filter.
|
|
85
|
+
*
|
|
86
|
+
* @param filter - (optional) A predicate function. Return `true` to include the
|
|
87
|
+
* object in the result.
|
|
88
|
+
* @returns An array of matching {@link GameObject} instances.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const enemies = register.getAll(() => true);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
getAll(filter?: () => true): GameObject[];
|
|
96
|
+
/**
|
|
97
|
+
* Calls {@link GameObject.update | update(deltaTime)} on every
|
|
98
|
+
* registered object.
|
|
99
|
+
*
|
|
100
|
+
* @param deltaTime - Seconds elapsed since the previous frame.
|
|
101
|
+
*/
|
|
8
102
|
updateAll(deltaTime: number): void;
|
|
103
|
+
/**
|
|
104
|
+
* Calls {@link GameObject.render | render(ctx)} on every registered
|
|
105
|
+
* object.
|
|
106
|
+
*
|
|
107
|
+
* @param ctx - The canvas 2-D rendering context.
|
|
108
|
+
*/
|
|
9
109
|
renderAll(ctx: CanvasRenderingContext2D): void;
|
|
10
110
|
}
|
|
11
111
|
//# sourceMappingURL=game_object_register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"game_object_register.d.ts","sourceRoot":"","sources":["../../core/game_object_register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,OAAO,CAAC,OAAO,CAAsC;IAErD,QAAQ,CAAC,MAAM,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"game_object_register.d.ts","sourceRoot":"","sources":["../../src/core/game_object_register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAsC;IAErD,OAAO,CAAC,MAAM,CAA6B;IAE3C;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU;IAK3B;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIvC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB;;;;;;;;OAQG;IACH,OAAO,IAAI,UAAU,EAAE;IAQvB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,GAAG,UAAU,EAAE;IAQzC;;;;;OAKG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAMlC;;;;;OAKG;IACH,SAAS,CAAC,GAAG,EAAE,wBAAwB,GAAG,IAAI;CAK/C"}
|