org.newdawn.asd.isoclient
Class InGameState

java.lang.Object
  extended byorg.newdawn.asd.isoclient.InGameState
All Implemented Interfaces:
GameState, GameWorldListener, TileTainter

public class InGameState
extends java.lang.Object
implements GameState, GameWorldListener, TileTainter

A state responsible for rendering and updating the in game world


Constructor Summary
InGameState(LWJGLWindow window, IsoClient client)
          Create a new in game state
 
Method Summary
 void actorChangedMap(Actor actor, Map map)
          Notification that an actor change map within the world
 void actorRemoved(Actor actor)
          Notification that an actor has been removed
 void addChatMessage(java.lang.String source, java.lang.String message)
          Add a recieved chat message to the display
 void addDecal(Decal decal)
          Add a decal to be rendered
 void applyTaint(int x, int y)
          Apply a rendering taint before rendering a particular tile
 void clearChat()
          Clear the chat area
 void enterState(StateBasedGame game)
          Notification that this state is being entered
 void init(StateBasedGame game)
          Initialise any resources required by this game state.
 void laggedOut()
          Notification that a command has been recieved in the past and hence this client has lagged out.
 void leaveState(StateBasedGame game)
          Notification that this state is being left
 void newMapCreated(Actor cause, Map map)
          Notification that a new map has been created within the game world.
 void playerActorAdded(Actor actor, java.lang.String username)
          Notification that a player's actor has been added
 void reinit(StateBasedGame game)
          Reinitialise the OpenGL resources
 void release()
          Release opengl resources from this state
 void render(StateBasedGame game, int delta)
          Render this game state
 void sendChat()
          Send the currently entered chat message to the server
 void setMessage(java.lang.String message)
          Set the message being displayed
 void setWorld(java.lang.String username, GameWorld world)
          Set the game world being rendered
 void unapplyTaint(int x, int y)
          Unapply a rendering taint before rendering a particular tile
 void update(StateBasedGame game, int delta)
          Execute any game logic for this game state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InGameState

public InGameState(LWJGLWindow window,
                   IsoClient client)
Create a new in game state

Parameters:
window - The window in which this state will be rendered
client - The client holding this state
Method Detail

addDecal

public void addDecal(Decal decal)
Add a decal to be rendered

Parameters:
decal - The decal to be added

setMessage

public void setMessage(java.lang.String message)
Set the message being displayed

Parameters:
message - The message to display

setWorld

public void setWorld(java.lang.String username,
                     GameWorld world)
Set the game world being rendered

Parameters:
username - The username of our player
world - The world in which the game is running

init

public void init(StateBasedGame game)
          throws java.io.IOException
Description copied from interface: GameState
Initialise any resources required by this game state.

Specified by:
init in interface GameState
Parameters:
game - The game to which this state belongs. (Probably need to cast it to the game type you know it to be)
Throws:
java.io.IOException - Indicates a failure to initialise a resource
See Also:
GameState.init(org.newdawn.state.StateBasedGame)

render

public void render(StateBasedGame game,
                   int delta)
Description copied from interface: GameState
Render this game state

Specified by:
render in interface GameState
Parameters:
game - The game to which this state belongs. (Probably need to cast it to the game type you know it to be)
delta - The amount of time in milliseconds since last render
See Also:
GameState.render(org.newdawn.state.StateBasedGame, int)

update

public void update(StateBasedGame game,
                   int delta)
Description copied from interface: GameState
Execute any game logic for this game state.

Specified by:
update in interface GameState
Parameters:
game - The game to which this state belongs. (Probably need to cast it to the game type you know it to be)
delta - The amount of time in milliseconds since last render
See Also:
GameState.update(org.newdawn.state.StateBasedGame, int)

enterState

public void enterState(StateBasedGame game)
Description copied from interface: GameState
Notification that this state is being entered

Specified by:
enterState in interface GameState
Parameters:
game - The game to which this state belongs. (Probably need to cast it to the game type you know it to be)
See Also:
GameState.enterState(org.newdawn.state.StateBasedGame)

leaveState

public void leaveState(StateBasedGame game)
Description copied from interface: GameState
Notification that this state is being left

Specified by:
leaveState in interface GameState
Parameters:
game - The game to which this state belongs. (Probably need to cast it to the game type you know it to be)
See Also:
GameState.leaveState(org.newdawn.state.StateBasedGame)

playerActorAdded

public void playerActorAdded(Actor actor,
                             java.lang.String username)
Description copied from interface: GameWorldListener
Notification that a player's actor has been added

Specified by:
playerActorAdded in interface GameWorldListener
Parameters:
actor - The actor that was added
username - The username of the player that the actor was added for.
See Also:
GameWorldListener.playerActorAdded(org.newdawn.asd.data.Actor, java.lang.String)

laggedOut

public void laggedOut()
Description copied from interface: GameWorldListener
Notification that a command has been recieved in the past and hence this client has lagged out. This shouldn't be possibl but added as a catch all

Specified by:
laggedOut in interface GameWorldListener
See Also:
GameWorldListener.laggedOut()

addChatMessage

public void addChatMessage(java.lang.String source,
                           java.lang.String message)
Add a recieved chat message to the display

Parameters:
source - The name of the source of the message
message - The message to be displayed

clearChat

public void clearChat()
Clear the chat area


sendChat

public void sendChat()
Send the currently entered chat message to the server


actorRemoved

public void actorRemoved(Actor actor)
Description copied from interface: GameWorldListener
Notification that an actor has been removed

Specified by:
actorRemoved in interface GameWorldListener
Parameters:
actor - The actor that was removed
See Also:
GameWorldListener.actorRemoved(org.newdawn.asd.data.Actor)

release

public void release()
Release opengl resources from this state


reinit

public void reinit(StateBasedGame game)
            throws java.io.IOException
Description copied from interface: GameState
Reinitialise the OpenGL resources

Specified by:
reinit in interface GameState
Parameters:
game - The game to which this state belongs
Throws:
java.io.IOException - Indicates a failure to reload resources
See Also:
GameState.reinit(org.newdawn.state.StateBasedGame)

applyTaint

public void applyTaint(int x,
                       int y)
Description copied from interface: TileTainter
Apply a rendering taint before rendering a particular tile

Specified by:
applyTaint in interface TileTainter
Parameters:
x - The x position of the tile being rendered
y - The y position of the tile being rendered
See Also:
TileTainter.applyTaint(int, int)

unapplyTaint

public void unapplyTaint(int x,
                         int y)
Description copied from interface: TileTainter
Unapply a rendering taint before rendering a particular tile

Specified by:
unapplyTaint in interface TileTainter
Parameters:
x - The x position of the tile being rendered
y - The y position of the tile being rendered
See Also:
TileTainter.unapplyTaint(int, int)

newMapCreated

public void newMapCreated(Actor cause,
                          Map map)
Description copied from interface: GameWorldListener
Notification that a new map has been created within the game world.

Specified by:
newMapCreated in interface GameWorldListener
Parameters:
cause - The actor causing this map to be created
map - The map that has been created
See Also:
GameWorldListener.newMapCreated(org.newdawn.asd.data.Actor, org.newdawn.asd.data.Map)

actorChangedMap

public void actorChangedMap(Actor actor,
                            Map map)
Description copied from interface: GameWorldListener
Notification that an actor change map within the world

Specified by:
actorChangedMap in interface GameWorldListener
Parameters:
actor - The actor changing maps
map - The map they've changed to
See Also:
GameWorldListener.actorChangedMap(org.newdawn.asd.data.Actor, org.newdawn.asd.data.Map)