Merge remote-tracking branch 'public/main'
This commit is contained in:
@@ -3,15 +3,20 @@ package funkin.backend;
|
||||
import flixel.graphics.frames.FlxFrame;
|
||||
import flixel.math.FlxAngle;
|
||||
import flixel.math.FlxMatrix;
|
||||
import openfl.display.BlendMode;
|
||||
import openfl.geom.ColorTransform;
|
||||
|
||||
class FlxAnimate extends flxanimate.FlxAnimate {
|
||||
static var rMatrix = new FlxMatrix();
|
||||
|
||||
override function drawLimb(limb:FlxFrame, _rMatrix:FlxMatrix, ?colorTransform:ColorTransform)
|
||||
override function drawLimb(limb:FlxFrame, _rMatrix:FlxMatrix, ?colorTransform:ColorTransform, ?blendMode:BlendMode)
|
||||
{
|
||||
if (alpha == 0 || colorTransform != null && (colorTransform.alphaMultiplier == 0 || colorTransform.alphaOffset == -255) || limb == null || limb.type == EMPTY)
|
||||
return;
|
||||
|
||||
if (blendMode == null)
|
||||
blendMode = BlendMode.NORMAL;
|
||||
|
||||
for (camera in cameras)
|
||||
{
|
||||
rMatrix.identity();
|
||||
@@ -66,7 +71,7 @@ class FlxAnimate extends flxanimate.FlxAnimate {
|
||||
}
|
||||
|
||||
rMatrix.translate(_point.x, _point.y);
|
||||
camera.drawPixels(limb, null, rMatrix, colorTransform, blend, antialiasing, shaderEnabled ? shader : null);
|
||||
camera.drawPixels(limb, null, rMatrix, colorTransform, blendMode, antialiasing, shaderEnabled ? shader : null);
|
||||
#if FLX_DEBUG
|
||||
FlxBasic.visibleCount++;
|
||||
#end
|
||||
@@ -84,4 +89,4 @@ class FlxAnimate extends flxanimate.FlxAnimate {
|
||||
// TODO: ACTUAL OPTIMIZATION
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,12 @@ class ModsFolder {
|
||||
public static function getModsList():Array<String> {
|
||||
var mods:Array<String> = [];
|
||||
#if MOD_SUPPORT
|
||||
for(modFolder in FileSystem.readDirectory(modsPath)) {
|
||||
final modsList:Array<String> = FileSystem.readDirectory(modsPath);
|
||||
|
||||
if (modsList == null || modsList.length <= 0)
|
||||
return mods;
|
||||
|
||||
for (modFolder in modsList) {
|
||||
if (FileSystem.isDirectory('${modsPath}${modFolder}')) {
|
||||
mods.push(modFolder);
|
||||
} else {
|
||||
@@ -152,4 +157,4 @@ class ModsFolder {
|
||||
return prepareModLibrary(libName, new ZipFolderLibrary(zipPath, libName, modName), force);
|
||||
}
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,10 @@ class Main extends Sprite
|
||||
|
||||
public static var game:FunkinGame;
|
||||
|
||||
/**
|
||||
* The time since the game was focused last time in seconds.
|
||||
*/
|
||||
public static var timeSinceFocus(get, never):Float;
|
||||
public static var time:Int = 0;
|
||||
|
||||
// You can pretty much ignore everything from here on - your code should go in your states.
|
||||
@@ -152,6 +156,7 @@ class Main extends Sprite
|
||||
Conductor.init();
|
||||
AudioSwitchFix.init();
|
||||
EventManager.init();
|
||||
FlxG.signals.focusGained.add(onFocus);
|
||||
FlxG.signals.preStateSwitch.add(onStateSwitch);
|
||||
FlxG.signals.postStateSwitch.add(onStateSwitchPost);
|
||||
|
||||
@@ -197,6 +202,10 @@ class Main extends Sprite
|
||||
{asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4));
|
||||
}
|
||||
|
||||
public static function onFocus() {
|
||||
_tickFocused = FlxG.game.ticks;
|
||||
}
|
||||
|
||||
private static function onStateSwitch() {
|
||||
scaleMode.resetSize();
|
||||
}
|
||||
@@ -230,4 +239,9 @@ class Main extends Sprite
|
||||
Sys.setCwd(Path.addTrailingSlash(openfl.filesystem.File.applicationStorageDirectory.nativePath));
|
||||
#end
|
||||
}
|
||||
|
||||
private static var _tickFocused:Float = 0;
|
||||
public static function get_timeSinceFocus():Float {
|
||||
return (FlxG.game.ticks - _tickFocused) / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import funkin.backend.chart.Chart;
|
||||
import funkin.backend.chart.ChartData.ChartMetaData;
|
||||
import funkin.backend.scripting.events.menu.MenuChangeEvent;
|
||||
import funkin.backend.scripting.events.menu.freeplay.*;
|
||||
import funkin.backend.system.Conductor;
|
||||
import funkin.game.HealthIcon;
|
||||
import funkin.savedata.FunkinSave;
|
||||
|
||||
@@ -249,10 +250,12 @@ class FreeplayState extends MusicBeatState
|
||||
else
|
||||
FlxG.log.error('Could not find a Sound asset with an ID of \'$soundPath\'.');
|
||||
|
||||
if (sound != null && autoplayShouldPlay)
|
||||
if (sound != null && autoplayShouldPlay) {
|
||||
FlxG.sound.playMusic(sound, 0);
|
||||
Conductor.changeBPM(songs[curSelected].bpm, songs[curSelected].beatsPerMeasure, songs[curSelected].stepsPerBeat);
|
||||
}
|
||||
}
|
||||
if(!disableAsyncLoading) Main.execAsync(huh);
|
||||
if (!disableAsyncLoading) Main.execAsync(huh);
|
||||
else huh();
|
||||
}
|
||||
songInstPlaying = true;
|
||||
|
||||
@@ -45,7 +45,7 @@ class OptionsScreen extends FlxTypedSpriteGroup<OptionType> {
|
||||
|
||||
if (members.length > 0) {
|
||||
members[curSelected].selected = true;
|
||||
if (controls.ACCEPT || FlxG.mouse.justReleased)
|
||||
if (controls.ACCEPT || (FlxG.mouse.justReleased && Main.timeSinceFocus > 0.25))
|
||||
members[curSelected].onSelect();
|
||||
if (controls.LEFT_P)
|
||||
members[curSelected].onChangeSelection(-1);
|
||||
|
||||
Reference in New Issue
Block a user