diff --git a/assets/data/config/menuItems.txt b/assets/data/config/menuItems.txt
index 6315cf3d..6fc72f13 100644
--- a/assets/data/config/menuItems.txt
+++ b/assets/data/config/menuItems.txt
@@ -1,3 +1,4 @@
story mode
freeplay
-options
\ No newline at end of file
+options
+donate
\ No newline at end of file
diff --git a/assets/images/menus/mainmenu/donate.xml b/assets/images/menus/mainmenu/donate.xml
index 99acaa8f..c2cf1015 100644
--- a/assets/images/menus/mainmenu/donate.xml
+++ b/assets/images/menus/mainmenu/donate.xml
@@ -1,6 +1,6 @@
-
+
@@ -11,7 +11,7 @@
-
-
-
+
+
+
diff --git a/assets/images/menus/mainmenu/freeplay.xml b/assets/images/menus/mainmenu/freeplay.xml
index 96b2b2cc..4c288a07 100644
--- a/assets/images/menus/mainmenu/freeplay.xml
+++ b/assets/images/menus/mainmenu/freeplay.xml
@@ -1,6 +1,6 @@
-
+
@@ -11,7 +11,7 @@
-
-
-
+
+
+
diff --git a/assets/images/menus/mainmenu/options.xml b/assets/images/menus/mainmenu/options.xml
index 42b192d1..17198c43 100644
--- a/assets/images/menus/mainmenu/options.xml
+++ b/assets/images/menus/mainmenu/options.xml
@@ -1,6 +1,6 @@
-
+
@@ -11,7 +11,7 @@
-
-
-
+
+
+
diff --git a/assets/images/menus/mainmenu/story mode.xml b/assets/images/menus/mainmenu/story mode.xml
index 6230ba67..c662407d 100644
--- a/assets/images/menus/mainmenu/story mode.xml
+++ b/assets/images/menus/mainmenu/story mode.xml
@@ -1,6 +1,6 @@
-
+
@@ -11,7 +11,7 @@
-
-
-
+
+
+
diff --git a/assets/images/menus/titlescreen/titleEnter.png b/assets/images/menus/titlescreen/titleEnter.png
index acd38a2c..38d6fab9 100644
Binary files a/assets/images/menus/titlescreen/titleEnter.png and b/assets/images/menus/titlescreen/titleEnter.png differ
diff --git a/assets/images/menus/titlescreen/titleEnter.xml b/assets/images/menus/titlescreen/titleEnter.xml
index 129fa49e..7aaf5458 100644
--- a/assets/images/menus/titlescreen/titleEnter.xml
+++ b/assets/images/menus/titlescreen/titleEnter.xml
@@ -1,59 +1,61 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx
index 8a77b0e9..d76fb97d 100644
--- a/source/funkin/menus/FreeplayState.hx
+++ b/source/funkin/menus/FreeplayState.hx
@@ -223,7 +223,7 @@ class FreeplayState extends MusicBeatState
}
scoreText.text = "PERSONAL BEST:" + lerpScore;
- scoreBG.scale.set(Math.max(diffText.width, scoreText.width) + 8, (coopText.visible ? coopText.y + coopText.height : 66));
+ scoreBG.scale.set(Math.max(Math.max(diffText.width, scoreText.width), coopText.width) + 8, (coopText.visible ? coopText.y + coopText.height : 66));
scoreBG.updateHitbox();
scoreBG.x = FlxG.width - scoreBG.width;
diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx
index 9b22383c..2b73ab10 100644
--- a/source/funkin/menus/MainMenuState.hx
+++ b/source/funkin/menus/MainMenuState.hx
@@ -2,7 +2,7 @@ package funkin.menus;
import haxe.Json;
import funkin.backend.FunkinText;
-// import funkin.menus.credits.CreditsMain;
+import funkin.menus.credits.CreditsMain;
import flixel.FlxState;
import flixel.addons.transition.FlxTransitionableState;
import flixel.effects.FlxFlicker;
@@ -174,10 +174,8 @@ class MainMenuState extends MusicBeatState
trace("Freeplay Menu Selected");
case 'donate':
- /*
FlxG.switchState(new CreditsMain());
trace("Credits Menu Selected");
- */
case 'options':
FlxG.switchState(new OptionsMenu());
diff --git a/source/funkin/menus/credits/CreditsCodename.hx b/source/funkin/menus/credits/CreditsCodename.hx
index 9bf25465..23b87416 100644
--- a/source/funkin/menus/credits/CreditsCodename.hx
+++ b/source/funkin/menus/credits/CreditsCodename.hx
@@ -1,134 +1,69 @@
package funkin.menus.credits;
-import funkin.backend.FunkinText;
-import flixel.util.FlxColor;
-import funkin.backend.shaders.CustomShader;
-import funkin.options.type.TextOption;
-import funkin.options.OptionsScreen;
-import flixel.graphics.FlxGraphic;
-import openfl.display.BitmapData;
-import flixel.addons.transition.FlxTransitionableState;
import funkin.backend.system.github.GitHub;
-import funkin.backend.system.github.GitHubContributor;
-import funkin.menus.MainMenuState;
+import funkin.options.type.PortraitOption;
-using funkin.backend.utils.BitmapUtil;
+using StringTools;
-class CreditsCodename extends OptionsScreen {
- public var contributorsSprites:Array = [];
- public var contributorsAvatars:Array = [];
- public var contributorsColors:Array = [];
- public var avatarLoadListId:Int = 0;
- public var contributors:Array;
-
- public var interpColor:FlxInterpolateColor;
-
- public var errorMessage:String = "";
-
- public override function create() {
- contributors = GitHub.getContributors("YoshiCrafter29", "CodenameEngine", function(e) {
- errorMessage = Std.string(e);
- });
-
-
- var totalContributions = 0;
-
- for(c in contributors)
- totalContributions += c.contributions;
-
- options = [for(c in contributors) new TextOption(
- c.login,
- 'Total Contributions: ${c.contributions} / ${totalContributions} (${FlxMath.roundDecimal(c.contributions / totalContributions * 100, 2)}%) - Select to open GitHub account',
- function() {
- // open the link
- CoolUtil.openURL(c.html_url);
- })];
-
-
- super.create();
- interpColor = new FlxInterpolateColor(bg.color);
- }
-
- public override function changeSelection(change:Int) {
- if (contributors.length <= 0)
- return;
- super.changeSelection(change);
- }
-
- public override function createAdditional() {
- if (contributors.length <= 0) {
- var t = new FunkinText(0, 0, FlxG.width, 'Could not load engine contributors.\nMake sure you\'re connected to the Internet.\n\n${errorMessage}\n\nPress BACK to go back.', 40, true);
- t.alignment = CENTER;
- t.borderSize *= 1.75;
- t.screenCenter();
-
- var bg = new FlxSprite(0, 0).makeGraphic(1, 1, 0xFF000000);
- bg.alpha = 0.5;
- bg.scale.set(FlxG.width - 80, t.height + 40);
- bg.updateHitbox();
- bg.screenCenter();
- add(bg);
- add(t);
- return;
- }
-
- for(k=>c in contributors) {
- var spr = new FlxSprite(0, (OptionsScreen.optionHeight * (k+0.5)) - 48);
- spr.antialiasing = true;
- spr.setUnstretchedGraphicSize(96, 96, false);
- spr.updateHitbox();
- spr.shader = new CustomShader('engine/circleProfilePicture');
- contributorsSprites.push(spr);
- add(spr);
- }
-
- // asynchronous pfp loading
- Main.execAsync(function() {
- for(k=>c in contributors) {
- var bytes = GitHub.__requestBytesOnGitHubServers('${c.avatar_url}&size=96');
- var bmap = BitmapData.fromBytes(bytes);
- var color = bmap.getMostPresentSaturatedColor();
- contributorsAvatars.push(FlxG.bitmap.add(bmap, false, 'GITHUB-USER:${c.login}'));
- contributorsColors.push(color);
- if (destroyed) return;
- }
- });
+class CreditsCodename extends funkin.options.OptionsScreen {
+ public override function new()
+ {
+ super("Codename Engine", "All the contributors of the engine! - Press RESET to update the list (One reset per 2 minutes).");
+ checkUpdate();
+ displayList();
}
public override function update(elapsed:Float) {
+ if (funkin.options.PlayerSettings.solo.controls.RESET && checkUpdate()) {
+ displayList();
+ updateMenuDesc();
+ }
super.update(elapsed);
-
- if (contributors.length <= 0) {
- if (controls.BACK)
- exit();
- return;
- }
-
- if (avatarLoadListId < contributorsAvatars.length) {
- for(i in avatarLoadListId...contributorsAvatars.length) {
- var v = contributorsSprites[i];
- v.loadGraphic(contributorsAvatars[i]);
- v.setUnstretchedGraphicSize(96, 96, false);
- v.updateHitbox();
- }
- avatarLoadListId = contributorsAvatars.length;
- }
-
- for(k=>spr in contributorsSprites) {
- var alpha = options[k];
- spr.x = alpha.x - 10;
- }
-
- interpColor.fpsLerpTo(contributorsColors[curSelected], 0.0625);
- bg.color = interpColor.color;
}
- public override function destroy() {
- super.destroy();
+ public function checkUpdate():Bool {
+ var curTime:Float = Date.now().getTime();
+ if(Options.lastUpdated != null && curTime < Options.lastUpdated + 120000) return false; // Fuck you Github rate limits - Nex_isDumb
+ Options.lastUpdated = curTime;
+
+ var error:Bool = false;
+ //Main.execAsync(function() {
+ var idk = GitHub.getContributors("FNF-CNE-Devs", "CodenameEngine", function(e) {
+ error = true;
+ var errMsg:String = ~/\d+.\d+.\d+.\d+/.replace(e.message, "[Your IP]"); // Removing sensitive stuff - Nex_isDumb
+ errMsg = 'Error while trying to download contributors list:\n$errMsg';
+
+ Logs.traceColored([Logs.logText(errMsg.replace('\n', ' '), RED)], ERROR);
+ funkin.backend.utils.NativeAPI.showMessageBox("Codename Engine Warning", errMsg, MSG_WARNING);
+ });
+ //});
+ if(error) return false;
+
+ Options.contributors = idk;
+ trace('List Updated!');
+ return true;
}
- public override function exit() {
- MusicBeatState.skipTransOut = true;
- FlxG.switchState(new CreditsMain());
+ public function displayList() {
+ //if (curSelected > Options.contributors.length - 1) changeSelection(-(curSelected - (Options.contributors.length - 1)));
+ if (curSelected > Options.contributors.length - 1) curSelected = Options.contributors.length - 1;
+ changeSelection(0, true);
+
+ while (members.length > 0) {
+ members[0].destroy();
+ remove(members[0], true);
+ }
+
+ var totalContributions = 0;
+ for(c in Options.contributors) totalContributions += c.contributions;
+ for(c in Options.contributors) {
+ var opt:PortraitOption = new PortraitOption(
+ c.login,
+ 'Total Contributions: ${c.contributions} / ${totalContributions} (${FlxMath.roundDecimal(c.contributions / totalContributions * 100, 2)}%) - Select to open GitHub account',
+ function() CoolUtil.openURL(c.html_url)
+ );
+ opt.loadFromGithub(c);
+ add(opt);
+ }
}
}
\ No newline at end of file
diff --git a/source/funkin/menus/credits/CreditsMain.hx b/source/funkin/menus/credits/CreditsMain.hx
index 6c628b80..84fe4a6e 100644
--- a/source/funkin/menus/credits/CreditsMain.hx
+++ b/source/funkin/menus/credits/CreditsMain.hx
@@ -3,23 +3,34 @@ package funkin.menus.credits;
import flixel.addons.transition.FlxTransitionableState;
import funkin.options.OptionsScreen;
import funkin.options.type.*;
+import funkin.options.TreeMenu;
+
+class CreditsMain extends TreeMenu {
+ var editable:Array = [];
+ var bg:FlxSprite;
-class CreditsMain extends OptionsScreen {
public override function create() {
- options = [
+ bg = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuBGBlue'));
+ // bg.scrollFactor.set();
+ bg.scale.set(1.15, 1.15);
+ bg.updateHitbox();
+ bg.screenCenter();
+ bg.scrollFactor.set();
+ bg.antialiasing = true;
+ add(bg);
+
+ var selectables:Array = [];
+ for (s in editable) selectables.push(new TextOption(s.name, s.desc, function() {
// TODO: Custom Credits
- new TextOption("Codename Engine", "Select this to see all of the contributors of the engine!", function() {
- MusicBeatState.skipTransIn = MusicBeatState.skipTransOut = true;
- FlxG.switchState(new CreditsCodename());
- }),
- new TextOption("Friday Night Funkin'", "Select this to open the itch.io page of the original game to donate!", function() {
- CoolUtil.openURL("https://ninja-muffin24.itch.io/funkin");
- })
- ];
+ }));
+ selectables.push(new TextOption("Codename Engine", "Select this to see all the contributors of the engine!", function() {
+ optionsTree.add(Type.createInstance(CreditsCodename, []));
+ }));
+ selectables.push(new TextOption("Friday Night Funkin'", "Select this to open the itch.io page of the original game to donate!", function() {
+ CoolUtil.openURL("https://ninja-muffin24.itch.io/funkin");
+ }));
+
+ main = new OptionsScreen('Credits', 'The people who made this possible!', selectables);
super.create();
}
-
- public override function exit() {
- FlxG.switchState(new MainMenuState());
- }
}
\ No newline at end of file
diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx
index 8ac2f947..bc5fb232 100644
--- a/source/funkin/options/Options.hx
+++ b/source/funkin/options/Options.hx
@@ -49,6 +49,8 @@ class Options
*/
public static var freeplayLastSong:String = null;
public static var freeplayLastDifficulty:String = "normal";
+ public static var contributors:Array = [];
+ public static var lastUpdated:Null;
// CHARTER
public static var charterMetronomeEnabled:Bool = false;
diff --git a/source/funkin/options/OptionsScreen.hx b/source/funkin/options/OptionsScreen.hx
index 937a3901..fa21032e 100644
--- a/source/funkin/options/OptionsScreen.hx
+++ b/source/funkin/options/OptionsScreen.hx
@@ -54,15 +54,21 @@ class OptionsScreen extends FlxTypedSpriteGroup {
onClose(this);
}
- public function changeSelection(sel:Int) {
- if (members.length <= 0 || sel == 0) return;
+ public function changeSelection(sel:Int, force:Bool = false) {
+ if (members.length <= 0 || (sel == 0 && !force)) return;
CoolUtil.playMenuSFX(SCROLL);
-
curSelected = FlxMath.wrap(curSelected + sel, 0, members.length-1);
-
- for(o in members)
members[curSelected].selected = true;
+ updateMenuDesc();
+ }
+
+ public function updateMenuDesc(?customTxt:String) {
+ if (parent.treeParent == null) return;
+
+ var text:String = members[curSelected].desc;
+ if (customTxt != null) text = customTxt;
+ parent.treeParent.updateDesc(text);
}
public dynamic function onClose(o:OptionsScreen) {}
diff --git a/source/funkin/options/OptionsTree.hx b/source/funkin/options/OptionsTree.hx
index 124b15ba..2ef66408 100644
--- a/source/funkin/options/OptionsTree.hx
+++ b/source/funkin/options/OptionsTree.hx
@@ -2,6 +2,7 @@ package funkin.options;
class OptionsTree extends FlxTypedGroup {
public var lastMenu:OptionsScreen;
+ public var treeParent:TreeMenu;
public override function new() {
super();
diff --git a/source/funkin/options/TreeMenu.hx b/source/funkin/options/TreeMenu.hx
index 1b2fa993..fbfebf11 100644
--- a/source/funkin/options/TreeMenu.hx
+++ b/source/funkin/options/TreeMenu.hx
@@ -43,6 +43,7 @@ class TreeMenu extends MusicBeatState {
optionsTree = new OptionsTree();
optionsTree.onMenuChange = onMenuChange;
optionsTree.onMenuClose = onMenuClose;
+ optionsTree.treeParent = this;
optionsTree.add(main);
@@ -72,12 +73,18 @@ class TreeMenu extends MusicBeatState {
t += '${o.name} > ';
pathLabel.text = t;
- pathDesc.text = optionsTree.members.last().desc;
- pathBG.scale.set(FlxG.width, pathDesc.y + pathDesc.height + 2);
- pathBG.updateHitbox();
+ var idk:OptionsScreen = optionsTree.members.last();
+ if (idk.members.length > 0) updateDesc(idk.members[idk.curSelected].desc);
}
}
+ public function updateDesc(moreTxt:String = '') {
+ pathDesc.text = optionsTree.members.last().desc;
+ if (moreTxt != null && moreTxt.length > 0) pathDesc.text += '\n' + moreTxt;
+ pathBG.scale.set(FlxG.width, pathDesc.y + pathDesc.height + 2);
+ pathBG.updateHitbox();
+ }
+
public function exit() {
FlxG.switchState((lastState != null) ? Type.createInstance(lastState, []) : new MainMenuState());
}
diff --git a/source/funkin/options/type/PortraitOption.hx b/source/funkin/options/type/PortraitOption.hx
new file mode 100644
index 00000000..08876035
--- /dev/null
+++ b/source/funkin/options/type/PortraitOption.hx
@@ -0,0 +1,37 @@
+package funkin.options.type;
+
+import openfl.display.BitmapData;
+import flixel.graphics.FlxGraphic;
+import funkin.backend.shaders.CustomShader;
+import funkin.backend.system.github.GitHubContributor;
+import funkin.backend.system.github.GitHub;
+
+class PortraitOption extends TextOption {
+ public var portrait:FlxSprite = null;
+
+ public function new(name:String, desc:String, callback:Void->Void, ?graphic:FlxGraphic, size:Int = 96) {
+ super(name, desc, callback);
+ if (graphic != null) addPortrait(graphic, size);
+ }
+
+ public function addPortrait(graphic:FlxGraphic, size:Int = 96) {
+ if (portrait == null) {
+ portrait = new FlxSprite();
+ portrait.antialiasing = true;
+ portrait.shader = new CustomShader('engine/circleProfilePicture');
+ add(portrait);
+ }
+ portrait.loadGraphic(graphic);
+ portrait.setUnstretchedGraphicSize(size, size, false);
+ portrait.updateHitbox();
+ portrait.setPosition(90 - portrait.width, 0);
+ }
+
+ public function loadFromGithub(user:GitHubContributor, size:Int = 96) {
+ //Main.execAsync(function() {
+ var bytes = GitHub.__requestBytesOnGitHubServers('${user.avatar_url}&size=$size');
+ var bmap = BitmapData.fromBytes(bytes);
+ addPortrait(FlxG.bitmap.add(bmap, false, 'GITHUB-USER:${user.login}'), size);
+ //});
+ }
+}
\ No newline at end of file
diff --git a/source/funkin/options/type/TextOption.hx b/source/funkin/options/type/TextOption.hx
index 4710f312..60d1a190 100644
--- a/source/funkin/options/type/TextOption.hx
+++ b/source/funkin/options/type/TextOption.hx
@@ -23,9 +23,7 @@ class TextOption extends OptionType {
public override function onSelect() {
super.onSelect();
CoolUtil.playMenuSFX(CONFIRM);
- FlxFlicker.flicker(this, 1, Options.flashingMenu ? 0.06 : 0.15, true, false, function(t) {
-
- });
+ FlxFlicker.flicker(this, 1, Options.flashingMenu ? 0.06 : 0.15, true, false);
selectCallback();
}
}
\ No newline at end of file