Games Delphi

/// bir form açın ve içine bir tane timer koyun
unit saat;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure FormDblClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function modulal(x:Integer):Integer;
begin
while x < 0 do
begin
x := x + 360;
end;
Result := x;
end;
function kactane(x:Integer; y: Integer):Integer;
var
times: Integer;
begin
times := 0;
while x >= y do
begin
x := x - y;
times := times + 1;
end;
Result := times;
end;
procedure TForm1.FormDblClick(Sender: TObject);
begin
Halt;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
sn: Integer;
dk: Integer;
st: Integer;
x: String;
y: String;
z: String;
dg: Extended;
dg2: Extended;
dg3: Extended;
linex: Integer;
liney: Integer;
linex2: Integer;
liney2: Integer;
linex3: Integer;
liney3: Integer;
begin
x := TimeToStr(Time);
y := TimeToStr(Time);
z := TimeToStr(Time);
Delete(x, 1,6);
Delete(y, 1, 3);
Delete(y, 3, 3);
Delete(z, 3,6);
sn := StrToInt(x);
dk := StrToInt(y);
st := StrToInt(z);
dg := ((modulal((90 - (sn * 6))) * pi ) / 180);
dg2 := ((modulal((90 - (dk * 6))) * pi ) / 180);
dg3 := ((modulal((90 - (st * 30) - (kactane(dk, 6)*3) )) * pi ) / 180);
linex := 150 + Round(120 * cos(dg));
liney := 150 - Round(120 * sin(dg));
linex2 := 150 + Round(120 * cos(dg2));
liney2 := 150 - Round(120 * sin(dg2));
linex3 := 150 + Round(85 * cos(dg3));
liney3 := 150 - Round(85 * sin(dg3));
Form1.Refresh;
with Form1.Canvas do
begin
Brush.Style := bsClear;
Font.Color := clYellow;
Font.Size := 18;
Font.Style:=[fsbold];
Font.Name:='Verdana';
TextOut(100, 300,TimeToStr(Time));
Pen.Width := 1;
MoveTo(150,150);
Pen.Color := clRed;
LineTo(linex, liney);
MoveTo(150,150);
Pen.Width := 2;
Pen.Color := clBlack;
LineTo(linex2, liney2);
MoveTo(150,150);
Pen.Width := 3;
LineTo(linex3, liney3);
end;
end;
end.