diff --git a/assets/images/editors/ui/checkbox-small.png b/assets/images/editors/ui/checkbox-small.png
new file mode 100644
index 00000000..bd6472a2
Binary files /dev/null and b/assets/images/editors/ui/checkbox-small.png differ
diff --git a/assets/images/editors/ui/inputbox-small.png b/assets/images/editors/ui/inputbox-small.png
new file mode 100644
index 00000000..30b76224
Binary files /dev/null and b/assets/images/editors/ui/inputbox-small.png differ
diff --git a/assets/images/editors/ui/inputbox-small.xml b/assets/images/editors/ui/inputbox-small.xml
new file mode 100644
index 00000000..de0e833b
--- /dev/null
+++ b/assets/images/editors/ui/inputbox-small.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/funkin/backend/utils/BitmapUtil.hx b/source/funkin/backend/utils/BitmapUtil.hx
index 776e9330..d7984d2d 100644
--- a/source/funkin/backend/utils/BitmapUtil.hx
+++ b/source/funkin/backend/utils/BitmapUtil.hx
@@ -2,6 +2,8 @@ package funkin.backend.utils;
import flixel.util.FlxColor;
import openfl.display.BitmapData;
+import openfl.geom.Point;
+import openfl.geom.Rectangle;
class BitmapUtil {
/**
@@ -66,4 +68,27 @@ class BitmapUtil {
}
return mostPresentColor;
}
+
+ /**
+ * Returns a new bitmap without any empty transperent space on the edges
+ * @param bitmap The bitmap to be cropped
+ */
+ public static function crop(bitmap:BitmapData) {
+ var minX:Int = bitmap.width;
+ var minY:Int = bitmap.height;
+ var maxX:Int = 0; var maxY:Int = 0;
+
+ for (y in 0...bitmap.height)
+ for (x in 0...bitmap.width)
+ if (bitmap.getPixel32(x, y) != 0x00000000) {
+ if (x < minX) minX = x;
+ if (y < minY) minY = y;
+ if (x > maxX) maxX = x;
+ if (y > maxY) maxY = y;
+ }
+
+ var croppedBitmap:BitmapData = new BitmapData(maxX-minX+1, maxY-minY+1, true, 0x00000000);
+ croppedBitmap.copyPixels(bitmap, new Rectangle(minX, minY, croppedBitmap.width, croppedBitmap.height), new Point(0,0));
+ return croppedBitmap;
+ }
}
\ No newline at end of file
diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx
index b5e4c307..36f817e8 100644
--- a/source/funkin/backend/utils/CoolUtil.hx
+++ b/source/funkin/backend/utils/CoolUtil.hx
@@ -1,8 +1,5 @@
package funkin.backend.utils;
-import openfl.geom.Point;
-import openfl.geom.Rectangle;
-import openfl.display.BitmapData;
import flixel.animation.FlxAnimation;
import flixel.input.keyboard.FlxKey;
import flixel.sound.FlxSound;
@@ -736,29 +733,6 @@ class CoolUtil
return array.indexOf(element) != -1;
}
#end
-
- /**
- * Returns a new bitmap without any empty transperent space on the edges
- * @param bitmap The bitmap to be cropped
- */
- public static function cropBitmap(bitmap:BitmapData) {
- var minX:Int = bitmap.width;
- var minY:Int = bitmap.height;
- var maxX:Int = 0; var maxY:Int = 0;
-
- for (y in 0...bitmap.height)
- for (x in 0...bitmap.width)
- if (bitmap.getPixel32(x, y) != 0x00000000) {
- if (x < minX) minX = x;
- if (y < minY) minY = y;
- if (x > maxX) maxX = x;
- if (y > maxY) maxY = y;
- }
-
- var croppedBitmap:BitmapData = new BitmapData(maxX-minX+1, maxY-minY+1, true, 0x00000000);
- croppedBitmap.copyPixels(bitmap, new Rectangle(minX, minY, croppedBitmap.width, croppedBitmap.height), new Point(0,0));
- return croppedBitmap;
- }
}
/**
diff --git a/source/funkin/editors/character/CharacterAnimButton.hx b/source/funkin/editors/character/CharacterAnimButton.hx
index b84201b8..ef0deb91 100644
--- a/source/funkin/editors/character/CharacterAnimButton.hx
+++ b/source/funkin/editors/character/CharacterAnimButton.hx
@@ -1,25 +1,109 @@
package funkin.editors.character;
+import funkin.backend.utils.XMLUtil.AnimData;
import flixel.math.FlxPoint;
import flixel.util.FlxColor;
class CharacterAnimButton extends UIButton {
- public var anim:String = "";
+ public var anim:String = null;
+ public var data:AnimData = null;
+ public var parent:CharacterAnimsWindow;
- public function new(x:Float,y:Float,anim:String, offset:FlxPoint) {
- this.anim = anim;
- super(x,y, ""/*'$anim (${offset.x}, ${offset.y})'*/, function () {
+ public var animationDisplayBG:UISliceSprite;
+ public var nameTextBox:UITextBox;
+ public var animTextBox:UITextBox;
+ public var positionXStepper:UINumericStepper;
+ public var positionYStepper:UINumericStepper;
+ public var fpsStepper:UINumericStepper;
+ public var loopedCheckbox:UICheckbox;
+ public var indicesTextBox:UITextBox;
+ public var XYComma:UIText;
+
+ public var labels:Map = [];
+
+ public function new(x:Float, y:Float, animData:AnimData, parent:CharacterAnimsWindow) {
+ this.anim = animData.name;
+ this.data = animData;
+ this.parent = parent;
+ super(x,y, '${animData.name} (${animData.x}, ${animData.y})', function () {
CharacterEditor.instance.playAnimation(this.anim);
- }, Std.int(500-16), 100);
+ }, Std.int(500-16-32), 184);
+ function addLabelOn(ui:UISprite, text:String, ?size:Int):UIText {
+ var uiText:UIText = new UIText(ui.x, ui.y-18, 0, text, size);
+ members.push(uiText); labels.set(ui, uiText);
+ return uiText;
+ }
- autoAlpha = autoFrames = false;
+ autoAlpha = autoFrames = autoFollow = false;
frames = Paths.getFrames('editors/ui/inputbox');
- framesOffset = 9;
+ field.fieldWidth = 0; framesOffset = 9;
+ field.visible = false;
+
+ animationDisplayBG = new UISliceSprite(x+12, y+12+18+12, 128, 128, 'editors/ui/inputbox');
+ members.push(animationDisplayBG);
+
+ nameTextBox = new UITextBox(animationDisplayBG.x+126+16, animationDisplayBG.y, animData.name, 116, 22, false, true);
+ members.push(nameTextBox);
+ addLabelOn(nameTextBox, "Name", 12);
+
+ animTextBox = new UITextBox(nameTextBox.x + 100 + 12, nameTextBox.y, animData.anim, 146, 22, false, true);
+ members.push(animTextBox);
+ addLabelOn(animTextBox, "Animation", 12);
+
+ positionXStepper = new UINumericStepper(animTextBox.x, animTextBox.y+32+18, animData.x, 0.001, 2, null, null, 64, 22, true);
+ members.push(positionXStepper);
+ addLabelOn(positionXStepper, "Position (X,Y)", 12);
+
+ members.push(XYComma = new UIText(positionXStepper.x+104-32+0, positionXStepper.y + 9, 0, ",", 18));
+
+ positionYStepper = new UINumericStepper(positionXStepper.x+104-32+26, positionXStepper.y, animData.y, 0.001, 2, null, null, 64, 22, true);
+ members.push(positionYStepper);
+
+ fpsStepper = new UINumericStepper(animTextBox.x + 200 + 26, animTextBox.y, 0, 0.1, 2, animData.fps, 100, 52, 22, true);
+ members.push(fpsStepper);
+ addLabelOn(fpsStepper, "FPS", 12);
+
+ loopedCheckbox = new UICheckbox(fpsStepper.x + 82 - 32 + 26, fpsStepper.y, "Looping?", animData.loop, 0, true);
+ members.push(loopedCheckbox);
+ addLabelOn(loopedCheckbox, "Looped", 12);
+
+ loopedCheckbox.x += 8; loopedCheckbox.y += 6;
+
+ indicesTextBox = new UITextBox(nameTextBox.x, nameTextBox.y, animData.indices.getDefault([]).join(","), 278, 22, false, true);
+ members.push(indicesTextBox);
+ addLabelOn(indicesTextBox, "Indices (frames)", 12);
+
}
- public function updateInfo(anim:String, offset:FlxPoint, ghost:Bool) {
- this.anim = anim;
+ public override function update(elapsed:Float) {
+ field.follow(this, 20, 12);
+
+ animationDisplayBG.follow(this, 16, 12+18+11);
+ nameTextBox.follow(this, 14+128+16, 12+18+8+14);
+ animTextBox.follow(this, 14+128+12+116+20, 12+18+8+14);
+
+ positionXStepper.follow(this, 14+128+16, 12+18+8+10+24+26);
+ positionYStepper.follow(this, 14+128+16+64-32+28, 12+18+8+10+24+26);
+ XYComma.follow(positionXStepper, 64-24, 6);
+
+ fpsStepper.follow(this, 14+128+16+64-32+28+64-22+20, 12+18+8+10+24+26);
+ loopedCheckbox.follow(this, 14+128+16+64-32+28+64-22+20+52-22+18+8, 12+18+8+10+24+32);
+
+ indicesTextBox.follow(this, 14+128+16, 12+18+8+10+24+26+24+22);
+
+ for (ui => text in labels)
+ text.follow(ui, -(2+(ui is UICheckbox?12:0)), -(18+(ui is UICheckbox?6:0)));
+
+ super.update(elapsed);
+ }
+
+ public override function draw() {
+ super.draw();
+
+ // if (parent.displayAnimsList.contains(anim)) {
+ // parent.displayAnimsList.animation
+ // }
}
}
\ No newline at end of file
diff --git a/source/funkin/editors/character/CharacterAnimScreen.hx b/source/funkin/editors/character/CharacterAnimScreen.hx
deleted file mode 100644
index 8d691c42..00000000
--- a/source/funkin/editors/character/CharacterAnimScreen.hx
+++ /dev/null
@@ -1,123 +0,0 @@
-package funkin.editors.character;
-
-import flixel.animation.FlxAnimation;
-import flixel.math.FlxPoint;
-import funkin.backend.utils.XMLUtil.AnimData;
-
-class CharacterAnimScreen extends UISubstateWindow {
- public var animData:AnimData;
-
- public var nameTextBox:UITextBox;
- public var animTextBox:UITextBox;
- public var fpsStepper:UINumericStepper;
- public var loopedCheckbox:UICheckbox;
- public var indicesTextBox:UITextBox;
- public var offsetXStepper:UINumericStepper;
- public var offsetYStepper:UINumericStepper;
-
- public var saveButton:UIButton;
- public var closeButton:UIButton;
-
- public var onSave:(animData:AnimData) -> Void = null;
-
- public function new(animData:AnimData, ?onSave:(animData:AnimData) -> Void) {
- this.animData = animData;
- this.onSave = onSave;
- super();
- }
-
- public override function create() {
- var creatingAnim:Bool = animData == null;
-
- if (creatingAnim)
- animData = {
- name: "name",
- anim: "anim",
- fps: 24,
- loop: false,
- animType: NONE,
- x: 0,
- y: 0,
- indices: []
- };
-
- winTitle = creatingAnim ? 'Creating Animation' : 'Animation ${animData.name} properties';
- winWidth = 690; winHeight = 314;
-
- super.create();
-
- function addLabelOn(ui:UISprite, text:String)
- add(new UIText(ui.x, ui.y - 24, 0, text));
-
- var title:UIText;
- add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, creatingAnim ? "Create New Animation" : "Edit Animation Properties", 28));
-
- nameTextBox = new UITextBox(title.x, title.y + title.height + 38, animData.name, 160);
- add(nameTextBox);
- addLabelOn(nameTextBox, "Name");
-
- animTextBox = new UITextBox(nameTextBox.x + 160 + 26, nameTextBox.y, animData.anim, 200);
- add(animTextBox);
- addLabelOn(animTextBox, "Animation");
-
- fpsStepper = new UINumericStepper(animTextBox.x + 200 + 26, animTextBox.y, animData.fps, 0.1, 2, 1, 100, 82);
- add(fpsStepper);
- addLabelOn(fpsStepper, "FPS");
-
- loopedCheckbox = new UICheckbox(fpsStepper.x + 82 - 32 + 26, fpsStepper.y, "Looped", animData.loop);
- add(loopedCheckbox);
- addLabelOn(loopedCheckbox, "Looping");
- loopedCheckbox.x += 8; loopedCheckbox.y += 6;
-
- indicesTextBox = new UITextBox(nameTextBox.x, nameTextBox.y + 32 + 40, animData.indices.join(", "), 270);
- add(indicesTextBox);
- addLabelOn(indicesTextBox, "Indices");
-
- offsetXStepper = new UINumericStepper(indicesTextBox.x + 270 + 26, indicesTextBox.y, animData.x, 0.001, 2, null, null, 84);
- add(offsetXStepper);
- addLabelOn(offsetXStepper, "Offset (X,Y)");
-
- add(new UIText(offsetXStepper.x + 84 - 32 + 0, offsetXStepper.y + 9, 0, ",", 22));
-
- offsetYStepper = new UINumericStepper(offsetXStepper.x + 84 - 32 + 26, offsetXStepper.y, animData.y, 0.001, 2, null, null, 84);
- add(offsetYStepper);
-
- saveButton = new UIButton(windowSpr.x + windowSpr.bWidth - 20 - 125, windowSpr.y + windowSpr.bHeight - 16 - 32, "Save & Close", function() {
- saveAnimData();
- close();
- }, 125);
- add(saveButton);
-
- closeButton = new UIButton(saveButton.x - 20, saveButton.y, creatingAnim ? "Cancel" : "Close", function() {
- if (creatingAnim && onSave != null) onSave(null);
- close();
- }, 125);
- add(closeButton);
- closeButton.color = 0xFFFF0000;
- closeButton.x -= closeButton.bWidth;
- }
-
- public function saveAnimData() {
- for (stepper in [offsetXStepper, offsetYStepper, fpsStepper])
- @:privateAccess stepper.__onChange(stepper.label.text);
-
- animData = {
- name: nameTextBox.label.text,
- anim: animTextBox.label.text,
- fps: fpsStepper.value,
- loop: loopedCheckbox.checked,
- animType: NONE,
- x: offsetXStepper.value,
- y: offsetYStepper.value,
- indices: []
- };
- var indicesSplit = indicesTextBox.label.text.split(",");
- for(indice in indicesSplit) {
- var i = Std.parseInt(indice.trim());
- if (i != null)
- animData.indices.push(i);
- }
-
- if (onSave != null) onSave(animData);
- }
-}
\ No newline at end of file
diff --git a/source/funkin/editors/character/CharacterAnimsWindow.hx b/source/funkin/editors/character/CharacterAnimsWindow.hx
index a3d42536..8ebe328f 100644
--- a/source/funkin/editors/character/CharacterAnimsWindow.hx
+++ b/source/funkin/editors/character/CharacterAnimsWindow.hx
@@ -1,14 +1,27 @@
package funkin.editors.character;
+import funkin.game.Character;
+
class CharacterAnimsWindow extends UIButtonList {
- public function new(x:Float, y:Float, animations:Array) {
- super(x, y, Std.int(500-16), 419, "", FlxPoint.get(500-16, 100));
+ public var character:Character;
+
+ public var displayWindowSprite:FlxSprite;
+ public var displayAnimsList:Array = [];
+
+ public function new(x:Float, y:Float, character:Character) {
+ super(x, y, Std.int(500-16), 419, "", FlxPoint.get(Std.int(500-16-32), 184));
cameraSpacing = 0;
frames = Paths.getFrames('editors/ui/inputbox');
- for (anim in animations)
- add(new CharacterAnimButton(0,0, anim, FlxPoint.get()));
+ displayWindowSprite = new FlxSprite();
+ displayWindowSprite.loadGraphicFromSprite(character);
+
+ displayAnimsList = displayWindowSprite.animation.getNameList();
+ for (anim in character.getAnimOrder())
+ add(new CharacterAnimButton(0,0, character.animDatas.get(anim), this));
}
+
+
}
\ No newline at end of file
diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx
index a2a8f713..6ba80df1 100644
--- a/source/funkin/editors/character/CharacterEditor.hx
+++ b/source/funkin/editors/character/CharacterEditor.hx
@@ -32,7 +32,7 @@ class CharacterEditor extends UIState {
public var cameraHoverDummy:CameraHoverDummy;
- public var characterPropertiresWindow:CharacterPropertiesWindow;
+ public var characterPropertiesWindow:CharacterPropertiesWindow;
public var characterAnimsWindow:CharacterAnimsWindow;
public var charCamera:FlxCamera;
@@ -235,21 +235,19 @@ class CharacterEditor extends UIState {
uiGroup.cameras = [uiCamera];
add(cameraHoverDummy = new CameraHoverDummy(uiGroup, FlxPoint.weak(0, 0)));
- characterPropertiresWindow = new CharacterPropertiesWindow((FlxG.width-500), 23+12+10, character);
- uiGroup.add(characterPropertiresWindow);
+ characterPropertiesWindow = new CharacterPropertiesWindow((FlxG.width-(532+16)), 23+12+10, character);
+ uiGroup.add(characterPropertiesWindow);
topMenuSpr = new UITopMenu(topMenu);
topMenuSpr.cameras = [uiCamera];
- var animationsLoaded:Array = character.getAnimOrder();
-
- characterAnimsWindow = new CharacterAnimsWindow(characterPropertiresWindow.x, characterPropertiresWindow.y+224+16, animationsLoaded);
+ characterAnimsWindow = new CharacterAnimsWindow(characterPropertiesWindow.x, characterPropertiesWindow.y+224+16, character);
uiGroup.add(characterAnimsWindow);
add(uiGroup);
add(topMenuSpr);
- playAnimation(animationsLoaded[0]);
+ playAnimation(character.getAnimOrder()[0]);
_view_focus_character(null);
@@ -375,9 +373,6 @@ class CharacterEditor extends UIState {
ghosts.setOffsets(anim, offsets.clone());
}
- for (charButton in characterAnimsWindow.buttons.members)
- charButton.updateInfo(charButton.anim, character.getAnimOffset(charButton.anim), ghosts.animGhosts[charButton.anim].visible);
-
changeOffset(character.getAnimName(), FlxPoint.get(0, 0), false); // apply da new offsets
}
}
@@ -419,18 +414,15 @@ class CharacterEditor extends UIState {
}
public function createAnimWithUI() {
- FlxG.state.openSubState(new CharacterAnimScreen(null, (_) -> {
- if (_ != null) createAnim(_);
- }));
+
}
public function editAnimWithUI(name:String) {
- FlxG.state.openSubState(new CharacterAnimScreen(character.animDatas.get(name), (_) -> {
- if (_ != null) editAnim(name, _);
- }));
+
}
public function createAnim(animData:AnimData, animID:Int = -1, addtoUndo:Bool = true) {
+ /*
XMLUtil.addAnimToSprite(character, animData);
ghosts.createGhost(animData.name);
var newButton = new CharacterAnimButton(0, 0, animData.name, FlxPoint.get(animData.x,animData.y));
@@ -441,6 +433,7 @@ class CharacterEditor extends UIState {
if (addtoUndo)
undos.addToUndo(CCreateAnim(character.getNameList().length, animData));
+ */
}
public function editAnim(name:String, animData:AnimData, addtoUndo:Bool = true) {
@@ -452,7 +445,6 @@ class CharacterEditor extends UIState {
ghosts.removeGhost(name);
XMLUtil.addAnimToSprite(character, animData);
ghosts.createGhost(animData.name);
- buttoner.updateInfo(animData.name, character.getAnimOffset(animData.name), ghosts.animGhosts[animData.name].visible);
if (character.getAnimName() == animData.name) // update anim ifs its currently selected
playAnimation(animData.name);
@@ -514,7 +506,6 @@ class CharacterEditor extends UIState {
var animButton:CharacterAnimButton = null;
for (button in characterAnimsWindow.buttons.members)
if (button.anim == anim) animButton = button;
- animButton.updateInfo(anim, character.getAnimOffset(anim), ghost.visible);
}
function _playback_play_anim(_) {
@@ -574,9 +565,6 @@ class CharacterEditor extends UIState {
if (character.getNameList().length == 0) return;
character.animOffsets.set(anim, character.getAnimOffset(anim) + change);
- for (i in characterAnimsWindow.buttons.members)
- if (i.anim == anim)
- i.updateInfo(anim, character.getAnimOffset(anim), ghosts.animGhosts[anim].visible);
character.frameOffset.set(character.getAnimOffset(anim).x, character.getAnimOffset(anim).y);
ghosts.updateOffsets(anim, change);
@@ -592,13 +580,6 @@ class CharacterEditor extends UIState {
for (anim => offsets in character.animOffsets)
anim => offsets.clone()
];
- for (anim in character.getNameList()) {
- character.animOffsets[anim].zero();
- for (i in characterAnimsWindow.buttons.members)
- if (i.anim == anim)
- i.updateInfo(anim, character.getAnimOffset(anim), ghosts.animGhosts[anim].visible);
- }
-
changeOffset(character.getAnimName(), FlxPoint.get(), false);
ghosts.clearOffsets();
diff --git a/source/funkin/editors/character/CharacterIconDisplay.hx b/source/funkin/editors/character/CharacterIconDisplay.hx
index e81b88ba..a9d43a76 100644
--- a/source/funkin/editors/character/CharacterIconDisplay.hx
+++ b/source/funkin/editors/character/CharacterIconDisplay.hx
@@ -5,6 +5,8 @@ import openfl.geom.Rectangle;
import openfl.display.BitmapData;
import flixel.util.FlxColor;
+using funkin.backend.utils.BitmapUtil;
+
// DONT DELETE I MIGHT USE LATER -lunar
class CharacterIconDisplay extends UISprite {
public var healthBarBG:FlxSprite;
@@ -22,10 +24,13 @@ class CharacterIconDisplay extends UISprite {
iconBitmap.copyPixels(imageBitmap, new Rectangle(0, 0, 150, 150), new Point(0,0));
- loadGraphic(iconBitmap.cropBitmap());
+ loadGraphic(FlxG.bitmap.add(iconBitmap.crop()));
scale.x = scale.y = 40/pixels.height;
updateHitbox();
+ // bye guys :((
+ imageBitmap.dispose(); iconBitmap.dispose();
+
antialiasing = true;
healthBarBG = new FlxSprite(x+(width/2), y+(height*(2.25/4))+2).makeSolid(barWidth-Std.int(width), 10, 0xFF000000);
diff --git a/source/funkin/editors/ui/UIButton.hx b/source/funkin/editors/ui/UIButton.hx
index 9a16b795..05cdf169 100644
--- a/source/funkin/editors/ui/UIButton.hx
+++ b/source/funkin/editors/ui/UIButton.hx
@@ -7,6 +7,7 @@ class UIButton extends UISliceSprite {
public var hasBeenPressed = false;
public var autoFrames:Bool = true;
+ public var autoFollow:Bool = true;
public override function new(x:Float, y:Float, text:String, callback:Void->Void, w:Int = 120, h:Int = 32) {
super(x, y, w, h, 'editors/ui/button');
@@ -20,7 +21,7 @@ class UIButton extends UISliceSprite {
public override function resize(w:Int, h:Int) {
super.resize(w, h);
- if (field != null) field.fieldWidth = w;
+ if (field != null && autoFollow) field.fieldWidth = w;
}
public override function onHovered() {
@@ -33,7 +34,7 @@ class UIButton extends UISliceSprite {
}
public override function update(elapsed:Float) {
- field.follow(this, 0, (bHeight - field.height) / 2);
+ if (autoFollow) field.follow(this, 0, (bHeight - field.height) / 2);
if (!hovered && hasBeenPressed && FlxG.mouse.justReleased) hasBeenPressed = false;
if (autoAlpha) alpha = field.alpha = selectable ? 1 : 0.4;
super.update(elapsed);
diff --git a/source/funkin/editors/ui/UICheckbox.hx b/source/funkin/editors/ui/UICheckbox.hx
index a5bcdef3..1e078446 100644
--- a/source/funkin/editors/ui/UICheckbox.hx
+++ b/source/funkin/editors/ui/UICheckbox.hx
@@ -2,20 +2,22 @@ package funkin.editors.ui;
class UICheckbox extends UISprite {
public var checked:Bool = false;
+ public var small:Bool = false;
public var onChecked:Bool->Void = null;
public var field:UIText;
public var check:FlxSprite;
- public function new(x:Float, y:Float, text:String, checked:Bool = false, w:Int = 0) {
+ public function new(x:Float, y:Float, text:String, checked:Bool = false, w:Int = 0, small:Bool = false) {
super(x, y);
- loadGraphic(Paths.image('editors/ui/checkbox'), true, 20, 20);
+ loadGraphic(Paths.image('editors/ui/checkbox${small ? "-small" : ""}'), true, small ? 14 : 20, small ? 14 : 20);
for(frame=>name in ["normal", "hover", "pressed", "checkmark"])
animation.add(name, [frame], 0, false);
this.checked = checked;
+ this.small = small;
- field = new UIText(x, y, w, text);
+ field = new UIText(x, y, w, text, small ? 12 : 15);
check = new FlxSprite().loadGraphicFromSprite(this);
check.animation.play("checkmark");
@@ -42,7 +44,7 @@ class UICheckbox extends UISprite {
public inline function updatePositions() {
check.follow(this);
- field.follow(this, 25, 0);
+ field.follow(this, (small ? 14 : 20)+5, 0);
}
public override function draw() {
diff --git a/source/funkin/editors/ui/UINumericStepper.hx b/source/funkin/editors/ui/UINumericStepper.hx
index c561846c..d871f3c5 100644
--- a/source/funkin/editors/ui/UINumericStepper.hx
+++ b/source/funkin/editors/ui/UINumericStepper.hx
@@ -7,8 +7,8 @@ class UINumericStepper extends UITextBox {
public var max:Null = null;
public var step:Float = 1;
- public function new(x:Float, y:Float, value:Float = 0, step:Float = 1, precision:Int = 0, ?min:Float, ?max:Float, w:Int = 180, h:Int = 32) {
- super(x, y, "", w - h, h, false);
+ public function new(x:Float, y:Float, value:Float = 0, step:Float = 1, precision:Int = 0, ?min:Float, ?max:Float, w:Int = 180, h:Int = 32, small:Bool = false) {
+ super(x, y, "", w - h, h, false, small);
onChange = __onChange;
diff --git a/source/funkin/editors/ui/UITextBox.hx b/source/funkin/editors/ui/UITextBox.hx
index ffc20c49..77b07915 100644
--- a/source/funkin/editors/ui/UITextBox.hx
+++ b/source/funkin/editors/ui/UITextBox.hx
@@ -17,10 +17,10 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
var __wasFocused:Bool = false;
- public function new(x:Float, y:Float, text:String = "", width:Int = 320, height:Int = 32, multiline:Bool = false) {
- super(x, y, width, height, 'editors/ui/inputbox');
+ public function new(x:Float, y:Float, text:String = "", width:Int = 320, height:Int = 32, multiline:Bool = false, small:Bool = false) {
+ super(x, y, width, height, 'editors/ui/inputbox${small ? "-small" : ""}');
- label = new UIText(0, 0, width, text);
+ label = new UIText(0, 0, width, text, small ? 12 : 15);
members.push(label);
caretSpr = new FlxSprite(0, 0);