This commit is contained in:
Yoshman29
2022-12-26 17:07:53 +01:00
parent 6d00ab0b5b
commit 6a8709a1fc
10 changed files with 46 additions and 4 deletions
+6
View File
@@ -24,4 +24,10 @@
<!-- CONTEXT MENU -->
<contextBackground path="context" textColor="0,0,0" left="4" top="4" right="4" bottom="4" />
<contextOption path="contextOption" textColor="255,255,255" height="20" />
<!-- TEXTBOX -->
<textbox path="textbox" textColor="0,0,0" left="4" top="4" right="4" bottom="4" />
<textboxHover path="textboxHover" textColor="0,0,0" left="4" top="4" right="4" bottom="4" />
<textboxPressed path="textboxPressed" textColor="0,0,0" left="4" top="4" right="4" bottom="4" />
<textboxFocused path="textboxFocus" textColor="0,0,0" left="4" top="4" right="4" bottom="4" />
</theme>
Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

+1 -1
View File
@@ -1 +1 @@
1793
1795
@@ -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() {
+5 -1
View File
@@ -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<Bool>) {
abstract CheckState(Null<Bool>) from Null<Bool> to Null<Bool> from Bool to Bool {
var CHECKED:CheckState = true;
var UNCHECKED:CheckState = false;
var BOTH:CheckState = null;
+21 -1
View File
@@ -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)));
}
+8
View File
@@ -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());