@utsp/core 0.6.0 → 0.7.0-nightly.20251208110725.8dda911

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _utsp_types from '@utsp/types';
2
- import { Vector2, AxisSource, ButtonSource, InputBindingLoadPacket, AxisBinding, ButtonBinding, SoundInstanceId, AudioConfigCommand, PlaySoundCommand, StopSoundCommand, FadeOutSoundCommand, PauseSoundCommand, ResumeSoundCommand, SetSoundEffectsCommand, IAudioProcessor, AudioAck, SoundFormat, SoundLoadType, SoundLoadPacket, SoundExternalLoadPacket, UserRenderState } from '@utsp/types';
3
- export { AxisBinding, AxisSource, ButtonBinding, ButtonSource, InputBindingLoadPacket, RenderState, RenderedCell, UserRenderState, Vector2 } from '@utsp/types';
2
+ import { ScalingModeValue, Vector2, AxisSource, ButtonSource, InputBindingLoadPacket, AxisBinding, ButtonBinding, SoundInstanceId, AudioConfigCommand, PlaySoundCommand, StopSoundCommand, FadeOutSoundCommand, PauseSoundCommand, ResumeSoundCommand, SetSoundEffectsCommand, IAudioProcessor, AudioAck, PostProcessConfig, PostProcessCommand, ScalingMode, GridConfig, SoundFormat, SoundLoadType, SoundLoadPacket, SoundExternalLoadPacket, UserRenderState } from '@utsp/types';
3
+ export { AxisBinding, AxisSource, ButtonBinding, ButtonSource, InputBindingLoadPacket, RenderState, RenderedCell, ScalingModeValue, UserRenderState, Vector2 } from '@utsp/types';
4
4
 
