1 2 %feature("director") btBulletWorldImporter; 3 %feature("nodirector") btBulletWorldImporter::createMultiSphereShape; 4 5 %{ 6 #include <BulletWorldImporter/btWorldImporter.h> 7 #include <BulletWorldImporter/btBulletWorldImporter.h> 8 %} 9 10 %template(btStringArray) btAlignedObjectArray<char*>; 11 12 %ignore btWorldImporter::getNameForPointer(const void* ptr); 13 %extend btWorldImporter { getNameForPointer(unsigned long cPtr)14 const char* getNameForPointer(unsigned long cPtr) { 15 return $self->getNameForPointer((void*)cPtr); 16 } 17 }; 18 19 %ignore btBulletWorldImporter::loadFileFromMemory(char *memoryBuffer, int len); 20 %extend btBulletWorldImporter { loadFileFromMemory(unsigned char * memoryBuffer,int len)21 bool loadFileFromMemory(unsigned char *memoryBuffer, int len) { 22 return $self->loadFileFromMemory((char *)memoryBuffer, len); 23 } 24 }; 25 26 %typemap(javacode) btBulletWorldImporter %{ 27 public boolean loadFile(final com.badlogic.gdx.files.FileHandle fileHandle) { 28 final int len = (int)fileHandle.length(); 29 if (len <= 0) 30 throw new com.badlogic.gdx.utils.GdxRuntimeException("Incorrect file specified"); 31 java.nio.ByteBuffer buff = com.badlogic.gdx.utils.BufferUtils.newUnsafeByteBuffer(len); 32 buff.put(fileHandle.readBytes()); 33 buff.position(0); 34 boolean result = loadFileFromMemory(buff, len); 35 com.badlogic.gdx.utils.BufferUtils.disposeUnsafeByteBuffer(buff); 36 return result; 37 } 38 %} 39 40 %include "BulletWorldImporter/btWorldImporter.h" 41 %include "BulletWorldImporter/btBulletWorldImporter.h" 42