org.xith3d.ui.hud.widgets
Class FPSCounter

java.lang.Object
  extended by org.xith3d.ui.hud.base.Widget
      extended by org.xith3d.ui.hud.base.BackgroundSettableWidget
          extended by org.xith3d.ui.hud.widgets.Label
              extended by org.xith3d.ui.hud.widgets.FPSCounter
All Implemented Interfaces:
org.jagatoo.datatypes.Enableable, org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.types.twodee.Positioned2f, org.openmali.types.twodee.Positioned2fRO, org.openmali.types.twodee.Sized2f, org.openmali.types.twodee.Sized2fRO, FPSListener, AutoSizable, PaddingSettable, TextWidget

public class FPSCounter
extends Label
implements FPSListener

Simple Widget to display the FPS count of your application. You can easily add it to an instance of ExtRenderLoop.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.widgets.Label
Label.Description
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
BackgroundSettableWidget.BackgroundSettableDescriptionBase
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
 
Fields inherited from class org.xith3d.ui.hud.widgets.Label
DEFAULT_HEAVYWEIGHT
 
Fields inherited from class org.xith3d.ui.hud.base.Widget
transformHeight_Pixels2HUD, transformWidth_Pixels2HUD
 
Constructor Summary
FPSCounter(boolean isHeavyWeight, float width, float height)
          Creates a new FPSCounter with the given width and height.
FPSCounter(boolean isHeavyWeight, float width, float height, java.lang.String backgroundTexture)
          Creates a new FPSCounter with the given width and height.
FPSCounter(boolean isHeavyWeight, float width, float height, Texture2D backgroundTexture)
          Creates a new FPSCounter with the given width and height.
FPSCounter(float width, float height)
          Creates a new FPSCounter with the given width and height.
FPSCounter(float width, float height, java.lang.String backgroundTexture)
          Creates a new FPSCounter with the given width and height.
FPSCounter(float width, float height, Texture2D backgroundTexture)
          Creates a new FPSCounter with the given width and height.
 
Method Summary
 char getDecimalSeparator()
           
 float getLastFPS()
           
 java.lang.String getPostfix()
          Sets the postfix to be appended to the FPS value.
 java.lang.String getPrefix()
           
 void onFPSCountIntervalHit(float fps)
          This method is called by the RenderLoop each FPS-counting interval
 void setDecimalSeparator(char decSep)
          Changes the decimal separator to the given char.
 void setPostfix(java.lang.String postfix)
          Sets the postfix to be appended to the FPS value.
 void setPrefix(java.lang.String prefix)
          Sets the prefix to be set to the FPS value.
 
Methods inherited from class org.xith3d.ui.hud.widgets.Label
drawIcon, drawText, drawWidget, getAlignment, getDisplayedText, getFont, getFont, getFontColor, getFontColor, getFontColorDisabled, getFontDisabled, getIcon, getIconGap, getMinimalHeight, getMinimalSize, getMinimalWidth, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getText, getTextOffsetX, getTextOffsetY, init, initSize, isAutoSizeEnabled, isEnabled, onAttachedToHUD, onSizeChanged, prepareText, setAlignment, setAutoSizeEnabled, setEnabled, setEnabledImpl, setFont, setFontColor, setFontColorDisabled, setFontDisabled, setIcon, setIcon, setIconGap, setMinimalSize, setPadding, setPadding, setText, setText, setText, setTextOffset, updateText
 
Methods inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
drawBackground, getBackgroundColor, getBackgroundTexture, getBackgroundTileMode, setBackground, setBackground, setBackground, setBackgroundColor, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTileMode, setNoBackground
 
