~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/extra/ncurses/firework.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
}
 
3
program firework;
 
4
uses
 
5
  ncurses;
 
6
 
 
7
CONST
 
8
  my_bg : LONGINT = COLOR_BLACK;
 
9
 
 
10
Procedure showit;
 
11
begin
 
12
  refresh;
 
13
  napms(120);
 
14
end;
 
15
 
 
16
Function get_colour(Var bold : chtype) : longint;
 
17
Var
 
18
  attr : longint;
 
19
begin
 
20
  attr:=random(16) + 1;
 
21
  bold:=A_NORMAL;
 
22
  if (attr > 8) then
 
23
   begin
 
24
     bold:=A_BOLD;
 
25
     attr:=attr and 7;
 
26
   end;
 
27
  get_colour:=attr;
 
28
end;
 
29
 
 
30
 
 
31
Procedure explode(Row,Col : longint);
 
32
var
 
33
  Bold : chtype;
 
34
begin
 
35
  ncurses.erase;
 
36
  mvaddstr(row,col,'-');
 
37
  showit;
 
38
 
 
39
  init_pair(1,get_colour(bold),my_bg);
 
40
  attrset(COLOR_PAIR(1) or bold);
 
41
  mvaddstr(row-1,col-1,' - ');
 
42
  mvaddstr(row,col-1,'-+-');
 
43
  mvaddstr(row+1,col-1,' - ');
 
44
  showit;
 
45
 
 
46
  init_pair(1,get_colour(bold),my_bg);
 
47
  attrset(COLOR_PAIR(1) or bold);
 
48
  mvaddstr(row-2,col-2,' --- ');
 
49
  mvaddstr(row-1,col-2,'-+++-');
 
50
  mvaddstr(row,  col-2,'-+#+-');
 
51
  mvaddstr(row+1,col-2,'-+++-');
 
52
  mvaddstr(row+2,col-2,' --- ');
 
53
  showit;
 
54
 
 
55
 
 
56
  init_pair(1,get_colour(bold),my_bg);
 
57
  attrset(COLOR_PAIR(1) or bold);
 
58
  mvaddstr(row-2,col-2,' +++ ');
 
59
  mvaddstr(row-1,col-2,'++#++');
 
60
  mvaddstr(row,  col-2,'+# #+');
 
61
  mvaddstr(row+1,col-2,'++#++');
 
62
  mvaddstr(row+2,col-2,' +++ ');
 
63
  showit;
 
64
 
 
65
  init_pair(1,get_colour(bold),my_bg);
 
66
  attrset(COLOR_PAIR(1) or bold);
 
67
  mvaddstr(row-2,col-2,'  #  ');
 
68
  mvaddstr(row-1,col-2,'## ##');
 
69
  mvaddstr(row,  col-2,'#   #');
 
70
  mvaddstr(row+1,col-2,'## ##');
 
71
  mvaddstr(row+2,col-2,'  #  ');
 
72
  showit;
 
73
 
 
74
  init_pair(1,get_colour(bold),my_bg);
 
75
  attrset(COLOR_PAIR(1) or bold);
 
76
  mvaddstr(row-2,col-2,' # # ');
 
77
  mvaddstr(row-1,col-2,'#   #');
 
78
  mvaddstr(row,  col-2,'     ');
 
79
  mvaddstr(row+1,col-2,'#   #');
 
80
  mvaddstr(row+2,col-2,' # # ');
 
81
  showit;
 
82
end;
 
83
 
 
84
Var
 
85
  startp,endp,row,diff,flag : longint;
 
86
  direction : boolean;
 
87
begin
 
88
  flag:=0;
 
89
  initscr;
 
90
  if (has_colors<>0) then
 
91
   start_color;
 
92
  curs_set(0);
 
93
  randomize;
 
94
  cbreak;
 
95
  While true do
 
96
   begin
 
97
     repeat
 
98
       startp:=random (COLS -3);
 
99
       endp:=random (COLS - 3);
 
100
       If startp < 2 then
 
101
        startp:=2;
 
102
       If endp <2  then
 
103
        endp:=2;
 
104
       direction:=startp > endp ;
 
105
       diff:=abs(startp-endp);
 
106
     until (diff>2) and (diff<(LINES-2));
 
107
     attrset(A_NORMAL);
 
108
     for row:=0 to diff do
 
109
      begin;
 
110
        If direction then
 
111
         mvaddstr(LINES - row,startp + row ,'/')
 
112
        else
 
113
         mvaddstr(LINES - row,startp - row ,'\');
 
114
        inc(flag);
 
115
        if flag<>0 then
 
116
         begin
 
117
           showit;
 
118
           erase;
 
119
           flag:=0;
 
120
         end;
 
121
      end;
 
122
     inc(flag);
 
123
     if (flag<>0) then
 
124
      begin
 
125
        showit;
 
126
        flag:=0;
 
127
      end;
 
128
     randomize;
 
129
     If Direction then
 
130
      explode(LINES-row,startp+diff)
 
131
     Else
 
132
      explode(LINES-row,startp-diff);
 
133
     erase;
 
134
     showit;
 
135
   end;
 
136
end.