Moai SDK  2.0
MOAIGfxResource Class Reference
+ Inheritance diagram for MOAIGfxResource:

Function List

getAge
 
purge
 
setReloader
 
- Function List inherited from MOAIInstanceEventSource
getListener
 
setListener
 

Function Documentation

getAge

Returns the 'age' of the graphics resource. The age is the number of times MOAIRenderMgr has rendered a scene since the resource was last bound. It is part of the render count, not a timestamp. This may change to be time-based in future releases.


function getAge ( MOAIGfxResource self )

Parameters
MOAIGfxResourceself
Returns
number age
purge

Attempt to release the resource. Generally this is used when responding to a memory warning from the system. A resource will only be released if it is renewable (i.e. has a renew callback or contains all information needed to reload the resources on demand). Using soft release can save an app in extreme memory circumstances, but may trigger reloads of resources during runtime which can significantly degrade performance.


function purge ( MOAIGfxResource self [, number age ] )

Parameters
MOAIGfxResourceself
numberage Optional. Release only if the texture hasn't been used in X frames.
Returns
boolean released
setReloader

The reloaded is called prior to recreating the resource. It should in turn call the resources regular load or init methods.


function setReloader ( MOAIGfxResource self [, function reloader ] )

Parameters
MOAIGfxResourceself
functionreloader Optional.
Returns
nil