@utsp/core 0.14.0-nightly.20251219144833.1c27cfe → 0.14.0
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 +5 -5
- package/dist/benchmark.d.ts +259 -88
- package/dist/benchmark.mjs +5 -5
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +313 -115
- package/dist/index.mjs +5 -5
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2580,7 +2580,13 @@ declare enum PostProcessOrderType {
|
|
|
2580
2580
|
*
|
|
2581
2581
|
* Parameters: slotId (0-255)
|
|
2582
2582
|
*/
|
|
2583
|
-
SwitchPalette = 6
|
|
2583
|
+
SwitchPalette = 6,
|
|
2584
|
+
/**
|
|
2585
|
+
* 0x07 - SetCellSize: Set cell dimensions in pixels
|
|
2586
|
+
*
|
|
2587
|
+
* Parameters: cellWidth (1-255), cellHeight (1-255)
|
|
2588
|
+
*/
|
|
2589
|
+
SetCellSize = 7
|
|
2584
2590
|
}
|
|
2585
2591
|
|
|
2586
2592
|
/**
|
|
@@ -2600,18 +2606,25 @@ declare enum ScanlinesPatternType {
|
|
|
2600
2606
|
}
|
|
2601
2607
|
/**
|
|
2602
2608
|
* Base interface for all post-process orders
|
|
2609
|
+
*
|
|
2610
|
+
* All post-process orders are scoped to a specific display.
|
|
2611
|
+
* The displayId identifies which display the order applies to.
|
|
2603
2612
|
*/
|
|
2604
2613
|
interface PostProcessOrderBase {
|
|
2614
|
+
/** Order type identifier */
|
|
2605
2615
|
type: PostProcessOrderType;
|
|
2616
|
+
/** Display ID this order applies to (0-255) */
|
|
2617
|
+
displayId: number;
|
|
2606
2618
|
}
|
|
2607
2619
|
/**
|
|
2608
2620
|
* SetConfig Order (0x01)
|
|
2609
2621
|
*
|
|
2610
|
-
* Sets the full post-process configuration.
|
|
2622
|
+
* Sets the full post-process configuration for a specific display.
|
|
2611
2623
|
* Flags indicate which optional sections are present.
|
|
2612
2624
|
*
|
|
2613
2625
|
* Binary format:
|
|
2614
2626
|
* - type: 1 byte (0x01)
|
|
2627
|
+
* - displayId: 1 byte (0-255)
|
|
2615
2628
|
* - flags: 1 byte (PostProcessConfigFlags)
|
|
2616
2629
|
* - [if HasScanlines]:
|
|
2617
2630
|
* - enabled: 1 byte (0 or 1)
|
|
@@ -2649,10 +2662,11 @@ interface SetConfigOrder extends PostProcessOrderBase {
|
|
|
2649
2662
|
/**
|
|
2650
2663
|
* SetScanlines Order (0x02)
|
|
2651
2664
|
*
|
|
2652
|
-
* Sets only the scanlines configuration.
|
|
2665
|
+
* Sets only the scanlines configuration for a specific display.
|
|
2653
2666
|
*
|
|
2654
2667
|
* Binary format:
|
|
2655
2668
|
* - type: 1 byte (0x02)
|
|
2669
|
+
* - displayId: 1 byte (0-255)
|
|
2656
2670
|
* - enabled: 1 byte (0 or 1)
|
|
2657
2671
|
* - opacity: 1 byte (0-255, scaled from 0.0-1.0)
|
|
2658
2672
|
* - pattern: 1 byte (ScanlinesPatternType)
|
|
@@ -2672,10 +2686,11 @@ interface SetScanlinesOrder extends PostProcessOrderBase {
|
|
|
2672
2686
|
/**
|
|
2673
2687
|
* SetAmbientEffect Order (0x03)
|
|
2674
2688
|
*
|
|
2675
|
-
* Sets only the ambient effect configuration.
|
|
2689
|
+
* Sets only the ambient effect configuration for a specific display.
|
|
2676
2690
|
*
|
|
2677
2691
|
* Binary format:
|
|
2678
2692
|
* - type: 1 byte (0x03)
|
|
2693
|
+
* - displayId: 1 byte (0-255)
|
|
2679
2694
|
* - enabled: 1 byte (0 or 1)
|
|
2680
2695
|
* - blur: 1 byte (0-255 pixels)
|
|
2681
2696
|
* - scale: 1 byte (100-255, scaled from 1.0-2.55)
|
|
@@ -2691,10 +2706,11 @@ interface SetAmbientEffectOrder extends PostProcessOrderBase {
|
|
|
2691
2706
|
/**
|
|
2692
2707
|
* SetScalingMode Order (0x04)
|
|
2693
2708
|
*
|
|
2694
|
-
* Sets the pixel-perfect scaling mode.
|
|
2709
|
+
* Sets the pixel-perfect scaling mode for a specific display.
|
|
2695
2710
|
*
|
|
2696
2711
|
* Binary format:
|
|
2697
2712
|
* - type: 1 byte (0x04)
|
|
2713
|
+
* - displayId: 1 byte (0-255)
|
|
2698
2714
|
* - mode: 1 byte (ScalingModeValue)
|
|
2699
2715
|
*/
|
|
2700
2716
|
interface SetScalingModeOrder extends PostProcessOrderBase {
|
|
@@ -2704,10 +2720,11 @@ interface SetScalingModeOrder extends PostProcessOrderBase {
|
|
|
2704
2720
|
/**
|
|
2705
2721
|
* SetGrid Order (0x05)
|
|
2706
2722
|
*
|
|
2707
|
-
* Sets the debug grid overlay configuration.
|
|
2723
|
+
* Sets the debug grid overlay configuration for a specific display.
|
|
2708
2724
|
*
|
|
2709
2725
|
* Binary format:
|
|
2710
2726
|
* - type: 1 byte (0x05)
|
|
2727
|
+
* - displayId: 1 byte (0-255)
|
|
2711
2728
|
* - enabled: 1 byte (0 or 1)
|
|
2712
2729
|
* - colorR: 1 byte (0-255)
|
|
2713
2730
|
* - colorG: 1 byte (0-255)
|
|
@@ -2727,21 +2744,39 @@ interface SetGridOrder extends PostProcessOrderBase {
|
|
|
2727
2744
|
/**
|
|
2728
2745
|
* SwitchPalette Order (0x06)
|
|
2729
2746
|
*
|
|
2730
|
-
* Switches to a pre-loaded palette slot.
|
|
2747
|
+
* Switches to a pre-loaded palette slot for a specific display.
|
|
2731
2748
|
* The palette must have been loaded to the Core via loadPaletteToSlot() first.
|
|
2732
2749
|
*
|
|
2733
2750
|
* Binary format:
|
|
2734
2751
|
* - type: 1 byte (0x06)
|
|
2752
|
+
* - displayId: 1 byte (0-255)
|
|
2735
2753
|
* - slotId: 1 byte (0-255)
|
|
2736
2754
|
*/
|
|
2737
2755
|
interface SwitchPaletteOrder extends PostProcessOrderBase {
|
|
2738
2756
|
type: PostProcessOrderType.SwitchPalette;
|
|
2739
2757
|
slotId: number;
|
|
2740
2758
|
}
|
|
2759
|
+
/**
|
|
2760
|
+
* SetCellSize Order (0x07)
|
|
2761
|
+
*
|
|
2762
|
+
* Sets the cell dimensions in pixels for a specific display.
|
|
2763
|
+
* Used to configure the renderer's native cell size.
|
|
2764
|
+
*
|
|
2765
|
+
* Binary format:
|
|
2766
|
+
* - type: 1 byte (0x07)
|
|
2767
|
+
* - displayId: 1 byte (0-255)
|
|
2768
|
+
* - cellWidth: 1 byte (1-255 pixels)
|
|
2769
|
+
* - cellHeight: 1 byte (1-255 pixels)
|
|
2770
|
+
*/
|
|
2771
|
+
interface SetCellSizeOrder extends PostProcessOrderBase {
|
|
2772
|
+
type: PostProcessOrderType.SetCellSize;
|
|
2773
|
+
cellWidth: number;
|
|
2774
|
+
cellHeight: number;
|
|
2775
|
+
}
|
|
2741
2776
|
/**
|
|
2742
2777
|
* Union type for all post-process orders
|
|
2743
2778
|
*/
|
|
2744
|
-
type AnyPostProcessOrder = SetConfigOrder | SetScanlinesOrder | SetAmbientEffectOrder | SetScalingModeOrder | SetGridOrder | SwitchPaletteOrder;
|
|
2779
|
+
type AnyPostProcessOrder = SetConfigOrder | SetScanlinesOrder | SetAmbientEffectOrder | SetScalingModeOrder | SetGridOrder | SwitchPaletteOrder | SetCellSizeOrder;
|
|
2745
2780
|
|
|
2746
2781
|
/**
|
|
2747
2782
|
* Update packet according to the new UTSP protocol
|
|
@@ -3669,6 +3704,7 @@ declare class User<TData = Record<string, any>> {
|
|
|
3669
3704
|
private bytesTickRate;
|
|
3670
3705
|
private currentTickBytesSent;
|
|
3671
3706
|
private currentTickBytesReceived;
|
|
3707
|
+
private availableViewports;
|
|
3672
3708
|
/**
|
|
3673
3709
|
* Application-specific data storage
|
|
3674
3710
|
* Use this to store game state, player data, or any custom information
|
|
@@ -3698,6 +3734,78 @@ declare class User<TData = Record<string, any>> {
|
|
|
3698
3734
|
* Removes all displays from the user
|
|
3699
3735
|
*/
|
|
3700
3736
|
clearDisplays(): void;
|
|
3737
|
+
/**
|
|
3738
|
+
* Sets the available viewport size (in pixels) for a display
|
|
3739
|
+
*
|
|
3740
|
+
* Called by the server when receiving viewport information from the client.
|
|
3741
|
+
* The application can use this to adapt display resolution.
|
|
3742
|
+
*
|
|
3743
|
+
* @param displayId - Display ID (0-255)
|
|
3744
|
+
* @param pixelWidth - Available width in pixels (0-65535)
|
|
3745
|
+
* @param pixelHeight - Available height in pixels (0-65535)
|
|
3746
|
+
*
|
|
3747
|
+
* @example
|
|
3748
|
+
* ```typescript
|
|
3749
|
+
* // Called automatically by decodeAndApplyCompressedInput()
|
|
3750
|
+
* user.setDisplayViewport(0, 800, 600);
|
|
3751
|
+
* ```
|
|
3752
|
+
*/
|
|
3753
|
+
setDisplayViewport(displayId: number, pixelWidth: number, pixelHeight: number): void;
|
|
3754
|
+
/**
|
|
3755
|
+
* Gets the available viewport size (in pixels) for a display
|
|
3756
|
+
*
|
|
3757
|
+
* @param displayId - Display ID (0-255)
|
|
3758
|
+
* @returns Viewport size in pixels, or null if not set
|
|
3759
|
+
*
|
|
3760
|
+
* @example
|
|
3761
|
+
* ```typescript
|
|
3762
|
+
* const viewport = user.getDisplayViewport(0);
|
|
3763
|
+
* if (viewport) {
|
|
3764
|
+
* console.log(`Available: ${viewport.pixelWidth}x${viewport.pixelHeight}px`);
|
|
3765
|
+
* }
|
|
3766
|
+
* ```
|
|
3767
|
+
*/
|
|
3768
|
+
getDisplayViewport(displayId: number): {
|
|
3769
|
+
pixelWidth: number;
|
|
3770
|
+
pixelHeight: number;
|
|
3771
|
+
} | null;
|
|
3772
|
+
/**
|
|
3773
|
+
* Gets all available viewports (in pixels)
|
|
3774
|
+
*
|
|
3775
|
+
* @returns Map of displayId → viewport size
|
|
3776
|
+
*/
|
|
3777
|
+
getAllDisplayViewports(): Map<number, {
|
|
3778
|
+
pixelWidth: number;
|
|
3779
|
+
pixelHeight: number;
|
|
3780
|
+
}>;
|
|
3781
|
+
/**
|
|
3782
|
+
* Calculates the maximum number of cells that fit in a display's available viewport
|
|
3783
|
+
*
|
|
3784
|
+
* Helper method that divides pixel dimensions by cell size to get max cells.
|
|
3785
|
+
* The application can use this to decide the optimal display resolution.
|
|
3786
|
+
*
|
|
3787
|
+
* @param displayId - Display ID (0-255)
|
|
3788
|
+
* @param cellWidth - Width of a cell in pixels (e.g., 8 for 8px font)
|
|
3789
|
+
* @param cellHeight - Height of a cell in pixels (e.g., 16 for 16px font)
|
|
3790
|
+
* @returns Max cells { cols, rows }, or null if viewport not set
|
|
3791
|
+
*
|
|
3792
|
+
* @example
|
|
3793
|
+
* ```typescript
|
|
3794
|
+
* // With 8x16 font, calculate how many cells fit in available space
|
|
3795
|
+
* const maxCells = user.calculateMaxCells(0, 8, 16);
|
|
3796
|
+
* if (maxCells) {
|
|
3797
|
+
* const display = user.getDisplays()[0];
|
|
3798
|
+
* display.setSize(new Vector2(
|
|
3799
|
+
* Math.min(maxCells.cols, 120), // Cap at 120 columns
|
|
3800
|
+
* Math.min(maxCells.rows, 40) // Cap at 40 rows
|
|
3801
|
+
* ));
|
|
3802
|
+
* }
|
|
3803
|
+
* ```
|
|
3804
|
+
*/
|
|
3805
|
+
calculateMaxCells(displayId: number, cellWidth: number, cellHeight: number): {
|
|
3806
|
+
cols: number;
|
|
3807
|
+
rows: number;
|
|
3808
|
+
} | null;
|
|
3701
3809
|
getLayers(): Layer[];
|
|
3702
3810
|
/**
|
|
3703
3811
|
* Gets a layer by its ID
|
|
@@ -4356,6 +4464,12 @@ declare class User<TData = Record<string, any>> {
|
|
|
4356
4464
|
* // Values are now available
|
|
4357
4465
|
* const move = user.getAxis("MoveHorizontal");
|
|
4358
4466
|
* if (user.getButton("Jump")) { ... }
|
|
4467
|
+
*
|
|
4468
|
+
* // Viewport info is available via:
|
|
4469
|
+
* const viewport = user.getDisplayViewport(0);
|
|
4470
|
+
* if (viewport) {
|
|
4471
|
+
* console.log(`Available: ${viewport.pixelWidth}x${viewport.pixelHeight}px`);
|
|
4472
|
+
* }
|
|
4359
4473
|
* });
|
|
4360
4474
|
* ```
|
|
4361
4475
|
*/
|
|
@@ -5207,17 +5321,18 @@ declare class User<TData = Record<string, any>> {
|
|
|
5207
5321
|
*/
|
|
5208
5322
|
macroActivateFocused(): void;
|
|
5209
5323
|
/**
|
|
5210
|
-
* Set post-processing configuration
|
|
5324
|
+
* Set post-processing configuration for a specific display
|
|
5211
5325
|
*
|
|
5212
5326
|
* The post-process overlay is rendered ONCE when this is called.
|
|
5213
5327
|
* No per-frame cost - only updates when you call this method.
|
|
5214
5328
|
*
|
|
5329
|
+
* @param displayId - Display ID (0-255) this setting applies to
|
|
5215
5330
|
* @param config - Post-processing configuration (or null to disable)
|
|
5216
5331
|
*
|
|
5217
5332
|
* @example
|
|
5218
5333
|
* ```typescript
|
|
5219
|
-
* // Enable scanlines effect
|
|
5220
|
-
* user.setPostProcess({
|
|
5334
|
+
* // Enable scanlines effect on display 0
|
|
5335
|
+
* user.setPostProcess(0, {
|
|
5221
5336
|
* scanlines: {
|
|
5222
5337
|
* enabled: true,
|
|
5223
5338
|
* opacity: 0.15,
|
|
@@ -5225,105 +5340,112 @@ declare class User<TData = Record<string, any>> {
|
|
|
5225
5340
|
* }
|
|
5226
5341
|
* });
|
|
5227
5342
|
*
|
|
5228
|
-
* // Disable all post-processing
|
|
5229
|
-
* user.setPostProcess(null);
|
|
5343
|
+
* // Disable all post-processing on display 0
|
|
5344
|
+
* user.setPostProcess(0, null);
|
|
5230
5345
|
* ```
|
|
5231
5346
|
*/
|
|
5232
|
-
setPostProcess(config: PostProcessConfig | null): void;
|
|
5347
|
+
setPostProcess(displayId: number, config: PostProcessConfig | null): void;
|
|
5233
5348
|
/**
|
|
5234
|
-
* Enable or disable scanlines effect with default/current settings
|
|
5349
|
+
* Enable or disable scanlines effect with default/current settings for a specific display
|
|
5235
5350
|
*
|
|
5351
|
+
* @param displayId - Display ID (0-255)
|
|
5236
5352
|
* @param enabled - Whether to enable scanlines
|
|
5237
5353
|
*
|
|
5238
5354
|
* @example
|
|
5239
5355
|
* ```typescript
|
|
5240
|
-
* user.setScanlinesEnabled(true); // Enable with defaults
|
|
5241
|
-
* user.setScanlinesEnabled(false); // Disable
|
|
5356
|
+
* user.setScanlinesEnabled(0, true); // Enable with defaults on display 0
|
|
5357
|
+
* user.setScanlinesEnabled(0, false); // Disable on display 0
|
|
5242
5358
|
* ```
|
|
5243
5359
|
*/
|
|
5244
|
-
setScanlinesEnabled(enabled: boolean): void;
|
|
5360
|
+
setScanlinesEnabled(displayId: number, enabled: boolean): void;
|
|
5245
5361
|
/**
|
|
5246
|
-
* Set scanlines opacity (0-1)
|
|
5362
|
+
* Set scanlines opacity (0-1) for a specific display
|
|
5247
5363
|
*
|
|
5248
5364
|
* Also enables scanlines if not already enabled.
|
|
5249
5365
|
*
|
|
5366
|
+
* @param displayId - Display ID (0-255)
|
|
5250
5367
|
* @param opacity - Opacity of dark lines (0 = invisible, 1 = fully opaque)
|
|
5251
5368
|
*
|
|
5252
5369
|
* @example
|
|
5253
5370
|
* ```typescript
|
|
5254
|
-
* user.setScanlinesOpacity(0.2); // Subtle effect
|
|
5255
|
-
* user.setScanlinesOpacity(0.5); // Strong effect
|
|
5371
|
+
* user.setScanlinesOpacity(0, 0.2); // Subtle effect on display 0
|
|
5372
|
+
* user.setScanlinesOpacity(0, 0.5); // Strong effect on display 0
|
|
5256
5373
|
* ```
|
|
5257
5374
|
*/
|
|
5258
|
-
setScanlinesOpacity(opacity: number): void;
|
|
5375
|
+
setScanlinesOpacity(displayId: number, opacity: number): void;
|
|
5259
5376
|
/**
|
|
5260
|
-
* Set scanlines pattern
|
|
5377
|
+
* Set scanlines pattern for a specific display
|
|
5261
5378
|
*
|
|
5379
|
+
* @param displayId - Display ID (0-255)
|
|
5262
5380
|
* @param pattern - Pattern type: 'horizontal', 'vertical', or 'grid'
|
|
5263
5381
|
*/
|
|
5264
|
-
setScanlinesPattern(pattern: 'horizontal' | 'vertical' | 'grid'): void;
|
|
5382
|
+
setScanlinesPattern(displayId: number, pattern: 'horizontal' | 'vertical' | 'grid'): void;
|
|
5265
5383
|
/**
|
|
5266
|
-
* Enable or configure ambient effect
|
|
5384
|
+
* Enable or configure ambient effect for a specific display
|
|
5267
5385
|
*
|
|
5268
5386
|
* Ambient effect creates a blurred glow around the terminal canvas,
|
|
5269
5387
|
* filling the unused space with colors from the terminal content.
|
|
5270
5388
|
* This effect is GPU-accelerated (CSS blur) and has zero CPU cost.
|
|
5271
5389
|
*
|
|
5390
|
+
* @param displayId - Display ID (0-255)
|
|
5272
5391
|
* @param config - true to enable with defaults, false to disable,
|
|
5273
5392
|
* or object with blur and scale settings
|
|
5274
5393
|
*
|
|
5275
5394
|
* @example
|
|
5276
5395
|
* ```typescript
|
|
5277
|
-
* // Enable with defaults (blur: 30px, scale: 1.3)
|
|
5278
|
-
* user.setAmbientEffect(true);
|
|
5396
|
+
* // Enable with defaults (blur: 30px, scale: 1.3) on display 0
|
|
5397
|
+
* user.setAmbientEffect(0, true);
|
|
5279
5398
|
*
|
|
5280
|
-
* // Disable
|
|
5281
|
-
* user.setAmbientEffect(false);
|
|
5399
|
+
* // Disable on display 0
|
|
5400
|
+
* user.setAmbientEffect(0, false);
|
|
5282
5401
|
*
|
|
5283
|
-
* // Custom settings
|
|
5284
|
-
* user.setAmbientEffect({ blur: 50, scale: 1.5 });
|
|
5402
|
+
* // Custom settings on display 1
|
|
5403
|
+
* user.setAmbientEffect(1, { blur: 50, scale: 1.5 });
|
|
5285
5404
|
* ```
|
|
5286
5405
|
*/
|
|
5287
|
-
setAmbientEffect(config: boolean | {
|
|
5406
|
+
setAmbientEffect(displayId: number, config: boolean | {
|
|
5288
5407
|
blur?: number;
|
|
5289
5408
|
scale?: number;
|
|
5290
5409
|
}): void;
|
|
5291
5410
|
/**
|
|
5292
|
-
* Enable or disable ambient effect
|
|
5411
|
+
* Enable or disable ambient effect for a specific display
|
|
5293
5412
|
*
|
|
5413
|
+
* @param displayId - Display ID (0-255)
|
|
5294
5414
|
* @param enabled - Whether to enable ambient effect
|
|
5295
5415
|
*
|
|
5296
5416
|
* @example
|
|
5297
5417
|
* ```typescript
|
|
5298
|
-
* user.setAmbientEffectEnabled(true); // Enable with defaults
|
|
5299
|
-
* user.setAmbientEffectEnabled(false); // Disable
|
|
5418
|
+
* user.setAmbientEffectEnabled(0, true); // Enable with defaults on display 0
|
|
5419
|
+
* user.setAmbientEffectEnabled(0, false); // Disable on display 0
|
|
5300
5420
|
* ```
|
|
5301
5421
|
*/
|
|
5302
|
-
setAmbientEffectEnabled(enabled: boolean): void;
|
|
5422
|
+
setAmbientEffectEnabled(displayId: number, enabled: boolean): void;
|
|
5303
5423
|
/**
|
|
5304
|
-
* Set ambient effect blur intensity
|
|
5424
|
+
* Set ambient effect blur intensity for a specific display
|
|
5305
5425
|
*
|
|
5426
|
+
* @param displayId - Display ID (0-255)
|
|
5306
5427
|
* @param blur - Blur intensity in pixels (default: 30)
|
|
5307
5428
|
*
|
|
5308
5429
|
* @example
|
|
5309
5430
|
* ```typescript
|
|
5310
|
-
* user.setAmbientEffectBlur(50); // More blur
|
|
5311
|
-
* user.setAmbientEffectBlur(15); // Less blur
|
|
5431
|
+
* user.setAmbientEffectBlur(0, 50); // More blur on display 0
|
|
5432
|
+
* user.setAmbientEffectBlur(0, 15); // Less blur on display 0
|
|
5312
5433
|
* ```
|
|
5313
5434
|
*/
|
|
5314
|
-
setAmbientEffectBlur(blur: number): void;
|
|
5435
|
+
setAmbientEffectBlur(displayId: number, blur: number): void;
|
|
5315
5436
|
/**
|
|
5316
|
-
* Set ambient effect scale factor
|
|
5437
|
+
* Set ambient effect scale factor for a specific display
|
|
5317
5438
|
*
|
|
5439
|
+
* @param displayId - Display ID (0-255)
|
|
5318
5440
|
* @param scale - Scale factor for the glow (default: 1.3)
|
|
5319
5441
|
*
|
|
5320
5442
|
* @example
|
|
5321
5443
|
* ```typescript
|
|
5322
|
-
* user.setAmbientEffectScale(1.5); // Larger glow area
|
|
5323
|
-
* user.setAmbientEffectScale(1.1); // Smaller glow area
|
|
5444
|
+
* user.setAmbientEffectScale(0, 1.5); // Larger glow area on display 0
|
|
5445
|
+
* user.setAmbientEffectScale(0, 1.1); // Smaller glow area on display 0
|
|
5324
5446
|
* ```
|
|
5325
5447
|
*/
|
|
5326
|
-
setAmbientEffectScale(scale: number): void;
|
|
5448
|
+
setAmbientEffectScale(displayId: number, scale: number): void;
|
|
5327
5449
|
/**
|
|
5328
5450
|
* Check if ambient effect is currently enabled
|
|
5329
5451
|
*/
|
|
@@ -5350,16 +5472,18 @@ declare class User<TData = Record<string, any>> {
|
|
|
5350
5472
|
* @internal
|
|
5351
5473
|
*/
|
|
5352
5474
|
flushPostProcessCommands(): PostProcessCommand[];
|
|
5353
|
-
/** Current scaling mode */
|
|
5354
|
-
private
|
|
5475
|
+
/** Current scaling mode per display (Map<displayId, mode>) */
|
|
5476
|
+
private currentScalingModes;
|
|
5355
5477
|
/**
|
|
5356
|
-
* Set the pixel-perfect scaling mode
|
|
5478
|
+
* Set the pixel-perfect scaling mode for a specific display
|
|
5357
5479
|
*
|
|
5358
5480
|
* Controls how the terminal canvas is scaled to fit the available space.
|
|
5359
5481
|
* Stricter modes produce crisper pixels but may leave empty space.
|
|
5360
5482
|
*
|
|
5483
|
+
* @param displayId - Display ID (0-255) this setting applies to
|
|
5361
5484
|
* @param mode - Scaling mode:
|
|
5362
5485
|
* - `'none'`: Fill space, may have sub-pixel artifacts (default)
|
|
5486
|
+
* - `'responsive'`: Fixed cell size, cols/rows adapt to fill space
|
|
5363
5487
|
* - `'eighth'`: Snap to 0.125 increments (1.0, 1.125, 1.25...)
|
|
5364
5488
|
* - `'quarter'`: Snap to 0.25 increments (1.0, 1.25, 1.5...)
|
|
5365
5489
|
* - `'half'`: Snap to 0.5 increments (1.0, 1.5, 2.0...)
|
|
@@ -5367,74 +5491,120 @@ declare class User<TData = Record<string, any>> {
|
|
|
5367
5491
|
*
|
|
5368
5492
|
* @example
|
|
5369
5493
|
* ```typescript
|
|
5370
|
-
* // For crisp retro-style pixels
|
|
5371
|
-
* user.setScalingMode('integer');
|
|
5494
|
+
* // For crisp retro-style pixels on display 0
|
|
5495
|
+
* user.setScalingMode(0, 'integer');
|
|
5372
5496
|
*
|
|
5373
|
-
* // For balanced quality
|
|
5374
|
-
* user.setScalingMode('quarter');
|
|
5497
|
+
* // For balanced quality on display 1
|
|
5498
|
+
* user.setScalingMode(1, 'quarter');
|
|
5375
5499
|
*
|
|
5376
|
-
* // Fill all available space
|
|
5377
|
-
* user.setScalingMode('none');
|
|
5500
|
+
* // Fill all available space on display 0
|
|
5501
|
+
* user.setScalingMode(0, 'none');
|
|
5378
5502
|
* ```
|
|
5379
5503
|
*/
|
|
5380
|
-
setScalingMode(mode: ScalingMode): void;
|
|
5504
|
+
setScalingMode(displayId: number, mode: ScalingMode): void;
|
|
5381
5505
|
/**
|
|
5382
|
-
* Get current scaling mode
|
|
5506
|
+
* Get current scaling mode for a display
|
|
5383
5507
|
*
|
|
5508
|
+
* @param displayId - Display ID (0-255)
|
|
5509
|
+
* @param displayId - Display ID (0-255)
|
|
5384
5510
|
* @returns Current scaling mode or null if not set
|
|
5385
5511
|
*/
|
|
5386
|
-
getScalingMode(): ScalingMode | null;
|
|
5387
|
-
/** Current
|
|
5388
|
-
private
|
|
5512
|
+
getScalingMode(displayId: number): ScalingMode | null;
|
|
5513
|
+
/** Current cell size configuration per display (Map<displayId, {width, height}>) */
|
|
5514
|
+
private currentCellSizes;
|
|
5389
5515
|
/**
|
|
5390
|
-
*
|
|
5516
|
+
* Set the cell dimensions in pixels for a specific display (for Responsive mode)
|
|
5517
|
+
*
|
|
5518
|
+
* This is only relevant when using `setScalingMode(displayId, 'responsive')`.
|
|
5519
|
+
* In responsive mode, the cell size is fixed and the number of cols/rows
|
|
5520
|
+
* adapts to fill the available space.
|
|
5521
|
+
*
|
|
5522
|
+
* In other scaling modes (integer, quarter, half, none), the cell size
|
|
5523
|
+
* comes from the font/atlas and CSS scaling is applied to fill space.
|
|
5524
|
+
*
|
|
5525
|
+
* @param displayId - Display ID (0-255) this setting applies to
|
|
5526
|
+
* @param width - Cell width in pixels (1-255, default: 8)
|
|
5527
|
+
* @param height - Cell height in pixels (1-255, default: 8)
|
|
5528
|
+
*
|
|
5529
|
+
* @example
|
|
5530
|
+
* ```typescript
|
|
5531
|
+
* // Responsive mode with 8x8 cells on display 0
|
|
5532
|
+
* user.setScalingMode(0, 'responsive');
|
|
5533
|
+
* user.setCellSize(0, 8, 8);
|
|
5534
|
+
*
|
|
5535
|
+
* // Responsive mode with larger 16x16 tiles on display 1
|
|
5536
|
+
* user.setScalingMode(1, 'responsive');
|
|
5537
|
+
* user.setCellSize(1, 16, 16);
|
|
5538
|
+
* ```
|
|
5539
|
+
*/
|
|
5540
|
+
setCellSize(displayId: number, width: number, height: number): void;
|
|
5541
|
+
/**
|
|
5542
|
+
* Get current cell size for a display
|
|
5543
|
+
*
|
|
5544
|
+
* @param displayId - Display ID (0-255)
|
|
5545
|
+
* @returns Object with cellWidth and cellHeight in pixels, or default 8x8 if not set
|
|
5546
|
+
*/
|
|
5547
|
+
getCellSize(displayId: number): {
|
|
5548
|
+
cellWidth: number;
|
|
5549
|
+
cellHeight: number;
|
|
5550
|
+
};
|
|
5551
|
+
/** Current grid configuration per display (Map<displayId, GridConfig>) */
|
|
5552
|
+
private currentGridConfigs;
|
|
5553
|
+
/**
|
|
5554
|
+
* Enable or configure the debug grid overlay for a specific display
|
|
5391
5555
|
*
|
|
5392
5556
|
* The grid shows cell boundaries aligned with the terminal grid.
|
|
5393
5557
|
* Useful for debugging layout and alignment issues.
|
|
5394
5558
|
*
|
|
5559
|
+
* @param displayId - Display ID (0-255) this setting applies to
|
|
5395
5560
|
* @param config - true to enable with defaults, false to disable,
|
|
5396
5561
|
* or object with color and lineWidth settings
|
|
5397
5562
|
*
|
|
5398
5563
|
* @example
|
|
5399
5564
|
* ```typescript
|
|
5400
|
-
* // Enable with default red grid
|
|
5401
|
-
* user.setGrid(true);
|
|
5565
|
+
* // Enable with default red grid on display 0
|
|
5566
|
+
* user.setGrid(0, true);
|
|
5402
5567
|
*
|
|
5403
|
-
* // Disable
|
|
5404
|
-
* user.setGrid(false);
|
|
5568
|
+
* // Disable on display 0
|
|
5569
|
+
* user.setGrid(0, false);
|
|
5405
5570
|
*
|
|
5406
|
-
* // Custom green grid
|
|
5407
|
-
* user.setGrid({ enabled: true, color: 'rgba(0, 255, 0, 0.5)' });
|
|
5571
|
+
* // Custom green grid on display 1
|
|
5572
|
+
* user.setGrid(1, { enabled: true, color: 'rgba(0, 255, 0, 0.5)' });
|
|
5408
5573
|
*
|
|
5409
|
-
* // Custom with thicker lines
|
|
5410
|
-
* user.setGrid({ enabled: true, color: '#ff0000', lineWidth: 2 });
|
|
5574
|
+
* // Custom with thicker lines on display 0
|
|
5575
|
+
* user.setGrid(0, { enabled: true, color: '#ff0000', lineWidth: 2 });
|
|
5411
5576
|
* ```
|
|
5412
5577
|
*/
|
|
5413
|
-
setGrid(config: boolean | GridConfig): void;
|
|
5578
|
+
setGrid(displayId: number, config: boolean | GridConfig): void;
|
|
5414
5579
|
/**
|
|
5415
|
-
* Enable or disable the grid
|
|
5580
|
+
* Enable or disable the grid for a specific display
|
|
5416
5581
|
*
|
|
5582
|
+
* @param displayId - Display ID (0-255)
|
|
5417
5583
|
* @param enabled - Whether to show the grid
|
|
5418
5584
|
*
|
|
5419
5585
|
* @example
|
|
5420
5586
|
* ```typescript
|
|
5421
|
-
* user.setGridEnabled(true); // Show grid
|
|
5422
|
-
* user.setGridEnabled(false); // Hide grid
|
|
5587
|
+
* user.setGridEnabled(0, true); // Show grid on display 0
|
|
5588
|
+
* user.setGridEnabled(0, false); // Hide grid on display 0
|
|
5423
5589
|
* ```
|
|
5424
5590
|
*/
|
|
5425
|
-
setGridEnabled(enabled: boolean): void;
|
|
5591
|
+
setGridEnabled(displayId: number, enabled: boolean): void;
|
|
5426
5592
|
/**
|
|
5427
|
-
* Check if grid is currently enabled
|
|
5593
|
+
* Check if grid is currently enabled for a display
|
|
5594
|
+
*
|
|
5595
|
+
* @param displayId - Display ID (0-255)
|
|
5428
5596
|
*/
|
|
5429
|
-
isGridEnabled(): boolean;
|
|
5597
|
+
isGridEnabled(displayId: number): boolean;
|
|
5430
5598
|
/**
|
|
5431
|
-
* Get current grid configuration
|
|
5599
|
+
* Get current grid configuration for a display
|
|
5600
|
+
*
|
|
5601
|
+
* @param displayId - Display ID (0-255)
|
|
5432
5602
|
*/
|
|
5433
|
-
getGridConfig(): GridConfig | null;
|
|
5434
|
-
/** Currently active palette slot ID */
|
|
5435
|
-
private
|
|
5603
|
+
getGridConfig(displayId: number): GridConfig | null;
|
|
5604
|
+
/** Currently active palette slot ID per display (Map<displayId, slotId>) */
|
|
5605
|
+
private currentPaletteSlotIds;
|
|
5436
5606
|
/**
|
|
5437
|
-
* Switch to a pre-loaded palette slot
|
|
5607
|
+
* Switch to a pre-loaded palette slot for a specific display
|
|
5438
5608
|
*
|
|
5439
5609
|
* The palette must have been loaded to the Core via `core.loadPaletteToSlot()` first.
|
|
5440
5610
|
* This allows instant palette switching without re-sending palette data over the network.
|
|
@@ -5445,6 +5615,7 @@ declare class User<TData = Record<string, any>> {
|
|
|
5445
5615
|
* - Accessibility options (high contrast)
|
|
5446
5616
|
* - Visual effects (damage flash, power-up)
|
|
5447
5617
|
*
|
|
5618
|
+
* @param displayId - Display ID (0-255) this setting applies to
|
|
5448
5619
|
* @param slotId - Palette slot ID (0-255)
|
|
5449
5620
|
*
|
|
5450
5621
|
* @example
|
|
@@ -5456,24 +5627,24 @@ declare class User<TData = Record<string, any>> {
|
|
|
5456
5627
|
*
|
|
5457
5628
|
* // In IApplication.updateUser() - switch based on game state
|
|
5458
5629
|
* if (gameState.isNight) {
|
|
5459
|
-
* user.switchPalette(1);
|
|
5630
|
+
* user.switchPalette(0, 1); // display 0, night palette
|
|
5460
5631
|
* } else {
|
|
5461
|
-
* user.switchPalette(0);
|
|
5632
|
+
* user.switchPalette(0, 0); // display 0, day palette
|
|
5462
5633
|
* }
|
|
5463
5634
|
*
|
|
5464
|
-
* //
|
|
5465
|
-
*
|
|
5466
|
-
*
|
|
5467
|
-
* }
|
|
5635
|
+
* // Different palettes for different displays (split-screen)
|
|
5636
|
+
* user.switchPalette(0, dayPalette); // Player 1 display
|
|
5637
|
+
* user.switchPalette(1, nightPalette); // Player 2 display
|
|
5468
5638
|
* ```
|
|
5469
5639
|
*/
|
|
5470
|
-
switchPalette(slotId: number): void;
|
|
5640
|
+
switchPalette(displayId: number, slotId: number): void;
|
|
5471
5641
|
/**
|
|
5472
|
-
* Get the currently active palette slot ID
|
|
5642
|
+
* Get the currently active palette slot ID for a display
|
|
5473
5643
|
*
|
|
5644
|
+
* @param displayId - Display ID (0-255)
|
|
5474
5645
|
* @returns The active slot ID, or null if no palette has been switched yet
|
|
5475
5646
|
*/
|
|
5476
|
-
getCurrentPaletteSlotId(): number | null;
|
|
5647
|
+
getCurrentPaletteSlotId(displayId: number): number | null;
|
|
5477
5648
|
/**
|
|
5478
5649
|
* Send data through the bridge channel to the client application
|
|
5479
5650
|
*
|
|
@@ -7880,29 +8051,43 @@ declare function getASCII8x8FontConfig(): {
|
|
|
7880
8051
|
};
|
|
7881
8052
|
|
|
7882
8053
|
/**
|
|
7883
|
-
* CompressedInputPacket - Ultra-compact binary format for inputs (
|
|
8054
|
+
* CompressedInputPacket - Ultra-compact binary format for inputs (V4)
|
|
7884
8055
|
*
|
|
7885
8056
|
* Architecture:
|
|
7886
8057
|
* - CLIENT: Evaluates sources → Compresses → Sends
|
|
7887
8058
|
* - SERVER: Receives → Decompresses → Stores in axes/buttons Maps
|
|
7888
8059
|
*
|
|
7889
|
-
* MINIMALIST Format (
|
|
7890
|
-
*
|
|
7891
|
-
* │ Tick │ Axes │ Buttons │ Mouse │ Flags │ MacroEvents │
|
|
7892
|
-
* │ 8 bytes│ N bytes │ M bytes │ 3 bytes│ 1 byte │ variable │
|
|
7893
|
-
*
|
|
8060
|
+
* MINIMALIST Format (V4):
|
|
8061
|
+
* ┌────────┬───────────┬─────────────┬────────┬──────────┬─────────────┬─────────────┬──────────────────┐
|
|
8062
|
+
* │ Tick │ Axes │ Buttons │ Mouse │ Flags │ TextInputs │ MacroEvents │ DisplayViewports │
|
|
8063
|
+
* │ 8 bytes│ N bytes │ M bytes │ 3 bytes│ 1 byte │ variable │ variable │ 1 + 5×count bytes│
|
|
8064
|
+
* └────────┴───────────┴─────────────┴────────┴──────────┴─────────────┴─────────────┴──────────────────┘
|
|
7894
8065
|
*
|
|
7895
8066
|
* Tick (8 bytes) : Frame number (uint64, little-endian)
|
|
7896
8067
|
* Axes (N bytes) : 1 byte per axis (int8, -127 to +127)
|
|
7897
8068
|
* Buttons (M bytes) : Bitpacking (8 buttons per byte, ⌈ButtonCount/8⌉)
|
|
7898
8069
|
* Mouse (3 bytes) : displayId (1) + mouseX (1) + mouseY (1)
|
|
7899
8070
|
* Flags (1 byte) : Bit 0 = mouseOverDisplay
|
|
8071
|
+
* TextInputs (var) : 1 byte count + length-prefixed UTF-8 strings
|
|
7900
8072
|
* MacroEvents (var) : 1 byte count + encoded events (see MacroEventEncoder)
|
|
8073
|
+
* DisplayViewports (var): 1 byte count + per display: id(1) + pixelWidth(2) + pixelHeight(2)
|
|
7901
8074
|
*
|
|
7902
8075
|
* Note: axisCount and buttonCount are known in advance via InputBindingRegistry
|
|
7903
|
-
* Example: 5 axes + 12 buttons = 8 + 5 + 2 + 3 + 1 = 19 bytes (+ macro
|
|
8076
|
+
* Example: 5 axes + 12 buttons = 8 + 5 + 2 + 3 + 1 = 19 bytes (+ text + macro + viewports)
|
|
7904
8077
|
*/
|
|
7905
8078
|
|
|
8079
|
+
/**
|
|
8080
|
+
* Represents a display viewport available on the client side (in pixels)
|
|
8081
|
+
* Used for responsive display sizing
|
|
8082
|
+
*/
|
|
8083
|
+
interface DisplayViewport {
|
|
8084
|
+
/** Display ID (0-255) */
|
|
8085
|
+
displayId: number;
|
|
8086
|
+
/** Available width in pixels (0-65535) */
|
|
8087
|
+
pixelWidth: number;
|
|
8088
|
+
/** Available height in pixels (0-65535) */
|
|
8089
|
+
pixelHeight: number;
|
|
8090
|
+
}
|
|
7906
8091
|
/**
|
|
7907
8092
|
* Represents a compressed input on the server side (after decoding)
|
|
7908
8093
|
*
|
|
@@ -7912,6 +8097,7 @@ declare function getASCII8x8FontConfig(): {
|
|
|
7912
8097
|
* - Mouse: position + display + flags
|
|
7913
8098
|
* - TextInputs: array of key strings for text input (e.g., ['a', 'Backspace', 'Enter'])
|
|
7914
8099
|
* - MacroEvents: array of macro events (clicks, changes, submits, selects)
|
|
8100
|
+
* - DisplayViewports: array of available viewport sizes in pixels per display
|
|
7915
8101
|
*/
|
|
7916
8102
|
interface CompressedInputPacket {
|
|
7917
8103
|
/** Frame number (tick) - uint64 */
|
|
@@ -7932,6 +8118,8 @@ interface CompressedInputPacket {
|
|
|
7932
8118
|
textInputs: string[];
|
|
7933
8119
|
/** Macro events (clicks, changes, submits, selects) from client-side macros */
|
|
7934
8120
|
macroEvents: AnyMacroEvent[];
|
|
8121
|
+
/** Display viewports available on client side (in pixels) - for responsive display sizing */
|
|
8122
|
+
displayViewports: DisplayViewport[];
|
|
7935
8123
|
}
|
|
7936
8124
|
/**
|
|
7937
8125
|
* Creates an empty CompressedInputPacket
|
|
@@ -8013,7 +8201,7 @@ declare function getCompressedPacketSize(axisCount: number, buttonCount: number)
|
|
|
8013
8201
|
* 2. Client encodes final values in compact binary
|
|
8014
8202
|
* 3. Client sends buffer to server via WebSocket
|
|
8015
8203
|
*
|
|
8016
|
-
* MINIMALIST
|
|
8204
|
+
* MINIMALIST V4 Format (without counts):
|
|
8017
8205
|
* - Tick: uint64 (8 bytes)
|
|
8018
8206
|
* - Axes: float (-1.0 to +1.0) → int8 (-127 to +127) = 1 byte per axis
|
|
8019
8207
|
* - Buttons: boolean → bitpacking = 8 buttons per byte
|
|
@@ -8021,14 +8209,15 @@ declare function getCompressedPacketSize(axisCount: number, buttonCount: number)
|
|
|
8021
8209
|
* - Mouse: mouseX/Y (uint8) + flags = 3 bytes
|
|
8022
8210
|
* - TextInputs: 1 byte count + length-prefixed strings
|
|
8023
8211
|
* - MacroEvents: 1 byte count + encoded events
|
|
8212
|
+
* - DisplayViewports: 1 byte count + per display: id(1) + pixelWidth(2) + pixelHeight(2)
|
|
8024
8213
|
*
|
|
8025
8214
|
* PREREQUISITE: Client and server must have the SAME bindings defined!
|
|
8026
8215
|
*
|
|
8027
|
-
* Example: 5 axes + 12 buttons + mouse = 19 bytes total (+ text inputs + macro events)
|
|
8216
|
+
* Example: 5 axes + 12 buttons + mouse = 19 bytes total (+ text inputs + macro events + viewports)
|
|
8028
8217
|
*/
|
|
8029
8218
|
|
|
8030
8219
|
/**
|
|
8031
|
-
* Encodes inputs in compact binary format
|
|
8220
|
+
* Encodes inputs in compact binary format v4 (CLIENT-SIDE)
|
|
8032
8221
|
*
|
|
8033
8222
|
* @param tick - Frame number (bigint for uint64)
|
|
8034
8223
|
* @param axes - Map of axis values (bindingId → float between -1.0 and +1.0)
|
|
@@ -8039,17 +8228,18 @@ declare function getCompressedPacketSize(axisCount: number, buttonCount: number)
|
|
|
8039
8228
|
* @param mouseOverDisplay - Is the mouse over a display?
|
|
8040
8229
|
* @param textInputs - Array of text input strings
|
|
8041
8230
|
* @param macroEvents - Array of macro events (clicks, changes, submits, selects)
|
|
8231
|
+
* @param displayViewports - Array of display viewports (pixels) that have changed
|
|
8042
8232
|
* @returns Encoded buffer (without counts, minimalist format)
|
|
8043
8233
|
*
|
|
8044
8234
|
* @example
|
|
8045
8235
|
* ```typescript
|
|
8046
8236
|
* const axes = new Map([[0, -0.7], [1, 0.5]]);
|
|
8047
8237
|
* const buttons = new Map([[0, true], [1, false], [2, true]]);
|
|
8048
|
-
* const
|
|
8049
|
-
*
|
|
8238
|
+
* const viewports = [{ displayId: 0, pixelWidth: 800, pixelHeight: 600 }];
|
|
8239
|
+
* const buffer = encodeCompressedInput(42n, axes, buttons, 0, 128, 64, true, [], [], viewports);
|
|
8050
8240
|
* ```
|
|
8051
8241
|
*/
|
|
8052
|
-
declare function encodeCompressedInput(tick: bigint, axes: Map<number, number>, buttons: Map<number, boolean>, displayId: number, mouseX: number, mouseY: number, mouseOverDisplay: boolean, textInputs?: string[], macroEvents?: AnyMacroEvent[]): Uint8Array;
|
|
8242
|
+
declare function encodeCompressedInput(tick: bigint, axes: Map<number, number>, buttons: Map<number, boolean>, displayId: number, mouseX: number, mouseY: number, mouseOverDisplay: boolean, textInputs?: string[], macroEvents?: AnyMacroEvent[], displayViewports?: DisplayViewport[]): Uint8Array;
|
|
8053
8243
|
|
|
8054
8244
|
/**
|
|
8055
8245
|
* CompressedInputDecoder - Decodes inputs from compact binary format
|
|
@@ -8058,10 +8248,10 @@ declare function encodeCompressedInput(tick: bigint, axes: Map<number, number>,
|
|
|
8058
8248
|
*
|
|
8059
8249
|
* Workflow:
|
|
8060
8250
|
* 1. Server receives binary buffer from client via WebSocket
|
|
8061
|
-
* 2. Server decodes values (MINIMALIST
|
|
8251
|
+
* 2. Server decodes values (MINIMALIST V4 format - without counts)
|
|
8062
8252
|
* 3. Server stores in user.axes and user.buttons Maps
|
|
8063
8253
|
*
|
|
8064
|
-
* MINIMALIST
|
|
8254
|
+
* MINIMALIST V4 Format (without counts):
|
|
8065
8255
|
* - PREREQUISITE: Client and server must have the SAME bindings defined!
|
|
8066
8256
|
* - Buffer does NOT contain AxisCount nor ButtonCount
|
|
8067
8257
|
* - Server must pass its registry to know expected structure
|
|
@@ -8072,15 +8262,16 @@ declare function encodeCompressedInput(tick: bigint, axes: Map<number, number>,
|
|
|
8072
8262
|
* - Mouse: uint8 → mouseX/Y + flags (mouseOverDisplay)
|
|
8073
8263
|
* - TextInputs: 1 byte count + length-prefixed strings
|
|
8074
8264
|
* - MacroEvents: 1 byte count + encoded events
|
|
8265
|
+
* - DisplayViewports: 1 byte count + per display: id(1) + pixelWidth(2) + pixelHeight(2)
|
|
8075
8266
|
*
|
|
8076
8267
|
* Example (2 axes, 3 buttons):
|
|
8077
|
-
* - Tick (8) + Axes (2) + Buttons (1) + DisplayId (1) + Mouse (3) = 15 bytes (+ text
|
|
8268
|
+
* - Tick (8) + Axes (2) + Buttons (1) + DisplayId (1) + Mouse (3) = 15 bytes (+ text + macro + viewports)
|
|
8078
8269
|
*/
|
|
8079
8270
|
|
|
8080
8271
|
/**
|
|
8081
|
-
* Decodes a binary buffer to CompressedInputPacket
|
|
8272
|
+
* Decodes a binary buffer to CompressedInputPacket v4 (SERVER-SIDE)
|
|
8082
8273
|
*
|
|
8083
|
-
* MINIMALIST
|
|
8274
|
+
* MINIMALIST v4 format: buffer does NOT contain counters!
|
|
8084
8275
|
* Server MUST pass its registry to know axisCount and buttonCount.
|
|
8085
8276
|
*
|
|
8086
8277
|
* IMPORTANT: Client and server must have the SAME bindings defined
|
|
@@ -8088,7 +8279,7 @@ declare function encodeCompressedInput(tick: bigint, axes: Map<number, number>,
|
|
|
8088
8279
|
*
|
|
8089
8280
|
* @param buffer - Encoded buffer received from client
|
|
8090
8281
|
* @param registry - Server registry to know expected structure
|
|
8091
|
-
* @returns Decoded packet with tick (bigint), axes, buttons, displayId, mouse
|
|
8282
|
+
* @returns Decoded packet with tick (bigint), axes, buttons, displayId, mouse, viewports
|
|
8092
8283
|
*
|
|
8093
8284
|
* @throws Error if buffer is too small or invalid
|
|
8094
8285
|
*
|
|
@@ -8100,6 +8291,7 @@ declare function encodeCompressedInput(tick: bigint, axes: Map<number, number>,
|
|
|
8100
8291
|
* // packet.buttons.get(0) → true
|
|
8101
8292
|
* // packet.displayId → 0
|
|
8102
8293
|
* // packet.mouseOverDisplay → true
|
|
8294
|
+
* // packet.displayViewports → [{ displayId: 0, pixelWidth: 800, pixelHeight: 600 }]
|
|
8103
8295
|
* ```
|
|
8104
8296
|
*/
|
|
8105
8297
|
declare function decodeCompressedInput(buffer: Uint8Array, registry: InputBindingRegistry): CompressedInputPacket;
|
|
@@ -8577,12 +8769,13 @@ declare const AUDIO_RESUME_SOUND_MIN_SIZE = 2;
|
|
|
8577
8769
|
declare const AUDIO_SET_LISTENER_POSITION_SIZE = 5;
|
|
8578
8770
|
declare const AUDIO_CONFIGURE_SPATIAL_SIZE = 5;
|
|
8579
8771
|
declare const AUDIO_SET_SOUND_EFFECTS_MIN_SIZE = 4;
|
|
8580
|
-
declare const POSTPROCESS_SET_CONFIG_MIN_SIZE =
|
|
8581
|
-
declare const POSTPROCESS_SET_SCANLINES_SIZE =
|
|
8582
|
-
declare const POSTPROCESS_SET_AMBIENT_EFFECT_SIZE =
|
|
8583
|
-
declare const POSTPROCESS_SET_SCALING_MODE_SIZE =
|
|
8584
|
-
declare const POSTPROCESS_SET_GRID_SIZE =
|
|
8585
|
-
declare const POSTPROCESS_SWITCH_PALETTE_SIZE =
|
|
8772
|
+
declare const POSTPROCESS_SET_CONFIG_MIN_SIZE = 3;
|
|
8773
|
+
declare const POSTPROCESS_SET_SCANLINES_SIZE = 8;
|
|
8774
|
+
declare const POSTPROCESS_SET_AMBIENT_EFFECT_SIZE = 6;
|
|
8775
|
+
declare const POSTPROCESS_SET_SCALING_MODE_SIZE = 3;
|
|
8776
|
+
declare const POSTPROCESS_SET_GRID_SIZE = 8;
|
|
8777
|
+
declare const POSTPROCESS_SWITCH_PALETTE_SIZE = 3;
|
|
8778
|
+
declare const POSTPROCESS_SET_CELL_SIZE_SIZE = 4;
|
|
8586
8779
|
|
|
8587
8780
|
/**
|
|
8588
8781
|
* UTSP Order Types Enumeration
|
|
@@ -9315,6 +9508,7 @@ declare class PostProcessOrderDecoder {
|
|
|
9315
9508
|
private decodeSetScalingModeOrder;
|
|
9316
9509
|
private decodeSetGridOrder;
|
|
9317
9510
|
private decodeSwitchPaletteOrder;
|
|
9511
|
+
private decodeSetCellSizeOrder;
|
|
9318
9512
|
}
|
|
9319
9513
|
|
|
9320
9514
|
/**
|
|
@@ -9393,11 +9587,15 @@ declare class PostProcessOrderCollector {
|
|
|
9393
9587
|
* Create a SwitchPaletteOrder with given slot ID
|
|
9394
9588
|
*/
|
|
9395
9589
|
private createSwitchPaletteOrder;
|
|
9590
|
+
/**
|
|
9591
|
+
* Create a SetCellSizeOrder with given dimensions
|
|
9592
|
+
*/
|
|
9593
|
+
private createSetCellSizeOrder;
|
|
9396
9594
|
/**
|
|
9397
9595
|
* Parse CSS color string to RGBA components
|
|
9398
9596
|
*/
|
|
9399
9597
|
private parseColor;
|
|
9400
9598
|
}
|
|
9401
9599
|
|
|
9402
|
-
export { ASCII_8X8_FONT, AUDIO_CONFIGURE_SPATIAL_SIZE, AUDIO_FADEOUT_SOUND_MIN_SIZE, AUDIO_PAUSE_SOUND_MIN_SIZE, AUDIO_PLAY_GLOBAL_SOUND_MIN_SIZE, AUDIO_PLAY_SOUND_MIN_SIZE, AUDIO_RESUME_SOUND_MIN_SIZE, AUDIO_SET_LISTENER_POSITION_SIZE, AUDIO_SET_SOUND_EFFECTS_MIN_SIZE, AUDIO_STOP_SOUND_MIN_SIZE, AudioOrderCollector, AudioOrderDecoder, AudioOrderType, AudioTargetType, BITMASK16_ORDER_MIN_SIZE, BITMASK4_ORDER_MIN_SIZE, BITMASK_ORDER_MIN_SIZE, BitmapFont, BitmapFontRegistry, CHAR_ORDER_SIZE, CIRCLE_SHAPE_SIZE, CLEAR_ORDER_SIZE, COLORMAP_ORDER_MIN_SIZE, COLOR_SKIP, CellBuffer, CharCodeBuffer, Core, CoreStats, DISPLAY_HEADER_SIZE, DOTCLOUD_MULTICOLOR_ORDER_MIN_SIZE, DOTCLOUD_ORDER_MIN_SIZE, Display, ELLIPSE_SHAPE_SIZE, FILLCHAR_ORDER_MIN_SIZE, FILLSPRITE_MULTICOLOR_ORDER_SIZE, FILLSPRITE_ORDER_SIZE, FULLFRAME_MULTICOLOR_ORDER_MIN_SIZE, FULLFRAME_ORDER_MIN_SIZE, FontType, GamepadVibrateFlags, ImageFont, ImageFontRegistry, InputBindingRegistry, LAYER_CELL_COUNT, LAYER_HEADER_SIZE, LAYER_SIZE, LINE_SHAPE_SIZE, Layer, LoadType, MacroEngine, MacroEventType, MacroOrderType, MacroRegistry, MobileVibrateFlags, OrderBuilder, OrderType, POLYLINE_ORDER_MIN_SIZE, POSTPROCESS_SET_AMBIENT_EFFECT_SIZE, POSTPROCESS_SET_CONFIG_MIN_SIZE, POSTPROCESS_SET_GRID_SIZE, POSTPROCESS_SET_SCALING_MODE_SIZE, POSTPROCESS_SET_SCANLINES_SIZE, POSTPROCESS_SWITCH_PALETTE_SIZE, PlaySoundFlags, PostProcessOrderCollector, PostProcessOrderDecoder, PostProcessOrderType, RECTANGLE_SHAPE_SIZE, SHAPE_ORDER_MIN_SIZE, SPRITECLOUD_MULTICOLOR_ORDER_MIN_SIZE, SPRITECLOUD_ORDER_MIN_SIZE, SPRITECLOUD_VARIED_MULTICOLOR_ORDER_MIN_SIZE, SPRITECLOUD_VARIED_ORDER_MIN_SIZE, SPRITE_MULTICOLOR_ORDER_SIZE, SPRITE_ORDER_SIZE, SUBFRAME_MULTICOLOR_ORDER_MIN_SIZE, SUBFRAME_ORDER_MIN_SIZE, ShapeType, SoundEffectsFlags, SoundRegistry, SpriteRegistry, TEXT_MULTILINE_ORDER_MIN_SIZE, TEXT_ORDER_MIN_SIZE, TRIANGLE_SHAPE_SIZE, UPDATE_PACKET_HEADER_SIZE, UpdateFlags, UpdateFlagsHelper, UpdatePacketDecoder, User, UserStats, VibrationOrderCollector, VibrationOrderDecoder, VibrationOrderEncoder, VibrationOrderType, WebFont, WebFontRegistry, charCodeByteSize, createASCII8x8FontLoad, createEmptyCompressedInputPacket, decodeCompressedInput, decodeInt8ToAxis, encodeAxisToInt8, encodeCompressedInput, getASCII8x8FontConfig, getAllCharCodes, getAtlasColumns, getAtlasDimensions, getAudioOrderTypeName, getButtonByteCount, getCharBitmap, getCompressedPacketSize, getMacroEventTypeName, getMacroOrderTypeName, getMaxCharCode, getOrderTypeName, hasChar, isValidAudioOrderType, isValidMacroEventType, isValidMacroOrderType, isValidOrderType };
|
|
9403
|
-
export type { AnyAudioOrder, AnyLoad, AnyMacroEvent, AnyMacroOrder, AnyPostProcessOrder, AnyVibrationOrder, AtlasBlocks, AudioOrder, BitmapFontConfig, BitmapFontLoad, Bitmask16Order, Bitmask16Variant, Bitmask4Order, Bitmask4Variant, BitmaskOrder, ButtonBorderStyle, ButtonConfig, ButtonStateColors, Cell, ChangeEvent, CharCodeMode, CircleShape, ClickEvent, Color, ColorPaletteLoad, CompressedInputPacket, ConfigureSpatialOrder, CoreMode, CoreOptions, CreateInstanceConfig, CreateInstanceOrder, EffectMacroTemplate, EffectTransform, EllipseShape, FadeOutSoundOrder, GamepadCancelOrder, GamepadVibrateOrder, GamepadVibrationOrder, GlyphSize, ImageFontConfig, ImageFontLoad, ImageFontOptions, LineMacroTemplate, LineShape, MacroEntry, MacroEvent, MacroInstanceEntry, MacroLoad, MacroOrder, MacroTemplate, MacroTemplateBase, MacroType, MacroUpdateResult, MobileCancelOrder, MobileVibrateOrder, MobileVibrationOrder, MulticolorCell, MulticolorSprite, MulticolorSpriteLoad, NetworkDisplay, NetworkLayer, ParticleConfig, ParticleEmitter, ParticleMacroTemplate, PauseSoundOrder, PlayGlobalSoundOrder, PlaySoundOrder, RectangleShape, RemoveInstanceOrder, RenderCommand, ResumeSoundOrder, RevealCellDef, RevealContent, RevealContentType, RevealCursor, RevealDirection, RevealMacroTemplate, RevealPattern, RevealPause, SelectEvent, SetAmbientEffectOrder, SetConfigOrder, SetGridOrder, SetListenerPositionOrder, SetScalingModeOrder, SetScanlinesOrder, SetSoundEffectsOrder, ShapeData, SoundEntry, SoundLoad, SpriteLoad, StopSoundOrder, SubmitEvent, SwitchPaletteOrder, TickStats, TriangleShape, UIMacroTemplate, UIState, UISubtype, UnicolorSprite, UpdateInstanceOrder, UpdatePacket, UserTickStats, VibrationOrder, WebFontConfig, WebFontLoad };
|
|
9600
|
+
export { ASCII_8X8_FONT, AUDIO_CONFIGURE_SPATIAL_SIZE, AUDIO_FADEOUT_SOUND_MIN_SIZE, AUDIO_PAUSE_SOUND_MIN_SIZE, AUDIO_PLAY_GLOBAL_SOUND_MIN_SIZE, AUDIO_PLAY_SOUND_MIN_SIZE, AUDIO_RESUME_SOUND_MIN_SIZE, AUDIO_SET_LISTENER_POSITION_SIZE, AUDIO_SET_SOUND_EFFECTS_MIN_SIZE, AUDIO_STOP_SOUND_MIN_SIZE, AudioOrderCollector, AudioOrderDecoder, AudioOrderType, AudioTargetType, BITMASK16_ORDER_MIN_SIZE, BITMASK4_ORDER_MIN_SIZE, BITMASK_ORDER_MIN_SIZE, BitmapFont, BitmapFontRegistry, CHAR_ORDER_SIZE, CIRCLE_SHAPE_SIZE, CLEAR_ORDER_SIZE, COLORMAP_ORDER_MIN_SIZE, COLOR_SKIP, CellBuffer, CharCodeBuffer, Core, CoreStats, DISPLAY_HEADER_SIZE, DOTCLOUD_MULTICOLOR_ORDER_MIN_SIZE, DOTCLOUD_ORDER_MIN_SIZE, Display, ELLIPSE_SHAPE_SIZE, FILLCHAR_ORDER_MIN_SIZE, FILLSPRITE_MULTICOLOR_ORDER_SIZE, FILLSPRITE_ORDER_SIZE, FULLFRAME_MULTICOLOR_ORDER_MIN_SIZE, FULLFRAME_ORDER_MIN_SIZE, FontType, GamepadVibrateFlags, ImageFont, ImageFontRegistry, InputBindingRegistry, LAYER_CELL_COUNT, LAYER_HEADER_SIZE, LAYER_SIZE, LINE_SHAPE_SIZE, Layer, LoadType, MacroEngine, MacroEventType, MacroOrderType, MacroRegistry, MobileVibrateFlags, OrderBuilder, OrderType, POLYLINE_ORDER_MIN_SIZE, POSTPROCESS_SET_AMBIENT_EFFECT_SIZE, POSTPROCESS_SET_CELL_SIZE_SIZE, POSTPROCESS_SET_CONFIG_MIN_SIZE, POSTPROCESS_SET_GRID_SIZE, POSTPROCESS_SET_SCALING_MODE_SIZE, POSTPROCESS_SET_SCANLINES_SIZE, POSTPROCESS_SWITCH_PALETTE_SIZE, PlaySoundFlags, PostProcessOrderCollector, PostProcessOrderDecoder, PostProcessOrderType, RECTANGLE_SHAPE_SIZE, SHAPE_ORDER_MIN_SIZE, SPRITECLOUD_MULTICOLOR_ORDER_MIN_SIZE, SPRITECLOUD_ORDER_MIN_SIZE, SPRITECLOUD_VARIED_MULTICOLOR_ORDER_MIN_SIZE, SPRITECLOUD_VARIED_ORDER_MIN_SIZE, SPRITE_MULTICOLOR_ORDER_SIZE, SPRITE_ORDER_SIZE, SUBFRAME_MULTICOLOR_ORDER_MIN_SIZE, SUBFRAME_ORDER_MIN_SIZE, ShapeType, SoundEffectsFlags, SoundRegistry, SpriteRegistry, TEXT_MULTILINE_ORDER_MIN_SIZE, TEXT_ORDER_MIN_SIZE, TRIANGLE_SHAPE_SIZE, UPDATE_PACKET_HEADER_SIZE, UpdateFlags, UpdateFlagsHelper, UpdatePacketDecoder, User, UserStats, VibrationOrderCollector, VibrationOrderDecoder, VibrationOrderEncoder, VibrationOrderType, WebFont, WebFontRegistry, charCodeByteSize, createASCII8x8FontLoad, createEmptyCompressedInputPacket, decodeCompressedInput, decodeInt8ToAxis, encodeAxisToInt8, encodeCompressedInput, getASCII8x8FontConfig, getAllCharCodes, getAtlasColumns, getAtlasDimensions, getAudioOrderTypeName, getButtonByteCount, getCharBitmap, getCompressedPacketSize, getMacroEventTypeName, getMacroOrderTypeName, getMaxCharCode, getOrderTypeName, hasChar, isValidAudioOrderType, isValidMacroEventType, isValidMacroOrderType, isValidOrderType };
|
|
9601
|
+
export type { AnyAudioOrder, AnyLoad, AnyMacroEvent, AnyMacroOrder, AnyPostProcessOrder, AnyVibrationOrder, AtlasBlocks, AudioOrder, BitmapFontConfig, BitmapFontLoad, Bitmask16Order, Bitmask16Variant, Bitmask4Order, Bitmask4Variant, BitmaskOrder, ButtonBorderStyle, ButtonConfig, ButtonStateColors, Cell, ChangeEvent, CharCodeMode, CircleShape, ClickEvent, Color, ColorPaletteLoad, CompressedInputPacket, ConfigureSpatialOrder, CoreMode, CoreOptions, CreateInstanceConfig, CreateInstanceOrder, DisplayViewport, EffectMacroTemplate, EffectTransform, EllipseShape, FadeOutSoundOrder, GamepadCancelOrder, GamepadVibrateOrder, GamepadVibrationOrder, GlyphSize, ImageFontConfig, ImageFontLoad, ImageFontOptions, LineMacroTemplate, LineShape, MacroEntry, MacroEvent, MacroInstanceEntry, MacroLoad, MacroOrder, MacroTemplate, MacroTemplateBase, MacroType, MacroUpdateResult, MobileCancelOrder, MobileVibrateOrder, MobileVibrationOrder, MulticolorCell, MulticolorSprite, MulticolorSpriteLoad, NetworkDisplay, NetworkLayer, ParticleConfig, ParticleEmitter, ParticleMacroTemplate, PauseSoundOrder, PlayGlobalSoundOrder, PlaySoundOrder, RectangleShape, RemoveInstanceOrder, RenderCommand, ResumeSoundOrder, RevealCellDef, RevealContent, RevealContentType, RevealCursor, RevealDirection, RevealMacroTemplate, RevealPattern, RevealPause, SelectEvent, SetAmbientEffectOrder, SetConfigOrder, SetGridOrder, SetListenerPositionOrder, SetScalingModeOrder, SetScanlinesOrder, SetSoundEffectsOrder, ShapeData, SoundEntry, SoundLoad, SpriteLoad, StopSoundOrder, SubmitEvent, SwitchPaletteOrder, TickStats, TriangleShape, UIMacroTemplate, UIState, UISubtype, UnicolorSprite, UpdateInstanceOrder, UpdatePacket, UserTickStats, VibrationOrder, WebFontConfig, WebFontLoad };
|