当前位置: 首页>>代码示例>>C++>>正文


C++ CCCamera::setCenterXYZ方法代码示例

本文整理汇总了C++中CCCamera::setCenterXYZ方法的典型用法代码示例。如果您正苦于以下问题:C++ CCCamera::setCenterXYZ方法的具体用法?C++ CCCamera::setCenterXYZ怎么用?C++ CCCamera::setCenterXYZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCCamera的用法示例。


在下文中一共展示了CCCamera::setCenterXYZ方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addChild

CameraZoomTest::CameraZoomTest()
{
    CCSize s = CCDirector::sharedDirector()->getWinSize();
    
    CCSprite *sprite;
    CCCamera *cam;
    
    // LEFT
    sprite = CCSprite::create(s_pPathGrossini);
    addChild( sprite, 0);        
    sprite->setPosition( ccp(s.width/4*1, s.height/2) );
    cam = sprite->getCamera();
    cam->setEyeXYZ(0, 0, 415/2);
    cam->setCenterXYZ(0, 0, 0);
    
    // CENTER
    sprite = CCSprite::create(s_pPathGrossini);
    addChild( sprite, 0, 40);
    sprite->setPosition(ccp(s.width/4*2, s.height/2));
    
    // RIGHT
    sprite = CCSprite::create(s_pPathGrossini);
    addChild( sprite, 0, 20);
    sprite->setPosition(ccp(s.width/4*3, s.height/2));

    m_z = 0;
    scheduleUpdate();
}
开发者ID:HongXiao,项目名称:Client-source,代码行数:28,代码来源:NodeTest.cpp

示例2: ccp

bool Recipe72::init()
{
    if ( !RecipeBase::init() )
    {
        return false;
    }
        
    CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Thonburi", 34);
    pLabel->setColor(ccBLACK);
    
    // ask director the window size
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    // position the label on the center of the screen
    pLabel->setPosition( ccp(size.width / 2, size.height - 20) );
    
    // add the label as a child to this layer
    this->addChild(pLabel, 1);
    
    // add "HelloWorld" splash screen"
    CCSprite* pSprite = CCSprite::create("HelloWorld.png");
    
    // position the sprite on the center of the screen
    pSprite->setPosition( ccp(size.width/2, size.height/2) );
    
    // add the sprite as a child to this layer
    this->addChild(pSprite, 0);
    
    /*
     float x=0, y=0, z=0;
     this->getCamera()->getCenterXYZ(&x, &y, &z);
     this->getCamera()->setCenterXYZ(x, y+0.0000001, z);
     */
    /*
     float x=0, y=0, z=0;
     this->getCamera()->getEyeXYZ(&x, &y, &z);
     this->getCamera()->setEyeXYZ(x, y, 200);
     */
    //this->scheduleUpdate();
    
    //CCDirector::sharedDirector()->setDepthTest(false);
    
    CCCamera* pCamera = this->getCamera();
    pCamera->setEyeXYZ(10.0f, 20.0f, 20.0f);
    pCamera->setCenterXYZ(0, 0, 0);
    pCamera->setUpXYZ(0.0f, 1.0f, 0.0f);
    
    return true;
}
开发者ID:DPigpen,项目名称:cocos2dx_recipe,代码行数:49,代码来源:Recipe72.cpp

示例3: glLineWidth

void 
CPrimitiveScene::draw()
{    
    CCCamera* pCamera = CCDirector::sharedDirector()->getRunningScene()->getCamera();
    pCamera->setEyeXYZ(0,0,10);
    pCamera->setCenterXYZ(-50.0f, -50.0f, 0);

    // open yellow poly
    ccDrawColor4B(255, 255, 0, 255);
    glLineWidth(10);
    ccVertex3F vertices[] = { vertex3(0,0,0), vertex3(50,50,0), vertex3(100,50,0), vertex3(100,100,0), vertex3(50,100,0.1) };
        
    s_pShader->use();
    s_pShader->setUniformForModelViewProjectionMatrix();
    s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1);

    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );


    int numberOfPoints = 5;
    // XXX: Mac OpenGL error. arrays can't go out of scope before draw is executed
    ccVertex3F* newPoli = new ccVertex3F[numberOfPoints];

    // iPhone and 32-bit machines optimization
    if( sizeof(CCPoint) == sizeof(ccVertex3F) )
    {
        glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, vertices);
    }
    else
    {
        // Mac on 64-bit
        for( unsigned int i=0; i<numberOfPoints;i++)
        {
            newPoli[i] = vertex3( vertices[i].x, vertices[i].y, vertices[i].z );
        }
        glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, newPoli);
    }    

    glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) numberOfPoints);

    CC_SAFE_DELETE_ARRAY(newPoli);
    CC_INCREMENT_GL_DRAWS(1);
}
开发者ID:valkidy,项目名称:homedefence,代码行数:43,代码来源:CTMXObjectSchedule.cpp


注:本文中的CCCamera::setCenterXYZ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。