This commit is contained in:
Yoshman29
2023-03-15 22:20:02 +01:00
parent 2f96cbaf68
commit d72558c427
5 changed files with 11 additions and 6 deletions
+1 -1
View File
@@ -1 +1 @@
2520
2526
+1 -1
View File
@@ -15,6 +15,6 @@ class UIDebugState extends UIState {
add(new UICheckbox(10, 40, "Test checked", true));
add(new UIButton(10, 70, "Test button", function() {
trace("Hello, World!");
}, 120, 20));
}, 120, 32));
}
}
+6 -2
View File
@@ -15,11 +15,14 @@ class UIButton extends UISprite {
field.fieldWidth = w;
}
public override function new(x:Float, y:Float, text:String, callback:Void->Void, w:Float = 120, h:Float = 20) {
public override function new(x:Float, y:Float, text:String, callback:Void->Void, w:Float = 120, h:Float = 32) {
super(x, y);
frames = CoolUtil.loadFrames(Paths.image('editors/ui/button'));
this.callback = callback;
members.push(field = new UIText(x, y, w, text));
field.borderStyle = OUTLINE;
field.borderColor = 0x88000000;
field.borderSize = 1;
field.alignment = CENTER;
}
@@ -38,7 +41,6 @@ class UIButton extends UISprite {
}
public override function draw() {
field.follow(this, 0, ((height - field.height) / 2));
var x:Float = this.x;
var y:Float = this.y;
var offset:Int = hovered ? (pressed ? 18 : 9) : 0;
@@ -111,6 +113,8 @@ class UIButton extends UISprite {
setPosition(x, y);
field.follow(this, 0, ((bHeight - field.height) / 2));
super.drawMembers();
}
-1
View File
@@ -44,7 +44,6 @@ class UISprite extends FlxSprite {
}
public function drawMembers() {
@:privateAccess {
__oldDefCams = FlxCamera._defaultCameras;
FlxCamera._defaultCameras = cameras;
+3 -1
View File
@@ -1,10 +1,12 @@
package funkin.editors.ui;
import flixel.util.FlxColor;
import funkin.ui.FunkinText;
class UIText extends FunkinText {
// PUTTING THIS HERE IN CASE IMMA MAKE FUTURE CHANGES
public function new(x, y, w, text, size:Int = 14) {
public function new(x, y, w, text, size:Int = 15, color:FlxColor = 0xFFFFFFFF) {
super(x, y, w, text, size, false);
this.color = color;
}
}