diff --git a/assets/images/desktop/ui.xml b/assets/images/desktop/ui.xml
index 79c6909a..c36783a4 100644
--- a/assets/images/desktop/ui.xml
+++ b/assets/images/desktop/ui.xml
@@ -24,4 +24,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/images/desktop/ui/textbox.png b/assets/images/desktop/ui/textbox.png
new file mode 100644
index 00000000..affdf708
Binary files /dev/null and b/assets/images/desktop/ui/textbox.png differ
diff --git a/assets/images/desktop/ui/textboxFocus.png b/assets/images/desktop/ui/textboxFocus.png
new file mode 100644
index 00000000..4592db0d
Binary files /dev/null and b/assets/images/desktop/ui/textboxFocus.png differ
diff --git a/assets/images/desktop/ui/textboxHover.png b/assets/images/desktop/ui/textboxHover.png
new file mode 100644
index 00000000..49688263
Binary files /dev/null and b/assets/images/desktop/ui/textboxHover.png differ
diff --git a/assets/images/desktop/ui/textboxPressed.png b/assets/images/desktop/ui/textboxPressed.png
new file mode 100644
index 00000000..21f51250
Binary files /dev/null and b/assets/images/desktop/ui/textboxPressed.png differ
diff --git a/buildnumber.txt b/buildnumber.txt
index a3ace50d..5093c79f 100644
--- a/buildnumber.txt
+++ b/buildnumber.txt
@@ -1 +1 @@
-1793
\ No newline at end of file
+1795
\ No newline at end of file
diff --git a/source/funkin/desktop/editors/CharacterEditor.hx b/source/funkin/desktop/editors/CharacterEditor.hx
index 83515c18..98db603a 100644
--- a/source/funkin/desktop/editors/CharacterEditor.hx
+++ b/source/funkin/desktop/editors/CharacterEditor.hx
@@ -28,6 +28,7 @@ class CharacterEditor extends WindowContent {
public var animsDropDown:DropDown;
public var animNameInput:InputBox;
public var animPrefixInput:InputBox;
+ public var animLoopCheckbox:Checkbox;
public override function create() {
super.create();
@@ -91,13 +92,15 @@ class CharacterEditor extends WindowContent {
labels.push(label = new WindowText(10, animNameInput.y + animNameInput.height + 10, 0, "Animation Prefix"));
animPrefixInput = new InputBox(10, label.y + label.height, 380, "");
+ animLoopCheckbox = new Checkbox(10, animPrefixInput.y + animPrefixInput.height + 10, 380, "Loop");
+
// labels.push(label = new WindowText(10, animNameInput.y + animNameInput.height + 10, 0, "Animation Prefix"));
// animPrefixInput = new InputBox(10, label.y + label.height, 380, "");
for(l in labels)
tabView.tabs[0].add(l);
- for(spr in [animsDropDown, animNameInput, ])
+ for(spr in [animsDropDown, animNameInput, animPrefixInput, animLoopCheckbox])
tabView.tabs[0].add(spr);
refreshAnims();
@@ -110,6 +113,7 @@ class CharacterEditor extends WindowContent {
animNameInput.text = anim.name;
animPrefixInput.text = anim.name;
+ animLoopCheckbox.setChecked(anim.loop);
}
public function refreshAnims() {
diff --git a/source/funkin/desktop/sprites/Checkbox.hx b/source/funkin/desktop/sprites/Checkbox.hx
index 8a16772a..a05df1ec 100644
--- a/source/funkin/desktop/sprites/Checkbox.hx
+++ b/source/funkin/desktop/sprites/Checkbox.hx
@@ -25,6 +25,10 @@ class Checkbox extends WindowText {
scrollFactor.set();
}
+ public function setChecked(checked:Bool) {
+ this.checked = cast checked;
+ }
+
public override function update(elapsed:Float) {
super.update(elapsed);
checkboxSprite.update(elapsed);
@@ -61,7 +65,7 @@ class Checkbox extends WindowText {
}
@:enum
-abstract CheckState(Null) {
+abstract CheckState(Null) from Null to Null from Bool to Bool {
var CHECKED:CheckState = true;
var UNCHECKED:CheckState = false;
var BOTH:CheckState = null;
diff --git a/source/funkin/desktop/sprites/InputBox.hx b/source/funkin/desktop/sprites/InputBox.hx
index 2bc8cf01..c6dabc8d 100644
--- a/source/funkin/desktop/sprites/InputBox.hx
+++ b/source/funkin/desktop/sprites/InputBox.hx
@@ -8,6 +8,7 @@ import lime.app.Application;
class InputBox extends Button {
public var index:Int = 0;
+ public static var insertMode:Bool = false;
public var text(get, set):String;
private inline function set_text(t:String):String
@@ -20,7 +21,8 @@ class InputBox extends Button {
public function new(x:Float, y:Float, w:Float, t:String, ?onChange:Void->Void) {
super(x, y, t, function() {
setIndex(label.text.length);
- });
+ disabled = true;
+ }, DesktopMain.theme.textbox, DesktopMain.theme.textboxHover, DesktopMain.theme.textboxPressed, DesktopMain.theme.textboxFocused);
this.resize(w, height);
this.label.alignment = LEFT;
FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
@@ -33,6 +35,8 @@ class InputBox extends Button {
switch(event.keyCode) {
case Keyboard.ESCAPE:
this.loseFocus();
+ case Keyboard.INSERT:
+ insertMode = !insertMode;
case Keyboard.LEFT:
changeIndex(-1);
case Keyboard.RIGHT:
@@ -60,10 +64,26 @@ class InputBox extends Button {
text = text.substr(0, index) + input + text.substring(index, text.length);
+ if (!insertMode)
+ index += input.length;
+
if (onChange != null)
onChange();
}
+ public override function update(elapsed:Float) {
+ if (DesktopMain.mouseInput.justPressed && !DesktopMain.mouseInput.overlaps(this, camera)) {
+ disabled = false;
+ this.loseFocus();
+ }
+ super.update(elapsed);
+ }
+
+ public override function onFocusLost() {
+ super.onFocusLost();
+ disabled = false;
+ }
+
public inline function changeIndex(change:Int) {
setIndex(Std.int(FlxMath.bound(index + change, 0, label.text.length)));
}
diff --git a/source/funkin/desktop/theme/Theme.hx b/source/funkin/desktop/theme/Theme.hx
index 5a072665..d2f7cf27 100644
--- a/source/funkin/desktop/theme/Theme.hx
+++ b/source/funkin/desktop/theme/Theme.hx
@@ -59,6 +59,14 @@ class Theme {
public var contextBackground:ThemeData = new ThemeData();
public var contextOption:ThemeData = new ThemeData();
+ /**
+ * THEME
+ */
+ public var textbox:ThemeData = new ThemeData();
+ public var textboxHover:ThemeData = new ThemeData();
+ public var textboxPressed:ThemeData = new ThemeData();
+ public var textboxFocused:ThemeData = new ThemeData();
+
public function new(content:String) {
try {
var access = new Access(Xml.parse(content).firstElement());