org.newdawn.slick.state
Interface GameState

All Superinterfaces:
ControlledInputReciever, ControllerListener, InputListener, KeyListener, MouseListener
All Known Implementing Classes:
BasicGameState, TestState1, TestState2, TestState3

public interface GameState
extends InputListener

A single state building up part of the game. The state include rendering, logic and input handling for the state.

Author:
kevin

Method Summary
 void enter(GameContainer container, StateBasedGame game)
          Notification that we've entered this game state
 int getID()
          Get the ID of this state
 void init(GameContainer container, StateBasedGame game)
          Initialise the state.
 void leave(GameContainer container, StateBasedGame game)
          Notification that we're leaving this game state
 void render(GameContainer container, StateBasedGame game, Graphics g)
          Render this state to the game's graphics context
 void update(GameContainer container, StateBasedGame game, int delta)
          Update the state's logic based on the amount of time thats passed
 
Methods inherited from interface org.newdawn.slick.MouseListener
mouseClicked, mouseDragged, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
 
Methods inherited from interface org.newdawn.slick.KeyListener
keyPressed, keyReleased
 
Methods inherited from interface org.newdawn.slick.ControllerListener
controllerButtonPressed, controllerButtonReleased, controllerDownPressed, controllerDownReleased, controllerLeftPressed, controllerLeftReleased, controllerRightPressed, controllerRightReleased, controllerUpPressed, controllerUpReleased
 
Methods inherited from interface org.newdawn.slick.ControlledInputReciever
inputEnded, inputStarted, isAcceptingInput, setInput
 

Method Detail

getID

int getID()
Get the ID of this state

Returns:
The game unique ID of this state

init

void init(GameContainer container,
          StateBasedGame game)
          throws SlickException
Initialise the state. It should load any resources it needs at this stage

Parameters:
container - The container holding the game
game - The game holding this state
Throws:
SlickException - Indicates a failure to initialise a resource for this state

render

void render(GameContainer container,
            StateBasedGame game,
            Graphics g)
            throws SlickException
Render this state to the game's graphics context

Parameters:
container - The container holding the game
game - The game holding this state
g - The graphics context to render to
Throws:
SlickException - Indicates a failure to render an artifact

update

void update(GameContainer container,
            StateBasedGame game,
            int delta)
            throws SlickException
Update the state's logic based on the amount of time thats passed

Parameters:
container - The container holding the game
game - The game holding this state
delta - The amount of time thats passed in millisecond since last update
Throws:
SlickException - Indicates an internal error that will be reported through the standard framework mechanism

enter

void enter(GameContainer container,
           StateBasedGame game)
           throws SlickException
Notification that we've entered this game state

Parameters:
container - The container holding the game
game - The game holding this state
Throws:
SlickException - Indicates an internal error that will be reported through the standard framework mechanism

leave

void leave(GameContainer container,
           StateBasedGame game)
           throws SlickException
Notification that we're leaving this game state

Parameters:
container - The container holding the game
game - The game holding this state
Throws:
SlickException - Indicates an internal error that will be reported through the standard framework mechanism


Copyright © 2006 New Dawn Software. All Rights Reserved.