All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mathiewz.slick.state.GameState Maven / Gradle / Ivy

Go to download

The main purpose of this libraryis to modernize and maintain the slick2D library.

The newest version!
package com.github.mathiewz.slick.state;

import com.github.mathiewz.slick.GameContainer;
import com.github.mathiewz.slick.Graphics;
import com.github.mathiewz.slick.InputListener;

/**
 * A single state building up part of the game. The state include rendering, logic and input handling
 * for the state.
 *
 * @author kevin
 */
public interface GameState extends InputListener {
    /**
     * Get the ID of this state
     *
     * @return The game unique ID of this state
     */
    public int getID();
    
    /**
     * Initialise the state. It should load any resources it needs at this stage
     *
     * @param container
     *            The container holding the game
     * @param game
     *            The game holding this state
     */
    public void init(GameContainer container, StateBasedGame game);
    
    /**
     * Render this state to the game's graphics context
     *
     * @param container
     *            The container holding the game
     * @param game
     *            The game holding this state
     * @param g
     *            The graphics context to render to
     */
    public void render(GameContainer container, StateBasedGame game, Graphics g);
    
    /**
     * Update the state's logic based on the amount of time thats passed
     *
     * @param container
     *            The container holding the game
     * @param game
     *            The game holding this state
     * @param delta
     *            The amount of time thats passed in millisecond since last update
     */
    public void update(GameContainer container, StateBasedGame game, int delta);
    
    /**
     * Notification that we've entered this game state
     *
     * @param container
     *            The container holding the game
     * @param game
     *            The game holding this state
     */
    public void enter(GameContainer container, StateBasedGame game);
    
    /**
     * Notification that we're leaving this game state
     *
     * @param container
     *            The container holding the game
     * @param game
     *            The game holding this state
     */
    public void leave(GameContainer container, StateBasedGame game);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy