small character editor progress

This commit is contained in:
Yoshman29
2022-12-23 21:29:29 +01:00
parent 31fadb9c7b
commit f69a41a0ed
10 changed files with 52 additions and 20 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

+1 -1
View File
@@ -1 +1 @@
1719
1729
@@ -8,20 +8,21 @@ import flixel.FlxG;
class CharacterEditor extends WindowContent {
public function new(curCharacter:String) {
super('Character Editor - Loading...', 0, 0, 800, 600);
super('Character Editor - Loading...', 0, 0, 1200, 600);
}
public var camHUD:FlxCamera;
public var char:Character;
public var curCharacter:String;
public var camFollow:FlxObject;
public var tabView:TabView;
public override function create() {
super.create();
// camera stuff
parent.windowCameras[0].resizeScroll = false;
camHUD = new FlxCamera(800, 600, 1);
camHUD = new FlxCamera(0, 0, 1200, 600, 1);
camHUD.pixelPerfectRender = true;
camHUD.bgColor = 0;
parent.addCamera(camHUD);
@@ -31,24 +32,32 @@ class CharacterEditor extends WindowContent {
bg.scrollFactor.set(0.9, 0.9);
var stageFront = new FlxSprite(-600, 600).loadAnimatedGraphic(Paths.image('stages/default/stagefront'));
stageFront.scrollFactor.set(0.9, 0.9);
char = new Character(100, 100, curCharacter, false, false);
for(e in [bg, stageFront]) {
for(e in [bg, stageFront])
e.antialiasing = true;
}
add(bg);
add(stageFront);
add(char);
title = 'Character Editor - ${char.curCharacter}.xml';
// character setup & following
camFollow = new FlxObject(0, 0, 2, 2);
var charMidpoint = char.getGraphicMidpoint();
camFollow = new FlxObject(0, 0, 2, 2);
camFollow.setPosition(charMidpoint.x, charMidpoint.y);
add(camFollow);
windowCamera.follow(camFollow, LOCKON, 999);
title = 'Character Editor - ${char.curCharacter}.xml';
// interface setup
setupTabView();
}
public function setupTabView() {
tabView = new TabView(800, 20, 400, 580, ["Animation Settings", "Character Settings"]);
tabView.updateAnchor(1, 0, [camHUD]);
add(tabView);
}
public override function update(elapsed:Float) {
@@ -60,4 +69,8 @@ class CharacterEditor extends WindowContent {
if (FlxG.keys.pressed.UP) camFollow.y -= elapsed * 500;
}
}
public override function onWindowResize(width:Int, height:Int) {
tabView.resize(400, height - 20);
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ class HelloWorld extends WindowContent {
add(t);
var tabs = new TabView(330, 10, 300, 500, ["Tab 1", "Tab 2", "Tab 3"]);
tabs.updateScrollFactor(0, 0);
tabs.updateAnchor(1, 0);
add(tabs);
+2 -1
View File
@@ -1 +1,2 @@
using funkin.desktop.DesktopUtils;
using funkin.desktop.DesktopUtils;
using funkin.desktop.windows.ContextMenu;
+1
View File
@@ -1,5 +1,6 @@
package funkin.desktop.sprites;
import flixel.FlxObject;
import flixel.math.FlxRect;
import flixel.FlxSprite;
import flixel.FlxBasic;
+15
View File
@@ -0,0 +1,15 @@
package funkin.desktop.sprites;
import flixel.FlxBasic;
import funkin.desktop.windows.WindowGroup;
class TopMenu extends WindowGroup<FlxBasic> {
public function new(trees:Array<TopMenuTree>) {
super();
}
}
typedef TopMenuTree = {
var name:String;
var options:Array<ContextOption>;
}
+1
View File
@@ -299,5 +299,6 @@ class Window extends FlxTypedGroup<FlxBasic> {
e.camera.scroll.set(-Std.int(e.camera.width - e.width), -Std.int(e.camera.height - e.height));
}
}
content.onWindowResize(windowWidth, windowHeight);
}
}
@@ -81,6 +81,9 @@ class WindowContent extends WindowGroup<FlxBasic> {
}
public function onWindowResize(width:Int, height:Int) {
}
public function onDesktopSizeChange(width:Int, height:Int) {
+8 -10
View File
@@ -21,36 +21,34 @@ class WindowGroup<T:FlxBasic> extends FlxTypedGroup<T> {
var o = cast(obj, FlxObject);
o.x += x;
o.y += y;
o.scrollFactor.x = scrollFactor.x;
o.scrollFactor.y = scrollFactor.y;
} else if (obj is WindowGroup) {
var o:WindowGroup<FlxBasic> = cast obj;
o.x += x;
o.y += y;
o.scrollFactor.x = scrollFactor.x;
o.scrollFactor.y = scrollFactor.y;
}
__updateObjScrollFactor(obj);
return obj;
}
public function updateScrollFactor(x:Float, y:Float) {
public function updateAnchor(x:Float, y:Float, ?cameras:Array<FlxCamera>) {
scrollFactor.set(x, y);
if (cameras != null) this.cameras = cameras;
if (!updateScrolls) return;
for(obj in members)
__updateObjScrollFactor(obj);
__updateObjScrollFactor(obj, cameras);
}
private function __updateObjScrollFactor(obj:FlxBasic) {
private function __updateObjScrollFactor(obj:FlxBasic, ?cameras:Array<FlxCamera>) {
if (obj is FlxObject) {
var o = cast(obj, FlxObject);
o.scrollFactor.x = scrollFactor.x;
o.scrollFactor.y = scrollFactor.y;
if (cameras != null) o.cameras = cameras;
o.scrollFactor.set(scrollFactor.x, scrollFactor.y);
} else if (obj is WindowGroup) {
var o:WindowGroup<FlxBasic> = cast obj;
o.updateScrollFactor(scrollFactor.x, scrollFactor.y);
o.updateAnchor(scrollFactor.x, scrollFactor.y, cameras);
}
}