Skip to content

Commit e20d363

Browse files
committed
feat: captions api
1 parent a57f652 commit e20d363

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

p2ce/caption.d.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
options: Map<string, string>;
22+
}
23+
24+
interface GlobalEventNameMap {
25+
BadCaptionRequest: (token: string, lifetime: number) => void;
26+
DisplayCaptionRequest: (token: string, caption: Caption, lifetime: number) => void;
27+
DisplayRawCaptionRequest: (text: string, lifetime: number) => void;
28+
CaptionTick: (time: number) => void;
29+
}

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
459+
* if the passed in text was set, given a pre-determined width.
460+
*/
461+
GetHeightForText(width: number, text: string): number;
450462
}
451463

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

0 commit comments

Comments
 (0)