这篇教程C++ AAssetManager_fromJava函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AAssetManager_fromJava函数的典型用法代码示例。如果您正苦于以下问题:C++ AAssetManager_fromJava函数的具体用法?C++ AAssetManager_fromJava怎么用?C++ AAssetManager_fromJava使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AAssetManager_fromJava函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Java_org_gearvrf_NativeImporter_readFileFromAssetsJNIEXPORT jlong JNICALLJava_org_gearvrf_NativeImporter_readFileFromAssets(JNIEnv * env, jobject obj, jobject asset_manager, jstring filename) { const char* native_string = env->GetStringUTFChars(filename, 0); AAssetManager* mgr = AAssetManager_fromJava(env, asset_manager); AAsset* asset = AAssetManager_open(mgr, native_string, AASSET_MODE_UNKNOWN); if (NULL == asset) { LOGE("_ASSET_NOT_FOUND_"); return JNI_FALSE; } long size = AAsset_getLength(asset); char* buffer = (char*) malloc(sizeof(char) * size); AAsset_read(asset, buffer, size); AssimpImporter* assimp_scene = Importer::readFileFromAssets( buffer, size); AAsset_close(asset); free(buffer); env->ReleaseStringUTFChars(filename, native_string); return reinterpret_cast<jlong>(assimp_scene);}
开发者ID:Bonch90,项目名称:GearVRf,代码行数:25,
示例2: EnginePreparestatic jboolean EnginePrepare(JNIEnv* env, jclass clzz, jobject assetsMgr/*AAssetManager*/, jstring filesRoot, jobjectArray plugins /*String[]*/){ AAssetManager* mgr = AAssetManager_fromJava(env, assetsMgr); int count = env->GetArrayLength(plugins); vector<string> _plugins; for (int i = 0; i < count; i++ ) { jstring ck_plugin = (jstring)env->GetObjectArrayElement(plugins, i); string _plgin; GET_CPPSTR_FROM_JSTR(env, ck_plugin, _plgin); _plugins.push_back(_plgin); } string filesroot_str; GET_CPPSTR_FROM_JSTR(env, filesRoot, filesroot_str); try { Vm::android_init(mgr, filesroot_str.c_str(), _plugins); return true; } catch( const vedit::Exception& e ) { gHook.last_error = "engine prepare failed. cause:"; gHook.last_error += e.what(); return false; }}
开发者ID:amongll,项目名称:AVFX,代码行数:25,
示例3: Java_co_theengine_loomdemo_LoomDemo_nativeSetPaths void Java_co_theengine_loomdemo_LoomDemo_nativeSetPaths(JNIEnv* env, jobject thiz, jstring apkPath, jobject am) { const char *str = env->GetStringUTFChars(apkPath, NULL); //cocos2d::CCFileUtils::sharedFileUtils()->setResourcePath(str); env->ReleaseStringUTFChars(apkPath, str); loom_setAssetManager(AAssetManager_fromJava(env, am)); }
开发者ID:RichardRanft,项目名称:LoomSDK,代码行数:7,
示例4: Java_org_linaro_glmark2_native_getSceneInfojobjectArrayJava_org_linaro_glmark2_native_getSceneInfo(JNIEnv* env, jclass clazz, jobject asset_manager){ static_cast<void>(clazz); Util::android_set_asset_manager(AAssetManager_fromJava(env, asset_manager)); std::vector<Scene*> scenes; DummyCanvas canvas; std::vector<jobject> si_vector; create_and_add_scenes(scenes, canvas); /* Create SceneInfo instances for all the scenes */ for (std::vector<Scene*>::const_iterator iter = scenes.begin(); iter != scenes.end(); iter++) { jobject si = scene_info_from_scene(env, **iter); si_vector.push_back(si); } /* Create a SceneInfo[] array */ jclass si_cls = env->FindClass("org/linaro/glmark2/SceneInfo"); jobjectArray si_array = env->NewObjectArray(si_vector.size(), si_cls, 0); /* Populate the SceneInfo[] array */ for (size_t i = 0; i < si_vector.size(); i++) env->SetObjectArrayElement(si_array, i, si_vector[i]); Util::dispose_pointer_vector(scenes); return si_array;}
开发者ID:rafalmiel,项目名称:glmark2-wl,代码行数:35,
示例5: setupJniEnvvoid setupJniEnv(JNIEnv* _jniEnv, jobject _tangramInstance, jobject _assetManager) { _jniEnv->GetJavaVM(&jvm); JNIEnv* jniEnv = _jniEnv; jniRenderThreadEnv = _jniEnv; tangramInstance = jniEnv->NewGlobalRef(_tangramInstance); jclass tangramClass = jniEnv->FindClass("com/mapzen/tangram/MapController"); startUrlRequestMID = jniEnv->GetMethodID(tangramClass, "startUrlRequest", "(Ljava/lang/String;J)Z"); cancelUrlRequestMID = jniEnv->GetMethodID(tangramClass, "cancelUrlRequest", "(Ljava/lang/String;)V"); getFontFilePath = jniEnv->GetMethodID(tangramClass, "getFontFilePath", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"); requestRenderMethodID = _jniEnv->GetMethodID(tangramClass, "requestRender", "()V"); setRenderModeMethodID = _jniEnv->GetMethodID(tangramClass, "setRenderMode", "(I)V"); featureSelectionCbMID = _jniEnv->GetMethodID(tangramClass, "featureSelectionCb", "(Lcom/mapzen/tangram/Properties;)V"); jclass propertiesClass = jniEnv->FindClass("com/mapzen/tangram/Properties"); propertiesConstructorMID = jniEnv->GetMethodID(propertiesClass, "<init>", "(JZ)V"); assetManager = AAssetManager_fromJava(jniEnv, _assetManager); if (assetManager == nullptr) { logMsg("ERROR: Could not obtain Asset Manager reference/n"); }}
开发者ID:zerebubuth,项目名称:tangram-es,代码行数:25,
示例6: ArchiveAssetArchive::AssetArchive(const String& name, AssetArchive* parent, const String& dir): Archive(name){ JNIEnv* env = g_AndroidJNI->getEnv(); if (parent->_assetManagerRef) { _assetManagerRef = env->NewGlobalRef(parent->_assetManagerRef); _assetManager = AAssetManager_fromJava(env, _assetManagerRef); } else { _assetManagerRef = NULL; _assetManager = parent->_assetManager; } _fixCaseProblem = parent->_fixCaseProblem; _dir = dir; if (!_dir.empty()) { FileUtil::normalizeSeparator(_dir); // Make sure base to be 'path/' from if (_dir[_dir.length()-1] != FileUtil::getPathSeparator()) _dir += FileUtil::getPathSeparator(); if (StringUtil::endsWith(_dir, FileUtil::getDamnedPattern1())) _dir.erase(_dir.size() - FileUtil::getDamnedPattern1().length()); } load();}
开发者ID:noriter,项目名称:nit,代码行数:33,
示例7: Java_com_torchandroid_neuraltalk_lua_LuaManager_initTorchJNIEXPORT long JNICALLJava_com_torchandroid_neuraltalk_lua_LuaManager_initTorch(JNIEnv *env, jobject thiz, jobject assetManager, jstring nativeLibraryDir_){ // get native asset manager. This allows access to files stored in the assets folder AAssetManager* manager = AAssetManager_fromJava(env, assetManager); assert( NULL != manager); const char *nativeLibraryDir = env->GetStringUTFChars(nativeLibraryDir_, 0); lua_State *L = NULL; L = inittorch(manager, nativeLibraryDir);// create a lua_State // load and run file char file[] = "init-only.lua"; int ret; long size = android_asset_get_size(file); if (size != -1) { char *filebytes = android_asset_get_bytes(file); ret = luaL_dobuffer(L, filebytes, size, "init-only"); if (ret == 1) { D("Torch Error doing resource: %s/n", file); D(lua_tostring(L,-1)); } else { D("Torch script ran successfully."); } } return (long) L;}
开发者ID:mseyed,项目名称:torch-android-neuraltalk,代码行数:26,
示例8: Java_com_android_accelerometergraph_AccelerometerGraphJNI_initJNIEXPORT void JNICALL Java_com_android_accelerometergraph_AccelerometerGraphJNI_init( JNIEnv *env, jclass type, jobject assetManager) { (void)type; AAssetManager *nativeAssetManager = AAssetManager_fromJava(env, assetManager); gSensorGraph.init(nativeAssetManager); }
开发者ID:cRAN-cg,项目名称:android-ndk,代码行数:7,
示例9: LoadAssetDirstatic jboolean LoadAssetDir(JNIEnv* env, jclass clazz, jobject assetmgr/*AssetManager*/, jstring assetDir){ if (assetDir == NULL || assetmgr == NULL) { gHook.last_error = "empty arguments wen loadAssetDir"; return false; } string dir; GET_CPPSTR_FROM_JSTR(env, assetDir, dir); if (dir.size() == 0) { gHook.last_error = "empty arguments wen loadAssetDir"; return false; } AAssetManager* mgr = AAssetManager_fromJava(env, assetmgr); try { Vm::load_script_assets_dir(mgr, dir.c_str()); return true; } catch(const vedit::Exception& e) { ostringstream oss; oss << "loadFileDir failed, cause:"<<e.what(); gHook.last_error = oss.str(); return false; }}
开发者ID:amongll,项目名称:AVFX,代码行数:29,
示例10: Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCreateJNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCreate(JNIEnv* env, jobject obj, jobject instance, jobject asset_mgr) { qDebug() << "nativeOnCreate On thread " << QThread::currentThreadId(); g_assetManager = AAssetManager_fromJava(env, asset_mgr); auto oldMessageHandler = qInstallMessageHandler(tempMessageHandler); unpackAndroidAssets(); qInstallMessageHandler(oldMessageHandler);}
开发者ID:ZappoMan,项目名称:hifi,代码行数:7,
示例11: Java_com_intel_deferredgles_JNIWrapper_init_1asset_1managerJNIEXPORT void JNICALL Java_com_intel_deferredgles_JNIWrapper_init_1asset_1manager(JNIEnv * env, jobject obj, jobject assetManager){ _asset_manager = AAssetManager_fromJava(env, assetManager); UNUSED_PARAMETER(env); UNUSED_PARAMETER(obj);}
开发者ID:gnlnx,项目名称:OpenGL-ES-3.0-Deferred-Rendering,代码行数:7,
示例12: Java_com_intel_textureloader_TextureLoaderLib_createAssetManagerJNIEXPORT void JNICALL Java_com_intel_textureloader_TextureLoaderLib_createAssetManager(JNIEnv* env, jobject obj, jobject assetManager){ AAssetManager* mgr = AAssetManager_fromJava( env, assetManager ); // Store the assest manager for future use. SetAssetManager( mgr ); }
开发者ID:Cristianohh,项目名称:ETC2TextureLoader,代码行数:7,
示例13: Java_io_jxcore_node_jxcore_setNativeContextJNIEXPORT void JNICALLJava_io_jxcore_node_jxcore_setNativeContext(JNIEnv *env, jobject thiz, jobject context, jobject j_assetManager) { jxcore::JniHelper::setClassLoaderFrom(context); assetManager = AAssetManager_fromJava(env, j_assetManager);}
开发者ID:heocon8319,项目名称:thingengine-platform-android,代码行数:7,
示例14: Java_com_example_android_nnapidemo_MainActivity_initModelJNIEXPORT jlongJNICALLJava_com_example_android_nnapidemo_MainActivity_initModel( JNIEnv *env, jobject /* this */, jobject _assetManager, jstring _assetName) { // Get the file descriptor of the the model data file. AAssetManager *assetManager = AAssetManager_fromJava(env, _assetManager); const char *assetName = env->GetStringUTFChars(_assetName, NULL); AAsset *asset = AAssetManager_open(assetManager, assetName, AASSET_MODE_BUFFER); if(asset == nullptr) { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to open the asset."); return 0; } env->ReleaseStringUTFChars(_assetName, assetName); off_t offset, length; int fd = AAsset_openFileDescriptor(asset, &offset, &length); AAsset_close(asset); if (fd < 0) { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to open the model_data file descriptor."); return 0; } SimpleModel* nn_model = new SimpleModel(length, PROT_READ, fd, offset); if (!nn_model->CreateCompiledModel()) { __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to prepare the model."); return 0; } return (jlong)(uintptr_t)nn_model;}
开发者ID:cRAN-cg,项目名称:android-ndk,代码行数:33,
示例15: Java_com_torchandroid_facedemo_CameraClass_initTorch JNIEXPORT long JNICALL Java_com_torchandroid_facedemo_CameraClass_initTorch(JNIEnv *env, jobject thiz, jobject assetManager) { // get native asset manager. This allows access to files stored in the assets folder AAssetManager* manager = AAssetManager_fromJava(env, assetManager); assert( NULL != manager); lua_State *L = NULL; L = inittorch(manager); // create a lua_State // load and run file char file[] = "main.lua"; int ret; long size = android_asset_get_size(file); if (size != -1) { char *filebytes = android_asset_get_bytes(file); ret = luaL_dobuffer(L, filebytes, size, "main"); if (ret == 1) { D("Torch Error doing resource: %s/n", file); D(lua_tostring(L,-1)); } else { D("Torch script ran succesfully."); } } lua_register(L,"parse",parse); //This function is used by main.lua. return (long) L; }
开发者ID:gokceneraslan,项目名称:torch-android,代码行数:28,
示例16: Java_sample_hawk_com_mybasicappcomponents_jni_AccelerometerGraphJNI_initJNIEXPORT void JNICALL Java_sample_hawk_com_mybasicappcomponents_jni_AccelerometerGraphJNI_init( JNIEnv *env, jclass type, jobject assetManager) { (void)type; AAssetManager *nativeAssetManager = AAssetManager_fromJava(env, assetManager); gSensorGraph.init(nativeAssetManager); }
开发者ID:ha271923,项目名称:MyBasicAppComponents,代码行数:7,
示例17: Java_com_ericsson_lispmediaplayer_Player_setAssetManager JNIEXPORT jint JNICALL Java_com_ericsson_lispmediaplayer_Player_setAssetManager( JNIEnv *env, jobject object, jobject assetManager) { AAssetManager * AssetMgr = NULL; AssetMgr = AAssetManager_fromJava(env, assetManager); setAssetManager(AssetMgr); }
开发者ID:jingshauizh,项目名称:android_sundy,代码行数:7,
示例18: Init void Init(void* infoPtr) { JNIInitInfo* initInfo = static_cast<JNIInitInfo*>(infoPtr); MB_ASSERT(infoPtr); g_assetManager = AAssetManager_fromJava(initInfo->env, initInfo->assetManager); MB_ASSERT(g_assetManager); MB_LOGINFO("Platform::Init complete"); }
开发者ID:kjmac123,项目名称:metabuilder,代码行数:8,
示例19: Java_com_casaproduction_casaengine_RendererWrapper_initAssetManagerJNIEXPORT void JNICALL Java_com_casaproduction_casaengine_RendererWrapper_initAssetManager(JNIEnv * env, jclass jclazz, jobject java_asset_manager){ //UNUSED(jclazz); AAssetManager *asset_manager = AAssetManager_fromJava(env, java_asset_manager); IOManager::SetAssetManager(asset_manager);}
开发者ID:xcasadio,项目名称:casaengine,代码行数:8,
示例20: loadScriptFromAssetsstd::string loadScriptFromAssets(const std::string& assetName) { JNIEnv *env = jni::Environment::current(); jobject application = env->CallStaticObjectMethod( gApplicationHolderClass, gGetApplicationMethod); jobject assetManager = env->CallObjectMethod(application, gGetAssetManagerMethod); return loadScriptFromAssets(AAssetManager_fromJava(env, assetManager), assetName);}
开发者ID:201528013329008,项目名称:react-native,代码行数:8,
示例21: Java_budny_moneykeeper_cv_Recognizer_nativeInitializeextern "C" JNIEXPORT jlong JNICALLJava_budny_moneykeeper_cv_Recognizer_nativeInitialize( JNIEnv* j_env, jobject, jobject j_manager, jstring j_model_filename) { AAssetManager* manager = AAssetManager_fromJava(j_env, j_manager); std::string model_filename = jni::stdString(j_env, j_model_filename); Recognizer* recognizer = new Recognizer(manager, model_filename); return reinterpret_cast<jlong>(recognizer);}
开发者ID:budnyjj,项目名称:MoneyKeeper,代码行数:9,
示例22: loadShadersvoid loadShaders(JNIEnv *env, jobject &obj) { AAssetManager *asset_manager = AAssetManager_fromJava(env, obj); FILE *fd; fd = android_fopen("vertex.glsl", "r", asset_manager); gVertexShader = readToString(fd); fclose(fd); fd = android_fopen("fragment.glsl", "r", asset_manager); gFragmentShader = readToString(fd); fclose(fd);}
开发者ID:TheFakeMontyOnTheRun,项目名称:nehe-ndk-gles20,代码行数:10,
示例23: LOGDJNIEXPORT void JNICALL Java_in_p3d_mobile_P3dViewerJNIWrapper_init_1asset_1manager (JNIEnv *env, jclass cls, jobject am){ // unused (void)cls; LOGD("assetmgr"); AAssetManager* mgr = AAssetManager_fromJava(env, am); adapter->setAssetManager(mgr);}
开发者ID:EthrosDemon,项目名称:p3d,代码行数:10,
示例24: Java_spidermonkey_bindings_runJSFromAssets JNIEXPORT void JNICALL Java_spidermonkey_bindings_runJSFromAssets (JNIEnv* env, jobject thiz, jobject java_assetmanager, jstring java_relativepath) { LOGD("Java_spidermonkey_bindings_runJSFromAssets"); // relative path const char* relativepath; relativepath = env->GetStringUTFChars(java_relativepath, NULL); if (NULL == relativepath) { LOGD("relativepath : is NULL"); return; // OutOfMemoryError already thrown } LOGD("relativepath : %s", relativepath); AAssetManager* assetmanager = AAssetManager_fromJava(env, java_assetmanager); if (NULL == assetmanager) { LOGD("assetmanager : is NULL"); return; } // read asset data AAsset* asset = AAssetManager_open(assetmanager, relativepath, AASSET_MODE_UNKNOWN); if (NULL == asset) { LOGD("asset : is NULL"); return; } off_t size = AAsset_getLength(asset); LOGD("size = %d ", size); char* buf = (char*) malloc(size+1); if (NULL == buf) { LOGD("asset : is NULL"); AAsset_close(asset); return; } int bytesread = AAsset_read(asset, (void*)buf, size); LOGD("bytesread = %d ", bytesread); buf[size] = '/0'; AAsset_close(asset); // run this in SpiderMonkey jsbindings::runJS((char*) buf); env->ReleaseStringUTFChars(java_relativepath, relativepath); }
开发者ID:flywingsky,项目名称:hellojs-android,代码行数:54,
示例25: Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCreateJNIEXPORT void Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCreate(JNIEnv* env, jobject obj, jobject instance, jobject asset_mgr) { g_assetManager = AAssetManager_fromJava(env, asset_mgr); qRegisterMetaType<QAndroidJniObject>("QAndroidJniObject"); __interfaceActivity = QAndroidJniObject(instance); auto oldMessageHandler = qInstallMessageHandler(tempMessageHandler); unpackAndroidAssets(); qInstallMessageHandler(oldMessageHandler); JavaVM* jvm; env->GetJavaVM(&jvm); QObject::connect(&AndroidHelper::instance(), &AndroidHelper::androidActivityRequested, [jvm](const QString& a, const bool backToScene, QMap<QString, QString> args) { JNIEnv* myNewEnv; JavaVMAttachArgs jvmArgs; jvmArgs.version = JNI_VERSION_1_6; // choose your JNI version jvmArgs.name = NULL; // you might want to give the java thread a name jvmArgs.group = NULL; // you might want to assign the java thread to a ThreadGroup int attachedHere = 0; // know if detaching at the end is necessary jint res = jvm->GetEnv((void**)&myNewEnv, JNI_VERSION_1_6); // checks if current env needs attaching or it is already attached if (JNI_OK != res) { qDebug() << "[JCRASH] GetEnv env not attached yet, attaching now.."; res = jvm->AttachCurrentThread(reinterpret_cast<JNIEnv **>(&myNewEnv), &jvmArgs); if (JNI_OK != res) { qDebug() << "[JCRASH] Failed to AttachCurrentThread, ErrorCode = " << res; return; } else { attachedHere = 1; } } QAndroidJniObject string = QAndroidJniObject::fromString(a); jboolean jBackToScene = (jboolean) backToScene; jclass hashMapClass = myNewEnv->FindClass("java/util/HashMap"); jmethodID mapClassConstructor = myNewEnv->GetMethodID(hashMapClass, "<init>", "()V"); jobject hashmap = myNewEnv->NewObject(hashMapClass, mapClassConstructor); jmethodID mapClassPut = myNewEnv->GetMethodID(hashMapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); QMap<QString, QString>::iterator i; for (i = args.begin(); i != args.end(); ++i) { QAndroidJniObject jKey = QAndroidJniObject::fromString(i.key()); QAndroidJniObject jValue = QAndroidJniObject::fromString(i.value()); myNewEnv->CallObjectMethod(hashmap, mapClassPut, jKey.object<jstring>(), jValue.object<jstring>()); } __interfaceActivity.callMethod<void>("openAndroidActivity", "(Ljava/lang/String;ZLjava/util/HashMap;)V", string.object<jstring>(), jBackToScene, hashmap); if (attachedHere) { jvm->DetachCurrentThread(); } }); QObject::connect(&AndroidHelper::instance(), &AndroidHelper::hapticFeedbackRequested, [](int duration) { jint iDuration = (jint) duration; __interfaceActivity.callMethod<void>("performHapticFeedback", "(I)V", iDuration); });}
开发者ID:birarda,项目名称:hifi,代码行数:54,
示例26: Java_com_cwq_cwqengine_CwqEngineJNI_CwqEngine_1setAssetManagerSWIGEXPORT void JNICALL Java_com_cwq_cwqengine_CwqEngineJNI_CwqEngine_1setAssetManager(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject assetManager) { CwqEngine *arg1 = (CwqEngine *) 0 ; AAssetManager *arg2 = (AAssetManager *) 0 ; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(CwqEngine **)&jarg1; arg2 = AAssetManager_fromJava(jenv, assetManager); Resource::setAssetManager(arg2);}
开发者ID:wyrover,项目名称:CwqEngine,代码行数:11,
注:本文中的AAssetManager_fromJava函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AAsset_close函数代码示例 C++ AABB函数代码示例 |