org.jrabbit.standard.profiler
Class ProfilerDisplay

java.lang.Object
  extended by org.jrabbit.standard.profiler.ProfilerDisplay
All Implemented Interfaces:
Renderable, GLTransform, Colored, GLGroupTransformed, Visible
Direct Known Subclasses:
GameLoopProfiler

public class ProfilerDisplay
extends java.lang.Object
implements Renderable, Visible, GLGroupTransformed, Colored

A ProfilerDisplay is an object rendered and updated by a GameLoop that stays constant despite changes in the GameLoop's world. It is specifically designed to display information; most particularly, it is intended to display information about how the game itself is functioning (a.k.a., it is called a "Profiler"). The API for using the ProfilerDisplay is somewhat complex, but a default setup that works for most situations is already provided.

Author:
Chris Molini

Field Summary
protected  Vector2f buffer
          This represents the "buffer" of empty space that is around the contents of the ProfilerDisplay when rendered.
protected  Color color
          This is the Color all ProfilerEntities are rendered at.
protected  OrderedKeyedContainer<ProfilerEntity> contents
          The list of ProfilerEntities, keyed to their references.
protected  ProfilerRenderer renderer
          The object being used to render the list of ProfilerEntities.
protected  GLGroupTransform transforms
          The list of GLTransforms that is applied to this ProfilerDisplay.
protected  boolean visible
          Whether or not the ProfilerDisplay should be shown.
 
Constructor Summary
ProfilerDisplay()
          Creates a ProfilerDisplay that renders its contents from the top-left of the screen.
ProfilerDisplay(ProfilerRenderer renderer)
          Creates a ProfilerDisplay that uses the indicated renderer.
 
Method Summary
 void bind()
          Applies all GLTransforms in the list.
 Vector2f buffer()
          Accesses the ProfilerDisplay's buffer.
 Color color()
          Accesses the ProfilerDisplay's color.
 OrderedKeyedContainer<ProfilerEntity> contents()
          Accesses the list of ProfilerEntities.
 void release()
          Calls release() on the list of GLTransforms.
 void render()
          Renders the ProfilerDisplay.
 ProfilerRenderer renderer()
          Accesses the object used to render the list of ProfilerEntities.
 void setAllVisible(boolean visible)
          Sets the visibility flag for all ProfilerEntities in the list.
 void setRenderer(ProfilerRenderer renderer)
          Redefines the object used to render the list of ProfilerEntities.
 void setVisible(boolean visible)
          Redefines the ProfilerDisplay's visibility flag.
 void setVisibleFor(boolean visible, java.lang.String... references)
          Sets the visibility flag for all specified ProfilerEntities.
 void setVisibleForAllExcept(boolean visible, java.lang.String... references)
          Sets the visibility flag for all ProfilerEntities, except those with the indicated references.
 GLGroupTransform transforms()
          Accesses the dynamic list of GLTransforms being applied to the ProfilerDisplay.
 boolean visible()
          Learns if the ProfilerDisplay is being rendered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contents

protected OrderedKeyedContainer<ProfilerEntity> contents
The list of ProfilerEntities, keyed to their references.


renderer

protected ProfilerRenderer renderer
The object being used to render the list of ProfilerEntities.


transforms

protected GLGroupTransform transforms
The list of GLTransforms that is applied to this ProfilerDisplay.


buffer

protected Vector2f buffer
This represents the "buffer" of empty space that is around the contents of the ProfilerDisplay when rendered.


color

protected Color color
This is the Color all ProfilerEntities are rendered at.


visible

protected boolean visible
Whether or not the ProfilerDisplay should be shown. By default this is left active.

Constructor Detail

ProfilerDisplay

public ProfilerDisplay()
Creates a ProfilerDisplay that renders its contents from the top-left of the screen.


ProfilerDisplay

public ProfilerDisplay(ProfilerRenderer renderer)
Creates a ProfilerDisplay that uses the indicated renderer.

Parameters:
renderer - The ProfilerRenderer that will organize the ProfilerEntities when rendered.
Method Detail

contents

public OrderedKeyedContainer<ProfilerEntity> contents()
Accesses the list of ProfilerEntities.

Returns:
The OrderedKeyedContainer that maintains the keyed list of ProfilerEntities.

renderer

public ProfilerRenderer renderer()
Accesses the object used to render the list of ProfilerEntities.

Returns:
The ProfilerRenderer that renders the ProfilerDisplay.

setRenderer

public void setRenderer(ProfilerRenderer renderer)
Redefines the object used to render the list of ProfilerEntities.

Parameters:
renderer - The new ProfilerRenderer to use.

buffer

public Vector2f buffer()
Accesses the ProfilerDisplay's buffer.

Returns:
The Vector2f that represents the buffer around the edges of the screen when the ProfilerDisplay is rendered.

color

public Color color()
Accesses the ProfilerDisplay's color.

Specified by:
color in interface Colored
Returns:
The Color that is applied to every ProfilerEntity when rendered.

transforms

public GLGroupTransform transforms()
Accesses the dynamic list of GLTransforms being applied to the ProfilerDisplay.

Specified by:
transforms in interface GLGroupTransformed
Returns:
The GLGroupTransform that affects this ProfilerDisplay.

visible

public boolean visible()
Learns if the ProfilerDisplay is being rendered.

Specified by:
visible in interface Visible
Returns:
True if the ProfilerDisplay is being rendered, false if not.

setVisible

public void setVisible(boolean visible)
Redefines the ProfilerDisplay's visibility flag.

Specified by:
setVisible in interface Visible
Parameters:
visible - Whether or not the ProfilerDisplay should be rendered.

setAllVisible

public void setAllVisible(boolean visible)
Sets the visibility flag for all ProfilerEntities in the list. NOTE: This call is different that setVisible(boolean). If this is being called in an attempt to hide the ProfilerDisplay, use the other method.

Parameters:
visible - Whether or not the ProfilerEntities should be visible.

setVisibleFor

public void setVisibleFor(boolean visible,
                          java.lang.String... references)
Sets the visibility flag for all specified ProfilerEntities.

Parameters:
visible - Whether or not an affected ProfilerEntity should be visible or not.
references - The references of all ProfilerEntities to affect.

setVisibleForAllExcept

public void setVisibleForAllExcept(boolean visible,
                                   java.lang.String... references)
Sets the visibility flag for all ProfilerEntities, except those with the indicated references.

Parameters:
visible - Whether or not an affected ProfilerEntity should be visible or not.
references - The references of all ProfilerEntities to exclude.

bind

public void bind()
Applies all GLTransforms in the list.

Specified by:
bind in interface GLTransform

release

public void release()
Calls release() on the list of GLTransforms.

Specified by:
release in interface GLTransform

render

public void render()
Renders the ProfilerDisplay.

Specified by:
render in interface Renderable