org.newdawn.slick.state.transition
Class CrossStateTransition

java.lang.Object
  extended by org.newdawn.slick.state.transition.CrossStateTransition
All Implemented Interfaces:
Transition

public abstract class CrossStateTransition
extends java.lang.Object
implements Transition

A transition that will combine two states into one effect. The first state is the one we're transitioning from. The second state is specified in the constructor. By default one state will simply be rendered over the other. Subclass this transition overriding the preRenderFirstState and preRenderSecondState to setup the rendering for each state (alpha or what ever). Note that it's also possible to use the postRenderSecondState method to clean up your OpenGL setup. So these methods are called like so: preRenderFirstState() = the first state is rendered preRenderSecondState() = the second state is rendered postRenderSecondState()

Author:
kevin

Constructor Summary
CrossStateTransition(GameState secondState)
          Create a cross state transitions
 
Method Summary
abstract  boolean isComplete()
          Check if this transtion has been completed
 void postRender(StateBasedGame game, GameContainer container, Graphics g)
          Render the transition over the existing state rendering
 void postRenderSecondState(StateBasedGame game, GameContainer container, Graphics g)
          Notification that the transition is has just rendered the second state is the cross transition.
 void preRender(StateBasedGame game, GameContainer container, Graphics g)
          Render the transition before the existing state rendering
 void preRenderFirstState(StateBasedGame game, GameContainer container, Graphics g)
          Notification that the transition is about to render the first state is the cross transition.
 void preRenderSecondState(StateBasedGame game, GameContainer container, Graphics g)
          Notification that the transition is about to render the second state is the cross transition.
 void update(StateBasedGame game, GameContainer container, int delta)
          Update the transition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.newdawn.slick.state.transition.Transition
init
 

Constructor Detail

CrossStateTransition

public CrossStateTransition(GameState secondState)
Create a cross state transitions

Parameters:
secondState - The secondary state with combining with the source state.
Method Detail

isComplete

public abstract boolean isComplete()
Description copied from interface: Transition
Check if this transtion has been completed

Specified by:
isComplete in interface Transition
Returns:
True if the transition has been completed
See Also:
Transition.isComplete()

postRender

public void postRender(StateBasedGame game,
                       GameContainer container,
                       Graphics g)
                throws SlickException
Description copied from interface: Transition
Render the transition over the existing state rendering

Specified by:
postRender in interface Transition
Parameters:
game - The game this transition is being rendered as part of
container - The container holding the game
g - The graphics context to use when rendering the transiton
Throws:
SlickException - Indicates a failure occured during the render
See Also:
Transition.postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)

preRender

public void preRender(StateBasedGame game,
                      GameContainer container,
                      Graphics g)
               throws SlickException
Description copied from interface: Transition
Render the transition before the existing state rendering

Specified by:
preRender in interface Transition
Parameters:
game - The game this transition is being rendered as part of
container - The container holding the game
g - The graphics context to use when rendering the transiton
Throws:
SlickException - Indicates a failure occured during the render
See Also:
Transition.preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)

update

public void update(StateBasedGame game,
                   GameContainer container,
                   int delta)
            throws SlickException
Description copied from interface: Transition
Update the transition. Cause what ever happens in the transition to happen

Specified by:
update in interface Transition
Parameters:
game - The game this transition is being rendered as part of
container - The container holding the game
delta - The amount of time passed since last update
Throws:
SlickException - Indicates a failure occured during the update
See Also:
Transition.update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)

preRenderFirstState

public void preRenderFirstState(StateBasedGame game,
                                GameContainer container,
                                Graphics g)
                         throws SlickException
Notification that the transition is about to render the first state is the cross transition.

Parameters:
game - The game being rendered
container - The container holding the game
g - The graphic context used to render
Throws:
SlickException - Indicates a failure to setup the rendering state - throw for anything that goes wrong

preRenderSecondState

public void preRenderSecondState(StateBasedGame game,
                                 GameContainer container,
                                 Graphics g)
                          throws SlickException
Notification that the transition is about to render the second state is the cross transition.

Parameters:
game - The game being rendered
container - The container holding the game
g - The graphic context used to render
Throws:
SlickException - Indicates a failure to setup the rendering state - throw for anything that goes wrong

postRenderSecondState

public void postRenderSecondState(StateBasedGame game,
                                  GameContainer container,
                                  Graphics g)
                           throws SlickException
Notification that the transition is has just rendered the second state is the cross transition.

Parameters:
game - The game being rendered
container - The container holding the game
g - The graphic context used to render
Throws:
SlickException - Indicates a failure to setup the rendering state - throw for anything that goes wrong


Copyright © 2006 New Dawn Software. All Rights Reserved.