forgot to push stuff haha fuck you wiz
This commit is contained in:
@@ -33,10 +33,10 @@ class Button extends FlxObject {
|
||||
var pressedButton = DesktopMain.theme.pressedButton;
|
||||
var disabledButton = DesktopMain.theme.disabledButton;
|
||||
|
||||
normalSprite = new SpliceSprite(normalButton.sprite, x, y, 75, 24, normalButton.left, normalButton.top, normalButton.bottom, normalButton.right);
|
||||
hoverSprite = new SpliceSprite(hoverButton.sprite, x, y, 75, 24, hoverButton.left, hoverButton.top, hoverButton.bottom, hoverButton.right);
|
||||
pressedSprite = new SpliceSprite(pressedButton.sprite, x, y, 75, 24, pressedButton.left, pressedButton.top, pressedButton.bottom, pressedButton.right);
|
||||
disabledSprite = new SpliceSprite(disabledButton.sprite, x, y, 75, 24, disabledButton.left, disabledButton.top, disabledButton.bottom, disabledButton.right);
|
||||
normalSprite = new SpliceSprite(Paths.image(normalButton.sprite), x, y, 75, 24, normalButton.left, normalButton.top, normalButton.bottom, normalButton.right);
|
||||
hoverSprite = new SpliceSprite(Paths.image(hoverButton.sprite), x, y, 75, 24, hoverButton.left, hoverButton.top, hoverButton.bottom, hoverButton.right);
|
||||
pressedSprite = new SpliceSprite(Paths.image(pressedButton.sprite), x, y, 75, 24, pressedButton.left, pressedButton.top, pressedButton.bottom, pressedButton.right);
|
||||
disabledSprite = new SpliceSprite(Paths.image(disabledButton.sprite), x, y, 75, 24, disabledButton.left, disabledButton.top, disabledButton.bottom, disabledButton.right);
|
||||
|
||||
label = new FlxUIText(0, 0, 75, text);
|
||||
}
|
||||
@@ -62,6 +62,13 @@ class Button extends FlxObject {
|
||||
|
||||
for(e in [normalSprite, hoverSprite, pressedSprite, disabledSprite])
|
||||
e.update(elapsed);
|
||||
|
||||
label.color = switch(frame) {
|
||||
case 1: DesktopMain.theme.hoverButton.textColor;
|
||||
case 2: DesktopMain.theme.pressedButton.textColor;
|
||||
case 3: DesktopMain.theme.disabledButton.textColor;
|
||||
default: DesktopMain.theme.normalButton.textColor;
|
||||
}
|
||||
}
|
||||
|
||||
public override function destroy() {
|
||||
|
||||
@@ -16,6 +16,7 @@ class SpliceSprite extends FlxObject {
|
||||
public var right:FlxSprite = new FlxSprite();
|
||||
public var topRight:FlxSprite = new FlxSprite();
|
||||
public var top:FlxSprite = new FlxSprite();
|
||||
public var middle:FlxSprite = new FlxSprite();
|
||||
|
||||
public var __internalSprite:FlxSprite;
|
||||
public var slice:Array<Int> = [0, 0, 0, 0];
|
||||
@@ -53,6 +54,7 @@ class SpliceSprite extends FlxObject {
|
||||
right.pixels = new BitmapData(_right, _height - _up - _down, true, 0);
|
||||
topRight.pixels = new BitmapData(_right, _up, true, 0);
|
||||
top.pixels = new BitmapData(_width - _left - _right, _up, true, 0);
|
||||
middle.pixels = new BitmapData(_width - _left - _right, _height - _up - _down, true, 0);
|
||||
|
||||
|
||||
for(e in parts) e.pixels.lock();
|
||||
@@ -66,6 +68,7 @@ class SpliceSprite extends FlxObject {
|
||||
right.pixels.copyPixels(__internalSprite.pixels, new Rectangle(_width - _right, _up, _right, _height - _down - _up), pos);
|
||||
topRight.pixels.copyPixels(__internalSprite.pixels, new Rectangle(_width - _right, 0, _right, _up), pos);
|
||||
top.pixels.copyPixels(__internalSprite.pixels, new Rectangle(_left, 0, _width - _left - _right, _up), pos);
|
||||
middle.pixels.copyPixels(__internalSprite.pixels, new Rectangle(_left, _up, _width - _left - _right, _height - _up - _down), pos);
|
||||
|
||||
for(e in parts) e.pixels.unlock();
|
||||
}
|
||||
@@ -84,7 +87,7 @@ class SpliceSprite extends FlxObject {
|
||||
public override function draw() {
|
||||
if (!visible) return;
|
||||
super.draw();
|
||||
var parts = [topLeft, left, bottomLeft, bottom, bottomRight, right, topRight, top];
|
||||
var parts = [topLeft, left, bottomLeft, bottom, bottomRight, right, topRight, top, middle];
|
||||
|
||||
var _left:Int = slice[0];
|
||||
var _down:Int = slice[1];
|
||||
@@ -111,6 +114,10 @@ class SpliceSprite extends FlxObject {
|
||||
right.setSpriteSize(_right, height - _up - _down);
|
||||
bottomRight.setPosition(x + (width - _right), y + height - _down);
|
||||
|
||||
// middle by dj snake
|
||||
middle.setPosition(x + _left, y + _up);
|
||||
middle.setSpriteSize(width - _left - _right, height - _up - _down);
|
||||
|
||||
for(e in parts) {
|
||||
e.cameras = cameras;
|
||||
e.scrollFactor.set(scrollFactor.x, scrollFactor.y);
|
||||
|
||||
@@ -45,7 +45,6 @@ class Theme {
|
||||
if (access.has.folder) prefix = access.att.folder.trim();
|
||||
for(element in access.elements) {
|
||||
var name:String = element.name.trim();
|
||||
trace(name);
|
||||
if (!Type.getInstanceFields(Theme).contains(name)) continue;
|
||||
var field = Reflect.field(this, name);
|
||||
if (!(field is ThemeData)) continue;
|
||||
|
||||
@@ -47,6 +47,12 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
|
||||
public var focused(get, null):Bool;
|
||||
|
||||
public var curDialog:Window = null;
|
||||
|
||||
public function openDialog(window:Window) {
|
||||
curDialog = window;
|
||||
if (focused) DesktopMain.instance.focusWindow(curDialog);
|
||||
}
|
||||
private function get_focused() {
|
||||
return DesktopMain.instance.windows.members.last() == this;
|
||||
}
|
||||
@@ -138,13 +144,18 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
caption.text = text;
|
||||
}
|
||||
|
||||
public function popupCamera(cam:FlxCamera) {
|
||||
cam.flashSprite.scaleX = 0.85;
|
||||
cam.flashSprite.scaleY = 0.85;
|
||||
cam.alpha = 0;
|
||||
|
||||
__captionTweens.push(FlxTween.tween(cam.flashSprite, {scaleX: 1, scaleY: 1}, 1/3, {ease: FlxEase.cubeOut}));
|
||||
__captionTweens.push(FlxTween.tween(cam, {alpha: 1}, 1/3, {ease: FlxEase.cubeOut}));
|
||||
public function popupCamera(cam:FlxCamera, popout:Bool = false, ?onFinish:FlxTween->Void) {
|
||||
if (popout) {
|
||||
__captionTweens.push(FlxTween.tween(cam.flashSprite, {scaleX: 0.85, scaleY: 0.85}, 1/5, {ease: FlxEase.quintOut}));
|
||||
__captionTweens.push(FlxTween.tween(cam, {alpha: 0}, 1/5, {ease: FlxEase.quintOut, onComplete: onFinish}));
|
||||
} else {
|
||||
cam.flashSprite.scaleX = 0.85;
|
||||
cam.flashSprite.scaleY = 0.85;
|
||||
cam.alpha = 0;
|
||||
|
||||
__captionTweens.push(FlxTween.tween(cam.flashSprite, {scaleX: 1, scaleY: 1}, 1/3, {ease: FlxEase.cubeOut}));
|
||||
__captionTweens.push(FlxTween.tween(cam, {alpha: 1}, 1/3, {ease: FlxEase.cubeOut, onComplete: onFinish}));
|
||||
}
|
||||
}
|
||||
public override function destroy() {
|
||||
super.destroy();
|
||||
@@ -177,8 +188,8 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
if (__closing) {
|
||||
DesktopMain.instance.windows.remove(this, true);
|
||||
destroy();
|
||||
// DesktopMain.instance.windows.remove(this, true);
|
||||
// destroy();
|
||||
return;
|
||||
}
|
||||
windowInactiveFrame.visible = !(windowFrame.visible = focused);
|
||||
@@ -189,6 +200,16 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
if (shouldCancel && DesktopMain.instance.mouseInput.justPressed)
|
||||
DesktopMain.instance.focusWindow(this);
|
||||
|
||||
if (curDialog != null && curDialog.exists) {
|
||||
if (shouldCancel) {
|
||||
DesktopMain.instance.mouseInput.cancel();
|
||||
if (DesktopMain.instance.mouseInput.justPressed) {
|
||||
// TODO: sounds
|
||||
DesktopMain.instance.focusWindow(curDialog);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// updates them backwards!!
|
||||
while(i > 0) {
|
||||
i--;
|
||||
@@ -202,6 +223,11 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
|
||||
public function close() {
|
||||
__closing = true;
|
||||
popupCamera(windowCaptionCamera, true, function(t) {
|
||||
DesktopMain.instance.windows.remove(this, true);
|
||||
destroy();
|
||||
});
|
||||
for(e in windowCameras) popupCamera(e.camera, true);
|
||||
}
|
||||
|
||||
public function updateWindowFrame() {
|
||||
|
||||
Reference in New Issue
Block a user