placeholder winxp luna theme
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
<settings folder="desktop/ui/">
|
||||
<captionActive path="caption" left="5" top="29" right="5" bottom="5" />
|
||||
<captionInactive path="captionInactive" left="5" top="29" right="5" bottom="5" />
|
||||
<captionButtons path="captionButtons" size="21,21" margin="2,0" offset="5,5" />
|
||||
</settings>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
+1
-1
@@ -1 +1 @@
|
||||
708
|
||||
714
|
||||
@@ -19,7 +19,7 @@ class DesktopMain extends MusicBeatState {
|
||||
public var wallpaper:FlxSprite;
|
||||
public var screenSize:FlxPoint;
|
||||
|
||||
public var windows:WindowGroup;
|
||||
public var windows:WindowGroup<Window>;
|
||||
|
||||
public static var instance:DesktopMain;
|
||||
|
||||
@@ -44,7 +44,7 @@ class DesktopMain extends MusicBeatState {
|
||||
|
||||
screenSize = new FlxPoint(-1, -1);
|
||||
|
||||
windows = new WindowGroup();
|
||||
windows = new WindowGroup<Window>();
|
||||
add(windows);
|
||||
}
|
||||
|
||||
@@ -76,6 +76,23 @@ class DesktopMain extends MusicBeatState {
|
||||
// TODO: switch back while using config
|
||||
FlxG.resizeGame(1280, 720);
|
||||
}
|
||||
|
||||
public function focusWindow(window:Window) {
|
||||
windows.remove(window, true);
|
||||
windows.add(window);
|
||||
layerCameras();
|
||||
}
|
||||
|
||||
public function layerCameras() {
|
||||
for(win in windows.members) {
|
||||
FlxG.cameras.remove(win.windowCaptionCamera, false);
|
||||
for(e in win.windowCameras) FlxG.cameras.remove(e.camera, false);
|
||||
}
|
||||
for(win in windows.members) {
|
||||
FlxG.cameras.add(win.windowCaptionCamera, false);
|
||||
for(e in win.windowCameras) FlxG.cameras.add(e.camera, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MouseInput {
|
||||
|
||||
@@ -32,6 +32,7 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
public var windowCameras:Array<WindowCam> = [];
|
||||
|
||||
private var __captionTweens:Array<FlxTween> = [];
|
||||
private var __closing:Bool = false;
|
||||
|
||||
public var content:WindowContent;
|
||||
|
||||
@@ -39,9 +40,15 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
public var icon:FlxSprite;
|
||||
public var dragHitbox:WindowDragHitbox;
|
||||
|
||||
public var draggable:Bool = true;
|
||||
public var moveable:Bool = true;
|
||||
public var resizeable:Bool = true;
|
||||
|
||||
public var focused(get, null):Bool;
|
||||
|
||||
private function get_focused() {
|
||||
return DesktopMain.instance.windows.members.last() == this;
|
||||
}
|
||||
|
||||
public function loadIcon(path:String) {
|
||||
icon.loadGraphic(path);
|
||||
icon.setUnstretchedGraphicSize(16, 16, false);
|
||||
@@ -160,6 +167,10 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
var i = members.length;
|
||||
|
||||
var shouldCancel = DesktopMain.instance.mouseInput.overlapsRect(this, new Rectangle(0, 0, windowCaptionCamera.width, windowCaptionCamera.height), windowCaptionCamera);
|
||||
|
||||
if (shouldCancel && DesktopMain.instance.mouseInput.justPressed)
|
||||
DesktopMain.instance.focusWindow(this);
|
||||
|
||||
// updates them backwards!!
|
||||
while(i > 0) {
|
||||
i--;
|
||||
@@ -172,6 +183,7 @@ class Window extends FlxTypedGroup<FlxBasic> {
|
||||
}
|
||||
|
||||
public function close() {
|
||||
__closing = true;
|
||||
DesktopMain.instance.windows.remove(this, true);
|
||||
destroy();
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class WindowDragHitbox extends FlxObject {
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
super.update(elapsed);
|
||||
if (!parent.moveable) return;
|
||||
if (dragging) {
|
||||
var screenPos = FlxG.mouse.getScreenPosition(FlxG.camera);
|
||||
if (DesktopMain.instance.mouseInput.justReleased) {
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
package funkin.desktop.windows;
|
||||
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.FlxBasic;
|
||||
|
||||
class WindowGroup extends FlxTypedGroup<Window> {
|
||||
class WindowGroup<T:FlxBasic> extends FlxTypedGroup<T> {
|
||||
public override function update(elapsed:Float) {
|
||||
// update them backwards, so that the top most window gets the priority
|
||||
var i = length-1;
|
||||
while(i >= 0) {
|
||||
var window = members[i];
|
||||
if (window == null || !window.exists) {
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
window.update(elapsed);
|
||||
|
||||
var i = length;
|
||||
while(i > 0) {
|
||||
i--;
|
||||
var window = members[i];
|
||||
if (window == null || !window.exists)
|
||||
continue;
|
||||
window.update(elapsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,4 +188,11 @@ class CoolUtil
|
||||
obj.y = (cam.height - obj.height) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last member of array
|
||||
*/
|
||||
public static function last<T>(array:Array<T>):T {
|
||||
return array[array.length-1];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user