Merge pull request #5926 from andyque/fix_tests_warnings

issue #4401, remove warnings under win32
This commit is contained in:
James Chen 2014-03-25 18:17:42 +08:00
commit f6c6d428ad
23 changed files with 82 additions and 82 deletions

View File

@ -590,7 +590,7 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners, c
// priority < 0
if (fixedPriorityListeners)
{
CCASSERT(listeners->getGt0Index() <= fixedPriorityListeners->size(), "Out of range exception!");
CCASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()), "Out of range exception!");
if (!fixedPriorityListeners->empty())
{

View File

@ -388,7 +388,7 @@ unsigned char * makeDistanceMap( unsigned char *img, long width, long height)
double * data = (double *) calloc( pixelAmount, sizeof(double) );
double * outside = (double *) calloc( pixelAmount, sizeof(double) );
double * inside = (double *) calloc( pixelAmount, sizeof(double) );
unsigned int i,j;
long i,j;
// Convert img into double (data) rescale image levels between 0 and 1
long outWidth = width + 2 * FontFreeType::DistanceMapSpread;

View File

@ -492,7 +492,7 @@ void TMXLayer::setTileGID(uint32_t gid, const Point& pos, TMXTileFlags flags)
{
CCASSERT(pos.x < _layerSize.width && pos.y < _layerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
CCASSERT(_tiles && _atlasIndexArray, "TMXLayer: the tiles map has been released");
CCASSERT(gid == 0 || gid >= _tileSet->_firstGid, "TMXLayer: invalid gid" );
CCASSERT(gid == 0 || (int)gid >= _tileSet->_firstGid, "TMXLayer: invalid gid" );
TMXTileFlags currentFlags;
uint32_t currentGID = getTileGIDAt(pos, &currentFlags);

View File

@ -241,7 +241,7 @@ void ActionNode::insertFrame(int index, ActionFrame* frame)
return;
}
int frameType = frame->getFrameType();
if(frameType < _frameArray.size())
if(frameType < (int)_frameArray.size())
{
auto cArray = _frameArray.at(frameType);
cArray->insert(index, frame);
@ -256,7 +256,7 @@ void ActionNode::addFrame(ActionFrame* frame)
}
int frameType = frame->getFrameType();
if(frameType < _frameArray.size())
if(frameType < (int)_frameArray.size())
{
auto cArray = _frameArray.at(frameType);
cArray->pushBack(frame);
@ -270,7 +270,7 @@ void ActionNode::deleteFrame(ActionFrame* frame)
return;
}
int frameType = frame->getFrameType();
if(frameType < _frameArray.size())
if(frameType < (int)_frameArray.size())
{
auto cArray = _frameArray.at(frameType);
cArray->eraseObject(frame);

View File

@ -126,8 +126,8 @@ void Skin::setSkinData(const BaseData &var)
setScaleX(_skinData.scaleX);
setScaleY(_skinData.scaleY);
setRotationX(CC_RADIANS_TO_DEGREES(_skinData.skewX));
setRotationY(CC_RADIANS_TO_DEGREES(-_skinData.skewY));
setRotationSkewX(CC_RADIANS_TO_DEGREES(_skinData.skewX));
setRotationSkewY(CC_RADIANS_TO_DEGREES(-_skinData.skewY));
setPosition(Point(_skinData.x, _skinData.y));
_skinTransform = getNodeToParentTransform();

View File

@ -340,7 +340,7 @@ void RichText::formarRenderers()
float newContentSizeHeight = 0.0f;
float *maxHeights = new float[_elementRenders.size()];
for (ssize_t i=0; i<_elementRenders.size(); i++)
for (size_t i=0; i<_elementRenders.size(); i++)
{
Vector<Node*>* row = (_elementRenders[i]);
float maxHeight = 0.0f;
@ -355,7 +355,7 @@ void RichText::formarRenderers()
float nextPosY = _customSize.height;
for (ssize_t i=0; i<_elementRenders.size(); i++)
for (size_t i=0; i<_elementRenders.size(); i++)
{
Vector<Node*>* row = (_elementRenders[i]);
float nextPosX = 0.0f;
@ -375,7 +375,7 @@ void RichText::formarRenderers()
}
size_t length = _elementRenders.size();
for (ssize_t i = 0; i<length; i++)
for (size_t i = 0; i<length; i++)
{
Vector<Node*>* l = _elementRenders[i];
l->clear();

View File

@ -1040,7 +1040,7 @@ void TestColliderDetector::update(float delta)
float minx = 0, miny = 0, maxx = 0, maxy = 0;
size_t length = vertexList.size();
for (int i = 0; i<length; i++)
for (size_t i = 0; i<length; i++)
{
Point vertex = vertexList.at(i);
if (i == 0)

View File

@ -48,7 +48,7 @@ void CustomImageView::initRenderer()
ImageView::initRenderer();
_label = LabelTTF::create();
CCNodeRGBA::addChild(_label, getZOrder() + 1, -1);
CCNodeRGBA::addChild(_label, getLocalZOrder() + 1, -1);
}
void CustomImageView::setText(const std::string &text)

View File

@ -72,7 +72,7 @@ void CustomParticleWidget::setParticlePlist(const char *plist)
_emitter->removeFromParent();
_emitter = ParticleSystemQuad::create(plist);
}
Node::addChild(_emitter , getZOrder() + 1, -1);
Node::addChild(_emitter , getLocalZOrder() + 1, -1);
_emitterPlist = plist;
}

View File

@ -39,7 +39,7 @@ bool UILayoutTest_Editor::init()
left_button->getSize().height));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -47,7 +47,7 @@ bool UILayoutTest_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -94,7 +94,7 @@ bool UILayoutTest_Color_Editor::init()
left_button->getSize().height));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -102,7 +102,7 @@ bool UILayoutTest_Color_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -149,7 +149,7 @@ bool UILayoutTest_Gradient_Editor::init()
left_button->getSize().height));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -157,7 +157,7 @@ bool UILayoutTest_Gradient_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -204,7 +204,7 @@ bool UILayoutTest_BackGroundImage_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -212,7 +212,7 @@ bool UILayoutTest_BackGroundImage_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -259,7 +259,7 @@ bool UILayoutTest_BackGroundImage_Scale9_Editor::init()
left_button->getSize().height));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -267,7 +267,7 @@ bool UILayoutTest_BackGroundImage_Scale9_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -314,7 +314,7 @@ bool UILayoutTest_Layout_Linear_Vertical_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -322,7 +322,7 @@ bool UILayoutTest_Layout_Linear_Vertical_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -369,7 +369,7 @@ bool UILayoutTest_Layout_Linear_Horizontal_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -377,7 +377,7 @@ bool UILayoutTest_Layout_Linear_Horizontal_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -425,7 +425,7 @@ bool UILayoutTest_Layout_Relative_Align_Parent_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -433,7 +433,7 @@ bool UILayoutTest_Layout_Relative_Align_Parent_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -480,7 +480,7 @@ bool UILayoutTest_Layout_Relative_Location_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -488,7 +488,7 @@ bool UILayoutTest_Layout_Relative_Location_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);

