
#include "ming.h"

int main()
{
  SWFShape s;
  SWFButton b;
  SWFMovieClip p;
  SWFMovie m;
  SWFDisplayItem i;

  Ming_init();
  Ming_setScale(1.0);

  s = newSWFShape();
  SWFShape_setRightFill(s, SWFShape_addSolidFill(s, 0xff, 0, 0, 0xff));
  SWFShape_drawLine(s, 1000, 0);
  SWFShape_drawLine(s, 0, 1000);
  SWFShape_drawLine(s, -1000, 0);
  SWFShape_drawLine(s, 0, -1000);

  b = newSWFButton();
  SWFButton_addShape(b, s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);

  SWFButton_addAction(b, compileSWFActionCode("startDrag('/test', 0);"), /* '0' means don't lock to mouse */
	       SWFBUTTON_MOUSEDOWN);

  SWFButton_addAction(b, compileSWFActionCode("stopDrag();"),
	       SWFBUTTON_MOUSEUP);

  p = newSWFMovieClip();
  SWFMovieClip_add(p, b);
  SWFMovieClip_nextFrame(p);

  m = newSWFMovie();
  i = SWFMovie_add(m, p);
  SWFDisplayItem_setName(i, "test");
  SWFDisplayItem_moveTo(i, 1000, 1000);

  SWFMovie_save(m, "test.swf");

  exit(0);
}
