Skip to content

Commit 7d620e7

Browse files
Rename Syntrix to Polyverse since it's better
1 parent 464f52b commit 7d620e7

File tree

5 files changed

+38
-12
lines changed

5 files changed

+38
-12
lines changed

assets/new_screen.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import me.stringfromjava.funkin.Funkin
77
import me.stringfromjava.funkin.backend.display.FunkinScreen
88
import me.stringfromjava.funkin.backend.system.Paths
99

10-
Funkin.Signals.postRender.add { params ->
10+
Funkin.Signals.postRender.add {params ->
1111
if (Gdx.input.isKeyJustPressed(Input.Keys.P)) {
1212
Funkin.setScreen(new ScriptedScreen())
1313
}

assets/test.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ println(count)
1515
var newSprite = new Sprite(new Texture(Paths.shared("images/transitionSwag/stickers-set-1/bfSticker1.png")))
1616
Funkin.screen.add(newSprite)
1717

18-
Funkin.Signals.postRender.add { params ->
18+
Funkin.Signals.postRender.add {params ->
1919
var delta = Gdx.graphics.getDeltaTime()
2020
if (Gdx.input.isKeyPressed(Input.Keys.W)) {
2121
newSprite.y += 300 * delta
@@ -31,6 +31,8 @@ Funkin.Signals.postRender.add { params ->
3131
}
3232
}
3333

34-
Funkin.Signals.preGameClose.add { params ->
34+
Funkin.Signals.preGameClose.add {params ->
3535
newSprite.getTexture().dispose()
3636
}
37+
38+
Funkin.playSound('shared/sounds/missnote1.ogg')

core/src/main/java/me/stringfromjava/funkin/FunkinGame.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.badlogic.gdx.Input;
66
import com.badlogic.gdx.audio.Sound;
77
import me.stringfromjava.funkin.game.InitScreen;
8-
import me.stringfromjava.funkin.syntrix.script.SyntrixScriptHandler;
8+
import me.stringfromjava.funkin.polyverse.script.PolyverseScriptHandler;
99

1010
import java.util.Set;
1111

@@ -21,12 +21,12 @@ public class FunkinGame extends Game {
2121

2222
@Override
2323
public void create() {
24-
SyntrixScriptHandler.compileScript("test.groovy");
25-
SyntrixScriptHandler.executeScript("new_screen.groovy");
24+
PolyverseScriptHandler.compileScript("test.groovy");
25+
PolyverseScriptHandler.executeScript("new_screen.groovy");
2626

2727
Funkin.Signals.postRender.add(data -> {
2828
if (Gdx.input.isKeyJustPressed(Input.Keys.SPACE)) {
29-
SyntrixScriptHandler.executeScript("test.groovy");
29+
PolyverseScriptHandler.executeScript("test.groovy");
3030
}
3131
});
3232

core/src/main/java/me/stringfromjava/funkin/backend/system/FunkinSignal.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package me.stringfromjava.funkin.backend.system;
22

3-
import java.util.ArrayList;
43
import java.util.concurrent.CopyOnWriteArrayList;
54

65
/**

core/src/main/java/me/stringfromjava/funkin/syntrix/script/SyntrixScriptHandler.java renamed to core/src/main/java/me/stringfromjava/funkin/polyverse/script/PolyverseScriptHandler.java

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.stringfromjava.funkin.syntrix.script;
1+
package me.stringfromjava.funkin.polyverse.script;
22

33
import groovy.lang.GroovyShell;
44
import groovy.lang.Script;
@@ -9,14 +9,24 @@
99
import java.util.Map;
1010

1111
/**
12-
* Core handler class for compiling and executing G-String scripts (aka {@code .groovy} scripts).
12+
* Core handler class for compiling and executing Polyverse scripts (aka {@code .groovy} scripts).
1313
*/
14-
public final class SyntrixScriptHandler {
14+
public final class PolyverseScriptHandler {
1515

1616
// Key = the path of the script.
1717
// Value = The script object itself.
1818
private static Map<String, Script> compiledScripts = new HashMap<>();
1919

20+
/**
21+
* Executes a {@code .groovy} script.
22+
*
23+
* <p>If it is not already compiled, it will be compiled and saved every time it is attempted to
24+
* be executed after.
25+
*
26+
* @param path The path to run the script from.
27+
* @return The {@link Script} object itself. If it fails to execute, then {@code null} is returned
28+
* instead.
29+
*/
2030
public static Script executeScript(String path) {
2131
try {
2232
if (compiledScripts.containsKey(path)) {
@@ -32,10 +42,25 @@ public static Script executeScript(String path) {
3242
return null;
3343
}
3444

45+
/**
46+
* Compiles a script and caches it any time it is attempted to be executed.
47+
*
48+
* @param path The location the script is located.
49+
* @return The {@link Script} object itself. If it fails to compile, then {@code null} is returned
50+
* instead.
51+
*/
3552
public static Script compileScript(String path) {
3653
return compileScript(path, false);
3754
}
3855

56+
/**
57+
* Compiles a script and caches it any time it is attempted to be executed.
58+
*
59+
* @param path The location the script is located.
60+
* @param execute If the script should be executed after being compiled.
61+
* @return The {@link Script} object itself. If it fails to compile or execute, then {@code null}
62+
* is returned instead.
63+
*/
3964
public static Script compileScript(String path, boolean execute) {
4065
try {
4166
if (!compiledScripts.containsKey(path)) {
@@ -53,5 +78,5 @@ public static Script compileScript(String path, boolean execute) {
5378
return null;
5479
}
5580

56-
private SyntrixScriptHandler() {}
81+
private PolyverseScriptHandler() {}
5782
}

0 commit comments

Comments
 (0)