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

ActionMouse [Ming wrapper example]

This flash movie was created with the following program.
ActionMouse.cpp
#include "SWFMovie.h"

#include <sstream>

int cnt=0;

MovieClip createMovieClip(
     MovieClip_& m,      
     byte r, byte g, byte b,
     int x, int y, int w, int h
     ) {

  std::stringstream s;
  s<<"name_of_clip" << cnt++;

  MovieClip clip;
  Shape     shape;

  shape.FillStyle(r,g,b);
  shape.MoveTo(x,y);
  shape.Line( w, 0);
  shape.Line( 0, h);
  shape.Line(-w, 0);
  shape.Line( 0,-h);

  clip.Add(shape);
  clip.NextFrame();

  DisplayItem iClip = m.Add(clip);
  iClip.Name(s.str().c_str());

  return clip;
}

int main() {
  Movie movie ("ActionMouse.swf", 400, 400);

  MovieClip c_1;
  MovieClip c_2;
  MovieClip c_3;

  //                                           red  blu  grn    x    y    w    h
  //                                   (       ---------------------------------);
  // Blue objects: second level        (          ,    ,    ,    ,    ,    ,    );
  MovieClip c_1_1     = createMovieClip(c_1  ,   0, 250,   0,  10,  10,  90,  40);
  MovieClip c_1_2     = createMovieClip(c_1  ,   0, 225,   0,  40,  20,  80,  30);
  MovieClip c_2_1     = createMovieClip(c_2  ,   0, 200,   0,  10,  20,  20,  20);
  // Red objects: first level          (          ,    ,    ,    ,    ,    ,    );
            c_1       = createMovieClip(movie, 250,   0,   0,  10, 200,  70, 120);
            c_2       = createMovieClip(movie, 225,   0,   0,  60,  80, 120,  90);
            c_3       = createMovieClip(movie, 200,   0,   0, 300,  40,  50, 240);


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