• Editor
  • Spine Scaling

Advice Please about Spine Scaling.
Look at this cocos2dx Project.
https://dl.dropboxusercontent.com/u/9304628/SpineScaleTest.zip

■AppDelegate.cpp

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();

CCSize designSize = CCSizeMake(320, 480);

if (screenSize.height > 480)
{
    CCSize resourceSize = CCSizeMake(640, 960);
    vector<string> searchPaths;
    searchPaths.push_back("hd");
    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
    pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
}
else
{
    // half
}

CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionShowAll);

pDirector->setDisplayStats(true);
pDirector->setAnimationInterval(1.0 / 60);

CCScene *pScene = HelloWorld::scene();
pDirector->runWithScene(pScene);

return true;
}

■HelloWorldScene.cpp

bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }

CCSkeletonAnimation* skeleton = CCSkeletonAnimation::createWithFile("spineboy.json", "spineboy.atlas", 0.5);
skeleton->setAnimation("walk", true);

CCSize windowSize = CCDirector::sharedDirector()->getWinSize();
CCLOG("%f, %f", windowSize.width, windowSize.height);
skeleton->setPosition(ccp(windowSize.width / 2, windowSize.height / 2 - 150));
skeleton->setTag(1234);
this->addChild(skeleton);

return true;
}

■Result[iOS]

Related Discussions
...
  • Изменено

Are you using the spine-cocos2dx from github? If you use the one packaged in cocos2dx then you need to ask the cocos2dx guys for support, as I don't keep track of what they change.

Thank you Nate.
Try using the spine-cocos2dx and Successful!