home *** CD-ROM | disk | FTP | other *** search
- program List10_7; { Listing 10-7 }
-
- uses Graph, Mouse, Crt, RobotSeg, Robot_B;
- var
- Hand,Arm : RobotArm2;
- P0 : Point;
-
- x, y : integer;
-
- GraphDriver : integer;
- GraphMode : integer;
- ErrorCode : integer;
- GlobalAnchorX,
- GlobalAnchorY,
- ArmLength,
- HandLength : integer;
-
- begin
- GraphDriver := Detect;
- InitGraph(GraphDriver, GraphMode, 'E:\TP');
- ErrorCode := GraphResult;
- if ErrorCode <> grOK then
- Writeln('Graphics error');
-
- GlobalAnchorX := Round(GetMaxX/3);
- GlobalAnchorY := Round(GetMaxY/2);
- ArmLength := Round(GetMaxY/2.5);
- HandLength := Round(GetMaxY/2.7);
-
- Graph.SetColor(white);
- SetTextStyle( DefaultFont, HorizDir, 2);
- OutTextXY( Round(GetMaxX/1.5), Round(GetMaxY*4/5), 'Robot ''B''' );
- Arm.Init( GlobalAnchorX, GlobalAnchorY,
- ArmLength, HandLength,
- 0, false, true, @Hand);
- P0.Init( 0,0);
- if MouseInit = true then
- ;
- MouseShow;
- repeat
- repeat
- until MouseLPressed or KeyPressed;
- if not KeyPressed then
- begin
- P0.Hide;
- repeat
- MouseCoords( x, y );
- until MouseLReleased;
- MouseHide;
- P0.Init( x, y );
- P0.Show;
- Arm.MoveTo( P0, true );
- P0.Show;
- MouseShow;
- end;
- until KeyPressed;
- end.