- All Superinterfaces:
Activatable
,Clearable
,Destroyable
,com.github.hanyaeger.core.scenes.DimensionsProvider
,DragRepositoryAccessor
,Effectable
,GameNode
,Initializable
- All Known Implementing Classes:
DynamicScene
,ScrollableDynamicScene
,SplashScene
,StaticScene
YaegerScene
encapsulates a scene or level from a Yaeger Game
.-
Method Summary
Modifier and TypeMethodDescriptiondouble
Return the playback volume of the background audio.default double
Return the height of thisYaegerScene
.javafx.scene.Scene
getScene()
Return theScene
that is encapsulated by thisYaegerScene
javafx.stage.Stage
getStage()
Return theStage
to which thisYaegerScene
will be added.default double
getWidth()
Return the width of thisYaegerScene
.void
Use this method to trigger behaviour that should be set after theYaegerScene
has been completely set up.void
setBackgroundAudio
(String url) Set the background audio file.void
setBackgroundAudioVolume
(double volume) Set the playback volume of the background audio.void
setBackgroundColor
(javafx.scene.paint.Color color) Set the background color of theYaegerScene
.void
setBackgroundImage
(String url) Set the background image file.void
setBackgroundImage
(String url, boolean fullscreen) Set the background image file.void
setConfig
(YaegerConfig yaegerConfig) Set theYaegerConfig
to be used by thisYaegerScene
.default void
setCursor
(javafx.scene.Cursor cursor) Set the Cursor.void
setStage
(javafx.stage.Stage stage) Set theStage
on thisYaegerScene
.void
Use this method to set up all instances ofYaegerEntity
that should be added to theYaegerScene
before activation.void
Set up theYaegerScene
.void
Stop playing the background audio.Methods inherited from interface com.github.hanyaeger.core.Activatable
activate, isActivationComplete
Methods inherited from interface com.github.hanyaeger.core.Destroyable
destroy
Methods inherited from interface com.github.hanyaeger.core.entities.DragRepositoryAccessor
getDragNDropRepository, setDragNDropRepository
Methods inherited from interface com.github.hanyaeger.core.Effectable
getBrightness, getContrast, getHue, getSaturation, setBrightness, setContrast, setHue, setSaturation
Methods inherited from interface com.github.hanyaeger.core.Initializable
beforeInitialize, init
-
Method Details
-
setupScene
void setupScene()Set up theYaegerScene
. Use this method to set up all properties of theYaegerScene
. The following methods are available:setBackgroundImage(String)
setBackgroundImage(String, boolean)
setBackgroundAudio(String)
setBackgroundAudioVolume(double)
getBackgroundAudioVolume()
ScrollableDynamicScene
is used, the following methods are also available: -
setupEntities
void setupEntities()Use this method to set up all instances ofYaegerEntity
that should be added to theYaegerScene
before activation.If not only instances of
YaegerEntity
, but also ofEntitySpawner
orTimer
should be added to theYaegerScene
, respectively the interfaceEntitySpawnerContainer
andTimerContainer
should be implemented. These two interface will provide their own setup methods. Note that the order in which these methods are called is not deterministic. -
postActivate
void postActivate()Use this method to trigger behaviour that should be set after theYaegerScene
has been completely set up. -
setBackgroundColor
void setBackgroundColor(javafx.scene.paint.Color color) Set the background color of theYaegerScene
. When both the background color and a background image are set, the color is not visible.- Parameters:
color
- theColor
of the background
-
setBackgroundImage
Set the background image file. This image full be placed as the background for the entireYaegerScene
and thus stretched horizontally and vertically, if necessary.The
url
of the image is relative to theresources/
folder, where all resources should be placed. If the resource is placed in a subfolder ofresources/
, this folder should be opened explicitly from the module descriptor.- Parameters:
url
- the name of the image file, including extension. Although many file types are supported, the following types are preferred:- jpg, jpeg
- png
-
setBackgroundImage
Set the background image file.The
url
of the image is relative to theresources/
folder, where all resources should be placed. If the resource is placed in a subfolder ofresources/
, this folder should be opened explicitly from the module descriptor.- Parameters:
url
- the name of the image file, including extension. Although many file types are supported, the following types are preferred:- jpg, jpeg
- png
fullscreen
- aboolean
that states whether the provided image should be displayed as fullscreen or tiled. If fullscreen is set tofalse
the image will be its original size and tiled both horizontally and vertically.
-
setBackgroundAudio
Set the background audio file. Currently, only*.mp3
files are supported. The audio file will be looped indefinitely, until theYaegerScene
is destroyed.Set the background image file. The
url
of the image is relative to theresources/
folder, where all resources should be placed. If the resource is placed in a subfolder ofresources/
, this folder should be opened explicitly from the module descriptor.- Parameters:
url
- the name of the audio file, including extension
-
setBackgroundAudioVolume
void setBackgroundAudioVolume(double volume) Set the playback volume of the background audio.- Parameters:
volume
- the volume
-
getBackgroundAudioVolume
double getBackgroundAudioVolume()Return the playback volume of the background audio. This is a value between [0, 1.0], where 0 means it is not audible and 1.0 it is played at its original volume level.- Returns:
- the volume as a
double
-
stopBackgroundAudio
void stopBackgroundAudio()Stop playing the background audio. -
getScene
javafx.scene.Scene getScene()Return theScene
that is encapsulated by thisYaegerScene
- Returns:
- the
Scene
that is encapsulated by thisYaegerScene
-
getStage
javafx.stage.Stage getStage()Return theStage
to which thisYaegerScene
will be added.- Returns:
- the
Stage
to which thisYaegerScene
will be added
-
setStage
void setStage(javafx.stage.Stage stage) Set theStage
on thisYaegerScene
. AYaegerScene
will only be added to theStage
when theYaegerScene
is the one that is being shown. Only when aYaegerScene
is added, itswidth
andheight
are available. Thus, to make it possible to request thewidth
andheight
during theYaegerScene#setupEntities()
methods, we need theStage
at an earlier stage. That is why we actively set theStage
on eachYaegerScene
that is created.- Parameters:
stage
- the currentStage
-
setCursor
default void setCursor(javafx.scene.Cursor cursor) Set the Cursor.- Parameters:
cursor
- theCursor
that should be used
-
getWidth
default double getWidth()Return the width of thisYaegerScene
.- Specified by:
getWidth
in interfacecom.github.hanyaeger.core.scenes.DimensionsProvider
- Returns:
- the width of this
YaegerScene
-
getHeight
default double getHeight()Return the height of thisYaegerScene
.- Specified by:
getHeight
in interfacecom.github.hanyaeger.core.scenes.DimensionsProvider
- Returns:
- the height of this
YaegerScene
-
setConfig
Set theYaegerConfig
to be used by thisYaegerScene
.- Parameters:
yaegerConfig
- theYaegerConfig
to be used by thisYaegerScene
-