Skip to content

Commit

Permalink
better docs + bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
cyn0x8 committed Dec 23, 2024
1 parent 3e85e34 commit 9e48dbf
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 64 deletions.
34 changes: 17 additions & 17 deletions _polymod_meta.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"title": "modlauncher",
"description": "ingame launcher for fnf mod states",
"homepage": "https://github.com/cyn0x8/modlauncher",

"contributors": [
{"name": "cyn0x8", "role": "coder"}
],

"license": "MIT",

"api_version": "0.5.0",
"mod_version": "3.0.1",

"dependencies": {
"cynlib": "2.* || 3.*"
}
{
"title": "modlauncher",
"description": "ingame launcher for fnf mod states",
"homepage": "https://github.com/cyn0x8/modlauncher",

"contributors": [
{"name": "cyn0x8", "role": "coder"}
],

"license": "MIT",

"api_version": "0.5.0",
"mod_version": "3.0.2",

"dependencies": {
"cynlib": "2.* || 3.*"
}
}
74 changes: 35 additions & 39 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,57 @@

ingame launcher for fnf mod states

## overview
## Overview

just drag `modlauncher.zip` into your mods folder and you're good to go!
Just drag `modlauncher.zip` into your mods folder and you're good to go!

when in the main menu, press `TAB` to open the launcher ui and your `BACK` key to close it
When in the main menu, press `TAB` to open the launcher UI and your `BACK` key to close it. While it's open, you'll see banners of any mods that have bound to the launcher. You can navigate between them with your `UI_LEFT` and `UI_RIGHT` keys, and press your `ACCEPT` key to "launch" the selected mod. You can also cancel the selection by pressing `BACK` before the state transition starts.

in the launcher, you will see banners of any mods that have bound to the launcher
## Dependencies

