mirror of https://github.com/axmolengine/axmol.git
Fixed warns:truncation from double to float
This commit is contained in:
parent
1fa0fb584b
commit
13b049a543
|
@ -1125,8 +1125,8 @@ void Director::showStats()
|
|||
{
|
||||
static unsigned long prevCalls = 0;
|
||||
static unsigned long prevVerts = 0;
|
||||
static float prevDeltaTime = 0.016; // 60FPS
|
||||
static const float FPS_FILTER = 0.10;
|
||||
static float prevDeltaTime = 0.016f; // 60FPS
|
||||
static const float FPS_FILTER = 0.10f;
|
||||
|
||||
_accumDt += _deltaTime;
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ void Director::showStats()
|
|||
void Director::calculateMPF()
|
||||
{
|
||||
static float prevSecondsPerFrame = 0;
|
||||
static const float MPF_FILTER = 0.10;
|
||||
static const float MPF_FILTER = 0.10f;
|
||||
|
||||
struct timeval now;
|
||||
gettimeofday(&now, nullptr);
|
||||
|
|
|
@ -142,7 +142,7 @@ CameraRotationTest::CameraRotationTest()
|
|||
bill1 = BillBoard::create("Images/Icon.png");
|
||||
bill1->setPosition3D(Vec3(s.width/2 + 50, s.height/2 + 10, -10));
|
||||
bill1->setColor(Color3B::YELLOW);
|
||||
bill1->setScale(0.6);
|
||||
bill1->setScale(0.6f);
|
||||
addChild(bill1);
|
||||
|
||||
l1 = Label::create();
|
||||
|
@ -154,7 +154,7 @@ CameraRotationTest::CameraRotationTest()
|
|||
|
||||
bill2 = BillBoard::create("Images/Icon.png");
|
||||
bill2->setPosition3D(Vec3(s.width/2 - 50, s.height/2 - 10, 10));
|
||||
bill2->setScale(0.6);
|
||||
bill2->setScale(0.6f);
|
||||
addChild(bill2);
|
||||
|
||||
l2 = Label::create();
|
||||
|
@ -1133,7 +1133,7 @@ void CameraArcBallDemo::onEnter()
|
|||
_layer3D->addChild(_sprite3D1);
|
||||
|
||||
_sprite3D2 = Sprite3D::create("Sprite3DTest/boss.c3b");
|
||||
_sprite3D2->setScale(0.6);
|
||||
_sprite3D2->setScale(0.6f);
|
||||
_sprite3D2->setRotation3D(Vec3(-90,0,0));
|
||||
_sprite3D2->setPosition3D(Vec3(20,0,0));
|
||||
_layer3D->addChild(_sprite3D2);
|
||||
|
@ -1438,7 +1438,7 @@ void FogTestDemo::switchTypeCallback(Ref* sender,int type)
|
|||
else if(type == 1)
|
||||
{
|
||||
_state->setUniformVec4("u_fogColor", Vec4(0.5,0.5,0.5,1.0));
|
||||
_state->setUniformFloat("u_fogDensity",0.03);
|
||||
_state->setUniformFloat("u_fogDensity",0.03f);
|
||||
_state->setUniformInt("u_fogEquation" ,1);
|
||||
|
||||
_sprite3D1->setGLProgramState(_state);
|
||||
|
@ -1447,7 +1447,7 @@ void FogTestDemo::switchTypeCallback(Ref* sender,int type)
|
|||
else if(type == 2)
|
||||
{
|
||||
_state->setUniformVec4("u_fogColor", Vec4(0.5,0.5,0.5,1.0));
|
||||
_state->setUniformFloat("u_fogDensity",0.03);
|
||||
_state->setUniformFloat("u_fogDensity",0.03f);
|
||||
_state->setUniformInt("u_fogEquation" ,2);
|
||||
|
||||
_sprite3D1->setGLProgramState(_state);
|
||||
|
|
|
@ -541,7 +541,7 @@ VBOFullTest::VBOFullTest()
|
|||
for (int i=0; i< Renderer::VBO_SIZE / 3.9; ++i)
|
||||
{
|
||||
Sprite* sprite = Sprite::create("Images/grossini_dance_01.png");
|
||||
sprite->setScale(0.1, 0.1);
|
||||
sprite->setScale(0.1f, 0.1f);
|
||||
float x = ((float)std::rand()) /RAND_MAX;
|
||||
float y = ((float)std::rand()) /RAND_MAX;
|
||||
sprite->setPosition(Vec2(x * s.width, y * s.height));
|
||||
|
|
|
@ -251,7 +251,7 @@ bool SpineTestPerformanceLayer::init () {
|
|||
skeletonNode->setAnimation(0, "walk", true);
|
||||
skeletonNode->setSkin("goblin");
|
||||
|
||||
skeletonNode->setScale(0.2);
|
||||
skeletonNode->setScale(0.2f);
|
||||
skeletonNode->setPosition(pos);
|
||||
addChild(skeletonNode);
|
||||
return true;
|
||||
|
|
|
@ -271,7 +271,7 @@ Sprite3DUVAnimationTest::Sprite3DUVAnimationTest()
|
|||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||
|
||||
//use custom camera
|
||||
auto camera = Camera::createPerspective(60,visibleSize.width/visibleSize.height,0.1,200);
|
||||
auto camera = Camera::createPerspective(60, visibleSize.width/visibleSize.height, 0.1f, 200);
|
||||
camera->setCameraFlag(CameraFlag::USER1);
|
||||
|
||||
//create cylinder
|
||||
|
@ -393,7 +393,7 @@ Sprite3DFakeShadowTest::Sprite3DFakeShadowTest()
|
|||
auto layer = Layer::create();
|
||||
addChild(layer,0);
|
||||
//create Camera
|
||||
_camera = Camera::createPerspective(60,visibleSize.width/visibleSize.height,0.1,200);
|
||||
_camera = Camera::createPerspective(60, visibleSize.width/visibleSize.height, 0.1f, 200);
|
||||
_camera->setCameraFlag(CameraFlag::USER1);
|
||||
_camera->setPosition3D(Vec3(0,20,25));
|
||||
_camera->setRotation3D(Vec3(-60,0,0));
|
||||
|
@ -435,7 +435,7 @@ Sprite3DFakeShadowTest::Sprite3DFakeShadowTest()
|
|||
|
||||
//create the orc
|
||||
_orc = Sprite3D::create("Sprite3DTest/orc.c3b");
|
||||
_orc->setScale(0.2);
|
||||
_orc->setScale(0.2f);
|
||||
_orc->setRotation3D(Vec3(0,180,0));
|
||||
_orc->setPosition3D(Vec3(0,0,10));
|
||||
_targetPos = _orc->getPosition3D();
|
||||
|
@ -646,7 +646,7 @@ void Sprite3DFakeShadowTest::onTouchesEnded(const std::vector<Touch*>& touches,
|
|||
Sprite3DBasicToonShaderTest::Sprite3DBasicToonShaderTest()
|
||||
{
|
||||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||
auto _camera = Camera::createPerspective(60,visibleSize.width/visibleSize.height,0.1,200);
|
||||
auto _camera = Camera::createPerspective(60, visibleSize.width/visibleSize.height, 0.1f, 200);
|
||||
_camera->setCameraFlag(CameraFlag::USER1);
|
||||
// create a teapot
|
||||
auto teapot = Sprite3D::create("Sprite3DTest/teapot.c3b");
|
||||
|
@ -717,12 +717,12 @@ Sprite3DLightMapTest::Sprite3DLightMapTest()
|
|||
//the assets are from the OpenVR demo
|
||||
//get the visible size.
|
||||
Size visibleSize = Director::getInstance()->getVisibleSize();
|
||||
_camera = Camera::createPerspective(60,visibleSize.width/visibleSize.height,0.1,200);
|
||||
_camera = Camera::createPerspective(60, visibleSize.width/visibleSize.height, 0.1f, 200);
|
||||
_camera->setCameraFlag(CameraFlag::USER1);
|
||||
_camera->setPosition3D(Vec3(0,25,15));
|
||||
_camera->setRotation3D(Vec3(-35,0,0));
|
||||
auto LightMapScene = Sprite3D::create("Sprite3DTest/LightMapScene.c3b");
|
||||
LightMapScene->setScale(0.1);
|
||||
LightMapScene->setScale(0.1f);
|
||||
addChild(LightMapScene);
|
||||
addChild(_camera);
|
||||
setCameraMask(2);
|
||||
|
|
|
@ -761,7 +761,7 @@ bool UIButtonFlipTest::init()
|
|||
|
||||
// Add a label in which the button events will be displayed
|
||||
_displayValueLabel = Text::create("Button X Flipped", "fonts/Marker Felt.ttf",20);
|
||||
_displayValueLabel->setNormalizedPosition(Vec2(0.3, 0.7));
|
||||
_displayValueLabel->setNormalizedPosition(Vec2(0.3f, 0.7f));
|
||||
_uiLayer->addChild(_displayValueLabel);
|
||||
|
||||
|
||||
|
@ -788,7 +788,7 @@ bool UIButtonFlipTest::init()
|
|||
_uiLayer->addChild(button2);
|
||||
|
||||
auto titleLabel = Text::create("Button Y flipped", "Arial", 20);
|
||||
titleLabel->setNormalizedPosition(Vec2(0.8, 0.7));
|
||||
titleLabel->setNormalizedPosition(Vec2(0.8f, 0.7f));
|
||||
this->addChild(titleLabel);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -584,9 +584,9 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
|||
|
||||
//add buttons
|
||||
auto button = Button::create();
|
||||
button->setNormalizedPosition(Vec2(0.12,0.7));
|
||||
button->setNormalizedPosition(Vec2(0.12f,0.7f));
|
||||
button->setTitleText("Add A Page");
|
||||
button->setZoomScale(0.3);
|
||||
button->setZoomScale(0.3f);
|
||||
button->setPressedActionEnabled(true);
|
||||
button->setTitleColor(Color3B::RED);
|
||||
button->addClickEventListener([=](Ref* sender)
|
||||
|
@ -622,9 +622,9 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
|||
_uiLayer->addChild(button);
|
||||
|
||||
auto button2 = Button::create();
|
||||
button2->setNormalizedPosition(Vec2(0.12,0.5));
|
||||
button2->setNormalizedPosition(Vec2(0.12f,0.5f));
|
||||
button2->setTitleText("Remove A Page");
|
||||
button2->setZoomScale(0.3);
|
||||
button2->setZoomScale(0.3f);
|
||||
button2->setPressedActionEnabled(true);
|
||||
button2->setTitleColor(Color3B::RED);
|
||||
button2->addClickEventListener([=](Ref* sender)
|
||||
|
@ -643,9 +643,9 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
|||
_uiLayer->addChild(button2);
|
||||
|
||||
auto button3 = Button::create();
|
||||
button3->setNormalizedPosition(Vec2(0.12,0.3));
|
||||
button3->setNormalizedPosition(Vec2(0.12f,0.3f));
|
||||
button3->setTitleText("Remove All Pages");
|
||||
button3->setZoomScale(0.3);
|
||||
button3->setZoomScale(0.3f);
|
||||
button3->setPressedActionEnabled(true);
|
||||
button3->setTitleColor(Color3B::RED);
|
||||
button3->addClickEventListener([=](Ref* sender)
|
||||
|
|
|
@ -666,7 +666,7 @@ bool UIS9Flip::init()
|
|||
auto flipXSprite = ui::Scale9Sprite::createWithSpriteFrameName("blocks9r.png");
|
||||
|
||||
flipXSprite->setPosition(Vec2(x - 120, y ));
|
||||
flipXSprite->setScale(1.2);
|
||||
flipXSprite->setScale(1.2f);
|
||||
this->addChild(flipXSprite);
|
||||
flipXSprite->setFlippedX(false);
|
||||
|
||||
|
@ -680,7 +680,7 @@ bool UIS9Flip::init()
|
|||
flipYSprite->setPosition(Vec2(x + 120, y));
|
||||
this->addChild(flipYSprite);
|
||||
|
||||
flipYSprite->setScale(0.8);
|
||||
flipYSprite->setScale(0.8f);
|
||||
flipYSprite->setFlippedY(true);
|
||||
|
||||
auto flipYLabel = Label::createWithSystemFont("sprite is flipped!","Airal",10);
|
||||
|
|
Loading…
Reference in New Issue