Path: blob/master/SLICK_HOME/src/org/newdawn/slick/state/GameState.java
1457 views
package org.newdawn.slick.state;12import org.newdawn.slick.GameContainer;3import org.newdawn.slick.Graphics;4import org.newdawn.slick.InputListener;5import org.newdawn.slick.SlickException;67/**8* A single state building up part of the game. The state include rendering, logic and input handling9* for the state.10*11* @author kevin12*/13public interface GameState extends InputListener {14/**15* Get the ID of this state16*17* @return The game unique ID of this state18*/19public int getID();2021/**22* Initialise the state. It should load any resources it needs at this stage23*24* @param container The container holding the game25* @param game The game holding this state26* @throws SlickException Indicates a failure to initialise a resource for this state27*/28public void init(GameContainer container, StateBasedGame game) throws SlickException;2930/**31* Render this state to the game's graphics context32*33* @param container The container holding the game34* @param game The game holding this state35* @param g The graphics context to render to36* @throws SlickException Indicates a failure to render an artifact37*/38public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException;3940/**41* Update the state's logic based on the amount of time thats passed42*43* @param container The container holding the game44* @param game The game holding this state45* @param delta The amount of time thats passed in millisecond since last update46* @throws SlickException Indicates an internal error that will be reported through the47* standard framework mechanism48*/49public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException ;5051/**52* Notification that we've entered this game state53*54* @param container The container holding the game55* @param game The game holding this state56* @throws SlickException Indicates an internal error that will be reported through the57* standard framework mechanism58*/59public void enter(GameContainer container, StateBasedGame game) throws SlickException;6061/**62* Notification that we're leaving this game state63*64* @param container The container holding the game65* @param game The game holding this state66* @throws SlickException Indicates an internal error that will be reported through the67* standard framework mechanism68*/69public void leave(GameContainer container, StateBasedGame game) throws SlickException;70}717273