View File

@ -42,7 +42,7 @@ bool UIListViewTest_Vertical_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -50,7 +50,7 @@ bool UIListViewTest_Vertical_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -98,7 +98,7 @@ bool UIListViewTest_Horizontal_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -106,7 +106,7 @@ bool UIListViewTest_Horizontal_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
return true;

View File

@ -40,7 +40,7 @@ bool UIPageViewTest_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -48,7 +48,7 @@ bool UIPageViewTest_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);

View File

@ -36,7 +36,7 @@ bool UIRichTextTest::init()
button->setTitleText("switch");
button->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f + button->getSize().height * 2.5));
button->addTouchEventListener(this, toucheventselector(UIRichTextTest::touchEvent));
button->setZOrder(10);
button->setLocalZOrder(10);
_widget->addChild(button);
@ -69,7 +69,7 @@ bool UIRichTextTest::init()
_richText->pushBackElement(re6);
_richText->setPosition(Point(widgetSize.width / 2, widgetSize.height / 2));
_richText->setZOrder(10);
_richText->setLocalZOrder(10);
_widget->addChild(_richText);

View File

@ -39,7 +39,7 @@ bool UIScrollViewTest_Vertical_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -47,7 +47,7 @@ bool UIScrollViewTest_Vertical_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -94,7 +94,7 @@ bool UIScrollViewTest_Horizontal_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -102,7 +102,7 @@ bool UIScrollViewTest_Horizontal_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);
@ -149,7 +149,7 @@ bool UIScrollViewTest_Both_Editor::init()
left_button->getSize().height * 0.625));
left_button->setTouchEnabled(true);
left_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::previousCallback));
left_button->setZOrder(_layout->getZOrder() + 1);
left_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(left_button);
Button* right_button = Button::create();
@ -157,7 +157,7 @@ bool UIScrollViewTest_Both_Editor::init()
right_button->setPosition(Point(_layout->getSize().width / 2 + right_button->getSize().width,
right_button->getSize().height * 0.625));
right_button->setTouchEnabled(true);
right_button->setZOrder(_layout->getZOrder() + 1);
right_button->setLocalZOrder(_layout->getLocalZOrder() + 1);
right_button->addTouchEventListener(this, toucheventselector(UIScene_Editor::nextCallback));
_layout->addChild(right_button);

