In this example C++ scripting support is embedded into the Scribble program. Scribble is a teaching example from standard Microsoft VisualStudio distributive. It lets to draw by mouse cursor in it's client window.
Let's try to write a simple script that will draw a star. We have to include the header file scribbleapi.h that contains BeginStroke(void) (begin uninterrupted line), AddPoint(unsigned x, unsigned y) (add a polygon apex) and EndStroke(void) (end uninterrupted line) functions declared. Star is a closed polyline. Accordingly, to draw it we need: - to begin uninterrupted line (BeginStroke()) - to point contour apexes (they are pointed in the iteration. The first point concurs with last one) - to finish uninterrupted line (EndStroke()). This example compiling gives the star.ir file.
To execute this script it's needed to choose corresponding menu item and show the file that contains the compiled script.