diff --git a/Project.xml b/Project.xml
index 643401439..029d6c890 100644
--- a/Project.xml
+++ b/Project.xml
@@ -96,7 +96,10 @@
-
+
+
+
+
diff --git a/example_mods/introMod/assets/preload/data/introText.txt b/example_mods/introMod/assets/preload/data/introText.txt
new file mode 100644
index 000000000..f0dd8224a
--- /dev/null
+++ b/example_mods/introMod/assets/preload/data/introText.txt
@@ -0,0 +1 @@
+awesomes tream--really awesome
\ No newline at end of file
diff --git a/example_mods/introMod/assets/preload/images/gfDanceTitle.png b/example_mods/introMod/assets/preload/images/gfDanceTitle.png
new file mode 100644
index 000000000..989f2a68a
Binary files /dev/null and b/example_mods/introMod/assets/preload/images/gfDanceTitle.png differ
diff --git a/source/ModdingSubstate.hx b/source/ModdingSubstate.hx
index 81f5a358f..9898286a5 100644
--- a/source/ModdingSubstate.hx
+++ b/source/ModdingSubstate.hx
@@ -1,33 +1,146 @@
package;
+import Controls.Control;
+import flixel.FlxG;
+import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
+import flixel.util.FlxColor;
+import polymod.Polymod;
import sys.FileSystem;
class ModdingSubstate extends MusicBeatSubstate
{
+ var grpMods:FlxTypedGroup;
+ var enabledMods:Array = [];
+ var modFolders:Array = [];
+
+ var curSelected:Int = 0;
+
public function new():Void
{
super();
- // var pathShit
+ grpMods = new FlxTypedGroup();
+ add(grpMods);
+
+ refreshModList();
+ }
+
+ override function update(elapsed:Float)
+ {
+ if (FlxG.keys.justPressed.R)
+ refreshModList();
+
+ selections();
+
+ if (controls.UP_P)
+ selections(-1);
+ if (controls.DOWN_P)
+ selections(1);
+
+ if (FlxG.keys.justPressed.SPACE)
+ grpMods.members[curSelected].modEnabled = !grpMods.members[curSelected].modEnabled;
+
+ if (FlxG.keys.justPressed.I && curSelected != 0)
+ {
+ var oldOne = grpMods.members[curSelected - 1];
+ grpMods.members[curSelected - 1] = grpMods.members[curSelected];
+ grpMods.members[curSelected] = oldOne;
+ selections(-1);
+ }
+
+ if (FlxG.keys.justPressed.K && curSelected < grpMods.members.length - 1)
+ {
+ var oldOne = grpMods.members[curSelected + 1];
+ grpMods.members[curSelected + 1] = grpMods.members[curSelected];
+ grpMods.members[curSelected] = oldOne;
+ selections(1);
+ }
+
+ super.update(elapsed);
+ }
+
+ private function selections(change:Int = 0):Void
+ {
+ curSelected += change;
+
+ if (curSelected >= modFolders.length)
+ curSelected = 0;
+ if (curSelected < 0)
+ curSelected = modFolders.length - 1;
+
+ for (txt in 0...grpMods.length)
+ {
+ if (txt == curSelected)
+ {
+ grpMods.members[txt].color = FlxColor.YELLOW;
+ }
+ else
+ grpMods.members[txt].color = FlxColor.WHITE;
+ }
+
+ organizeByY();
+ }
+
+ private function refreshModList():Void
+ {
+ while (grpMods.members.length > 0)
+ {
+ grpMods.remove(grpMods.members[0], true);
+ }
var modList = [];
+ modFolders = [];
for (file in FileSystem.readDirectory('./mods'))
{
- if (FileSystem.isDirectory("./mods/" + file))
- modList.push(file);
+ if (FileSystem.isDirectory('./mods/' + file))
+ modFolders.push(file);
}
+ enabledMods = [];
+
+ modList = Polymod.scan('./mods');
+
trace(modList);
var loopNum:Int = 0;
- for (i in modList)
+ for (i in modFolders)
{
- var txt:FlxText = new FlxText(0, 10 + (40 * loopNum), 0, i, 32);
- add(txt);
+ var txt:ModMenuItem = new ModMenuItem(0, 10 + (40 * loopNum), 0, i, 32);
+ txt.text = i;
+ grpMods.add(txt);
loopNum++;
}
}
+
+ private function organizeByY():Void
+ {
+ for (i in 0...grpMods.length)
+ {
+ grpMods.members[i].y = 10 + (40 * i);
+ }
+ }
+}
+
+class ModMenuItem extends FlxText
+{
+ public var modEnabled:Bool = false;
+ public var daMod:String;
+
+ public function new(x:Float, y:Float, w:Float, str:String, size:Int)
+ {
+ super(x, y, w, str, size);
+ }
+
+ override function update(elapsed:Float)
+ {
+ if (modEnabled)
+ alpha = 1;
+ else
+ alpha = 0.5;
+
+ super.update(elapsed);
+ }
}
diff --git a/source/TitleState.hx b/source/TitleState.hx
index 572a97825..7759626fd 100644
--- a/source/TitleState.hx
+++ b/source/TitleState.hx
@@ -37,7 +37,7 @@ class TitleState extends MusicBeatState
override public function create():Void
{
#if polymod
- polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']});
+ polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL});
#end
PlayerSettings.init();
@@ -216,6 +216,17 @@ class TitleState extends MusicBeatState
override function update(elapsed:Float)
{
+ /*
+ if (FlxG.keys.justPressed.R)
+ {
+ #if polymod
+ polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']});
+ trace('reinitialized');
+ #end
+ }
+
+ */
+
if (FlxG.sound.music != null)
Conductor.songPosition = FlxG.sound.music.time;
// FlxG.watch.addQuick('amp', FlxG.sound.music.amplitude);