DirectX Media for Animation Java Reference |
![]() Previous |
![]() Classes |
![]() Index |
![]() Next |
public interface Viewer extends java.lang.Object { // Methods public abstract double getCurrentTime(); public abstract double getCurrentTickTime(); public abstract Preferences getPreferences(); public abstract ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w); public abstract void setPreferences(Preferences p); public abstract void startModel(); public abstract void stopModel(); public abstract void tick(); public abstract void tick(double timeToUse); }
The viewer interface abstracts the common functionality present in both DXMApplet and DXMCanvas and contains the methods both of these classes implement. Thus, using this interface, it is possible to write code that concerns itself only with a viewer but will work for both an applet and a canvas.
public abstract double getCurrentTime();Returns the number of seconds since startModel was invoked.
Return Value:
Returns a double floating-point number.
public abstract double getCurrentTickTime();Returns the time provided for the most recent call to tick or 0 if tick has not yet been called.
Return Value:
Returns the double floating-point number representing the current tick time.
public abstract Preferences getPreferences();Allows the application to dynamically view the viewer preferences. For more information about preferences, see Preferences.
Return Value:
Returns the Preferences object.
See Also: setPreferences
public abstract ErrorAndWarningReceiver registerErrorAndWarningReceiver(ErrorAndWarningReceiver w);Allows the application to register an object that will have its methods invoked upon asynchronous errors encountered when Direct media is controlling the frame loop or when recoverable errors occur when sampling and displaying the model.
Return Value:
Returns the ErrorAndWarningReceiver object.
Parameter Description w The ErrorAndWarningReceiver object to be registered.
public abstract void setPreferences(Preferences p);Allows the application to dynamically modify the viewer preferences. For more information about preferences, see Preferences.
Parameter Description p The viewer preferences to be set. See Also: getPreferences
public abstract void startModel();Starts the behaviors associated with the model at global time 0. Also causes the createModel method on the model itself to be invoked.
public abstract void stopModel();Forces all media to stop immediately. It is not required to call this method, however, without it, some media (such as sounds) will continue playing until the object is released.
public abstract void tick();Acutally a shorthand way of writing tick(getCurrentTime()). It is the easiest way to explicitly sample and display model and provides a real-time clock for global time.
public abstract void tick(double timeToUse);Explicitly performs a single sampling and display of the model, where timeToUse represents the global time.
Parameter Description timeToUseThe global time for the single sampling.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.