I managed to figure out how to wrap things a bit now, so I've started my Havok wrapper, just for the heck of it.
(only got as far as initializing the base system, and I've only wrapped the constructors/methods required to get Havok running)
Would you mind sharing how you wrapped hkBaseSystem::init() so that you could specify the errorreport function in c#, if you did? Right now I just left it out. When I tried adding an hkErrorReportFunction (the typedef) as a parameter, it compiled fine, but init() no longer showed up in C#.
[EDIT]
I'm also trying to think of a good way to sort everything into namespaces. Right now it's all crammed into "Havok". I was thinking of using namespaces like the directory structure for the include files, but C++ doesn't seem to like
namespace Havok.Physics.Dynamics.World { }
so I'd need to do
namespace Havok {
namespace Physics {
namespace Dynamics {
...
right? And that would get annoying rather quickly. Any ideas?
[EDIT2]
Argh, perhaps this is slightly over my head. I'm trying to get hkpWorld / hkpWorldCinfo going now.
HavokWorldCinfo.h
namespace Havok
{
void HavokWorldCinfo::setSimulationType(Havok::HavokWorldCinfo::SimulationType type)
{
obj->m_simulationType = (hkpWorldCinfo::SimulationType)(int)type;
}
}
HavokWorldCinfo.cpp
namespace Havok
{
public ref class HavokWorldCinfo
{
internal:
hkpWorldCinfo* obj;
public:
enum class SimulationType
{
SIMULATION_TYPE_INVALID,
SIMULATION_TYPE_DISCRETE,
SIMULATION_TYPE_CONTINUOUS,
SIMULATION_TYPE_MULTITHREADED,
};
void setSimulationType(SimulationType type);
};
}
HavokWorld.h
namespace Havok
{
public ref class HavokWorld
{
internal:
hkpWorld* obj;
public:
HavokWorld(HavokWorldCinfo^ info);
};
}
HavokWorld.cpp
namespace Havok
{
HavokWorld::HavokWorld(HavokWorldCinfo^ info)
{
obj = new hkpWorld(info->obj);
}
}
In HavocWorld.cpp, I get
Error 1 error C2664: 'hkpWorld::hkpWorld(const hkpWorldCinfo &,unsigned int)' : cannot convert parameter 1 from 'hkpWorldCinfo *' to 'const hkpWorldCinfo &' c:\Users\Jeffrey\Documents\Visual Studio 2008\Projects\Havok\HavokWorld.cpp 8 Havok
But if I change hkpWorldCinfo* obj in HavokWorldCinfo.h to just hkpWorldCinfo in an attempt to fix it, I get
Error 1 error C4368: cannot define 'obj' as a member of managed 'Havok::HavokWorldCinfo': mixed types are not supported c:\users\jeffrey\documents\visual studio 2008\projects\havok\HavokWorldCinfo.h 12 Havok
I think I need to find a more in-depth course on C++/CLR