1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-21 14:23:00 +00:00

some selection shader stuff in progress

This commit is contained in:
Cameron Taylor 2024-09-30 21:48:15 -04:00
parent 097dbf5bb4
commit 1189c226ee
3 changed files with 31 additions and 13 deletions

View file

@ -7,8 +7,17 @@ import flixel.addons.display.FlxRuntimeShader;
*/
class InverseDotsShader extends FlxRuntimeShader
{
public function new()
public var amount:Float;
public function new(amount:Float = 1.0)
{
super(Assets.getText(Paths.frag("InverseDots")));
setAmount(amount);
}
public function setAmount(value:Float):Void
{
this.amount = value;
this.setFloat("_amount", amount);
}
}

View file

@ -3,6 +3,7 @@ package funkin.ui.debug.stageeditor;
import funkin.data.animation.AnimationData;
import funkin.graphics.FunkinSprite;
import funkin.modding.events.ScriptEvent;
import funkin.graphics.shaders.InverseDotsShader;
/**
* Contains all the Logic needed for Stage Editor. Only for Stage Editor, as in the gameplay StageProps and Boppers will be used.
@ -14,6 +15,8 @@ class StageEditorObject extends FunkinSprite
*/
public var name:String = "Unnamed";
public var selectedShader:InverseDotsShader;
/**
* What animation to play upon starting.
*/
@ -24,6 +27,9 @@ class StageEditorObject extends FunkinSprite
override public function new()
{
super();
selectedShader = new InverseDotsShader(0);
shader = selectedShader;
}
/**
@ -31,7 +37,7 @@ class StageEditorObject extends FunkinSprite
*/
public var isDebugged(default, set):Bool = true;
function set_isDebugged(value:Bool)
function set_isDebugged(value:Bool):Bool
{
this.isDebugged = value;

View file

@ -143,10 +143,12 @@ class StageEditorState extends UIState
if (selectedSprite != null)
{
spriteMarker.setGraphicSize(Std.int(selectedSprite.width), Std.int(selectedSprite.height));
spriteMarker.updateHitbox();
// spriteMarker.setGraphicSize(Std.int(selectedSprite.width), Std.int(selectedSprite.height));
// spriteMarker.updateHitbox();
}
selectedSprite?.selectedShader.setAmount(1);
return selectedSprite;
}
@ -370,10 +372,10 @@ class StageEditorState extends UIState
add(charGroups[CharacterType.BF]);
// ui
spriteMarker = new FlxSprite().makeGraphic(1, 1, FlxColor.CYAN);
spriteMarker.alpha = 0.3;
spriteMarker.zIndex = MAX_Z_INDEX + CHARACTER_COLORS.length + 3; // PLEASE
add(spriteMarker);
// spriteMarker = new FlxSprite().makeGraphic(1, 1, FlxColor.CYAN);
// spriteMarker.alpha = 0.3;
// spriteMarker.zIndex = MAX_Z_INDEX + CHARACTER_COLORS.length + 3; // PLEASE
// add(spriteMarker);
camFields = new FlxTypedGroup<FlxSprite>();
camFields.visible = false;
@ -522,7 +524,7 @@ class StageEditorState extends UIState
for (char in getCharacters())
char.alpha = 1;
spriteMarker.visible = camMarker.visible = false;
// spriteMarker.visible = camMarker.visible = false;
findObjDialog.hideDialog(DialogButton.CANCEL);
// cam
@ -625,6 +627,7 @@ class StageEditorState extends UIState
if (FlxG.mouse.justPressed && allowInput && spr.visible && !FlxG.keys.pressed.SHIFT && !isCursorOverHaxeUI)
{
selectedSprite.selectedShader.setAmount(0);
selectedSprite = spr;
updateDialog(StageEditorDialogType.OBJECT);
}
@ -734,12 +737,12 @@ class StageEditorState extends UIState
nameTxt.x = FlxG.mouse.getScreenPosition(camHUD).x;
nameTxt.y = FlxG.mouse.getScreenPosition(camHUD).y - nameTxt.height;
spriteMarker.visible = (moveMode == "assets" && selectedSprite != null);
// spriteMarker.visible = (moveMode == "assets" && selectedSprite != null);
camMarker.visible = moveMode == "chars";
if (selectedSprite != null) spriteMarker.setPosition(selectedSprite.x, selectedSprite.y);
// if (selectedSprite != null) spriteMarker.setPosition(selectedSprite.x, selectedSprite.y);
for (item in sprDependant)
item.disabled = !spriteMarker.visible;
// for (item in sprDependant)
// item.disabled = !spriteMarker.visible;
menubarItemPaste.disabled = copiedSprite == null;
menubarItemFindObj.disabled = !(moveMode == "assets");