HELP ME!!!! button

This commit is contained in:
Yoshman29
2022-10-23 03:32:42 +02:00
parent 5304827035
commit 489f3abe64
5 changed files with 15 additions and 4 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

+1 -1
View File
@@ -1 +1 @@
739
741
+1 -1
View File
@@ -77,7 +77,7 @@ class Window extends FlxTypedGroup<FlxBasic> {
caption = new FlxUIText(24, 4, 0, content.title);
captionButtons = new FlxTypedSpriteGroup<WindowCaptionButton>();
for(i in 0...3) {
for(i in 0...4) {
var btn = new WindowCaptionButton(this, i);
btn.x = (i+1) * -(DesktopMain.theme.captionButtons.size.x + DesktopMain.theme.captionButtons.margin.x);
captionButtons.add(btn);
@@ -6,6 +6,8 @@ class WindowCaptionButton extends FlxSprite {
public var icon:FlxSprite;
public var window:Window;
public static var anims:Array<String> = ["minimize", "maximize", "close", "restore", "help"];
public function new(window:Window, i:Int) {
// super(0, 0, "", function() {
// switch(i) {
@@ -18,8 +20,11 @@ class WindowCaptionButton extends FlxSprite {
ID = i;
loadGraphic(Paths.image(DesktopMain.theme.captionButtons.sprite), true, Std.int(DesktopMain.theme.captionButtons.size.x), Std.int(DesktopMain.theme.captionButtons.size.y));
animation.add("button", [for(l in 0...6) i+(l*3)], 0, true);
animation.play("button");
for(k=>e in anims) {
animation.add(e, [for(l in 0...6) k + (l * anims.length)], 0, true);
}
animation.play(anims[ID]);
// resize(18, 18);
// color = (i > 0) ? 0xFF8888FF : 0xFFFF0000;
@@ -40,6 +45,8 @@ class WindowCaptionButton extends FlxSprite {
switch(ID) {
case 0:
window.close();
case 1:
}
mouseInput.cancel();
return;
@@ -2,6 +2,7 @@ package funkin.desktop.windows;
import flixel.FlxG;
import flixel.FlxObject;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
class WindowDragHitbox extends FlxObject {
@@ -34,6 +35,9 @@ class WindowDragHitbox extends FlxObject {
if (!parent.moveable) return;
if (dragging) {
var screenPos = FlxG.mouse.getScreenPosition(FlxG.camera);
screenPos.x = FlxMath.bound(screenPos.x, 0, FlxG.camera.width);
screenPos.y = FlxMath.bound(screenPos.y, 0, FlxG.camera.height);
if (DesktopMain.instance.mouseInput.justReleased) {
dragging = false;
offset.put();