accessing c++ methods from torquescript
by Sergio Seligmann Rodrigues · in General Discussion · 02/13/2011 (2:32 pm) · 2 replies
Hey
I create a class in c++, then I did a datablock with my custom class, but i cant get the methods from my custom class. I could assign my class with no errors through datablock but when I try to use any method that I create say unkown command. And I use DECLARE_CONOBJECT(MyClass)and IMPLEMENT_CO_NETOBJECT_V1(MyClass); Even using object.dump() didnt show the methods.
Tnx in advance
Here is the code.
I create a class in c++, then I did a datablock with my custom class, but i cant get the methods from my custom class. I could assign my class with no errors through datablock but when I try to use any method that I create say unkown command. And I use DECLARE_CONOBJECT(MyClass)and IMPLEMENT_CO_NETOBJECT_V1(MyClass); Even using object.dump() didnt show the methods.
Tnx in advance
Here is the code.
#ifndef NODE_H
#define NODE_H
#include "T3D/staticShape.h"
class Node : public StaticShapeData
{
typedef StaticShapeData Parent;
public:
Node(void);
Node(int x, int y);
~Node(void);
DECLARE_CONOBJECT(Node);
void setX(int x);
int getX();
void setY(int y);
int getY();
void setF(int f);
int getF();
void setG(int g);
int getG();
void setH(int h);
int getH();
void setUniqueN(int uniqueN);
int getUniqueN();
void setForward(Node *nodeToSet);
Node* getForward();
void setBackward(Node *nodeToSet);
Node* getBackward();
private:
int x;
int y;
int f;
int g;
int h;
int uniqueN;
Node *nodeForward;
Node *nodeBackward;
};
#endif#include "Node.h"
#include <iostream>
//IMPLEMENT_CO_NETOBJECT_V1(Node);
IMPLEMENT_CO_DATABLOCK_V1(Node);
Node::Node(void)
{
}
Node::Node(int x, int y)
{
this->x = x;
this->y = y;
this->f = 0;
this->g = 0;
this->h = 0;
this->uniqueN = 0;
this->nodeForward = new Node();
this->nodeBackward = new Node();
}
Node::~Node(void){ }
void Node::setX(int x){ this->x = x; }
int Node::getX(){ return this->x; }
void Node::setY(int y){ this->y = y; }
int Node::getY(){ return this->y; }
void Node::setF(int f){ this->f = f; }
int Node::getF(){ return this->f; }
void Node::setG(int g){ this->g = g; }
int Node::getG(){ return this->g; }
void Node::setH(int h){ this->h = h; }
int Node::getH(){ return this->h; }
void Node::setUniqueN(int uniqueN){ this->uniqueN = uniqueN; }
int Node::getUniqueN(){ return this->uniqueN; }
void Node::setForward(Node *nodeForward){ this->nodeForward = nodeForward; }
Node* Node::getForward(){ return this->nodeForward; }
void Node::setBackward(Node *nodeBackward){ this->nodeBackward = nodeBackward; }
Node* Node::getBackward(){ return this->nodeBackward; }About the author
#2
http://www.garagegames.com/community/forums/viewthread/123329
02/14/2011 (2:18 pm)
I ran into similar problems with Torque2D, it might still help you, specially the Visual Studio problems.http://www.garagegames.com/community/forums/viewthread/123329
Torque Owner Daniel Buckmaster
T3D Steering Committee