René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Counter [Ming wrapper example]

This example demonstrates how a series of frames can be made into a counter.
This flash movie was created with the following program.
Counter.cpp
#include "SWFMovie.h"

#include <sstream>
#include <iomanip>

int main() {
  Movie  movie("Counter.swf", 200, 100, 100);

  int font_size=20;

  Font  verdana("Verdana.fdb");

  for (int sec=0;sec<2; sec++) {
    for (int sec_100=0; sec_100<100; sec_100++) {
      std::stringstream str;
      str << std::setw(2) << std::setfill('0') << sec << ":" << std::setw(2) << std::setfill('0') << sec_100;

      float width=verdana.Width(str.str(), font_size);

      Text  tm(verdana, font_size, 175-width, 50, str.str(), 127, 100, 200);
      DisplayItem  item=movie.Add(tm);
      movie.NextFrame();
      movie.Remove(item);
    }
  }

  return 0;
}
This is one of a series of examples that demonstrates the C++ ming wrapper classes. Other examples can be found here.