5
5
  /**
6
6
  * Font system for UTSP Core
@@ -2051,6 +2051,196 @@ interface NetworkLayer {
2051
2051
  orders: AnyNetworkOrder[];
2052
2052
  }
2053
2053
 
2054
+ /**
2055
+ * UTSP Post-Process Order Types Enumeration
2056
+ *
2057
+ * Post-process orders control visual effects like scanlines and ambient effect.
2058
+ * They are included in the UpdatePacket and processed by the renderer.
2059
+ *
2060
+ * This separation ensures:
2061
+ * - Clear distinction between render, audio, and post-process orders
2062
+ * - Independent type numbering
2063
+ * - Perfect frame-level synchronization
2064
+ */
2065
+ declare enum PostProcessOrderType {
2066
+ /**
2067
+ * 0x01 - SetConfig: Set full post-process configuration
2068
+ *
2069
+ * Parameters: flags, scanlines config?, ambient effect config?
2070
+ */
2071
+ SetConfig = 1,
2072
+ /**
2073
+ * 0x02 - SetScanlines: Set scanlines configuration only
2074
+ *
2075
+ * Parameters: enabled, opacity?, pattern?, colorR?, colorG?, colorB?
2076
+ */
2077
+ SetScanlines = 2,
2078
+ /**
2079
+ * 0x03 - SetAmbientEffect: Set ambient effect configuration only
2080
+ *
2081
+ * Parameters: enabled, blur?, scale?, opacity?
2082
+ */
2083
+ SetAmbientEffect = 3,
2084
+ /**
2085
+ * 0x04 - SetScalingMode: Set pixel-perfect scaling mode
2086
+ *
2087
+ * Parameters: mode (ScalingMode enum value)
2088
+ */
2089
+ SetScalingMode = 4,
2090
+ /**
2091
+ * 0x05 - SetGrid: Set debug grid overlay configuration
2092
+ *
2093
+ * Parameters: enabled, colorR?, colorG?, colorB?, colorA?, lineWidth?
2094
+ */
2095
+ SetGrid = 5
2096
+ }
2097
+
2098
+ /**
2099
+ * UTSP Post-Process Order Interfaces
2100
+ *
2101
+ * Defines the data structures for post-process orders sent over the network.
2102
+ * These orders control visual effects like scanlines and ambient effect.
2103
+ */
2104
+
2105
+ /**
2106
+ * Scanlines pattern type (2 bits)
2107
+ */
2108
+ declare enum ScanlinesPatternType {
2109
+ Horizontal = 0,
2110
+ Vertical = 1,
2111
+ Grid = 2
2112
+ }
2113
+ /**
2114
+ * Base interface for all post-process orders
2115
+ */
2116
+ interface PostProcessOrderBase {
2117
+ type: PostProcessOrderType;
2118
+ }
2119
+ /**
2120
+ * SetConfig Order (0x01)
2121
+ *
2122
+ * Sets the full post-process configuration.
2123
+ * Flags indicate which optional sections are present.
2124
+ *
2125
+ * Binary format:
2126
+ * - type: 1 byte (0x01)
2127
+ * - flags: 1 byte (PostProcessConfigFlags)
2128
+ * - [if HasScanlines]:
2129
+ * - enabled: 1 byte (0 or 1)
2130
+ * - opacity: 1 byte (0-255, scaled from 0.0-1.0)
2131
+ * - pattern: 1 byte (ScanlinesPatternType)
2132
+ * - colorR: 1 byte (0-255)
2133
+ * - colorG: 1 byte (0-255)
2134
+ * - colorB: 1 byte (0-255)
2135
+ * - [if HasAmbientEffect]:
2136
+ * - enabled: 1 byte (0 or 1)
2137
+ * - blur: 1 byte (0-255 pixels)
2138
+ * - scale: 1 byte (100-255, scaled from 1.0-2.55)
2139
+ * - opacity: 1 byte (0-255, scaled from 0.0-1.0)
2140
+ */
2141
+ interface SetConfigOrder extends PostProcessOrderBase {
2142
+ type: PostProcessOrderType.SetConfig;
2143
+ flags: number;
2144
+ /** Scanlines config (if HasScanlines flag set) */
2145
+ scanlines?: {
2146
+ enabled: boolean;
2147
+ opacity: number;
2148
+ pattern: ScanlinesPatternType;
2149
+ colorR: number;
2150
+ colorG: number;
2151
+ colorB: number;
2152
+ };
2153
+ /** Ambient effect config (if HasAmbientEffect flag set) */
2154
+ ambientEffect?: {
2155
+ enabled: boolean;
2156
+ blur: number;
2157
+ scale: number;
2158
+ opacity: number;
2159
+ };
2160
+ }
2161
+ /**
2162
+ * SetScanlines Order (0x02)
2163
+ *
2164
+ * Sets only the scanlines configuration.
2165
+ *
2166
+ * Binary format:
2167
+ * - type: 1 byte (0x02)
2168
+ * - enabled: 1 byte (0 or 1)
2169
+ * - opacity: 1 byte (0-255, scaled from 0.0-1.0)
2170
+ * - pattern: 1 byte (ScanlinesPatternType)
2171
+ * - colorR: 1 byte (0-255)
2172
+ * - colorG: 1 byte (0-255)
2173
+ * - colorB: 1 byte (0-255)
2174
+ */
2175
+ interface SetScanlinesOrder extends PostProcessOrderBase {
2176
+ type: PostProcessOrderType.SetScanlines;
2177
+ enabled: boolean;
2178
+ opacity: number;
2179
+ pattern: ScanlinesPatternType;
2180
+ colorR: number;
2181
+ colorG: number;
2182
+ colorB: number;
2183
+ }
2184
+ /**
2185
+ * SetAmbientEffect Order (0x03)
2186
+ *
2187
+ * Sets only the ambient effect configuration.
2188
+ *
2189
+ * Binary format:
2190
+ * - type: 1 byte (0x03)
2191
+ * - enabled: 1 byte (0 or 1)
2192
+ * - blur: 1 byte (0-255 pixels)
2193
+ * - scale: 1 byte (100-255, scaled from 1.0-2.55)
2194
+ * - opacity: 1 byte (0-255, scaled from 0.0-1.0)
2195
+ */
2196
+ interface SetAmbientEffectOrder extends PostProcessOrderBase {
2197
+ type: PostProcessOrderType.SetAmbientEffect;
2198
+ enabled: boolean;
2199
+ blur: number;
2200
+ scale: number;
2201
+ opacity: number;
2202
+ }
2203
+ /**
2204
+ * SetScalingMode Order (0x04)
2205
+ *
2206
+ * Sets the pixel-perfect scaling mode.
2207
+ *
2208
+ * Binary format:
2209
+ * - type: 1 byte (0x04)
2210
+ * - mode: 1 byte (ScalingModeValue)
2211
+ */
2212
+ interface SetScalingModeOrder extends PostProcessOrderBase {
2213
+ type: PostProcessOrderType.SetScalingMode;
2214
+ mode: ScalingModeValue;
2215
+ }
2216
+ /**
2217
+ * SetGrid Order (0x05)
2218
+ *
2219
+ * Sets the debug grid overlay configuration.
2220
+ *
2221
+ * Binary format:
2222
+ * - type: 1 byte (0x05)
2223
+ * - enabled: 1 byte (0 or 1)
2224
+ * - colorR: 1 byte (0-255)
2225
+ * - colorG: 1 byte (0-255)
2226
+ * - colorB: 1 byte (0-255)
2227
+ * - colorA: 1 byte (0-255, alpha as 0-255)
2228
+ * - lineWidth: 1 byte (1-10 pixels)
2229
+ */
2230
+ interface SetGridOrder extends PostProcessOrderBase {
2231
+ type: PostProcessOrderType.SetGrid;
2232
+ enabled: boolean;
2233
+ colorR: number;
2234
+ colorG: number;
2235
+ colorB: number;
2236
+ colorA: number;
2237
+ lineWidth: number;
2238
+ }
2239
+ /**
2240
+ * Union type for all post-process orders
2241
+ */
2242
+ type AnyPostProcessOrder = SetConfigOrder | SetScanlinesOrder | SetAmbientEffectOrder | SetScalingModeOrder | SetGridOrder;
2243
+
2054
2244
  /**
2055
2245
  * Update packet according to the new UTSP protocol
2056
2246
  *
@@ -2060,9 +2250,10 @@ interface NetworkLayer {
2060
2250
  * - Layers: Render orders for visual output
2061
2251
  * - Audio Orders: Audio commands synchronized with the frame
2062
2252
  * - Macro Orders: Macro instance commands (create, update, remove)
2253
+ * - PostProcess Orders: Visual effects commands (scanlines, ambient effect)
2063
2254
  *
2064
- * Audio orders are in the same packet as render orders to ensure
2065
- * perfect frame-level synchronization between visuals and sound.
2255
+ * Audio and PostProcess orders are in the same packet as render orders to ensure
2256
+ * perfect frame-level synchronization between visuals, sound, and effects.
2066
2257
  */
