uwcse.animation
Class Stage

java.lang.Object
  |
  +--uwcse.animation.Stage

public class Stage
extends java.lang.Object


Constructor Summary
Stage(uwcse.graphics.GWindow window)
          Create a new, empty stage, on the given window.
 
Method Summary
 void addActor(Actor actor)
          Add a new actor to the stage.
 void addProp(Prop prop)
          Add a new prop to the stage.
 void animate()
          Run rounds of animation forever.
 void animate(int times)
          Run a certain number of rounds of animation.
 void animateInBackground()
          Run rounds of animation forever, in the background.
 void animateOneRound()
          Run one round of the animation.
 void close()
          End the animation and close the GWindow
 java.util.ArrayList getActors()
          Return a list of all the actors.
 int getHeight()
          Return the height of the stage window.
 java.util.ArrayList getProps()
          Return a list of all the props.
 int getTimeForOneRound()
          Get the current amount of time to pause between rounds of animation, in ms.
 int getWidth()
          Return the width of the stage window.
 uwcse.graphics.GWindow getWindow()
          Return the window of the stage.
 void makeAnimationRoundsAtomic()
          Make each round of animation "atomic", in that only after all the doAction operations are done, and all the graphic changes are made, will the final updated scene be displayed.
 void quitAnimation()
          Quit the animation loop, if it's running.
 void quitWhenWindowClosed()
          Make it so that the whole animation application will exit when the stage's window is closed.
 void registerEventHandler(uwcse.graphics.GWindowEventHandler handler)
          Register the handler object that should be notified if there are any input events (e.g., key or mouse button pressed or released).
 void removeActor(Actor actor)
          Remove an actor from the stage.
 void removeProp(Prop prop)
          Remove a prop from the stage.
 void resumeAnimation()
          Resume the animation loop, if was suspended.
 void resumeTimerEvents()
          Resume delivering timer events at the previous rate, if they were enabled.
 void setTimeForOneRound(int newTime)
          Set the amount of time to pause between rounds of animation, in ms.
 void startTimerEvents(int interval)
          Start delivering timer events to the registered event handler.
 void stopTimerEvents()
          Stop delivering timer events to the registered event handler.
 void suspendAnimation()
          Suspend the animation loop, if it's running.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stage

public Stage(uwcse.graphics.GWindow window)
Create a new, empty stage, on the given window.
Method Detail

addActor

public void addActor(Actor actor)
Add a new actor to the stage. (If in the middle of animating, this will take effect only at the end of a round of animation.) (You can ignore the synchronized keyword.)

addProp

public void addProp(Prop prop)
Add a new prop to the stage. (If in the middle of animating, this will take effect only at the end of a round of animation.) (You can ignore the synchronized keyword.)

animate

public void animate()
Run rounds of animation forever. This method doesn't return until animation is quit through a separate event.

animate

public void animate(int times)
Run a certain number of rounds of animation.
Parameters:
times - the number of rounds to run.

animateInBackground

public void animateInBackground()
Run rounds of animation forever, in the background. This method returns right away, as is needed to run animations from the start() method of an applet.

animateOneRound

public void animateOneRound()
Run one round of the animation.

close

public void close()
End the animation and close the GWindow

getActors

public java.util.ArrayList getActors()
Return a list of all the actors. (This allows the action of an actor to depend on what other actors are in the animation.)

getHeight

public int getHeight()
Return the height of the stage window.

getProps

public java.util.ArrayList getProps()
Return a list of all the props. (This allows the action of an actor to depend on what other actors are in the animation.)

getTimeForOneRound

public int getTimeForOneRound()
Get the current amount of time to pause between rounds of animation, in ms.

getWidth

public int getWidth()
Return the width of the stage window.

getWindow

public uwcse.graphics.GWindow getWindow()
Return the window of the stage.

makeAnimationRoundsAtomic

public void makeAnimationRoundsAtomic()
Make each round of animation "atomic", in that only after all the doAction operations are done, and all the graphic changes are made, will the final updated scene be displayed. This can be used to make coordinated motions look coordinated, instead of having each part move separately. But don't turn it on while you're debugging, because you won't be able to see any motions until a whole round of animation is completed!

quitAnimation

public void quitAnimation()
Quit the animation loop, if it's running. (I.e., the animate method will return.)

quitWhenWindowClosed

public void quitWhenWindowClosed()
Make it so that the whole animation application will exit when the stage's window is closed.

registerEventHandler

public void registerEventHandler(uwcse.graphics.GWindowEventHandler handler)
Register the handler object that should be notified if there are any input events (e.g., key or mouse button pressed or released).

removeActor

public void removeActor(Actor actor)
Remove an actor from the stage. (If in the middle of animating, this will take effect only at the end of a round of animation.) (You can ignore the synchronized keyword.)

removeProp

public void removeProp(Prop prop)
Remove a prop from the stage. (If in the middle of animating, this will take effect only at the end of a round of animation.) (You can ignore the synchronized keyword.)

resumeAnimation

public void resumeAnimation()
Resume the animation loop, if was suspended.

resumeTimerEvents

public void resumeTimerEvents()
Resume delivering timer events at the previous rate, if they were enabled.

setTimeForOneRound

public void setTimeForOneRound(int newTime)
Set the amount of time to pause between rounds of animation, in ms.

startTimerEvents

public void startTimerEvents(int interval)
Start delivering timer events to the registered event handler.
Parameters:
interval - the interval in milliseconds between timerExpired events.

stopTimerEvents

public void stopTimerEvents()
Stop delivering timer events to the registered event handler.

suspendAnimation

public void suspendAnimation()
Suspend the animation loop, if it's running. (But the animation method won't return, it will just stop animating until told to resume, or quit.)