Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.threed.jpct.util
Class Overlay

    java.lang.Object
      com.threed.jpct.util.Overlay

All Implemented Interfaces:
  java.io.Serializable

public class Overlay
extends java.lang.Object
implements java.io.Serializable

Overlay is a helper class to create opaque or transparent screen overlays from textures. An overlay is quite similar to scaled blit with the exception that an overlay has an actual depth and that it takes care of itself, i.e. once created, it will appear automatically until you dispose it. A scaled blit has to be applied by the application each frame.

See Also:
  Serialized Form

Constructor Summary
`Overlay(World world, FrameBuffer buffer, java.lang.String textureName)` Creates a new overlay that covers the whole screen.
`Overlay(World world, int upperLeftX, int upperLeftY, int lowerRightX, int lowerRightY, java.lang.String textureName)` Creates a new overlay of arbritary size.

Method Summary
`void` | `dispose()` Disposes the overlay and frees its resources.
`void` | `setColor(java.awt.Color color)` Sets a new additional color.
`void` | `setDepth(float depth)` Sets the depth of the overlay.
`void` | `setNewCoordinates(int upperLeftX, int upperLeftY, int lowerRightX, int lowerRightY)` Sets new coordinates for the overlay.
`void` | `setRotation(float angle)` Rotates the Overlay around it's midpoint.
`void` | `setSelectable(boolean mode)` Sets the object as selectable/unselectable.
`void` | `setSourceCoordinates(int upperLeftX, int upperLeftY, int lowerRightX, int lowerRightY)` Sets new source coordinates.
`void` | `setTexture(java.lang.String textureName)` Changes the texture of the overlay.
`void` | `setTexture(TextureInfo textureInfo)` Changes the texture of the overlay.
`void` | `setTransparency(int trans)` Set the transparency of the overlay.
`void` | `setTransparencyMode(int mode)` Sets the transparency mode similar to setTransparencyMode() in Object3D.
`void` | `setVisibility(boolean visible)` Sets the visibility similar to setVisibility() in Object3D.
`void` | `unlink()` Unlinks the overlay.
`void` | `update(FrameBuffer buffer)` Updates the overlay.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Overlay

    public Overlay(World world,
                   FrameBuffer buffer,
                   java.lang.String textureName)

  Creates a new overlay that covers the whole screen.

Parameters:
  `world` - the world
  `buffer` - the current frame buffer
  `textureName` - the name of the texture that should be used as an overlay. The TextureManager has to know this texture.

### Overlay

    public Overlay(World world,
                   int upperLeftX,
                   int upperLeftY,
                   int lowerRightX,
                   int lowerRightY,
                   java.lang.String textureName)

  Creates a new overlay of arbritary size.

Parameters:
  `world` - the world
  `upperLeftX` - the upper left corner's x-coordinate in screen coordinates
  `upperLeftY` - the upper left corner's y-coordinate in screen coordinates
  `lowerRightX` - the lower right corner's x-coordinate in screen coordinates
  `lowerRightY` - the lower right corner's y-coordinate in screen coordinates
  `textureName` - the name of the texture that should be used as an overlay. The TextureManager has to know this texture.

Method Detail

### setDepth

    public void setDepth(float depth)

  Sets the depth of the overlay. By default the overlay is bound to Config.nearPlane with a small offset. By setting this to a higher value, the overlay will ovberlap differently with other objects in the world while still filling the whole screen.
  Useful for using an (pseudo-)overlay as static backdrop.

  Parameters:
    `depth` - the new depth (should be positive)

### setSelectable

    public void setSelectable(boolean mode)

  Sets the object as selectable/unselectable. An object that is set to be unselectable won't be processed by the pickPolygon() method in Interact2D. Default for an Overlay is MOUSE_UNSELECTABLE.

  Parameters:
    `mode` - MOUSE_SELECTABLE/MOUSE_UNSELECTABLE
  See Also:
    `Object3D.MOUSE_SELECTABLE`, `Object3D.MOUSE_UNSELECTABLE`

### setTransparency

    public void setTransparency(int trans)

  Set the transparency of the overlay. The trans-value behaves as the value in Object3D's setTransparency()-method. By default, the overlay is opaque.

  Parameters:
    `trans` - the transparency value
  See Also:
    `Object3D.setTransparency(int)`

### setColor

    public void setColor(java.awt.Color color)

  Sets a new additional color. With this, it's possible to give the overlay another coloring. Default is white, i.e. the overlay shows the same colors like they are defined in the texture.

  Parameters:
    `color` - the new Color

### setTexture

    public void setTexture(java.lang.String textureName)

  Changes the texture of the overlay.

  Parameters:
    `textureName` - the new texture's name as the TextureManager knows it.

### setTexture

    public void setTexture(TextureInfo textureInfo)

  Changes the texture of the overlay.

  Parameters:
    `textureInfo` - the new TextureInfo.

### setVisibility

    public void setVisibility(boolean visible)

  Sets the visibility similar to setVisibility() in Object3D.

  Parameters:
    `visible` - should it be visible or not?
  See Also:
    `Object3D.setVisibility(boolean)`

### setTransparencyMode

    public void setTransparencyMode(int mode)

  Sets the transparency mode similar to setTransparencyMode() in Object3D.

  Parameters:
    `mode` - the mode
  See Also:
    `Object3D.setTransparencyMode(int)`, `Object3D.TRANSPARENCY_MODE_DEFAULT`, `Object3D.TRANSPARENCY_MODE_ADD`

### setNewCoordinates

    public void setNewCoordinates(int upperLeftX,
                                  int upperLeftY,
                                  int lowerRightX,
                                  int lowerRightY)

  Sets new coordinates for the overlay.

  Parameters:
    `upperLeftX` - the upper left corner's x-coordinate in screen coordinates
    `upperLeftY` - the upper left corner's y-coordinate in screen coordinates
    `lowerRightX` - the lower right corner's x-coordinate in screen coordinates
    `lowerRightY` - the lower right corner's y-coordinate in screen coordinates

### setSourceCoordinates

    public void setSourceCoordinates(int upperLeftX,
                                     int upperLeftY,
                                     int lowerRightX,
                                     int lowerRightY)

  Sets new source coordinates. Only the defined part of the source texture will be used as an overlay. Setting this will slow the overlay down a tiny little bit, but that shouldn't be noticable.

  Parameters:
    `upperLeftX` - the upper left corner's x-coordinate in texture coordinates
    `upperLeftY` - the upper left corner's y-coordinate in texture coordinates
    `lowerRightX` - the lower right corner's x-coordinate in texture coordinates
    `lowerRightY` - the lower right corner's y-coordinate in texture coordinates

### setRotation

    public void setRotation(float angle)

  Rotates the Overlay around it's midpoint.

  Parameters:
    `angle` - the angle

### dispose

    public void dispose()

  Disposes the overlay and frees its resources. It can't be used after calling this method

### unlink

    public void unlink()

  Unlinks the overlay. It shouldn't be required to call this method from a normal application.

### update

    public void update(FrameBuffer buffer)

  Updates the overlay. It shouldn't be required to call this method from a normal application.

  Parameters:
    `buffer` -

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD