Skip to content

Commit

Permalink
starting to implement export
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed Nov 2, 2024
1 parent 8b1aa76 commit 2abc94d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/funkin/ui/debug/char/CharCreatorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class CharCreatorState extends UIState
if (FlxG.mouse.justPressed || FlxG.mouse.justPressedRight) FunkinSound.playOnce(Paths.sound("chartingSounds/ClickDown"));
if (FlxG.mouse.justReleased || FlxG.mouse.justReleasedRight) FunkinSound.playOnce(Paths.sound("chartingSounds/ClickUp"));

handleShortcuts();

if (!CharCreatorUtil.isCursorOverHaxeUI)
{
if (camGame.zoom > 0.11) MouseUtil.mouseWheelZoom();
Expand All @@ -96,6 +98,12 @@ class CharCreatorState extends UIState
function setupUICallbacks()
{
menubarOptionGameplay.onChange = function(_) switchToPage(Gameplay);
menubarItemExport.onClick = _ -> exportCharacter();
}

function handleShortcuts():Void
{
if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.S) exportCharacter();
}

function wizardComplete(params:WizardGenerateParams)
Expand Down Expand Up @@ -150,6 +158,13 @@ class CharCreatorState extends UIState
selectedPage.fillUpBottomBar(bottomBarLeftBox, bottomBarMiddleBox, bottomBarRightBox);
selectedPage.fillUpPageSettings(menubarMenuSettings);
}

function exportCharacter():Void
{
funkin.util.FileUtil.saveFile(haxe.io.Bytes.ofString("lol"), [funkin.util.FileUtil.FILE_FILTER_JSON], (path:String) -> {
trace('PATH: $path');
});
}
}

enum CharCreatorPage
Expand Down

4 comments on commit 2abc94d

@KoloInDaCrib
Copy link
Owner

@KoloInDaCrib KoloInDaCrib commented on 2abc94d Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a small suggestion for export - considering the wizard files also save the path and also considering openfl.Assets path is also supported via CharCreatorUtil, perhaps you could make it if openfl.Assets detects the file in the assets folder it doesnt add the wizard file to the export files

That way we could save on file size!

@lemz1
Copy link
Collaborator Author

@lemz1 lemz1 commented on 2abc94d Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for clarification:
i thought we only export the character.json file.
do we export the .png, .xml, etc. files as well?

@KoloInDaCrib
Copy link
Owner

@KoloInDaCrib KoloInDaCrib commented on 2abc94d Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought we might as well since you could load files from anywhere on the computer, kind of like how chart editor does it except in a simple .zip file instead of an .fnfc

@lemz1
Copy link
Collaborator Author

@lemz1 lemz1 commented on 2abc94d Nov 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know - im gonna keep this in mind while implementing the export functionality

Please sign in to comment.