unit DriveControl;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Math,StdCtrls, ExtCtrls;
type
TDriveControl =
class(TGraphicControl)
private
{ Private declarations }
FForm : TForm;
//Plattformground
FGeschwindigkeit : integer;
//Geschwindigkeitswert
FLenkung : integer;
//Lenkwert
FMaxGE: integer;
//Maximale Geschwindigkeit
FMaxLE: integer;
//Maximaler Lenkeinschlag
Timer1: TTimer;
l,k,p,o: integer;
procedure SetForm(Form: TForm);
procedure SetGE(Wert: Integer);
procedure SetLE(Wert: Integer);
procedure SetMGE(Wert: Integer);
procedure SetMLE(Wert: Integer);
function GetForm: TForm;
function GetGE: Integer;
function GetLE: Integer;
function GetMGE: Integer;
function GetMLE: Integer;
procedure Timer1Timer(Sender: TObject);
protected
{ Protected declarations }
public
{ Public declarations }
constructor create(AOwner: TComponent);
Override;
{
procedure KeyDown(Key: Word);
procedure KeyUp(Key: Word); }
published
{ Published declarations }
property Form : TForm
Read GetForm
Write SetForm;
property Geschwindigkeit : Integer
Read GetGE
Write SetGE;
property Lenkung : Integer
Read GetLE
Write SetLE;
property MaxGE : Integer
Read GetMGE
Write SetMGE;
property MaxLE : Integer
Read GetMLE
Write SetMLE;
end;
procedure Register;
implementation
procedure TDriveControl.Timer1Timer(Sender: TObject);
begin
k := 0;
if (FGeschwindigkeit < FMaxGE)
then
begin
inc(FGeschwindigkeit);
end;
end;
constructor TDriveControl.create(AOwner: TComponent);
begin
inherited;
Timer1.Create(self);
Timer1.Interval := 500;
Timer1.Enabled := False;
l := 0;
k := 0;
p := 0;
o := 0;
end;
{
procedure TDriveControl.KeyDown(Key : Word);
begin
If (Key = VK_UP) then
begin
Timer2.Enabled := False;
Timer3.Enabled := False;
if (l = 0) then
begin
Timer1.Enabled := True;
end;
end;
end;
procedure TDriveControl.KeyUp(Key : Word);
begin
If (Key = VK_UP) then
begin
Timer1.Enabled := False;
if (l = 1) then l := 0 else l := 1;
Timer2.Enabled := True;
Timer3.Enabled := True;
end;
end;
}
procedure TDriveControl.SetForm(Form: TForm);
begin
FForm := Form;
end;
procedure TDriveControl.SetGE(Wert: Integer);
begin
FGeschwindigkeit := Wert;
end;
procedure TDriveControl.SetLE(Wert: Integer);
begin
FLenkung := Wert;
end;
procedure TDriveControl.SetMGE(Wert: Integer);
begin
FMaxGE := Wert;
end;
procedure TDriveControl.SetMLE(Wert: Integer);
begin
FMaxLE := Wert;
end;
function TDriveControl.GetForm: TForm;
begin
result := FForm;
end;
function TDriveControl.GetGE: Integer;
begin
result := FGeschwindigkeit;
end;
function TDriveControl.GetLE: Integer;
begin
result := FLenkung;
end;
function TDriveControl.GetMGE: Integer;
begin
result := FMaxGE;
end;
function TDriveControl.GetMLE: Integer;
begin
result := FMaxLE
end;
procedure Register;
begin
RegisterComponents('
Standard', [TDriveControl]);
end;
end.