2067
2258
  interface UpdatePacket {
2068
2259
  /** Tick counter (8 bytes) */
@@ -2083,6 +2274,10 @@ interface UpdatePacket {
2083
2274
  macroOrderCount: number;
2084
2275
  /** List of macro orders (create, update, remove instances) */
2085
2276
  macroOrders: AnyMacroOrder[];
2277
+ /** Number of post-process orders (1 byte) */
2278
+ postProcessOrderCount: number;
2279
+ /** List of post-process orders (scanlines, ambient effect) */
2280
+ postProcessOrders: AnyPostProcessOrder[];
2086
2281
  }
2087
2282
 
2088
2283
  /**
@@ -2914,6 +3109,8 @@ declare class User<TData = Record<string, any>> {
2914
3109
  private macroRegistry;
2915
3110
  private macroEngine;
2916
3111
  private macroEventHandlers;
3112
+ private postProcessCommands;
3113
+ private currentPostProcessConfig;
2917
3114
  /**
2918
3115
  * Application-specific data storage
2919
3116
  * Use this to store game state, player data, or any custom information
@@ -4183,6 +4380,231 @@ declare class User<TData = Record<string, any>> {
4183
4380
  * Activate the currently focused macro element
4184
4381
  */
4185
4382
  macroActivateFocused(): void;
4383
+ /**
4384
+ * Set post-processing configuration
4385
+ *
4386
+ * The post-process overlay is rendered ONCE when this is called.
4387
+ * No per-frame cost - only updates when you call this method.
4388
+ *
4389
+ * @param config - Post-processing configuration (or null to disable)
4390
+ *
4391
+ * @example
4392
+ * ```typescript
4393
+ * // Enable scanlines effect
4394
+ * user.setPostProcess({
4395
+ * scanlines: {
4396
+ * enabled: true,
4397
+ * opacity: 0.15,
4398
+ * pattern: 'horizontal'
4399
+ * }
4400
+ * });
4401
+ *
4402
+ * // Disable all post-processing
4403
+ * user.setPostProcess(null);
4404
+ * ```
4405
+ */
4406
+ setPostProcess(config: PostProcessConfig | null): void;
4407
+ /**
4408
+ * Enable or disable scanlines effect with default/current settings
4409
+ *
4410
+ * @param enabled - Whether to enable scanlines
4411
+ *
4412
+ * @example
4413
+ * ```typescript
4414
+ * user.setScanlinesEnabled(true); // Enable with defaults
4415
+ * user.setScanlinesEnabled(false); // Disable
4416
+ * ```
4417
+ */
4418
+ setScanlinesEnabled(enabled: boolean): void;
4419
+ /**
4420
+ * Set scanlines opacity (0-1)
4421
+ *
4422
+ * Also enables scanlines if not already enabled.
4423
+ *
4424
+ * @param opacity - Opacity of dark lines (0 = invisible, 1 = fully opaque)
4425
+ *
4426
+ * @example
4427
+ * ```typescript
4428
+ * user.setScanlinesOpacity(0.2); // Subtle effect
4429
+ * user.setScanlinesOpacity(0.5); // Strong effect
4430
+ * ```
4431
+ */
4432
+ setScanlinesOpacity(opacity: number): void;
4433
+ /**
4434
+ * Set scanlines pattern
4435
+ *
4436
+ * @param pattern - Pattern type: 'horizontal', 'vertical', or 'grid'
4437
+ */
4438
+ setScanlinesPattern(pattern: 'horizontal' | 'vertical' | 'grid'): void;
4439
+ /**
4440
+ * Enable or configure ambient effect
4441
+ *
4442
+ * Ambient effect creates a blurred glow around the terminal canvas,
4443
+ * filling the unused space with colors from the terminal content.
4444
+ * This effect is GPU-accelerated (CSS blur) and has zero CPU cost.
4445
+ *
4446
+ * @param config - true to enable with defaults, false to disable,
4447
+ * or object with blur and scale settings
4448
+ *
4449
+ * @example
4450
+ * ```typescript
4451
+ * // Enable with defaults (blur: 30px, scale: 1.3)
4452
+ * user.setAmbientEffect(true);
4453
+ *
4454
+ * // Disable
4455
+ * user.setAmbientEffect(false);
4456
+ *
4457
+ * // Custom settings
4458
+ * user.setAmbientEffect({ blur: 50, scale: 1.5 });
4459
+ * ```
4460
+ */
4461
+ setAmbientEffect(config: boolean | {
4462
+ blur?: number;
4463
+ scale?: number;
4464
+ }): void;
4465
+ /**
4466
+ * Enable or disable ambient effect
4467
+ *
4468
+ * @param enabled - Whether to enable ambient effect
4469
+ *
4470
+ * @example
4471
+ * ```typescript
4472
+ * user.setAmbientEffectEnabled(true); // Enable with defaults
4473
+ * user.setAmbientEffectEnabled(false); // Disable
4474
+ * ```
4475
+ */
4476
+ setAmbientEffectEnabled(enabled: boolean): void;
4477
+ /**
4478
+ * Set ambient effect blur intensity
4479
+ *
4480
+ * @param blur - Blur intensity in pixels (default: 30)
4481
+ *
4482
+ * @example
4483
+ * ```typescript
4484
+ * user.setAmbientEffectBlur(50); // More blur
4485
+ * user.setAmbientEffectBlur(15); // Less blur
4486
+ * ```
4487
+ */
4488
+ setAmbientEffectBlur(blur: number): void;
4489
+ /**
4490
+ * Set ambient effect scale factor
4491
+ *
4492
+ * @param scale - Scale factor for the glow (default: 1.3)
4493
+ *
4494
+ * @example
4495
+ * ```typescript
4496
+ * user.setAmbientEffectScale(1.5); // Larger glow area
4497
+ * user.setAmbientEffectScale(1.1); // Smaller glow area
4498
+ * ```
4499
+ */
4500
+ setAmbientEffectScale(scale: number): void;
4501
+ /**
4502
+ * Check if ambient effect is currently enabled
4503
+ */
4504
+ isAmbientEffectEnabled(): boolean;
4505
+ /**
4506
+ * Get current ambient effect configuration
4507
+ */
4508
+ getAmbientEffectConfig(): {
4509
+ enabled: boolean;
4510
+ blur: number;
4511
+ scale: number;
4512
+ } | null;
4513
+ /**
4514
+ * Get current post-process configuration
4515
+ */
4516
+ getPostProcessConfig(): PostProcessConfig | null;
4517
+ /**
4518
+ * Check if there are pending post-process commands
4519
+ * @internal
4520
+ */
4521
+ hasPostProcessCommands(): boolean;
4522
+ /**
4523
+ * Flush post-process commands (returns and clears the queue)
4524
+ * @internal
4525
+ */
4526
+ flushPostProcessCommands(): PostProcessCommand[];
4527
+ /** Current scaling mode */
4528
+ private currentScalingMode;
4529
+ /**
4530
+ * Set the pixel-perfect scaling mode
4531
+ *
4532
+ * Controls how the terminal canvas is scaled to fit the available space.
4533
+ * Stricter modes produce crisper pixels but may leave empty space.
4534
+ *
4535
+ * @param mode - Scaling mode:
4536
+ * - `'none'`: Fill space, may have sub-pixel artifacts (default)
4537
+ * - `'eighth'`: Snap to 0.125 increments (1.0, 1.125, 1.25...)
4538
+ * - `'quarter'`: Snap to 0.25 increments (1.0, 1.25, 1.5...)
4539
+ * - `'half'`: Snap to 0.5 increments (1.0, 1.5, 2.0...)
4540
+ * - `'integer'`: Crisp pixels, integer scaling only (1x, 2x, 3x...)
4541
+ *
4542
+ * @example
4543
+ * ```typescript
4544
+ * // For crisp retro-style pixels
4545
+ * user.setScalingMode('integer');
4546
+ *
4547
+ * // For balanced quality
4548
+ * user.setScalingMode('quarter');
4549
+ *
4550
+ * // Fill all available space
4551
+ * user.setScalingMode('none');
4552
+ * ```
4553
+ */
4554
+ setScalingMode(mode: ScalingMode): void;
4555
+ /**
4556
+ * Get current scaling mode
4557
+ *
4558
+ * @returns Current scaling mode or null if not set
4559
+ */
4560
+ getScalingMode(): ScalingMode | null;
4561
+ /** Current grid configuration */
4562
+ private currentGridConfig;
4563
+ /**
4564
+ * Enable or configure the debug grid overlay
4565
+ *
4566
+ * The grid shows cell boundaries aligned with the terminal grid.
4567
+ * Useful for debugging layout and alignment issues.
4568
+ *
4569
+ * @param config - true to enable with defaults, false to disable,
4570
+ * or object with color and lineWidth settings
4571
+ *
4572
+ * @example
4573
+ * ```typescript
4574
+ * // Enable with default red grid
4575
+ * user.setGrid(true);
4576
+ *
4577
+ * // Disable
4578
+ * user.setGrid(false);
4579
+ *
4580
+ * // Custom green grid
4581
+ * user.setGrid({ enabled: true, color: 'rgba(0, 255, 0, 0.5)' });
4582
+ *
4583
+ * // Custom with thicker lines
4584
+ * user.setGrid({ enabled: true, color: '#ff0000', lineWidth: 2 });
4585
+ * ```
4586
+ */
4587
+ setGrid(config: boolean | GridConfig): void;
4588
+ /**
4589
+ * Enable or disable the grid
4590
+ *
4591
+ * @param enabled - Whether to show the grid
4592
+ *
4593
+ * @example
4594
+ * ```typescript
4595
+ * user.setGridEnabled(true); // Show grid
4596
+ * user.setGridEnabled(false); // Hide grid
4597
+ * ```
4598
+ */
4599
+ setGridEnabled(enabled: boolean): void;
4600
+ /**
4601
+ * Check if grid is currently enabled
4602
+ */
4603
+ isGridEnabled(): boolean;
4604
+ /**
4605
+ * Get current grid configuration
4606
+ */
4607
+ getGridConfig(): GridConfig | null;
4186
4608
  }