View File

@ -336,7 +336,7 @@ void UITextFieldTest_LineWrap::textFieldEvent(Ref *pSender, TextFiledEventType t
{
TextField* textField = dynamic_cast<TextField*>(pSender);
Size widgetSize = _widget->getSize();
textField->runAction(CCMoveTo::create(0.225,
textField->runAction(CCMoveTo::create(0.225f,
Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f + textField->getContentSize().height / 2)));
textField->setTextHorizontalAlignment(TextHAlignment::LEFT);
textField->setTextVerticalAlignment(TextVAlignment::TOP);
@ -349,7 +349,7 @@ void UITextFieldTest_LineWrap::textFieldEvent(Ref *pSender, TextFiledEventType t
{
TextField* textField = dynamic_cast<TextField*>(pSender);
Size widgetSize = _widget->getSize();
textField->runAction(CCMoveTo::create(0.175, Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f)));
textField->runAction(CCMoveTo::create(0.175f, Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f)));
textField->setTextHorizontalAlignment(TextHAlignment::CENTER);
textField->setTextVerticalAlignment(TextVAlignment::CENTER);

View File

@ -37,7 +37,7 @@ bool UIWidgetAddNodeTest_Editor::init()
// Create the ui widget
Widget* widget = Widget::create();
widget->setPosition(Point(rootSize.width / 2.0f, rootSize.height / 2.0f));
widget->setZOrder(_layout->getZOrder() + 1);
widget->setLocalZOrder(_layout->getLocalZOrder() + 1);
_layout->addChild(widget);
Sprite* sprite = Sprite::create("cocosui/ccicon.png");

View File

@ -199,7 +199,7 @@ void TMoveBy::serialize(const rapidjson::Value &val)
}
else if (key == "IsReverse")
{
_reverse = (bool)(DICTOOL->getIntValue_json(subDict, "value"));
_reverse = DICTOOL->getIntValue_json(subDict, "value") ? true : false;
continue;
}
}
@ -337,7 +337,7 @@ void TRotateBy::serialize(const rapidjson::Value &val)
}
else if (key == "IsReverse")
{
_reverse = (int)(DICTOOL->getIntValue_json(subDict, "value"));
_reverse = (DICTOOL->getIntValue_json(subDict, "value")) ? true : false;
continue;
}
}
@ -483,7 +483,7 @@ void TScaleBy::serialize(const rapidjson::Value &val)
}
else if (key == "IsReverse")
{
_reverse = (bool)(DICTOOL->getIntValue_json(subDict, "value"));
_reverse = (DICTOOL->getIntValue_json(subDict, "value")) ? true : false;
continue;
}
}
@ -629,7 +629,7 @@ void TSkewBy::serialize(const rapidjson::Value &val)
}
else if (key == "IsReverse")
{
_reverse = (bool)(DICTOOL->getIntValue_json(subDict, "value"));
_reverse = DICTOOL->getIntValue_json(subDict, "value") ? true : false;
}
}
}

View File

@ -255,7 +255,7 @@ void NodeVisible::serialize(const rapidjson::Value &val)
}
else if (key == "Visible")
{
_visible = DICTOOL->getIntValue_json(subDict, "value");
_visible = DICTOOL->getIntValue_json(subDict, "value") ? true : false;
continue;
}
}

View File

