当前位置: 首页>>代码示例>>C++>>正文


C++ AAssetManager_fromJava函数代码示例

本文整理汇总了C++中AAssetManager_fromJava函数的典型用法代码示例。如果您正苦于以下问题:C++ AAssetManager_fromJava函数的具体用法?C++ AAssetManager_fromJava怎么用?C++ AAssetManager_fromJava使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了AAssetManager_fromJava函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Java_org_gearvrf_NativeImporter_readFileFromAssets

JNIEXPORT jlong JNICALL
Java_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,代码来源:importer_jni.cpp


示例2: EnginePrepare

static 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,代码来源:VEditVM_android.cpp


示例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,代码来源:core.cpp


示例4: Java_org_linaro_glmark2_native_getSceneInfo

jobjectArray
Java_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,代码来源:android.cpp


示例5: setupJniEnv

void 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,代码来源:platform_android.cpp


示例6: Archive

AssetArchive::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,代码来源:AndroidSupport.cpp


示例7: Java_com_torchandroid_neuraltalk_lua_LuaManager_initTorch

JNIEXPORT long JNICALL
Java_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,代码来源:torchdemo.cpp


示例8: Java_com_android_accelerometergraph_AccelerometerGraphJNI_init

JNIEXPORT 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,代码来源:sensorgraph.cpp


示例9: LoadAssetDir

static 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,代码来源:VEditVM_android.cpp


示例10: Java_io_highfidelity_hifiinterface_InterfaceActivity_nativeOnCreate

JNIEXPORT 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,代码来源:native.cpp


示例11: Java_com_intel_deferredgles_JNIWrapper_init_1asset_1manager

JNIEXPORT 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,代码来源:jni.c


示例12: Java_com_intel_textureloader_TextureLoaderLib_createAssetManager

JNIEXPORT 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,代码来源:jni_main.c


示例13: Java_io_jxcore_node_jxcore_setNativeContext

JNIEXPORT void JNICALL
Java_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,代码来源:jxcore.cpp


示例14: Java_com_example_android_nnapidemo_MainActivity_initModel

JNIEXPORT jlong
JNICALL
Java_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,代码来源:nn_sample.cpp


示例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,代码来源:torchdemo.cpp


示例16: Java_sample_hawk_com_mybasicappcomponents_jni_AccelerometerGraphJNI_init

JNIEXPORT 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,代码来源:sensorgraph.cpp


示例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,代码来源:com_ericsson_lispmediaplayer_Player.cpp


示例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,代码来源:platform_android.cpp


示例19: Java_com_casaproduction_casaengine_RendererWrapper_initAssetManager

JNIEXPORT 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,代码来源:renderer_wrapper.cpp


示例20: loadScriptFromAssets

std::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,代码来源:JSLoader.cpp



注:本文中的AAssetManager_fromJava函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。