本文整理汇总了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();
}
示例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;
}
示例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);
}