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); } }
/** * 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); } }
/** * Get the height of this sprite in pixels * * @return The height of this sprite in pixels */ public int getHeight() { return texture.getImageHeight(); }