Creating new c++ class
by Justin Mosiman · in Torque Game Builder · 02/01/2009 (5:22 pm) · 4 replies
Hello,
I am trying to create a new class in C++ and call it from TorqueScript, but I'm having some problems.
First, my C++ .h/.cc file looks like:
ObjectManager.h
ObjectManager.cc:
I tried calling it in script with:
But I am getting the error:
Unable to instantiate non-conobject class ObjectManager.
I thought that if I had the IMPLEMENT/DECLARE macros that would fix it, but no luck.
What else do I have to do to create a new class?
Thanks,
Justin
I am trying to create a new class in C++ and call it from TorqueScript, but I'm having some problems.
First, my C++ .h/.cc file looks like:
ObjectManager.h
#ifndef _OBJECTMANAGER_H_
#define _OBJECTMANAGER_H_
#ifndef _CONSOLEOBJECT_H_
#include "console/consoleObject.h"
#endif
class ObjectManager : public ConsoleObject
{
public:
typedef ConsoleObject Parent;
ObjectManager();
DECLARE_CONOBJECT(ObjectManager);
};
#endifObjectManager.cc:
#include "console/console.h"
#include "game/objectManager.h"
IMPLEMENT_CONOBJECT(ObjectManager);
ObjectManager::ObjectManager(){
Con::errorf("ObjectManager");
}I tried calling it in script with:
$objectManager = new ObjectManager(){};But I am getting the error:
Unable to instantiate non-conobject class ObjectManager.
I thought that if I had the IMPLEMENT/DECLARE macros that would fix it, but no luck.
What else do I have to do to create a new class?
Thanks,
Justin
Associate Phillip O'Shea
Violent Tulip