Merge branch 'rewrite/master' into freeplay-objects-tweens

This commit is contained in:
Cameron Taylor 2024-04-30 04:15:22 -04:00 committed by GitHub
commit 45941af161
5 changed files with 49 additions and 3 deletions

View file

@ -74,6 +74,7 @@ class InitState extends FlxState
// //
// Setup window events (like callbacks for onWindowClose) // Setup window events (like callbacks for onWindowClose)
// and fullscreen keybind setup
WindowUtil.initWindowEvents(); WindowUtil.initWindowEvents();
// Disable the thing on Windows where it tries to send a bug report to Microsoft because why do they care? // Disable the thing on Windows where it tries to send a bug report to Microsoft because why do they care?
WindowUtil.disableCrashHandler(); WindowUtil.disableCrashHandler();

View file

@ -66,6 +66,7 @@ class Controls extends FlxActionSet
var _volume_up = new FunkinAction(Action.VOLUME_UP); var _volume_up = new FunkinAction(Action.VOLUME_UP);
var _volume_down = new FunkinAction(Action.VOLUME_DOWN); var _volume_down = new FunkinAction(Action.VOLUME_DOWN);
var _volume_mute = new FunkinAction(Action.VOLUME_MUTE); var _volume_mute = new FunkinAction(Action.VOLUME_MUTE);
var _fullscreen = new FunkinAction(Action.FULLSCREEN);
var byName:Map<String, FunkinAction> = new Map<String, FunkinAction>(); var byName:Map<String, FunkinAction> = new Map<String, FunkinAction>();
@ -272,6 +273,11 @@ class Controls extends FlxActionSet
inline function get_VOLUME_MUTE() inline function get_VOLUME_MUTE()
return _volume_mute.check(); return _volume_mute.check();
public var FULLSCREEN(get, never):Bool;
inline function get_FULLSCREEN()
return _fullscreen.check();
public function new(name, scheme:KeyboardScheme = null) public function new(name, scheme:KeyboardScheme = null)
{ {
super(name); super(name);
@ -296,6 +302,7 @@ class Controls extends FlxActionSet
add(_volume_up); add(_volume_up);
add(_volume_down); add(_volume_down);
add(_volume_mute); add(_volume_mute);
add(_fullscreen);
for (action in digitalActions) { for (action in digitalActions) {
if (Std.isOfType(action, FunkinAction)) { if (Std.isOfType(action, FunkinAction)) {
@ -399,6 +406,7 @@ class Controls extends FlxActionSet
case VOLUME_UP: _volume_up; case VOLUME_UP: _volume_up;
case VOLUME_DOWN: _volume_down; case VOLUME_DOWN: _volume_down;
case VOLUME_MUTE: _volume_mute; case VOLUME_MUTE: _volume_mute;
case FULLSCREEN: _fullscreen;
} }
} }
@ -474,6 +482,8 @@ class Controls extends FlxActionSet
func(_volume_down, JUST_PRESSED); func(_volume_down, JUST_PRESSED);
case VOLUME_MUTE: case VOLUME_MUTE:
func(_volume_mute, JUST_PRESSED); func(_volume_mute, JUST_PRESSED);
case FULLSCREEN:
func(_fullscreen, JUST_PRESSED);
} }
} }
@ -668,6 +678,7 @@ class Controls extends FlxActionSet
bindKeys(Control.VOLUME_UP, getDefaultKeybinds(scheme, Control.VOLUME_UP)); bindKeys(Control.VOLUME_UP, getDefaultKeybinds(scheme, Control.VOLUME_UP));
bindKeys(Control.VOLUME_DOWN, getDefaultKeybinds(scheme, Control.VOLUME_DOWN)); bindKeys(Control.VOLUME_DOWN, getDefaultKeybinds(scheme, Control.VOLUME_DOWN));
bindKeys(Control.VOLUME_MUTE, getDefaultKeybinds(scheme, Control.VOLUME_MUTE)); bindKeys(Control.VOLUME_MUTE, getDefaultKeybinds(scheme, Control.VOLUME_MUTE));
bindKeys(Control.FULLSCREEN, getDefaultKeybinds(scheme, Control.FULLSCREEN));
bindMobileLol(); bindMobileLol();
} }
@ -696,6 +707,8 @@ class Controls extends FlxActionSet
case Control.VOLUME_UP: return [PLUS, NUMPADPLUS]; case Control.VOLUME_UP: return [PLUS, NUMPADPLUS];
case Control.VOLUME_DOWN: return [MINUS, NUMPADMINUS]; case Control.VOLUME_DOWN: return [MINUS, NUMPADMINUS];
case Control.VOLUME_MUTE: return [ZERO, NUMPADZERO]; case Control.VOLUME_MUTE: return [ZERO, NUMPADZERO];
case Control.FULLSCREEN: return [FlxKey.F];
} }
case Duo(true): case Duo(true):
switch (control) { switch (control) {
@ -719,6 +732,8 @@ class Controls extends FlxActionSet
case Control.VOLUME_UP: return [PLUS]; case Control.VOLUME_UP: return [PLUS];
case Control.VOLUME_DOWN: return [MINUS]; case Control.VOLUME_DOWN: return [MINUS];
case Control.VOLUME_MUTE: return [ZERO]; case Control.VOLUME_MUTE: return [ZERO];
case Control.FULLSCREEN: return [FlxKey.F];
} }
case Duo(false): case Duo(false):
switch (control) { switch (control) {
@ -742,6 +757,8 @@ class Controls extends FlxActionSet
case Control.VOLUME_UP: return [NUMPADPLUS]; case Control.VOLUME_UP: return [NUMPADPLUS];
case Control.VOLUME_DOWN: return [NUMPADMINUS]; case Control.VOLUME_DOWN: return [NUMPADMINUS];
case Control.VOLUME_MUTE: return [NUMPADZERO]; case Control.VOLUME_MUTE: return [NUMPADZERO];
case Control.FULLSCREEN: return [];
} }
default: default:
// Fallthrough. // Fallthrough.
@ -876,6 +893,7 @@ class Controls extends FlxActionSet
case Control.CUTSCENE_ADVANCE: return [A]; case Control.CUTSCENE_ADVANCE: return [A];
case Control.DEBUG_MENU: return []; case Control.DEBUG_MENU: return [];
case Control.DEBUG_CHART: return []; case Control.DEBUG_CHART: return [];
case Control.FULLSCREEN: return [];
default: default:
// Fallthrough. // Fallthrough.
} }
@ -1398,6 +1416,7 @@ enum Control
ACCEPT; ACCEPT;
BACK; BACK;
PAUSE; PAUSE;
FULLSCREEN;
// CUTSCENE // CUTSCENE
CUTSCENE_ADVANCE; CUTSCENE_ADVANCE;
// SCREENSHOT // SCREENSHOT
@ -1443,6 +1462,7 @@ enum abstract Action(String) to String from String
var BACK = "back"; var BACK = "back";
var PAUSE = "pause"; var PAUSE = "pause";
var RESET = "reset"; var RESET = "reset";
var FULLSCREEN = "fullscreen";
// SCREENSHOT // SCREENSHOT
var SCREENSHOT = "screenshot"; var SCREENSHOT = "screenshot";
// CUTSCENE // CUTSCENE

