File: testvid2.pas

package info (click to toggle)
fpc 0.99.13-19991013-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 23,104 kB
  • ctags: 9,760
  • sloc: pascal: 253,711; ansic: 5,236; makefile: 3,855; yacc: 2,016; lex: 707; asm: 526; xml: 443; sh: 200; perl: 87; sed: 21; csh: 12; cpp: 1
file content (50 lines) | stat: -rw-r--r-- 905 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
uses
  Common, Video;

var
  I, J: CPUInt;
  Direction: CPUWord;

begin
  Randomize;
  InitVideo;
  I := 1; J := 1;
  Direction := Random(8);
  repeat
    VideoBuf^[I+J*ScreenWidth] := $0720;
    case Direction of
      0: Dec(J);
      1: Inc(I);
      2: Inc(J);
      3: Dec(I);
      4:
        begin
          Inc(I);
          Dec(J);
        end;
      5:
        begin
          Inc(I);
          Inc(J);
        end;
      6:
        begin
          Dec(I);
          Inc(J);
        end;
      7:
        begin
          Dec(I);
          Dec(J);
        end;
    end;
    if (I < 0) then I := 0;
    if (J < 0) then J := 0;
    if (I >= ScreenWidth) then I := ScreenWidth-1;
    if (J >= ScreenHeight) then J := ScreenHeight-1;
    VideoBuf^[I+J*ScreenWidth] := $1F2A;
    if Random(100) < 30 then Direction := Random(8);
    UpdateScreen(False);
  until False; {KeyPressed;}
  DoneVideo;
end.