vooga.widget.clock
Class OverlayClock

java.lang.Object
  extended by Sprite
      extended by vooga.engine.overlay.Overlay
          extended by vooga.engine.overlay.OverlayString
              extended by vooga.widget.clock.OverlayClock

public class OverlayClock
extends OverlayString

OverlayClock displays a string representing the current local time on the screen. It is an extension of OverlayString where the String to be displayed is always the local time. The time is determined on update which means that the clock can be paused. If this behavior is not desired, do not place the OverlayClock in a GameState which renders without updating. The font and color of the clock are customizable. If the clock is specifying the incorrect time, make sure that you set the proper time zone for WorldClock. The default way to display time is the 24 time format.

Sample initialization using default 24 hour time:

WorldClock.setTimeZone("EST"); OverlayClock clock = new OverlayClock(); clock.setLocation(WIDTH/2, HEIGHT/2);

Sample initialization using default 12 hour time with am/pm: WorldClock.setTimeZone("EST"); OverlayClock clock = new OverlayClock(new AMandPMReader()); clock.setLocation(WIDTH/2, HEIGHT/2);


Field Summary
 
Fields inherited from class vooga.engine.overlay.OverlayString
DEFAULT_COLOR, DEFAULT_FONT
 
Constructor Summary
OverlayClock()
          Create a clock with default font and color
OverlayClock(java.awt.Color color)
          Create a clock with default font and custom color
OverlayClock(java.awt.Font font)
          Create a clock with default color and custom font
OverlayClock(java.util.Map<java.lang.String,java.lang.String> attributes, OverlayTracker tracker)
           
OverlayClock(TimeReader timeReader)
          Create a clock with default font and color and a custom TimeReader
OverlayClock(TimeReader timeReader, java.awt.Font font, java.awt.Color color)
          Create a clock with custom font and color
 
Method Summary
 void update(long elapsedTime)
          Updates the string to be displayed to be the current time designated by WorldClock.
 
Methods inherited from class vooga.engine.overlay.OverlayString
getHeight, getString, getWidth, print, render, setColor, setFont, setFont, setString
 
Methods inherited from class vooga.engine.overlay.Overlay
setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OverlayClock

public OverlayClock()
Create a clock with default font and color


OverlayClock

public OverlayClock(TimeReader timeReader)
Create a clock with default font and color and a custom TimeReader


OverlayClock

public OverlayClock(java.awt.Font font)
Create a clock with default color and custom font

Parameters:
font - Font used to render the clock digits

OverlayClock

public OverlayClock(java.awt.Color color)
Create a clock with default font and custom color

Parameters:
color - Color used to render the clock

OverlayClock

public OverlayClock(TimeReader timeReader,
                    java.awt.Font font,
                    java.awt.Color color)
Create a clock with custom font and color

Parameters:
font - Font used to render clock digits
color - Color used to render clock

OverlayClock

public OverlayClock(java.util.Map<java.lang.String,java.lang.String> attributes,
                    OverlayTracker tracker)
Method Detail

update

public void update(long elapsedTime)
Updates the string to be displayed to be the current time designated by WorldClock.

Parameters:
elapsedTime - not used