Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
0.8.3:inventory [2021/09/03 13:09] – [Visual Items] admin | 0.8.3:inventory [2021/09/03 13:11] (current) – [Visual Items] admin | ||
---|---|---|---|
Line 395: | Line 395: | ||
[...] | [...] | ||
+ | /// define callback event for assets loading | ||
GorillaInventory.OnLoadResource := DoOnInventoryLoadResource; | GorillaInventory.OnLoadResource := DoOnInventoryLoadResource; | ||
Line 406: | Line 407: | ||
LBmp : FMX.Graphics.TBitmap; | LBmp : FMX.Graphics.TBitmap; | ||
begin | begin | ||
+ | /// get your package previously created | ||
LPckg := GorillaAssetsManager1.GetPackage(' | LPckg := GorillaAssetsManager1.GetPackage(' | ||
if not Assigned(LPckg) then | if not Assigned(LPckg) then | ||
raise Exception.Create(' | raise Exception.Create(' | ||
| | ||
+ | /// try to find an asset by resource filename + extension | ||
LAsset := LPckg.FindAsset(AResource); | LAsset := LPckg.FindAsset(AResource); | ||
if not Assigned(LAsset) then | if not Assigned(LAsset) then | ||
raise Exception.CreateFmt(' | raise Exception.CreateFmt(' | ||
| | ||
+ | /// check if it really is a texture / image asset | ||
if not (LAsset is TGorillaTextureAsset) then | if not (LAsset is TGorillaTextureAsset) then | ||
raise Exception.CreateFmt(' | raise Exception.CreateFmt(' | ||
| | ||
+ | /// copy the image to inventory image (duplication!) | ||
LBmp := TGorillaTextureAsset(LAsset).GetBitmap(); | LBmp := TGorillaTextureAsset(LAsset).GetBitmap(); | ||
try | try |