@utsp/core 0.17.0-nightly.20260127101256.e83fcc8 → 0.17.0-nightly.20260127111647.165f2b8
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/benchmark.cjs +6 -6
- package/dist/benchmark.d.ts +136 -46
- package/dist/benchmark.mjs +6 -6
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +136 -46
- package/dist/index.mjs +6 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1476,6 +1476,75 @@ interface ImageFontBlockLoad {
|
|
|
1476
1476
|
*/
|
|
1477
1477
|
type AnyLoad = ColorPaletteLoad | SpriteLoad | MulticolorSpriteLoad | SoundLoad | MacroLoad | ImageFontLoad | ImageFontBlockLoad;
|
|
1478
1478
|
|
|
1479
|
+
/**
|
|
1480
|
+
* Public-facing types for Sprite Loading API
|
|
1481
|
+
* These types hide internal implementation details like LoadType
|
|
1482
|
+
* and support flexible input formats (strings, numbers, etc.)
|
|
1483
|
+
*/
|
|
1484
|
+
/**
|
|
1485
|
+
* Single Multicolor Cell definition
|
|
1486
|
+
*/
|
|
1487
|
+
interface MulticolorSpriteCell {
|
|
1488
|
+
/**
|
|
1489
|
+
* Character as a string (first char used) or numeric char code (0-65535).
|
|
1490
|
+
* Automatically converted to CP437 if a string is provided.
|
|
1491
|
+
*/
|
|
1492
|
+
charCode: string | number;
|
|
1493
|
+
/**
|
|
1494
|
+
* Foreground color ID (0-255)
|
|
1495
|
+
*/
|
|
1496
|
+
fgColorId: number;
|
|
1497
|
+
/**
|
|
1498
|
+
* Background color ID (0-255)
|
|
1499
|
+
*/
|
|
1500
|
+
bgColorId: number;
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Definition for a Unicolor Sprite
|
|
1504
|
+
*/
|
|
1505
|
+
interface UnicolorSpriteDefinition {
|
|
1506
|
+
/**
|
|
1507
|
+
* Unique sprite identifier (0-255)
|
|
1508
|
+
*/
|
|
1509
|
+
spriteId: number;
|
|
1510
|
+
/**
|
|
1511
|
+
* Width in cells (1-255)
|
|
1512
|
+
*/
|
|
1513
|
+
sizeX: number;
|
|
1514
|
+
/**
|
|
1515
|
+
* Height in cells (1-255)
|
|
1516
|
+
*/
|
|
1517
|
+
sizeY: number;
|
|
1518
|
+
/**
|
|
1519
|
+
* Sprite data. Can be:
|
|
1520
|
+
* - Flat array of numbers (char codes)
|
|
1521
|
+
* - Single string (will be treated as a sequence of characters)
|
|
1522
|
+
* - Array of strings (one per row)
|
|
1523
|
+
*/
|
|
1524
|
+
data: number[] | string | string[];
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Definition for a Multicolor Sprite
|
|
1528
|
+
*/
|
|
1529
|
+
interface MulticolorSpriteDefinition {
|
|
1530
|
+
/**
|
|
1531
|
+
* Unique sprite identifier (0-255)
|
|
1532
|
+
*/
|
|
1533
|
+
spriteId: number;
|
|
1534
|
+
/**
|
|
1535
|
+
* Width in cells (1-255)
|
|
1536
|
+
*/
|
|
1537
|
+
sizeX: number;
|
|
1538
|
+
/**
|
|
1539
|
+
* Height in cells (1-255)
|
|
1540
|
+
*/
|
|
1541
|
+
sizeY: number;
|
|
1542
|
+
/**
|
|
1543
|
+
* Array of multicolor cells (row-major order, length = sizeX * sizeY)
|
|
1544
|
+
*/
|
|
1545
|
+
data: MulticolorSpriteCell[];
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1479
1548
|
/**
|
|
1480
1549
|
* Central registry to manage unicolor and multicolor sprites
|
|
1481
1550
|
*
|
|
@@ -1491,15 +1560,25 @@ declare class SpriteRegistry {
|
|
|
1491
1560
|
private unicolorSprites;
|
|
1492
1561
|
private multicolorSprites;
|
|
1493
1562
|
/**
|
|
1494
|
-
* Loads unicolor sprites from
|
|
1495
|
-
*
|
|
1563
|
+
* Loads unicolor sprites from public definitions
|
|
1564
|
+
* Supports strings, string arrays, and numbers
|
|
1496
1565
|
*/
|
|
1497
|
-
loadUnicolorSprites(
|
|
1566
|
+
loadUnicolorSprites(definitions: UnicolorSpriteDefinition[] | SpriteLoad): void;
|
|
1498
1567
|
/**
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1568
|
+
* Internal method to load unicolor sprites from protocol packet
|
|
1569
|
+
* @internal
|
|
1570
|
+
*/
|
|
1571
|
+
loadUnicolorSpritesFromPacket(loadData: SpriteLoad): void;
|
|
1572
|
+
/**
|
|
1573
|
+
* Loads multicolor sprites from public definitions
|
|
1574
|
+
* Supports string or number charCodes
|
|
1575
|
+
*/
|
|
1576
|
+
loadMulticolorSprites(definitions: MulticolorSpriteDefinition[] | MulticolorSpriteLoad): void;
|
|
1577
|
+
/**
|
|
1578
|
+
* Internal method to load multicolor sprites from protocol packet
|
|
1579
|
+
* @internal
|
|
1501
1580
|
*/
|
|
1502
|
-
|
|
1581
|
+
loadMulticolorSpritesFromPacket(loadData: MulticolorSpriteLoad): void;
|
|
1503
1582
|
/**
|
|
1504
1583
|
* Retrieves a unicolor sprite by its ID
|
|
1505
1584
|
*/
|
|
@@ -8000,63 +8079,74 @@ declare class Core {
|
|
|
8000
8079
|
*/
|
|
8001
8080
|
resetStats(): void;
|
|
8002
8081
|
/**
|
|
8003
|
-
* Loads unicolor sprites
|
|
8082
|
+
* Loads unicolor sprites into the registry.
|
|
8004
8083
|
*
|
|
8005
|
-
* Unicolor sprites
|
|
8006
|
-
*
|
|
8084
|
+
* Unicolor sprites store only character codes. Colors (fg/bg) are
|
|
8085
|
+
* defined at render time via SpriteOrder.
|
|
8007
8086
|
*
|
|
8008
|
-
*
|
|
8087
|
+
* ✨ Supports strings for data (including row-by-row arrays) and auto-converts
|
|
8088
|
+
* characters to CP437 automatically.
|
|
8089
|
+
*
|
|
8090
|
+
* @param definitions - Array of sprite definitions
|
|
8009
8091
|
*
|
|
8010
8092
|
* @example
|
|
8011
8093
|
* ```typescript
|
|
8012
|
-
* // Load a 4x4 unicolor sprite
|
|
8013
|
-
* engine.loadUnicolorSprites(
|
|
8014
|
-
*
|
|
8015
|
-
*
|
|
8016
|
-
*
|
|
8017
|
-
*
|
|
8018
|
-
*
|
|
8019
|
-
*
|
|
8020
|
-
*
|
|
8021
|
-
*
|
|
8022
|
-
*
|
|
8023
|
-
*
|
|
8024
|
-
*
|
|
8025
|
-
*
|
|
8026
|
-
*
|
|
8027
|
-
*
|
|
8094
|
+
* // Load a 4x4 unicolor sprite using a flat string
|
|
8095
|
+
* engine.loadUnicolorSprites([
|
|
8096
|
+
* {
|
|
8097
|
+
* spriteId: 1,
|
|
8098
|
+
* sizeX: 4,
|
|
8099
|
+
* sizeY: 4,
|
|
8100
|
+
* data: "##### ## #####"
|
|
8101
|
+
* }
|
|
8102
|
+
* ]);
|
|
8103
|
+
*
|
|
8104
|
+
* // Load using a string array (row by row) - cleaner!
|
|
8105
|
+
* engine.loadUnicolorSprites([
|
|
8106
|
+
* {
|
|
8107
|
+
* spriteId: 2,
|
|
8108
|
+
* sizeX: 4,
|
|
8109
|
+
* sizeY: 4,
|
|
8110
|
+
* data: [
|
|
8111
|
+
* "####",
|
|
8112
|
+
* "# #",
|
|
8113
|
+
* "# #",
|
|
8114
|
+
* "####"
|
|
8115
|
+
* ]
|
|
8116
|
+
* }
|
|
8117
|
+
* ]);
|
|
8028
8118
|
* ```
|
|
8029
8119
|
*/
|
|
8030
|
-
loadUnicolorSprites(
|
|
8120
|
+
loadUnicolorSprites(definitions: UnicolorSpriteDefinition[]): void;
|
|
8031
8121
|
/**
|
|
8032
|
-
* Loads multicolor sprites
|
|
8122
|
+
* Loads multicolor sprites into the registry.
|
|
8033
8123
|
*
|
|
8034
|
-
* Multicolor sprites store charCode + fgColorId + bgColorId
|
|
8124
|
+
* Multicolor sprites store charCode + fgColorId + bgColorId per cell.
|
|
8035
8125
|
* Optimized for sprites with lots of visual detail.
|
|
8036
8126
|
*
|
|
8037
|
-
*
|
|
8127
|
+
* ✨ Supports string characters for charCode and auto-converts to CP437.
|
|
8128
|
+
*
|
|
8129
|
+
* @param definitions - Array of sprite definitions
|
|
8038
8130
|
*
|
|
8039
8131
|
* @example
|
|
8040
8132
|
* ```typescript
|
|
8041
8133
|
* // Load a 2x2 multicolor sprite
|
|
8042
|
-
* engine.loadMulticolorSprites(
|
|
8043
|
-
*
|
|
8044
|
-
*
|
|
8045
|
-
*
|
|
8046
|
-
*
|
|
8047
|
-
*
|
|
8048
|
-
*
|
|
8049
|
-
*
|
|
8050
|
-
*
|
|
8051
|
-
*
|
|
8052
|
-
*
|
|
8053
|
-
*
|
|
8054
|
-
*
|
|
8055
|
-
* ]
|
|
8056
|
-
* });
|
|
8134
|
+
* engine.loadMulticolorSprites([
|
|
8135
|
+
* {
|
|
8136
|
+
* spriteId: 10,
|
|
8137
|
+
* sizeX: 2,
|
|
8138
|
+
* sizeY: 2,
|
|
8139
|
+
* data: [
|
|
8140
|
+
* { charCode: 'A', fgColorId: 12, bgColorId: 0 },
|
|
8141
|
+
* { charCode: 'B', fgColorId: 14, bgColorId: 0 },
|
|
8142
|
+
* { charCode: 'C', fgColorId: 14, bgColorId: 0 },
|
|
8143
|
+
* { charCode: 'D', fgColorId: 12, bgColorId: 0 }
|
|
8144
|
+
* ]
|
|
8145
|
+
* }
|
|
8146
|
+
* ]);
|
|
8057
8147
|
* ```
|
|
8058
8148
|
*/
|
|
8059
|
-
loadMulticolorSprites(
|
|
8149
|
+
loadMulticolorSprites(definitions: MulticolorSpriteDefinition[]): void;
|
|
8060
8150
|
/**
|
|
8061
8151
|
* Load Font structure (allocate font)
|
|
8062
8152
|
* Defines the font dimensions and allocates the atlas in memory (empty)
|