Interface Game

  • All Known Implementing Classes:
    GameApplication

    public interface Game
    Represents game application with multiple scenes.
    • 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 new container 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