Package sk.tuke.kpi.gamelib
Interface Game
-
- All Known Implementing Classes:
GameApplication
public interface Game
Represents game application with multiple scenes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addScene(@NotNull Scene scene)
Adds a anew scene to the game.void
clearScreen()
Clears the game's screen.void
clearScreen(@NotNull Color color)
Clears the game's screen with specified color.@NotNull Scene
getCurrentScene()
int
getFramesPerSecond()
@NotNull Input
getInput()
Gets game's global input processor that is active in all scenes.@NotNull Overlay
getOverlay()
@NotNull Scene
getSceneByName(@NotNull java.lang.String name)
Gets a scene with given name.@NotNull WindowSetup
getWindowSetup()
@Nullable ActorContainer<?>
peekActorContainer()
Gets the last container pushed to actor containers stack.@Nullable ActorContainer<?>
popActorContainer()
Pops the last container from actor containers stack.void
pushActorContainer(@NotNull ActorContainer<?> container)
Pushes a newcontainer
to the stack of actor containers.void
setCurrentSceneByName(@NotNull java.lang.String name)
Switches the currently shown scene to another already registered scene with the given name.void
start()
Starts the game.void
stop()
Stops the game.
-
-
-
Method Detail
-
getWindowSetup
@NotNull @NotNull WindowSetup getWindowSetup()
- Returns:
- game window setup data
-
getFramesPerSecond
int getFramesPerSecond()
- Returns:
- game FPS
-
getCurrentScene
@NotNull @NotNull Scene getCurrentScene()
- Returns:
- currently shown scene
-
getOverlay
@NotNull @NotNull Overlay getOverlay()
- Returns:
- topmost game overlay;
-
getInput
@NotNull @NotNull Input getInput()
Gets game's global input processor that is active in all scenes.- Returns:
- global input processor
- See Also:
Scene.getInput()
-
start
void start()
Starts the game. Usually start the main game loop.
-
stop
void stop()
Stops the game.
-
addScene
void addScene(@NotNull @NotNull Scene scene)
Adds a anew scene to the game.- Parameters:
scene
- scene to add, with a unique name within game.
-
getSceneByName
@NotNull @NotNull Scene getSceneByName(@NotNull @NotNull java.lang.String name)
Gets a scene with given name.- Parameters:
name
- scene name to look up- Returns:
- scene with the given name
- Throws:
java.lang.IllegalArgumentException
- if no scene with the name is found.
-
setCurrentSceneByName
void setCurrentSceneByName(@NotNull @NotNull java.lang.String name)
Switches the currently shown scene to another already registered scene with the given name.- Parameters:
name
- name of the scene to switch to- Throws:
java.lang.IllegalArgumentException
- if no scene with the is found.
-
clearScreen
void clearScreen()
Clears the game's screen.
-
clearScreen
void clearScreen(@NotNull @NotNull Color color)
Clears the game's screen with specified color.
-
pushActorContainer
void pushActorContainer(@NotNull @NotNull ActorContainer<?> container)
Pushes a newcontainer
to the stack of actor containers.
-
popActorContainer
@Nullable @Nullable ActorContainer<?> popActorContainer()
Pops the last container from actor containers stack.- Returns:
- the last added container
-
peekActorContainer
@Nullable @Nullable ActorContainer<?> peekActorContainer()
Gets the last container pushed to actor containers stack.- Returns:
- the last added container
-
-