import net.sf.jirr.*;

/**
 
 @author Matthew Casperson
 *
 * TwoDGraphicsResource is used to define a static or animated 2D texture
 *
 */
public class TwoDGraphicsResource 
{
  public ITexture texture = null;
  public recti area = null;
  public float fps = 0;
  public int frames = 0;
  
  public TwoDGraphicsResource(ITexture texture, recti area, SColor alphaColor)
  {
    initialise(texture, area, alphaColor, 01);
  }
    
  public TwoDGraphicsResource(ITexture texture, recti area, SColor alphaColor, float fps, int frames)
  {
    initialise(texture, area, alphaColor, fps, frames);
  }
  
  protected void initialise(ITexture texture, recti area, SColor alphaColor, float fps, int frames)
  {
    this.texture = texture;
    this.area = area;
    this.fps = fps;
    this.frames = frames;
    
    // if an alpha color was supplied use makeColorKeyTexture to make it transparent
    if (alphaColor != null)
    {
      EngineManager.getInstance().getVideoDriver().makeColorKeyTexture(
        texture, 
        alphaColor);
    }
    
    // if no area was supplied assume that the whole texture will be used
    if (this.area == null)
      this.area = new recti(00, texture.getSize().getWidth(), texture.getSize().getHeight());
  }
  
}