espresso3d.engine.viewport.text
Class E3DMessage

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.renderer.base.E3DBlendedRenderable
              extended byespresso3d.engine.renderer.base.E3DBlendedTexturedRenderable
                  extended byespresso3d.engine.viewport.text.E3DMessage

public class E3DMessage
extends E3DBlendedTexturedRenderable

Author:
Curt A message is a single piece of text that was added to the viewport for printing via the viewport's viewportPrinter. This is constructing out of the String message to be displayed, font, etc. It is constructed by the viewport printer and passed back to the user after it is added to the viewport for rendering.

Field Summary
 
Fields inherited from class espresso3d.engine.renderer.base.E3DBlendedRenderable
BLENDMODE_BLEND, BLENDMODE_SOLID
 
Fields inherited from class espresso3d.engine.renderer.base.E3DRenderable
RENDERMODE_SOLID, RENDERMODE_TEXTURED, RENDERMODE_WIREFRAME
 
Constructor Summary
E3DMessage(E3DEngine engine, E3DViewport viewport, java.lang.String text, espresso3d.engine.viewport.text.E3DFont font, double fontSize, E3DVector2I position, double life, E3DVector3F color)
          Create a message to be printed by the viewport printer.
E3DMessage(E3DEngine engine, E3DViewport viewport, java.lang.String text, espresso3d.engine.viewport.text.E3DFont font, double fontSize, E3DVector2I position, double life, E3DVector3F color, int blendMode)
          Create a message to be printed by the viewport printer.
 
Method Summary
 double getAge()
          Return the age, or, how long the message has been rendered
 E3DVector3F getColor()
          Return the color of the message
 E3DVector2I getCursorPositionAfterMessage()
          This returns the X, Y coords of the cursor after the last character in the message.
 espresso3d.engine.viewport.text.E3DFont getFont()
          Return the font object the message is bound to
 double getFontSize()
          Return the size of the font for the message
 double getLife()
          Get the life of the message, or, how many seconds it will be rendered in the engine.
 E3DVector2I getPosition()
          Get the 2D (x,y) position the message starts at.
 java.util.ArrayList getPositionedQuadList()
          This will return an arraylist of positioned, textured quads in 3D space for the message.
 java.lang.String getText()
          Get the text of the message that will be rendered in the viewport.
 void renderAtPosition(E3DVector3F position)
           
protected  void setAge(double age)
           
 void setColor(E3DVector3F color)
          Set the color of the message.
 void setFont(espresso3d.engine.viewport.text.E3DFont font)
          Change the font object the message should use
 void setFontSize(double fontSize)
          Change the size of the font the message is using.
protected  void setLife(double life)
          Get the life of the message, or, how many seconds it will be rendered in the engine.
 void setPosition(E3DVector2I position)
          Set the 2D (x,y) position the message starts at.
 void setText(java.lang.String text)
          Change the messages text
protected  boolean update(double lastFrameTimeSeconds)
          Called by the printer to update its life
 
Methods inherited from class espresso3d.engine.renderer.base.E3DBlendedTexturedRenderable
getRenderableOptionsKey, getTexture, setTexture
 
Methods inherited from class espresso3d.engine.renderer.base.E3DBlendedRenderable
getBlendMode, initCorrectGeometryRenderer, setBlendMode
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getRenderMode, render, setRenderMode
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

E3DMessage

public E3DMessage(E3DEngine engine,
                  E3DViewport viewport,
                  java.lang.String text,
                  espresso3d.engine.viewport.text.E3DFont font,
                  double fontSize,
                  E3DVector2I position,
                  double life,
                  E3DVector3F color)
Create a message to be printed by the viewport printer. This defaults to be rendered blended

Parameters:
engine -
viewport -
text -
font -
fontSize -
position -
life -
color -

E3DMessage

public E3DMessage(E3DEngine engine,
                  E3DViewport viewport,
                  java.lang.String text,
                  espresso3d.engine.viewport.text.E3DFont font,
                  double fontSize,
                  E3DVector2I position,
                  double life,
                  E3DVector3F color,
                  int blendMode)
Create a message to be printed by the viewport printer.

Parameters:
engine -
viewport -
text -
font -
fontSize -
life -
color -
blendMode - Type of blending to use when rendering
Method Detail

renderAtPosition

public void renderAtPosition(E3DVector3F position)
Specified by:
renderAtPosition in class E3DBlendedTexturedRenderable

getPositionedQuadList

public java.util.ArrayList getPositionedQuadList()
This will return an arraylist of positioned, textured quads in 3D space for the message. This is usually used internally by the font renderer only.

Returns:

getCursorPositionAfterMessage

public E3DVector2I getCursorPositionAfterMessage()
This returns the X, Y coords of the cursor after the last character in the message. This is useful for creating another message that will start directly after the current message for things like a change in colors.

Returns:

getFont

public espresso3d.engine.viewport.text.E3DFont getFont()
Return the font object the message is bound to


setFont

public void setFont(espresso3d.engine.viewport.text.E3DFont font)
Change the font object the message should use

Parameters:
font -

update

protected boolean update(double lastFrameTimeSeconds)
Called by the printer to update its life

Returns:
returns false if this message's life has expired and it should be removed from the viewport printer

getLife

public double getLife()
Get the life of the message, or, how many seconds it will be rendered in the engine. -1 is infinity.

Returns:

setLife

protected void setLife(double life)
Get the life of the message, or, how many seconds it will be rendered in the engine. -1 is infinity.

Parameters:
life - Number of seconds the message should be rendered

getText

public java.lang.String getText()
Get the text of the message that will be rendered in the viewport.

Returns:

setText

public void setText(java.lang.String text)
Change the messages text

Parameters:
text -

getAge

public double getAge()
Return the age, or, how long the message has been rendered

Returns:

setAge

protected void setAge(double age)

getColor

public E3DVector3F getColor()
Return the color of the message

Returns:

setColor

public void setColor(E3DVector3F color)
Set the color of the message.

Parameters:
color -

getFontSize

public double getFontSize()
Return the size of the font for the message

Returns:

setFontSize

public void setFontSize(double fontSize)
Change the size of the font the message is using. Will increase or decrease its size

Parameters:
fontSize - Size of the font (or scalar for the message)

getPosition

public E3DVector2I getPosition()
Get the 2D (x,y) position the message starts at. The position is the bottom left corner of the first character of the message and is in viewport space.

Returns:

setPosition

public void setPosition(E3DVector2I position)
Set the 2D (x,y) position the message starts at. The position is the bottom left corner of the first character of the message and is in viewport space.

Parameters:
position -