unit Unit5;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.ExtCtrls;
type
TForm5 =
class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form5: TForm5;
screenx: integer;
screeny: integer;
y,x: integer;
drop:
array[0..200]
of integer;
chars:
string;
fsizey,fsizex: integer;
colums,rows: integer;
neuerwert: integer;
implementation
{$R *.dfm}
procedure draw();
var
b1: TBitmap;
i: integer;
vertikal: integer;
begin
b1 := TBitmap.Create;
b1.SetSize(screenx,screeny);
b1.Canvas.Brush.Color:=clblack;
b1.Canvas.FillRect(Rect(0,0,screenx,screeny));
for i:= 0
to colums
do
begin
if (drop[i] < rows)
and (drop[i] > -1)
then
begin
form5.Canvas.TextOut(i * fsizex, drop[i] * fsizey, chars[random(length(chars))]);
neuerwert:= drop[i] + 1;
drop[i]:= neuerwert;
end
else
begin
drop[i]:=-1;
end;
if (drop[i] = -1)
then
begin
if random(40) = 1
then
begin
drop[i]:= 0
end;
end;
end;
form5.Canvas.Draw(0,0,b1,$15);
if y < rows
then y:= y + 1;
if y = rows
then y:= 0;
end;
procedure TForm5.FormCreate(Sender: TObject);
var
i: integer;
begin
form5.Width:= 1920;
form5.Height:= 1080;
screenx:= form5.Width;
screeny:= form5.Height;
form5.Canvas.Font.
Name := '
Segoe UI';
form5.Canvas.Font.Color := clAqua;
form5.Canvas.Font.Style := [];
form5.Canvas.Font.Height := 20;
form5.Canvas.Brush.Style:=bsClear;
fsizex:= 10;
// Vertikaler Abstand
fsizey:= 20;
// Horizontaler Abstand
colums:= screenx
div fsizex;
rows:= screeny
div fsizey;
chars:= '
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~!@#$%^&*()-_=+`[]{};:?/.,<>\\|';
y:=0;
for i:= 0
to colums
do
begin
drop[i]:= 0;
end;
end;
procedure TForm5.Timer1Timer(Sender: TObject);
begin
draw
end;
end.