Box2d (1)-testbed basic structure in cocos2d-x

Source: Internet
Author: User

Fill (Bill man) Personal originality. You are welcome to repost it. Please specify the address for reprinting (Bill man) Column addressHttp://blog.csdn.net/bill_man

Cocos2d-xSelf-containedBox2dEngine,Cocos2d-xThere are alsoCocos2d-xFor better researchBox2dFrom this article, I will explain the examples and further studyBox2d

First, the file structure is shown in

TestAre all examples. HFile, allTestBoth inherit fromTest,. HThere are also implementations in the file. From the next one, I will write them one by one.Box2dFor example, I useExample in cocos2d-1.0.1-x-0.11.0 release

Enter box2dtestbedscene, then menulayer, and menulayer to enter box2dview. The initialization function of box2dview is as follows:

Define a call per frameTickIn addition, rewriteDrawFunction.

EachTestAllTestentry type,CodeAs follows:

Each entryTest, ThroughCreateStart.

In additionTestFor example, defining the world and other initialization content.

Then rewrite the required collision function.

This function is called after a collision update. You can change the collision event before the collision is updated.

If there are any errors, I hope you can correct them more.

Next, write down the tumbler example.

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.