|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.gameEngine.graphics.Texture
vooga.gameEngine.graphics.ImageTexture
public class ImageTexture
Class ImageTexture
creates a Texture
from a URL
linking to an image file. The images used must be a .png, .gif, or .jpg. The
image should contain a continuous opaque area that represents the object and
the rest of the image should be transparent. The image will automatically be
cropped to its minimal visible size such that in every row and column there
is at least one non-transparent pixel.
Constructor Summary | |
---|---|
ImageTexture(java.net.URL url,
Dimension d,
Position p)
Creates a new ImageTexture from a url, dimension, and
position. |
Method Summary | |
---|---|
protected java.awt.Shape |
makeShape()
Method for a Texture subclass to supply a Shape
representing their bounding box. |
void |
setImage(java.net.URL url)
Loads an image from a url and uses it to represent this Texture on screen. |
void |
setShape(java.awt.Shape s)
sets the shape of the image by cutting our the image to fit the shape |
Methods inherited from class vooga.gameEngine.graphics.Texture |
---|
getArea, getIndex, getPosition, getRotation, getShape, getSize, paintComponent, setImage, setIndex, setPosition, setRotation, setSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageTexture(java.net.URL url, Dimension d, Position p)
ImageTexture
from a url, dimension, and
position. The image when loaded will automatically be cropped to its
minimal visible size.
url
- is the link to the image file to be usedd
- is the dimension of the object in the game's coordinate systemp
- is the position of the top left corner of the created
Texture
in the game's coordinate systemMethod Detail |
---|
public void setImage(java.net.URL url)
Texture
on screen. The image is automatically cropped to its
minimal visible size.
url
- is the link to the image file to be usedpublic void setShape(java.awt.Shape s)
s
- protected java.awt.Shape makeShape()
Texture
Texture
subclass to supply a Shape
representing their bounding box. For efficiency, an object should cache
their Shape
if possible.
makeShape
in class Texture
Shape
representing the boundaries of the object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |