Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
0.8.3:inventory [2021/09/03 13:09] – [Visual Items] admin0.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('InMemory');   LPckg := GorillaAssetsManager1.GetPackage('InMemory');
   if not Assigned(LPckg) then   if not Assigned(LPckg) then
     raise Exception.Create('package "InMemory" not found');     raise Exception.Create('package "InMemory" not found');
          
 +  /// 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('asset "%s" not found', [AResource]);     raise Exception.CreateFmt('asset "%s" not found', [AResource]);
          
 +  /// check if it really is a texture / image asset
   if not (LAsset is TGorillaTextureAsset) then   if not (LAsset is TGorillaTextureAsset) then
     raise Exception.CreateFmt('asset "%s" not a valid texture asset', [AResource]);     raise Exception.CreateFmt('asset "%s" not a valid texture asset', [AResource]);
          
 +  /// copy the image to inventory image (duplication!)
   LBmp := TGorillaTextureAsset(LAsset).GetBitmap();   LBmp := TGorillaTextureAsset(LAsset).GetBitmap();
   try   try