<> <> <<>> DIRECTORY RobotDefs USING [RobotIndex, RobotPic], Rope USING [ROPE], ViewerOps USING [CreateViewer], ViewerClasses USING [Viewer, ViewerRec]; RobotArena: CEDAR DEFINITIONS IMPORTS ViewerOps ~ { OPEN V: ViewerClasses; RobotIndex: TYPE ~ RobotDefs.RobotIndex; --The number of robots on the screen at a time... RobotPic: TYPE ~ RobotDefs.RobotPic; Arena: TYPE = V.Viewer; --Arenas are just viewers that are suited for robot battle. arenaWidth, arenaHeight: INT ~ 100; RobotImage: TYPE ~ RECORD [ x, y: REAL _ (arenaWidth)/2, --Position of the robot hit: BOOLEAN _ FALSE, --TRUE => show robot under fire fire: BOOLEAN _ FALSE, --Is he firing right now? fireAngle: INT _ 0 --Angle if so. ]; Create: PROC [info: V.ViewerRec _ [], paint: BOOL _ TRUE] RETURNS [arena: Arena] = INLINE {RETURN[ViewerOps.CreateViewer[$Arena, info, paint]]}; <> SetRobot: PROC [self: V.Viewer, i: RobotIndex, image: RobotImage]; <> <<>> GetRobot: PROC [self: V.Viewer, i: RobotIndex] RETURNS [image: RobotImage]; <> <<>> SetRobotLocation: PROC [self: Arena, num: RobotIndex, x, y: REAL]; <> <<>> SetRobotPicture: PROC [self: Arena, num: RobotIndex, picture: RobotPic]; <> <<>> SetRobotColor: PROC [index: RobotIndex, color: Rope.ROPE]; <> }.