class HelloWorld : public cocos2d::Layer中添加函数

void menuclose(cocos2d::Ref *psender);

实现:

 void HelloWorld::menuclose(cocos2d::Ref *psender)
{
Director::getInstance()->end();
}

bool HelloWorld::init()中与按钮关联起来

 auto close = static_cast<ui::Button *> (rootNode->getChildByName("Button_1"));
close->addTouchEventListener(CC_CALLBACK_1(HelloWorld::menuclose,this));

截图:

1.cocos_helloworld的更多相关文章

随机推荐

  1. 【Paper Reading】Bayesian Face Sketch Synthesis

    Contribution: 1) Systematic interpretation to existing face sketch synthesis methods. 2) Bayesian fa ...

  2. C - The C Answer (2nd Edition) - Exercise 1-12

    /* Write a program that prints its input one word per line. */ #include <stdio.h> #define IN 1 ...

  3. [MST] Remove Model Instances from the Tree

    In this lesson we will dive a bit more into the tree semantics of MST. In this lesson you will learn ...

  4. ScrollView反弹效果的实现

    发现非常多APP的界面都能够滑动,QQ.微信等等,自己琢磨了下.效果例如以下: 代码:ScrollView package com.wsj.wsjdemo; import android.conten ...

  5. Android Shape使用

    说明 在Android开发中,使用shape可以很方便的帮我们画出想要的背景,相对于png图片来说,使用shape可以减少安装包的大小,而且能够更好的适配不同的手机. 使用 先贴出官网上的说明: &l ...

  6. hpuoj--校赛--考试来了(水题)

    问题 C: 感恩节KK专场--考试来了 时间限制: 1 Sec  内存限制: 128 MB 提交: 475  解决: 112 [提交][状态][讨论版] 题目描述 很多课程马上就结课了,随之而来的就是 ...

  7. es6 --- class 类的继承使用

    传统的javascript中只有对象,没有类的概念.它是基于原型的面向对象语言.原型对象特点就是将自身的属性共享给新对象.这样的写法相对于其它传统面向对象语言来讲,很有一种独树一帜的感脚!非常容易让人 ...

  8. POJ 3661 DP

    题意: 思路: i表示到了i,j表示疲劳度为j f[i][j]表示能跑的最大距离 f[i][j]=f[i-1][j-1]+a[i] if(i-j>=0)f[i][0]=max(f[i][0],f ...

  9. 无滚动条GridView少量图片展示

    import android.content.Context; import android.util.AttributeSet; import android.util.Log; import an ...

  10. 隐私:随机选择 MAC 地址

    隐私:随机选择 MAC 地址 从 Android 8.0 开始,Android 设备在未连接到网络的情况下探测新网络时会使用随机 MAC 地址. 在 Android 9 中,您可以启用开发者选项(默认 ...