Ejemplo n.º 1
0
 public Sprite(TextureLoader loader, String ref, int x, int y, int w, int h) {
   try {
     texture = loader.getTexture(ref, GL_TEXTURE_2D, GL_RGBA, GL_LINEAR, GL_LINEAR, x, y, w, h);
     width = texture.getImageWidth();
     height = texture.getImageHeight();
   } catch (IOException ioe) {
     ioe.printStackTrace();
     System.exit(-1);
   }
 }
Ejemplo n.º 2
0
 /**
  * Create a new sprite from a specified image.
  *
  * @param loader the texture loader to use
  * @param ref A reference to the image on which this sprite should be based
  */
 public Sprite(TextureLoader loader, String ref) {
   try {
     texture = loader.getTexture(ref);
     width = texture.getImageWidth();
     height = texture.getImageHeight();
   } catch (IOException ioe) {
     ioe.printStackTrace();
     System.exit(-1);
   }
 }
Ejemplo n.º 3
0
 /**
  * Get the width of this sprite in pixels
  *
  * @return The width of this sprite in pixels
  */
 public int getWidth() {
   return texture.getImageWidth();
 }