11 changed files

This commit is contained in:
Yoshman29
2022-12-22 03:05:06 +01:00
parent 0fab92dca3
commit e1d22daec0
11 changed files with 47 additions and 29 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
<theme folder="desktop/ui/">
<!-- WINDOW!! !-->
<captionActive path="caption" textColor="255,255,255" left="5" top="30" right="5" bottom="5" />
<captionInactive path="captionInactive" textColor="216,228,248" left="5" top="30" right="5" bottom="5" />
<captionActive path="caption" textColor="#FFFFFF" left="5" top="30" right="5" bottom="5" textSize="16" />
<captionInactive path="captionInactive" textColor="#AAFFFFFF" left="5" top="30" right="5" bottom="5" />
<captionButtons path="captionButtons" size="21,21" margin="2,0" offset="4,6" />
<window color="255,255,255" textColor="0,0,0" font="file://C:/Windows/fonts/tahoma.ttf" fontSize="11"/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

+1 -1
View File
@@ -1 +1 @@
1668
1675
@@ -29,19 +29,18 @@ class CharacterEditor extends WindowContent {
// stage
var bg = new FlxSprite(-600, -200).loadAnimatedGraphic(Paths.image('stages/default/stageback'));
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);
var stageCurtains = new FlxSprite(-500, -300).loadAnimatedGraphic(Paths.image('stages/default/stagecurtains'));
stageCurtains.scrollFactor.set(1.3, 1.3);
char = new Character(100, 100, curCharacter, false);
for(e in [bg, stageFront, stageCurtains]) {
char = new Character(100, 100, curCharacter, false, false);
for(e in [bg, stageFront]) {
e.antialiasing = true;
}
add(bg);
add(stageFront);
add(char);
add(stageCurtains);
// character setup & following
camFollow = new FlxObject(0, 0, 2, 2);
@@ -55,10 +54,10 @@ class CharacterEditor extends WindowContent {
public override function update(elapsed:Float) {
super.update(elapsed);
if (parent.focused) {
if (FlxG.keys.pressed.RIGHT) camFollow.x += elapsed * 200;
if (FlxG.keys.pressed.LEFT) camFollow.x -= elapsed * 200;
if (FlxG.keys.pressed.DOWN) camFollow.y += elapsed * 200;
if (FlxG.keys.pressed.UP) camFollow.y -= elapsed * 200;
if (FlxG.keys.pressed.RIGHT) camFollow.x += elapsed * 500;
if (FlxG.keys.pressed.LEFT) camFollow.x -= elapsed * 500;
if (FlxG.keys.pressed.DOWN) camFollow.y += elapsed * 500;
if (FlxG.keys.pressed.UP) camFollow.y -= elapsed * 500;
}
}
}
@@ -74,6 +74,8 @@ class EditorPlayState extends WindowContent {
public override function update(elapsed:Float) {
beforeStateShit();
super.update(elapsed);
@:privateAccess
FlxG.cameras.update(elapsed);
state.tryUpdate(elapsed);
afterStateShit();
}
+1 -2
View File
@@ -31,8 +31,7 @@ class MessageBox extends WindowContent {
setSize(Std.int(Math.max(text.width + 20, 240)), Std.int(text.height + 20));
if (__buttons == null) __buttons = ["OK"];
else if (__buttons.length <= 0) __buttons.push("OK");
if (__buttons == null || __buttons.length <= 0) __buttons = ["OK"];
var firstButt:Button = null;
for(k=>b in __buttons) {
+14 -6
View File
@@ -9,16 +9,24 @@ class WindowText extends FlxText {
super(x, y, w, t);
color = 0xFF000000;
scrollFactor.set();
size = 12;
applyFontSettings(DesktopMain.theme.window);
// setFormat(Paths.font(.font))
}
public function applyFontSettings(data:ThemeData) {
var fontPath = Paths.font(data.font);
if (data.font.startsWith("file://")) {
fontPath = data.font.substr(7);
while(fontPath.charAt(0) == "/") fontPath = fontPath.substr(1);
if (data.font != null) {
var fontPath:String;
if (data.font.startsWith("file://")) {
fontPath = data.font.substr(7);
while(fontPath.charAt(0) == "/") fontPath = fontPath.substr(1);
} else {
fontPath = Paths.font(data.font);
}
font = fontPath;
}
setFormat(fontPath, Std.int(data.fontSize), data.textColor);
if (data.fontSize != null)
size = Std.int(data.fontSize);
if (data.textColor != null)
color = data.textColor;
}
}
+3 -3
View File
@@ -89,10 +89,10 @@ class Theme {
class ThemeData implements IFlxDestroyable {
public var sprite:String = "";
public var font:String = "";
public var fontSize:Float = 12;
public var font:String = null;
public var fontSize:Null<Float> = null;
public var textColor:FlxColor = FlxColor.BLACK;
public var textColor:Null<FlxColor> = null;
public var color:FlxColor = FlxColor.WHITE;
public var left:Float = 4;
+10 -3
View File
@@ -40,7 +40,7 @@ class Window extends FlxTypedGroup<FlxBasic> {
public var content:WindowContent;
public var caption:FlxUIText;
public var caption:WindowText;
public var icon:FlxSprite;
public var dragHitbox:WindowDragHitbox;
@@ -91,20 +91,27 @@ class Window extends FlxTypedGroup<FlxBasic> {
add(windowFrame);
add(windowInactiveFrame);
caption = new FlxUIText(24, 4, 0, content.title);
caption = new WindowText(24, 4, 0, content.title);
caption.applyFontSettings(DesktopMain.theme.captionActive);
caption.borderSize = 1.25;
caption.borderStyle = OUTLINE;
caption.borderColor = 0x63000000;
captionButtons = new FlxTypedSpriteGroup<WindowCaptionButton>();
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);
}
caption.y = (DesktopMain.theme.captionActive.top - caption.height) / 2;
add(caption);
dragHitbox = new WindowDragHitbox(DesktopMain.theme.captionActive.left, DesktopMain.theme.captionActive.left, DesktopMain.theme.captionActive.left, DesktopMain.theme.captionActive.top);
dragHitbox.parent = this;
add(dragHitbox);
icon = new FlxSprite(4, 4);
icon = new FlxSprite(4, (DesktopMain.theme.captionActive.top - 16) / 2);
add(icon);
loadIcon(content.icon);
@@ -32,7 +32,10 @@ class WindowDragHitbox extends FlxObject {
public override function update(elapsed:Float) {
super.update(elapsed);
if (!parent.moveable) return;
if (!parent.moveable || parent.maximized) {
dragging = false;
return;
}
if (dragging) {
var screenPos = FlxG.mouse.getScreenPosition(FlxG.camera);
screenPos.x = FlxMath.bound(screenPos.x, 0, FlxG.camera.width);
+2 -2
View File
@@ -74,7 +74,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
if (!event.cancelled) playAnim(event.animName, event.force, SING, event.reversed, event.frame);
}
public function new(x:Float, y:Float, ?character:String = "bf", ?isPlayer:Bool = false)
public function new(x:Float, y:Float, ?character:String = "bf", isPlayer:Bool = false, switchAnims:Bool = true)
{
super(x, y);
@@ -172,7 +172,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom
// [ true ][ false ][ true ]
// [ false ][ true ][ true ]
// [ true ][ true ][ false ]
if (isPlayer != playerOffsets)
if (isPlayer != playerOffsets && switchAnims)
{
// character is flipped
CoolUtil.switchAnimFrames(animation.getByName('singRIGHT'), animation.getByName('singLEFT'));