本文整理汇总了C++中wyAAL类的典型用法代码示例。如果您正苦于以下问题:C++ wyAAL类的具体用法?C++ wyAAL怎么用?C++ wyAAL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wyAAL类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getPosition
size_t wyAssetInputStream_android::getPosition() {
if(m_asset != NULL)
return gAAL.getAssetLength(m_asset) - gAAL.getAssetRemainingLength(m_asset);
else if(m_fp != NULL)
return ftell(m_fp);
else
return 0;
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:8,代码来源:wyAssetInputStream_android.cpp
示例2: setScaleMode
void wyDirector_android::setScaleMode(wyScaleMode mode) {
wyDirector::setScaleMode(mode);
// need update AAL
if(gAAL.setScaleMode)
gAAL.setScaleMode((int)mode);
}
开发者ID:nbolabs,项目名称:WiEngine,代码行数:7,代码来源:wyDirector_android.cpp
示例3: read
ssize_t wyAssetInputStream_android::read(char* buffer, size_t length) {
if(m_asset != NULL)
return gAAL.readAsset(m_asset, buffer, length);
else if(m_fp != NULL)
return fread(buffer, sizeof(char), length, m_fp);
else
return -1;
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:8,代码来源:wyAssetInputStream_android.cpp
示例4: available
size_t wyAssetInputStream_android::available() {
if(m_asset != NULL)
return gAAL.getAssetRemainingLength(m_asset);
else if(m_fp != NULL)
return getLength() - getPosition();
else
return 0;
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:8,代码来源:wyAssetInputStream_android.cpp
示例5: seek
size_t wyAssetInputStream_android::seek(int offset, int mode) {
if(m_asset != NULL)
return gAAL.seekAsset(m_asset, offset, mode);
else if(m_fp != NULL)
return fseek(m_fp, offset, mode);
else
return 0;
}
开发者ID:ascetic85,项目名称:WiEngine,代码行数:8,代码来源:wyAssetInputStream_android.cpp
示例6: if
wyAssetInputStream_android::~wyAssetInputStream_android() {
if(m_asset != NULL) {
gAAL.closeAsset(m_asset);
m_asset = NULL;
} else if(m_fp != NULL) {
fclose(m_fp);
m_fp = NULL;
}
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:9,代码来源:wyAssetInputStream_android.cpp
示例7: seek
size_t wyAssetInputStream_android::seek(int offset, int mode) {
if(m_asset != NULL) {
return gAAL.seekAsset(m_asset, offset, mode);
} else if(m_fp != NULL) {
fseek(m_fp, offset, mode);
return ftell(m_fp);
} else {
return 0;
}
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:10,代码来源:wyAssetInputStream_android.cpp
示例8: getBuffer
char* wyAssetInputStream_android::getBuffer() {
size_t len = getLength();
char* buf = (char*)wyMalloc(len * sizeof(char));
if(m_asset != NULL)
memcpy(buf, gAAL.getAssetBuffer(m_asset), len);
else if(m_fp != NULL)
fread(buf, sizeof(char), len, m_fp);
return buf;
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:11,代码来源:wyAssetInputStream_android.cpp
示例9: getLength
size_t wyAssetInputStream_android::getLength() {
if(m_asset != NULL)
return gAAL.getAssetLength(m_asset);
else if(m_fp != NULL) {
size_t offset = ftell(m_fp);
fseek(m_fp, 0, SEEK_END);
size_t len = ftell(m_fp);
fseek(m_fp, offset, SEEK_SET);
return len;
} else {
return 0;
}
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:13,代码来源:wyAssetInputStream_android.cpp
示例10: strerror
wyAssetInputStream_android::wyAssetInputStream_android(const char* path, bool isFile) :
wyAssetInputStream(path, isFile),
m_asset(NULL),
m_fp(NULL) {
if(isFile) {
// open file
if((m_fp = fopen(path, "rb")) == NULL) {
LOGW("open file %s failed: %s", path, strerror(errno));
m_fp = NULL;
}
} else {
m_asset = gAAL.getAsset(path);
}
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:14,代码来源:wyAssetInputStream_android.cpp
示例11: attachContext
void wyDirector_android::attachContext(wyGLContext context) {
if (m_context != context) {
// get env
JNIEnv* env = wyUtils::getJNIEnv();
// global init
globalInit(env);
// delete old reference
if(m_context != NULL) {
env->DeleteGlobalRef(m_context);
m_context = NULL;
}
// save context reference
if(context != NULL)
m_context = env->NewGlobalRef(context);
// setup sal
setupAAL();
// get resources
jobject res = env->CallObjectMethod(m_context, g_mid_Context_getResources);
// get display metrics
jobject dm = env->CallObjectMethod(res, g_mid_Resources_getDisplayMetrics);
env->DeleteLocalRef(res);
// set surface size
wyDevice::realWidth = env->GetIntField(dm, g_fid_DisplayMetrics_widthPixels);
wyDevice::realHeight = env->GetIntField(dm, g_fid_DisplayMetrics_heightPixels);
if(SCALE_MODE_BY_DENSITY == wyDevice::scaleMode) {
wyDevice::winWidth = wyDevice::realWidth;
wyDevice::winHeight = wyDevice::realHeight;
}
// save other parameters
wyDevice::density = env->GetFloatField(dm, g_fid_DisplayMetrics_density);
wyDevice::scaledDensity = env->GetFloatField(dm, g_fid_DisplayMetrics_scaledDensity);
// set density to aal
if(gAAL.setDensity)
gAAL.setDensity(wyDevice::density);
// delete display metrics ref
env->DeleteLocalRef(dm);
}
}
开发者ID:nbolabs,项目名称:WiEngine,代码行数:48,代码来源:wyDirector_android.cpp
示例12: setupAAL
void wyDirector_android::setupAAL() {
JNIEnv* env = wyUtils::getJNIEnv();
if(env != NULL) {
// get package name
jstring pkg = (jstring)env->CallObjectMethod(m_context, g_mid_Context_getPackageName);
// build lib path
const char* cPkg = env->GetStringUTFChars(pkg, NULL);
// open android adapter layer so
char buf[128];
if(wyDevice::apiLevel > 15) {
sprintf(buf, "/data/data/%s/lib/libaal_jellybean.so", cPkg);
} else if(wyDevice::apiLevel > 10) {
sprintf(buf, "/data/data/%s/lib/libaal_honeycomb.so", cPkg);
} else {
sprintf(buf, "/data/data/%s/lib/libaal.so", cPkg);
}
sAALHandler = dlopen(buf, RTLD_LAZY);
// release pkg
env->ReleaseStringUTFChars(pkg, cPkg);
// if failed to open sal in app data folder, try find them in system lib
if(!sAALHandler) {
if(wyDevice::apiLevel > 15) {
sprintf(buf, "/system/lib/libaal_jellybean.so");
} else if(wyDevice::apiLevel > 10) {
sprintf(buf, "/system/lib/libaal_honeycomb.so");
} else {
sprintf(buf, "/system/lib/libaal.so");
}
sAALHandler = dlopen(buf, RTLD_LAZY);
}
// check
if (!sAALHandler) {
LOGE("Cannot open android adapter layer");
exit(1);
}
// find functions
gAAL.scaleImage = (scaleImageFunc)dlsym(sAALHandler, "scaleImage");
if(gAAL.scaleImage == NULL) {
LOGE("Cannot load symbol 'scaleImage'");
dlclose(sAALHandler);
exit(1);
}
gAAL.scalePVR = (scalePVRFunc)dlsym(sAALHandler, "scalePVR");
if(gAAL.scalePVR == NULL) {
LOGE("Cannot load symbol 'scalePVR'");
dlclose(sAALHandler);
exit(1);
}
gAAL.calculateTextSizeWithFont = (calculateTextSizeWithFontFunc)dlsym(sAALHandler, "calculateTextSizeWithFont");
if(gAAL.calculateTextSizeWithFont == NULL) {
LOGE("Cannot load symbol 'calculateTextSizeWithFont'");
dlclose(sAALHandler);
exit(1);
}
gAAL.calculateTextSizeWithCustomFont = (calculateTextSizeWithCustomFontFunc)dlsym(sAALHandler, "calculateTextSizeWithCustomFont");
if(gAAL.calculateTextSizeWithCustomFont == NULL) {
LOGE("Cannot load symbol 'calculateTextSizeWithCustomFont'");
dlclose(sAALHandler);
exit(1);
}
gAAL.createLabelBitmapWithFont = (createLabelBitmapWithFontFunc)dlsym(sAALHandler, "createLabelBitmapWithFont");
if(gAAL.createLabelBitmapWithFont == NULL) {
LOGE("Cannot load symbol 'createLabelBitmapWithFont'");
dlclose(sAALHandler);
exit(1);
}
gAAL.createLabelBitmapWithCustomFont = (createLabelBitmapWithCustomFontFunc)dlsym(sAALHandler, "createLabelBitmapWithCustomFont");
if(gAAL.createLabelBitmapWithCustomFont == NULL) {
LOGE("Cannot load symbol 'createLabelBitmapWithCustomFont'");
dlclose(sAALHandler);
exit(1);
}
gAAL.deinit = (deinitFunc)dlsym(sAALHandler, "deinit");
if(gAAL.deinit == NULL) {
LOGE("Cannot load symbol 'deinit'");
dlclose(sAALHandler);
exit(1);
}
gAAL.setEnv = (setEnvFunc)dlsym(sAALHandler, "setEnv");
if(gAAL.setEnv == NULL) {
LOGE("Cannot load symbol 'setEnv'");
dlclose(sAALHandler);
exit(1);
}
gAAL.setContext = (setContextFunc)dlsym(sAALHandler, "setContext");
if(gAAL.setContext == NULL) {
LOGE("Cannot load symbol 'setContext'");
dlclose(sAALHandler);
exit(1);
}
gAAL.setDensity = (setDensityFunc)dlsym(sAALHandler, "setDensity");
if(gAAL.setDensity == NULL) {
LOGE("Cannot load symbol 'setDensity'");
dlclose(sAALHandler);
//.........这里部分代码省略.........
开发者ID:nbolabs,项目名称:WiEngine,代码行数:101,代码来源:wyDirector_android.cpp
示例13: commonDestroy
wyDirector_android::~wyDirector_android() {
// if background running is enabled
if(m_allowBackgroundRunning) {
pthread_mutex_lock(&gCondMutex);
if(m_backgroundRunning) {
if(pthread_cond_init(&sBackgroundLooperCond, NULL) == 0) {
m_backgroundRunning = false;
pthread_cond_wait(&sBackgroundLooperCond, &gCondMutex);
pthread_cond_destroy(&sBackgroundLooperCond);
}
}
pthread_mutex_unlock(&gCondMutex);
}
// call gl view
JNIEnv* env = wyUtils::getJNIEnv();
if(env != NULL) {
if(m_glView != NULL) {
if(!m_paused)
env->CallVoidMethod(m_glView, g_mid_WYGLSurfaceView_onPause);
env->DeleteGlobalRef(m_glView);
m_glView = NULL;
}
}
// if resource decoder is set, check whether it is wyJavaResourceDecoder
if(gResDecoder) {
wyJavaResourceDecoder* jrd = dynamic_cast<wyJavaResourceDecoder*>(gResDecoder);
if(jrd)
delete jrd;
}
// common destroy
commonDestroy();
// release listener
wyArrayEach(m_jLifecycleListeners, j_releaseListener, NULL);
wyArrayDestroy(m_jLifecycleListeners);
// deinit aal
if(gAAL.deinit)
gAAL.deinit();
// delete context ref
if(env != NULL) {
if(m_context != NULL) {
env->DeleteGlobalRef(m_context);
m_context = NULL;
}
}
// global deinit
globalDeInit(env);
// unload sal lib
if(sAALHandler != NULL) {
/*
* 不要close这个东西, 可能是因为android底层有什么bug, 导致重复载入卸载45
* 次之后就会出现问题. 而android上的dlopen又不支持RTLD_NODELETE这个flag,
* 所以只能不close它, 就没事了
*/
// dlclose(sAALHandler);
sAALHandler = NULL;
}
// nullify gVM
gVM = NULL;
// free my self
gDirector = NULL;
}
开发者ID:nbolabs,项目名称:WiEngine,代码行数:71,代码来源:wyDirector_android.cpp
示例14:
wyAssetInputStream_android::wyAssetInputStream_android(int resId) :
wyAssetInputStream(resId),
m_asset(NULL),
m_fp(NULL) {
m_asset = gAAL.getAssetByResId(resId, NULL);
}
开发者ID:Adoni,项目名称:WiEngine,代码行数:6,代码来源:wyAssetInputStream_android.cpp
注:本文中的wyAAL类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论