Terence Tan
unread,May 22, 2011, 7:24:29 AM5/22/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to The Render Engine
I've been trying to get consts to work like in some of the classes in
the engine but I keep get NaN or undefined for the consts I define:
Tile = function() {
return R.engine.PooledObject.extend(/** @scope Tile.prototype */{
sourceRect: null,
tileInfo: null,
attribute: null,
constructor: function(sourceRect,tileInfo,attribute)
{
this.sourceRect = sourceRect;
this.tileInfo = tileInfo;
this.attribute = attribute;
},
getClassName: function() {
return "Tile";
},
TILE_WIDTH: 16,
TILE_HEIGHT: 16
});
};
Here is a sample of a class. Now I'm not a javascript guru so bear
with me. I tried using Tile.TILE_WIDTH both in the class definition
and in other classes and I always get a undefined. I notice however in
the engine scripts this is being done alot:
} else if (sMap.s == R.resources.types.Tile.ALL_TRANSPARENT)
{
Now I should probably rename my class to be something that won't
pollute the global namespace but besides that...how would you do a
static consts attached to a class definition.