Class BGMManager
java.lang.Object
util.BGMManager
A simple manager for playing background music (BGM) in a JavaFX application.
Supports playing, looping, and stopping a single BGM track at a time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static javafx.scene.media.MediaPlayerprivate static final double -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
currentPlayer
private static javafx.scene.media.MediaPlayer currentPlayer -
VOLUME
private static final double VOLUME- See Also:
-
-
Constructor Details
-
BGMManager
public BGMManager()
-
-
Method Details
-
play
Plays a BGM track from the given resource path. If another track is already playing, it stops it first.- Parameters:
resourcePath- the path to the music file relative to the classpath
-
stop
public static void stop()Stops the currently playing BGM, if any.
-