@ -845,7 +845,7 @@ void PhysicsDemoJoints::onEnter()
_scene->getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1->getPhysicsBody(), box, sp1->getPosition()));
_scene->getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2->getPhysicsBody(), box, sp2->getPosition()));
PhysicsJointRotaryLimit* joint = PhysicsJointRotaryLimit::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), 0.0f, M_PI_2);
PhysicsJointRotaryLimit* joint = PhysicsJointRotaryLimit::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), 0.0f,(float) M_PI_2);
_scene->getPhysicsWorld()->addJoint(joint);
this->addChild(sp1);
@ -861,7 +861,7 @@ void PhysicsDemoJoints::onEnter()
_scene->getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1->getPhysicsBody(), box, sp1->getPosition()));
_scene->getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2->getPhysicsBody(), box, sp2->getPosition()));
PhysicsJointRatchet* joint = PhysicsJointRatchet::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), 0.0f, M_PI_2);
PhysicsJointRatchet* joint = PhysicsJointRatchet::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), 0.0f, (float)M_PI_2);
_scene->getPhysicsWorld()->addJoint(joint);
this->addChild(sp1);
@ -893,7 +893,7 @@ void PhysicsDemoJoints::onEnter()
_scene->getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp1->getPhysicsBody(), box, sp1->getPosition()));
_scene->getPhysicsWorld()->addJoint(PhysicsJointPin::construct(sp2->getPhysicsBody(), box, sp2->getPosition()));
PhysicsJointMotor* joint = PhysicsJointMotor::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), M_PI_2);
PhysicsJointMotor* joint = PhysicsJointMotor::construct(sp1->getPhysicsBody(), sp2->getPhysicsBody(), (float)M_PI_2);
_scene->getPhysicsWorld()->addJoint(joint);
this->addChild(sp1);
@ -1445,7 +1445,7 @@ void PhysicsContactTest::resetTest()
label->setPosition(Point(s.width/2, s.height-170));
auto wall = Node::create();
wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1, 1, 0.0)));
wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1, 0.0f)));
wall->setPosition(VisibleRect::center());
root->addChild(wall);
@ -1463,7 +1463,7 @@ void PhysicsContactTest::resetTest()
position.y = position.y * CCRANDOM_0_1();
position = VisibleRect::leftBottom() + position + Point(size.width/2, size.height/2);
Vect velocity((CCRANDOM_0_1() - 0.5)*200, (CCRANDOM_0_1() - 0.5)*200);
auto box = makeBox(position, size, 1, PhysicsMaterial(0.1, 1, 0.0));
auto box = makeBox(position, size, 1, PhysicsMaterial(0.1f, 1, 0.0f));
box->getPhysicsBody()->setVelocity(velocity);
box->getPhysicsBody()->setCategoryBitmask(0x01); // 0001
box->getPhysicsBody()->setContactTestBitmask(0x04); // 0100
@ -1481,7 +1481,7 @@ void PhysicsContactTest::resetTest()
position.y = position.y * CCRANDOM_0_1();
position = VisibleRect::leftBottom() + position + Point(size.width/2, size.height/2);
Vect velocity((CCRANDOM_0_1() - 0.5)*200, (CCRANDOM_0_1() - 0.5)*200);
auto box = makeBox(position, size, 2, PhysicsMaterial(0.1, 1, 0.0));
auto box = makeBox(position, size, 2, PhysicsMaterial(0.1f, 1, 0.0f));
box->getPhysicsBody()->setVelocity(velocity);
box->getPhysicsBody()->setCategoryBitmask(0x02); // 0010
box->getPhysicsBody()->setContactTestBitmask(0x08); // 1000
@ -1499,7 +1499,7 @@ void PhysicsContactTest::resetTest()
position.y = position.y * CCRANDOM_0_1();
position = VisibleRect::leftBottom() + position + Point(size.width/2, size.height/2);
Vect velocity((CCRANDOM_0_1() - 0.5)*300, (CCRANDOM_0_1() - 0.5)*300);
auto triangle = makeTriangle(position, size, 1, PhysicsMaterial(0.1, 1, 0.0));
auto triangle = makeTriangle(position, size, 1, PhysicsMaterial(0.1f, 1, 0.0f));
triangle->getPhysicsBody()->setVelocity(velocity);
triangle->getPhysicsBody()->setCategoryBitmask(0x04); // 0100
triangle->getPhysicsBody()->setContactTestBitmask(0x01); // 0001
@ -1517,7 +1517,7 @@ void PhysicsContactTest::resetTest()
position.y = position.y * CCRANDOM_0_1();
position = VisibleRect::leftBottom() + position + Point(size.width/2, size.height/2);
Vect velocity((CCRANDOM_0_1() - 0.5)*300, (CCRANDOM_0_1() - 0.5)*300);
auto triangle = makeTriangle(position, size, 2, PhysicsMaterial(0.1, 1, 0.0));
auto triangle = makeTriangle(position, size, 2, PhysicsMaterial(0.1f, 1, 0.0f));
triangle->getPhysicsBody()->setVelocity(velocity);
triangle->getPhysicsBody()->setCategoryBitmask(0x08); // 1000
triangle->getPhysicsBody()->setContactTestBitmask(0x02); // 0010
@ -1566,7 +1566,7 @@ void PhysicsPositionRotationTest::onEnter()
// anchor test
auto anchorNode = Sprite::create("Images/YellowSquare.png");
anchorNode->setAnchorPoint(Point(0.1, 0.9));
anchorNode->setAnchorPoint(Point(0.1f, 0.9f));
anchorNode->setPosition(100, 100);
anchorNode->setScale(0.25);
anchorNode->setPhysicsBody(PhysicsBody::createBox(anchorNode->getContentSize()*anchorNode->getScale()));

