@fukutotojido/osu-classes
Version:
Basic classes, interfaces and utils for creating new osu! rulesets
1,924 lines (1,867 loc) • 158 kB
TypeScript
/**
* A color that supports RGBA format.
*/
declare class Color4 {
/**
* The red value of the color in range from 0 to 255.
* @default 255
*/
red: number;
/**
* The green value of the color in range from 0 to 255.
* @default 255
*/
green: number;
/**
* The blue value of the color in range from 0 to 255.
* @default 255
*/
blue: number;
/**
* The alpha value of the color in range from 0 to 1.
* @default 1
*/
alpha: number;
/**
* Creates a new color.
* @param red Red value of the color in range from 0 to 255.
* @param green Green value of the color in range from 0 to 255.
* @param blue Blue value of the color in range from 0 to 255.
* @param alpha Alpha value of the color in range from 0 to 1.
*/
constructor(red?: number, green?: number, blue?: number, alpha?: number);
/**
* The HEX representation of the color.
*/
get hex(): string;
/**
* @param color Another color.
* @returns Wheter the color equals to another one.
*/
equals(color: Color4): boolean;
/**
* Clones the current color.
* @returns A cloned color.
*/
clone(): Color4;
/**
* @returns A string representation of this color.
*/
toString(): string;
}
declare class Vector2 {
/**
* The X-position.
*/
x: number;
/**
* The Y-position.
*/
y: number;
/**
* Creates a new instance of a Vector2.
* @param x The X-position.
* @param y The Y-position.
*/
constructor(x: number, y?: number);
get floatX(): number;
get floatY(): number;
/**
* Adds a vector to the current and returns a new instance.
* @param vec Vector to add.
*/
add(vec: Vector2): Vector2;
/**
* Adds a vector to the current and
* returns a new instance with single precision.
* @param vec Vector to add.
*/
fadd(vec: Vector2): Vector2;
/**
* Subtracts a vector from the current and returns a new instance.
* @param vec Vector to substract.
*/
subtract(vec: Vector2): Vector2;
/**
* Subtracts a vector from the current and
* returns a new instance with single precision.
* @param vec Vector to substract.
*/
fsubtract(vec: Vector2): Vector2;
/**
* Scales the current vector and returns a new instance.
* @param multiplier Vector multiplier.
*/
scale(multiplier: number): Vector2;
/**
* Scales the current vector and
* returns a new instance with single precision.
* @param vec Vector to substract.
*/
fscale(multiplier: number): Vector2;
/**
* Divides the current vector and returns a new instance.
* @param divisor Vector divisor.
*/
divide(divisor: number): Vector2;
/**
* Subtracts a vector from the current and
* returns a new instance with single precision.
* @param vec Vector to substract.
*/
fdivide(divisor: number): Vector2;
/**
* Returns a dot product of two vectors.
* @param vec Second vector.
*/
dot(vec: Vector2): number;
/**
* Returns a dot product of two vectors with single precision.
* @param vec Second vector.
*/
fdot(vec: Vector2): number;
/**
* Returns a length of two points in a vector.
*/
length(): number;
/**
* Returns a single precision length of two points in a vector.
*/
flength(): number;
/**
* Returns a distance between two vectors.
* @param vec Second vector.
*/
distance(vec: Vector2): number;
fdistance(vec: Vector2): number;
/**
* Returns a normalized vector.
*/
normalize(): Vector2;
/**
* Returns a normalized vector with single precision.
*/
fnormalize(): Vector2;
/**
* Returns if two vectors are equal.
* @param vec Second vector.
*/
equals(vec: Vector2): boolean;
/**
* Clones the current vector.
* @returns A cloned vector.
*/
clone(): Vector2;
/**
* @returns A string representation of this vector.
*/
toString(): string;
}
/**
* A beatmap colors section.
*/
declare class BeatmapColorSection {
/**
* Additive combo colors.
*/
comboColors: Color4[];
/**
* Additive slider track color.
*/
sliderTrackColor?: Color4;
/**
* Slider border color.
*/
sliderBorderColor?: Color4;
/**
* Creates a copy of this beatmap colors section.
* Non-primitive properties will be copied via their own clone() method.
* @returns A copied information about control points.
*/
clone(): BeatmapColorSection;
}
declare class BeatmapDifficultySection {
/**
* The default value used for all difficulty settings
* except slider multiplier and slider tickrate.
*/
static BASE_DIFFICULTY: number;
protected _CS: number;
protected _HP: number;
protected _OD: number;
protected _AR?: number;
protected _multiplier: number;
protected _tickRate: number;
protected _rate: number;
/**
* The circle size of this beatmap.
*/
get circleSize(): number;
set circleSize(value: number);
/**
* The HP drain rate of this beatmap.
*/
get drainRate(): number;
set drainRate(value: number);
/**
* The overall difficulty of this beatmap.
*/
get overallDifficulty(): number;
set overallDifficulty(value: number);
/**
* The approach rate of this beatmap.
*/
get approachRate(): number;
set approachRate(value: number);
/**
* The slider multiplier of this beatmap.
*/
get sliderMultiplier(): number;
set sliderMultiplier(value: number);
/**
* The slider tickrate of this beatmap.
*/
get sliderTickRate(): number;
set sliderTickRate(value: number);
/**
* The current state of this beatmap's clock rate.
*/
get clockRate(): number;
set clockRate(value: number);
/**
* Creates a copy of this beatmap difficulty section.
* Non-primitive properties will be copied via their own clone() method.
* @returns A copied information about control points.
*/
clone(): BeatmapDifficultySection;
/**
* Maps a difficulty value [0, 10] to a two-piece linear range of values.
* @param diff The difficulty value to be mapped.
* @param min Minimum of the resulting range which will be achieved by a difficulty value of 0.
* @param mid Midpoint of the resulting range which will be achieved by a difficulty value of 5.
* @param max Maximum of the resulting range which will be achieved by a difficulty value of 10.
* @returns Value to which the difficulty value maps in the specified range.
*/
static range(diff: number, min: number, mid: number, max: number): number;
}
/**
* A beatmap editor section.
*/
declare class BeatmapEditorSection {
/**
* Time in milliseconds of bookmarks.
*/
bookmarks: number[];
/**
* Distance snap multiplier.
*/
distanceSpacing: number;
/**
* Beat snap divisor.
*/
beatDivisor: number;
/**
* Grid size.
*/
gridSize: number;
/**
* Scale factor for the object timeline.
*/
timelineZoom: number;
/**
* Creates a copy of this beatmap editor section.
* Non-primitive properties will be copied via their own clone() method.
* @returns A copied information about control points.
*/
clone(): BeatmapEditorSection;
}
/**
* Types of storyboard layers.
*/
declare enum LayerType {
Background = 0,
Fail = 1,
Pass = 2,
Foreground = 3,
Overlay = 4,
Video = 5
}
/**
* Origins of the storyboard sprite.
*/
declare enum Anchor {
/**
* The vertical counterpart is at "Top" position.
*/
y0 = 1,
/**
* The vertical counterpart is at "Centre" position.
*/
y1 = 2,
/**
* The vertical counterpart is at "Bottom" position.
*/
y2 = 4,
/**
* The horizontal counterpart is at "Left" position.
*/
x0 = 8,
/**
* The horizontal counterpart is at "Centre" position.
*/
x1 = 16,
/**
* The horizontal counterpart is at "Right" position.
*/
x2 = 32,
/**
* The user is manually updating the outcome.
*/
Custom = 64,
TopLeft = 9,
TopCentre = 17,
TopRight = 33,
CentreLeft = 10,
Centre = 18,
CentreRight = 34,
BottomLeft = 12,
BottomCentre = 20,
BottomRight = 36
}
/**
* Types of storyboard commands.
*/
declare enum CommandType {
None = '',
Movement = 'M',
MovementX = 'MX',
MovementY = 'MY',
Fade = 'F',
Scale = 'S',
VectorScale = 'V',
Rotation = 'R',
Color = 'C',
Parameter = 'P'
}
/**
* Types of storyboard compounds.
*/
declare enum CompoundType {
None = '',
Loop = 'L',
Trigger = 'T'
}
/**
* Types of storyboard events.
*/
declare enum EventType {
Background = 0,
Video = 1,
Break = 2,
Colour = 3,
Sprite = 4,
Sample = 5,
Animation = 6,
StoryboardCommand = 7
}
/**
* Types of animation loops.
*/
declare enum LoopType {
LoopForever = 0,
LoopOnce = 1
}
/**
* This is used by osu!lazer to convert legacy origins to the new format.
*/
declare enum Origins {
TopLeft = 0,
Centre = 1,
CentreLeft = 2,
TopRight = 3,
BottomCentre = 4,
TopCentre = 5,
Custom = 6,
CentreRight = 7,
BottomLeft = 8,
BottomRight = 9
}
/**
* Types of the parameter command.
*/
declare enum ParameterType {
None = '',
HorizontalFlip = 'H',
VerticalFlip = 'V',
BlendingMode = 'A'
}
/**
* Types of easing.
*/
declare enum EasingType {
None = 0,
Out = 1,
In = 2,
InQuad = 3,
OutQuad = 4,
InOutQuad = 5,
InCubic = 6,
OutCubic = 7,
InOutCubic = 8,
InQuart = 9,
OutQuart = 10,
InOutQuart = 11,
InQuint = 12,
OutQuint = 13,
InOutQuint = 14,
InSine = 15,
OutSine = 16,
InOutSine = 17,
InExpo = 18,
OutExpo = 19,
InOutExpo = 20,
InCirc = 21,
OutCirc = 22,
InOutCirc = 23,
InElastic = 24,
OutElastic = 25,
OutElasticHalf = 26,
OutElasticQuarter = 27,
InOutElastic = 28,
InBack = 29,
OutBack = 30,
InOutBack = 31,
InBounce = 32,
OutBounce = 33,
InOutBounce = 34,
OutPow10 = 35
}
type EasingFn = (p: number) => number;
declare const linear: EasingFn;
declare const inQuad: EasingFn;
declare const outQuad: EasingFn;
declare const inOutQuad: EasingFn;
declare const inCubic: EasingFn;
declare const outCubic: EasingFn;
declare const inOutCubic: EasingFn;
declare const inQuart: EasingFn;
declare const outQuart: EasingFn;
declare const inOutQuart: EasingFn;
declare const inQuint: EasingFn;
declare const outQuint: EasingFn;
declare const inOutQuint: EasingFn;
declare const inSine: EasingFn;
declare const outSine: EasingFn;
declare const inOutSine: EasingFn;
declare const inExpo: EasingFn;
declare const outExpo: EasingFn;
declare const inOutExpo: EasingFn;
declare const inCirc: EasingFn;
declare const outCirc: EasingFn;
declare const inOutCirc: EasingFn;
declare const inElastic: EasingFn;
declare const outElastic: EasingFn;
declare const outElasticHalf: EasingFn;
declare const outElasticQuarter: EasingFn;
declare const inOutElastic: EasingFn;
declare const inBack: EasingFn;
declare const outBack: EasingFn;
declare const inOutBack: EasingFn;
declare const inBounce: EasingFn;
declare const outBounce: EasingFn;
declare const inOutBounce: EasingFn;
declare const outPow10: EasingFn;
declare function getEasingFn(easing: EasingType): EasingFn;
type Easing_EasingFn = EasingFn;
declare const Easing_getEasingFn: typeof getEasingFn;
declare const Easing_inBack: typeof inBack;
declare const Easing_inBounce: typeof inBounce;
declare const Easing_inCirc: typeof inCirc;
declare const Easing_inCubic: typeof inCubic;
declare const Easing_inElastic: typeof inElastic;
declare const Easing_inExpo: typeof inExpo;
declare const Easing_inOutBack: typeof inOutBack;
declare const Easing_inOutBounce: typeof inOutBounce;
declare const Easing_inOutCirc: typeof inOutCirc;
declare const Easing_inOutCubic: typeof inOutCubic;
declare const Easing_inOutElastic: typeof inOutElastic;
declare const Easing_inOutExpo: typeof inOutExpo;
declare const Easing_inOutQuad: typeof inOutQuad;
declare const Easing_inOutQuart: typeof inOutQuart;
declare const Easing_inOutQuint: typeof inOutQuint;
declare const Easing_inOutSine: typeof inOutSine;
declare const Easing_inQuad: typeof inQuad;
declare const Easing_inQuart: typeof inQuart;
declare const Easing_inQuint: typeof inQuint;
declare const Easing_inSine: typeof inSine;
declare const Easing_linear: typeof linear;
declare const Easing_outBack: typeof outBack;
declare const Easing_outBounce: typeof outBounce;
declare const Easing_outCirc: typeof outCirc;
declare const Easing_outCubic: typeof outCubic;
declare const Easing_outElastic: typeof outElastic;
declare const Easing_outElasticHalf: typeof outElasticHalf;
declare const Easing_outElasticQuarter: typeof outElasticQuarter;
declare const Easing_outExpo: typeof outExpo;
declare const Easing_outPow10: typeof outPow10;
declare const Easing_outQuad: typeof outQuad;
declare const Easing_outQuart: typeof outQuart;
declare const Easing_outQuint: typeof outQuint;
declare const Easing_outSine: typeof outSine;
declare namespace Easing {
export { type Easing_EasingFn as EasingFn, Easing_getEasingFn as getEasingFn, Easing_inBack as inBack, Easing_inBounce as inBounce, Easing_inCirc as inCirc, Easing_inCubic as inCubic, Easing_inElastic as inElastic, Easing_inExpo as inExpo, Easing_inOutBack as inOutBack, Easing_inOutBounce as inOutBounce, Easing_inOutCirc as inOutCirc, Easing_inOutCubic as inOutCubic, Easing_inOutElastic as inOutElastic, Easing_inOutExpo as inOutExpo, Easing_inOutQuad as inOutQuad, Easing_inOutQuart as inOutQuart, Easing_inOutQuint as inOutQuint, Easing_inOutSine as inOutSine, Easing_inQuad as inQuad, Easing_inQuart as inQuart, Easing_inQuint as inQuint, Easing_inSine as inSine, Easing_linear as linear, Easing_outBack as outBack, Easing_outBounce as outBounce, Easing_outCirc as outCirc, Easing_outCubic as outCubic, Easing_outElastic as outElastic, Easing_outElasticHalf as outElasticHalf, Easing_outElasticQuarter as outElasticQuarter, Easing_outExpo as outExpo, Easing_outPow10 as outPow10, Easing_outQuad as outQuad, Easing_outQuart as outQuart, Easing_outQuint as outQuint, Easing_outSine as outSine };
}
/**
* A storyboard command.
*/
declare class Command<T = any> {
/**
* Command type.
*/
type: CommandType;
/**
* Command type.
*/
parameter: ParameterType;
/**
* The easing of the storyboard command.
*/
easing: EasingType;
/**
* The time at which the command starts.
*/
startTime: number;
/**
* The time at which the command ends.
*/
endTime: number;
/**
* Starting value of this command.
*/
startValue: T;
/**
* Ending value of this command.
*/
endValue: T;
constructor(params?: Partial<Command>);
/**
* The duration of the storyboard command.
*/
get duration(): number;
/**
* Calculates the progress of this command.
* @param time Current time in milliseconds.
* @returns Progress of this command in range from 0 to 1.
*/
getProgress(time: number): number;
/**
* Calculates the value of this command at a given progress.
* @param progress Current progress in range from 0 to 1.
* @returns Calculated value.
*/
getValueAtProgress(progress: number): T;
/**
* Calculates the value of this command at a given momemnt of time.
* @param time Current time in milliseconds.
* @returns Calculated value.
*/
getValueAtTime(time: number): T;
/**
* @param other Other storyboard command.
* @returns If two storyboard commands are equal.
*/
equals(other: Command<T>): boolean;
}
/**
* A storyboard command timeline.
*/
declare class CommandTimeline<T = any> implements Iterable<Command<T>> {
private readonly _commands;
startTime: number;
endTime: number;
startValue: T;
endValue: T;
[Symbol.iterator](): Iterator<Command<T>>;
/**
* A command list.
*/
get commands(): Command<T>[];
add(type: CommandType, easing: EasingType, startTime: number, endTime: number, startValue: T, endValue: T, parameter?: ParameterType): void;
get hasCommands(): boolean;
}
declare const enum BlendingEquation {
/**
* Inherits from parent.
*/
Inherit = 0,
/**
* Adds the source and destination colors.
*/
Add = 1,
/**
* Chooses the minimum of each component of the source and destination colors.
*/
Min = 2,
/**
* Chooses the maximum of each component of the source and destination colors.
*/
Max = 3,
/**
* Subtracts the destination color from the source color.
*/
Subtract = 4,
/**
* Subtracts the source color from the destination color.
*/
ReverseSubtract = 5
}
declare const enum BlendEquationMode {
FuncAdd = 32774,
Min = 32775,
Max = 32776,
FuncSubtract = 32778,
FuncReverseSubtract = 32779
}
declare const enum BlendingFactorDest {
Zero = 0,
SrcColor = 768,
OneMinusSrcColor = 769,
SrcAlpha = 770,
OneMinusSrcAlpha = 771,
DstAlpha = 772,
OneMinusDstAlpha = 773,
DstColor = 774,
OneMinusDstColor = 775,
SrcAlphaSaturate = 776,
ConstantColor = 32769,
OneMinusConstantColor = 32770,
ConstantAlpha = 32771,
OneMinusConstantAlpha = 32772,
One = 1
}
declare const enum BlendingFactorSrc {
Zero = 0,
SrcColor = 768,
OneMinusSrcColor = 769,
SrcAlpha = 770,
OneMinusSrcAlpha = 771,
DstAlpha = 772,
OneMinusDstAlpha = 773,
DstColor = 774,
OneMinusDstColor = 775,
SrcAlphaSaturate = 776,
ConstantColor = 32769,
OneMinusConstantColor = 32770,
ConstantAlpha = 32771,
OneMinusConstantAlpha = 32772,
One = 1
}
/**
* Types of blending.
*/
declare enum BlendingMode {
AdditiveBlending = 0,
AlphaBlending = 1
}
/**
* Types of blending.
*/
declare const enum BlendingType {
Inherit = 0,
ConstantAlpha = 1,
ConstantColor = 2,
DstAlpha = 3,
DstColor = 4,
One = 5,
OneMinusConstantAlpha = 6,
OneMinusConstantColor = 7,
OneMinusDstAlpha = 8,
OneMinusDstColor = 9,
OneMinusSrcAlpha = 10,
OneMinusSrcColor = 11,
SrcAlpha = 12,
SrcAlphaSaturate = 13,
SrcColor = 14,
Zero = 15
}
/**
* Contains information about how a drawable should be blended into its destination.
*/
declare class BlendingParameters {
/**
* The blending factor for the source color of the blend.
*/
source: BlendingType;
/**
* The blending factor for the destination color of the blend.
*/
destination: BlendingType;
/**
* The blending factor for the source alpha of the blend.
*/
sourceAlpha: BlendingType;
/**
* The blending factor for the destination alpha of the blend.
*/
destinationAlpha: BlendingType;
/**
* Gets or sets the blending equation to use for the RGB components of the blend.
*/
rgbEquation: BlendingEquation;
/**
* Gets or sets the blending equation to use for the alpha component of the blend.
*/
alphaEquation: BlendingEquation;
static None: BlendingParameters;
static Inherit: BlendingParameters;
static Mixture: BlendingParameters;
static Additive: BlendingParameters;
constructor(params: Partial<BlendingParameters>);
/**
* Copy all properties that are marked as inherited from a parent blending parameters object.
* @param parent The parent blending parameters from which to copy inherited properties.
*/
copyFromParent(parent: BlendingParameters): void;
/**
* Any properties marked as inherited will have their
* blending mode changed to the default type.
* This can occur when a root element is set to inherited.
*/
applyDefaultToInherited(): void;
equals(other: BlendingParameters): boolean;
get isDisabled(): boolean;
/**
* Gets the blending equation mode for the currently specified RGB Equation.
*/
get rgbEquationMode(): BlendEquationMode;
/**
* Gets the blending equation mode for the currently specified Alpha Equation.
*/
get alphaEquationMode(): BlendEquationMode;
/**
* Gets the blending factor source for the currently specified source blending mode.
*/
get sourceBlendingFactor(): BlendingFactorSrc;
/**
* Gets the blending factor destination for the currently specified destination blending mode.
*/
get destinationBlendingFactor(): BlendingFactorDest;
/**
* Gets the blending factor source for the currently specified source alpha mode.
*/
get sourceAlphaBlendingFactor(): BlendingFactorSrc;
/**
* Gets the blending factor destination for the currently specified destination alpha mode.
*/
get destinationAlphaBlendingFactor(): BlendingFactorDest;
private static _translateBlendingFactorSrc;
private static _translateBlendingFactorDest;
private static _translateEquation;
}
/**
* A command timeline group.
*/
declare class CommandTimelineGroup {
x: CommandTimeline<number>;
y: CommandTimeline<number>;
scale: CommandTimeline<number>;
vectorScale: CommandTimeline<Vector2>;
rotation: CommandTimeline<number>;
color: CommandTimeline<Color4>;
alpha: CommandTimeline<number>;
blendingParameters: CommandTimeline<BlendingParameters>;
flipH: CommandTimeline<boolean>;
flipV: CommandTimeline<boolean>;
readonly _timelines: CommandTimeline[];
constructor();
get timelines(): CommandTimeline[];
get totalCommands(): number;
get commands(): Command[];
get commandsStartTime(): number;
get commandsEndTime(): number;
get commandsDuration(): number;
get startTime(): number;
get endTime(): number;
get duration(): number;
get hasCommands(): boolean;
}
/**
* A storyboard command loop.
*/
declare class CommandLoop extends CommandTimelineGroup {
/**
* Compound type.
*/
type: CompoundType;
/**
* The start time of the loop.
*/
loopStartTime: number;
/**
* The total number of repeats.
*/
loopCount: number;
/**
* Creates a new instance of the storyboard command loop.
* @param loopStartTime The start time of the loop.
* @param loopCount The number of repeats of this loop.
*/
constructor(loopStartTime?: number, loopCount?: number);
/**
* The total number of times this loop is played back. Always greater than zero.
*/
get totalIterations(): number;
/**
* The start time of the command loop.
*/
get startTime(): number;
/**
* The end time of the command loop.
*/
get endTime(): number;
unrollCommands(): Command[];
}
declare class CommandTrigger extends CommandTimelineGroup {
/**
* Compound type.
*/
type: CompoundType;
/**
* The name of the trigger.
*/
triggerName: string;
/**
* The start time of the command trigger.
*/
triggerStartTime: number;
/**
* The end time of the command trigger.
*/
triggerEndTime: number;
/**
* The group of the command trigger.
*/
groupNumber: number;
/**
* Creates a new instance of command trigger.
* @param triggerName The name of the trigger.
* @param startTime The start time of the command trigger.
* @param endTime The end time of the command trigger.
* @param groupNumber The group of the command trigger.
*/
constructor(triggerName?: string, startTime?: number, endTime?: number, groupNumber?: number);
unrollCommands(): Command[];
}
/**
* A storyboard element.
*/
interface IStoryboardElement {
/**
* The start time of the storyboard element.
*/
startTime: number;
/**
* The file path of the content of the storyboard element.
*/
filePath: string;
/**
* Whether this storyboard element can be drawn or not.
*/
isDrawable: boolean;
}
/**
* A storyboard element that has commands.
*/
interface IHasCommands extends IStoryboardElement {
/**
* The list of commands of the storyboard element.
* This is not synchronized with {@link timelineGroup}
* as constantly updating it can be very expensive.
* If you need to update this array, use {@link updateCommands}.
*/
commands: Command[];
/**
* The command timeline group of this storyboard element.
*/
timelineGroup: CommandTimelineGroup;
/**
* The list of command loops of the storyboard element.
*/
loops: CommandLoop[];
/**
* The list of command triggers of the storyboard element.
*/
triggers: CommandTrigger[];
/**
* Collects all commands from every timeline and loop.
* All loop commands are unwinded, which means there is no need to iterate over loops.
* This method also updates {@link commands} array.
* @returns General command array of this sprite.
*/
updateCommands(): Command[];
/**
* If this storyboard element has commands or not.
*/
hasCommands: boolean;
}
/**
* A storyboard element that ends at a different time than its start time.
*/
interface IStoryboardElementWithDuration extends IStoryboardElement {
/**
* The time at which this storyboard element ends.
*/
endTime: number;
/**
* The duration of the storyboard element.
*/
duration: number;
}
/**
* A storyboard sprite.
*/
declare class StoryboardSprite implements IStoryboardElementWithDuration, IHasCommands {
/**
* The origin of the image on the screen.
*/
origin: Origins;
/**
* The anchor of the image on the screen.
*/
anchor: Anchor;
/**
* The start time of the storyboard sprite.
*/
startTime: number;
/**
* The end time of the storyboard sprite.
*/
endTime: number;
/**
* The file path of the content of this storyboard sprite.
*/
filePath: string;
/**
* The list of commands of the storyboard element.
* This is not synchronized with {@link timelineGroup}
* as constantly updating it can be very expensive.
* If you need to update this array, use {@link updateCommands}.
*/
commands: Command[];
/**
* The list of commands of the storyboard sprite.
*/
timelineGroup: CommandTimelineGroup;
/**
* The list of command loops of the storyboard sprite.
*/
loops: CommandLoop[];
/**
* The list of command triggers of the storyboard sprite.
*/
triggers: CommandTrigger[];
/**
* The relative start position of the storyboard sprite.
*/
startPosition: Vector2;
/**
* Current scale of this sprite.
*/
scale: Vector2;
/**
* Current color of this sprite.
*/
color: Color4;
/**
* Current rotation of this sprite.
*/
rotation: number;
/**
* If this sprite is fliped horizontally.
*/
flipX: boolean;
/**
* If this sprite is fliped vertically.
*/
flipY: boolean;
/**
* If this sprite is using additive blending.
*/
isAdditive: boolean;
/**
* @param path The file path of the content of this storyboard sprite.
* @param origin The origin of the image on the screen.
* @param anchor The anchor of the image on the screen.
* @param position The relative start position of the storyboard sprite.
* @constructor
*/
constructor(path: string, origin: Origins, anchor: Anchor, position: Vector2);
/**
* The start X-position of the storyboard sprite.
*/
get startX(): number;
set startX(value: number);
/**
* The start Y-position of the storyboard sprite.
*/
get startY(): number;
set startY(value: number);
get duration(): number;
get hasCommands(): boolean;
get isDrawable(): boolean;
/**
* Creates a new instance of the storyboard command loop.
* @param startTime The start time of the loop.
* @param repeatCount The number of repeats of this loop.
*/
addLoop(startTime: number, repeatCount: number): CommandLoop;
/**
* Creates a new instance of command trigger.
* @param triggerName The name of the trigger.
* @param startTime The start time of the command trigger.
* @param endTime The end time of the command trigger.
* @param groupNumber The group of the command trigger.
*/
addTrigger(triggerName: string, startTime: number, endTime: number, groupNumber: number): CommandTrigger;
/**
* Collects all commands from every timeline and loop.
* All loop commands are unwinded, which means there is no need to iterate over loops.
* This method also updates {@link commands} array.
* @returns General command array of this sprite.
*/
updateCommands(): Command[];
/**
* Adjusts start & end time of this sprite to the
* earliest command start time & latest command end time.
*/
adjustTimesToCommands(): void;
/**
* Resets all sprite values to first applied command values.
*/
resetValuesToCommands(): void;
/**
* Replaces current sprite values with command values.
* @param command Target command.
* @param progress Current command progress.
*/
setValueFromCommand(command: Command, progress: number): void;
}
/**
* A storyboard animation.
*/
declare class StoryboardAnimation extends StoryboardSprite {
/**
* The number of frames in this animation.
*/
frameCount: number;
/**
* The delay (in milliseconds) between each frame of the animation.
*/
frameDelay: number;
/**
* Indicates if the animation should loop or not.
*/
loopType: LoopType;
/**
* @param path The file path of the content of this storyboard sprite.
* @param origin The origin of the image on the screen.
* @param anchor The anchor of the image on the screen.
* @param position The relative start position of the storyboard sprite.
* @param frameCount The number of frames in this animation.
* @param frameDelay The delay (in milliseconds) between each frame of the animation.
* @param loopType Indicates if the animation should loop or not.
* @constructor
*/
constructor(path: string, origin: Origins, anchor: Anchor, position: Vector2, frameCount: number, frameDelay: number, loopType: LoopType);
}
/**
* A storyboard sample.
*/
declare class StoryboardSample implements IStoryboardElement {
/**
* The start time of the storyboard sample.
*/
startTime: number;
/**
* The volume of the storyboard sample.
*/
volume: number;
/**
* The file path of the sound of this sample.
*/
filePath: string;
get isDrawable(): boolean;
constructor(path: string, time: number, volume: number);
}
/**
* A storyboard video.
*/
declare class StoryboardVideo implements IStoryboardElement {
/**
* The start time of the storyboard video.
*/
startTime: number;
/**
* The file path of this video.
*/
filePath: string;
get isDrawable(): boolean;
constructor(path: string, time: number);
}
/**
* A storyboard layer.
*/
declare class StoryboardLayer {
/**
* Storyboard layer name.
*/
readonly name: string;
/**
* Storyboard layer name.
*/
readonly depth: number;
/**
* Should this layer be masked or not?
*/
readonly masking: boolean;
/**
* Is this layer visible when player is alive.
*/
visibleWhenPassing: boolean;
/**
* Is this layer visible when player fails.
*/
visibleWhenFailing: boolean;
/**
* Storyboard layer elements.
*/
elements: IStoryboardElement[];
constructor(params: Required<Pick<StoryboardLayer, 'name' | 'depth'>> & Partial<StoryboardLayer>);
}
/**
* A beatmap storyboard.
*/
declare class Storyboard {
/**
* Variables of the storyboard.
*/
variables: Map<string, string>;
/**
* Custom beatmap colors.
*/
colors: BeatmapColorSection;
/**
* Whether the storyboard can fall back to skin sprites
* in case no matching storyboard sprites are found.
*/
useSkinSprites: boolean;
/**
* Depth of the currently front-most storyboard layer, excluding the overlay layer.
*/
minimumLayerDepth: number;
/**
* Beatmap file version for which this storyboard was created.
*/
fileFormat: number;
/**
* Storyboard layers.
*/
private _layers;
constructor();
get layers(): Map<string, StoryboardLayer>;
get hasDrawable(): boolean;
get hasVariables(): boolean;
/**
* Across all layers, find the earliest point in time that a storyboard element exists at.
* Will return `null` if there are no elements.
* This iterates all elements and as such should be used sparingly or stored locally.
*/
get earliestEventTime(): number | null;
/**
* Across all layers, find the latest point in time that a storyboard element ends at.
* Will return null if there are no elements.
* This iterates all elements and as such should be used sparingly or stored locally.
* Videos and samples return start time as their end time.
*/
get latestEventTime(): number | null;
/**
* Adds a new storyboard layer.
* @param layer A storyboard layer.
*/
addLayer(layer: StoryboardLayer): void;
/**
* Finds a storyboard layer by its type. Returns background layer if type doesn't exist.
* @param type The type of the storyboard layer.
* @returns The storyboard layer.
*/
getLayerByType(type: LayerType): StoryboardLayer;
/**
* Finds a storyboard layer by its name. Otherwise will create a new storyboard layer with this name.
* @param name The name of the storyboard layer.
* @returns The storyboard layer.
*/
getLayerByName(name: string): StoryboardLayer;
}
/**
* A beatmap break event.
*/
declare class BeatmapBreakEvent {
/**
* The time at which break event starts.
*/
startTime: number;
/**
* The time at which break event ends.
*/
endTime: number;
/**
* Creates a new instance of beatmap break event.
* @param startTime The time at which break event starts.
* @param endTime The time at which break event ends.
*/
constructor(startTime: number, endTime: number);
/**
* The duration of this beatmap break event.
*/
get duration(): number;
/**
* @returns Whether the beatmap break event has effects.
*/
get hasEffect(): boolean;
/**
* @param time The time.
* @returns Whether beatmap break lasts at the specified time.
*/
contains(time: number): boolean;
}
/**
* A beatmap events section.
*/
declare class BeatmapEventSection {
/**
* A beatmap background file path.
*/
backgroundPath: string | null;
/**
* List of beatmap break events.
*/
breaks: BeatmapBreakEvent[];
/**
* A beatmap storyboard.
*/
storyboard: Storyboard | null;
/**
* Whether the storyboard replace the background?
*/
get isBackgroundReplaced(): boolean;
/**
* Creates a copy of this beatmap events section.
* Non-primitive properties will be copied via their own clone() method.
* @returns A copied information about control points.
*/
clone(): BeatmapEventSection;
}
/**
* Types of sample set.
*/
declare enum SampleSet {
None = 0,
Normal = 1,
Soft = 2,
Drum = 3
}
/**
* A beatmap general section.
*/
declare class BeatmapGeneralSection {
/**
* Location of the audio file relative to the current folder.
*/
audioFilename: string;
/**
* @deprecated
*/
audioHash?: string;
/**
* Draw order of hit circle overlays compared to hit numbers.
* NoChange = use skin setting.
* Below = draw overlays under numbers.
* Above = draw overlays on top of numbers.
*/
overlayPosition: string;
/**
* Preferred skin to use during gameplay.
*/
skinPreference: string;
/**
* Milliseconds of silence before the audio starts playing.
*/
audioLeadIn: number;
/**
* Time in milliseconds when the audio preview should start.
*/
previewTime: number;
/**
* Speed of the countdown before the first hit object.
* 0 = no countdown.
* 1 = normal.
* 2 = half.
* 3 = double.
*/
countdown: number;
/**
* Multiplier for the threshold in time where
* hit objects placed close together stack (0–1).
*/
stackLeniency: number;
/**
* Time in beats that the countdown starts before the first hit object.
*/
countdownOffset: number;
/**
* Sample set that will be used if timing points
* do not override it (Normal, Soft, Drum).
*/
sampleSet: SampleSet;
/**
* Whether or not breaks have a letterboxing effect.
*/
letterboxInBreaks: boolean;
/**
* @deprecated
*/
storyFireInFront?: boolean;
/**
* Whether or not the storyboard can use the user's skin images.
*/
useSkinSprites: boolean;
/**
* @deprecated
*/
alwaysShowPlayfield?: boolean;
/**
* Whether or not a warning about flashing colors
* should be shown at the beginning of the map.
*/
epilepsyWarning: boolean;
/**
* Whether or not the "N+1" style key layout is used for osu!mania.
*/
specialStyle: boolean;
/**
* Whether or not the storyboard allows widescreen viewing.
*/
widescreenStoryboard: boolean;
/**
* Whether or not sound samples will change
* rate when playing with speed-changing mods.
*/
samplesMatchPlaybackRate: boolean;
/**
* Creates a copy of this beatmap general section.
* Non-primitive properties will be copied via their own clone() method.
* @returns A copied information about control points.
*/
clone(): BeatmapGeneralSection;
}
/**
* A beatmap metadata section.
*/
declare class BeatmapMetadataSection {
/**
* Romanised song title.
*/
title: string;
/**
* Romanised song artist.
*/
artist: string;
/**
* Beatmap creator.
*/
creator: string;
/**
* Difficulty name.
*/
version: string;
/**
* Original media the song was produced for.
*/
source: string;
/**
* Search terms.
*/
tags: string[];
/**
* Beatmap ID.
*/
beatmapId: number;
/**
* Beatmapset ID.
*/
beatmapSetId: number;
/**
* Song title.
*/
private _titleUnicode;
get titleUnicode(): string;
set titleUnicode(value: string);
/**
* Song artist.
*/
private _artistUnicode;
get artistUnicode(): string;
set artistUnicode(value: string);
/**
* Creates a copy of this beatmap metadata section.
* Non-primitive properties will be copied via their own clone() method.
* @returns A copied information about control points.
*/
clone(): BeatmapMetadataSection;
}
/**
* A group of control points.
*/
declare class ControlPointGroup {
/**
* A list of control points.
*/
controlPoints: ControlPoint[];
/**
* The time at which group starts.
*/
startTime: number;
/**
* Creates a new group of control points.
* @param time The time at which group starts.
* @constructor
*/
constructor(time: number);
/**
* Adds a new control point to a group.
* @param point A control point.
*/
add(point: ControlPoint): void;
/**
* Removes a control point from a group.
* @param point A control point.
*/
remove(point: ControlPoint): void;
}
/**
* All types of control points.
*/
declare enum ControlPointType {
TimingPoint = 0,
DifficultyPoint = 1,
EffectPoint = 2,
SamplePoint = 3
}
/**
* A control point of a beatmap.
*/
declare abstract class ControlPoint {
abstract pointType: ControlPointType;
/**
* The group to which a control point belongs.
*/
group: ControlPointGroup | null;
/**
* Creates a new instance of a control point.
* @param group A group of this control point.
* @constructor
*/
constructor(group?: ControlPointGroup);
/**
* Attaches a new group to this control point.
* @param group A new group.
*/
attachGroup(group: ControlPointGroup): void;
/**
* Dettaches a group from this control point.
*/
dettachGroup(): void;
/**
* The time at which control point starts.
*/
get startTime(): number;
abstract isRedundant(existing: ControlPoint | null): boolean;
}
/**
* A difficulty point.
*/
declare class DifficultyPoint extends ControlPoint {
/**
* The default instance of a difficulty point.
*/
static default: DifficultyPoint;
/**
* The type of a difficulty point.
*/
pointType: ControlPointType;
/**
* Whether or not slider ticks should be generated at this control point.
* This exists for backwards compatibility with maps that abuse
* NaN slider velocity behavior on osu!stable (e.g. /b/2628991).
*/
generateTicks: boolean;
/**
* Indicates whether this difficulty control point should be considered as legacy or not.
*/
isLegacy: boolean;
/**
* The real slider velocity of this difficulty point
* without any limits as it was in osu!stable.
* Usage of {@link sliderVelocity} is preferable when working with osu!lazer.
*/
sliderVelocityUnlimited: number;
/**
* The slider velocity at this difficulty point.
*/
get sliderVelocity(): number;
set sliderVelocity(value: number);
/**
* Legacy BPM multiplier that introduces floating-point
* errors for rulesets that depend on it.
* DO NOT USE THIS UNLESS 100% SURE.
*/
bpmMultiplier: number;
/**
* Checks if this difficulty point is redundant to an another one.
* @param existing The another difficulty point.
* @returns Whether the difficulty point is redundant.
*/
isRedundant(existing: DifficultyPoint | null): boolean;
/**
* @param other Other difficulty control point.
* @returns If two difficulty control points are equal.
*/
equals(other: DifficultyPoint): boolean;
}
/**
* An effect point.
*/
declare class EffectPoint extends ControlPoint {
/**
* The default instance of an effect point.
*/
static default: EffectPoint;
/**
* The type of an effect point.
*/
pointType: ControlPointType;
/**
* Whether this control point enables kiai mode.
*/
kiai: boolean;
/**
* Whether the first bar line of this control point is ignored.
*/
omitFirstBarLine: boolean;
/**
* The real scroll speed of this effect point
* without any limits as it was in osu!stable.
* Usage of {@link scrollSpeed} is preferable when working with osu!lazer.
*/
scrollSpeedUnlimited: number;
/**
* The relative scroll speed at this control point.
*/
get scrollSpeed(): number;
set scrollSpeed(value: number);
/**
* Checks if this effect point is redundant to an another one.
* @param existing The another effect point.
* @returns Whether the effect point is redundant.
*/
isRedundant(existing: EffectPoint | null): boolean;
/**
* @param other Other effect control point.
* @returns If two effect control points are equal.
*/
equals(other: EffectPoint): boolean;
}
/**
* A sample point.
*/
declare class SamplePoint extends ControlPoint {
/**
* The default instance of a sample point.
*/
static default: SamplePoint;
/**
* The type of a sample point.
*/
pointType: ControlPointType;
/**
* The sample bank of this sample point.
*/
sampleSet: string;
/**
* The custom index of this sample point.
*/
customIndex: number;
/**
* The volume of this sample point.
*/
volume: number;
/**
* Checks if this sample point is redundant to an another one.
* @param existing The another sample point.
* @returns Whether the sample point is redundant.
*/
isRedundant(existing: SamplePoint): boolean;
/**
* @param other Other sample control point.
* @returns If two sample control points are equal.
*/
equals(other: SamplePoint): boolean;
}
/**
* All time signatures.
*/
declare enum TimeSignature {
SimpleTriple = 3,
SimpleQuadruple = 4
}
/**
* A timing point.
*/
declare class TimingPoint extends ControlPoint {
/**
* The default instance of a timing point.
*/
static default: TimingPoint;
/**
* Default length of a beat in milliseconds.
* Used whenever there is no beatmap or track playing.
*/
static DEFAULT_BEAT_LENGTH: number;
/**
* The type of a timing point.
*/
pointType: ControlPointType;
/**
* The real beat length of this timing point
* without any limits as it was in osu!stable.
* Usage of {@link beatLength} is preferable when working with osu!lazer.
*/
beatLengthUnlimited: number;
/**
* The beat length of this timing point.
*/
get beatLength(): number;
set beatLength(value: number);
/**
* The time signature of this timing point.
*/
timeSignature: TimeSignature;
/**
* The real BPM of this timing point
* without any limits as it was in osu!stable.
* Usage of {@link bpm} is preferable when working with osu!lazer.
*/
get bpmUnlimited(): number;
/**
* The BPM of this timing point.
*/
get bpm(): number;
/**
* Timing points are never redundant as they can change the time signature.
*/
isRedundant(): false;
/**
* @param other Other timing control point.
* @returns If two timing control points are equal.
*/
equals(other: TimingPoint): boolean;
}
/**
* The information about control points.
*/
declare class ControlPointInfo {
/**
* All groups of control points.
*/
groups: ControlPointGroup[];
/**
* All difficulty points.
*/
difficultyPoints: DifficultyPoint[];
/**
* All effect points.
*/
effectPoints: EffectPoint[];
/**
* All sample points.
*/
samplePoints: SamplePoint[];
/**
* All timing points.
*/
timingPoints: TimingPoint[];
/**
* All control points.
*/
get allPoints(): ControlPoint[];
/**
* Finds a group at the specified time.
* @param time The time.
* @returns A group at the specified time.
*/
groupAt(time: number): ControlPointGroup;
/**
* Finds a difficulty point at the specified time.
* @param time The time.
* @returns A difficulty point at the specified time.
*/
difficultyPointAt(time: number): DifficultyPoint;
/**
* Finds a effect point at the specified time.
* @param time The time.
* @returns A effect point at the specified time.
*/
effectPointAt(time: number): EffectPoint;
/**
* Finds a sample point at the specified time.
* @param time The time.
* @returns A sample point at the specified time.
*/
samplePointAt(time: number): SamplePoint;
/**
* Finds a timing point at the specified time.
* @param time The time.
* @returns A timing point at the specified time.
*/
timingPointAt(time: number): TimingPoint;
/**
* Adds a new unique control point to the group at the specified time.
* @param point A control point.
* @param time The time.
* @returns Whether the control point has been added to the group.
*/
add(point: ControlPoint, time: number): boolean;
getCurrentList(newPoint: ControlPoint): ControlPoint[];
checkAlreadyExisting(time: number, newPoint: ControlPoint): boolean;
/**
* Removes a control point from the group at the specified time.
* @param point A control point.
* @param time The time.
* @returns Whether the control point has been removed from the group.
*/
remove(point: ControlPoint, time: number): boolean;
/**
* Removes all control points.
*/
clear(): void;
/**
* Creates a copy of this information about control points.
* Non-primitive properties will be copied via their own clone() method.
* @returns A copied information about control points.
*/
clone(): ControlPointInfo;
}
/**
* Hit sound types.
*/
declare enum HitSound {
None = 0,
Normal = 1,
Whistle = 2,
Finish = 4,
Clap = 8
}
/**
* Hit types.
*/
declare enum HitType {
Normal = 1,
Slider = 2,
NewCombo = 4,
Spinner = 8,
ComboSkip1 = 16,
ComboSkip2 = 32,
ComboSkip3 = 64,
ComboOffset = 112,
Hold = 128
}
/**
* Slider curve types.
*/
declare enum PathType {
Catmull = 'C',
Bezier = 'B',
Linear = 'L',
PerfectCurve = 'P'
}
/**
* Types of slider events.
*/
declare enum SliderEventType {
Tick = 1,
LegacyLastTick = 2,
Head = 4,
Tail = 8,
Repeat = 16
}
/**
* An object describing the name of a sound file,
* which has the following format:
*
* <sampleSet>-hit<hitSound><index>.wav
*/
declare class HitSample {
/**
* The bank to load the sample from.
*/
sampleSet: string;
/**
* Hit sound data.
*/
hitSound: string;
/**
* Custom index of hit sample.
*/
customIndex: number;
/**
* An optional suffix to provide priority lookup.
* Falls back to non-suffixed name.
*/
suffix: string;
/**
* The sample volume.
*/
volume: number;
/**
* Whether this hit sample is layered.
*/
isLayered: boolean;
/**
* The filename of this hit sample.
*/
filename: string;
/**
* Creates a copy of this hit sample.
* Non-primitive properties will be copied via their own clone() method.
* @returns A copied hit sample.
*/
clone(): HitSample;
}
declare enum HitResult {
/**
* Indicates that the object has not been judged yet.
*/
None = 0,
/**
* Indicates that the object has been judged as a miss.
* This miss window should determine how early a hit can be before it is considered
* for judgement (as opposed to being ignored as "too far in the future").
* It should also define when a forced miss should be triggered (as a result of no user input in time).
*/
Miss = 1,
Meh = 2,
Ok = 3,
Good = 4,
Great = 5,
Perfect = 6,
/**