Introduction
Script commands are the primary means of communication
between programs and the SilverScreen API. The ss_command
function, available in SilverC and C++, sends commands to the
engine for processing. In this section we will describe
how commands fit into the overall structure of SilverScreen and
the API.
A Command-Based System
SilverScreen is a fully command-based system.
Every activity, interactive or otherwise, is executed by means
of a command. Below is a schematic that shows the relationship
between the three systems that operate within interactive SilverScreen.
The commands that are passed from the Menu System to the Interactive
System are called icommands (interactive commands).
The commands between the Interactive System and the Execution
System are simply called commands. (The
word "command" is often used loosely to refer to either
a command or an icommand.)
Example
A user selects Draw Polygon from the menu.
This selection is translated by the Menu System to an icommand
and sent to the Interactive System. Here is the icommand:
icommand draw polygon common
When the Interactive System receives this
command, it prompts the user for a set of polygon points.
Assume that the user selects five points. Then the commands
sent to the Execution System might be as follows:
begin polygon
point 1,1,10
point 1,5,10
point 3,8,10
point 6,10,10
point 10,0,10
end
These commands will cause the Execution System
to draw a polygon on the screen and to include the polygon within
the drawing database.
Application Programs and Commands
SilverScreen is designed so that the Interactive
and Execution Systems are independent of the source of the commands
that they process. That is, these systems do not know whether
a command comes from an interactive user or from an application
program.
Using the ss_command function, a C++ or SilverC
application program can send the icommand
ss_command("icommand draw polygon common");
The Interactive System will respond to this
icommand exactly as if the icommand were sent from the Menu System.
That is, it will prompt the user for a set of points.
After the user has supplied the points, it will then send commands
to the Execution System to draw the polygon.
Application programs can also use ss_command
to send commands directly to the Execution System. The following
command will rotate an object about the y-axis.
ss_command(
"rotate object \\screw y%d", degrees );
The important point is this: The full power
of SilverScreen, both at the interactive level and the execution
level, is available to application programs through commands,
icommands, and the ss_command function.