4187
4609
 
4188
4610
  /**
@@ -4659,6 +5081,7 @@ declare class Core {
4659
5081
  private bitmapFontRegistry;
4660
5082
  private soundRegistry;
4661
5083
  private audioOrderCollector;
5084
+ private postProcessOrderCollector;
4662
5085
  private activeWebFontId;
4663
5086
  private _renderCallCount;
4664
5087
  private onPaletteChangedCallback?;
@@ -5233,11 +5656,14 @@ declare class Core {
5233
5656
  * ```typescript
5234
5657
  * // Simplified version for runtime
5235
5658
  * websocket.on('update', (buffer: Uint8Array) => {
5236
- * core.applyUpdatePacketBuffer('user1', buffer);
5659
+ * const packet = core.applyUpdatePacketBuffer('user1', buffer);
5660
+ * if (packet) {
5661
+ * // Handle post-process orders, etc.
5662
+ * }
5237
5663
  * });
5238
5664
  * ```
5239
5665
  */
5240
- applyUpdatePacketBuffer(userId: string, buffer: Uint8Array): boolean;
5666
+ applyUpdatePacketBuffer(userId: string, buffer: Uint8Array): UpdatePacket | null;
5241
5667
  /**
5242
5668
  * Applies a LoadPacket received from the server (CLIENT-SIDE)
5243
5669
  *
@@ -6853,6 +7279,11 @@ declare const AUDIO_RESUME_SOUND_MIN_SIZE = 2;
6853
7279
  declare const AUDIO_SET_LISTENER_POSITION_SIZE = 5;
6854
7280
  declare const AUDIO_CONFIGURE_SPATIAL_SIZE = 5;
6855
7281
  declare const AUDIO_SET_SOUND_EFFECTS_MIN_SIZE = 4;
7282
+ declare const POSTPROCESS_SET_CONFIG_MIN_SIZE = 2;
7283
+ declare const POSTPROCESS_SET_SCANLINES_SIZE = 7;
7284
+ declare const POSTPROCESS_SET_AMBIENT_EFFECT_SIZE = 5;
7285
+ declare const POSTPROCESS_SET_SCALING_MODE_SIZE = 2;
7286
+ declare const POSTPROCESS_SET_GRID_SIZE = 7;
6856
7287
 
6857
7288
  /**
6858
7289
  * UTSP Order Types Enumeration
@@ -7164,6 +7595,7 @@ declare class UpdatePacketDecoder {
7164
7595
  private layerDecoder;
7165
7596
  private audioOrderDecoder;
7166
7597
  private macroOrderDecoder;
7598
+ private postProcessOrderDecoder;
7167
7599
  constructor();
7168
7600
  /**
7169
7601
  * Decodes an UpdatePacket from binary buffer
@@ -7178,8 +7610,10 @@ declare class UpdatePacketDecoder {
7178
7610
  * - AudioOrders: variable (encoded audio orders)
7179
7611
  * - MacroOrderCount: 1 byte (max 255 macro orders)
7180
7612
  * - MacroOrders: variable (encoded macro orders)
7613
+ * - PostProcessOrderCount: 1 byte (max 255 post-process orders)
7614
+ * - PostProcessOrders: variable (encoded post-process orders)
7181
7615
  *
7182
- * Minimum packet size: 13 bytes (Tick + DisplayCount + LayerCount + AudioOrderCount + MacroOrderCount)
7616
+ * Minimum packet size: 14 bytes (Tick + DisplayCount + LayerCount + AudioOrderCount + MacroOrderCount + PostProcessOrderCount)
7183
7617
  */
