Files
CodenameEngine/pages/funkin/backend/utils/CoolUtil.html
T
23648695e9 More Optimizations (#188)
* bye

* Updated docs

* Adding docs to gitignore

Useless to keep and upload too plus it contains sensitive stuff that takes when generating docs (eg: repo's saved path)
It's prob smth that the docs program uses temporarily to generate

* Re-exported gf chrimah

Atlas exported christmas gf by @EnderNile8182
Gf adjusted offsets by me
No more black lines

Co-Authored-By: Nile <102095746+endernile8182@users.noreply.github.com>

* Custom Credits

* Better Custom Credits

* Custom Credits template

* Re-exported gf car

Atlas exported car gf by @EnderNile8182
I've edited some strings in the xml
No more black lines

Co-Authored-By: Nile <102095746+endernile8182@users.noreply.github.com>

* Re-exported gf tank

Atlas exported tank gf by @EnderNile8182
Gf adjusted offsets by me
No more black lines

Co-Authored-By: Nile <102095746+endernile8182@users.noreply.github.com>

* Yay finished gfs

* Better Icons

Mainly Fixed offsets and adjust Tankman ones (some transparent pixels)

* Added bf x gf week 7 gameover

* verbose!!!!!!!!!!

❗

* tank bg "bug" fix

it was also giving an error
what the hell is tankBg even

* No more game freeze for desktop on freeplay

* Some freeplay optimisations

* Making .temp folder hidden

idk i found it ugly

* Reupdated docs

---------

Co-authored-by: Nile <102095746+endernile8182@users.noreply.github.com>
2023-07-19 15:48:20 -07:00

17 lines
36 KiB
HTML
Vendored

<!DOCTYPE html>
<html lang="en"><!-- use theme color or fallback -->
<!--use textcolor from settings, otherwise create a contrasting color to theme color-->
<head><meta charset="utf-8"/><link href="../../../bootstrap/css/bootstrap.min.css" rel="stylesheet"/><link href="../../../bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"/><link href="../../../bootstrap/css/bootstrap-select.min.css" rel="stylesheet"/><link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600,600italic,400" rel="stylesheet" type="text/css"/><link href="https://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet" type="text/css"/><script src="../../../jquery-1.9.1.min.js"></script><script src="../../../bootstrap/js/bootstrap.min.js"></script><script src="../../../bootstrap/js/bootstrap-select.min.js"></script><link href="../../../styles.css" rel="stylesheet"/><link href="../../../extra-styles.css" rel="stylesheet"/><link href="../../../haxe-nav.css" rel="stylesheet"/><link href="../../../dark-mode.css" rel="stylesheet"/><script>var dox = {rootPath: "../../../",platforms: ["doc"]};</script><script src="../../../nav.js"></script><script src="../../../index.js"></script><link rel="icon" href="../../../favicon.ico" type="image/x-icon"/><title>funkin.backend.utils.CoolUtil</title></head><body><script>/* Here to prevent flash of unstyled content */let systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;if ((!localStorage.theme && systemDarkMode) || localStorage.theme == "dark") {document.body.style.backgroundColor = "#111";document.body.style.opacity = "0";document.addEventListener("DOMContentLoaded", function(event) {toggleTheme();document.body.style.backgroundColor = "";document.body.style.opacity = "";});}</script><style>
.navbar .brand {
display: inline-block;
float: none;
text-shadow: 0 0 0 transparent;
}
</style><nav class="nav"><div class="navbar"><div class="navbar-inner" style="background:#FAFAFA; border-bottom:1px solid rgba(0,0,0,.09)"><div class="container"><a class="brand" style="color:#000000" href="../../../">API Documentation</a><a href="#" id="theme-toggle" class="brand" style="color:#000000" onclick="toggleTheme()" title="Toggle Dark Mode"><i class="fa fa-moon-o"></i></a></div></div></div></nav><div class="container main-content"><div class="row-fluid"><div class="span3"><div class="well sidebar-nav"><form class="form-search" id="searchForm"><div class="input-prepend input-block-level"><span class="add-on"><i class="fa fa-search"></i></span><input id="search" type="text" placeholder="Filter (Ctrl+P)" autocomplete="off"/></div></form></div><div class="well sidebar-nav" id="explorer"><div id="nav"></div></div></div><div class="span9"><div class="page-header"><h1><small>class</small> CoolUtil</h1><h4><small>package <a href="../../../funkin/backend/utils/index.html">funkin.backend.utils</a></small></h4> <span class="label label-meta label-meta-directlyUsed" title="Marks types that are directly referenced by non-extern code.">@:directlyUsed</span><span class="label label-meta label-meta-build" title="Builds a class or enum from a macro.">@:build(hscript.ClassExtendMacro.build())</span><span class="label label-meta label-meta-allow" title="Allows private access from package, type or field.">@:allow(funkin.game.PlayState)</span></div><div class="body"><div class="doc doc-main"><p></p></div><h3 class="section">Static methods</h3><div class="fields"><div class="field "><a name="addEndZeros"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#addEndZeros"><span class="identifier">addEndZeros</span></a>(<span style="white-space:nowrap">str:<span class="type">String</span>,</span> <span style="white-space:nowrap">num:<span class="type">Int</span></span>):<span class="type">String</span></code></h3><div class="doc"><p>Add several zeros at the end of a string, so that <code>2</code> becomes <code>20</code>, useful for ms.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>str</code></th><td><p>String to add zeros</p></td></tr><tr><th style="width:25%;"><code>num</code></th><td><p>The length required</p></td></tr></table></div></div><div class="field "><a name="addZeros"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#addZeros"><span class="identifier">addZeros</span></a>(<span style="white-space:nowrap">str:<span class="type">String</span>,</span> <span style="white-space:nowrap">num:<span class="type">Int</span></span>):<span class="type">String</span></code></h3><div class="doc"><p>Add several zeros at the beginning of a string, so that <code>2</code> becomes <code>02</code>.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>str</code></th><td><p>String to add zeros</p></td></tr><tr><th style="width:25%;"><code>num</code></th><td><p>The length required</p></td></tr></table></div></div><div class="field "><a name="cameraCenter"></a><h3 class="anchor"><code><span class="label label-meta label-meta-value" title="Used to store default values for fields and function arguments.">@:value({ axes : XY })</span><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#cameraCenter"><span class="identifier">cameraCenter</span></a>(<span style="white-space:nowrap">obj:<span class="type">FlxObject</span>,</span> <span style="white-space:nowrap">cam:<span class="type">FlxCamera</span>,</span> <span style="white-space:nowrap">axes:<span class="type">FlxAxes</span> = XY</span>):<span class="type">Void</span></code></h3><div class="doc"><p>Centers an object in a camera's field, basically <code>screenCenter()</code> but <code>camera.width</code> and <code>camera.height</code> are used instead of <code>FlxG.width</code> and <code>FlxG.height</code>.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>obj</code></th><td><p>Sprite to center</p></td></tr><tr><th style="width:25%;"><code>cam</code></th><td><p>Camera</p></td></tr><tr><th style="width:25%;"><code>axes</code></th><td><p>Axes (XY)</p></td></tr></table></div></div><div class="field "><a name="clear"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#clear"><span class="identifier">clear</span></a>&lt;<span class="type">T</span>&gt;(<span style="white-space:nowrap">array:<span class="type">Array</span>&lt;<span class="type">T</span>&gt;</span>):<span class="type">Array</span>&lt;<span class="type">T</span>&gt;</code></h3><div class="doc"><p>Clears the content of an array</p></div></div><div class="field "><a name="coolTextFile"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#coolTextFile"><span class="identifier">coolTextFile</span></a>(<span style="white-space:nowrap">path:<span class="type">String</span></span>):<span class="type">Array</span>&lt;<span class="type">String</span>&gt;</code></h3><div class="doc"><p>Allows you to split a text file from a path, into a "cool text file", AKA a list. Allows for comments. For example,
<code># comment</code>
<code>test1</code>
<code> </code>
<code>test2</code>
will return <code>["test1", "test2"]</code></p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>path</code></th><td></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>Array<String></p></div></div></div><div class="field "><a name="copyColorTransform"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#copyColorTransform"><span class="identifier">copyColorTransform</span></a>(<span style="white-space:nowrap">color1:<span class="type">ColorTransform</span>,</span> <span style="white-space:nowrap">color2:<span class="type">ColorTransform</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Copies a color transform from color1 to color2</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>color1</code></th><td><p>Color transform to copy to</p></td></tr><tr><th style="width:25%;"><code>color2</code></th><td><p>Color transform to copy from</p></td></tr></table></div></div><div class="field "><a name="deleteFolder"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#deleteFolder"><span class="identifier">deleteFolder</span></a>(<span style="white-space:nowrap">delete:<span class="type">String</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Deletes a folder recursively</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>delete</code></th><td><p>Path to the folder.</p></td></tr></table></div></div><div class="field "><a name="floorInt"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#floorInt"><span class="identifier">floorInt</span></a>(<span style="white-space:nowrap">e:<span class="type">Float</span></span>):<span class="type">Int</span></code></h3><div class="doc"><p>Equivalent of <code>Math.floor</code>, except doesn't require a Int -> Float -> Int conversion.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>e</code></th><td><p>Value to get the floor of.</p></td></tr></table></div></div><div class="field "><a name="fpsLerp"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#fpsLerp"><span class="identifier">fpsLerp</span></a>(<span style="white-space:nowrap">v1:<span class="type">Float</span>,</span> <span style="white-space:nowrap">v2:<span class="type">Float</span>,</span> <span style="white-space:nowrap">ratio:<span class="type">Float</span></span>):<span class="type">Float</span></code></h3><div class="doc"><p>Alternative linear interpolation function for each frame use, without worrying about framerate changes.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>v1</code></th><td><p>Begin value</p></td></tr><tr><th style="width:25%;"><code>v2</code></th><td><p>End value</p></td></tr><tr><th style="width:25%;"><code>ratio</code></th><td><p>Ratio</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>Float Final value</p></div></div></div><div class="field "><a name="getAtt"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#getAtt"><span class="identifier">getAtt</span></a>(<span style="white-space:nowrap">xml:<span class="type">Access</span>,</span> <span style="white-space:nowrap">name:<span class="type">String</span></span>):<span class="type">String</span></code></h3><div class="doc"><p>Gets an XML attribute from an <code>Access</code> abstract, without throwing an exception if invalid.
Example: <code>xml.getAtt("test").getDefault("Hello, World!");</code></p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>xml</code></th><td><p>XML to get the attribute from</p></td></tr><tr><th style="width:25%;"><code>name</code></th><td><p>Name of the attribute</p></td></tr></table></div></div><div class="field "><a name="getColorFromDynamic"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#getColorFromDynamic"><span class="identifier">getColorFromDynamic</span></a>(<span style="white-space:nowrap">c:<span class="type">Dynamic</span></span>):<span class="type">Null</span>&lt;<span class="type">FlxColor</span>&gt;</code></h3><div class="doc"><p>Tries to get a color from a <code>Dynamic</code> variable.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>c</code></th><td><p><code>Dynamic</code> color.</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>The result color, or <code>null</code> if invalid.</p></div></div></div><div class="field "><a name="getDefault"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#getDefault"><span class="identifier">getDefault</span></a>&lt;<span class="type">T</span>&gt;(<span style="white-space:nowrap">v:<span class="type">Null</span>&lt;<span class="type">T</span>&gt;,</span> <span style="white-space:nowrap">defaultValue:<span class="type">T</span></span>):<span class="type">T</span></code></h3><div class="doc"><p></p></div></div><div class="field "><a name="getFPSRatio"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#getFPSRatio"><span class="identifier">getFPSRatio</span></a>(<span style="white-space:nowrap">ratio:<span class="type">Float</span></span>):<span class="type">Float</span></code></h3><div class="doc"><p>Modifies a lerp ratio based on current FPS to keep a stable speed on higher framerate.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>ratio</code></th><td><p>Ratio</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>FPS-Modified Ratio</p></div></div></div><div class="field "><a name="getLastExceptionStack"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#getLastExceptionStack"><span class="identifier">getLastExceptionStack</span></a>():<span class="type">String</span></code></h3><div class="doc"><p></p></div></div><div class="field "><a name="getMacroAbstractClass"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#getMacroAbstractClass"><span class="identifier">getMacroAbstractClass</span></a>(<span style="white-space:nowrap">className:<span class="type">String</span></span>):<span class="type">Class</span>&lt;<span class="type">Dynamic</span>&gt;</code></h3><div class="doc"><p>Gets the macro class created by hscript-improved for an abstract / enum</p></div></div><div class="field "><a name="getSizeString"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#getSizeString"><span class="identifier">getSizeString</span></a>(<span style="white-space:nowrap">size:<span class="type">Float</span></span>):<span class="type">String</span></code></h3><div class="doc"><p>Returns a string representation of a size, following this format: <code>1.02 GB</code>, <code>134.00 MB</code></p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>size</code></th><td><p>Size to convert ot string</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>String Result string representation</p></div></div></div><div class="field "><a name="indexOfFromLast"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#indexOfFromLast"><span class="identifier">indexOfFromLast</span></a>&lt;<span class="type">T</span>&gt;(<span style="white-space:nowrap">array:<span class="type">Array</span>&lt;<span class="type">T</span>&gt;,</span> <span style="white-space:nowrap">element:<span class="type">T</span></span>):<span class="type">Int</span></code></h3><div class="doc"><p>Basically indexOf, but starts from the end.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>array</code></th><td><p>Array to scan</p></td></tr><tr><th style="width:25%;"><code>element</code></th><td><p>Element</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>Index, or -1 if unsuccessful.</p></div></div></div><div class="field "><a name="isNaN"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#isNaN"><span class="identifier">isNaN</span></a>(<span style="white-space:nowrap">v:<span class="type">Dynamic</span></span>):<span class="type">Bool</span></code></h3><div class="doc"><p>Whenever a value is NaN or not.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>v</code></th><td><p>Value</p></td></tr></table></div></div><div class="field "><a name="keyToString"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#keyToString"><span class="identifier">keyToString</span></a>(<span style="white-space:nowrap">key:<span class="type">Null</span>&lt;<span class="type">FlxKey</span>&gt;</span>):<span class="type">String</span></code></h3><div class="doc"><p>Returns a simple string representation of a FlxKey. Used in Controls options.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>key</code></th><td><p>Key</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>Simple representation</p></div></div></div><div class="field "><a name="last"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#last"><span class="identifier">last</span></a>&lt;<span class="type">T</span>&gt;(<span style="white-space:nowrap">array:<span class="type">Array</span>&lt;<span class="type">T</span>&gt;</span>):<span class="type">T</span></code></h3><div class="doc"><p>Returns the last of an Array</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>array</code></th><td><p>Array</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>T Last element</p></div></div></div><div class="field "><a name="lerpColor"></a><h3 class="anchor"><code><span class="label label-meta label-meta-value" title="Used to store default values for fields and function arguments.">@:value({ fpsSensitive : false })</span><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#lerpColor"><span class="identifier">lerpColor</span></a>(<span style="white-space:nowrap">color1:<span class="type">FlxColor</span>,</span> <span style="white-space:nowrap">color2:<span class="type">FlxColor</span>,</span> <span style="white-space:nowrap">ratio:<span class="type">Float</span>,</span> <span style="white-space:nowrap">fpsSensitive:<span class="type">Bool</span> = false</span>):<span class="type">FlxColor</span></code></h3><div class="doc"><p>Lerps from color1 into color2 (Shortcut to <code>FlxColor.interpolate</code>)</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>color1</code></th><td><p>Color 1</p></td></tr><tr><th style="width:25%;"><code>color2</code></th><td><p>Color 2</p></td></tr><tr><th style="width:25%;"><code>ratio</code></th><td><p>Ratio</p></td></tr><tr><th style="width:25%;"><code>fpsSensitive</code></th><td><p>Whenever the ratio should be fps sensitive (adapted when game is running at 120 instead of 60)</p></td></tr></table></div></div><div class="field "><a name="loadAnimatedGraphic"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#loadAnimatedGraphic"><span class="identifier">loadAnimatedGraphic</span></a>(<span style="white-space:nowrap">spr:<span class="type">FlxSprite</span>,</span> <span style="white-space:nowrap">path:<span class="type">String</span></span>):<span class="type">FlxSprite</span></code></h3><div class="doc"><p>Loads an animated graphic, and automatically animates it.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>spr</code></th><td><p>Sprite to load the graphic for</p></td></tr><tr><th style="width:25%;"><code>path</code></th><td><p>Path to the graphic</p></td></tr></table></div></div><div class="field "><a name="maxInt"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#maxInt"><span class="identifier">maxInt</span></a>(<span style="white-space:nowrap">p1:<span class="type">Int</span>,</span> <span style="white-space:nowrap">p2:<span class="type">Int</span></span>):<span class="type">Int</span></code></h3><div class="doc"><p>Equivalent of <code>Math.max</code>, except doesn't require a Int -> Float -> Int conversion.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>p1</code></th><td></td></tr><tr><th style="width:25%;"><code>p2</code></th><td></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>return p1 &lt; p2 ? p2 : p1</p></div></div></div><div class="field "><a name="numberArray"></a><h3 class="anchor"><code><span class="label label-meta label-meta-value" title="Used to store default values for fields and function arguments.">@:value({ min : 0 })</span><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#numberArray"><span class="identifier">numberArray</span></a>(<span style="white-space:nowrap">max:<span class="type">Int</span>,</span> <span style="white-space:nowrap">min:<span class="type">Int</span> = 0</span>):<span class="type">Array</span>&lt;<span class="type">Int</span>&gt;</code></h3><div class="doc"><p>Returns an array of number from min to max. Equivalent of <code>[for (i in min...max) i]</code>.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>max</code></th><td><p>Max value</p></td></tr><tr><th style="width:25%;"><code>min</code></th><td><p>Minimal value (0)</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>Array<Int> Final array</p></div></div></div><div class="field "><a name="openURL"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#openURL"><span class="identifier">openURL</span></a>(<span style="white-space:nowrap">url:<span class="type">String</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Opens an URL in the browser.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>null</code></th><td><p>url</p></td></tr></table></div></div><div class="field "><a name="parseJson"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#parseJson"><span class="identifier">parseJson</span></a>(<span style="white-space:nowrap">assetPath:<span class="type">String</span></span>):Unknown</code></h3><div class="doc"><p>Shortcut to parse JSON from an Asset path</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>assetPath</code></th><td><p>Path to the JSON asset.</p></td></tr></table></div></div><div class="field "><a name="parseJsonString"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#parseJsonString"><span class="identifier">parseJsonString</span></a>(<span style="white-space:nowrap">str:<span class="type">String</span></span>):Unknown</code></h3><div class="doc"><p>Shortcut to parse a JSON string</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>str</code></th><td><p>Path to the JSON string</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>Parsed JSON</p></div></div></div><div class="field "><a name="playMenuSFX"></a><h3 class="anchor"><code><span class="label label-meta label-meta-value" title="Used to store default values for fields and function arguments.">@:value({ volume : 1, menuSFX : SCROLL })</span><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#playMenuSFX"><span class="identifier">playMenuSFX</span></a>(<span style="white-space:nowrap">menuSFX:<a class="type" title="funkin.backend.utils.CoolSfx - SFXs to play using playMenuSFX." href="../../../funkin/backend/utils/CoolSfx.html">CoolSfx</a> = SCROLL,</span> <span style="white-space:nowrap">volume:<span class="type">Float</span> = 1</span>):<span class="type">Void</span></code></h3><div class="doc"><p>Plays a specified Menu SFX.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>menuSFX</code></th><td><p>Menu SFX to play</p></td></tr><tr><th style="width:25%;"><code>volume</code></th><td><p>At which volume it should play</p></td></tr></table></div></div><div class="field "><a name="playMenuSong"></a><h3 class="anchor"><code><span class="label label-meta label-meta-value" title="Used to store default values for fields and function arguments.">@:value({ fadeIn : false })</span><span class="label label-static">static</span><a href="#playMenuSong"><span class="identifier">playMenuSong</span></a>(<span style="white-space:nowrap">fadeIn:<span class="type">Bool</span> = false</span>):<span class="type">Void</span></code></h3><div class="doc"><p>Plays the main menu theme.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>null</code></th><td><p>fadeIn</p></td></tr></table></div></div><div class="field "><a name="playMusic"></a><h3 class="anchor"><code><span class="label label-meta label-meta-value" title="Used to store default values for fields and function arguments.">@:value({ DefaultBPM : 102, Looped : true, Volume : 1, Persist : false })</span><span class="label label-static">static</span><a href="#playMusic"><span class="identifier">playMusic</span></a>(<span style="white-space:nowrap">path:<span class="type">String</span>,</span> <span style="white-space:nowrap">Persist:<span class="type">Bool</span> = false,</span> <span style="white-space:nowrap">Volume:<span class="type">Int</span> = 1,</span> <span style="white-space:nowrap">Looped:<span class="type">Bool</span> = true,</span> <span style="white-space:nowrap">DefaultBPM:<span class="type">Int</span> = 102,</span> <span style="white-space:nowrap">?Group:<span class="type">FlxSoundGroup</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Plays music, while resetting the Conductor, and taking info from INI in count.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>path</code></th><td><p>Path to the music</p></td></tr><tr><th style="width:25%;"><code>Persist</code></th><td><p>Whenever the music should persist while switching states</p></td></tr><tr><th style="width:25%;"><code>DefaultBPM</code></th><td><p>Default BPM of the music (102)</p></td></tr><tr><th style="width:25%;"><code>Volume</code></th><td><p>Volume of the music (1)</p></td></tr><tr><th style="width:25%;"><code>Looped</code></th><td><p>Whenever the music loops (true)</p></td></tr><tr><th style="width:25%;"><code>Group</code></th><td><p>A group that this music belongs to (default)</p></td></tr></table></div></div><div class="field "><a name="preloadCharacter"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#preloadCharacter"><span class="identifier">preloadCharacter</span></a>(<span style="white-space:nowrap">name:<span class="type">String</span>,</span> <span style="white-space:nowrap">?spriteName:<span class="type">String</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Preloads a character.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>name</code></th><td><p>Character name</p></td></tr><tr><th style="width:25%;"><code>spriteName</code></th><td><p>(Optional) sprite name.</p></td></tr></table></div></div><div class="field "><a name="pushGroup"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#pushGroup"><span class="identifier">pushGroup</span></a>&lt;<span class="type">T</span>&gt;(<span style="white-space:nowrap">array:<span class="type">Array</span>&lt;<span class="type">T</span>&gt;,</span> <span style="white-space:nowrap">args:<span class="type">Rest</span>&lt;<span class="type">T</span>&gt;</span>):<span class="type">Array</span>&lt;<span class="type">T</span>&gt;</code></h3><div class="doc"><p>Push an entire group into an array.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>array</code></th><td><p>Array to push the group into</p></td></tr><tr><th style="width:25%;"><code>...args</code></th><td><p>Group entries</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>Array<T></p></div></div></div><div class="field "><a name="replay"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#replay"><span class="identifier">replay</span></a>(<span style="white-space:nowrap">sound:<span class="type">FlxSound</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Stops a sound, set its time to 0 then play it again.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>sound</code></th><td><p>Sound to replay.</p></td></tr></table></div></div><div class="field "><a name="resetSprite"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#resetSprite"><span class="identifier">resetSprite</span></a>(<span style="white-space:nowrap">spr:<span class="type">FlxSprite</span>,</span> <span style="white-space:nowrap">x:<span class="type">Float</span>,</span> <span style="white-space:nowrap">y:<span class="type">Float</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Resets an FlxSprite</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>spr</code></th><td><p>Sprite to reset</p></td></tr><tr><th style="width:25%;"><code>x</code></th><td><p>New X position</p></td></tr><tr><th style="width:25%;"><code>y</code></th><td><p>New Y position</p></td></tr></table></div></div><div class="field "><a name="setFieldDefault"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#setFieldDefault"><span class="identifier">setFieldDefault</span></a>&lt;<span class="type">T</span>&gt;(<span style="white-space:nowrap">v:<span class="type">Dynamic</span>,</span> <span style="white-space:nowrap">name:<span class="type">String</span>,</span> <span style="white-space:nowrap">defaultValue:<span class="type">T</span></span>):<span class="type">T</span></code></h3><div class="doc"><p>Sets a field's default value, and returns it. In case it already exists, returns the existing one.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>v</code></th><td><p>Dynamic to set the default value to</p></td></tr><tr><th style="width:25%;"><code>name</code></th><td><p>Name of the value</p></td></tr><tr><th style="width:25%;"><code>defaultValue</code></th><td><p>Default value</p></td></tr></table><p class="javadoc">Returns:</p><div class="indent inline-content"><p>T New/old value.</p></div></div></div><div class="field "><a name="setMusic"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#setMusic"><span class="identifier">setMusic</span></a>(<span style="white-space:nowrap">frontEnd:<span class="type">SoundFrontEnd</span>,</span> <span style="white-space:nowrap">music:<span class="type">FlxSound</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Sets a SoundFrontEnd's music to a FlxSound.
Example: <code>FlxG.sound.setMusic(music);</code></p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>frontEnd</code></th><td><p>SoundFrontEnd to set the music of</p></td></tr><tr><th style="width:25%;"><code>music</code></th><td><p>Music</p></td></tr></table></div></div><div class="field "><a name="setSpriteSize"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#setSpriteSize"><span class="identifier">setSpriteSize</span></a>(<span style="white-space:nowrap">sprite:<span class="type">FlxSprite</span>,</span> <span style="white-space:nowrap">width:<span class="type">Float</span>,</span> <span style="white-space:nowrap">height:<span class="type">Float</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Equivalent of <code>setGraphicSize</code>, except that it can accept floats and automatically updates the hitbox.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>sprite</code></th><td><p>Sprite to set the size of</p></td></tr><tr><th style="width:25%;"><code>width</code></th><td><p>Width</p></td></tr><tr><th style="width:25%;"><code>height</code></th><td><p>Height</p></td></tr></table></div></div><div class="field "><a name="setUnstretchedGraphicSize"></a><h3 class="anchor"><code><span class="label label-meta label-meta-value" title="Used to store default values for fields and function arguments.">@:value({ maxScale : 0, fill : true })</span><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#setUnstretchedGraphicSize"><span class="identifier">setUnstretchedGraphicSize</span></a>(<span style="white-space:nowrap">sprite:<span class="type">FlxSprite</span>,</span> <span style="white-space:nowrap">width:<span class="type">Int</span>,</span> <span style="white-space:nowrap">height:<span class="type">Int</span>,</span> <span style="white-space:nowrap">fill:<span class="type">Bool</span> = true,</span> <span style="white-space:nowrap">maxScale:<span class="type">Float</span> = 0</span>):<span class="type">Void</span></code></h3><div class="doc"><p>Allows you to set a graphic size (ex: 150x150), with proper hitbox without a stretched sprite.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>sprite</code></th><td><p>Sprite to apply the new graphic size to</p></td></tr><tr><th style="width:25%;"><code>width</code></th><td><p>Width</p></td></tr><tr><th style="width:25%;"><code>height</code></th><td><p>Height</p></td></tr><tr><th style="width:25%;"><code>fill</code></th><td><p>Whenever the sprite should fill instead of shrinking (true)</p></td></tr><tr><th style="width:25%;"><code>maxScale</code></th><td><p>Maximum scale (0 / none)</p></td></tr></table></div></div><div class="field "><a name="switchAnimFrames"></a><h3 class="anchor"><code><span class="label label-static">static</span><a href="#switchAnimFrames"><span class="identifier">switchAnimFrames</span></a>(<span style="white-space:nowrap">anim1:<span class="type">FlxAnimation</span>,</span> <span style="white-space:nowrap">anim2:<span class="type">FlxAnimation</span></span>):<span class="type">Void</span></code></h3><div class="doc"><p>Switches frames from 2 FlxAnimations.</p><p class="javadoc">Parameters:</p><table class="table table-bordered params"><tr><th style="width:25%;"><code>anim1</code></th><td><p>First animation</p></td></tr><tr><th style="width:25%;"><code>anim2</code></th><td><p>Second animation</p></td></tr></table></div></div><div class="field "><a name="timeToStr"></a><h3 class="anchor"><code><span class="label label-static">static</span><span class="label label-inline">inline</span><a href="#timeToStr"><span class="identifier">timeToStr</span></a>(<span style="white-space:nowrap">time:<span class="type">Float</span></span>):<span class="type">String</span></code></h3><div class="doc"><p>Converts a timestamp to a readable format such as <code>01:22</code> (<code>mm:ss</code>)</p></div></div></div></div></div></div></div><footer class="section site-footer" style="background:#FAFAFA"><div class="container"><div class="copyright"><p style="color:#000000">&copy; 2023 &nbsp;</p></div></div></footer><script src="../../..//highlighter.js"></script><link href="../../../highlighter.css" rel="stylesheet"/></body></html>