diff --git a/cocos2dx/include/ccTypes.h b/cocos2dx/include/ccTypes.h index 15d9704f1a..efccf070eb 100755 --- a/cocos2dx/include/ccTypes.h +++ b/cocos2dx/include/ccTypes.h @@ -305,22 +305,6 @@ typedef struct _ccBlendFunc GLenum dst; } ccBlendFunc; -//! ccResolutionType -typedef enum -{ - //! Unknonw resolution type - kCCResolutionUnknown, - //! iPhone resolution type - kCCResolutioniPhone, - //! RetinaDisplay resolution type - kCCResolutioniPhoneRetinaDisplay, - //! iPad resolution type - kCCResolutioniPad, - //! iPad Retina Display resolution type - kCCResolutioniPadRetinaDisplay, - -} ccResolutionType; - // XXX: If any of these enums are edited and/or reordered, udpate CCTexture2D.m //! Vertical text alignment type typedef enum diff --git a/cocos2dx/label_nodes/CCLabelTTF.cpp b/cocos2dx/label_nodes/CCLabelTTF.cpp index 14953f500f..ca20749884 100644 --- a/cocos2dx/label_nodes/CCLabelTTF.cpp +++ b/cocos2dx/label_nodes/CCLabelTTF.cpp @@ -293,32 +293,6 @@ void CCLabelTTF::updateTexture() m_pFontName->c_str(), m_fFontSize * CC_CONTENT_SCALE_FACTOR()); } - - // iPad ? - //if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) { - if (CCApplication::sharedApplication().isIpad()) - { - if (CC_CONTENT_SCALE_FACTOR() == 2) - { - tex->setResolutionType(kCCResolutioniPadRetinaDisplay); - } - else - { - tex->setResolutionType(kCCResolutioniPad); - } - } - // iPhone ? - else - { - if (CC_CONTENT_SCALE_FACTOR() == 2) - { - tex->setResolutionType(kCCResolutioniPhoneRetinaDisplay); - } - else - { - tex->setResolutionType(kCCResolutioniPhone); - } - } this->setTexture(tex); tex->release(); diff --git a/cocos2dx/platform/CCFileUtils.h b/cocos2dx/platform/CCFileUtils.h index d1457ab663..0efa5e3c64 100644 --- a/cocos2dx/platform/CCFileUtils.h +++ b/cocos2dx/platform/CCFileUtils.h @@ -62,16 +62,6 @@ public: */ unsigned char* getFileDataFromZip(const char* pszZipFilePath, const char* pszFileName, unsigned long * pSize); - /** removes the suffix from a path - * On RetinaDisplay it will remove the -hd suffix - * On iPad it will remove the -ipad suffix - * On iPhone it will remove the (empty) suffix - Only valid on iOS. Not valid for OS X. - - @since v0.99.5 - */ - std::string& removeSuffixFromFile(std::string& path); - /** @brief Generate the absolute path of the file. @param pszRelativePath The relative path of the file. @@ -82,68 +72,10 @@ public: */ const char* fullPathFromRelativePath(const char *pszRelativePath); - /** Returns the fullpath of an filename including the resolution of the image. - - If in RetinaDisplay mode, and a RetinaDisplay file is found, it will return that path. - If in iPad mode, and an iPad file is found, it will return that path. - - Examples: - - * In iPad mode: "image.png" -> "/full/path/image-ipad.png" (in case the -ipad file exists) - * In RetinaDisplay mode: "image.png" -> "/full/path/image-hd.png" (in case the -hd file exists) - - If an iPad file is found, it will set resolution type to kCCResolutioniPad - If a RetinaDisplay file is found, it will set resolution type to kCCResolutionRetinaDisplay - - */ - const char* fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType); - /// @cond const char* fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile); /// @endcond - /** Sets the iPhone RetinaDisplay suffix to load resources. - By default it is "-hd". - Only valid on iOS. Not valid for OS X. - - @since v1.1 - */ - void setiPhoneRetinaDisplaySuffix(const char *suffix); - - /** Sets the iPad suffix to load resources. - By default it is "". - Only valid on iOS. Not valid for OS X. - - - */ - void setiPadSuffix(const char *suffix); - - /** Sets the iPad Retina Display suffix to load resources. - By default it is "-ipadhd". - Only valid on iOS. Not valid for OS X. - - @since v1.1 - */ - void setiPadRetinaDisplaySuffix(const char *suffix); - - /** Returns whether or not a given filename exists with the iPad suffix. - Only available on iOS. Not supported on OS X. - @since v1.1 - */ - bool iPadFileExistsAtPath(const char *filename); - - /** Returns whether or not a given filename exists with the iPad RetinaDisplay suffix. - Only available on iOS. Not supported on OS X. - @since v2.0 - */ - bool iPadRetinaDisplayFileExistsAtPath(const char *filename); - - /** Returns whether or not a given path exists with the iPhone RetinaDisplay suffix. - Only available on iOS. Not supported on OS X. - @since v1.1 - */ - bool iPhoneRetinaDisplayFileExistsAtPath(const char *filename); - /** @brief Set the ResourcePath,we will find resource relative to this path @param pszResourcePath Relative path to root diff --git a/cocos2dx/platform/CCFileUtilsCommon_cpp.h b/cocos2dx/platform/CCFileUtilsCommon_cpp.h index 11e95f6a4d..631198c047 100644 --- a/cocos2dx/platform/CCFileUtilsCommon_cpp.h +++ b/cocos2dx/platform/CCFileUtilsCommon_cpp.h @@ -42,10 +42,6 @@ THE SOFTWARE. NS_CC_BEGIN -static const char *__suffixiPhoneRetinaDisplay = "-hd"; -static const char *__suffixiPad = "-ipad"; -static const char *__suffixiPadRetinaDisplay = "-ipadhd"; - typedef enum { SAX_NONE = 0, @@ -322,27 +318,6 @@ public: } }; -std::string& CCFileUtils::removeSuffixFromFile(std::string& path) -{ - // XXX win32 now can only support iphone retina, because - // we don't know it is ipad retina or iphone retina. - // fixe me later - if( CC_CONTENT_SCALE_FACTOR() == 2 ) - { - std::string::size_type pos = path.rfind("/") + 1; // the begin index of last part of path - - std::string::size_type suffixPos = path.rfind(__suffixiPhoneRetinaDisplay); - if (std::string::npos != suffixPos && suffixPos > pos) - { - CCLog("cocos2d: FilePath(%s) contains suffix(%s), remove it.", path.c_str(), - __suffixiPhoneRetinaDisplay); - path.replace(suffixPos, strlen(__suffixiPhoneRetinaDisplay), ""); - } - } - - return path; -} - CCDictionary* ccFileUtils_dictionaryWithContentsOfFileThreadSafe(const char *pFileName) { CCDictMaker tMaker; @@ -397,47 +372,6 @@ unsigned char* CCFileUtils::getFileDataFromZip(const char* pszZipFilePath, const return pBuffer; } - -const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath) -{ - ccResolutionType ignore; - return fullPathFromRelativePath(pszRelativePath, &ignore); -} - -/// functions iOS specific -void CCFileUtils::setiPhoneRetinaDisplaySuffix(const char *suffix) -{ - CCAssert(0, "not implement"); -} - -void CCFileUtils::setiPadSuffix(const char *suffix) -{ - CCAssert(0, "not implement"); -} - -void CCFileUtils::setiPadRetinaDisplaySuffix(const char *suffix) -{ - CCAssert(0, "not implement"); -} - -bool CCFileUtils::iPadFileExistsAtPath(const char *filename) -{ - CCAssert(0, "not implement"); - return false; -} - -bool CCFileUtils::iPadRetinaDisplayFileExistsAtPath(const char *filename) -{ - CCAssert(0, "not implement"); - return false; -} - -bool CCFileUtils::iPhoneRetinaDisplayFileExistsAtPath(const char *filename) -{ - CCAssert(0, "not implement"); - return false; -} - void CCFileUtils::setResourceDirectory(const char* pszResourceDirectory) { m_obDirectory = pszResourceDirectory; diff --git a/cocos2dx/platform/android/CCFileUtils.cpp b/cocos2dx/platform/android/CCFileUtils.cpp index 43a86547ec..680a591f7d 100644 --- a/cocos2dx/platform/android/CCFileUtils.cpp +++ b/cocos2dx/platform/android/CCFileUtils.cpp @@ -63,8 +63,7 @@ void CCFileUtils::purgeCachedEntries() } -const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath, - ccResolutionType *pResolutionType) +const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath) { return pszRelativePath; } @@ -92,9 +91,18 @@ unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* psz if (pszFileName[0] != '/') { // read from apk + string pathWithoutDirectory = fullPath; + fullPath.insert(0, m_obDirectory.c_str()); fullPath.insert(0, "assets/"); pData = CCFileUtils::getFileDataFromZip(s_strResourcePath.c_str(), fullPath.c_str(), pSize); + + if (! pData && m_obDirectory.size() > 0) + { + // search from root + pathWithoutDirectory.insert(0, "assets/"); + pData = CCFileUtils::getFileDataFromZip(s_strResourcePath.c_str(), pathWithoutDirectory.c_str(), pSize); + } } else { diff --git a/cocos2dx/platform/ios/CCFileUtils.mm b/cocos2dx/platform/ios/CCFileUtils.mm index 71b86770c8..ec6745c0f4 100644 --- a/cocos2dx/platform/ios/CCFileUtils.mm +++ b/cocos2dx/platform/ios/CCFileUtils.mm @@ -44,9 +44,7 @@ USING_NS_CC; static void static_addValueToCCDict(id key, id value, CCDictionary* pDict); static void static_addItemToCCArray(id item, CCArray* pArray); -static NSString *__suffixiPhoneRetinaDisplay =@"-hd"; -static NSString *__suffixiPad =@"-ipad"; -static NSString *__suffixiPadRetinaDisplay =@"-ipadhd"; + static NSFileManager *__localFileManager= [[NSFileManager alloc] init]; static NSString* removeSuffixFromPath(NSString *suffix, NSString *path) @@ -243,57 +241,6 @@ void CCFileUtils::setResourceDirectory(const char *pszDirectoryName) m_obDirectory = pszDirectoryName; } -std::string& CCFileUtils::removeSuffixFromFile(std::string& cpath ) -{ - NSString *ret = nil; - NSString *path = [NSString stringWithUTF8String:cpath.c_str()]; - - if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) - { - if( CC_CONTENT_SCALE_FACTOR() == 2 ) - { - ret = removeSuffixFromPath(__suffixiPadRetinaDisplay, path); - } - else - { - ret = removeSuffixFromPath(__suffixiPad, path); - } - } - else - { - if( CC_CONTENT_SCALE_FACTOR() == 2 ) - { - ret = removeSuffixFromPath(__suffixiPhoneRetinaDisplay, [NSString stringWithUTF8String:cpath.c_str()]); - } - else - { - ret = path; - } - } - - - cpath = [ret UTF8String]; - return cpath; -} - -void CCFileUtils::setiPhoneRetinaDisplaySuffix(const char *suffix) -{ - [__suffixiPhoneRetinaDisplay release]; - __suffixiPhoneRetinaDisplay = [[NSString stringWithUTF8String:suffix] retain]; -} - -void CCFileUtils::setiPadSuffix(const char *suffix) -{ - [__suffixiPad release]; - __suffixiPad = [[NSString stringWithUTF8String:suffix] retain]; -} - -void CCFileUtils::setiPadRetinaDisplaySuffix(const char *suffix) -{ - [__suffixiPadRetinaDisplay release]; - __suffixiPadRetinaDisplay = [[NSString stringWithUTF8String:suffix] retain]; -} - bool fileExistsAtPath(const char *cpath, const char *csuffix) { NSString *fullpath = nil; @@ -320,92 +267,41 @@ bool fileExistsAtPath(const char *cpath, const char *csuffix) return ( path != nil ); } -bool CCFileUtils::iPhoneRetinaDisplayFileExistsAtPath(const char *cpath) -{ - return fileExistsAtPath(cpath, [__suffixiPhoneRetinaDisplay UTF8String]); -} - -bool CCFileUtils::iPadFileExistsAtPath(const char *cpath) -{ - return fileExistsAtPath(cpath, [__suffixiPad UTF8String]); -} - -bool CCFileUtils::iPadRetinaDisplayFileExistsAtPath(const char *cpath) -{ - return fileExistsAtPath(cpath, [__suffixiPadRetinaDisplay UTF8String]); -} - const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath) -{ - ccResolutionType ignore; - return fullPathFromRelativePath(pszRelativePath, &ignore); -} - -const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType) { CCAssert(pszRelativePath != NULL, "CCFileUtils: Invalid path"); - + NSString *fullpath = nil; NSString *relPath = [NSString stringWithUTF8String:pszRelativePath]; - + // only if it is not an absolute path if( ! [relPath isAbsolutePath] ) { - + // pathForResource also searches in .lproj directories. issue #1230 NSString *file = [relPath lastPathComponent]; NSMutableString *imageDirectory = [NSMutableString stringWithUTF8String:m_obDirectory.c_str()]; - [imageDirectory appendString:[relPath stringByDeletingLastPathComponent]]; - //NSString *imageDirectory = [relPath stringByDeletingLastPathComponent]; - + NSMutableString *imageDirectoryWithDirectory = imageDirectory; + [imageDirectoryWithDirectory appendString:[relPath stringByDeletingLastPathComponent]]; + + // search path from directory set by setResourceDirectory fullpath = [[NSBundle mainBundle] pathForResource:file - ofType:nil - inDirectory:imageDirectory]; - - + ofType:nil + inDirectory:imageDirectoryWithDirectory]; + if (fullpath == nil) + { + // search from root directory + fullpath = [[NSBundle mainBundle] pathForResource:file + ofType:nil + inDirectory:imageDirectory]; + } } - + if (fullpath == nil) { fullpath = relPath; } - /* - - NSString *ret = nil; - - // iPad? - if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) - { - // Retina Display ? - if( CC_CONTENT_SCALE_FACTOR() == 2 ) { - ret = getPathForSuffix(fullpath, __suffixiPadRetinaDisplay); - *pResolutionType = kCCResolutioniPadRetinaDisplay; - } - else - { - ret = getPathForSuffix(fullpath, __suffixiPad); - *pResolutionType = kCCResolutioniPad; - } - } - // iPhone ? - else - { - // Retina Display ? - if( CC_CONTENT_SCALE_FACTOR() == 2 ) { - ret = getPathForSuffix(fullpath, __suffixiPhoneRetinaDisplay); - *pResolutionType = kCCResolutioniPhoneRetinaDisplay; - } - } - - // If it is iPhone Non RetinaDisplay, or if the previous "getPath" failed, then use iPhone images. - if( ret == nil ) - { - *pResolutionType = kCCResolutioniPhone; - ret = fullpath; - } - */ - return [fullpath UTF8String]; } diff --git a/cocos2dx/platform/win32/CCEGLView.cpp b/cocos2dx/platform/win32/CCEGLView.cpp index b387f5da31..e10f5539aa 100644 --- a/cocos2dx/platform/win32/CCEGLView.cpp +++ b/cocos2dx/platform/win32/CCEGLView.cpp @@ -397,7 +397,7 @@ void CCEGLView::resize(int width, int height) rcClient.bottom - rcClient.top, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER); } -void CCEGLView::setFrameSize(float width, float height) +void CCEGLView::setSize(float width, float height) { Create((LPCTSTR)m_szViewName, (int)width, (int)height); CCEGLViewProtocol::setFrameSize(width, height); @@ -435,16 +435,13 @@ void CCEGLView::centerWindow() SetWindowPos(m_hWnd, 0, offsetX, offsetY, 0, 0, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER); } -bool CCEGLView::canSetContentScaleFactor() -{ - return true; -} - -void CCEGLView::setContentScaleFactor(float contentScaleFactor) +bool CCEGLView::setContentScaleFactor(float contentScaleFactor) { CCEGLViewProtocol::setContentScaleFactor(contentScaleFactor); resize((int)(m_sSizeInPixel.width * contentScaleFactor), (int)(m_sSizeInPixel.height * contentScaleFactor)); centerWindow(); + + return true } CCEGLView& CCEGLView::sharedOpenGLView() diff --git a/cocos2dx/platform/win32/CCEGLView.h b/cocos2dx/platform/win32/CCEGLView.h index 1fdddce4e7..88104b8e94 100644 --- a/cocos2dx/platform/win32/CCEGLView.h +++ b/cocos2dx/platform/win32/CCEGLView.h @@ -44,9 +44,8 @@ public: virtual bool isOpenGLReady(); virtual void end(); virtual void swapBuffers(); - virtual bool canSetContentScaleFactor(); - virtual void setContentScaleFactor(float contentScaleFactor); - virtual void setFrameSize(float width, float height); + virtual bool setContentScaleFactor(float contentScaleFactor); + virtual void setSize(float width, float height); virtual void setIMEKeyboardState(bool bOpen); private: diff --git a/cocos2dx/platform/win32/CCFileUtils.cpp b/cocos2dx/platform/win32/CCFileUtils.cpp index 9a57cd49ff..09b7bcf9a8 100644 --- a/cocos2dx/platform/win32/CCFileUtils.cpp +++ b/cocos2dx/platform/win32/CCFileUtils.cpp @@ -83,7 +83,7 @@ void CCFileUtils::setResourcePath(const char *pszResourcePath) strcpy(s_pszResourcePath, pszResourcePath); } -const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType) +const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath) { _CheckPath(); diff --git a/cocos2dx/textures/CCTexture2D.cpp b/cocos2dx/textures/CCTexture2D.cpp index 4916e0bb57..94d49e1e18 100644 --- a/cocos2dx/textures/CCTexture2D.cpp +++ b/cocos2dx/textures/CCTexture2D.cpp @@ -235,7 +235,6 @@ bool CCTexture2D::initWithData(const void *data, CCTexture2DPixelFormat pixelFor m_bHasPremultipliedAlpha = false; m_bHasMipmaps = false; - m_eResolutionType = kCCResolutionUnknown; setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTexture)); return true; @@ -250,11 +249,6 @@ const char* CCTexture2D::description(void) // implementation CCTexture2D (Image) bool CCTexture2D::initWithImage(CCImage *uiImage) -{ - return initWithImage(uiImage, kCCResolutionUnknown); -} - -bool CCTexture2D::initWithImage(CCImage * uiImage, ccResolutionType resolution) { if (uiImage == NULL) { @@ -267,7 +261,7 @@ bool CCTexture2D::initWithImage(CCImage * uiImage, ccResolutionType resolution) unsigned int imageHeight = uiImage->getHeight(); CCConfiguration *conf = CCConfiguration::sharedConfiguration(); - + unsigned maxTextureSize = conf->getMaxTextureSize(); if (imageWidth > maxTextureSize || imageHeight > maxTextureSize) { @@ -275,12 +269,11 @@ bool CCTexture2D::initWithImage(CCImage * uiImage, ccResolutionType resolution) this->release(); return NULL; } - - m_eResolutionType = resolution; - + // always load premultiplied images return initPremultipliedATextureWithImage(uiImage, imageWidth, imageHeight); } + bool CCTexture2D::initPremultipliedATextureWithImage(CCImage *image, unsigned int width, unsigned int height) { unsigned char* tempData = image->getData(); diff --git a/cocos2dx/textures/CCTexture2D.h b/cocos2dx/textures/CCTexture2D.h index 1c3810eb8c..9c8370b88f 100644 --- a/cocos2dx/textures/CCTexture2D.h +++ b/cocos2dx/textures/CCTexture2D.h @@ -134,8 +134,6 @@ public: bool initWithImage(CCImage * uiImage); - bool initWithImage(CCImage *uiImage, ccResolutionType resolution); - /** Initializes a texture from a string with dimensions, alignment, font name and font size */ bool initWithString(const char *text, const CCSize& dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment, const char *fontName, float fontSize); /** Initializes a texture from a string with font name and font size */ @@ -273,17 +271,6 @@ private: /** shader program used by drawAtPoint and drawInRect */ CC_PROPERTY(CCGLProgram*, m_pShaderProgram, ShaderProgram); - - - /** Returns the resolution type of the texture. - Is it a RetinaDisplay texture, an iPad texture or an standard texture ? - Only valid on iOS. Not valid on OS X. - - Should be a readonly property. It is readwrite as a hack. - - @since v1.1 - */ - CC_SYNTHESIZE(ccResolutionType, m_eResolutionType, ResolutionType); }; // end of textures group diff --git a/cocos2dx/textures/CCTextureCache.cpp b/cocos2dx/textures/CCTextureCache.cpp index 9945dab479..99ad1b20ef 100644 --- a/cocos2dx/textures/CCTextureCache.cpp +++ b/cocos2dx/textures/CCTextureCache.cpp @@ -257,7 +257,6 @@ void CCTextureCache::addImageAsync(const char *path, CCObject *target, SEL_CallF // optimization std::string pathKey = path; - CCFileUtils::sharedFileUtils()->removeSuffixFromFile(pathKey); pathKey = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pathKey.c_str()); texture = (CCTexture2D*)m_pTextures->objectForKey(pathKey.c_str()); @@ -400,8 +399,6 @@ CCTexture2D * CCTextureCache::addImage(const char * path) // remove possible -HD suffix to prevent caching the same image twice (issue #1040) std::string pathKey = path; - ccResolutionType resolution = kCCResolutionUnknown; - CCFileUtils::sharedFileUtils()->removeSuffixFromFile(pathKey); pathKey = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pathKey.c_str()); texture = (CCTexture2D*)m_pTextures->objectForKey(pathKey.c_str()); @@ -446,7 +443,7 @@ CCTexture2D * CCTextureCache::addImage(const char * path) texture = new CCTexture2D(); if( texture && - texture->initWithImage(&image, resolution) ) + texture->initWithImage(&image) ) { #if CC_ENABLE_CACHE_TEXTURE_DATA // cache the texture file name @@ -477,7 +474,6 @@ CCTexture2D* CCTextureCache::addPVRTCImage(const char* path, int bpp, bool hasAl CCTexture2D * texture; std::string temp(path); - CCFileUtils::sharedFileUtils()->removeSuffixFromFile(temp); if ( (texture = (CCTexture2D*)m_pTextures->objectForKey(temp.c_str())) ) { @@ -514,8 +510,6 @@ CCTexture2D * CCTextureCache::addPVRImage(const char* path) CCTexture2D* texture = NULL; std::string key(path); - // remove possible -HD suffix to prevent caching the same image twice (issue #1040) - CCFileUtils::sharedFileUtils()->removeSuffixFromFile(key); if( (texture = (CCTexture2D*)m_pTextures->objectForKey(key.c_str())) ) { @@ -568,7 +562,7 @@ CCTexture2D* CCTextureCache::addUIImage(CCImage *image, const char *key) // prevents overloading the autorelease pool texture = new CCTexture2D(); - texture->initWithImage(image, kCCResolutionUnknown); + texture->initWithImage(image); if(key && texture) { @@ -890,8 +884,7 @@ void VolatileTexture::reloadAllTextures() break; case kImage: { - vt->texture->initWithImage(vt->uiImage, - kCCResolutionUnknown); + vt->texture->initWithImage(vt->uiImage); } break; default: diff --git a/samples/HelloLua/proj.android/jni/hellolua/main.cpp b/samples/HelloLua/proj.android/jni/hellolua/main.cpp index 7c8321c204..033ec82421 100644 --- a/samples/HelloLua/proj.android/jni/hellolua/main.cpp +++ b/samples/HelloLua/proj.android/jni/hellolua/main.cpp @@ -24,9 +24,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi if (!CCDirector::sharedDirector()->getOpenGLView()) { CCEGLView *view = &CCEGLView::sharedOpenGLView(); - view->setFrameSize(w, h); - // set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line. - view->setDesignResolutionSize(480, 320); + view->setSize(w, h); AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication().run(); diff --git a/samples/TestCpp/proj.android/jni/testcpp/main.cpp b/samples/TestCpp/proj.android/jni/testcpp/main.cpp index d61d2d009a..21b56b9156 100644 --- a/samples/TestCpp/proj.android/jni/testcpp/main.cpp +++ b/samples/TestCpp/proj.android/jni/testcpp/main.cpp @@ -25,9 +25,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi if (!CCDirector::sharedDirector()->getOpenGLView()) { CCEGLView *view = &CCEGLView::sharedOpenGLView(); - view->setFrameSize(w, h); - // set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line. - view->setDesignResolutionSize(480, 320, kResolutionScaleFullScreen); + view->setSize(w, h); AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication().run(); diff --git a/samples/TestJavascript/proj.android/jni/testjavascript/main.cpp b/samples/TestJavascript/proj.android/jni/testjavascript/main.cpp index 42c1458559..b326bf94e1 100644 --- a/samples/TestJavascript/proj.android/jni/testjavascript/main.cpp +++ b/samples/TestJavascript/proj.android/jni/testjavascript/main.cpp @@ -25,9 +25,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi if (!CCDirector::sharedDirector()->getOpenGLView()) { CCEGLView *view = &CCEGLView::sharedOpenGLView(); - view->setFrameSize(w, h); - // set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line. - // view->setDesignResolutionSize(480, 320); + view->setSize(w, h); AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication().run();