View file

@ -251,7 +251,7 @@ class TitleState extends MusicBeatState
var transitioning:Bool = false; var transitioning:Bool = false;
override function update(elapsed:Float) override function update(elapsed:Float):Void
{ {
FlxG.bitmapLog.add(FlxG.camera.buffer); FlxG.bitmapLog.add(FlxG.camera.buffer);
@ -286,7 +286,6 @@ class TitleState extends MusicBeatState
} }
if (FlxG.sound.music != null) Conductor.instance.update(FlxG.sound.music.time); if (FlxG.sound.music != null) Conductor.instance.update(FlxG.sound.music.time);
if (FlxG.keys.justPressed.F) FlxG.fullscreen = !FlxG.fullscreen;
// do controls.PAUSE | controls.ACCEPT instead? // do controls.PAUSE | controls.ACCEPT instead?
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER; var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;

View file

@ -120,6 +120,7 @@ class FunkinPreloader extends FlxBasePreloader
var progressRightText:TextField; var progressRightText:TextField;
var dspText:TextField; var dspText:TextField;
var fnfText:TextField;
var enhancedText:TextField; var enhancedText:TextField;
var stereoText:TextField; var stereoText:TextField;
@ -202,6 +203,7 @@ class FunkinPreloader extends FlxBasePreloader
// Create the progress message. // Create the progress message.
progressLeftText = new TextField(); progressLeftText = new TextField();
dspText = new TextField(); dspText = new TextField();
fnfText = new TextField();
enhancedText = new TextField(); enhancedText = new TextField();
stereoText = new TextField(); stereoText = new TextField();
@ -252,6 +254,15 @@ class FunkinPreloader extends FlxBasePreloader
dspText.y = -5; dspText.y = -5;
box.addChild(dspText); box.addChild(dspText);
fnfText.selectable = false;
fnfText.textColor = 0x000000;
fnfText.width = this._width;
fnfText.height = 20;
fnfText.x = 75;
fnfText.y = -5;
fnfText.text = 'FNF';
box.addChild(fnfText);
enhancedText.selectable = false; enhancedText.selectable = false;
enhancedText.textColor = Constants.COLOR_PRELOADER_BAR; enhancedText.textColor = Constants.COLOR_PRELOADER_BAR;
enhancedText.width = this._width; enhancedText.width = this._width;
@ -967,9 +978,13 @@ class FunkinPreloader extends FlxBasePreloader
progressLeftText.text = text; progressLeftText.text = text;
dspText.defaultTextFormat = new TextFormat("Quantico", 20, 0x000000, false); dspText.defaultTextFormat = new TextFormat("Quantico", 20, 0x000000, false);
dspText.text = 'DSP\t\t\t\t\tFNF'; // fukin dum.... dspText.text = 'DSP'; // fukin dum....
dspText.textColor = 0x000000; dspText.textColor = 0x000000;
fnfText.defaultTextFormat = new TextFormat("Quantico", 20, 0x000000, false);
fnfText.text = 'FNF';
fnfText.textColor = 0x000000;
enhancedText.defaultTextFormat = new TextFormat("Inconsolata Black", 16, Constants.COLOR_PRELOADER_BAR, false); enhancedText.defaultTextFormat = new TextFormat("Inconsolata Black", 16, Constants.COLOR_PRELOADER_BAR, false);
enhancedText.text = 'ENHANCED'; enhancedText.text = 'ENHANCED';
enhancedText.textColor = Constants.COLOR_PRELOADER_BAR; enhancedText.textColor = Constants.COLOR_PRELOADER_BAR;
@ -1007,6 +1022,7 @@ class FunkinPreloader extends FlxBasePreloader
progressRightText.alpha = logo.alpha; progressRightText.alpha = logo.alpha;
box.alpha = logo.alpha; box.alpha = logo.alpha;
dspText.alpha = logo.alpha; dspText.alpha = logo.alpha;
fnfText.alpha = logo.alpha;
enhancedText.alpha = logo.alpha; enhancedText.alpha = logo.alpha;
stereoText.alpha = logo.alpha; stereoText.alpha = logo.alpha;
progressLines.alpha = logo.alpha; progressLines.alpha = logo.alpha;

View file

@ -90,6 +90,16 @@ class WindowUtil
openfl.Lib.current.stage.application.onExit.add(function(exitCode:Int) { openfl.Lib.current.stage.application.onExit.add(function(exitCode:Int) {
windowExit.dispatch(exitCode); windowExit.dispatch(exitCode);
}); });
openfl.Lib.current.stage.addEventListener(openfl.events.KeyboardEvent.KEY_DOWN, (e:openfl.events.KeyboardEvent) -> {
for (key in PlayerSettings.player1.controls.getKeysForAction(FULLSCREEN))
{
if (e.keyCode == key)
{
openfl.Lib.application.window.fullscreen = !openfl.Lib.application.window.fullscreen;
}
}
});
} }
/** /**