funkintext
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
971
|
||||
975
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.game;
|
||||
|
||||
import funkin.ui.FunkinText;
|
||||
import flixel.group.FlxSpriteGroup;
|
||||
import funkin.options.Options;
|
||||
import funkin.scripting.Script;
|
||||
@@ -126,9 +127,9 @@ class PlayState extends MusicBeatState
|
||||
|
||||
public var songScore:Int = 0;
|
||||
public var misses:Int = 0;
|
||||
public var scoreTxt:FlxText;
|
||||
public var missesTxt:FlxText;
|
||||
public var accuracyTxt:FlxText;
|
||||
public var scoreTxt:FunkinText;
|
||||
public var missesTxt:FunkinText;
|
||||
public var accuracyTxt:FunkinText;
|
||||
|
||||
public static var campaignScore:Int = 0;
|
||||
|
||||
@@ -298,17 +299,12 @@ class PlayState extends MusicBeatState
|
||||
add(icon);
|
||||
}
|
||||
|
||||
scoreTxt = new FlxText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Score:0", 20);
|
||||
missesTxt = new FlxText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Misses:0", 20);
|
||||
accuracyTxt = new FlxText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Accuracy:-%", 20);
|
||||
scoreTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Score:0", 20);
|
||||
missesTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Misses:0", 20);
|
||||
accuracyTxt = new FunkinText(healthBarBG.x + 50, healthBarBG.y + 30, Std.int(healthBarBG.width - 100), "Accuracy:-%", 20);
|
||||
|
||||
for(text in [scoreTxt, missesTxt, accuracyTxt]) {
|
||||
text.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE);
|
||||
text.borderStyle = OUTLINE;
|
||||
text.borderSize = 1;
|
||||
text.borderColor = 0xFF000000;
|
||||
text.scrollFactor.set();
|
||||
add(text);
|
||||
}
|
||||
scoreTxt.alignment = RIGHT;
|
||||
missesTxt.alignment = CENTER;
|
||||
@@ -433,6 +429,9 @@ class PlayState extends MusicBeatState
|
||||
private function generateSong(dataPath:String, ?songData:SwagSong):Void
|
||||
{
|
||||
if (songData == null) songData = SONG;
|
||||
|
||||
Conductor.reset();
|
||||
|
||||
Conductor.changeBPM(songData.bpm);
|
||||
|
||||
curSong = songData.song;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.menus;
|
||||
|
||||
import funkin.ui.FunkinText;
|
||||
import funkin.options.Options;
|
||||
#if desktop
|
||||
import funkin.system.Discord.DiscordClient;
|
||||
@@ -94,9 +95,8 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
FlxG.camera.follow(camFollow, null, 0.06);
|
||||
|
||||
var versionShit:FlxText = new FlxText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nPre-Alpha: Build ${funkin.macros.BuildCounterMacro.getBuildNumber()}\n', 12);
|
||||
var versionShit:FunkinText = new FunkinText(5, FlxG.height - 2, 0, 'Codename Engine v${Application.current.meta.get('version')}\nPre-Alpha: Build ${funkin.macros.BuildCounterMacro.getBuildNumber()}\n');
|
||||
versionShit.scrollFactor.set();
|
||||
versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
|
||||
versionShit.y -= versionShit.height;
|
||||
add(versionShit);
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -42,17 +42,16 @@ class CustomShader extends FunkinShader implements IHScriptCustomBehaviour {
|
||||
}
|
||||
if (!Reflect.hasField(data, v)) return null;
|
||||
var field = Reflect.field(data, v);
|
||||
if (field is ShaderInput) {
|
||||
var cl = Std.string(Type.getClass(field));
|
||||
|
||||
// cant do "field is ShaderInput" for some reason
|
||||
if (cl.startsWith("openfl.display.ShaderInput")) {
|
||||
var si = cast(field, ShaderInput<Dynamic>);
|
||||
return si.input;
|
||||
} else if (field is ShaderParameter) {
|
||||
var sp = cast(field, ShaderParameter<Dynamic>);
|
||||
switch(sp.type) {
|
||||
case BOOL, FLOAT, INT:
|
||||
return sp.value[0];
|
||||
default:
|
||||
return sp.value;
|
||||
}
|
||||
@:privateAccess
|
||||
return (sp.__length > 1) ? sp.value : sp.value[0];
|
||||
}
|
||||
return field;
|
||||
}
|
||||
@@ -80,7 +79,7 @@ class CustomShader extends FunkinShader implements IHScriptCustomBehaviour {
|
||||
field.input = cast val;
|
||||
} else if (cl.startsWith("openfl.display.ShaderParameter")) {
|
||||
@:privateAccess
|
||||
if (field.__arrayLength <= 1) {
|
||||
if (field.__length <= 1) {
|
||||
// that means we wait for a single number, instead of an array
|
||||
@:privateAccess
|
||||
if (field.__isInt && !(val is Int)) {
|
||||
|
||||
@@ -104,7 +104,7 @@ class CoolUtil
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function playMenuSong(fadeIn:Bool) {
|
||||
public static function playMenuSong(fadeIn:Bool = false) {
|
||||
if (FlxG.sound.music == null || !FlxG.sound.music.playing)
|
||||
{
|
||||
Conductor.reset();
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package funkin.ui;
|
||||
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.text.FlxText;
|
||||
|
||||
class FunkinText extends FlxText {
|
||||
public function new(X:Float = 0, Y:Float = 0, FieldWidth:Float = 0, ?Text:String, Size:Int = 16, EmbeddedFont:Bool = true) {
|
||||
super(X, Y, FieldWidth, Text, Size, EmbeddedFont);
|
||||
setFormat(Paths.font("vcr.ttf"), Size, FlxColor.WHITE);
|
||||
borderStyle = OUTLINE;
|
||||
borderSize = 1;
|
||||
borderColor = 0xFF000000;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user