diff --git a/.editorconfig b/.editorconfig
index def4063..179b03d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -24,7 +24,7 @@ ij_java_names_count_to_use_import_on_demand = 999
ij_java_packages_to_use_import_on_demand = unset
ij_java_blank_lines_before_class_end = 0
ij_java_blank_lines_after_class_header = 1
-ij_java_doc_align_param_comments = true
+ij_java_doc_align_param_comments = false
ij_java_doc_do_not_wrap_if_one_line = true
ij_any_keep_simple_blocks_in_one_line = true
diff --git a/android/src/main/java/me/stringfromjava/funkin/android/AndroidLauncher.java b/android/src/main/java/me/stringfromjava/funkin/android/AndroidLauncher.java
index 0898de2..2b41d46 100644
--- a/android/src/main/java/me/stringfromjava/funkin/android/AndroidLauncher.java
+++ b/android/src/main/java/me/stringfromjava/funkin/android/AndroidLauncher.java
@@ -3,7 +3,10 @@
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
+import me.stringfromjava.flixelgdx.FlixelGame;
import me.stringfromjava.funkin.FunkinGame;
+import me.stringfromjava.funkin.init.InitScreen;
+import me.stringfromjava.funkin.util.FunkinConstants;
/** Launches the Android application. */
public class AndroidLauncher extends AndroidApplication {
@@ -11,8 +14,14 @@ public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ FunkinGame game = new FunkinGame(
+ FunkinConstants.WINDOW_TITLE,
+ FunkinConstants.WINDOW_WIDTH,
+ FunkinConstants.WINDOW_HEIGHT,
+ new InitScreen()
+ );
AndroidApplicationConfiguration configuration = new AndroidApplicationConfiguration();
configuration.useImmersiveMode = true; // Recommended, but not required.
- initialize(new FunkinGame(), configuration);
+ initialize(game, configuration);
}
}
diff --git a/assets/another_test.groovy b/assets/another_test.groovy
index b162bc9..a7a42b6 100644
--- a/assets/another_test.groovy
+++ b/assets/another_test.groovy
@@ -1,10 +1,10 @@
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Input
-import me.stringfromjava.funkin.Funkin
-import me.stringfromjava.funkin.backend.Paths
-import me.stringfromjava.funkin.graphics.sprite.FunkinSprite
-import me.stringfromjava.funkin.polyverse.script.type.Script
-import me.stringfromjava.funkin.util.Constants
+import me.stringfromjava.flixelgdx.Flixel
+import me.stringfromjava.flixelgdx.backend.FlixelPaths
+import me.stringfromjava.flixelgdx.graphics.sprite.FlixelSprite
+import me.stringfromjava.funkin.util.FunkinConstants
+import me.stringfromjava.polyverse.script.type.Script
class AnotherTestClass extends Script {
@@ -16,9 +16,9 @@ class AnotherTestClass extends Script {
void onCreate() {
super.onCreate()
- Funkin.info("AnotherTestClass", "Script has been created!")
+ Flixel.info("AnotherTestClass", "Script has been created!")
- Funkin.playMusic("songs/bopeebo/Inst.ogg")
+ Flixel.playMusic("songs/bopeebo/Inst.ogg")
}
@Override
@@ -26,13 +26,13 @@ class AnotherTestClass extends Script {
super.onRender(delta)
if (Gdx.input.isKeyJustPressed(Input.Keys.SPACE)) {
- var sprite = new FunkinSprite().loadGraphic(Paths.sharedImageAsset("pauseAlt/bfLol"))
- var randomPosX = new Random().nextInt(Constants.Display.WINDOW_WIDTH)
- var randomPosY = new Random().nextInt(Constants.Display.WINDOW_HEIGHT)
+ var sprite = new FlixelSprite().loadGraphic(FlixelPaths.sharedImageAsset("pauseAlt/bfLol"))
+ var randomPosX = new Random().nextInt(FunkinConstants.WINDOW_WIDTH)
+ var randomPosY = new Random().nextInt(FunkinConstants.WINDOW_HEIGHT)
sprite.setPosition(randomPosX, randomPosY)
- Funkin.screen.add(sprite)
+ Flixel.screen.add(sprite)
}
}
@@ -40,6 +40,6 @@ class AnotherTestClass extends Script {
void onDispose() {
super.onDispose()
- Funkin.info("AnotherTestClass", "Script has been disposed!")
+ Flixel.info("AnotherTestClass", "Script has been disposed!")
}
}
diff --git a/assets/shared/images/characters/Nene.xml b/assets/shared/images/characters/Nene.xml
index 3b2d96c..0dd32df 100644
--- a/assets/shared/images/characters/Nene.xml
+++ b/assets/shared/images/characters/Nene.xml
@@ -1,6 +1,6 @@
This is where you want to do the main things, like switching screens, playing sounds/music, - * etc. + *
This is where you want to do the main things, like switching screens, playing sounds/music, etc. */ -public final class Funkin { +public final class Flixel { - /** The current {@code FunkinScreen} being displayed. */ - private static FunkinScreen screen; + /** The current {@code FlixelScreen} being displayed. */ + private static FlixelScreen screen; /** The main audio object used to create, */ private static MiniAudio engine; @@ -50,7 +49,7 @@ public final class Funkin { * The static instance used to access the core elements of the game. This includes the main loop, * setting the current screen, and more. */ - private static FunkinGame game; + private static FlixelGame game; /** Has the global manager been initialized yet? */ private static boolean initialized = false; @@ -63,7 +62,7 @@ public final class Funkin { * * @param gameInstance The instance of the game to use. */ - public static void initialize(FunkinGame gameInstance) { + public static void initialize(FlixelGame gameInstance) { if (initialized) { throw new IllegalStateException("FNF:JE has already been initialized!"); } @@ -80,12 +79,11 @@ public static void initialize(FunkinGame gameInstance) { } /** - * Sets the current screen to the provided screen. This is just a more direct version of {@code - * Funkin.game.setScreen(screen)} with some extra functionality put into it. + * Sets the current screen to the provided screen. * - * @param newScreen The new {@code FunkinScreen} to set as the current screen. + * @param newScreen The new {@code FlixelScreen} to set as the current screen. */ - public static void setScreen(FunkinScreen newScreen) { + public static void setScreen(FlixelScreen newScreen) { Signals.preScreenSwitch.dispatch(new ScreenSwitchSignalData(newScreen)); if (!initialized) { throw new IllegalStateException("FNF:JE has not been initialized yet!"); @@ -93,12 +91,12 @@ public static void setScreen(FunkinScreen newScreen) { if (newScreen == null) { throw new IllegalArgumentException("Screen cannot be null!"); } - if (Funkin.screen != null) { - Funkin.screen.hide(); - Funkin.screen.dispose(); + if (Flixel.screen != null) { + Flixel.screen.hide(); + Flixel.screen.dispose(); } - Funkin.screen = newScreen; - Funkin.screen.show(); + Flixel.screen = newScreen; + Flixel.screen.show(); Signals.postScreenSwitch.dispatch(new ScreenSwitchSignalData(newScreen)); } @@ -109,8 +107,8 @@ public static void setScreen(FunkinScreen newScreen) { * FileHandle} like so: * *
{@code
- * // Notice how it uses the Paths class provided by Funkin'.
- * Funkin.playSound(Paths.external("your/path/here").path());
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
+ * Flixel.playSound(FlixelPaths.external("your/path/here").path());
* }
*
* @param path The path to load the sound from. Note that if you're loading an external sound
@@ -129,8 +127,8 @@ public static MASound playSound(String path) {
* FileHandle} like so:
*
* {@code
- * // Notice how it uses the Paths class provided by Funkin'.
- * Funkin.playSound(Paths.external("your/path/here").path(), 1);
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
+ * Flixel.playSound(FlixelPaths.external("your/path/here").path(), 1);
* }
*
* @param path The path to load the sound from. Note that if you're loading an external sound
@@ -150,8 +148,8 @@ public static MASound playSound(String path, float volume) {
* FileHandle} like so:
*
* {@code
- * // Notice how it uses the Paths class provided by Funkin'.
- * Funkin.playSound(Paths.external("your/path/here").path(), 1, false);
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
+ * Flixel.playSound(FlixelPaths.external("your/path/here").path(), 1, false);
* }
*
* @param path The path to load the sound from. Note that if you're loading an external sound
@@ -172,9 +170,9 @@ public static MASound playSound(String path, float volume, boolean looping) {
* FileHandle} like so:
*
* {@code
- * // Notice how it uses the Paths class provided by Funkin'.
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
* // If null is passed down for the group, then the default sound group will be used.
- * Funkin.playSound(Paths.external("your/path/here").path(), 1, false, null);
+ * Flixel.playSound(FlixelPaths.external("your/path/here").path(), 1, false, null);
* }
*
* @param path The path to load the sound from. Note that if you're loading an external sound
@@ -197,11 +195,11 @@ public static MASound playSound(String path, float volume, boolean looping, MAGr
* FileHandle} like so:
*
* {@code
- * // Notice how it uses the Paths class provided by Funkin'.
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
* // If null is passed down for the group, then the default sound group will be used.
* // For the boolean attribuite "external", you only should make it true for mobile builds,
* // otherwise just simply leave it be or make it "false" for other platforms like desktop.
- * Funkin.playSound(Paths.external("your/path/here").path(), 1, false, null, true);
+ * Flixel.playSound(FlixelPaths.external("your/path/here").path(), 1, false, null, true);
* }
*
* @param path The path to load the sound from. Note that if you're loading an external sound
@@ -231,8 +229,8 @@ public static MASound playSound(@NotNull String path, float volume, boolean loop
* {@link FileHandle} like so:
*
* {@code
- * // Notice how it uses the Paths class provided by Funkin'.
- * Funkin.playMusic(Paths.external("your/path/here").path());
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
+ * Flixel.playMusic(FlixelPaths.external("your/path/here").path());
* }
*
* @param path The path to load the music from. Note that if you're loading an external sound file
@@ -250,8 +248,8 @@ public static void playMusic(String path) {
* {@link FileHandle} like so:
*
* {@code
- * // Notice how it uses the Paths class provided by Funkin'.
- * Funkin.playMusic(Paths.external("your/path/here").path(), 1);
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
+ * Flixel.playMusic(FlixelPaths.external("your/path/here").path(), 1);
* }
*
* @param path The path to load the music from. Note that if you're loading an external sound file
@@ -270,8 +268,8 @@ public static void playMusic(String path, float volume) {
* {@link FileHandle} like so:
*
* {@code
- * // Notice how it uses the Paths class provided by Funkin'.
- * Funkin.playMusic(Paths.external("your/path/here").path(), 1, false);
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
+ * Flixel.playMusic(FlixelPaths.external("your/path/here").path(), 1, false);
* }
*
* @param path The path to load the music from. Note that if you're loading an external sound file
@@ -291,10 +289,10 @@ public static void playMusic(String path, float volume, boolean looping) {
* {@link FileHandle} like so:
*
* {@code
- * // Notice how it uses the Paths class provided by Funkin'.
+ * // Notice how it uses the FlixelPaths class provided by Flixel'.
* // For the boolean attribuite "external", you only should make it true for mobile builds,
* // otherwise just simply leave it be or make it "false" for other platforms like desktop.
- * Funkin.playMusic(Paths.external("your/path/here").path(), 1, false, true);
+ * Flixel.playMusic(FlixelPaths.external("your/path/here").path(), 1, false, true);
* }
*
* @param path The path to load the music from. Note that if you're loading an external sound file
@@ -320,7 +318,7 @@ public static void playMusic(String path, float volume, boolean looping, boolean
* Sets the game master/global volume, which is automatically applied to all current sounds.
*
* (This is just a helper method for creating a faster version of {@code
- * Funkin.getAudioEngine().setMasterVolume(float)}).
+ * Flixel.getAudioEngine().setMasterVolume(float)}).
*
* @param volume The new master volume to set.
*/
@@ -338,23 +336,23 @@ public static boolean keyJustPressed(int key) {
}
public static void info(Object message) {
- info(Constants.System.LOG_TAG, message);
+ info(FlixelConstants.System.LOG_TAG, message);
}
public static void info(String tag, Object message) {
- outputLog(tag, message, FunkinLogLevel.INFO);
+ outputLog(tag, message, FlixelLogLevel.INFO);
}
public static void warn(Object message) {
- warn(Constants.System.LOG_TAG, message);
+ warn(FlixelConstants.System.LOG_TAG, message);
}
public static void warn(String tag, Object message) {
- outputLog(tag, message, FunkinLogLevel.WARN);
+ outputLog(tag, message, FlixelLogLevel.WARN);
}
public static void error(String message) {
- error(Constants.System.LOG_TAG, message, null);
+ error(FlixelConstants.System.LOG_TAG, message, null);
}
public static void error(String tag, Object message) {
@@ -363,10 +361,10 @@ public static void error(String tag, Object message) {
public static void error(String tag, Object message, Throwable throwable) {
String msg = (throwable != null) ? (message + " | Exception: " + throwable) : message.toString();
- outputLog(tag, msg, FunkinLogLevel.ERROR);
+ outputLog(tag, msg, FlixelLogLevel.ERROR);
}
- public static FunkinGame getGame() {
+ public static FlixelGame getGame() {
return game;
}
@@ -374,7 +372,7 @@ public static Stage getStage() {
return game.stage;
}
- public static FunkinScreen getScreen() {
+ public static FlixelScreen getScreen() {
return screen;
}
@@ -398,6 +396,10 @@ public static MAGroup getSoundsGroup() {
return soundsGroup;
}
+ public static float getDelta() {
+ return Gdx.graphics.getDeltaTime();
+ }
+
/**
* Contains all the global events that get dispatched when something happens in the game.
*
@@ -410,19 +412,19 @@ public static MAGroup getSoundsGroup() {
*/
public static final class Signals {
- public static final FunkinSignal If you want to change what happens to the pre and window configurations, you might want to see
+ * {@code Lwjgl3Launcher} in the {@code lwjgl3} folder.
+ */
+public abstract class FlixelGame implements ApplicationListener {
+
+ /** The title displayed on the game's window. */
+ protected String title;
+
+ /** The size of the game's starting window position and its viewport. */
+ protected Vector2 size;
+
+ /** The entry point screen the game starts in (which becomes null after the game is done setting up!). */
+ protected FlixelScreen initialScreen;
+
+ /** Is the game's window currently minimized? */
+ protected boolean isMinimized = false;
+
+ /** The main stage used for rendering all screens and sprites on screen. */
+ protected Stage stage;
+
+ /** The main viewport used to fit the world no matter the screen size. */
+ protected FitViewport viewport;
+
+ /** The main camera used to see the world. */
+ protected OrthographicCamera camera;
+
+ /** The main sprite batch used for rendering all sprites on screen. */
+ protected SpriteBatch batch;
+
+ /** The 1x1 texture used to draw the background color of the current screen. */
+ protected Texture bgTexture;
+
+ /**
+ * Creates a new game instance with the specified title, window width/height, and initial screen. This configures
+ * the game's core parts, such as the viewport, stage, etc.
+ *
+ * @param title The title of the game's window.
+ * @param width The starting width of the game's window and how wide the viewport should be.
+ * @param height The starting height of the game's window and how tall the viewport should be.
+ * @param initialScreen The initial screen to load when the game starts.
+ */
+ public FlixelGame(String title, int width, int height, FlixelScreen initialScreen) {
+ this.title = title;
+ this.size = new Vector2(width, height);
+ this.initialScreen = initialScreen;
+ }
+
+ @Override
+ public void create() {
+ configureCrashHandler(); // This should ALWAYS be called first no matter what!
+
+ batch = new SpriteBatch();
+ viewport = new FitViewport(size.x, size.y);
+ viewport.apply();
+
+ camera = new OrthographicCamera();
+ camera.setToOrtho(false, size.x, size.y);
+
+ stage = new Stage(viewport, batch);
+
+ Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
+ pixmap.setColor(Color.WHITE);
+ pixmap.fill();
+ bgTexture = new Texture(pixmap);
+ pixmap.dispose();
+
+ Flixel.setScreen(initialScreen);
+ initialScreen = null;
+ }
+
+ @Override
+ public void resize(int width, int height) {
+ viewport.update(width, height, true);
+ }
+
+ @Override
+ public void render() {
+ float delta = Gdx.graphics.getDeltaTime();
+ FlixelScreen screen = Flixel.getScreen();
+
+ Flixel.Signals.preRender.dispatch(new RenderSignalData(delta));
+
+ if (Flixel.keyJustPressed(Input.Keys.F11)) {
+ toggleFullscreen();
+ }
+
+ // Update and render the current screen that's active.
+ ScreenUtils.clear(Color.BLACK);
+ viewport.apply();
+ batch.setProjectionMatrix(camera.combined);
+ batch.begin();
+
+ if (screen != null) {
+ batch.setColor(screen.getBgColor());
+ batch.draw(bgTexture, 0, 0, viewport.getWorldWidth(), viewport.getWorldHeight());
+ batch.setColor(Color.WHITE); // Set color back to white so display objects aren't affected.
+ screen.render(delta);
+ var members = screen.members.begin();
+ for (FlixelObject object : members) {
+ if (object instanceof FlixelSprite sprite) {
+ sprite.update(delta);
+ sprite.draw(batch);
+ }
+ }
+ screen.members.end();
+ }
+
+ batch.end();
+ stage.act(delta);
+ stage.draw();
+
+ FlixelTween.getGlobalManager().update(delta);
+
+ Flixel.Signals.postRender.dispatch(new RenderSignalData(delta));
+ }
+
+ @Override
+ public void pause() {}
+
+ @Override
+ public void resume() {}
+
+ /** Called when the user regains focus on the game's window. */
+ public void onWindowFocused() {
+ Flixel.setMasterVolume(1);
+ Flixel.Signals.windowFocused.dispatch();
+ Flixel.info("Game window has regained focus.");
+ }
+
+ /** Called when the user loses focus on the game's window, while also not being minimized. */
+ public void onWindowUnfocused() {
+ if (isMinimized) {
+ return;
+ }
+ Flixel.setMasterVolume(0.008f);
+ Flixel.Signals.windowUnfocused.dispatch();
+ Flixel.info("Game window has lost focus.");
+ }
+
+ /**
+ * Called when the user minimizes the game's window.
+ *
+ * @param iconified Whether the window is iconified (minimized) or not. This parameter is provided
+ * for compatibility with the window listener in the LWJGL3 (desktop) launcher.
+ */
+ public void onWindowMinimized(boolean iconified) {
+ isMinimized = iconified;
+ if (!isMinimized) {
+ return;
+ }
+ Flixel.setMasterVolume(0);
+ Flixel.Signals.windowMinimized.dispatch();
+ Flixel.info("Game window has been minimized.");
+ }
+
+ /** Toggles fullscreen mode on or off, depending on the current state. */
+ public void toggleFullscreen() {
+ boolean isFullscreen = Gdx.graphics.isFullscreen();
+ if (isFullscreen) {
+ Gdx.graphics.setWindowedMode(FunkinConstants.WINDOW_WIDTH, FunkinConstants.WINDOW_HEIGHT);
+ Flixel.info("Exiting fullscreen mode.");
+ } else {
+ Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
+ Flixel.info("Entering fullscreen mode.");
+ }
+ }
+
+ @Override
+ public void dispose() {
+ Flixel.warn("SHUTTING DOWN GAME AND DISPOSING ALL RESOURCES.");
+
+ Flixel.Signals.preGameClose.dispatch();
+
+ Flixel.info("Disposing the screen display...");
+ Flixel.getScreen().hide();
+ Flixel.getScreen().dispose();
+ stage.dispose();
+ batch.dispose();
+ bgTexture.dispose();
+
+ Flixel.info("Disposing all sounds from sound group and music...");
+ if (Flixel.getMusic() != null) {
+ Flixel.getMusic().dispose();
+ }
+ Flixel.getSoundsGroup().dispose();
+ Flixel.getAudioEngine().dispose();
+
+ Flixel.info("Disposing and shutting down scripts...");
+ Polyverse.forAllScripts(Script::onDispose);
+
+ Flixel.Signals.postGameClose.dispatch();
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public int[] getWindowSize() {
+ return new int[]{(int) size.x, (int) size.y};
+ }
+
+ public Stage getStage() {
+ return stage;
+ }
+
+ public FitViewport getViewport() {
+ return viewport;
+ }
+
+ public OrthographicCamera getCamera() {
+ return camera;
+ }
+
+ public SpriteBatch getBatch() {
+ return batch;
+ }
+
+ public Texture getBgTexture() {
+ return bgTexture;
+ }
+
+ public boolean isMinimized() {
+ return isMinimized;
+ }
+
+ /**
+ * Configurers Flixel's crash handler to safely catch uncaught exceptions and gracefully close the game.
+ */
+ protected void configureCrashHandler() {
+ Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
+ String logs = FlixelRuntimeUtil.getFullExceptionMessage(throwable);
+ String msg = "There was an uncaught exception on thread \"" + thread.getName() + "\"!\n" + logs;
+ Flixel.error(FlixelConstants.System.LOG_TAG, msg);
+ dispose();
+ // Only use Gdx.app.exit() on non-iOS platforms to avoid App Store guideline violations!
+ if (Gdx.app.getType() != Application.ApplicationType.iOS) {
+ Gdx.app.exit();
+ }
+ });
+ }
+}
diff --git a/core/src/main/java/me/stringfromjava/funkin/backend/Paths.java b/core/src/main/java/me/stringfromjava/flixelgdx/backend/FlixelPaths.java
similarity index 86%
rename from core/src/main/java/me/stringfromjava/funkin/backend/Paths.java
rename to core/src/main/java/me/stringfromjava/flixelgdx/backend/FlixelPaths.java
index d406bab..193b68e 100644
--- a/core/src/main/java/me/stringfromjava/funkin/backend/Paths.java
+++ b/core/src/main/java/me/stringfromjava/flixelgdx/backend/FlixelPaths.java
@@ -1,10 +1,10 @@
-package me.stringfromjava.funkin.backend;
+package me.stringfromjava.flixelgdx.backend;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
/** Utility class for simplifying asset paths and libGDX {@link FileHandle}s. */
-public final class Paths {
+public final class FlixelPaths {
public static FileHandle asset(String path) {
return Gdx.files.internal(path);
@@ -26,5 +26,5 @@ public static FileHandle external(String path) {
return Gdx.files.external(path);
}
- private Paths() {}
+ private FlixelPaths() {}
}
diff --git a/core/src/main/java/me/stringfromjava/funkin/graphics/screen/FunkinScreen.java b/core/src/main/java/me/stringfromjava/flixelgdx/graphics/screen/FlixelScreen.java
similarity index 77%
rename from core/src/main/java/me/stringfromjava/funkin/graphics/screen/FunkinScreen.java
rename to core/src/main/java/me/stringfromjava/flixelgdx/graphics/screen/FlixelScreen.java
index 69d390f..daa8efa 100644
--- a/core/src/main/java/me/stringfromjava/funkin/graphics/screen/FunkinScreen.java
+++ b/core/src/main/java/me/stringfromjava/flixelgdx/graphics/screen/FlixelScreen.java
@@ -1,21 +1,21 @@
-package me.stringfromjava.funkin.graphics.screen;
+package me.stringfromjava.flixelgdx.graphics.screen;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.SnapshotArray;
-import me.stringfromjava.funkin.graphics.sprite.FunkinObject;
+import me.stringfromjava.flixelgdx.graphics.sprite.FlixelObject;
/**
* Base class for creating a better screen display with more functionality than the default {@link
* com.badlogic.gdx.Screen} interface.
*/
-public abstract class FunkinScreen implements Screen {
+public abstract class FlixelScreen implements Screen {
/** The background color of {@code this} current screen. */
protected Color bgColor;
/** All display objects that are shown in {@code this} screen. */
- public final SnapshotArray It allows you to load animations, textures, and do much more with simplicity and ease.
*/
-public class FunkinSprite extends Sprite implements FunkinObject, Pool.Poolable {
+public class FlixelSprite extends Sprite implements FlixelObject, Pool.Poolable {
/** The texture image that {@code this} sprite uses. */
protected Texture texture;
@@ -53,7 +53,7 @@ public class FunkinSprite extends Sprite implements FunkinObject, Pool.Poolable
*/
protected TextureRegion[][] frames;
- public FunkinSprite() {
+ public FlixelSprite() {
animations = new HashMap<>();
}
@@ -77,7 +77,7 @@ public void update(float delta) {
* @param path The directory of the {@code .png} to load onto {@code this} sprite.
* @return {@code this} sprite for chaining.
*/
- public FunkinSprite loadGraphic(FileHandle path) {
+ public FlixelSprite loadGraphic(FileHandle path) {
Texture texture = new Texture(path);
return loadGraphic(texture, texture.getWidth(), texture.getHeight());
}
@@ -89,7 +89,7 @@ public FunkinSprite loadGraphic(FileHandle path) {
* @param frameWidth How wide the sprite should be.
* @return {@code this} sprite for chaining.
*/
- public FunkinSprite loadGraphic(FileHandle path, int frameWidth) {
+ public FlixelSprite loadGraphic(FileHandle path, int frameWidth) {
Texture texture = new Texture(path);
return loadGraphic(texture, frameWidth, texture.getHeight());
}
@@ -102,11 +102,11 @@ public FunkinSprite loadGraphic(FileHandle path, int frameWidth) {
* @param frameHeight How tall the sprite should be.
* @return {@code this} sprite for chaining.
*/
- public FunkinSprite loadGraphic(FileHandle path, int frameWidth, int frameHeight) {
+ public FlixelSprite loadGraphic(FileHandle path, int frameWidth, int frameHeight) {
return loadGraphic(new Texture(path), frameWidth, frameHeight);
}
- public FunkinSprite loadGraphic(Texture texture, int frameWidth, int frameHeight) {
+ public FlixelSprite loadGraphic(Texture texture, int frameWidth, int frameHeight) {
frames = TextureRegion.split(texture, frameWidth, frameHeight);
// Set default visual to the first frame.
setRegion(frames[0][0]);
@@ -124,7 +124,7 @@ public FunkinSprite loadGraphic(Texture texture, int frameWidth, int frameHeight
* the sparrow atlas.
* @return {@code this} sprite for chaining.
*/
- public FunkinSprite loadSparrowFrames(FileHandle texture, FileHandle xmlFile) {
+ public FlixelSprite loadSparrowFrames(FileHandle texture, FileHandle xmlFile) {
return loadSparrowFrames(new Texture(texture), new XmlReader().parse(xmlFile));
}
@@ -137,7 +137,7 @@ public FunkinSprite loadSparrowFrames(FileHandle texture, FileHandle xmlFile) {
* of the sparrow atlas.
* @return {@code this} sprite for chaining.
*/
- public FunkinSprite loadSparrowFrames(Texture texture, XmlReader.Element xmlFile) {
+ public FlixelSprite loadSparrowFrames(Texture texture, XmlReader.Element xmlFile) {
// We store regions in a list so we can filter them by prefix later.
// TextureAtlas.AtlasRegion is used because it supports offsets.
atlasRegions = new Array<>();
diff --git a/core/src/main/java/me/stringfromjava/funkin/graphics/text/FunkinText.java b/core/src/main/java/me/stringfromjava/flixelgdx/graphics/text/FlixelText.java
similarity index 78%
rename from core/src/main/java/me/stringfromjava/funkin/graphics/text/FunkinText.java
rename to core/src/main/java/me/stringfromjava/flixelgdx/graphics/text/FlixelText.java
index da42da5..138dbba 100644
--- a/core/src/main/java/me/stringfromjava/funkin/graphics/text/FunkinText.java
+++ b/core/src/main/java/me/stringfromjava/flixelgdx/graphics/text/FlixelText.java
@@ -1,7 +1,7 @@
-package me.stringfromjava.funkin.graphics.text;
+package me.stringfromjava.flixelgdx.graphics.text;
/** A display object for creating a piece of text to show on the screen. */
-public class FunkinText {
+public class FlixelText {
/** The text to be written onto the screen. */
public String text;
@@ -15,7 +15,7 @@ public class FunkinText {
/**
* @param text The string to be displayed.
*/
- public FunkinText(String text) {
+ public FlixelText(String text) {
this.text = text;
x = 0;
y = 0;
diff --git a/core/src/main/java/me/stringfromjava/funkin/util/signal/FunkinSignal.java b/core/src/main/java/me/stringfromjava/flixelgdx/signal/FlixelSignal.java
similarity index 95%
rename from core/src/main/java/me/stringfromjava/funkin/util/signal/FunkinSignal.java
rename to core/src/main/java/me/stringfromjava/flixelgdx/signal/FlixelSignal.java
index 89d3af0..283cf0f 100644
--- a/core/src/main/java/me/stringfromjava/funkin/util/signal/FunkinSignal.java
+++ b/core/src/main/java/me/stringfromjava/flixelgdx/signal/FlixelSignal.java
@@ -1,4 +1,4 @@
-package me.stringfromjava.funkin.util.signal;
+package me.stringfromjava.flixelgdx.signal;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -6,12 +6,12 @@
* Utility class for creating objects that can execute multiple callbacks when it is dispatched (or
* triggered).
*/
-public class FunkinSignal Note that this doesn't have to be used on sprites, it can be used on just about anything!
*/
-public class FunkinTween implements Pool.Poolable {
+public class FlixelTween implements Pool.Poolable {
/** The global tween manager for the entire game. */
- protected static FunkinTweenManager globalManager = new FunkinTweenManager();
+ protected static FlixelTweenManager globalManager = new FlixelTweenManager();
/** The object to tween. */
protected Object object;
/** The settings used for how the tween is handled and calculated (aka how it looks and animates). */
- protected FunkinTweenSettings tweenSettings;
+ protected FlixelTweenSettings tweenSettings;
/** The parent manager that {@code this} tween gets updated in. */
- protected FunkinTweenManager manager;
+ protected FlixelTweenManager manager;
/** How far the tween is tweening itself. This is what's used to actually tween the object! */
protected float scale = 0.0f;
/** The update callback for {@code this} tween to change the objects values every update. */
- protected FunkinTween.FunkinTweenUpdateCallback updateCallback;
+ protected FlixelTween.FunkinTweenUpdateCallback updateCallback;
/** How many seconds has elapsed since {@code this} tween started. */
protected float secondsSinceStart = 0.0f;
@@ -67,14 +67,14 @@ public class FunkinTween implements Pool.Poolable {
protected Field[] fieldsCache = null;
/** Default constructor for pooling purposes. */
- protected FunkinTween() {}
+ protected FlixelTween() {}
/**
* Constructs a new tween.
*
* Note that this does NOT add the tween to the global manager, it just assigns its main
* values. That's it. If you wish to create a tween to automatically start working, you might want
- * to see {@link FunkinTween#tween(Object object, FunkinTweenSettings tweenSettings,
+ * to see {@link FlixelTween#tween(Object object, FlixelTweenSettings tweenSettings,
* FunkinTweenUpdateCallback updateCallback)}.
*
* @param object The object to tween values.
@@ -82,8 +82,8 @@ protected FunkinTween() {}
* for.
* @param updateCallback Callback function for updating the objects values when the tween updates.
*/
- protected FunkinTween(
- Object object, FunkinTweenSettings settings, FunkinTweenUpdateCallback updateCallback) {
+ protected FlixelTween(
+ Object object, FlixelTweenSettings settings, FunkinTweenUpdateCallback updateCallback) {
this.object = object;
this.tweenSettings = settings;
this.updateCallback = updateCallback;
@@ -97,9 +97,9 @@ protected FunkinTween(
* @param updateCallback Callback function for updating the objects values when the tween updates.
* @return The newly created and started tween.
*/
- public static FunkinTween tween(
- Object object, FunkinTweenSettings tweenSettings, FunkinTweenUpdateCallback updateCallback) {
- return new FunkinTween(object, tweenSettings, updateCallback).setManager(globalManager).start();
+ public static FlixelTween tween(
+ Object object, FlixelTweenSettings tweenSettings, FunkinTweenUpdateCallback updateCallback) {
+ return new FlixelTween(object, tweenSettings, updateCallback).setManager(globalManager).start();
}
public void update(float delta) {
@@ -154,7 +154,7 @@ public void update(float delta) {
var newValues = new HashMap If you want to change what happens to the pre and window configurations, you might want to see
- * {@code Lwjgl3Launcher} in the {@code lwjgl3} folder.
+ * The main Funkin' game class that initializes and runs the game.
*/
-public class FunkinGame implements ApplicationListener {
-
- /** Is the game's window currently minimized? */
- protected boolean isMinimized = false;
-
- /** The main stage used for rendering all screens and sprites on screen. */
- protected Stage stage;
-
- /** The main viewport used to fit the world no matter the screen size. */
- protected FitViewport viewport;
-
- /** The main camera used to see the world. */
- protected OrthographicCamera camera;
-
- /** The main sprite batch used for rendering all sprites on screen. */
- protected SpriteBatch batch;
+public class FunkinGame extends FlixelGame {
- /** The 1x1 texture used to draw the background color of the current screen. */
- protected Texture bgTexture;
-
- @Override
- public void create() {
- configureCrashHandler(); // Crash handler for uncaught exceptions.
- configureWindow(); // Window and viewport.
- configurePolyverse(); // Polyverse scripting and modding system.
- Funkin.setScreen(new InitScreen());
+ public FunkinGame(String title, int width, int height, FlixelScreen initialScreen) {
+ super(title, width, height, initialScreen);
}
@Override
- public void resize(int width, int height) {
- viewport.update(width, height, true);
+ public void create() {
+ super.create();
+ configurePolyverse(); // Scripting and modding support.
}
@Override
public void render() {
- float delta = Gdx.graphics.getDeltaTime();
- FunkinScreen screen = Funkin.getScreen();
-
- Funkin.Signals.preRender.dispatch(new RenderSignalData(delta));
-
- if (Funkin.keyJustPressed(Input.Keys.F11)) {
- toggleFullscreen();
- }
-
- // Update and render the current screen that's active.
- ScreenUtils.clear(Color.BLACK);
- viewport.apply();
- batch.setProjectionMatrix(camera.combined);
- batch.begin();
-
- if (screen != null) {
- batch.setColor(screen.getBgColor());
- batch.draw(bgTexture, 0, 0, viewport.getWorldWidth(), viewport.getWorldHeight());
- batch.setColor(Color.WHITE); // Set color back to white so display objects aren't affected.
- screen.render(delta);
- var members = screen.members.begin();
- for (FunkinObject object : members) {
- if (object instanceof FunkinSprite sprite) {
- sprite.update(delta);
- sprite.draw(batch);
- }
- }
- screen.members.end();
- }
-
- batch.end();
- stage.act(delta);
- stage.draw();
-
- FunkinTween.getGlobalManager().update(delta);
- Polyverse.forAllScripts(script -> script.onRender(delta));
-
- Funkin.Signals.postRender.dispatch(new RenderSignalData(delta));
- }
-
- @Override
- public void pause() {}
-
- @Override
- public void resume() {}
-
- /** Called when the user regains focus on the game's window. */
- public void onWindowFocused() {
- Funkin.setMasterVolume(1);
- Funkin.Signals.windowFocused.dispatch();
- Funkin.info("Game window has regained focus.");
- }
-
- /** Called when the user loses focus on the game's window, while also not being minimized. */
- public void onWindowUnfocused() {
- if (isMinimized) {
- return;
- }
- Funkin.setMasterVolume(0.008f);
- Funkin.Signals.windowUnfocused.dispatch();
- Funkin.info("Game window has lost focus.");
- }
-
- /**
- * Called when the user minimizes the game's window.
- *
- * @param iconified Whether the window is iconified (minimized) or not. This parameter is provided
- * for compatibility with the window listener in the LWJGL3 (desktop) launcher.
- */
- public void onWindowMinimized(boolean iconified) {
- isMinimized = iconified;
- if (!isMinimized) {
- return;
- }
- Funkin.setMasterVolume(0);
- Funkin.Signals.windowMinimized.dispatch();
- Funkin.info("Game window has been minimized.");
- }
-
- /** Toggles fullscreen mode on or off, depending on the current state. */
- public void toggleFullscreen() {
- boolean isFullscreen = Gdx.graphics.isFullscreen();
- if (isFullscreen) {
- Gdx.graphics.setWindowedMode(Constants.Display.WINDOW_WIDTH, Constants.Display.WINDOW_HEIGHT);
- Funkin.info("Exiting fullscreen mode.");
- } else {
- Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
- Funkin.info("Entering fullscreen mode.");
- }
- }
-
- @Override
- public void dispose() {
- Funkin.warn("SHUTTING DOWN GAME AND DISPOSING ALL RESOURCES.");
-
- Funkin.Signals.preGameClose.dispatch();
-
- Funkin.info("Disposing the screen display...");
- Funkin.getScreen().hide();
- Funkin.getScreen().dispose();
- stage.dispose();
- batch.dispose();
- bgTexture.dispose();
-
- Funkin.info("Disposing all sounds from sound group and music...");
- if (Funkin.getMusic() != null) {
- Funkin.getMusic().dispose();
- }
- Funkin.getSoundsGroup().dispose();
- Funkin.getAudioEngine().dispose();
-
- Funkin.info("Disposing and shutting down scripts...");
- Polyverse.forAllScripts(Script::onDispose);
-
- Funkin.Signals.postGameClose.dispatch();
- }
-
- public boolean isMinimized() {
- return isMinimized;
- }
-
- private void configureCrashHandler() {
- Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
- String logs = FunkinRuntimeUtil.getFullExceptionMessage(throwable);
- String msg = "There was an uncaught exception on thread \"" + thread.getName() + "\"!\n" + logs;
- Funkin.error(Constants.System.LOG_TAG, msg);
- dispose();
- // Only use Gdx.app.exit() on non-iOS platforms to avoid App Store guideline violations!
- if (Gdx.app.getType() != Application.ApplicationType.iOS) {
- Gdx.app.exit();
- }
- });
- }
-
- private void configureWindow() {
- var wWidth = Constants.Display.WINDOW_WIDTH;
- var wHeight = Constants.Display.WINDOW_HEIGHT;
-
- batch = new SpriteBatch();
- viewport = new FitViewport(wWidth, wHeight);
- viewport.apply();
-
- camera = new OrthographicCamera();
- camera.setToOrtho(false, wWidth, wHeight);
-
- stage = new Stage(viewport, batch);
+ super.render();
- Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
- pixmap.setColor(Color.WHITE);
- pixmap.fill();
- bgTexture = new Texture(pixmap);
- pixmap.dispose();
+ Polyverse.forAllScripts(script -> script.onRender(Flixel.getDelta()));
}
private void configurePolyverse() {
@@ -226,7 +35,7 @@ private void configurePolyverse() {
Polyverse.registerScriptType(Script.class); // Master type, DO NOT REMOVE THIS!
Polyverse.registerScriptType(SystemScript.class);
- Polyverse.registerScript(Paths.asset("test.groovy"));
- Polyverse.registerScript(Paths.asset("another_test.groovy"));
+ Polyverse.registerScript(FlixelPaths.asset("test.groovy"));
+ Polyverse.registerScript(FlixelPaths.asset("another_test.groovy"));
}
}
diff --git a/core/src/main/java/me/stringfromjava/funkin/game/InitScreen.java b/core/src/main/java/me/stringfromjava/funkin/game/InitScreen.java
deleted file mode 100644
index 6f67f69..0000000
--- a/core/src/main/java/me/stringfromjava/funkin/game/InitScreen.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package me.stringfromjava.funkin.game;
-
-import me.stringfromjava.funkin.Funkin;
-import me.stringfromjava.funkin.game.menus.TitleScreen;
-import me.stringfromjava.funkin.graphics.screen.FunkinScreen;
-
-public class InitScreen extends FunkinScreen {
-
- @Override
- public void show() {
- super.show();
- Funkin.setScreen(new TitleScreen());
- }
-}
diff --git a/core/src/main/java/me/stringfromjava/funkin/game/menus/TitleScreen.java b/core/src/main/java/me/stringfromjava/funkin/game/menus/TitleScreen.java
deleted file mode 100644
index ab95517..0000000
--- a/core/src/main/java/me/stringfromjava/funkin/game/menus/TitleScreen.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package me.stringfromjava.funkin.game.menus;
-
-import com.badlogic.gdx.Input;
-import games.rednblack.miniaudio.MASound;
-import me.stringfromjava.funkin.Funkin;
-import me.stringfromjava.funkin.backend.Paths;
-import me.stringfromjava.funkin.graphics.screen.FunkinScreen;
-import me.stringfromjava.funkin.graphics.sprite.FunkinSprite;
-import me.stringfromjava.funkin.tween.FunkinEase;
-import me.stringfromjava.funkin.tween.FunkinTween;
-import me.stringfromjava.funkin.tween.settings.FunkinTweenSettings;
-import me.stringfromjava.funkin.tween.settings.FunkinTweenType;
-
-public class TitleScreen extends FunkinScreen {
-
- private FunkinSprite logo;
-
- private FunkinTween tween;
- private MASound tickleFight;
-
- @Override
- public void show() {
- super.show();
-
- var t = Paths.sharedImageAsset("noteStrumline");
- var xml = Paths.shared("images/noteStrumline.xml");
- logo = new FunkinSprite().loadSparrowFrames(t, xml);
- logo.addAnimationByPrefix("test", "confirmDown", 24, false);
- add(logo);
-
- tickleFight = Funkin.playSound("shared/sounds/tickleFight.ogg");
-// Funkin.playMusic("preload/music/freakyMenu/freakyMenu.ogg", 0.5f);
-
- FunkinTweenSettings settings = new FunkinTweenSettings()
- .addGoal("x", 600)
- .addGoal("y", 40)
- .addGoal("rotation", 180)
- .setDuration(0.7f)
- .setEase(FunkinEase::circInOut)
- .setType(FunkinTweenType.PERSIST);
- tween = FunkinTween.tween(logo, settings, values -> {
- logo.setX(values.get("x"));
- logo.setY(values.get("y"));
- logo.setRotation(values.get("rotation"));
- }).stop();
- }
-
- @Override
- public void render(float elapsed) {
- super.render(elapsed);
-
- float speed = 500 * elapsed;
- if (Funkin.keyPressed(Input.Keys.W)) {
- logo.setY(logo.getY() + speed);
- }
- if (Funkin.keyPressed(Input.Keys.S)) {
- logo.setY(logo.getY() - speed);
- }
- if (Funkin.keyPressed(Input.Keys.A)) {
- logo.setX(logo.getX() - speed);
- }
- if (Funkin.keyPressed(Input.Keys.D)) {
- logo.setX(logo.getX() + speed);
- }
-
- if (Funkin.keyJustPressed(Input.Keys.SPACE)) {
- logo.playAnimation("test", true);
- }
-
- if (Funkin.keyJustPressed(Input.Keys.T)) {
- tween.start();
- }
-
- if (Funkin.keyJustPressed(Input.Keys.R)) {
- tween.reset();
- }
-
- if (Funkin.keyJustPressed(Input.Keys.Y)) {
- if (tween.paused) {
- tween.resume();
- } else {
- tween.pause();
- }
- }
-
- if (Funkin.keyJustPressed(Input.Keys.Z)) {
- tickleFight.play();
- }
- }
-}
diff --git a/core/src/main/java/me/stringfromjava/funkin/graphics/sprite/FunkinObject.java b/core/src/main/java/me/stringfromjava/funkin/graphics/sprite/FunkinObject.java
deleted file mode 100644
index f7ee545..0000000
--- a/core/src/main/java/me/stringfromjava/funkin/graphics/sprite/FunkinObject.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package me.stringfromjava.funkin.graphics.sprite;
-
-/**
- * An interface which allows any class that implements it to be added to a {@link
- * me.stringfromjava.funkin.graphics.screen.FunkinScreen}.
- */
-public interface FunkinObject {}
diff --git a/core/src/main/java/me/stringfromjava/funkin/init/InitScreen.java b/core/src/main/java/me/stringfromjava/funkin/init/InitScreen.java
new file mode 100644
index 0000000..1f89de2
--- /dev/null
+++ b/core/src/main/java/me/stringfromjava/funkin/init/InitScreen.java
@@ -0,0 +1,14 @@
+package me.stringfromjava.funkin.init;
+
+import me.stringfromjava.flixelgdx.graphics.screen.FlixelScreen;
+import me.stringfromjava.flixelgdx.Flixel;
+import me.stringfromjava.funkin.menus.TitleScreen;
+
+public class InitScreen extends FlixelScreen {
+
+ @Override
+ public void show() {
+ super.show();
+ Flixel.setScreen(new TitleScreen());
+ }
+}
diff --git a/core/src/main/java/me/stringfromjava/funkin/menus/TitleScreen.java b/core/src/main/java/me/stringfromjava/funkin/menus/TitleScreen.java
new file mode 100644
index 0000000..bd6715d
--- /dev/null
+++ b/core/src/main/java/me/stringfromjava/funkin/menus/TitleScreen.java
@@ -0,0 +1,90 @@
+package me.stringfromjava.funkin.menus;
+
+import com.badlogic.gdx.Input;
+import games.rednblack.miniaudio.MASound;
+import me.stringfromjava.flixelgdx.Flixel;
+import me.stringfromjava.flixelgdx.backend.FlixelPaths;
+import me.stringfromjava.flixelgdx.graphics.screen.FlixelScreen;
+import me.stringfromjava.flixelgdx.graphics.sprite.FlixelSprite;
+import me.stringfromjava.flixelgdx.tween.FlixelEase;
+import me.stringfromjava.flixelgdx.tween.FlixelTween;
+import me.stringfromjava.flixelgdx.tween.settings.FlixelTweenSettings;
+import me.stringfromjava.flixelgdx.tween.settings.FlixelTweenType;
+
+public class TitleScreen extends FlixelScreen {
+
+ private FlixelSprite logo;
+
+ private FlixelTween tween;
+ private MASound tickleFight;
+
+ @Override
+ public void show() {
+ super.show();
+
+ var t = FlixelPaths.sharedImageAsset("noteStrumline");
+ var xml = FlixelPaths.shared("images/noteStrumline.xml");
+ logo = new FlixelSprite().loadSparrowFrames(t, xml);
+ logo.addAnimationByPrefix("test", "confirmDown", 24, false);
+ add(logo);
+
+ tickleFight = Flixel.playSound("shared/sounds/tickleFight.ogg");
+// Flixel.playMusic("preload/music/freakyMenu/freakyMenu.ogg", 0.5f);
+
+ FlixelTweenSettings settings = new FlixelTweenSettings()
+ .addGoal("x", 600)
+ .addGoal("y", 40)
+ .addGoal("rotation", 180)
+ .setDuration(0.7f)
+ .setEase(FlixelEase::circInOut)
+ .setType(FlixelTweenType.PERSIST);
+ tween = FlixelTween.tween(logo, settings, values -> {
+ logo.setX(values.get("x"));
+ logo.setY(values.get("y"));
+ logo.setRotation(values.get("rotation"));
+ }).stop();
+ }
+
+ @Override
+ public void render(float elapsed) {
+ super.render(elapsed);
+
+ float speed = 500 * elapsed;
+ if (Flixel.keyPressed(Input.Keys.W)) {
+ logo.setY(logo.getY() + speed);
+ }
+ if (Flixel.keyPressed(Input.Keys.S)) {
+ logo.setY(logo.getY() - speed);
+ }
+ if (Flixel.keyPressed(Input.Keys.A)) {
+ logo.setX(logo.getX() - speed);
+ }
+ if (Flixel.keyPressed(Input.Keys.D)) {
+ logo.setX(logo.getX() + speed);
+ }
+
+ if (Flixel.keyJustPressed(Input.Keys.SPACE)) {
+ logo.playAnimation("test", true);
+ }
+
+ if (Flixel.keyJustPressed(Input.Keys.T)) {
+ tween.start();
+ }
+
+ if (Flixel.keyJustPressed(Input.Keys.R)) {
+ tween.reset();
+ }
+
+ if (Flixel.keyJustPressed(Input.Keys.Y)) {
+ if (tween.paused) {
+ tween.resume();
+ } else {
+ tween.pause();
+ }
+ }
+
+ if (Flixel.keyJustPressed(Input.Keys.Z)) {
+ tickleFight.play();
+ }
+ }
+}
diff --git a/core/src/main/java/me/stringfromjava/funkin/util/FunkinConstants.java b/core/src/main/java/me/stringfromjava/funkin/util/FunkinConstants.java
new file mode 100644
index 0000000..ced76f0
--- /dev/null
+++ b/core/src/main/java/me/stringfromjava/funkin/util/FunkinConstants.java
@@ -0,0 +1,26 @@
+package me.stringfromjava.funkin.util;
+
+/**
+ * Constants used throughout Funkin'.
+ */
+public final class FunkinConstants {
+
+ /**
+ * The default title for the game's window.
+ */
+ public static final String WINDOW_TITLE = "Friday Night Funkin': Java Edition";
+
+ /**
+ * How wide the window's viewport is in pixels. This also affects how wide the window is when
+ * the game first starts up.
+ */
+ public static final int WINDOW_WIDTH = 1280;
+
+ /**
+ * How tall the window's viewport is in pixels. This also affects how tall the window is when
+ * the game first starts up.
+ */
+ public static final int WINDOW_HEIGHT = 720;
+
+ private FunkinConstants() {}
+}
diff --git a/core/src/main/java/me/stringfromjava/funkin/util/signal/FunkinSignalData.java b/core/src/main/java/me/stringfromjava/funkin/util/signal/FunkinSignalData.java
deleted file mode 100644
index 93f71ad..0000000
--- a/core/src/main/java/me/stringfromjava/funkin/util/signal/FunkinSignalData.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package me.stringfromjava.funkin.util.signal;
-
-import games.rednblack.miniaudio.MASound;
-import me.stringfromjava.funkin.graphics.screen.FunkinScreen;
-
-/**
- * Convenience class for holding all signal data records used in the default signals stored in
- * the global {@link me.stringfromjava.funkin.Funkin} manager class.
- */
-public final class FunkinSignalData {
-
- public record RenderSignalData(float delta) {
-
- }
-
- public record ScreenSwitchSignalData(FunkinScreen screen) {
-
- }
-
- public record SoundPlayedSignalData(MASound sound) {
-
- }
-
- public record MusicPlayedSignalData(MASound music) {
-
- }
-
- private FunkinSignalData() {
- }
-
-}
-
diff --git a/core/src/main/java/me/stringfromjava/funkin/polyverse/Polyverse.java b/core/src/main/java/me/stringfromjava/polyverse/Polyverse.java
similarity index 91%
rename from core/src/main/java/me/stringfromjava/funkin/polyverse/Polyverse.java
rename to core/src/main/java/me/stringfromjava/polyverse/Polyverse.java
index 81c746c..6daace4 100644
--- a/core/src/main/java/me/stringfromjava/funkin/polyverse/Polyverse.java
+++ b/core/src/main/java/me/stringfromjava/polyverse/Polyverse.java
@@ -1,9 +1,9 @@
-package me.stringfromjava.funkin.polyverse;
+package me.stringfromjava.polyverse;
import com.badlogic.gdx.files.FileHandle;
import groovy.lang.GroovyClassLoader;
-import me.stringfromjava.funkin.Funkin;
-import me.stringfromjava.funkin.polyverse.script.type.Script;
+import me.stringfromjava.flixelgdx.Flixel;
+import me.stringfromjava.polyverse.script.type.Script;
import java.util.ArrayList;
import java.util.Collections;
@@ -12,7 +12,7 @@
import java.util.Map;
import java.util.function.Consumer;
-/** Core manager class for managing the Polyverse mod engine for FNF:JE. */
+/** Core manager class for managing the Polyverse scripting and modding engine. */
public final class Polyverse {
/** A map that stores lists of scripts based on their parent class type. */
@@ -81,7 +81,7 @@ public static void registerScript(FileHandle handle) {
var typeScripts = scripts.get(mostSpecificType);
if (!typeScripts.contains(script)) {
typeScripts.add(script);
- Funkin.info(
+ Flixel.info(
"Polyverse",
"Registered Polyverse script \""
+ script.getClass().getSimpleName()
@@ -93,14 +93,14 @@ public static void registerScript(FileHandle handle) {
script.onCreate();
}
} catch (Exception e) {
- Funkin.error("Polyverse", "Failed to load script: " + handle.path(), e);
+ Flixel.error("Polyverse", "Failed to load script: " + handle.path(), e);
}
}
/**
* Executes an action for each script of a certain type, with error handling.
*
- * @param type The class type of scripts to iterate over.
+ * @param type The class type of scripts to iterate over.
* @param action The action to perform on each script.
*/
public static