Cocos2d-x menu option Button Introduction

Source: Internet
Author: User

Cocos2d-x menu option Button Introduction
To create a menu, the first parameter is an item, a variable parameter, which is equivalent to a mutable parameter in Java
Menuitemimage::create (normal state picture background, selected picture background,
Callback (callback, event callback, the method to be executed after the button is clicked))
[] () {} represents the closure function, which is the c++11
function is to click the Picture button when changing the picture
Auto Menu = menu::create (Menuitemimage::create ("Ball_black.jpg", "ball_blue.jpg", [] (REF *) {
Log ("menu Item thouch!!!");
}), NULL);
Multiple menu buttons can be added
Auto menu1 = menu::create (Menuitemimage::create ("Ball_black.jpg", "ball_blue.jpg", [] (REF *) {
Log ("menu Item thouch!!!");
}), Menuitemimage::create ("Ball_blue.jpg", "ball_black.jpg", [] (REF *) {
Log ("menu Item thouch!!!");
}), NULL);
AddChild (menu1);//Add a menu into the layer

Cocos2d-x menu option Button Introduction

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.