About the name of the class that you define in Cocos2d-x and the name of the class in the Cocos2d-x engine library. Duplicate resolution method

Source: Internet
Author: User

Method One:

Modify the name of the class you define, VS2013 can use ctrl+h to replace a particular word, ctrl+f is used to query the location of a word or there is no existence.

Method Two:

1. Add a namespace to the whole of the. h and. cpp files for the class you define.

Edge.h file

Namespace Caishaohang {
Class Edge:public Node {

Public
virtual BOOL init ();
Create_func (Edge);
};
}

Edge.cpp file

Namespace caishaohang{
BOOL Edge::init () {

Node::init ();

Size visiblesize = director::getinstance ()->getvisiblesize ();

Setcontentsize (visiblesize);

Setphysicsbody (Physicsbody::createedgebox (visiblesize));

Getphysicsbody ()->setdynamic (false);

Getphysicsbody ()->getshape (0)->setfriction (0);

Getphysicsbody ()->getshape (0)->setrestitution (0);

return true;
}
}

2. When using a namespace, specify a class that uses our own definition

Auto _edge = Caishaohang::edge::create ();
Layer->addchild (_edge);
_edge->setposition (0, Positiony);

About the name of the class that you define in Cocos2d-x and the name of the class in the Cocos2d-x engine library. Duplicate resolution method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.