Game Development Community

Namespaces for Objects

by Till Hoffmann · in Torque Game Engine · 11/14/2005 (9:24 am) · 3 replies

Hello,

I've got another question:

You can implement new functions for datablocks by using the className field.

Is there any way to do this for objects (and not their datablocks).

#1
11/14/2005 (9:57 am)
Function shapebase::func()

but this function gets implemented for all members of shapebase.

I also recall seeing someone using the classname attribute when instantiating an object using "new". I'm not sure if that's legal, but if it is then maybe you could use that for object namespace functions.
#2
11/14/2005 (10:12 am)
Well, i used the following code:

function CInventoryGuiItem::adjustPosition(%this)
{
...
}

%myObj = new GuiBitmapCtrl
{
    classname = "CInventoryGuiItem";
};

But if I call %myObj.adjustPosition() the function is not found.
#3
11/14/2005 (10:52 am)
Yeah i didnt really think that would work. without modifying the engine, Im pretty sure only datablocks can have namespace functions.

what is it you are attempting to do? if you only need to object specific functionality for guis theres a few less-elegant ways to realize this.