another use case not finished

This commit is contained in:
yangxiao 2015-01-26 18:44:30 +08:00
parent 77716d481d
commit cc18a3a955
2 changed files with 21 additions and 13 deletions

View File

@ -2115,13 +2115,13 @@ UseCaseSprite3D::UseCaseSprite3D()
auto s = Director::getInstance()->getWinSize(); auto s = Director::getInstance()->getWinSize();
_useCaseTitles[0] = "transparent 3d sprite and 2d sprite"; _useCaseTitles[0] = "transparent 3d sprite and 2d sprite";
_useCaseTitles[1] = "ui - 3d - ui";
auto itemPrev = MenuItemImage::create("Images/b1.png", "Images/b2.png", auto itemPrev = MenuItemImage::create("Images/b1.png", "Images/b2.png",
[&](Ref *sender) { [&](Ref *sender) {
_caseIdx--; _caseIdx--;
if (_caseIdx < 0) if (_caseIdx < 0)
_caseIdx = 0; _caseIdx = (int)USECASE::MAX_CASE_NUM - 1;
this->switchCase(); this->switchCase();
}); });
@ -2129,7 +2129,7 @@ UseCaseSprite3D::UseCaseSprite3D()
[&](Ref *sender) { [&](Ref *sender) {
_caseIdx++; _caseIdx++;
if (_caseIdx >= (int)USECASE::MAX_CASE_NUM) if (_caseIdx >= (int)USECASE::MAX_CASE_NUM)
_caseIdx = (int)USECASE::MAX_CASE_NUM - 1; _caseIdx = 0;
this->switchCase(); this->switchCase();
}); });
@ -2213,6 +2213,10 @@ void UseCaseSprite3D::switchCase()
_sprite3d->setCameraMask(2); _sprite3d->setCameraMask(2);
_sprite2d->setCameraMask(2); _sprite2d->setCameraMask(2);
} }
else if (_caseIdx == 1)
{
}
scheduleUpdate(); scheduleUpdate();
update(0.f); update(0.f);
@ -2220,14 +2224,17 @@ void UseCaseSprite3D::switchCase()
void UseCaseSprite3D::update(float delta) void UseCaseSprite3D::update(float delta)
{ {
static float accAngle = 0.f; if (_caseIdx == 0)
accAngle += delta * CC_DEGREES_TO_RADIANS(60); {
static float accAngle = 0.f;
float radius = 30.f; accAngle += delta * CC_DEGREES_TO_RADIANS(60);
float x = cosf(accAngle) * radius, z = sinf(accAngle) * radius;
float radius = 30.f;
_sprite3d->setPositionX(x); float x = cosf(accAngle) * radius, z = sinf(accAngle) * radius;
_sprite3d->setPositionZ(z);
_sprite2d->setPositionX(x); _sprite3d->setPositionX(x);
_sprite2d->setPositionZ(z); _sprite3d->setPositionZ(z);
_sprite2d->setPositionX(x);
_sprite2d->setPositionZ(z);
}
} }

View File

@ -471,6 +471,7 @@ protected:
enum class USECASE{ enum class USECASE{
_3D_WITH_2D, _3D_WITH_2D,
_UI_3D_UI,
MAX_CASE_NUM, MAX_CASE_NUM,
}; };
cocos2d::Label* _label; cocos2d::Label* _label;