@utsp/core 0.7.0-nightly.20251207021518.b0c5521 → 0.7.0-nightly.20251208141647.137af20
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.cjs +5 -5
- package/dist/index.d.ts +555 -9
- package/dist/index.mjs +5 -5
- package/package.json +2 -2
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
|
|
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
|
|
@@ -4140,6 +4337,13 @@ declare class User<TData = Record<string, any>> {
|
|
|
4140
4337
|
* @returns Update result with events and sounds to play
|
|
4141
4338
|
*/
|
|
4142
4339
|
updateMacros(): MacroUpdateResult;
|
|
4340
|
+
/**
|
|
4341
|
+
* Process macro events from MacroUpdateResult
|
|
4342
|
+
* Dispatches events to registered handlers (used in standalone mode)
|
|
4343
|
+
*
|
|
4344
|
+
* @param result - The result from updateMacros()
|
|
4345
|
+
*/
|
|
4346
|
+
processMacroEvents(result: MacroUpdateResult): void;
|
|
4143
4347
|
/**
|
|
4144
4348
|
* Update mouse state for the macro engine
|
|
4145
4349
|
* Converts display-local coordinates to world coordinates using the display's origin
|
|
@@ -4183,6 +4387,231 @@ declare class User<TData = Record<string, any>> {
|
|
|
4183
4387
|
* Activate the currently focused macro element
|
|
4184
4388
|
*/
|
|
4185
4389
|
macroActivateFocused(): void;
|
|
4390
|
+
/**
|
|
4391
|
+
* Set post-processing configuration
|
|
4392
|
+
*
|
|
4393
|
+
* The post-process overlay is rendered ONCE when this is called.
|
|
4394
|
+
* No per-frame cost - only updates when you call this method.
|
|
4395
|
+
*
|
|
4396
|
+
* @param config - Post-processing configuration (or null to disable)
|
|
4397
|
+
*
|
|
4398
|
+
* @example
|
|
4399
|
+
* ```typescript
|
|
4400
|
+
* // Enable scanlines effect
|
|
4401
|
+
* user.setPostProcess({
|
|
4402
|
+
* scanlines: {
|
|
4403
|
+
* enabled: true,
|
|
4404
|
+
* opacity: 0.15,
|
|
4405
|
+
* pattern: 'horizontal'
|
|
4406
|
+
* }
|
|
4407
|
+
* });
|
|
4408
|
+
*
|
|
4409
|
+
* // Disable all post-processing
|
|
4410
|
+
* user.setPostProcess(null);
|
|
4411
|
+
* ```
|
|
4412
|
+
*/
|
|
4413
|
+
setPostProcess(config: PostProcessConfig | null): void;
|
|
4414
|
+
/**
|
|
4415
|
+
* Enable or disable scanlines effect with default/current settings
|
|
4416
|
+
*
|
|
4417
|
+
* @param enabled - Whether to enable scanlines
|
|
4418
|
+
*
|
|
4419
|
+
* @example
|
|
4420
|
+
* ```typescript
|
|
4421
|
+
* user.setScanlinesEnabled(true); // Enable with defaults
|
|
4422
|
+
* user.setScanlinesEnabled(false); // Disable
|
|
4423
|
+
* ```
|
|
4424
|
+
*/
|
|
4425
|
+
setScanlinesEnabled(enabled: boolean): void;
|
|
4426
|
+
/**
|
|
4427
|
+
* Set scanlines opacity (0-1)
|
|
4428
|
+
*
|
|
4429
|
+
* Also enables scanlines if not already enabled.
|
|
4430
|
+
*
|
|
4431
|
+
* @param opacity - Opacity of dark lines (0 = invisible, 1 = fully opaque)
|
|
4432
|
+
*
|
|
4433
|
+
* @example
|
|
4434
|
+
* ```typescript
|
|
4435
|
+
* user.setScanlinesOpacity(0.2); // Subtle effect
|
|
4436
|
+
* user.setScanlinesOpacity(0.5); // Strong effect
|
|
4437
|
+
* ```
|
|
4438
|
+
*/
|
|
4439
|
+
setScanlinesOpacity(opacity: number): void;
|
|
4440
|
+
/**
|
|
4441
|
+
* Set scanlines pattern
|
|
4442
|
+
*
|
|
4443
|
+
* @param pattern - Pattern type: 'horizontal', 'vertical', or 'grid'
|
|
4444
|
+
*/
|
|
4445
|
+
setScanlinesPattern(pattern: 'horizontal' | 'vertical' | 'grid'): void;
|
|
4446
|
+
/**
|
|
4447
|
+
* Enable or configure ambient effect
|
|
4448
|
+
*
|
|
4449
|
+
* Ambient effect creates a blurred glow around the terminal canvas,
|
|
4450
|
+
* filling the unused space with colors from the terminal content.
|
|
4451
|
+
* This effect is GPU-accelerated (CSS blur) and has zero CPU cost.
|
|
4452
|
+
*
|
|
4453
|
+
* @param config - true to enable with defaults, false to disable,
|
|
4454
|
+
* or object with blur and scale settings
|
|
4455
|
+
*
|
|
4456
|
+
* @example
|
|
4457
|
+
* ```typescript
|
|
4458
|
+
* // Enable with defaults (blur: 30px, scale: 1.3)
|
|
4459
|
+
* user.setAmbientEffect(true);
|
|
4460
|
+
*
|
|
4461
|
+
* // Disable
|
|
4462
|
+
* user.setAmbientEffect(false);
|
|
4463
|
+
*
|
|
4464
|
+
* // Custom settings
|
|
4465
|
+
* user.setAmbientEffect({ blur: 50, scale: 1.5 });
|
|
4466
|
+
* ```
|
|
4467
|
+
*/
|
|
4468
|
+
setAmbientEffect(config: boolean | {
|
|
4469
|
+
blur?: number;
|
|
4470
|
+
scale?: number;
|
|
4471
|
+
}): void;
|
|
4472
|
+
/**
|
|
4473
|
+
* Enable or disable ambient effect
|
|
4474
|
+
*
|
|
4475
|
+
* @param enabled - Whether to enable ambient effect
|
|
4476
|
+
*
|
|
4477
|
+
* @example
|
|
4478
|
+
* ```typescript
|
|
4479
|
+
* user.setAmbientEffectEnabled(true); // Enable with defaults
|
|
4480
|
+
* user.setAmbientEffectEnabled(false); // Disable
|
|
4481
|
+
* ```
|
|
4482
|
+
*/
|
|
4483
|
+
setAmbientEffectEnabled(enabled: boolean): void;
|
|
4484
|
+
/**
|
|
4485
|
+
* Set ambient effect blur intensity
|
|
4486
|
+
*
|
|
4487
|
+
* @param blur - Blur intensity in pixels (default: 30)
|
|
4488
|
+
*
|
|
4489
|
+
* @example
|
|
4490
|
+
* ```typescript
|
|
4491
|
+
* user.setAmbientEffectBlur(50); // More blur
|
|
4492
|
+
* user.setAmbientEffectBlur(15); // Less blur
|
|
4493
|
+
* ```
|
|
4494
|
+
*/
|
|
4495
|
+
setAmbientEffectBlur(blur: number): void;
|
|
4496
|
+
/**
|
|
4497
|
+
* Set ambient effect scale factor
|
|
4498
|
+
*
|
|
4499
|
+
* @param scale - Scale factor for the glow (default: 1.3)
|
|
4500
|
+
*
|
|
4501
|
+
* @example
|
|
4502
|
+
* ```typescript
|
|
4503
|
+
* user.setAmbientEffectScale(1.5); // Larger glow area
|
|
4504
|
+
* user.setAmbientEffectScale(1.1); // Smaller glow area
|
|
4505
|
+
* ```
|
|
4506
|
+
*/
|
|
4507
|
+
setAmbientEffectScale(scale: number): void;
|
|
4508
|
+
/**
|
|
4509
|
+
* Check if ambient effect is currently enabled
|
|
4510
|
+
*/
|
|
4511
|
+
isAmbientEffectEnabled(): boolean;
|
|
4512
|
+
/**
|
|
4513
|
+
* Get current ambient effect configuration
|
|
4514
|
+
*/
|
|
4515
|
+
getAmbientEffectConfig(): {
|
|
4516
|
+
enabled: boolean;
|
|
4517
|
+
blur: number;
|
|
4518
|
+
scale: number;
|
|
4519
|
+
} | null;
|
|
4520
|
+
/**
|
|
4521
|
+
* Get current post-process configuration
|
|
4522
|
+
*/
|
|
4523
|
+
getPostProcessConfig(): PostProcessConfig | null;
|
|
4524
|
+
/**
|
|
4525
|
+
* Check if there are pending post-process commands
|
|
4526
|
+
* @internal
|
|
4527
|
+
*/
|
|
4528
|
+
hasPostProcessCommands(): boolean;
|
|
4529
|
+
/**
|
|
4530
|
+
* Flush post-process commands (returns and clears the queue)
|
|
4531
|
+
* @internal
|
|
4532
|
+
*/
|
|
4533
|
+
flushPostProcessCommands(): PostProcessCommand[];
|
|
4534
|
+
/** Current scaling mode */
|
|
4535
|
+
private currentScalingMode;
|
|
4536
|
+
/**
|
|
4537
|
+
* Set the pixel-perfect scaling mode
|
|
4538
|
+
*
|
|
4539
|
+
* Controls how the terminal canvas is scaled to fit the available space.
|
|
4540
|
+
* Stricter modes produce crisper pixels but may leave empty space.
|
|
4541
|
+
*
|
|
4542
|
+
* @param mode - Scaling mode:
|
|
4543
|
+
* - `'none'`: Fill space, may have sub-pixel artifacts (default)
|
|
4544
|
+
* - `'eighth'`: Snap to 0.125 increments (1.0, 1.125, 1.25...)
|
|
4545
|
+
* - `'quarter'`: Snap to 0.25 increments (1.0, 1.25, 1.5...)
|
|
4546
|
+
* - `'half'`: Snap to 0.5 increments (1.0, 1.5, 2.0...)
|
|
4547
|
+
* - `'integer'`: Crisp pixels, integer scaling only (1x, 2x, 3x...)
|
|
4548
|
+
*
|
|
4549
|
+
* @example
|
|
4550
|
+
* ```typescript
|
|
4551
|
+
* // For crisp retro-style pixels
|
|
4552
|
+
* user.setScalingMode('integer');
|
|
4553
|
+
*
|
|
4554
|
+
* // For balanced quality
|
|
4555
|
+
* user.setScalingMode('quarter');
|
|
4556
|
+
*
|
|
4557
|
+
* // Fill all available space
|
|
4558
|
+
* user.setScalingMode('none');
|
|
4559
|
+
* ```
|
|
4560
|
+
*/
|
|
4561
|
+
setScalingMode(mode: ScalingMode): void;
|
|
4562
|
+
/**
|
|
4563
|
+
* Get current scaling mode
|
|
4564
|
+
*
|
|
4565
|
+
* @returns Current scaling mode or null if not set
|
|
4566
|
+
*/
|
|
4567
|
+
getScalingMode(): ScalingMode | null;
|
|
4568
|
+
/** Current grid configuration */
|
|
4569
|
+
private currentGridConfig;
|
|
4570
|
+
/**
|
|
4571
|
+
* Enable or configure the debug grid overlay
|
|
4572
|
+
*
|
|
4573
|
+
* The grid shows cell boundaries aligned with the terminal grid.
|
|
4574
|
+
* Useful for debugging layout and alignment issues.
|
|
4575
|
+
*
|
|
4576
|
+
* @param config - true to enable with defaults, false to disable,
|
|
4577
|
+
* or object with color and lineWidth settings
|
|
4578
|
+
*
|
|
4579
|
+
* @example
|
|
4580
|
+
* ```typescript
|
|
4581
|
+
* // Enable with default red grid
|
|
4582
|
+
* user.setGrid(true);
|
|
4583
|
+
*
|
|
4584
|
+
* // Disable
|
|
4585
|
+
* user.setGrid(false);
|
|
4586
|
+
*
|
|
4587
|
+
* // Custom green grid
|
|
4588
|
+
* user.setGrid({ enabled: true, color: 'rgba(0, 255, 0, 0.5)' });
|
|
4589
|
+
*
|
|
4590
|
+
* // Custom with thicker lines
|
|
4591
|
+
* user.setGrid({ enabled: true, color: '#ff0000', lineWidth: 2 });
|
|
4592
|
+
* ```
|
|
4593
|
+
*/
|
|
4594
|
+
setGrid(config: boolean | GridConfig): void;
|
|
4595
|
+
/**
|
|
4596
|
+
* Enable or disable the grid
|
|
4597
|
+
*
|
|
4598
|
+
* @param enabled - Whether to show the grid
|
|
4599
|
+
*
|
|
4600
|
+
* @example
|
|
4601
|
+
* ```typescript
|
|
4602
|
+
* user.setGridEnabled(true); // Show grid
|
|
4603
|
+
* user.setGridEnabled(false); // Hide grid
|
|
4604
|
+
* ```
|
|
4605
|
+
*/
|
|
4606
|
+
setGridEnabled(enabled: boolean): void;
|
|
4607
|
+
/**
|
|
4608
|
+
* Check if grid is currently enabled
|
|
4609
|
+
*/
|
|
4610
|
+
isGridEnabled(): boolean;
|
|
4611
|
+
/**
|
|
4612
|
+
* Get current grid configuration
|
|
4613
|
+
*/
|
|
4614
|
+
getGridConfig(): GridConfig | null;
|
|
4186
4615
|
}
|
|
4187
4616
|
|
|
4188
4617
|
/**
|
|
@@ -4659,6 +5088,7 @@ declare class Core {
|
|
|
4659
5088
|
private bitmapFontRegistry;
|
|
4660
5089
|
private soundRegistry;
|
|
4661
5090
|
private audioOrderCollector;
|
|
5091
|
+
private postProcessOrderCollector;
|
|
4662
5092
|
private activeWebFontId;
|
|
4663
5093
|
private _renderCallCount;
|
|
4664
5094
|
private onPaletteChangedCallback?;
|
|
@@ -5233,11 +5663,14 @@ declare class Core {
|
|
|
5233
5663
|
* ```typescript
|
|
5234
5664
|
* // Simplified version for runtime
|
|
5235
5665
|
* websocket.on('update', (buffer: Uint8Array) => {
|
|
5236
|
-
* core.applyUpdatePacketBuffer('user1', buffer);
|
|
5666
|
+
* const packet = core.applyUpdatePacketBuffer('user1', buffer);
|
|
5667
|
+
* if (packet) {
|
|
5668
|
+
* // Handle post-process orders, etc.
|
|
5669
|
+
* }
|
|
5237
5670
|
* });
|
|
5238
5671
|
* ```
|
|
5239
5672
|
*/
|
|
5240
|
-
applyUpdatePacketBuffer(userId: string, buffer: Uint8Array):
|
|
5673
|
+
applyUpdatePacketBuffer(userId: string, buffer: Uint8Array): UpdatePacket | null;
|
|
5241
5674
|
/**
|
|
5242
5675
|
* Applies a LoadPacket received from the server (CLIENT-SIDE)
|
|
5243
5676
|
*
|
|
@@ -6853,6 +7286,11 @@ declare const AUDIO_RESUME_SOUND_MIN_SIZE = 2;
|
|
|
6853
7286
|
declare const AUDIO_SET_LISTENER_POSITION_SIZE = 5;
|
|
6854
7287
|
declare const AUDIO_CONFIGURE_SPATIAL_SIZE = 5;
|
|
6855
7288
|
declare const AUDIO_SET_SOUND_EFFECTS_MIN_SIZE = 4;
|
|
7289
|
+
declare const POSTPROCESS_SET_CONFIG_MIN_SIZE = 2;
|
|
7290
|
+
declare const POSTPROCESS_SET_SCANLINES_SIZE = 7;
|
|
7291
|
+
declare const POSTPROCESS_SET_AMBIENT_EFFECT_SIZE = 5;
|
|
7292
|
+
declare const POSTPROCESS_SET_SCALING_MODE_SIZE = 2;
|
|
7293
|
+
declare const POSTPROCESS_SET_GRID_SIZE = 7;
|
|
6856
7294
|
|
|
6857
7295
|
/**
|
|
6858
7296
|
* UTSP Order Types Enumeration
|
|
@@ -7164,6 +7602,7 @@ declare class UpdatePacketDecoder {
|
|
|
7164
7602
|
private layerDecoder;
|
|
7165
7603
|
private audioOrderDecoder;
|
|
7166
7604
|
private macroOrderDecoder;
|
|
7605
|
+
private postProcessOrderDecoder;
|
|
7167
7606
|
constructor();
|
|
7168
7607
|
/**
|
|
7169
7608
|
* Decodes an UpdatePacket from binary buffer
|
|
@@ -7178,8 +7617,10 @@ declare class UpdatePacketDecoder {
|
|
|
7178
7617
|
* - AudioOrders: variable (encoded audio orders)
|
|
7179
7618
|
* - MacroOrderCount: 1 byte (max 255 macro orders)
|
|
7180
7619
|
* - MacroOrders: variable (encoded macro orders)
|
|
7620
|
+
* - PostProcessOrderCount: 1 byte (max 255 post-process orders)
|
|
7621
|
+
* - PostProcessOrders: variable (encoded post-process orders)
|
|
7181
7622
|
*
|
|
7182
|
-
* Minimum packet size:
|
|
7623
|
+
* Minimum packet size: 14 bytes (Tick + DisplayCount + LayerCount + AudioOrderCount + MacroOrderCount + PostProcessOrderCount)
|
|
7183
7624
|
*/
|
|
7184
7625
|
decode(data: Uint8Array, offset?: number): UpdatePacket;
|
|
7185
7626
|
/**
|
|
@@ -7442,5 +7883,110 @@ declare class AudioOrderCollector {
|
|
|
7442
7883
|
private encodeReverb;
|
|
7443
7884
|
}
|
|
7444
7885
|
|
|
7445
|
-
|
|
7446
|
-
|
|
7886
|
+
/**
|
|
7887
|
+
* UTSP Post-Process Order Decoder
|
|
7888
|
+
*
|
|
7889
|
+
* Decodes binary post-process orders received over the network.
|
|
7890
|
+
* Post-process orders control visual effects like scanlines and ambient effect.
|
|
7891
|
+
*/
|
|
7892
|
+
|
|
7893
|
+
/**
|
|
7894
|
+
* Decoder for UTSP post-process orders
|
|
7895
|
+
* Converts binary buffers to post-process order interfaces
|
|
7896
|
+
*/
|
|
7897
|
+
declare class PostProcessOrderDecoder {
|
|
7898
|
+
/**
|
|
7899
|
+
* Main entry point - decodes a post-process order from buffer
|
|
7900
|
+
* Returns the decoded order and bytes consumed
|
|
7901
|
+
*/
|
|
7902
|
+
decode(buffer: Uint8Array, offset: number): {
|
|
7903
|
+
order: AnyPostProcessOrder;
|
|
7904
|
+
bytesRead: number;
|
|
7905
|
+
};
|
|
7906
|
+
private decodeSetConfigOrder;
|
|
7907
|
+
private decodeSetScanlinesOrder;
|
|
7908
|
+
private decodeSetAmbientEffectOrder;
|
|
7909
|
+
private decodeSetScalingModeOrder;
|
|
7910
|
+
private decodeSetGridOrder;
|
|
7911
|
+
}
|
|
7912
|
+
|
|
7913
|
+
/**
|
|
7914
|
+
* PostProcessOrderCollector - Converts high-level post-process commands to binary PostProcessOrders
|
|
7915
|
+
*
|
|
7916
|
+
* This class bridges the gap between the User's high-level post-process API
|
|
7917
|
+
* (setPostProcess, setAmbientEffect, etc.) and the binary PostProcessOrder protocol.
|
|
7918
|
+
*
|
|
7919
|
+
* It converts PostProcessCommands to PostProcessOrders ready for binary encoding in UpdatePacket.
|
|
7920
|
+
*
|
|
7921
|
+
* @example
|
|
7922
|
+
* ```typescript
|
|
7923
|
+
* const collector = new PostProcessOrderCollector();
|
|
7924
|
+
*
|
|
7925
|
+
* // Convert User's pending commands to orders
|
|
7926
|
+
* const postProcessOrders = collector.collectFromUser(user);
|
|
7927
|
+
*
|
|
7928
|
+
* // postProcessOrders can now be added to UpdatePacket
|
|
7929
|
+
* ```
|
|
7930
|
+
*/
|
|
7931
|
+
|
|
7932
|
+
/**
|
|
7933
|
+
* Collects and converts post-process commands to binary PostProcessOrders
|
|
7934
|
+
*/
|
|
7935
|
+
declare class PostProcessOrderCollector {
|
|
7936
|
+
/**
|
|
7937
|
+
* Collect all pending post-process orders from a user
|
|
7938
|
+
*
|
|
7939
|
+
* This flushes the user's post-process command queue,
|
|
7940
|
+
* converts them to binary PostProcessOrders, and returns them.
|
|
7941
|
+
*
|
|
7942
|
+
* @param user - The user to collect orders from
|
|
7943
|
+
* @returns Array of PostProcessOrders ready for encoding
|
|
7944
|
+
*/
|
|
7945
|
+
collectFromUser(user: User): AnyPostProcessOrder[];
|
|
7946
|
+
/**
|
|
7947
|
+
* Convert an array of post-process commands to PostProcessOrders
|
|
7948
|
+
*
|
|
7949
|
+
* This is the core conversion logic used by both:
|
|
7950
|
+
* - Server: collectFromUser() → encode → network
|
|
7951
|
+
* - Local: convertCommands() → applyPostProcessOrders() (no encoding)
|
|
7952
|
+
*
|
|
7953
|
+
* @param commands - Array of PostProcessCommands to convert
|
|
7954
|
+
* @returns Array of PostProcessOrders
|
|
7955
|
+
*/
|
|
7956
|
+
convertCommands(commands: PostProcessCommand[]): AnyPostProcessOrder[];
|
|
7957
|
+
/**
|
|
7958
|
+
* Convert a post-process command to a PostProcessOrder
|
|
7959
|
+
*/
|
|
7960
|
+
private convertCommand;
|
|
7961
|
+
/**
|
|
7962
|
+
* Convert a full set-config command to a SetConfigOrder
|
|
7963
|
+
*/
|
|
7964
|
+
private convertSetConfig;
|
|
7965
|
+
/**
|
|
7966
|
+
* Create a SetScanlinesOrder with given parameters
|
|
7967
|
+
*/
|
|
7968
|
+
private createSetScanlinesOrder;
|
|
7969
|
+
/**
|
|
7970
|
+
* Create a SetAmbientEffectOrder with given parameters
|
|
7971
|
+
*/
|
|
7972
|
+
private createSetAmbientEffectOrder;
|
|
7973
|
+
/**
|
|
7974
|
+
* Convert pattern string to ScanlinesPatternType
|
|
7975
|
+
*/
|
|
7976
|
+
private patternToType;
|
|
7977
|
+
/**
|
|
7978
|
+
* Create a SetScalingModeOrder with given scaling mode
|
|
7979
|
+
*/
|
|
7980
|
+
private createSetScalingModeOrder;
|
|
7981
|
+
/**
|
|
7982
|
+
* Create a SetGridOrder with given grid configuration
|
|
7983
|
+
*/
|
|
7984
|
+
private createSetGridOrder;
|
|
7985
|
+
/**
|
|
7986
|
+
* Parse CSS color string to RGBA components
|
|
7987
|
+
*/
|
|
7988
|
+
private parseColor;
|
|
7989
|
+
}
|
|
7990
|
+
|
|
7991
|
+
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 };
|
|
7992
|
+
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 };
|