espresso3d.engine.viewport.text
Class E3DViewportPrinter

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.viewport.text.E3DViewportPrinter

public class E3DViewportPrinter
extends E3DRenderable

Author:
Curt The container for all text that needs to be displayed, regardless of viewport. This handles managing fonts (global to all viewports) and adding messages (text) to specific viewports.

Constructor Summary
E3DViewportPrinter(E3DEngine engine, E3DViewport viewport)
          Construct a viewport printer.
 
Method Summary
 void addFont(espresso3d.engine.viewport.text.E3DFont font)
          Add (register) a font to the viewport printer.
 espresso3d.engine.viewport.text.E3DFont getFont(java.lang.String fontID)
          Get a registered font object from the viewportprinter named fontID
 E3DViewport getViewport()
          Get the viewport the viewportPrinter is within
 E3DMessage printToViewport(java.lang.String text, java.lang.String fontName, int fontSize, E3DVector2I position, double life)
           
 E3DMessage printToViewport(java.lang.String text, java.lang.String fontName, int fontSize, E3DVector3F color, E3DVector2I position, double life)
           
 E3DMessage printToViewport(java.lang.String text, java.lang.String fontName, int fontSize, E3DVector3F color, E3DVector2I position, double life, int blendMode)
           
 void removeFont(java.lang.String fontID)
          Remove a font from the viewportprinter
 void removeMessage(E3DMessage message)
          Remove a message from the viewport even if its life hasn't expired yet.
 void render()
          Rendering all messages
 void setViewport(E3DViewport viewport)
          Set the viewport the viewportPrinter belongs to.
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getBlendMode, getKey, getRenderMode, initCorrectGeometryRenderer, isKeyChanged, setBlendMode, setKeyChanged, setRenderMode
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DViewportPrinter

public E3DViewportPrinter(E3DEngine engine,
                          E3DViewport viewport)
Construct a viewport printer. This will be handled automatically by a viewport

Method Detail

addFont

public void addFont(espresso3d.engine.viewport.text.E3DFont font)
Add (register) a font to the viewport printer.

Parameters:
font -

getFont

public espresso3d.engine.viewport.text.E3DFont getFont(java.lang.String fontID)
Get a registered font object from the viewportprinter named fontID

Parameters:
fontID - ID of the font registered in the viewportPrinter
Returns:

removeFont

public void removeFont(java.lang.String fontID)
Remove a font from the viewportprinter

Parameters:
fontID - Unique ID of the font to remove

printToViewport

public E3DMessage printToViewport(java.lang.String text,
                                  java.lang.String fontName,
                                  int fontSize,
                                  E3DVector2I position,
                                  double life)
Parameters:
text - The text to print to the viewport
fontName - Name of a font that has been loaded already
fontSize - The size the font should be displayed as. The font size scales as the main window scales, NOT the viewport
position - Position starting from x=0,y=0 at the bottom left corner of the viewport (NOT window). The font grows up and right from here
life - How long (Seconds) the text should be printed. -1 is infinity
Returns:
returns the E3DMessage object that is printed in the viewport.

printToViewport

public E3DMessage printToViewport(java.lang.String text,
                                  java.lang.String fontName,
                                  int fontSize,
                                  E3DVector3F color,
                                  E3DVector2I position,
                                  double life)
Parameters:
text - The text to print to the viewport
fontName - Name of a font that has been loaded already
fontSize - The size the font should be displayed as. The font size scales as the main window scales, NOT the viewport
position - Position starting from x=0,y=0 at the bottom left corner of the viewport (NOT window). The font grows up and right from here
life - How long (Seconds) the text should be printed. -1 is infinity
color - A color overlay for the font. X=R, Y=G, Z=B. If the font is white, this will change the font to whatever color you specify Valid range is [0.0, 1.0]
Returns:
returns the E3DMessage object that is printed in the viewport.

printToViewport

public E3DMessage printToViewport(java.lang.String text,
                                  java.lang.String fontName,
                                  int fontSize,
                                  E3DVector3F color,
                                  E3DVector2I position,
                                  double life,
                                  int blendMode)
Parameters:
text - The text to print to the viewport
fontName - Name of a font that has been loaded already
fontSize - The size the font should be displayed as. The font size scales as the main window scales, NOT the viewport
position - Position starting from x=0,y=0 at the bottom left corner of the viewport (NOT window). The font grows up and right from here
life - How long (Seconds) the text should be printed. -1 is infinity
color - A color overlay for the font. X=R, Y=G, Z=B. If the font is white, this will change the font to whatever color you specify Valid range is [0.0, 1.0]
blendMode - The type of blending to use for the font if other than default BLENDMODE_BLEND. The blendmodes are enumerated in E3DBlendedRenderable
Returns:
returns the E3DMessage object that is printed in the viewport.

removeMessage

public void removeMessage(E3DMessage message)
Remove a message from the viewport even if its life hasn't expired yet.

Parameters:
message -

render

public void render()
Rendering all messages

Specified by:
render in class E3DRenderable

getViewport

public E3DViewport getViewport()
Get the viewport the viewportPrinter is within


setViewport

public void setViewport(E3DViewport viewport)
Set the viewport the viewportPrinter belongs to. This should not be changed.

Parameters:
viewport -