[Cocos2d-x 2.0 + Game Development] mouse events and coordinate systems

Source: Internet
Author: User

Reprinted. For more information, see softboy.
Blog: http://www.softboy.uqc.cn

This tutorial is a larger cocos2d-2.0-rc2-x-2.0.1 than the previous changes, the previous version of the tutorial is really only for reference. the mouse event cocos2dx has been processed. here we only need to implement the corresponding virtual function.

    // default implements are used to call script callback if exist    virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);    virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);    virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);    virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);

CcTouchesCancelled is a drag-and-drop effect. It can be viewed as a callback to be processed by the touch on the button and sliding to other buttons.
After the above function is implemented in HelloWorld, the following code must be installed in the initialization area. Otherwise, touch will not take effect.
Prompt if the definition is not found in CCSet. USING_NS_CC; defined outside helloword. h

The coordinate system is x up to right. y.

  • Previous: [cocos2d-x 2.0 + Game Development] animation creation
  • Next article: android 4.0 launcher 2 source code eclipse can be compiled (including android 4.1 launcher2 source code compilation)
  • 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.