Methods inherited from class org.xith3d.ui.hud.base.Widget
addContainerListener, addControllerListener, addFocusListener, addInputListener, addKeyboardListener, addLocationListener, addMouseListener, addSizeListener, addVisibilityListener, bindToGlobalMouseMovement, blocksFocusMoveDeviceComponent, calculateTransformHeight_Pixels2HUD, calculateTransformWidth_Pixels2HUD, compareAbsZIndex, createShape, detach, drawAndUpdateWidget, drawBorder, drawWidgetAfterWidgetAssembler, drawWidgetContents, getAbsoluteLocationOnHUD_, getAspect, getAssembly, getBorder, getContainer, getContentAspect, getContentHeight, getContentHeightPX, getContentLeftPX, getContentOffset, getContentTopPX, getContentWidth, getContentWidthPX, getContextMenu, getCursor, getEqualHeight_, getEqualWidth_, getForcedRedrawFrequency, getHeight, getHeightPX, getHUD, getLeft, getLevel, getLocation, getLocation, getLocationHUD2Pixels_, getLocationHUD2SG_, getLocationPixels2HUD_, getLocationSG2HUD_, getMaxRedrawFrequency, getMinHeight, getMinWidth, getName, getParentWindow, getPickHeight, getPickWidth, getRelLocationHUD2Pixels_, getRootHostWidget, getShape, getSize, getSizeHUD2Pixels_, getSizeHUD2SG_, getSizeOfPixels_, getSizePixels2HUD_, getSizeSG2HUD_, getToolTip, getTop, getTransparency, getUserObject, getWidgetAssembler, getWidth, getWidthPX, getZIndex, hasDropShadow, hasFocus, hasFocus, hasToolTip, isAHostedWidgetDirty, isClickable, isDraggable, isFocussable, isHeavyWeight, isHovered, isInitialized, isInitializing, isPickable, isThisWidgetDirty, isVisible, notifyOnDragStopped, onAttachedToContainer, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetachedFromContainer, onDetachedFromHUD, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, onKeyReleased, onKeyTyped, onLocationChanged, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseExited, onMouseMoved, onMouseStopped, onMouseWheelMoved, onVisibilityChanged, pick, pickConditionsMatch, removeContainerListener, removeControllerListener, removeFocusListener, removeInputListener, removeKeyboardListener, removeLocationListener, removeMouseListener, removeSizeListener, removeVisibilityListener, requestFocus, resetWidgetDirty, setBorder, setBorder, setClickable, setContentClipRect, setContextMenu, setCursor, setDraggable, setFocussable, setForcedRedrawFrequency, setHasDropShadow, setHeight, setHostedWidgetDirty, setHostTextureDirty, setHostTextureDirty, setHostWidget, setLocation, setLocation, setLocation, setMaxRedrawFrequency, setName, setPickable, setSize, setSize, setSize, setSize, setTextureDirty, setTextureDirty, setToolTip, setTransparency, setTransparency, setUserObject, setVisible, setWidgetDirty, setWidth, setZIndex, startDragging, toString, update, updateAbsZIndex, updateSizeFactors, updateTranslation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FPSCounter

public FPSCounter(boolean isHeavyWeight,
                  float width,
                  float height,
                  Texture2D backgroundTexture)
Creates a new FPSCounter with the given width and height.

Parameters:
isHeavyWeight -
width - the new width of this Widget
height - the new height of this Widget
backgroundTexture -

FPSCounter

public FPSCounter(boolean isHeavyWeight,
                  float width,
                  float height,
                  java.lang.String backgroundTexture)
Creates a new FPSCounter with the given width and height.

Parameters:
isHeavyWeight -
width - the new width of this Widget
height - the new height of this Widget
backgroundTexture -

FPSCounter

public FPSCounter(boolean isHeavyWeight,
                  float width,
                  float height)
Creates a new FPSCounter with the given width and height.

Parameters:
isHeavyWeight -
width - the new width of this Widget
height - the new height of this Widget

FPSCounter

public FPSCounter(float width,
                  float height,
                  Texture2D backgroundTexture)
Creates a new FPSCounter with the given width and height.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
backgroundTexture -

FPSCounter

public FPSCounter(float width,
                  float height,
                  java.lang.String backgroundTexture)
Creates a new FPSCounter with the given width and height.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
backgroundTexture -

FPSCounter

public FPSCounter(float width,
                  float height)
Creates a new FPSCounter with the given width and height.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
Method Detail

setPrefix

public void setPrefix(java.lang.String prefix)
Sets the prefix to be set to the FPS value.


getPrefix

public final java.lang.String getPrefix()
Returns:
the postfix to be appended to the FPS value

setPostfix

public void setPostfix(java.lang.String postfix)
Sets the postfix to be appended to the FPS value.


getPostfix

public final java.lang.String getPostfix()
Sets the postfix to be appended to the FPS value.


setDecimalSeparator

public void setDecimalSeparator(char decSep)
Changes the decimal separator to the given char.
Use '\0' to not display any decimal places.

Parameters:
decSep -

getDecimalSeparator

public final char getDecimalSeparator()

getLastFPS

public final float getLastFPS()
Returns:
the last notified FPS value

onFPSCountIntervalHit

public void onFPSCountIntervalHit(float fps)
This method is called by the RenderLoop each FPS-counting interval

Specified by:
onFPSCountIntervalHit in interface FPSListener
Parameters:
fps - the average frames per second during the last interval