
#include "ming.h"

SWFShape makeRect(int r, int g, int b)
{
  SWFShape s = newSWFShape();

  SWFShape_setRightFill(s, SWFShape_addSolidFill(s, r, g, b, 0xff));
  SWFShape_movePenTo(s, -500, -500);
  SWFShape_drawLineTo(s, 500, -500);
  SWFShape_drawLineTo(s, 500, 500);
  SWFShape_drawLineTo(s, -500, 500);
  SWFShape_drawLineTo(s, -500, -500);
  return s;
}

int main()
{
  SWFButton b;
  SWFMovie m;
  SWFDisplayItem i;

  Ming_init();
  Ming_setScale(1.0);

  b = newSWFButton();
  SWFButton_addShape(b, makeRect(0xff, 0, 0), SWFBUTTON_UP);
  SWFButton_addShape(b, makeRect(0, 0xff, 0), SWFBUTTON_OVER);
  SWFButton_addShape(b, makeRect(0, 0, 0xff), SWFBUTTON_DOWN);
  SWFButton_addShape(b, makeRect(0, 0, 0), SWFBUTTON_HIT);

  m = newSWFMovie();
  SWFMovie_setDimension(m, 2000, 2000);
  SWFMovie_setBackground(m, 0xff, 0xff, 0xff);

  i = SWFMovie_add(m, b);
  SWFDisplayItem_moveTo(i, 1000, 1000);

  SWFMovie_save(m, "test.swf");

  exit(0);
}
