funkintext
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package funkin.options;
|
||||
|
||||
import funkin.ui.FunkinText;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.util.FlxColor;
|
||||
@@ -18,10 +20,19 @@ class OptionsScreen extends MusicBeatState {
|
||||
|
||||
// public var bgColor:FlxColor = 0xFFFDE871;
|
||||
public var bg:FlxSprite;
|
||||
|
||||
public var descBG:FlxSprite;
|
||||
public var descText:FunkinText;
|
||||
|
||||
public var curSelected:Int = -1;
|
||||
|
||||
public var options:Array<OptionType> = [];
|
||||
|
||||
private var transparentFormat:FlxTextFormat;
|
||||
private var descLetters:Float = 0;
|
||||
|
||||
public var descSpeed:Float = 35;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
instance = this;
|
||||
@@ -39,10 +50,16 @@ class OptionsScreen extends MusicBeatState {
|
||||
bg.antialiasing = true;
|
||||
add(bg);
|
||||
|
||||
descText = new FunkinText(10, 10, FlxG.width - 20);
|
||||
descText.alignment = CENTER;
|
||||
add(descText);
|
||||
|
||||
for(k=>option in options) {
|
||||
option.setPosition(k * 20, 10 + (k * optionHeight));
|
||||
add(option);
|
||||
}
|
||||
|
||||
transparentFormat = new FlxTextFormat(FlxColor.TRANSPARENT);
|
||||
changeSelection(1);
|
||||
}
|
||||
|
||||
@@ -55,6 +72,7 @@ class OptionsScreen extends MusicBeatState {
|
||||
}
|
||||
if (controls.BACK) {
|
||||
Options.applySettings();
|
||||
Options.save();
|
||||
exit();
|
||||
}
|
||||
FlxG.camera.scroll.x = lerp(FlxG.camera.scroll.x, scrollDest.x, 0.25);
|
||||
@@ -65,6 +83,11 @@ class OptionsScreen extends MusicBeatState {
|
||||
|
||||
option.x = -50 + (Math.abs(angle) * 150);
|
||||
}
|
||||
var offset:Int;
|
||||
if (Std.int(descLetters) != (offset = Std.int(Math.min(descText.text.length, descLetters += elapsed * descSpeed)))) {
|
||||
descText.clearFormats();
|
||||
descText.addFormat(transparentFormat, offset, descText.text.length);
|
||||
}
|
||||
}
|
||||
|
||||
public function exit() {
|
||||
@@ -76,12 +99,21 @@ class OptionsScreen extends MusicBeatState {
|
||||
|
||||
public function changeSelection(change:Int) {
|
||||
if (change == 0 && curSelected != -1) return;
|
||||
curSelected = FlxMath.wrap(curSelected + change, 0, options.length - 1);
|
||||
for(e in options)
|
||||
e.selected = false;
|
||||
options[curSelected].selected = true;
|
||||
CoolUtil.playMenuSFX(0);
|
||||
scrollDest.set(-50, -(FlxG.height / 2) + ((curSelected + 0.5) * optionHeight));
|
||||
if (curSelected != (curSelected = FlxMath.wrap(curSelected + change, 0, options.length - 1))) {
|
||||
for(e in options)
|
||||
e.selected = false;
|
||||
options[curSelected].selected = true;
|
||||
scrollDest.set(-50, -(FlxG.height / 2) + ((curSelected + 0.5) * optionHeight));
|
||||
updateDesc();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDesc() {
|
||||
descLetters = 0;
|
||||
descText.text = options[curSelected].desc;
|
||||
descSpeed = descText.text.length;
|
||||
descText.addFormat(transparentFormat, 0, descText.text.length);
|
||||
}
|
||||
|
||||
public override function destroy() {
|
||||
|
||||
@@ -3,9 +3,18 @@ package funkin.options.categories;
|
||||
class BehaviourOptions extends OptionsScreen {
|
||||
public override function create() {
|
||||
options = [
|
||||
new Checkbox("Naughtyness", "naughtyness"),
|
||||
new Checkbox("Flashing Menu", "flashingMenu"),
|
||||
new Checkbox("Camera Zoom on Beat", "camZoomOnBeat"),
|
||||
new Checkbox(
|
||||
"Naughtyness",
|
||||
"If unchecked, will censor Week 7 cutscenes.",
|
||||
"naughtyness"),
|
||||
new Checkbox(
|
||||
"Flashing Menu",
|
||||
"If unchecked, will disable menu flashing when you select an option in the Main Menu, and other flashs will be slower.",
|
||||
"flashingMenu"),
|
||||
new Checkbox(
|
||||
"Camera Zoom on Beat",
|
||||
"If unchecked, will disable camera zooming every 4 beats.",
|
||||
"camZoomOnBeat"),
|
||||
];
|
||||
super.create();
|
||||
}
|
||||
|
||||
@@ -3,9 +3,18 @@ package funkin.options.categories;
|
||||
class GameplayOptions extends OptionsScreen {
|
||||
public override function create() {
|
||||
options = [
|
||||
new Checkbox("Downscroll", "downscroll"),
|
||||
new Checkbox("Auto Pause", "autoPause"),
|
||||
new Checkbox("Antialiasing", "antialiasing"),
|
||||
new Checkbox(
|
||||
"Downscroll",
|
||||
"If checked, notes will go from up to down instead of down to up, like if they were falling.",
|
||||
"downscroll"),
|
||||
new Checkbox(
|
||||
"Auto Pause",
|
||||
"If checked, switching windows will pause the game.",
|
||||
"autoPause"),
|
||||
new Checkbox(
|
||||
"Antialiasing",
|
||||
"If unchecked, will disable antialiasing on every sprite. Can boost performances at the cost of sharper, more pixely sprites.",
|
||||
"antialiasing"),
|
||||
];
|
||||
super.create();
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ package funkin.options.categories;
|
||||
class SaveDataOptions extends OptionsScreen {
|
||||
public override function create() {
|
||||
options = [
|
||||
new TextOption("Reset Save Data", function() {
|
||||
|
||||
new TextOption(
|
||||
"Reset Save Data",
|
||||
"Select this option to reset save data. This will remove all of your highscores.",
|
||||
function() {
|
||||
// TODO!!
|
||||
})
|
||||
];
|
||||
super.create();
|
||||
|
||||
@@ -21,8 +21,8 @@ class Checkbox extends TextOption {
|
||||
];
|
||||
private var baseCheckboxOffset:FlxPoint = FlxPoint.get();
|
||||
|
||||
public function new(text:String, optionName:String) {
|
||||
super(text, null);
|
||||
public function new(text:String, desc:String, optionName:String) {
|
||||
super(text, desc, null);
|
||||
|
||||
checkbox = new FlxSprite(10, -40);
|
||||
checkbox.frames = Paths.getSparrowAtlas('menus/options/checkboxThingie');
|
||||
|
||||
@@ -7,6 +7,12 @@ import funkin.options.OptionsScreen;
|
||||
class OptionType extends FlxSpriteGroup {
|
||||
public var controls(get, null):Controls;
|
||||
public var selected:Bool = false;
|
||||
public var desc:String;
|
||||
|
||||
public function new(desc:String) {
|
||||
super();
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
private function get_controls() {return PlayerSettings.player1.controls;}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ class TextOption extends OptionType {
|
||||
private function get_text() {return __text.text;}
|
||||
private function set_text(v:String) {return __text.text = v;}
|
||||
|
||||
public function new(text:String, selectCallback:Void->Void) {
|
||||
super();
|
||||
public function new(text:String, desc:String, selectCallback:Void->Void) {
|
||||
super(desc);
|
||||
this.selectCallback = selectCallback;
|
||||
add(__text = new Alphabet(100, 20, text, true));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user