{
**************************************
* Code by Marc von Garrel *
* (c)2009 Marc 'BullsEye' von Garrel *
* Vist me at: [url]www.m-v-g.de.ms[/url] *
**************************************
}
unit sek;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TfrmGame =
class(TForm)
edtZeit: TEdit;
Label1: TLabel;
btnStart: TButton;
btnClose: TButton;
edtZiel: TEdit;
Label2: TLabel;
Timer: TTimer;
Button1: TButton;
Label3: TLabel;
procedure btnCloseClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure btnStartClick(Sender: TObject);
procedure TimerTimer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
frmGame: TfrmGame;
zeit,
zaehler : Integer;
implementation
{$R *.dfm}
procedure TfrmGame.btnCloseClick(Sender: TObject);
begin
Timer.Enabled := false;
zeit := 0;
zaehler := 0;
btnStart.Caption := '
Start';
edtZiel.Text := IntToStr(zaehler);
// edtZiel.Show;
end;
procedure TfrmGame.FormCreate(Sender: TObject);
begin
frmGame.DoubleBuffered := true;
end;
procedure TfrmGame.btnStartClick(Sender: TObject);
begin
Zeit := StrToInt(edtZeit.Text);
btnStart.Caption := '
Stop';
IF (Timer.Enabled = false)
THEN
BEGIN
Timer.Enabled := true;
zaehler := 0;
zeit := 0;
edtZiel.Text := '
0';
btnStart.Caption := '
Stop';
END ELSE
BEGIN
Timer.Enabled := false;
edtZiel.Text := IntToStr(zaehler);
IF (zeit = zaehler)
THEN ShowMessage('
Gewonnen!');
IF (zeit > zaehler)
THEN ShowMessage('
Verloren! - Zu schnell!');
IF (zeit < zaehler)
THEN ShowMessage('
Verloren! - Zu langsam!');
btnStart.Caption := '
Start';
END;
end;
procedure TfrmGame.TimerTimer(Sender: TObject);
begin
zaehler := zaehler+1;
end;
procedure TfrmGame.Button1Click(Sender: TObject);
begin
close();
end;
end.