CommonCtrl.OneTimeAsset

for managing (texture) asset that is mostly used only once during the application, such as game front page, on_load movie, etc.

Title for managing (texture) asset that is mostly used only once during the application, such as game front page, on_load movie, etc.
Author(s) LiXizhi
Date 2007/4/26
File script/ide/OneTimeAsset.lua

Description

for managing asset that is mostly used only once during the application, such as game front page, on_load movie, etc.

TIP Sample Code

NPL.load("(gl)script/ide/OneTimeAsset.lua");
CommonCtrl.OneTimeAsset.Add("Logo", "page1.bmp")
...
CommonCtrl.OneTimeAsset.Add("Logo", "page2.bmp")
...
CommonCtrl.OneTimeAsset.Add("Logo", nil)
or one can use CommonCtrl.OneTimeAsset.Unload("page2.bmp;0 0 100 100")

Member Functions

OneTimeAsset.Add

 define a new control in the common control libary
local OneTimeAsset = {
   registry = {}, 
   error = "",
   print_error = commonlib.error,  
}
OneTimeAsset = OneTimeAsset;

Only one item is loaded at a time. So if we add multiple asset files to the same item name, the previous ones will be unloaded if they are not identical.

  • param ItemName :
  • param assetFileName :

syntax

function OneTimeAsset.Add(ItemName, assetFileName)

parameters

ItemName  
assetFileName  

OneTimeAsset.GetFileName

this will remove the paramters after the semicolon e.g. GetFileName("aaa.bmp;0 0 11 11") == "aaa.bmp"

syntax

function OneTimeAsset.GetFileName(assetFileName)

parameters

assetFileName  

OneTimeAsset.Unload

call this function to unload the given asset

syntax

function OneTimeAsset.Unload(assetFileName)

parameters

assetFileName  
Topic revision: r1 - 2008-02-29 - LiXizhi
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback