
#include "ming.h"

int main()
{
  SWFShape s;
  SWFFont f;
  SWFMovie m;
  SWFDisplayItem i;

  Ming_init();
  Ming_setScale(1.0);

  s = newSWFShape();
  f = loadSWFFontFromFile(fopen("../common/test.fdb", "rb"));

  SWFShape_setRightFill(s, SWFShape_addSolidFill(s, 0xff, 0, 0, 0xff));
  SWFShape_setLine(s, 40, 0x7f, 0, 0, 0xff);
  SWFShape_drawGlyph(s, f, '!');
  SWFShape_movePen(s, SWFFont_getWidth(f, "!"), 0);

  SWFShape_setRightFill(s, SWFShape_addSolidFill(s, 0xff, 0x7f, 0, 0xff));
  SWFShape_setLine(s, 40, 0x7f, 0x3f, 0, 0xff);
  SWFShape_drawGlyph(s, f, '#');
  SWFShape_movePen(s, SWFFont_getWidth(f, "#"), 0);

  SWFShape_setRightFill(s, SWFShape_addSolidFill(s, 0xff, 0xff, 0, 0xff));
  SWFShape_setLine(s, 40, 0x7f, 0x7f, 0, 0xff);
  SWFShape_drawGlyph(s, f, '%');
  SWFShape_movePen(s, SWFFont_getWidth(f, "%"), 0);

  SWFShape_setRightFill(s, SWFShape_addSolidFill(s, 0, 0xff, 0, 0xff));
  SWFShape_setLine(s, 40, 0, 0x7f, 0, 0xff);
  SWFShape_drawGlyph(s, f, '*');
  SWFShape_movePen(s, SWFFont_getWidth(f, "*"), 0);

  SWFShape_setRightFill(s, SWFShape_addSolidFill(s, 0, 0, 0xff, 0xff));
  SWFShape_setLine(s, 40, 0, 0, 0x7f, 0xff);
  SWFShape_drawGlyph(s, f, '@');

  m = newSWFMovie();
  SWFMovie_setDimension(m, 3000,2000);
  SWFMovie_setRate(m, 12.0);

  i = SWFMovie_add(m, s);
  SWFDisplayItem_moveTo(i, 1500-SWFFont_getWidth(f, "!#%*@")/2.0, 1000+SWFFont_getAscent(f)/2.0);

  SWFMovie_save(m, "test.swf");

  exit(0);
}
