DirectX Media for Animation Java Reference Previous
Previous
Classes
Classes
Index
Index
Next
Next

Viewer Interface

Methods

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.


Methods


getCurrentTime

public abstract double getCurrentTime();

Returns the number of seconds since startModel was invoked.

Return Value:

Returns a double floating-point number.


getCurrentTickTime

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.


getPreferences

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


registerErrorAndWarningReceiver

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.

ParameterDescription
w The ErrorAndWarningReceiver object to be registered.


setPreferences

public abstract void setPreferences(Preferences p);

Allows the application to dynamically modify the viewer preferences. For more information about preferences, see Preferences.

ParameterDescription
p The viewer preferences to be set.

See Also: getPreferences


startModel

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.


stopModel

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.


tick

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.


tick

public abstract void tick(double timeToUse);

Explicitly performs a single sampling and display of the model, where timeToUse represents the global time.

ParameterDescription
timeToUseThe global time for the single sampling.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.