java.lang.Object
com.github.hanyaeger.core.scenes.delegates.BackgroundDelegate
- All Implemented Interfaces:
Destroyable,ResourceConsumer
A
BackgroundDelegate follows the Delegate pattern and embraces Composition over Inheritance.
It can be used to deal with both background audio and background images for a YaegerScene.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Implement this method and use it to ensure that the maximum number of Objects are eligible for Garbage Collection after this method has been called.doubleRetrieves the background audio playback volume.voidsetBackgroundAudio(String backgroundAudioUrl) Set the background audio.voidsetBackgroundAudioMediaPlayer(BackgroundAudioMediaPlayer backgroundAudioMediaPlayer) TSet theBackgroundAudioMediaPlayerto be used for thisBackgroundDelegate.voidsetBackgroundColor(javafx.scene.paint.Color color) Set the background color of theYaegerScene.voidsetBackgroundFactory(BackgroundFactory backgroundFactory) Set theBackgroundFactoryto be used for thisBackgroundDelegate.voidsetBackgroundImage(String backgroundImageUrl, boolean fullscreen) Set the background image.voidsetImageRepository(ImageRepository imageRepository) Set theImageRepositoryto be used for thisBackgroundDelegate.voidsetup(javafx.scene.layout.Pane pane) Set up thePanebelonging to thisBackgroundDelegate.voidsetVolume(double volume) Set the volume of the background audio.voidStop playing the background audio.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.hanyaeger.core.ResourceConsumer
createPathForResource
-
Constructor Details
-
BackgroundDelegate
public BackgroundDelegate()
-
-
Method Details
-
setup
public void setup(javafx.scene.layout.Pane pane) Set up thePanebelonging to thisBackgroundDelegate.- Parameters:
pane- ThePanethat should be used when setup.
-
setBackgroundAudio
Set the background audio. The audio will loop indefinite while theSceneis active.- Parameters:
backgroundAudioUrl- the url of the audio file
-
setBackgroundColor
public void setBackgroundColor(javafx.scene.paint.Color color) Set the background color of theYaegerScene.- Parameters:
color- TheColorof the background.
-
setBackgroundImage
Set the background image. The image will be set as the full background for theScene.- Parameters:
backgroundImageUrl- The url of the image file. This is relative to the resource/ folder.fullscreen- abooleanthat states whether the image should be fullscreen. Iffalsethe image will be horizontally and vertically tiled.
-
stopBackgroundAudio
public void stopBackgroundAudio()Stop playing the background audio. -
setVolume
public void setVolume(double volume) Set the volume of the background audio.- Parameters:
volume- the volume
-
getVolume
public double getVolume()Retrieves the background audio playback volume.- Returns:
- the audio volume
-
destroy
public void destroy()Description copied from interface:DestroyableImplement this method and use it to ensure that the maximum number of Objects are eligible for Garbage Collection after this method has been called.- Specified by:
destroyin interfaceDestroyable
-
setImageRepository
Set theImageRepositoryto be used for thisBackgroundDelegate.- Parameters:
imageRepository- theImageRepositoryto be used
-
setBackgroundFactory
Set theBackgroundFactoryto be used for thisBackgroundDelegate.- Parameters:
backgroundFactory- theBackgroundFactoryto be used
-
setBackgroundAudioMediaPlayer
@Inject public void setBackgroundAudioMediaPlayer(BackgroundAudioMediaPlayer backgroundAudioMediaPlayer) TSet theBackgroundAudioMediaPlayerto be used for thisBackgroundDelegate.- Parameters:
backgroundAudioMediaPlayer- theBackgroundAudioMediaPlayerto be used
-