Download SIMGRAPHICS II User's Manual

Transcript
Chapter 1. Introduction to SIMGRAPHICS
5. Ask the instances to customize their appearance by copying an object in the library:
ASK TruckImage TO LoadFromLibrary(GraphicLib,
"truck");
6. Add the instances to the window:
ASK window TO AddGraphic(TruckImage);
7. Draw either the window or object:
ASK window TO Draw;
1.3 A Simple Program
MAIN MODULE Example1;
{ This program gets a "truck" created in the editor and
displays it for 10 seconds. }
FROM OSMod IMPORT Delay;
FROM Graphic IMPORT GraphicLibObj;
FROM Window
IMPORT WindowObj;
FROM Animate IMPORT DynImageObj;
VAR
GraphicLib : GraphicLibObj;
window
: WindowObj;
truck
: DynImageObj;
BEGIN
NEW(window);
NEW(GraphicLib);
ASK GraphicLib TO ReadFromFile("graphics.sg2");
NEW(truck);
ASK truck
TO LoadFromLibrary(GraphicLib, "truck");
ASK window TO AddGraphic(truck);
ASK window TO Draw;
Delay(10);
END MODULE.
3