@dryanovski/gamefoo 0.2.1 → 0.2.5

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.
Files changed (84) hide show
  1. package/dist/core/animate.js +147 -0
  2. package/dist/core/asset.js +74 -0
  3. package/dist/core/behaviour.js +88 -0
  4. package/dist/core/behaviours/collidable.js +186 -0
  5. package/dist/core/behaviours/control.js +75 -0
  6. package/dist/core/behaviours/healtkit.js +153 -0
  7. package/dist/core/behaviours/sprite_render.js +193 -0
  8. package/dist/core/camera.js +134 -0
  9. package/dist/core/engine.d.ts +1 -1
  10. package/dist/core/engine.d.ts.map +1 -1
  11. package/dist/core/engine.js +527 -0
  12. package/dist/core/fonts/font_bitmap.js +205 -0
  13. package/dist/core/fonts/font_bitmap_prebuild.js +137 -0
  14. package/dist/core/fonts/internal/font_3x5.js +169 -0
  15. package/dist/core/fonts/internal/font_4x6.js +171 -0
  16. package/dist/core/fonts/internal/font_5x5.js +129 -0
  17. package/dist/core/fonts/internal/font_6x8.js +171 -0
  18. package/dist/core/fonts/internal/font_8x13.js +171 -0
  19. package/dist/core/fonts/internal/font_8x8.js +171 -0
  20. package/dist/core/game_object_register.js +134 -0
  21. package/dist/core/input.js +170 -0
  22. package/dist/core/sprite.js +222 -0
  23. package/dist/core/utils/perlin_noise.js +183 -0
  24. package/dist/core/world.js +304 -0
  25. package/dist/debug/monitor.js +47 -0
  26. package/dist/decorators/index.js +1 -0
  27. package/dist/decorators/log.js +42 -0
  28. package/dist/entities/dynamic_entity.js +99 -0
  29. package/dist/entities/entity.js +283 -0
  30. package/dist/entities/player.js +93 -0
  31. package/dist/entities/text.js +62 -0
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +47 -29
  35. package/dist/subsystems/camera_system.d.ts +2 -2
  36. package/dist/subsystems/camera_system.d.ts.map +1 -1
  37. package/dist/subsystems/camera_system.js +41 -0
  38. package/dist/subsystems/collision_system.js +17 -0
  39. package/dist/subsystems/monitor_system.js +20 -0
  40. package/dist/subsystems/object_system.d.ts +1 -1
  41. package/dist/subsystems/object_system.d.ts.map +1 -1
  42. package/dist/subsystems/object_system.js +29 -0
  43. package/dist/subsystems/types.d.ts +1 -1
  44. package/dist/subsystems/types.d.ts.map +1 -1
  45. package/dist/subsystems/types.js +0 -0
  46. package/dist/types.js +10 -0
  47. package/package.json +17 -6
  48. package/src/core/animate.ts +159 -0
  49. package/src/core/asset.ts +76 -0
  50. package/src/core/behaviour.ts +145 -0
  51. package/src/core/behaviours/collidable.ts +296 -0
  52. package/src/core/behaviours/control.ts +80 -0
  53. package/src/core/behaviours/healtkit.ts +166 -0
  54. package/src/core/behaviours/sprite_render.ts +216 -0
  55. package/src/core/camera.ts +145 -0
  56. package/src/core/engine.ts +607 -0
  57. package/src/core/fonts/font_bitmap.ts +232 -0
  58. package/src/core/fonts/font_bitmap_prebuild.ts +141 -0
  59. package/src/core/fonts/internal/font_3x5.ts +178 -0
  60. package/src/core/fonts/internal/font_4x6.ts +180 -0
  61. package/src/core/fonts/internal/font_5x5.ts +137 -0
  62. package/src/core/fonts/internal/font_6x8.ts +180 -0
  63. package/src/core/fonts/internal/font_8x13.ts +180 -0
  64. package/src/core/fonts/internal/font_8x8.ts +180 -0
  65. package/src/core/game_object_register.ts +146 -0
  66. package/src/core/input.ts +182 -0
  67. package/src/core/sprite.ts +339 -0
  68. package/src/core/utils/perlin_noise.ts +196 -0
  69. package/src/core/world.ts +331 -0
  70. package/src/debug/monitor.ts +60 -0
  71. package/src/decorators/index.ts +1 -0
  72. package/src/decorators/log.ts +45 -0
  73. package/src/entities/dynamic_entity.ts +106 -0
  74. package/src/entities/entity.ts +322 -0
  75. package/src/entities/player.ts +99 -0
  76. package/src/entities/text.ts +72 -0
  77. package/src/index.ts +51 -0
  78. package/src/subsystems/camera_system.ts +52 -0
  79. package/src/subsystems/collision_system.ts +21 -0
  80. package/src/subsystems/monitor_system.ts +26 -0
  81. package/src/subsystems/object_system.ts +37 -0
  82. package/src/subsystems/types.ts +46 -0
  83. package/src/types.ts +178 -0
  84. package/dist/index.js.map +0 -9
