Skip to content

Commit 4a850d8

Browse files
committed
feat: captions api
1 parent 2e98ae8 commit 4a850d8

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

p2ce/caption.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* @packageDocumentation
3+
* Captioning Interface
4+
*/
5+
6+
interface CaptionUnit {
7+
text: string;
8+
r: number;
9+
g: number;
10+
b: number;
11+
a: number;
12+
}
13+
14+
interface Caption {
15+
bLowPriority: boolean;
16+
bSFX: boolean;
17+
noRepeat: number;
18+
delay: number;
19+
lifetimeOverride: number;
20+
units: Array<CaptionUnit>;
21+
}
22+
23+
interface GlobalEventNameMap {
24+
BadCaptionRequest: (token: string, lifetime: number) => void;
25+
DisplayCaptionRequest: (token: string, caption: Caption, lifetime: number) => void;
26+
DisplayRawCaptionRequest: (text: string, lifetime: number) => void;
27+
CaptionTick: (time: number) => void;
28+
}

shared/panels.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,18 @@ declare interface Label extends AbstractPanel<'Label'> {
447447
SetLocalizationString(text: string): void;
448448

449449
SetProceduralTextThatIPromiseIsLocalizedAndEscaped(text: string, allowDialogVariables: boolean): void;
450+
451+
/**
452+
* Sets the color for a specified range of characters.
453+
* This doesn't work if you are trying to set a color for range of 0 - x, set the base style instead!
454+
*/
455+
SetTextColorRange(startChar: number, endChar: number, colorR: number, colorG: number, colorB: number, colorA: number ): void;
456+
457+
/**
458+
* Approximates the height this label would have if the passed in text was set.
459+
* This adheres to the width of the label's parent to determine wrapping
460+
*/
461+
GetHeightForText(text: string): number;
450462
}
451463

452464
declare interface Movie extends AbstractPanel<'Movie'> {

0 commit comments

Comments
 (0)