bool CCTexturePNG::load(const char *path, const CCResourceType resourceType, const bool generateMipMap) { #if defined PROFILEON CCProfiler profile( "CCTexturePNG::load()" ); #endif CCText filename = path; filename.stripDirectory(); filename.toLowercase(); glName = JniLoad( filename.buffer, resourceType == Resource_Packaged, generateMipMap ); if( glName > 0 ) { allocatedWidth = imageWidth = JniGetImageWidth(); imageHeight = JniGetImageHeight(); allocatedHeight = JniGetAllocatedHeight(); rawWidth = JniGetRawWidth(); rawHeight = JniGetRawHeight(); // TODO: pretend it's always 4 bytes on Android, look into getting actual pixel size data allocatedBytes = allocatedWidth * allocatedHeight * 4; return true; } return false; }
bool CCTexturePNG::DoesTextureExist(const char *path, const CCResourceType resourceType) { CCText filename = path; filename.stripDirectory(); filename.toLowercase(); return JniDoesTextureExist( filename.buffer, resourceType == Resource_Packaged ); }
void CCJNI::BillingRequestPurchase(const char *productID, CCLambdaCallback *callback) { if( billingCallback != NULL ) { delete billingCallback; } billingCallback = callback; CCText androidProductID = productID; androidProductID.toLowercase(); // JNI Java call JNIEnv *jEnv = gView->jniEnv; jclass jniClass = jEnv->FindClass( "com/android2c/CCJNI" ); ASSERT_MESSAGE( jniClass != 0, "Could not find Java class." ); // Get the method ID of our method "startVideoView", which takes one parameter of type string, and returns void static jmethodID mid = jEnv->GetStaticMethodID( jniClass, "BillingRequestPurchase", "(Ljava/lang/String;)V" ); ASSERT( mid != 0 ); // Call the function jstring javaURL = jEnv->NewStringUTF( androidProductID.buffer ); jEnv->CallStaticVoidMethod( jniClass, mid, javaURL ); //jEnv->DeleteLocalRef( javaURL ); }
const bool CCTexturePNG::load(const char *name, const CCResourceType resourceType, const bool generateMipMap) { #if defined PROFILEON CCProfiler profile( "CCTexturePNG::load()" ); #endif CCText filename = name; filename.stripDirectory(); filename.toLowercase(); glName = jniLoad( filename.buffer, generateMipMap, resourceType == Resource_Packaged ); if( glName > 0 ) { allocatedWidth = imageWidth = jniGetWidth(); allocatedHeight = imageHeight = jniGetHeight(); jniReleaseRawData(); return true; } return false; }