2 DEMO07 - Hardware scrolling
\r
3 Copyright (c) 1994 Alessandro Scotti
\r
8 (* Change this if scrolling seems jerky (this simple program does *)
\r
9 (* not handle vertical retrace/display very well) *)
\r
12 procedure Check( Cond: boolean; var Coord, DeltaC: integer; NewCoord, Sign: integer );
\r
14 if( Cond ) then begin
\r
16 DeltaC := Sign*(Random(3)+2);
\r
21 I, X, Y, DX, DY: integer;
\r
23 (* Initialize library and graphics mode *)
\r
25 mxSetMode( MX_320x200 );
\r
26 (* Set a 640x400 virtual screen *)
\r
27 mxSetVirtualScreen( 640, 400 );
\r
35 (* Main loop: draw lines, circles, points and rectangles in separate *)
\r
36 (* 320x200 windows, while smoothly panning virtual screen *)
\r
37 while( not KeyPressed ) do begin
\r
39 mxSetClipRegion( 0, 0, 320, 200 );
\r
40 for I:=1 to STEPS do
\r
41 mxPutPixel( Random(320), Random(200), Random(16) );
\r
43 mxSetClipRegion( 0, 200, 320, 200 );
\r
44 for I:=1 to STEPS do
\r
45 mxLine( Random(320), Random(200)+200, Random(320), Random(200)+200, Random(16), OP_SET );
\r
47 mxSetClipRegion( 320, 0, 320, 200 );
\r
48 for I:=1 to STEPS do
\r
49 mxCircle( Random(320)+320, Random(200), Random(100), Random(16) );
\r
51 mxSetClipRegion( 320, 200, 320, 200 );
\r
52 for I:=1 to STEPS do
\r
53 mxFillBox( Random(320)+320, Random(200)+200, Random(100)+1, Random(100)+1, Random(16), OP_SET );
\r
56 Check( X+320 >= 639, X, DX, 319, -1 );
\r
57 Check( X < 0, X, DX, 0, +1 );
\r
59 Check( Y+200 >= 399, Y, DY, 199, -1 );
\r
60 Check( Y < 0, Y, DY, 0, +1 );
\r
66 mxSetMode( MX_TEXT );
\r