@@ -0,0 +1,129 @@
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 const FONT_5x5_NAME = "5x5";
30
+ /**
31
+ * Glyph width in pixels (excluding spacing).
32
+ * @defaultValue `5`
33
+ */
34
+ export const FONT_5x5_WIDTH = 5;
35
+ /**
36
+ * Glyph height in pixels.
37
+ * @defaultValue `5`
38
+ */
39
+ export const FONT_5x5_HEIGHT = 5;
40
+ /**
41
+ * Horizontal spacing between glyphs in pixels.
42
+ * @defaultValue `1`
43
+ */
44
+ export const FONT_5x5_SPACING = 1;
45
+ /**
46
+ * Complete set of supported characters as a single string.
47
+ */
48
+ export 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 const FONT_5x5 = {
58
+ A: [14, 17, 31, 17, 17],
59
+ B: [30, 17, 30, 17, 30],
60
+ C: [15, 16, 16, 16, 15],
61
+ D: [30, 17, 17, 17, 30],
62
+ E: [31, 16, 28, 16, 31],
63
+ F: [31, 16, 28, 16, 16],
64
+ G: [15, 16, 19, 17, 15],
65
+ H: [17, 17, 31, 17, 17],
66
+ I: [31, 4, 4, 4, 31],
67
+ L: [16, 16, 16, 16, 31],
68
+ M: [17, 27, 21, 17, 17],
69
+ N: [17, 25, 21, 19, 17],
70
+ O: [14, 17, 17, 17, 14],
71
+ P: [30, 17, 30, 16, 16],
72
+ R: [30, 17, 30, 18, 17],
73
+ S: [15, 16, 14, 1, 30],
74
+ T: [31, 4, 4, 4, 4],
75
+ U: [17, 17, 17, 17, 14],
76
+ V: [17, 17, 17, 10, 4],
77
+ W: [17, 17, 21, 27, 17],
78
+ Y: [17, 10, 4, 4, 4],
79
+ " ": [0, 0, 0, 0, 0],
80
+ "0": [14, 17, 17, 17, 14],
81
+ "1": [4, 12, 4, 4, 14],
82
+ "2": [14, 17, 6, 8, 31],
83
+ "3": [30, 1, 14, 1, 30],
84
+ "4": [18, 18, 31, 2, 2],
85
+ "5": [31, 16, 30, 1, 30],
86
+ "6": [14, 16, 30, 17, 14],
87
+ "7": [31, 1, 2, 4, 4],
88
+ "8": [14, 17, 14, 17, 14],
89
+ "9": [14, 17, 15, 1, 14],
90
+ ".": [0, 0, 0, 12, 12],
91
+ ",": [0, 0, 0, 12, 4],
92
+ "/": [1, 2, 4, 8, 16],
93
+ "|": [4, 4, 4, 4, 4],
94
+ "(": [2, 4, 4, 4, 2],
95
+ ")": [8, 4, 4, 4, 8],
96
+ "?": [14, 17, 6, 0, 4],
97
+ "!": [4, 4, 4, 0, 4],
98
+ "#": [10, 31, 10, 31, 10],
99
+ $: [14, 16, 14, 1, 14],
100
+ "%": [19, 9, 4, 18, 25],
101
+ "@": [14, 17, 21, 21, 14],
102
+ "^": [4, 10, 17, 0, 0],
103
+ "&": [14, 17, 14, 21, 14],
104
+ "*": [0, 10, 4, 10, 0],
105
+ "-": [0, 0, 31, 0, 0],
106
+ "+": [0, 4, 14, 4, 0],
107
+ "=": [0, 14, 0, 14, 0],
108
+ };
109
+ /**
110
+ * Complete metadata object for the 5x5 font, used by the
111
+ * {@link FontBitmap} catalogue at module load time.
112
+ *
113
+ * @internal
114
+ */
115
+ export const metadata = {
116
+ /** Catalogue name. */
117
+ name: FONT_5x5_NAME,
118
+ /** Cell width including spacing (5 + 1 = 6). */
119
+ width: FONT_5x5_WIDTH + FONT_5x5_SPACING,
120
+ /** Cell height (5). */
121
+ height: FONT_5x5_HEIGHT,
122
+ /** Inter-glyph spacing (1). */
123
+ spacing: FONT_5x5_SPACING,
124
+ /** Supported character string. */
125
+ chars: FONT_5x5_CHARS,
126
+ /** Glyph bitmask data. */
127
+ data: FONT_5x5,
128
+ };
129
+ export default FONT_5x5;
@@ -0,0 +1,171 @@
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 const FONT_6x8_NAME = "6x8";
27
+ /**
28
+ * Glyph width in pixels (excluding spacing).
29
+ * @defaultValue `6`
30
+ */
31
+ export const FONT_6x8_WIDTH = 6;
32
+ /**
33
+ * Glyph height in pixels.
34
+ * @defaultValue `8`
35
+ */
36
+ export const FONT_6x8_HEIGHT = 8;
37
+ /**
38
+ * Horizontal spacing between glyphs in pixels.
39
+ * @defaultValue `1`
40
+ */
41
+ export const FONT_6x8_SPACING = 1;
42
+ /**
43
+ * Complete set of supported characters as a single string.
44
+ */
45
+ export 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 const FONT_6x8 = {
55
+ "0": [30, 33, 35, 37, 41, 49, 30, 0],
56
+ "1": [12, 28, 12, 12, 12, 12, 63, 0],
57
+ "2": [30, 33, 1, 14, 16, 32, 63, 0],
58
+ "3": [30, 33, 1, 30, 1, 33, 30, 0],
59
+ "4": [6, 14, 22, 38, 63, 6, 6, 0],
60
+ "5": [63, 32, 62, 1, 1, 33, 30, 0],
61
+ "6": [30, 33, 32, 62, 33, 33, 30, 0],
62
+ "7": [63, 1, 2, 4, 8, 16, 32, 0],
63
+ "8": [30, 33, 33, 30, 33, 33, 30, 0],
64
+ "9": [30, 33, 33, 31, 1, 33, 30, 0],
65
+ A: [12, 18, 33, 33, 63, 33, 33, 0],
66
+ B: [62, 33, 33, 62, 33, 33, 62, 0],
67
+ C: [30, 33, 32, 32, 32, 33, 30, 0],
68
+ D: [60, 34, 33, 33, 33, 34, 60, 0],
69
+ E: [63, 32, 32, 60, 32, 32, 63, 0],
70
+ F: [63, 32, 32, 60, 32, 32, 32, 0],
71
+ G: [30, 33, 32, 39, 33, 33, 31, 0],
72
+ H: [33, 33, 33, 63, 33, 33, 33, 0],
73
+ I: [30, 12, 12, 12, 12, 12, 30, 0],
74
+ J: [15, 3, 3, 3, 3, 35, 30, 0],
75
+ K: [33, 34, 36, 40, 52, 34, 33, 0],
76
+ L: [32, 32, 32, 32, 32, 32, 63, 0],
77
+ M: [33, 51, 45, 37, 33, 33, 33, 0],
78
+ N: [33, 49, 41, 37, 35, 33, 33, 0],
79
+ O: [30, 33, 33, 33, 33, 33, 30, 0],
80
+ P: [62, 33, 33, 62, 32, 32, 32, 0],
81
+ Q: [30, 33, 33, 33, 37, 34, 29, 0],
82
+ R: [62, 33, 33, 62, 36, 34, 33, 0],
83
+ S: [31, 32, 32, 30, 1, 1, 62, 0],
84
+ T: [63, 12, 12, 12, 12, 12, 12, 0],
85
+ U: [33, 33, 33, 33, 33, 33, 30, 0],
86
+ V: [33, 33, 33, 33, 18, 18, 12, 0],
87
+ W: [33, 33, 33, 37, 45, 51, 33, 0],
88
+ X: [33, 18, 12, 12, 18, 33, 33, 0],
89
+ Y: [33, 33, 18, 12, 12, 12, 12, 0],
90
+ Z: [63, 1, 2, 12, 16, 32, 63, 0],
91
+ a: [0, 0, 30, 1, 31, 33, 31, 0],
92
+ b: [32, 32, 46, 49, 33, 49, 46, 0],
93
+ c: [0, 0, 30, 32, 32, 32, 30, 0],
94
+ d: [1, 1, 29, 35, 33, 35, 29, 0],
95
+ e: [0, 0, 30, 33, 63, 32, 30, 0],
96
+ f: [14, 17, 16, 60, 16, 16, 16, 0],
97
+ g: [0, 29, 35, 33, 31, 1, 30, 0],
98
+ h: [32, 32, 46, 49, 33, 33, 33, 0],
99
+ i: [12, 0, 12, 28, 12, 12, 30, 0],
100
+ j: [6, 0, 6, 6, 6, 38, 28, 0],
101
+ k: [32, 32, 33, 38, 56, 38, 33, 0],
102
+ l: [24, 8, 8, 8, 8, 8, 30, 0],
103
+ m: [0, 0, 54, 41, 33, 33, 33, 0],
104
+ n: [0, 0, 46, 49, 33, 33, 33, 0],
105
+ o: [0, 0, 30, 33, 33, 33, 30, 0],
106
+ p: [0, 46, 49, 33, 49, 46, 32, 32],
107
+ q: [0, 29, 35, 33, 35, 29, 1, 1],
108
+ r: [0, 0, 30, 32, 32, 32, 32, 0],
109
+ s: [0, 0, 31, 32, 30, 1, 62, 0],
110
+ t: [16, 16, 60, 16, 16, 17, 14, 0],
111
+ u: [0, 0, 33, 33, 33, 35, 29, 0],
112
+ v: [0, 0, 33, 33, 18, 18, 12, 0],
113
+ w: [0, 0, 33, 33, 37, 45, 18, 0],
114
+ x: [0, 0, 33, 18, 12, 18, 33, 0],
115
+ y: [0, 33, 33, 33, 31, 1, 30, 0],
116
+ z: [0, 0, 63, 2, 12, 16, 63, 0],
117
+ " ": [0, 0, 0, 0, 0, 0, 0, 0],
118
+ "!": [12, 12, 12, 12, 12, 0, 12, 0],
119
+ "?": [30, 33, 1, 6, 12, 0, 12, 0],
120
+ ".": [0, 0, 0, 0, 0, 12, 12, 0],
121
+ ",": [0, 0, 0, 0, 12, 12, 24, 0],
122
+ ":": [0, 12, 12, 0, 12, 12, 0, 0],
123
+ ";": [0, 12, 12, 0, 12, 12, 24, 0],
124
+ "-": [0, 0, 0, 63, 0, 0, 0, 0],
125
+ "+": [0, 12, 12, 63, 12, 12, 0, 0],
126
+ "*": [0, 33, 18, 12, 18, 33, 0, 0],
127
+ "/": [1, 1, 2, 12, 16, 32, 0, 0],
128
+ "\\": [32, 16, 8, 4, 2, 1, 0, 0],
129
+ "(": [6, 12, 24, 24, 24, 12, 6, 0],
130
+ ")": [24, 12, 6, 6, 6, 12, 24, 0],
131
+ "[": [30, 16, 16, 16, 16, 16, 30, 0],
132
+ "]": [30, 2, 2, 2, 2, 2, 30, 0],
133
+ "{": [14, 24, 24, 48, 24, 24, 14, 0],
134
+ "}": [28, 6, 6, 3, 6, 6, 28, 0],
135
+ "<": [3, 12, 48, 48, 12, 3, 0, 0],
136
+ ">": [48, 12, 3, 3, 12, 48, 0, 0],
137
+ "=": [0, 63, 0, 63, 0, 0, 0, 0],
138
+ "#": [18, 18, 63, 18, 63, 18, 18, 0],
139
+ "%": [33, 34, 4, 12, 16, 32, 33, 0],
140
+ "&": [24, 36, 36, 25, 38, 36, 27, 0],
141
+ "@": [30, 33, 33, 47, 41, 32, 31, 0],
142
+ "^": [12, 18, 33, 0, 0, 0, 0, 0],
143
+ _: [0, 0, 0, 0, 0, 0, 63, 0],
144
+ "'": [12, 12, 24, 0, 0, 0, 0, 0],
145
+ '"': [36, 36, 0, 0, 0, 0, 0, 0],
146
+ "`": [24, 12, 0, 0, 0, 0, 0, 0],
147
+ "~": [0, 17, 42, 36, 0, 0, 0, 0],
148
+ "|": [12, 12, 12, 12, 12, 12, 12, 0],
149
+ $: [12, 30, 32, 30, 1, 30, 12, 0],
150
+ };
151
+ /**
152
+ * Complete metadata object for the 6x8 font, used by the
153
+ * {@link FontBitmap} catalogue at module load time.
154
+ *
155
+ * @internal
156
+ */
157
+ export const metadata = {
158
+ /** Catalogue name. */
159
+ name: FONT_6x8_NAME,
160
+ /** Cell width including spacing (6 + 1 = 7). */
161
+ width: FONT_6x8_WIDTH + FONT_6x8_SPACING,
162
+ /** Cell height (8). */
163
+ height: FONT_6x8_HEIGHT,
164
+ /** Inter-glyph spacing (1). */
165
+ spacing: FONT_6x8_SPACING,
166
+ /** Supported character string. */
167
+ chars: FONT_6x8_CHARS,
168
+ /** Glyph bitmask data. */
169
+ data: FONT_6x8,
170
+ };
171
+ export default FONT_6x8;
@@ -0,0 +1,171 @@
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 const FONT_8x13_NAME = "8x13";
27
+ /**
28
+ * Glyph width in pixels (excluding spacing).
29
+ * @defaultValue `8`
30
+ */
31
+ export const FONT_8x13_WIDTH = 8;
32
+ /**
33
+ * Glyph height in pixels.
34
+ * @defaultValue `13`
35
+ */
36
+ export const FONT_8x13_HEIGHT = 13;
37
+ /**
38
+ * Horizontal spacing between glyphs in pixels.
39
+ * @defaultValue `1`
40
+ */
41
+ export const FONT_8x13_SPACING = 1;
42
+ /**
43
+ * Complete set of supported characters as a single string.
44
+ */
45
+ export 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 const FONT_8x13 = {
55
+ "0": [0, 0, 60, 66, 70, 74, 82, 98, 66, 60, 0, 0, 0],
56
+ "1": [0, 0, 24, 56, 24, 24, 24, 24, 24, 126, 0, 0, 0],
57
+ "2": [0, 0, 60, 66, 2, 4, 8, 48, 64, 126, 0, 0, 0],
58
+ "3": [0, 0, 124, 2, 2, 60, 2, 2, 2, 124, 0, 0, 0],
59
+ "4": [0, 0, 4, 12, 20, 36, 68, 254, 4, 4, 0, 0, 0],
60
+ "5": [0, 0, 254, 128, 128, 252, 2, 2, 66, 60, 0, 0, 0],
61
+ "6": [0, 0, 62, 64, 128, 252, 130, 130, 66, 60, 0, 0, 0],
62
+ "7": [0, 0, 254, 2, 4, 8, 16, 32, 64, 128, 0, 0, 0],
63
+ "8": [0, 0, 60, 66, 66, 60, 66, 66, 66, 60, 0, 0, 0],
64
+ "9": [0, 0, 60, 66, 66, 62, 2, 2, 66, 60, 0, 0, 0],
65
+ A: [0, 0, 24, 36, 66, 66, 126, 66, 66, 66, 0, 0, 0],
66
+ B: [0, 0, 252, 66, 66, 124, 66, 66, 66, 252, 0, 0, 0],
67
+ C: [0, 0, 60, 66, 128, 128, 128, 128, 66, 60, 0, 0, 0],
68
+ D: [0, 0, 248, 68, 66, 66, 66, 66, 68, 248, 0, 0, 0],
69
+ E: [0, 0, 254, 128, 128, 252, 128, 128, 128, 254, 0, 0, 0],
70
+ F: [0, 0, 254, 128, 128, 252, 128, 128, 128, 128, 0, 0, 0],
71
+ G: [0, 0, 62, 64, 128, 142, 130, 130, 66, 62, 0, 0, 0],
72
+ H: [0, 0, 66, 66, 66, 126, 66, 66, 66, 66, 0, 0, 0],
73
+ I: [0, 0, 126, 24, 24, 24, 24, 24, 24, 126, 0, 0, 0],
74
+ J: [0, 0, 62, 8, 8, 8, 8, 136, 136, 112, 0, 0, 0],
75
+ K: [0, 0, 130, 132, 136, 144, 224, 144, 136, 134, 0, 0, 0],
76
+ L: [0, 0, 128, 128, 128, 128, 128, 128, 128, 254, 0, 0, 0],
77
+ M: [0, 0, 130, 198, 170, 146, 130, 130, 130, 130, 0, 0, 0],
78
+ N: [0, 0, 130, 194, 162, 146, 138, 134, 130, 130, 0, 0, 0],
79
+ O: [0, 0, 60, 66, 129, 129, 129, 129, 66, 60, 0, 0, 0],
80
+ P: [0, 0, 252, 130, 130, 252, 128, 128, 128, 128, 0, 0, 0],
81
+ Q: [0, 0, 60, 66, 129, 129, 129, 133, 70, 61, 0, 0, 0],
82
+ R: [0, 0, 252, 130, 130, 252, 144, 136, 132, 130, 0, 0, 0],
83
+ S: [0, 0, 62, 64, 128, 124, 2, 2, 2, 252, 0, 0, 0],
84
+ T: [0, 0, 254, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0],
85
+ U: [0, 0, 130, 130, 130, 130, 130, 130, 68, 56, 0, 0, 0],
86
+ V: [0, 0, 130, 130, 68, 68, 40, 40, 16, 16, 0, 0, 0],
87
+ W: [0, 0, 130, 130, 130, 130, 146, 170, 198, 130, 0, 0, 0],
88
+ X: [0, 0, 130, 68, 40, 16, 16, 40, 68, 130, 0, 0, 0],
89
+ Y: [0, 0, 130, 68, 40, 16, 16, 16, 16, 16, 0, 0, 0],
90
+ Z: [0, 0, 254, 4, 8, 16, 16, 32, 64, 254, 0, 0, 0],
91
+ a: [0, 0, 0, 0, 60, 2, 62, 66, 66, 62, 0, 0, 0],
92
+ b: [0, 64, 64, 64, 124, 66, 66, 66, 66, 124, 0, 0, 0],
93
+ c: [0, 0, 0, 0, 62, 64, 128, 128, 64, 62, 0, 0, 0],
94
+ d: [0, 2, 2, 2, 62, 66, 66, 66, 66, 62, 0, 0, 0],
95
+ e: [0, 0, 0, 0, 60, 66, 126, 64, 64, 62, 0, 0, 0],
96
+ f: [0, 14, 16, 16, 60, 16, 16, 16, 16, 16, 0, 0, 0],
97
+ g: [0, 0, 0, 62, 66, 66, 66, 62, 2, 124, 0, 0, 0],
98
+ h: [0, 64, 64, 64, 124, 66, 66, 66, 66, 66, 0, 0, 0],
99
+ i: [0, 24, 24, 0, 56, 24, 24, 24, 24, 62, 0, 0, 0],
100
+ j: [0, 6, 6, 0, 6, 6, 6, 6, 70, 60, 0, 0, 0],
101
+ k: [0, 64, 64, 68, 72, 112, 120, 72, 68, 66, 0, 0, 0],
102
+ l: [0, 56, 24, 24, 24, 24, 24, 24, 24, 62, 0, 0, 0],
103
+ m: [0, 0, 0, 0, 218, 170, 170, 170, 130, 130, 0, 0, 0],
104
+ n: [0, 0, 0, 0, 124, 66, 66, 66, 66, 66, 0, 0, 0],
105
+ o: [0, 0, 0, 0, 60, 66, 129, 129, 66, 60, 0, 0, 0],
106
+ p: [0, 0, 0, 124, 66, 66, 66, 124, 64, 64, 64, 0, 0],
107
+ q: [0, 0, 0, 62, 66, 66, 66, 62, 2, 2, 2, 0, 0],
108
+ r: [0, 0, 0, 0, 94, 96, 64, 64, 64, 64, 0, 0, 0],
109
+ s: [0, 0, 0, 0, 62, 64, 60, 2, 2, 124, 0, 0, 0],
110
+ t: [0, 32, 32, 126, 32, 32, 32, 32, 34, 28, 0, 0, 0],
111
+ u: [0, 0, 0, 0, 66, 66, 66, 66, 70, 58, 0, 0, 0],
112
+ v: [0, 0, 0, 0, 66, 66, 36, 36, 24, 24, 0, 0, 0],
113
+ w: [0, 0, 0, 0, 130, 130, 146, 170, 198, 130, 0, 0, 0],
114
+ x: [0, 0, 0, 0, 66, 36, 24, 24, 36, 66, 0, 0, 0],
115
+ y: [0, 0, 0, 66, 66, 66, 66, 62, 2, 124, 0, 0, 0],
116
+ z: [0, 0, 0, 0, 254, 4, 8, 48, 64, 254, 0, 0, 0],
117
+ " ": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
118
+ "!": [0, 0, 24, 24, 24, 24, 24, 24, 0, 24, 0, 0, 0],
119
+ "?": [0, 0, 60, 66, 2, 4, 8, 8, 0, 8, 0, 0, 0],
120
+ ".": [0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 0, 0, 0],
121
+ ",": [0, 0, 0, 0, 0, 0, 0, 24, 24, 48, 0, 0, 0],
122
+ ":": [0, 0, 0, 0, 24, 24, 0, 24, 24, 0, 0, 0, 0],
123
+ ";": [0, 0, 0, 0, 24, 24, 0, 24, 24, 48, 0, 0, 0],
124
+ "-": [0, 0, 0, 0, 0, 254, 0, 0, 0, 0, 0, 0, 0],
125
+ "+": [0, 0, 0, 16, 16, 254, 16, 16, 0, 0, 0, 0, 0],
126
+ "*": [0, 0, 66, 36, 254, 36, 66, 0, 0, 0, 0, 0, 0],
127
+ "/": [0, 2, 4, 8, 16, 16, 32, 64, 128, 0, 0, 0, 0],
128
+ "\\": [0, 128, 64, 32, 16, 16, 8, 4, 2, 0, 0, 0, 0],
129
+ "(": [0, 6, 8, 16, 32, 32, 32, 16, 8, 6, 0, 0, 0],
130
+ ")": [0, 96, 16, 8, 4, 4, 4, 8, 16, 96, 0, 0, 0],
131
+ "[": [0, 120, 64, 64, 64, 64, 64, 64, 64, 120, 0, 0, 0],
132
+ "]": [0, 30, 2, 2, 2, 2, 2, 2, 2, 30, 0, 0, 0],
133
+ "{": [0, 30, 32, 32, 32, 64, 32, 32, 32, 30, 0, 0, 0],
134
+ "}": [0, 120, 4, 4, 4, 2, 4, 4, 4, 120, 0, 0, 0],
135
+ "<": [0, 0, 4, 8, 16, 32, 16, 8, 4, 0, 0, 0, 0],
136
+ ">": [0, 0, 32, 16, 8, 4, 8, 16, 32, 0, 0, 0, 0],
137
+ "=": [0, 0, 0, 0, 254, 0, 254, 0, 0, 0, 0, 0, 0],
138
+ "#": [0, 36, 36, 254, 36, 36, 254, 36, 36, 0, 0, 0, 0],
139
+ "%": [0, 0, 194, 196, 8, 16, 32, 67, 131, 0, 0, 0, 0],
140
+ "&": [0, 0, 48, 72, 72, 48, 74, 68, 72, 54, 0, 0, 0],
141
+ "@": [0, 0, 60, 66, 157, 165, 165, 158, 64, 60, 0, 0, 0],
142
+ "^": [0, 24, 36, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0],
143
+ _: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 0, 0],
144
+ "'": [0, 24, 24, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0],
145
+ '"': [0, 72, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
146
+ "`": [0, 48, 24, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0],
147
+ "~": [0, 0, 0, 70, 137, 144, 0, 0, 0, 0, 0, 0, 0],
148
+ "|": [0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0],
149
+ $: [0, 24, 62, 96, 96, 60, 6, 6, 124, 24, 0, 0, 0],
150
+ };
151
+ /**
152
+ * Complete metadata object for the 8x13 font, used by the
153
+ * {@link FontBitmap} catalogue at module load time.
154
+ *
155
+ * @internal
156
+ */
157
+ export const metadata = {
158
+ /** Catalogue name. */
159
+ name: FONT_8x13_NAME,
160
+ /** Cell width including spacing (8 + 1 = 9). */
161
+ width: FONT_8x13_WIDTH + FONT_8x13_SPACING,
162
+ /** Cell height (13). */
163
+ height: FONT_8x13_HEIGHT,
164
+ /** Inter-glyph spacing (1). */
165
+ spacing: FONT_8x13_SPACING,
166
+ /** Supported character string. */
167
+ chars: FONT_8x13_CHARS,
168
+ /** Glyph bitmask data. */
169
+ data: FONT_8x13,
170
+ };
171
+ export default FONT_8x13;
@@ -0,0 +1,171 @@
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 const FONT_8x8_NAME = "8x8";
27
+ /**
28
+ * Glyph width in pixels (excluding spacing).
29
+ * @defaultValue `8`
30
+ */
31
+ export const FONT_8x8_WIDTH = 8;
32
+ /**
33
+ * Glyph height in pixels.
34
+ * @defaultValue `8`
35
+ */
36
+ export const FONT_8x8_HEIGHT = 8;
37
+ /**
38
+ * Horizontal spacing between glyphs in pixels.
39
+ * @defaultValue `1`
40
+ */
41
+ export const FONT_8x8_SPACING = 1;
42
+ /**
43
+ * Complete set of supported characters as a single string.
44
+ */
45
+ export 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 const FONT_8x8 = {
55
+ "0": [60, 66, 70, 74, 82, 98, 60, 0],
56
+ "1": [24, 56, 24, 24, 24, 24, 126, 0],
57
+ "2": [60, 66, 2, 12, 48, 64, 126, 0],
58
+ "3": [126, 2, 4, 28, 2, 2, 124, 0],
59
+ "4": [4, 12, 20, 36, 68, 254, 4, 0],
60
+ "5": [254, 128, 252, 2, 2, 66, 60, 0],
61
+ "6": [62, 64, 128, 252, 130, 130, 124, 0],
62
+ "7": [254, 4, 8, 16, 32, 64, 128, 0],
63
+ "8": [60, 66, 66, 60, 66, 66, 60, 0],
64
+ "9": [60, 66, 66, 62, 2, 2, 60, 0],
65
+ A: [24, 36, 66, 66, 126, 66, 66, 0],
66
+ B: [252, 66, 66, 124, 66, 66, 252, 0],
67
+ C: [62, 64, 128, 128, 128, 64, 62, 0],
68
+ D: [248, 68, 66, 66, 66, 68, 248, 0],
69
+ E: [254, 128, 128, 252, 128, 128, 254, 0],
70
+ F: [254, 128, 128, 252, 128, 128, 128, 0],
71
+ G: [62, 64, 128, 142, 130, 66, 62, 0],
72
+ H: [66, 66, 66, 126, 66, 66, 66, 0],
73
+ I: [126, 24, 24, 24, 24, 24, 126, 0],
74
+ J: [62, 4, 4, 4, 132, 136, 112, 0],
75
+ K: [130, 132, 136, 240, 136, 132, 130, 0],
76
+ L: [128, 128, 128, 128, 128, 128, 254, 0],
77
+ M: [130, 198, 170, 146, 130, 130, 130, 0],
78
+ N: [130, 194, 162, 146, 138, 134, 130, 0],
79
+ O: [60, 66, 129, 129, 129, 66, 60, 0],
80
+ P: [252, 130, 130, 252, 128, 128, 128, 0],
81
+ Q: [60, 66, 129, 129, 133, 66, 61, 0],
82
+ R: [252, 130, 130, 252, 136, 132, 130, 0],
83
+ S: [62, 64, 128, 124, 2, 2, 252, 0],
84
+ T: [254, 16, 16, 16, 16, 16, 16, 0],
85
+ U: [130, 130, 130, 130, 130, 68, 56, 0],
86
+ V: [130, 130, 68, 68, 40, 40, 16, 0],
87
+ W: [130, 130, 130, 146, 170, 198, 130, 0],
88
+ X: [130, 68, 40, 16, 40, 68, 130, 0],
89
+ Y: [130, 68, 40, 16, 16, 16, 16, 0],
90
+ Z: [254, 4, 8, 16, 32, 64, 254, 0],
91
+ a: [0, 0, 60, 2, 62, 66, 62, 0],
92
+ b: [64, 64, 124, 66, 66, 66, 124, 0],
93
+ c: [0, 0, 62, 64, 64, 64, 62, 0],
94
+ d: [2, 2, 62, 66, 66, 66, 62, 0],
95
+ e: [0, 0, 60, 66, 126, 64, 62, 0],
96
+ f: [14, 16, 16, 62, 16, 16, 16, 0],
97
+ g: [0, 62, 66, 66, 62, 2, 60, 0],
98
+ h: [64, 64, 124, 66, 66, 66, 66, 0],
99
+ i: [16, 0, 48, 16, 16, 16, 62, 0],
100
+ j: [8, 0, 8, 8, 8, 72, 48, 0],
101
+ k: [64, 68, 72, 112, 72, 68, 66, 0],
102
+ l: [96, 32, 32, 32, 32, 32, 126, 0],
103
+ m: [0, 0, 218, 170, 170, 130, 130, 0],
104
+ n: [0, 0, 124, 66, 66, 66, 66, 0],
105
+ o: [0, 0, 60, 66, 66, 66, 60, 0],
106
+ p: [0, 124, 66, 66, 124, 64, 64, 0],
107
+ q: [0, 62, 66, 66, 62, 2, 2, 0],
108
+ r: [0, 0, 94, 96, 64, 64, 64, 0],
109
+ s: [0, 0, 62, 64, 60, 2, 124, 0],
110
+ t: [32, 32, 126, 32, 32, 34, 28, 0],
111
+ u: [0, 0, 66, 66, 66, 70, 58, 0],
112
+ v: [0, 0, 66, 66, 36, 40, 16, 0],
113
+ w: [0, 0, 130, 130, 146, 170, 68, 0],
114
+ x: [0, 0, 66, 36, 24, 36, 66, 0],
115
+ y: [0, 66, 66, 66, 62, 2, 60, 0],
116
+ z: [0, 0, 254, 4, 24, 96, 254, 0],
117
+ " ": [0, 0, 0, 0, 0, 0, 0, 0],
118
+ "!": [24, 24, 24, 24, 24, 0, 24, 0],
119
+ "?": [60, 66, 2, 4, 8, 0, 8, 0],
120
+ ".": [0, 0, 0, 0, 0, 48, 48, 0],
121
+ ",": [0, 0, 0, 0, 48, 48, 96, 0],
122
+ ":": [0, 24, 24, 0, 24, 24, 0, 0],
123
+ ";": [0, 24, 24, 0, 24, 24, 48, 0],
124
+ "-": [0, 0, 0, 254, 0, 0, 0, 0],
125
+ "+": [0, 16, 16, 254, 16, 16, 0, 0],
126
+ "*": [0, 130, 68, 56, 68, 130, 0, 0],
127
+ "/": [2, 4, 8, 16, 32, 64, 128, 0],
128
+ "\\": [128, 64, 32, 16, 8, 4, 2, 0],
129
+ "(": [12, 16, 32, 32, 32, 16, 12, 0],
130
+ ")": [48, 8, 4, 4, 4, 8, 48, 0],
131
+ "[": [120, 64, 64, 64, 64, 64, 120, 0],
132
+ "]": [30, 2, 2, 2, 2, 2, 30, 0],
133
+ "{": [30, 48, 16, 96, 16, 48, 30, 0],
134
+ "}": [120, 12, 8, 6, 8, 12, 120, 0],
135
+ "<": [4, 8, 16, 32, 16, 8, 4, 0],
136
+ ">": [32, 16, 8, 4, 8, 16, 32, 0],
137
+ "=": [0, 0, 254, 0, 254, 0, 0, 0],
138
+ "#": [36, 36, 254, 36, 254, 36, 36, 0],
139
+ "%": [194, 196, 8, 16, 32, 67, 131, 0],
140
+ "&": [56, 68, 72, 48, 74, 68, 58, 0],
141
+ "@": [60, 66, 157, 165, 158, 64, 60, 0],
142
+ "^": [16, 40, 68, 130, 0, 0, 0, 0],
143
+ _: [0, 0, 0, 0, 0, 0, 254, 0],
144
+ "'": [24, 24, 48, 0, 0, 0, 0, 0],
145
+ '"': [72, 72, 0, 0, 0, 0, 0, 0],
146
+ "`": [48, 24, 8, 0, 0, 0, 0, 0],
147
+ "~": [0, 70, 137, 144, 0, 0, 0, 0],
148
+ "|": [24, 24, 24, 24, 24, 24, 24, 0],
149
+ $: [24, 62, 96, 60, 6, 124, 24, 0],
150
+ };
151
+ /**
152
+ * Complete metadata object for the 8x8 font, used by the
153
+ * {@link FontBitmap} catalogue at module load time.
154
+ *
155
+ * @internal
156
+ */
157
+ export const metadata = {
158
+ /** Catalogue name. */
159
+ name: FONT_8x8_NAME,
160
+ /** Cell width including spacing (8 + 1 = 9). */
161
+ width: FONT_8x8_WIDTH + FONT_8x8_SPACING,
162
+ /** Cell height (8). */
163
+ height: FONT_8x8_HEIGHT,
164
+ /** Inter-glyph spacing (1). */
165
+ spacing: FONT_8x8_SPACING,
166
+ /** Supported character string. */
167
+ chars: FONT_8x8_CHARS,
168
+ /** Glyph bitmask data. */
169
+ data: FONT_8x8,
170
+ };
171
+ export default FONT_8x8;