com.realtime.crossfire.jxclient.map
Class AnimationMap

java.lang.Object
  extended by com.realtime.crossfire.jxclient.map.AnimationMap

public class AnimationMap
extends java.lang.Object

Maintains AnimationState instances for map locations.


Field Summary
private  java.util.Map<Location,AnimationState> animations
          The active AnimationState instances.
 
Constructor Summary
AnimationMap()
           
 
Method Summary
 void add(Location location, AnimationState animationState)
          Adds a new AnimationState to a Location.
 void clear()
          Forgets all state.
private static void freeAnimationState(AnimationState animationState, Location location)
          Calls AnimationState.free(Location).
 void remove(Location location)
          Clears a Location.
 void scroll(int dx, int dy, int width, int height)
          Scrolls all locations.
 void updateSpeed(Location location, int speed)
          Updates the animation speed value of a Location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

animations

@NotNull
private final java.util.Map<Location,AnimationState> animations
The active AnimationState instances. Maps map Location to AnimationState instance.

Constructor Detail

AnimationMap

public AnimationMap()
Method Detail

add

public void add(@NotNull
                Location location,
                @NotNull
                AnimationState animationState)
Adds a new AnimationState to a Location. If the location was not empty, the previous animation state is freed.

Parameters:
location - the location to add to
animationState - the animation state to add

clear

public void clear()
Forgets all state.


freeAnimationState

private static void freeAnimationState(@Nullable
                                       AnimationState animationState,
                                       @NotNull
                                       Location location)
Calls AnimationState.free(Location).

Parameters:
animationState - the instance to call free() on or null to do nothing
location - the location to pass

remove

public void remove(@NotNull
                   Location location)
Clears a Location.

Parameters:
location - the location to clear

scroll

public void scroll(int dx,
                   int dy,
                   int width,
                   int height)
Scrolls all locations.

Parameters:
dx - the x distance to scroll
dy - the y distance to scroll
width - the map width
height - the map height

updateSpeed

public void updateSpeed(@NotNull
                        Location location,
                        int speed)
Updates the animation speed value of a Location.

Parameters:
location - the location to update
speed - the new animation speed