---++!! !CommonCtrl.OneTimeAsset %TOC{title="Contents:"}% %STARTINCLUDE% ---++ 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. %T% __Sample Code__ <verbatim> 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") </verbatim> ---+++ Member Functions ---++++ !OneTimeAsset.Add <verbatim> define a new control in the common control libary local OneTimeAsset = { registry = {}, error = "", print_error = commonlib.error, }</verbatim> CommonCtrl.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__ <verbatim>function OneTimeAsset.Add(ItemName, assetFileName)</verbatim> __parameters__ | *ItemName* | | | *assetFileName* | | ---++++ !OneTimeAsset.GetFileName this will remove the paramters after the semicolon e.g. OneTimeAsset.GetFileName("aaa.bmp;0 0 11 11") == "aaa.bmp" __syntax__ <verbatim>function OneTimeAsset.GetFileName(assetFileName)</verbatim> __parameters__ | *assetFileName* | | ---++++ !OneTimeAsset.Unload call this function to unload the given asset __syntax__ <verbatim>function OneTimeAsset.Unload(assetFileName)</verbatim> __parameters__ | *assetFileName* | | %STOPINCLUDE%
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2008-02-29
-
LiXizhi
Home
Site map
CCWeb web
HaqiTeen web
Main web
ParaEngine web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
导航页WebTopMenu
Preferences
开发指南
Getting Started
ParacraftSDK
NPL
MCML
NPL Reference Manual
美术Mod
Account
Log In
English
简体中文
簡體中文
E
dit
A
ttach
Copyright © 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