Merge pull request #1908 from minggo/master

fix some warnings
This commit is contained in:
minggo 2013-01-28 04:36:01 -08:00
commit 05363ee8dd
8 changed files with 27 additions and 21 deletions

View File

@ -13,7 +13,7 @@ cocos2d-2.1beta3-x-2.1.1 @Jan.29 2013
Bug #1680: fix a bug that can't set touch priority by invoking CCMenu::setTouchPriority()
Bug #1681: fix a bug that CCTableView crashes if CCTableViewDelegate is not provided
Feature #1598: add japanese language support
Feature #1625: add stackable action support and exchang the order of parameters for 3d relative actions
Feature #1625: add stackable action support and exchange the order of parameters for 3d relative actions
Feature #1667: add file name lookup support
Refactor #1593: remove all deprecated methods
Refactor #1599: do some improvements of CCScrollView and CCTableView
@ -44,7 +44,7 @@ cocos2d-2.1beta3-x-2.1.1 @Jan.29 2013
[marmalade]
Bug #1631: make SimpleGame force landscape
Refactor #1629: add marmalade third party cleanup
Refactor #1630: add TestLua postbuilt script
Refactor #1630: add TestLua post-build script
Refactor #1632: remove grskia dependency and add in freetype support to the builds.
[linux]
Feature #1611: add lua support

View File

@ -564,7 +564,7 @@ CCImage::~CCImage()
bool CCImage::initWithImageFile(const char * strPath, EImageFormat eImgFmt/* = eFmtPng*/)
{
std::string strTemp = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(strPath);
std::string strTemp = CCFileUtils::sharedFileUtils()->fullPathForFilename(strPath);
if (m_bEnabledScale)
{
if (!isFileExists(strTemp.c_str()))

View File

@ -1,8 +1,13 @@
#include "AppDelegate.h"
#include <vector>
#include <string>
#include "HelloWorldScene.h"
#include "AppMacros.h"
USING_NS_CC;
using namespace std;
AppDelegate::AppDelegate() {
@ -23,6 +28,8 @@ bool AppDelegate::applicationDidFinishLaunching() {
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
CCSize frameSize = pEGLView->getFrameSize();
vector<string> searchPath;
// In this demo, we select resource according to the frame's height.
// If the resource size is different from design resolution size, you need to set contentScaleFactor.
@ -31,22 +38,28 @@ bool AppDelegate::applicationDidFinishLaunching() {
// if the frame's height is larger than the height of medium resource size, select large resource.
if (frameSize.height > mediumResource.size.height)
{
CCFileUtils::sharedFileUtils()->setResourceDirectory(largeResource.directory);
{
searchPath.push_back(largeResource.directory);
pDirector->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height, largeResource.size.width/designResolutionSize.width));
}
// if the frame's height is larger than the height of small resource size, select medium resource.
else if (frameSize.height > smallResource.size.height)
{
CCFileUtils::sharedFileUtils()->setResourceDirectory(mediumResource.directory);
{
searchPath.push_back(mediumResource.directory);
pDirector->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height, mediumResource.size.width/designResolutionSize.width));
}
// if the frame's height is smaller than the height of medium resource size, select small resource.
else
{
CCFileUtils::sharedFileUtils()->setResourceDirectory(smallResource.directory);
{
searchPath.push_back(smallResource.directory);
pDirector->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width));
}
// set searching path
CCFileUtils::sharedFileUtils()->setSearchPath(searchPath);
// turn on display FPS
pDirector->setDisplayStats(true);

View File

@ -175,15 +175,15 @@ void Box2DTestLayer::addNewSpriteAtPosition(CCPoint p)
fixtureDef.shape = &dynamicBox;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.3f;
body->CreateFixture(&fixtureDef);
body->CreateFixture(&fixtureDef);
#if CC_ENABLE_BOX2D_INTEGRATION
CCNode *parent = this->getChildByTag(kTagParentNode);
//We have a 64x64 sprite sheet with 4 different 32x32 images. The following code is
//just randomly picking one of the images
int idx = (CCRANDOM_0_1() > .5 ? 0:1);
int idy = (CCRANDOM_0_1() > .5 ? 0:1);
#if CC_ENABLE_BOX2D_INTEGRATION
CCPhysicsSprite *sprite = CCPhysicsSprite::createWithTexture(m_pSpriteTexture,CCRectMake(32 * idx,32 * idy,32,32));
parent->addChild(sprite);
sprite->setB2Body(body);

View File

@ -151,8 +151,6 @@ void BugsTestBaseLayer::onEnter()
{
CCLayer::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCMenuItemFont::setFontName("Arial");
CCMenuItemFont::setFontSize(24);
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", this,

View File

@ -248,7 +248,6 @@ class JumpTiles3DDemo : public CCJumpTiles3D
public:
static CCActionInterval* create(float t)
{
CCSize size = CCDirector::sharedDirector()->getWinSize();
return CCJumpTiles3D::create(t, CCSizeMake(15,10), 2, 30);
}
};

View File

@ -445,9 +445,7 @@ Atlas3::Atlas3()
// testing anchors
label3->setAnchorPoint( ccp(1,1) );
addChild(label3, 0, kTagBitmapAtlas3);
CCSize s = CCDirector::sharedDirector()->getWinSize();
label1->setPosition( VisibleRect::leftBottom() );
label2->setPosition( VisibleRect::center() );
label3->setPosition( VisibleRect::rightTop() );

View File

@ -92,8 +92,6 @@ void PerformBasicLayer::onEnter()
{
CCLayer::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCMenuItemFont::setFontName("Arial");
CCMenuItemFont::setFontSize(24);
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", this,