7184
7618
  decode(data: Uint8Array, offset?: number): UpdatePacket;
7185
7619
  /**
@@ -7442,5 +7876,110 @@ declare class AudioOrderCollector {
7442
7876
  private encodeReverb;
7443
7877
  }
7444
7878
 
7445
- 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, InputBindingRegistry, LAYER_CELL_COUNT, LAYER_HEADER_SIZE, LAYER_SIZE, LINE_SHAPE_SIZE, Layer, LoadType, MacroEngine, MacroEventType, MacroOrderType, MacroRegistry, OrderBuilder, OrderType, POLYLINE_ORDER_MIN_SIZE, PlaySoundFlags, 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, TRIGGERGLOBALSOUND_ORDER_SIZE, TRIGGERSOUND_ORDER_SIZE, UPDATE_PACKET_HEADER_SIZE, UpdateFlags, UpdateFlagsHelper, UpdatePacketDecoder, User, UserStats, WebFont, WebFontRegistry, createASCII8x8FontLoad, createEmptyCompressedInputPacket, decodeCompressedInput, decodeInt8ToAxis, encodeAxisToInt8, encodeCompressedInput, getASCII8x8FontConfig, getAllCharCodes, getAudioOrderTypeName, getButtonByteCount, getCharBitmap, getCompressedPacketSize, getMacroEventTypeName, getMacroOrderTypeName, getOrderTypeName, hasChar, isValidAudioOrderType, isValidMacroEventType, isValidMacroOrderType, isValidOrderType };
7446
- export type { AnyAudioOrder, AnyLoad, AnyMacroEvent, AnyMacroOrder, AudioOrder, BitmapFontConfig, BitmapFontLoad, Bitmask16Order, Bitmask16Variant, Bitmask4Order, Bitmask4Variant, BitmaskOrder, ButtonBorderStyle, ButtonConfig, ButtonStateColors, Cell, ChangeEvent, CircleShape, ClickEvent, Color, ColorPaletteLoad, CompressedInputPacket, ConfigureSpatialOrder, CoreMode, CoreOptions, CreateInstanceConfig, CreateInstanceOrder, EffectMacroTemplate, EffectTransform, EllipseShape, FadeOutSoundOrder, LineMacroTemplate, LineShape, MacroEntry, MacroEvent, MacroInstanceEntry, MacroLoad, MacroOrder, MacroTemplate, MacroTemplateBase, MacroType, MacroUpdateResult, MulticolorCell, MulticolorSprite, MulticolorSpriteLoad, NetworkDisplay, NetworkLayer, ParticleConfig, ParticleEmitter, ParticleMacroTemplate, PauseSoundOrder, PlayGlobalSoundOrder, PlaySoundOrder, RectangleShape, RemoveInstanceOrder, RenderCommand, ResumeSoundOrder, RevealCellDef, RevealContent, RevealContentType, RevealCursor, RevealDirection, RevealMacroTemplate, RevealPattern, RevealPause, SelectEvent, SetListenerPositionOrder, SetSoundEffectsOrder, ShapeData, SoundEntry, SoundLoad, SpriteLoad, StopSoundOrder, SubmitEvent, TickStats, TriangleShape, UIMacroTemplate, UIState, UISubtype, UnicolorSprite, UpdateInstanceOrder, UpdatePacket, UserTickStats, WebFontConfig, WebFontLoad };
7879
+ /**
7880
+ * UTSP Post-Process Order Decoder
7881
+ *
7882
+ * Decodes binary post-process orders received over the network.
7883
+ * Post-process orders control visual effects like scanlines and ambient effect.
7884
+ */
7885
+
7886
+ /**
7887
+ * Decoder for UTSP post-process orders
7888
+ * Converts binary buffers to post-process order interfaces
7889
+ */
7890
+ declare class PostProcessOrderDecoder {
7891
+ /**
7892
+ * Main entry point - decodes a post-process order from buffer
7893
+ * Returns the decoded order and bytes consumed
7894
+ */
7895
+ decode(buffer: Uint8Array, offset: number): {
7896
+ order: AnyPostProcessOrder;
7897
+ bytesRead: number;
7898
+ };
7899
+ private decodeSetConfigOrder;
7900
+ private decodeSetScanlinesOrder;
7901
+ private decodeSetAmbientEffectOrder;
7902
+ private decodeSetScalingModeOrder;
7903
+ private decodeSetGridOrder;
7904
+ }
7905
+
7906
+ /**
7907
+ * PostProcessOrderCollector - Converts high-level post-process commands to binary PostProcessOrders
7908
+ *
7909
+ * This class bridges the gap between the User's high-level post-process API
7910
+ * (setPostProcess, setAmbientEffect, etc.) and the binary PostProcessOrder protocol.
7911
+ *
7912
+ * It converts PostProcessCommands to PostProcessOrders ready for binary encoding in UpdatePacket.
7913
+ *
7914
+ * @example
7915
+ * ```typescript
7916
+ * const collector = new PostProcessOrderCollector();
7917
+ *
7918
+ * // Convert User's pending commands to orders
7919
+ * const postProcessOrders = collector.collectFromUser(user);
7920
+ *
7921
+ * // postProcessOrders can now be added to UpdatePacket
7922
+ * ```
7923
+ */
7924
+
7925
+ /**
7926
+ * Collects and converts post-process commands to binary PostProcessOrders
7927
+ */
7928
+ declare class PostProcessOrderCollector {
7929
+ /**
7930
+ * Collect all pending post-process orders from a user
7931
+ *
7932
+ * This flushes the user's post-process command queue,
7933
+ * converts them to binary PostProcessOrders, and returns them.
7934
+ *
7935
+ * @param user - The user to collect orders from
7936
+ * @returns Array of PostProcessOrders ready for encoding
7937
+ */
7938
+ collectFromUser(user: User): AnyPostProcessOrder[];
7939
+ /**
7940
+ * Convert an array of post-process commands to PostProcessOrders
7941
+ *
7942
+ * This is the core conversion logic used by both:
7943
+ * - Server: collectFromUser() → encode → network
7944
+ * - Local: convertCommands() → applyPostProcessOrders() (no encoding)
7945
+ *
7946
+ * @param commands - Array of PostProcessCommands to convert
7947
+ * @returns Array of PostProcessOrders
7948
+ */
7949
+ convertCommands(commands: PostProcessCommand[]): AnyPostProcessOrder[];
7950
+ /**
7951
+ * Convert a post-process command to a PostProcessOrder
7952
+ */
7953
+ private convertCommand;
7954
+ /**
7955
+ * Convert a full set-config command to a SetConfigOrder
7956
+ */
7957
+ private convertSetConfig;
7958
+ /**
7959
+ * Create a SetScanlinesOrder with given parameters
7960
+ */
7961
+ private createSetScanlinesOrder;
7962
+ /**
7963
+ * Create a SetAmbientEffectOrder with given parameters
7964
+ */
7965
+ private createSetAmbientEffectOrder;
7966
+ /**
7967
+ * Convert pattern string to ScanlinesPatternType
7968
+ */
7969
+ private patternToType;
7970
+ /**
7971
+ * Create a SetScalingModeOrder with given scaling mode
7972
+ */
7973
+ private createSetScalingModeOrder;
7974
+ /**
7975
+ * Create a SetGridOrder with given grid configuration
7976
+ */
7977
+ private createSetGridOrder;
7978
+ /**
7979
+ * Parse CSS color string to RGBA components
7980
+ */
7981
+ private parseColor;
7982
+ }
7983
+
7984
+ 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, InputBindingRegistry, LAYER_CELL_COUNT, LAYER_HEADER_SIZE, LAYER_SIZE, LINE_SHAPE_SIZE, Layer, LoadType, MacroEngine, MacroEventType, MacroOrderType, MacroRegistry, 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, 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, TRIGGERGLOBALSOUND_ORDER_SIZE, TRIGGERSOUND_ORDER_SIZE, UPDATE_PACKET_HEADER_SIZE, UpdateFlags, UpdateFlagsHelper, UpdatePacketDecoder, User, UserStats, WebFont, WebFontRegistry, createASCII8x8FontLoad, createEmptyCompressedInputPacket, decodeCompressedInput, decodeInt8ToAxis, encodeAxisToInt8, encodeCompressedInput, getASCII8x8FontConfig, getAllCharCodes, getAudioOrderTypeName, getButtonByteCount, getCharBitmap, getCompressedPacketSize, getMacroEventTypeName, getMacroOrderTypeName, getOrderTypeName, hasChar, isValidAudioOrderType, isValidMacroEventType, isValidMacroOrderType, isValidOrderType };
7985
+ export type { AnyAudioOrder, AnyLoad, AnyMacroEvent, AnyMacroOrder, AnyPostProcessOrder, AudioOrder, BitmapFontConfig, BitmapFontLoad, Bitmask16Order, Bitmask16Variant, Bitmask4Order, Bitmask4Variant, BitmaskOrder, ButtonBorderStyle, ButtonConfig, ButtonStateColors, Cell, ChangeEvent, CircleShape, ClickEvent, Color, ColorPaletteLoad, CompressedInputPacket, ConfigureSpatialOrder, CoreMode, CoreOptions, CreateInstanceConfig, CreateInstanceOrder, EffectMacroTemplate, EffectTransform, EllipseShape, FadeOutSoundOrder, LineMacroTemplate, LineShape, MacroEntry, MacroEvent, MacroInstanceEntry, MacroLoad, MacroOrder, MacroTemplate, MacroTemplateBase, MacroType, MacroUpdateResult, 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, TickStats, TriangleShape, UIMacroTemplate, UIState, UISubtype, UnicolorSprite, UpdateInstanceOrder, UpdatePacket, UserTickStats, WebFontConfig, WebFontLoad };