procedure CreateVUSprites(WinHandle: HWND; X, Y: Integer; SpritePath: string);
var
HBmp: HBITMAP;
ImgW, ImgH: Cardinal;
X1, Y1: Integer;
IntI: Integer;
bmW, bmH: Cardinal;
VuHeight, VUWidth: Integer;
VULeftX, VULeftY: Integer;
VURightX, VURightY: Integer;
DotTop, DotWidth: Integer;
begin
VuHeight := 0;
VuWidth := 0;
DotTop := 0;
DotWidth := 0;
if gSprVU.GD_GetObjectBitmap(ID_LAYER) = 0 then
begin
hBmp := gSprVU.GI_CreateBitmapFromFile(PWideChar(SpritePath + 'Layer.png'), ImgW, ImgH);
if hBmp <> 0 then
begin
// Layer
gSprVU.GD_DrawBitmapToCtrl(WinHandle, X, Y, hBmp, gSprVU.GD_ColorARGB(255, 0), ID_LAYER,
GS_VISIBLE);
gSprVU.GD_SetObjectLinked(ID_LAYER, ID_LAYER);
gSprVU.GD_SetObjectLocked(ID_LAYER, true);
hBmp := gSprVU.GI_CreateBitmapFromFile(PWideChar(SpritePath + 'TopLight.png'), ImgW, ImgH);
X1 := X + 110;
Y1 := Y + 28;
for IntI := 0 to 3 do
begin
gSprVU.GD_DrawBitmapToCtrl(WinHandle, X1, Y1, hBmp, gSprVU.GD_ColorARGB(255, 0),
ID_TOPLIGHT + IntI, GS_HIDDEN);
gSprVU.GD_SetObjectLinked(ID_TOPLIGHT + IntI, ID_LAYER);
case IntI of
0:
X1 := X1 + 240;
1:
X1 := X1 + 110;
2:
X1 := X1 + 240;
end;
end;
// ************** VUMeter Left
VULeftX := X + 64;
VULeftY := Y + 32;
hBmp := gSprVU.GI_CreateBitmapFromFile(PWideChar(SpritePath + 'BVU.png'), ImgW, ImgH);
if hBmp <> 0 then
begin
gSprVU.GD_DrawBitmapToCtrl(WinHandle, VULeftX, VULeftY, hBmp, gSprVU.GD_ColorARGB(255, 0),
ID_VULEFT, GS_VISIBLE);
gSprVU.GD_SetObjectLinked(ID_VULEFT, ID_VULEFT);
gSprVU.GD_SetObjectLocked(ID_VULEFT, true);
VuHeight := ImgH;
VuWidth := ImgW;
end;
// LeftPendel
hBmp := gSprVU.GI_CreateBitmapFromFile(PWideChar(SpritePath + 'Pendel.png'), ImgW, ImgH);
if hBmp <> 0 then
begin
gSprVU.GD_DrawBitmapToCtrl(WinHandle, VULeftX + (VuWidth div 2) - 10, VULeftY + 39, hBmp,
gSprVU.GD_ColorARGB(255, 0), ID_PENDELLEFT, GS_VISIBLE);
gSprVU.GD_SetObjectLinked(ID_PENDELLEFT, ID_VULEFT);
gSprVU.GD_SetObjectLocked(ID_PENDELLEFT, true);
gSprVU.GD_SetObjectAngle(ID_PENDELLEFT, 310);
end;
// Dot
hBmp := gSprVU.GI_CreateBitmapFromFile(PWideChar(SpritePath + 'Dot.png'), ImgW, ImgH);
if hBmp <> 0 then
begin
DotTop := (VULeftY + VuHeight) - Integer(ImgH);
DotWidth := ImgW;
gSprVU.GD_DrawBitmapToCtrl(WinHandle, VULeftX + (VuWidth - DotWidth + 1) div 2, DotTop, hBmp,
gSprVU.GD_ColorARGB(255, 0), ID_DOTLEFT, GS_VISIBLE);
gSprVU.GD_SetObjectLinked(ID_DOTLEFT, ID_VULEFT);
gSprVU.GD_SetObjectLocked(ID_DOTLEFT, true);
end;
// VULeftLight
hBmp := gSprVU.GI_CreateBitmapFromFile(PWideChar(SpritePath + 'BLight.png'), ImgW, ImgH);
if hBmp <> 0 then
begin
gSprVU.GD_DrawBitmapToCtrl(WinHandle, VULeftX, VULeftY, hBmp, gSprVU.GD_ColorARGB(255, 0),
ID_LIGHTLEFT, GS_HIDDEN);
gSprVU.GD_SetObjectLinked(ID_LIGHTLEFT, ID_VULEFT);
gSprVU.GD_SetObjectLocked(ID_LIGHTLEFT, true);
end;
// ************** VU Meter Right
VURightX := VULeftX + Integer(ImgW);
VURightY := VULeftY;
// same Bitmap as VULeft so to clone
gSprVU.GD_CloneObject(ID_VULEFT, ID_VURIGHT, VURightX, VURightY);
// RightPendel
// same Bitmap as LeftPendel so to clone
gSprVU.GD_CloneObject(ID_PENDELLEFT, ID_PENDELRIGHT, VURightX + (VuWidth div 2) - 10, VURightY + 39);
gSprVU.GD_SetObjectAngle(ID_PENDELRIGHT, 310);
// Dot
// same Bitmap as DotLeft so to clone
gSprVU.GD_CloneObject(ID_DOTLEFT, ID_DOTRIGHT, VURightX + (VuWidth - DotWidth + 1) div 2, DotTop);
// VURightLight
// same Bitmap as VULeftLight so to clone
gSprVU.GD_CloneObject(ID_LIGHTLEFT, ID_LIGHTRIGHT, VURightX, VURightY);
hBmp := gSprVU.GI_CreateBitmapFromFile(PWideChar(SpriteResPath + 'hSwitch.png'), bmW, bmH);
if (hBmp <> 0) then
begin
gSprVU.GD_DrawBitmapToCtrl(HSprVU, 740, 267, hBmp, OPAQUEIMAGE, ID_POWER,
GS_VISIBLE);
gSprVU.GD_SetObjectFrameCount(ID_POWER, 2);
// Frame 2 Power OFF
gSprVU.GD_SetObjectFrameToUse(ID_POWER, 2);
gSprVU.GD_SetObjectLocked(ID_POWER, true);
end;
// Left Anchor
gSprVU.GD_SetObjectAnchorMode(ID_VULEFT, ANCHOR_CENTER);
gSprVU.GD_SetObjectAnchorMode(ID_PENDELLEFT, ANCHOR_CENTER);
gSprVU.GD_SetObjectAnchorMode(ID_LIGHTLEFT, ANCHOR_CENTER);
gSprVU.GD_SetObjectAnchorMode(ID_DOTLEFT, ANCHOR_CENTER);
// Right Anchor
gSprVU.GD_SetObjectAnchorMode(ID_VURIGHT, ANCHOR_CENTER);
gSprVU.GD_SetObjectAnchorMode(ID_PENDELRIGHT, ANCHOR_CENTER);
gSprVU.GD_SetObjectAnchorMode(ID_LIGHTRIGHT, ANCHOR_CENTER);
gSprVU.GD_SetObjectAnchorMode(ID_DOTRIGHT, ANCHOR_CENTER);
end;
end;
end;