这篇教程C++ AAsset_read函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AAsset_read函数的典型用法代码示例。如果您正苦于以下问题:C++ AAsset_read函数的具体用法?C++ AAsset_read怎么用?C++ AAsset_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AAsset_read函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ReadFileAsset void ReadFileAsset(const tstring & path, star::SerializedData & data) { auto app = star::StarEngine::GetInstance()->GetAndroidApp(); auto manager = app->activity->assetManager; AAsset* asset = AAssetManager_open( manager, star::string_cast<sstring>(path.c_str()).c_str(), AASSET_MODE_UNKNOWN ); star::Logger::GetInstance()->Log(asset != NULL, _T("Couldn't find '") + path + _T("'.")); data.size = AAsset_getLength(asset); data.data = new schar[sizeof(schar) * data.size]; AAsset_read(asset, data.data, data.size); AAsset_close(asset); }
开发者ID:Syvion,项目名称:StarEngine,代码行数:16,
示例2: writeLogbool FileReader::read(unsigned int count, void*buffer){ writeLog("%d %x %x", count, buffer, asset); if(asset != nullptr) { writeLog("not null or sumthin"); if(AAsset_read(asset, buffer,count) >=0) { writeLog("everything went better than expedition"); return true; } } writeLog("Null asset"); return false;}
开发者ID:NeoLeijona,项目名称:EVO,代码行数:16,
示例3: DEBUGPRINTsize_t FileInput::read(unsigned char *buffer, size_t size){ if(!m_asset || !buffer) { Console::Print(Console::Error, "Could not read from file."); return 0; } DEBUGPRINT("Reading %i bytes from asset %x", size, m_asset); int returnval = AAsset_read(m_asset, buffer, size); DEBUGPRINT("AAsset_read returned %i", returnval); return returnval;}
开发者ID:robindegen,项目名称:android_game_engine,代码行数:16,
示例4: vertexShaderStreamchar* Renderer::LoadKernelFromAssets(const string * path){#ifdef PLATFORM_WINDOWS string prefix = "kernelsPC/";#else string prefix = "kernels/";#endif string suffix = ".glsl"; string fPath = prefix + *path + suffix;#ifdef PLATFORM_WINDOWS fPath = Renderer::GetInstance()->ASSET_PATH + fPath; string sCode; ifstream vertexShaderStream(fPath.c_str(), ios::in); if (vertexShaderStream.is_open()) { string Line = ""; while (getline(vertexShaderStream, Line)) { sCode += "/n" + Line; } vertexShaderStream.close(); } int length = sCode.length(); char* ret = new char[length + 1]; strcpy(ret, sCode.c_str()); ret[length] = '/0'; return ret;#else AAssetManager* mgr = System::GetInstance()->GetEngineData()->app->activity->assetManager; AAsset* shaderAsset = AAssetManager_open(mgr, fPath.c_str(), AASSET_MODE_UNKNOWN); unsigned int length = AAsset_getLength(shaderAsset); char * code = new char[length + 1]; AAsset_read(shaderAsset, (void*)code, length); code[length] = '/0'; return code;#endif}
开发者ID:ACPLMaverick,项目名称:MAVNET,代码行数:47,
示例5: File_ReadWRes File_Read(CSzFile *p, void *data, size_t *size){ size_t originalSize = *size; if (originalSize == 0) return 0; #ifdef USE_WINDOWS_FILE *size = 0; do { DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize; DWORD processed = 0; BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL); data = (void *)((Byte *)data + processed); originalSize -= processed; *size += processed; if (!res) return GetLastError(); if (processed == 0) break; } while (originalSize > 0); return 0; #else if(p->mgr) { msg_Dbg("file read");#ifndef ANDROID22 if(p->asset) *size = AAsset_read(p->asset,data,originalSize);#endif if (*size == originalSize) return 0; return -1; } else { *size = fread(data, 1, originalSize, p->file); if (*size == originalSize) return 0; return ferror(p->file); } #endif}
开发者ID:Alford087,项目名称:NativeLibCompression,代码行数:47,
示例6: jsModulesDirbool JniJSModulesUnbundle::isUnbundle( AAssetManager *assetManager, const std::string& assetName) { if (!assetManager) { return false; } auto magicFileName = jsModulesDir(assetName) + MAGIC_FILE_NAME; auto asset = openAsset(assetManager, magicFileName.c_str()); if (asset == nullptr) { return false; } magic_number_t fileHeader = 0; AAsset_read(asset.get(), &fileHeader, sizeof(fileHeader)); return fileHeader == htole32(MAGIC_FILE_HEADER);}
开发者ID:APSL,项目名称:react-native,代码行数:17,
示例7: esFileRead///// esFileRead()//// Wrapper for platform specific File read//static size_t esFileRead ( esFile *pFile, int bytesToRead, void *buffer ){ size_t bytesRead = 0; if ( pFile == NULL ) { return bytesRead; }#ifdef ANDROID bytesRead = AAsset_read ( pFile, buffer, bytesToRead );#else bytesRead = fread ( buffer, bytesToRead, 1, pFile );#endif return bytesRead;}
开发者ID:OnTheEasiestWay,项目名称:OpenGL3,代码行数:22,
示例8: LoadMesh /** * Load a scene from a supported 3D file format * * @param filename Name of the file (or asset) to load * @param flags (Optional) Set of ASSIMP processing flags * * @return Returns true if the scene has been loaded */ bool LoadMesh(const std::string& filename, int flags = defaultFlags) {#if defined(__ANDROID__) // Meshes are stored inside the apk on Android (compressed) // So they need to be loaded via the asset manager AAsset* asset = AAssetManager_open(assetManager, filename.c_str(), AASSET_MODE_STREAMING); assert(asset); size_t size = AAsset_getLength(asset); assert(size > 0); void *meshData = malloc(size); AAsset_read(asset, meshData, size); AAsset_close(asset); pScene = Importer.ReadFileFromMemory(meshData, size, flags); free(meshData);#else pScene = Importer.ReadFile(filename.c_str(), flags);#endif if (pScene) { m_Entries.clear(); m_Entries.resize(pScene->mNumMeshes); // Read in all meshes in the scene for (auto i = 0; i < m_Entries.size(); i++) { m_Entries[i].vertexBase = numVertices; numVertices += pScene->mMeshes[i]->mNumVertices; const aiMesh* paiMesh = pScene->mMeshes[i]; InitMesh(&m_Entries[i], paiMesh, pScene); } return true; } else { printf("Error parsing '%s': '%s'/n", filename.c_str(), Importer.GetErrorString());#if defined(__ANDROID__) LOGE("Error parsing '%s': '%s'", filename.c_str(), Importer.GetErrorString());#endif return false; } }
开发者ID:dreadwords,项目名称:Vulkan,代码行数:54,
示例9: androidExtractAllbool androidExtractAll() { AAssetDir* assetDir = AAssetManager_openDir(gActivity->assetManager, ""); const char* filename = (const char*)NULL; std::string assetContent; while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) { std::string newPath = androidGetPath(filename); AAsset* asset = AAssetManager_open(gActivity->assetManager, filename, AASSET_MODE_STREAMING); FLOG_DEBUG("File %s opened for extraction ...", filename ); // Find size off_t assetSize = AAsset_getLength(asset); // Prepare input buffer assetContent.resize(assetSize); // Store input buffer AAsset_read(asset, &assetContent[0], assetSize); // Close AAsset_close(asset); // Check if file exists std::ifstream f(newPath.c_str()); if (f.good()) { f.close(); FLOG_DEBUG("Asset %s already extracted", filename); } else { // Prepare output buffer std::ofstream assetExtracted(newPath.c_str(), std::ios::out | std::ios::binary); if (!assetExtracted) { FLOG_ERROR("File %s not extracted", newPath.c_str()); return false; } // Write output buffer into a file assetExtracted.write(assetContent.c_str(), assetSize); assetExtracted.close(); FLOG_DEBUG("File %s extracted", filename); } } return true; AAssetDir_close(assetDir);}
开发者ID:filipwasil,项目名称:fillwave,代码行数:45,
示例10: loadCompressedTexturebool loadCompressedTexture(GLenum target, int level, GLenum internalFormat, int width, int height, const std::string& fileName){#if defined(SUPPORT_ANDROID) AAsset* asset = AAssetManager_open(ctx.assetManager, fileName.c_str(), O_RDONLY); if (!asset) { LOGW("Unable to open asset %s", fileName.c_str()); return false; } off_t size = AAsset_getLength(asset); void* pixels = malloc(size); AAsset_read(asset, pixels, size); AAsset_close(asset);#else // !SUPPORT_ANDROID int fd = open(fileName.c_str(), O_RDONLY); if (fd == -1) { perror("open"); return false; } struct stat sb; if (fstat(fd, &sb) == -1) { perror("stat"); return false; } off_t size = sb.st_size; void* pixels = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);#endif // !SUPPORT_ANDROID glCompressedTexImage2D(target, level, internalFormat, width, height, 0, size, pixels);#if defined(SUPPORT_ANDROID) free(pixels);#else munmap(pixels, sb.st_size); close(fd);#endif ASSERT_GL(); return true;}
开发者ID:akallabeth,项目名称:glmemperf,代码行数:45,
示例11: androidExtractbool androidExtract( const std::string& name ) { const char* pFile = name.c_str(); std::string newPath = androidGetPath(pFile); AAssetDir* a; if ( androidExtracted(name.c_str()) ) { FLOG_DEBUG("File %s already extracted", name.c_str()); return true; } AAsset* asset = AAssetManager_open(gActivity->assetManager, name.c_str(), AASSET_MODE_STREAMING); std::string assetContent; if (asset != NULL) { // Find size off_t assetSize = AAsset_getLength(asset); // Prepare input buffer assetContent.resize(assetSize); // Store input buffer AAsset_read(asset, &assetContent[0], assetSize); // Close AAsset_close(asset); // Prepare output buffer std::ofstream assetExtracted(newPath.c_str(), std::ios::out | std::ios::binary); if (!assetExtracted) { FLOG_ERROR("File %s not extracted", newPath.c_str()); return false; } // Write output buffer into a file assetExtracted.write(assetContent.c_str(), assetSize); assetExtracted.close(); FLOG_DEBUG("File extracted"); return true; } else { FLOG_ERROR("File %s not extracted. Returning empty string", name.c_str()); return false; }}
开发者ID:filipwasil,项目名称:fillwave,代码行数:45,
示例12: BEHAVIAC_LOGERROR bool CFileSystem::ReadFile(Handle file, void* pBuffer, uint32_t nNumberOfBytesToRead, uint32_t* pNumberOfBytesRead) { if (!file) { BEHAVIAC_LOGERROR("File not open"); return 0; }#if BEHAVIAC_CCDEFINE_ANDROID && (BEHAVIAC_CCDEFINE_ANDROID_VER > 8) size_t ret = AAsset_read((AAsset*)file, pBuffer, nNumberOfBytesToRead);#else size_t ret = fread(pBuffer, 1, nNumberOfBytesToRead, (FILE*)file);#endif if (pNumberOfBytesRead) { *pNumberOfBytesRead = ret; } return true; }
开发者ID:czfsvn,项目名称:LinuxC,代码行数:18,
示例13: AAssetManager_openGLubyte* FileReader::loadTGA(const std::string &fileName, tgaHeader &header){ AAsset* asset = AAssetManager_open(FileReader::manager, fileName.c_str(), AASSET_MODE_UNKNOWN); if(asset == NULL) { writeLog("Asset = NULL"); } AAsset_read(asset, &header.idLength, 1); AAsset_read(asset, &header.colorMapType, 1); AAsset_read(asset, &header.type, 1); AAsset_seek(asset, 9, SEEK_CUR); AAsset_read(asset, &header.width, 2); AAsset_read(asset, &header.height, 2); AAsset_read(asset, &header.depth, 1); AAsset_read(asset, &header.descriptor, 1); AAsset_seek(asset, header.idLength, SEEK_CUR); //writeLog("spritewidth: %d, height: %d, depth: %d", header.width, header.height, header.depth); //24bit / 8 = 3 (RGB), 32bit / 8 = 4 (RGBA) int componentCount = header.depth/8; int size = componentCount * header.width * header.height; GLubyte* data = new GLubyte[size]; AAsset_read(asset, data, size); //data is now BGRA so we format it to RGBA for(int i = 0; i < size; i += componentCount) { GLubyte temp = data[i]; //Switch red and blue data[i] = data[i+2]; data[i+2] = temp; } AAsset_close(asset); return data;}
开发者ID:NeoLeijona,项目名称:EVO,代码行数:42,
示例14: fopenchar *VSShaderLib::textFileRead(std::string fileName) { char *content = NULL;#ifndef __ANDROID_API__ FILE *fp; size_t count=0; if (fileName != "") { fp = fopen(fileName.c_str(),"rt"); if (fp != NULL) { fseek(fp, 0, SEEK_END); count = ftell(fp); rewind(fp); if (count > 0) { content = (char *)malloc(sizeof(char) * (count+1)); count = fread(content, sizeof(char), count, fp); content[count] = '/0'; } fclose(fp); } } return content;#else AAsset* asset = AAssetManager_open(s_AssetManager, fileName.c_str(), AASSET_MODE_UNKNOWN); const char *loc = "VSShaderLib::readText"; if (NULL == asset) { __android_log_print(ANDROID_LOG_ERROR, loc, "%s", "_ASSET_NOT_FOUND_"); return content; } size_t size = (size_t)AAsset_getLength(asset); content = (char*)malloc(sizeof(char)*size + 1); AAsset_read(asset, content, size); content[size] = '/0'; __android_log_print(ANDROID_LOG_DEBUG, loc, "%s", content); AAsset_close(asset); return content;#endif}
开发者ID:lighthouse3d,项目名称:VSL,代码行数:44,
示例15: AAssetManager_openFileUtils::FileData FileUtils::getFileData(const char* fileName){ DebugLog::print( "FileUtils::getFileData(%s)", fileName ); AAsset* asset = AAssetManager_open(g_aassetManager, (const char *) fileName, AASSET_MODE_UNKNOWN); if (NULL == asset) { DebugLog::print("Failed !"); return FileData(); } long size = AAsset_getLength(asset); FileData res = findFreeFileDataSlot(size); res.size = size; AAsset_read (asset, res.bytes, size); AAsset_close(asset); return res;}
开发者ID:SylerWang,项目名称:FunFashion,代码行数:19,
示例16: androidReadToStringvoid androidReadToString(const char* pFileName, std::string& fileContent) { assert( gActivity->assetManager ); AAsset* pFile = AAssetManager_open(gActivity->assetManager, pFileName, AASSET_MODE_UNKNOWN); if (pFile != NULL) { off_t fileSize = AAsset_getLength(pFile); fileContent.resize(fileSize); char* pData = new char[fileSize]; AAsset_read(pFile, &fileContent[0], fileSize); AAsset_close(pFile); FLOG_DEBUG("File %s found", pFileName); } else { FLOG_ERROR("File %s not found", pFileName); }}
开发者ID:filipwasil,项目名称:fillwave,代码行数:19,
示例17: j_moc_init/* * For native implementation for java methods, if it's static method * belongs to class itself, then second parameter should be jclass(it * refers to MocClient here), otherwise, it should be jobject because * it's just instance of specified class. */static jbooleanj_moc_init(JNIEnv *env, jobject obj, jobject assetManager, jstring fileStr){ char *fileChars = NULL; if (fileStr) { fileChars = (char*) (*env)->GetStringUTFChars(env, fileStr, NULL); LOGI("moc client would to be initialized by file %s.", fileChars); } else { fileChars = "conf/mocclient.hdf"; LOGI("moc client would to be initialized by default configurations."); } AAssetManager *manager = AAssetManager_fromJava(env, assetManager); assert(manager != NULL); AAsset *file = AAssetManager_open(manager, "conf/mocclient.hdf", AASSET_MODE_UNKNOWN); if (file == NULL) { LOGE("sepecified file does not exists in apk."); } /* read contents from config file */ off_t bufferSize = AAsset_getLength(file); char *buffer = (char*) malloc(bufferSize + 1); buffer[bufferSize] = 0; AAsset_read(file, buffer, bufferSize); /* close file */ AAsset_close(file); moc_init_frombuf(buffer); /* * initial module calback hash table * but it only supports bang module currently */ hash_init(®isted_callback_module_table, hash_str_hash, hash_str_comp, NULL); hash_insert(registed_callback_module_table, (void*) "bang", (void*) j_moc_regist_callback_bang); return true;}
开发者ID:bigclean,项目名称:moc,代码行数:48,
示例18: AAsset_readint FileAccessAndroid::get_buffer(uint8_t *p_dst, int p_length) const { off_t r = AAsset_read(a,p_dst,p_length); if (pos+p_length >len ) { eof=true; } if (r>=0) { pos+=r; if (pos>len) { pos=len; } } return r;}
开发者ID:Blake-Hudson,项目名称:godot,代码行数:20,
示例19: AAssetManager_openstd::string gg::Util::loadFile(const std::string &fileName){ //TODO: check for invalid filenames AAsset* asset = AAssetManager_open(gg::AssetManager::manager, fileName.c_str(), AASSET_MODE_UNKNOWN); off_t length = AAsset_getLength(asset); char* text = new char[length+1]; if(AAsset_read(asset, text, length) < 1) { writeLog("File not loaded! Error! Error!"); } text[length] = 0; AAsset_close(asset); text[length] = 0; std::string r(text); return r;}
开发者ID:Hangyakusha,项目名称:TeamNoHope,代码行数:20,
示例20: LoadFileFuncstatic void* LoadFileFunc(const char* pFilename, char** pData, size_t &size){ size = 0; AAsset* pAsset = AAssetManager_open(g_AssetManager, pFilename, AASSET_MODE_BUFFER); if(pAsset) { off_t length = AAsset_getLength(pAsset); if(length) { SHandle *pHandle = new SHandle(); if(pHandle) { pHandle->size = length; pHandle->pData = new char[length]; if(pHandle->pData) { if(length == AAsset_read(pAsset, pHandle->pData, length)) { AAsset_close(pAsset); size = length; *pData = pHandle->pData; return pHandle; } delete[] pHandle->pData; } delete pHandle; } } AAsset_close(pAsset); } return 0;}
开发者ID:joyfish,项目名称:GameThirdPartyLibs,代码行数:41,
示例21: assetReadSyncstatic void assetReadSync(JXValue *results, int argc) { char *filename = JX_GetString(&results[0]); AAsset *asset = AAssetManager_open(assetManager, filename, AASSET_MODE_UNKNOWN); free(filename); if (asset) { off_t fileSize = AAsset_getLength(asset); void *data = malloc(fileSize); int read_len = AAsset_read(asset, data, fileSize); JX_SetBuffer(&results[argc], (char *)data, read_len); free(data); AAsset_close(asset); return; } const char *err = "File doesn't exist"; JX_SetError(&results[argc], err, strlen(err));}
开发者ID:heocon8319,项目名称:thingengine-platform-android,代码行数:21,
示例22: _spUtil_readFilechar* _spUtil_readFile (const char* path, int* length) { AAssetManager* assetManager = (AAssetManager*) get_asset_manager(); AAsset* asset = AAssetManager_open(assetManager, (const char *) path, AASSET_MODE_UNKNOWN); if (NULL == asset) { __android_log_print(ANDROID_LOG_ERROR, "SpineAndroid", "Asset (%s) not found", path); return NULL; } long size = AAsset_getLength(asset); *length = size; char* buffer = (char*) malloc (sizeof(char)*size); AAsset_read (asset,buffer,size); AAsset_close(asset); return buffer;}
开发者ID:jasonpolites,项目名称:spine-runtimes,代码行数:21,
示例23: ReadStringAMint ReadStringAM(AAsset* asset, char * buffer, int count, int offset) { AAsset_seek(asset, offset, SEEK_SET); int r_count = AAsset_read(asset, buffer, count); if (r_count <= 0) return r_count; for (int i = 0; i < r_count; ++i) { if (buffer[i] == '/n') { buffer[i] = '/0'; AAsset_seek(asset, offset + i + 1, SEEK_SET); return offset + i + 1; } } if (count == r_count && buffer[r_count - 1] != '/n') return 0; return offset + r_count + 1;}
开发者ID:Charlesjean,项目名称:libjpeg-version-9-android,代码行数:21,
示例24: fileNamestd::string ResourceEngineAndroid::loadLevel(std::string const& levelName) { //logging::Fatal() << " not implemented"; if (!assertAssetManager()) return ""; const std::string fileName(getLevelPrefix() + levelName + ".xml"); AAsset * asset = AAssetManager_open(m_assetManager, fileName.c_str(), AASSET_MODE_STREAMING); if (asset == nullptr) { logging::Fatal() << "Asset with name " << fileName << " could not be loaded."; return ""; } constexpr size_t buffer_size = 1024; int bytes_read; char buffer[buffer_size]; std::string textFileString; while (true) { bytes_read = AAsset_read(asset, &buffer, buffer_size); if (bytes_read < 0) { logging::Fatal() << "Error while reading from file " << fileName; return ""; } else { std::string bufString(buffer); bufString.resize(bytes_read); textFileString.append(bufString); // at the end ! if (bytes_read < buffer_size) break; } } logging::Info() << "Completed reading of file " << fileName; return textFileString;}
开发者ID:poseidn,项目名称:KungFoo,代码行数:40,
示例25: esFileRead///// esFileRead()//// Wrapper for platform specific File read//static int esFileRead ( void * ioContext, void *pFile, int bytesToRead, void *buffer ){ int bytesRead = 0; if ( pFile == NULL ) { return bytesRead; } LOGE("bytesToRead is %d", bytesToRead); if (ioContext != NULL) { bytesRead = AAsset_read ( pFile, buffer, bytesToRead ); } else { bytesRead = fread ( buffer, bytesToRead, 1, pFile ); } return bytesRead;}
开发者ID:leagueingithub,项目名称:opengl-es-demo,代码行数:27,
示例26: m_kFullPath//--------------------------------------------------------------------------VeAssetPath::ReadTask::ReadTask(const VeChar8* pcFullPath, VeRefNode<ReadCallback>& kCallback) noexcept : m_kFullPath(pcFullPath){ IncRefCount(); m_kNode.m_Content = this; ve_sys.Collect(m_kNode); m_kCallback.attach_back(kCallback); m_kTask.m_Content = [this](VeTaskQueue& kMgr) noexcept { AAsset* pkAsset = AAssetManager_open(s_pkAssetManager, m_kFullPath, AASSET_MODE_UNKNOWN); if (pkAsset) { VeInt32 i32Len = AAsset_getLength(pkAsset); if (i32Len) { VeBlobPtr spBlob = VE_NEW VeBlob(i32Len); VeInt32 i32Read = AAsset_read(pkAsset, spBlob->GetBuffer(), i32Len); if (i32Read == i32Len) { m_spData = VE_NEW VeMemoryIStream(spBlob); } } AAsset_close(pkAsset); } m_kTask.m_Content = [this](VeTaskQueue& kMgr) noexcept { for (auto call : m_kCallback) { call(m_spData); } DecRefCount(); }; kMgr.AddFGTask(m_kTask); }; ve_res_mgr.GetTaskQueue(VeResourceManager::TASK_FILE).AddBGTask(m_kTask);}
开发者ID:JamesLinus,项目名称:Venus3D,代码行数:40,
示例27: AAsset_reads32 FileAsset::readBuffer(void* Buffer, u32 Size, u32 Count) const{ /* Check for valid data */ if (!Buffer || !Size || !Count || !opened()) return 0; /* Read buffer out of file */ s32 Result = AAsset_read(Asset_, Buffer, Size * Count); /* Check for errors */ if (Result < 0) { Log::error("Could not read buffer out of asset"); return -1; } /* Boost seek position */ Pos_ += Result; /* Return count of read bytes */ return Result;}
开发者ID:bekasov,项目名称:SoftPixelEngine,代码行数:22,
示例28: test_apk/******************************************************************** * Test for asset *******************************************************************/void test_apk(struct android_app* state){ AAssetManager* mgr = state->activity->assetManager; AAsset* asset = AAssetManager_open(mgr, "fuck.txt", AASSET_MODE_UNKNOWN); if(asset == NULL) { LOGI("assets == NULL"); } off_t size = AAsset_getLength(asset); LOGI("size=%d",size); char* buffer = new char[size+1]; buffer[size] = 0; int num_read = AAsset_read(asset, buffer, size); //LOGI(buffer); AAsset_close(asset);}
开发者ID:gaoguanglei,项目名称:Android-OpenGL-ES-2.0-Effects,代码行数:25,
示例29: LoadShaderint LoadShader(GLuint Shader, char *Filename){ AAsset *stream; char *buffer; int length; if((stream=AAssetManager_open(assetManager, Filename, AASSET_MODE_BUFFER))==NULL) return 0; length=AAsset_getLength(stream); buffer=(char *)malloc(length+1); AAsset_read(stream, buffer, length); buffer[length]='/0'; glShaderSource(Shader, 1, (const char **)&buffer, &length); AAsset_close(stream); free(buffer); return 1;}
开发者ID:seishuku,项目名称:gauges,代码行数:22,
注:本文中的AAsset_read函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AB函数代码示例 C++ AAsset_getLength函数代码示例 |