Skip to main content

CoolUtil

Kindclass
Packagebackend
Full namebackend.CoolUtil
Sourcesource/backend/CoolUtil.hx

Public fields​

NameTypeStaticDefaultNotes
defaultDifficultiesArray<String>yes['Easy', 'Normal', 'Hard']—
defaultDifficultiesFullArray<String>yes['Easy', 'Normal', 'Hard', 'Erect', 'Nightmare']—
defaultDifficultyStringyes'Normal'—
defaultDifficultyThingsArray<String>yes['Normal', 'normal']—
difficultiesArray<String>yes[]—
currentDifficultyStringyes'Normal'—
defaultSongsArray<String>yes[—
defaultSongsFormattedArray<String>yes['dad-battle', 'philly-nice', 'satin-panties', 'winter-horrorland', 'lit-up']—
defaultCharactersArray<String>yes[—
resWFloatyes1#if desktop && !air · Resolution scaling is used with native resizable windows, not AIR's window model.
resHFloatyes1#if desktop && !air
baseWFloatyes1#if desktop && !air
baseHFloatyes1#if desktop && !air
getUsername—yesCoolSystemStuff.getUsername—
getUserPath—yesCoolSystemStuff.getUserPath—
getTempPath—yesCoolSystemStuff.getTempPath—
beatsArray<Int>yes[final

Public methods​

quantize​

static inline function quantize(f:Float, snap:Float)
ParameterTypeDefault
fFloat—
snapFloat—

View source

isVersionNewer​

static function isVersionNewer(versionA:String, versionB:String):Bool
ParameterTypeDefault
versionAString—
versionBString—

View source

resetResScale​

static inline function resetResScale(wid:Int = 1280, height:Int = 720)

Only compiled when #if desktop && !air.

ParameterTypeDefault
wid (optional)Int1280
height (optional)Int720

View source

selfDestruct​

static function selfDestruct():Void // this function instantly deletes your JS Engine build. i stole this from vs marcello source so if this gets used for malicious purposes im removing it

View source

checkForOBS​

static function checkForOBS():Bool

View source

hasVersion​

static function hasVersion(vers:String):Bool

Can be used to check if your using a specific version of an OS (or if your using a certain OS).

ParameterTypeDefault
versString—

View source

getSongDuration​

static function getSongDuration(musicTime:Float, musicLength:Float, precision:Int = 0):String
ParameterTypeDefault
musicTimeFloat—
musicLengthFloat—
precision (optional)Int0

View source

formatTime​

static function formatTime(musicTime:Float, precision:Int = 0):String
ParameterTypeDefault
musicTimeFloat—
precision (optional)Int0

View source

formatCompactNumber​

static function formatCompactNumber(number:Float):String
ParameterTypeDefault
numberFloat—

View source

zeroFill​

static function zeroFill(value:Int, digits:Int)
ParameterTypeDefault
valueInt—
digitsInt—

View source

getHealthColors​

static function getHealthColors(char:Character):Array<Int>
ParameterTypeDefault
charCharacter—

View source

checkNoteQuant​

static function checkNoteQuant(note:Note, timeToCheck:Float, ?rgbShader:RGBShaderReference)
ParameterTypeDefault
noteNote—
timeToCheckFloat—
rgbShader (optional)RGBShaderReference—

View source

getDifficultyFilePath​

static function getDifficultyFilePath(num:Null<Int> = null)
ParameterTypeDefault
num (optional)Null<Int>null

View source

difficultyString​

static function difficultyString():String

View source

getMinAndMax​

static function getMinAndMax(value1:Float, value2:Float):Array<Float>
ParameterTypeDefault
value1Float—
value2Float—

View source

boundTo​

static inline function boundTo(value:Float, min:Float, max:Float):Float
ParameterTypeDefault
valueFloat—
minFloat—
maxFloat—

View source

clamp​

static inline function clamp(value:Float, min:Float, max:Float):Float
ParameterTypeDefault
valueFloat—
minFloat—
maxFloat—

View source

coolTextFile​

static inline function coolTextFile(path:String):Array<String>
ParameterTypeDefault
pathString—

View source

colorFromString​

static inline function colorFromString(color:String):FlxColor
ParameterTypeDefault
colorString—

View source

listFromString​

static inline function listFromString(string:String):Array<String>
ParameterTypeDefault
stringString—

View source

floorDecimal​

static function floorDecimal(value:Float, decimals:Int):Float
ParameterTypeDefault
valueFloat—
decimalsInt—

View source

dominantColor​

static function dominantColor(sprite:flixel.FlxSprite):Int
ParameterTypeDefault
spriteflixel.FlxSprite—

View source

coolError​

static function coolError(message:Null<String> = null, title:Null<String> = null):Void

Funny handler for Application.current.window.alert that doesn't crash on Linux and shit.

@param message Message of the error.
@param title Title of the error.

@author Leather128
ParameterTypeDefault
message (optional)Null<String>null
title (optional)Null<String>null

View source

numberArray​

static function numberArray(max:Int, min = 0):Array<Int>
ParameterTypeDefault
maxInt—
min (optional)Dynamic0

View source

browserLoad​

static function browserLoad(site:String)
ParameterTypeDefault
siteString—

View source

getNoteAmount​

static function getNoteAmount(song:SwagSong, bothSides:Bool = true, oppNotes:Bool = false):Int
ParameterTypeDefault
songSwagSong—
bothSides (optional)Booltrue
oppNotes (optional)Boolfalse

View source

getSavePath​

static inline function getSavePath():String

View source

setTextBorderFromString​

static function setTextBorderFromString(text:FlxText, border:String)
ParameterTypeDefault
textFlxText—
borderString—

View source

showPopUp​

static function showPopUp(message:String, title:String):Void
ParameterTypeDefault
messageString—
titleString—

View source

Internals​

Private / internal members
FieldTypeStatic
SUFFIXES1Array<String>yes
TEN_SUFFIXESArray<Array<String>>yes
DEC_SUFFIXESArray<Array<Dynamic>>yes
CENTI_SUFFIXESArray<Array<String>>yes
foundQuantIntyes
theCurBPMFloatyes
stepCrochetFloatyes
latestBpmChangeIndex—yes
latestBpmChange—yes