unit uSprite;
interface
uses Windows, Classes, Messages, SysUtils, Graphics, uGlobal, SKAeroAPI;
const
ID_LEFT = -1;
ID_RIGHT = -2;
ID_FLARE = -3;
ID_BLUEFLARE = -4;
ID_FOCUS = -5;
SCALE_DEFAULT = 80;
SCALE_MAX = 105;
SCALE_STEP = 2;
LBOUND = ID_FOCUS;
type
TSprite =
class(TObject)
private
FX: Integer;
FY: Integer;
FW: Integer;
FH: Integer;
FScale: Integer;
FOpacity: Byte;
FShellTo:
string;
FIconPath: PWideChar;
FWorkDir: PWideChar;
FUseLabel:
string;
FCmdLine: PWideChar;
FShowCmd: LongInt;
FBitmap: HBitmap;
FVisible: Bool;
function getH: Integer;
function getW: Integer;
function getX: Integer;
function getY: Integer;
procedure setH(
const Value: Integer);
procedure setW(
const Value: Integer);
procedure setX(
const Value: Integer);
procedure setY(
const Value: Integer);
function GetBitmap: HBitmap;
function GetCmdLine: PWideChar;
function GetIconPath: PWideChar;
function GetOpacity: Byte;
function GetScale: Integer;
function GetShellTo:
string;
function GetShowCmd: LongInt;
function GetUseLabel:
string;
function GetVisible: Bool;
function GetWorkDir: PWideChar;
procedure SetBitmap(
const Value: HBitmap);
procedure SetCmdLine(
const Value: PWideChar);
procedure SetIconPath(
const Value: PWideChar);
procedure SetOpacity(
const Value: Byte);
procedure SetScale(
const Value: Integer);
procedure SetShellTo(
const Value:
string);
procedure SetShowCmd(
const Value: LongInt);
procedure SetUseLabel(
const Value:
string);
procedure SetVisible(
const Value: Bool);
procedure SetWorkDir(
const Value: PWideChar);
public
property x: Integer
read getX
write setX;
property y: Integer
read getY
write setY;
property w: Integer
read getW
write setW;
property h: Integer
read getH
write setH;
property Scale: Integer
read GetScale
write SetScale;
property Opacity: Byte
read GetOpacity
write SetOpacity;
property ShellTo:
string read GetShellTo
write SetShellTo;
property IconPath: PWideChar
read GetIconPath
write SetIconPath;
property WorkDir: PWideChar
read GetWorkDir
write SetWorkDir;
property UseLabel:
string read GetUseLabel
write SetUseLabel;
property CmdLine: PWideChar
read GetCmdLine
write SetCmdLine;
property ShowCmd: LongInt
read GetShowCmd
write SetShowCmd;
property Bitmap: HBitmap
read GetBitmap
write SetBitmap;
property Visible: Bool
read GetVisible
write SetVisible;
end;
TNegativeArray =
class(TObject)
private
Fdata :
array of TSprite;
FMaxValue: Integer;
function getData(
index : Integer) : TSprite;
inline;
procedure setData(
index : Integer; aData : TSprite);
inline;
function GetMaxValue: Integer;
procedure SetMaxValue(
const Value: Integer);
public
Constructor Create(aLenght : Integer);
Destructor Destroy;
override;
property Data[
index: Integer]: TSprite
read getData
write setData;
default;
property MaxValue: Integer
read GetMaxValue
write SetMaxValue;
end;
var
gs: TNegativeArray;
implementation
{ TSprite }
function TSprite.GetBitmap: HBitmap;
begin
Result := FBitmap;
end;
function TSprite.GetCmdLine: PWideChar;
begin
Result := FCmdLine;
end;
function TSprite.getH: Integer;
begin
Result := FH;
end;
function TSprite.GetIconPath: PWideChar;
begin
Result := FIconPath;
end;
function TSprite.GetOpacity: Byte;
begin
Result := FOpacity;
end;
function TSprite.GetScale: Integer;
begin
Result := FScale;
end;
function TSprite.GetShellTo:
string;
begin
Result := FShellTo;
end;
function TSprite.GetShowCmd: LongInt;
begin
Result := FShowCmd;
end;
function TSprite.GetUseLabel:
string;
begin
Result := FUseLabel;
end;
function TSprite.GetVisible: Bool;
begin
Result := FVisible;
end;
function TSprite.getW: Integer;
begin
Result := FW;
end;
function TSprite.GetWorkDir: PWideChar;
begin
Result := FWorkDir;
end;
function TSprite.getX: Integer;
begin
Result := FX;
end;
function TSprite.getY: Integer;
begin
Result := FY;
end;
procedure TSprite.SetBitmap(
const Value: HBitmap);
begin
FBitmap := Value;
end;
procedure TSprite.SetCmdLine(
const Value: PWideChar);
begin
FCmdLine := Value;
end;
procedure TSprite.setH(
const Value: Integer);
begin
FH := Value;
end;
procedure TSprite.SetIconPath(
const Value: PWideChar);
begin
FIconPath := Value;
end;
procedure TSprite.SetOpacity(
const Value: Byte);
begin
FOpacity := Value;
end;
procedure TSprite.SetScale(
const Value: Integer);
begin
FScale := Value;
end;
procedure TSprite.SetShellTo(
const Value:
string);
begin
FShellTo := Value;
end;
procedure TSprite.SetShowCmd(
const Value: LongInt);
begin
FShowCmd := Value;
end;
procedure TSprite.SetUseLabel(
const Value:
string);
begin
FUseLabel := Value;
end;
procedure TSprite.SetVisible(
const Value: Bool);
begin
FVisible := Value;
end;
procedure TSprite.setW(
const Value: Integer);
begin
FW := Value;
end;
procedure TSprite.SetWorkDir(
const Value: PWideChar);
begin
FWorkDir := Value;
end;
procedure TSprite.setX(
const Value: Integer);
begin
FX := Value;
end;
procedure TSprite.setY(
const Value: Integer);
begin
FY := Value;
end;
{ TNegativeArray }
constructor TNegativeArray.Create(aLenght: Integer);
begin
MaxValue := IIF(aLenght > 6, aLenght, 0);
SetLength(fdata, aLenght);
end;
destructor TNegativeArray.Destroy;
begin
inherited;
end;
function TNegativeArray.getData(
index: Integer): TSprite;
begin
assert(
index <= 0);
result := fData[abs(
index)];
end;
function TNegativeArray.GetMaxValue: Integer;
begin
Result := FMaxValue;
end;
procedure TNegativeArray.setData(
index: Integer; aData: TSprite);
begin
assert(
index <= 0);
fData[abs(
index)] := aData;
end;
procedure TNegativeArray.SetMaxValue(
const Value: Integer);
begin
FMaxValue := Value;
end;
end.