From AGI Wiki
Jump to: navigation, search

The draw command draws a screen object on the visual screen so it will be visible in subsequent interpreter cycles.


draw(obj oA);


A screen object will not appear on the graphics screen until the object is initialized, a view is assigned, the object is positioned, and finally the draw command is executed.

Once the object number is validated, AGI enables it for updating (if not already enabled) and then validates the object's position using the shuffling method. The object is then added to the screen, where it will be visible and updated in subsequent interpreter cycles.

If the draw command is used on an object that is already visible AGI ignores the command.

Use the erase command to erase a screen object from the screen.

Possible Errors

If the screen object is not properly initialized when the draw command is executed, AGI will try to access invalid memory while trying to position and draw the object, resulting in unpredictable results, including possibly crashing AGI.

When the draw command is executed, AGI first checks that the object's number is less than or equal to the max screen object number; if not, it raises trappable error #19.

If a view has not been assigned to the object, AGI will raise trappable error #20.


animate.obj(o5);       [ initialize first
load.view(8);          [ load a view for the object
set.view(o5, 8);       [ assign the  view to the object
position(o5, 72, 144); [ position the object on the screen]
draw(o2);              [ now draw it after all setup is done

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 35 (0x23 hex)

See Also