Top Description Fields Constructors Methods
org.lwjgl.examples.spaceinvaders

public Class Sprite

extends Object
Class Inheritance
Imports
java.io.IOException

Implementation of sprite that uses an OpenGL quad and a texture to render a given image to the screen.
Authors
Kevin Glass, Brian Matzon

Field Summary

Modifier and TypeField and Description
private int
height

The height in pixels of this sprite

private Texture
texture

The texture that stores the image for this sprite

private int
width

The width in pixels of this sprite

Constructor Summary

AccessConstructor and Description
public
Sprite(TextureLoader
the texture loader to use
loader
,
String
A reference to the image on which this sprite should be based
ref
)

Create a new sprite from a specified image.

Method Summary

Modifier and TypeMethod and Description
public void
draw(int
The x location at which to draw this sprite
x
,
int
The y location at which to draw this sprite
y
)

Draw the sprite at the specified location

public int

Returns:

The height of this sprite in pixels
getHeight
()

Get the height of this sprite in pixels

public int

Returns:

The width of this sprite in pixels
getWidth
()

Get the width of this sprite in pixels

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

heightback to summary
private int height

The height in pixels of this sprite

textureback to summary
private Texture texture

The texture that stores the image for this sprite

widthback to summary
private int width

The width in pixels of this sprite

Constructor Detail

Spriteback to summary
public Sprite(TextureLoader loader, String ref)

Create a new sprite from a specified image.

Parameters
loader:TextureLoader

the texture loader to use

ref:String

A reference to the image on which this sprite should be based

Method Detail

drawback to summary
public void draw(int x, int y)

Draw the sprite at the specified location

Parameters
x:int

The x location at which to draw this sprite

y:int

The y location at which to draw this sprite

getHeightback to summary
public int getHeight()

Get the height of this sprite in pixels

Returns:int

The height of this sprite in pixels

getWidthback to summary
public int getWidth()

Get the width of this sprite in pixels

Returns:int

The width of this sprite in pixels