View File

@ -314,9 +314,9 @@ RenderTextureZbuffer::RenderTextureZbuffer()
label3->setPosition(Point(size.width / 2, size.height * 0.75f));
this->addChild(label3);
label->setVertexZ(50);
label2->setVertexZ(0);
label3->setVertexZ(-50);
label->setPositionZ(50);
label2->setPositionZ(0);
label3->setPositionZ(-50);
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("Images/bugs/circle.plist");
mgr = SpriteBatchNode::create("Images/bugs/circle.png", 9);
@ -341,15 +341,15 @@ RenderTextureZbuffer::RenderTextureZbuffer()
mgr->addChild(sp8, 2);
mgr->addChild(sp9, 1);
sp1->setVertexZ(400);
sp2->setVertexZ(300);
sp3->setVertexZ(200);
sp4->setVertexZ(100);
sp5->setVertexZ(0);
sp6->setVertexZ(-100);
sp7->setVertexZ(-200);
sp8->setVertexZ(-300);
sp9->setVertexZ(-400);
sp1->setPositionZ(400);
sp2->setPositionZ(300);
sp3->setPositionZ(200);
sp4->setPositionZ(100);
sp5->setPositionZ(0);
sp6->setPositionZ(-100);
sp7->setPositionZ(-200);
sp8->setPositionZ(-300);
sp9->setPositionZ(-400);
sp9->setScale(2);
sp9->setColor(Color3B::YELLOW);

View File

@ -1 +1 @@
4bb0b2a6151e4910ea662bedd91a5be655ec05d1
4d17613c96e30631ec5da21b2629fa3d0fc39f2d

View File

@ -285,7 +285,7 @@ TMXOrthoTest::TMXOrthoTest()
Size CC_UNUSED s = map->getContentSize();
CCLOG("ContentSize: %f, %f", s.width,s.height);
auto scale = ScaleBy::create(10, 0.1);
auto scale = ScaleBy::create(10, 0.1f);
auto back = scale->reverse();
auto seq = Sequence::create(scale, back, NULL);
auto repeat = RepeatForever::create(seq);
@ -1086,7 +1086,7 @@ void TMXIsoVertexZ::repositionSprite(float dt)
auto p = _tamara->getPosition();
p = CC_POINT_POINTS_TO_PIXELS(p);
float newZ = -(p.y+32) /16;
_tamara->setVertexZ( newZ );
_tamara->setPositionZ( newZ );
}
void TMXIsoVertexZ::onEnter()
@ -1132,7 +1132,7 @@ TMXOrthoVertexZ::TMXOrthoVertexZ()
// can use any Sprite and it will work OK.
auto layer = map->getLayer("trees");
_tamara = layer->getTileAt(Point(0,11));
CCLOG("%p vertexZ: %f", _tamara, _tamara->getVertexZ());
CCLOG("%p vertexZ: %f", _tamara, _tamara->getPositionZ());
_tamara->retain();
auto move = MoveBy::create(10, Point(400,450) * (1/CC_CONTENT_SCALE_FACTOR()));
@ -1155,7 +1155,7 @@ void TMXOrthoVertexZ::repositionSprite(float dt)
// map size: 12x12
auto p = _tamara->getPosition();
p = CC_POINT_POINTS_TO_PIXELS(p);
_tamara->setVertexZ( -( (p.y+81) /81) );
_tamara->setPositionZ( -( (p.y+81) /81) );
}
void TMXOrthoVertexZ::onEnter()

View File

@ -185,8 +185,8 @@ void ZwoptexGenericTest::flipSprites(float dt)
char str2[32] = {0};
sprintf(str1, "grossini_dance_%02d.png", spriteFrameIndex);
sprintf(str2, "grossini_dance_generic_%02d.png", spriteFrameIndex);
sprite1->setDisplayFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(str1));
sprite2->setDisplayFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(str2));
sprite1->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(str1));
sprite2->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(str2));
}
ZwoptexGenericTest::~ZwoptexGenericTest()