you can navigate between them with your `UI_LEFT` and `UI_RIGHT` keys, and press your `ACCEPT` key to "launch" the selected mod
- [cynlib (2.x-3.x)](https://github.com/cyn0x8/cynlib/releases)

you can also cancel the selection by pressing `BACK` before the state transition starts

## dependencies

- [cynlib 2.x-3.x](https://github.com/cyn0x8/cynlib/releases)

## screenshots
## Screenshots

![no mods example](./images/modlauncher/meta/examples/none.png)

![bound mods example](./images/modlauncher/meta/examples/bound.png)

## for developers
## For developers

The following documentation is also available in the `modlauncher.Registry` code, but here it is for your convenience:

to bind your mod, you must call `bind` from the `modlauncher.Registry` module and pass in a single struct with the following fields:
To bind your mod, you must call `bind` from the `modlauncher.Registry` module and pass in an anonymous struct which requires the following fields of `LauncherData`:

|field|type|description|
|Field|Type|Description|
|-|-|-|
|`name`|`String`|the name of your mod as it will appear in the launcher|
|`target`|`String`|class name of the `ScriptedMusicBeatState` you want to open|
|`logoPath`|`String`|the path to your mod's logo (will be passed into `Paths.image`)<br>defaults to the modlauncher icon|
|`selectSoundPath`|`Null<String>`|the path to your mod's select sound (will be passed into `Paths.sound`)<br>defaults to `"confirmMenu"`|
|`selectDuration`|`Null<Float>`|the time in seconds from when the player selcts your mod to the end of the state transition, minimum `1.5`<br>the selection is cancellable until `0.5` seconds before this duration (when the state transition starts)<br>defaults to `1.5`|
|`onSetup`|`Null<(Dynamic)->Void>`|callback to run when modlauncher is injected into the main menu, useful for setting up your mod banner in the launcher|
|`onUpdate`|`Null<(Dynamic, Float)->Void>`|callback to run every frame while the launcher is open, useful for animating your banner<br>the 2nd parameter is delta time in seconds|
|`onFocus`|`Null<(Dynamic)->Void>`|callback to run when your mod is "focused" on|
|`onUnfocus`|`Null<(Dynamic)->Void>`|callback to run when another mod is focused on away from yours|
|`onSelect`|`Null<(Dynamic)->Void>`|callback to run when your mod is selected|
|`onCancel`|`Null<(Dynamic)->Void>`|callback to run when your mod selection is cancelled before the state transition starts|
|`onInit`|`Null<(Dynamic)->Void>`|callback to run after your mod is selected and right before your target state is initialized, useful for "initializing" your mod|

the `Dynamic` parameter passed into the callbacks is the same as the struct you passed into `bind`, but with a few more fields used for the banner:

|field|type|description|
|`name`|`String`|The name of your mod as it will appear in the launcher.|
|`target`|`String`|Full class name of the `ScriptedMusicBeatState` you want to open after your mod is selected. For example, `"exampleMod.states.InitState"`.|
|`logoPath`|`String`|The path to your mod's logo (will be passed into `Paths.image`).<br>Defaults to the modlauncher icon.|
|`selectSoundPath`|`Null<String>`|The path to your mod's select sound (will be passed into `Paths.sound`).<br>Defaults to `"confirmMenu"`.|
|`selectDuration`|`Null<Float>`|The time in seconds from when the player selcts your mod to the end of the state transition, minimum `1.5`.<br>The selection is cancellable until `0.5` seconds before this duration (when the state transition starts).<br>Defaults to `1.5`.|
|`onSetup`|`Null<(LauncherData)->Void>`|Callback to run when modlauncher is injected into the main menu.<br>Useful for setting up your mod banner in the launcher.|
|`onUpdate`|`Null<(LauncherData, Float)->Void>`|Callback to run every frame while the launcher is open.<br>Useful for animating your banner<br>The 2nd parameter is delta-time in seconds.|
|`onFocus`|`Null<(LauncherData)->Void>`|Callback to run when your mod is "focused" on.|
|`onUnfocus`|`Null<(LauncherData)->Void>`|Callback to run when another mod is focused on away from yours.|
|`onSelect`|`Null<(LauncherData)->Void>`|Callback to run when your mod is initially selected, before the state transition starts.|
|`onCancel`|`Null<(LauncherData)->Void>`|Callback to run when your mod selection is cancelled before the state transition starts.|
|`onInit`|`Null<(LauncherData)->Void>`|Callback to run after your mod is selected, and right before your target state is initialized.<br>Useful for "initializing" your mod if you're not using an initialization state (I recommend the latter, though).|

The `LauncherData` parameter passed into the callbacks is the same as the struct you passed into `bind`, but with a few more fields used for the banner:

|Field|Type|Description|
|-|-|-|
|`camera`|`FunkinCamera`|the camera of your mod's banner in the launcher|
|`groupBG`|`FlxTypedSpriteGroup`|bg group for your mod's banner|
|`groupUI`|`FlxTypedSpriteGroup`|ui group for your mod's banner|
|`logo`|`FunkinSprite`|the logo of your mod, part of `groupUI`|
|`camera`|`FunkinCamera`|The camera of your mod's banner in the launcher.|
|`groupBG`|`FlxTypedSpriteGroup`|The background group of your mod's banner.|
|`groupUI`|`FlxTypedSpriteGroup`|The UI group of your mod's banner.|
|`logo`|`FunkinSprite`|The logo sprite of your mod's banner, part of `groupUI`.|

if you modify or add to this parameter, it will carry over into the callbacks
So, if you add to this struct in one of your callbacks, it will carry over into the other callbacks.

---

example binding:
Example binding:

```haxe
package exampleMod;
Expand Down Expand Up @@ -125,7 +121,7 @@ class LauncherBinding extends ScriptedModule {
}]);
}
// bind to other fnf mod launchers maybe? up to you
// Bind to other FNF mod launchers as well? Up to you...
ModuleHandler.getModule("cynlib.reloader.Reloader").scriptGet("reloadPre").set("exampleMod.LauncherBinding", {
callback: "tryBind"
Expand All @@ -135,4 +131,4 @@ class LauncherBinding extends ScriptedModule {
```

> [!important]
> bound mods do not persist through polymod reload! you must re-bind your mods using the reloader module like in the example above
> Bound mods do not persist through polymod reload! You must re-bind your mods using the `cynlib.reloader.Reloader` module like in the example above.
Loading

0 comments on commit 9e48dbf

Please # to comment.