mirror of https://github.com/axmolengine/axmol.git
1. Hide CameraTest2. 2. Correct the projection setting, fix camera center test projection.
This commit is contained in:
parent
f4a7da8457
commit
18b0c041b4
|
@ -51,7 +51,9 @@ static int sceneIdx = -1;
|
|||
static std::function<Layer*()> createFunctions[] =
|
||||
{
|
||||
CL(CameraTest1),
|
||||
CL(CameraTest2),
|
||||
//Camera has been removed from CCNode
|
||||
//todo add new feature to support it
|
||||
// CL(CameraTest2),
|
||||
CL(CameraCenterTest),
|
||||
CL(Test2),
|
||||
CL(Test4),
|
||||
|
@ -581,12 +583,13 @@ std::string NodeToWorld3D::subtitle() const
|
|||
void CameraOrbitTest::onEnter()
|
||||
{
|
||||
TestCocosNodeDemo::onEnter();
|
||||
_preProjection = Director::getInstance()->getProjection();
|
||||
Director::getInstance()->setProjection(Director::Projection::_3D);
|
||||
}
|
||||
|
||||
void CameraOrbitTest::onExit()
|
||||
{
|
||||
Director::getInstance()->setProjection(Director::Projection::_2D);
|
||||
Director::getInstance()->setProjection(_preProjection);
|
||||
TestCocosNodeDemo::onExit();
|
||||
}
|
||||
|
||||
|
@ -652,13 +655,13 @@ std::string CameraOrbitTest::subtitle() const
|
|||
void CameraZoomTest::onEnter()
|
||||
{
|
||||
TestCocosNodeDemo::onEnter();
|
||||
|
||||
_preProjection = Director::getInstance()->getProjection();
|
||||
Director::getInstance()->setProjection(Director::Projection::_3D);
|
||||
}
|
||||
|
||||
void CameraZoomTest::onExit()
|
||||
{
|
||||
Director::getInstance()->setProjection(Director::Projection::_2D);
|
||||
Director::getInstance()->setProjection(_preProjection);
|
||||
TestCocosNodeDemo::onExit();
|
||||
}
|
||||
|
||||
|
@ -717,6 +720,19 @@ std::string CameraZoomTest::subtitle() const
|
|||
// CameraCenterTest
|
||||
//
|
||||
//------------------------------------------------------------------
|
||||
void CameraCenterTest::onEnter()
|
||||
{
|
||||
TestCocosNodeDemo::onEnter();
|
||||
_preProjection = Director::getInstance()->getProjection();
|
||||
Director::getInstance()->setProjection(Director::Projection::_3D);
|
||||
}
|
||||
|
||||
void CameraCenterTest::onExit()
|
||||
{
|
||||
TestCocosNodeDemo::onEnter();
|
||||
Director::getInstance()->setProjection(_preProjection);
|
||||
}
|
||||
|
||||
CameraCenterTest::CameraCenterTest()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
|
@ -1029,13 +1045,14 @@ void MySprite::onDraw(const kmMat4 &transform, bool transformUpdated)
|
|||
void CameraTest1::onEnter()
|
||||
{
|
||||
TestCocosNodeDemo::onEnter();
|
||||
_preProjection = Director::getInstance()->getProjection();
|
||||
Director::getInstance()->setProjection(Director::Projection::_3D);
|
||||
Director::getInstance()->setDepthTest(true);
|
||||
}
|
||||
|
||||
void CameraTest1::onExit()
|
||||
{
|
||||
Director::getInstance()->setProjection(Director::Projection::_2D);
|
||||
Director::getInstance()->setProjection(_preProjection);
|
||||
TestCocosNodeDemo::onExit();
|
||||
}
|
||||
|
||||
|
@ -1075,13 +1092,14 @@ std::string CameraTest1::subtitle() const
|
|||
void CameraTest2::onEnter()
|
||||
{
|
||||
TestCocosNodeDemo::onEnter();
|
||||
_preProjection = Director::getInstance()->getProjection();
|
||||
Director::getInstance()->setProjection(Director::Projection::_3D);
|
||||
Director::getInstance()->setDepthTest(true);
|
||||
}
|
||||
|
||||
void CameraTest2::onExit()
|
||||
{
|
||||
Director::getInstance()->setProjection(Director::Projection::_2D);
|
||||
Director::getInstance()->setProjection(_preProjection);
|
||||
TestCocosNodeDemo::onExit();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ public:
|
|||
protected:
|
||||
TestCocosNodeDemo();
|
||||
virtual ~TestCocosNodeDemo();
|
||||
|
||||
protected:
|
||||
Director::Projection _preProjection;
|
||||
};
|
||||
|
||||
class Test2 : public TestCocosNodeDemo
|
||||
|
@ -178,6 +181,9 @@ public:
|
|||
CREATE_FUNC(CameraCenterTest);
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
|
||||
protected:
|
||||
CameraCenterTest();
|
||||
|
|
Loading…
Reference in New Issue