
/**
 * This simple MyGUIObject allows an image to be loaded and positioned within a MyGUIGroup.
 */

public class MyGUIImage extends MyGUIObject {

  /* Core variables */
  PImage _icon;
  
  /* Constructors */
  MyGUIImage(int x, int y, PImage icon) {
    super(x, y);
    _icon = icon;
    _width = icon.width;
    _height = icon.height;
  }
     
  void drawStates() {
    pushMatrix();
    translate(_x, _y);
    scale(_scale);
    rotate(radians(_rotation));
    imageMode(CORNERS);
    image(_icon, -_width/2, -_height/2, _width/2, _height/2);
    popMatrix();
  }
}
