void AndroidApplication::callJNI()
{
	B_ASSERT(_context->activity->vm!=NULL);
	JavaVM* java = _context->activity->vm;
	JNIEnv *jni = NULL;

	java->AttachCurrentThread(&jni, NULL);


	B_ASSERT(jni!=NULL);
	jclass activityClass = jni->GetObjectClass(_context->activity->clazz);
	B_ASSERT(activityClass!=NULL);

	jmethodID methodID = (jni)->GetMethodID(activityClass, "getStorageDirectory", "()Ljava/lang/String;");
	B_ASSERT(methodID!=NULL);
	jstring string = reinterpret_cast<jstring>(jni->CallObjectMethod(_context->activity->clazz, methodID));

	jboolean isCopy = false;
	const char* dir = (jni)->GetStringUTFChars(string, &isCopy);
	_storageDirectory = dir;
	(jni)->ReleaseStringUTFChars(string, dir);
	Log::debug("DIRECTORY = %s", _storageDirectory.c_str());

	_context->activity->vm->DetachCurrentThread();
}
Example #2
0
//------------------------------------------------------------------
EHost::EHost()
: _running( false )
, _server( 0 )
{
	B_ASSERT( !gHost );

	B_NEW( "client", ESystem );

	gHost = this;
}
Example #3
0
//------------------------------------------------------------------
IGameObject* GGame::GetPlayer( uint idx )
{
	B_ASSERT( idx < 2 );
	return _players[ idx ];
}