cocos2d 多点触控
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
USING_NS_CC;
class HelloWorld : public cocos2d::CCLayer
{
public:
virtual bool init();
static cocos2d::CCScene* scene();
void menuCloseCallback(CCObject* pSender);
CREATE_FUNC(HelloWorld);
//touch
private:
virtual void registerWithTouchDispatcher(void);
virtual void ccTouchesBegan(CCSet * set,CCEvent * e);
virtual void ccTouchesMoved(CCSet * set,CCEvent * e);
virtual void ccTouchesEnded(CCSet * set,CCEvent * e);
//写上生命周期函数
virtual void onEnter();
virtual void onExit();
};
#endif // __HELLOWORLD_SCENE_H__
#include "HelloWorldScene.h"
CCScene* HelloWorld::scene()
{
CCScene *scene = CCScene::create();
HelloWorld *layer = HelloWorld::create();
scene->addChild(layer);
return scene;
}
bool HelloWorld::init()
{
if ( !CCLayer::init() )
{
return false;
}
this->setTouchEnabled(true);
return true;
}
void HelloWorld::registerWithTouchDispatcher(void){
//注册监听
CCDirector::sharedDirector()->getTouchDispatcher()->addStandardDelegate(this,0);
}
void HelloWorld::ccTouchesBegan(CCSet * set,CCEvent * e)
{
CCLOG("hello begin");
}
void HelloWorld::ccTouchesMoved(CCSet * set,CCEvent * e)
{
CCLOG("hello moved");
}
void HelloWorld::ccTouchesEnded(CCSet * set,CCEvent * e)
{
CCLOG("hello ended");
}
void HelloWorld::onEnter()
{
CCLayer::onEnter();
}
void HelloWorld::onExit()
{
CCDirector::sharedDirector()->getTouchDispatcher()->removeDelegate(this);
CCLayer::onExit();
}
cocos2d 多点触控的更多相关文章
- Cocos2dx 多点触控
1 最容易忽略的东西,对于ios平台,须得设置glView的属性: [__glView setMultipleTouchEnabled:YES]; 2 如果调用CCLayer的方法setTouchEn ...
- 【原】cocos2d-x开发笔记:多点触控
在项目开发中,我们做的大地图,一个手指头按下滑动可以拖动大地图,两个手指头按下张开或者闭合,可以放大和缩小地图 在实现这个功能的时候,需要使用到cocos2d-x的多点触控功能. 多点触控事件,并不是 ...
- [示例] Firemonkey OnTouch 多点触控应用
说明:Firemonkey OnTouch 多点触控应用,可同时多指移动多个不同控件 原码下载:[原创]TestMultitouchMove_多点触控应用_by_Aone.zip 运行展示:
- ccc 多点触控2
经过不断的思考发现,如果是两个sprite都添加触控的时候,往往直接成单点触控, 但是如果是两个node的时候在node上面点击就会变成多点触控的形式 cc.Class({ extends: cc.C ...
- ccc 多点触控
研究了一天,多点触控的点无法保存,只能模拟多点触控了 cc.Class({ extends: cc.Component, properties: { wheelStick:{ default:null ...
- Android 多点触控与简单手势(一)
现在一般的Android手机都会使用电容触摸屏最少可以支持两点触摸,多的可能是七八个,所以基本上都会支持多点触控, android系统中应用程序可以使用多点触控的事件来完成各种手势和场景需求. And ...
- Android多点触控技术实战,自由地对图片进行缩放和移动
转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/11100327 在上一篇文章中我带着大家一起实现了Android瀑布流照片墙的效果, ...
- MultiTouch————多点触控,伸缩图片,变换图片位置
前言:当今的手机都支持多点触控功能(可以进行图片伸缩,变换位置),但是我们程序员要怎样结合硬件去实现这个功能呢? 跟随我一起,来学习这个功能 国际惯例:先上DEMO免费下载地址:http://down ...
- windows8 开发教程 教你制作 多点触控Helper可将任意容器内任意对象进行多点缩放
http://blog.csdn.net/wangrenzhu2011/article/details/7732907 (转) 实现方法: 对Manipulation进行抽象化 使不同容器可共用多点缩 ...
随机推荐
- Unity游戏开发之“屏幕截图”
原地址:http://sygame.lofter.com/post/117105_791680 在unity游戏开发中,可能会遇到在游戏中截屏的效果.这儿提供两种截屏方法.(方法二提供显示截图缩略图代 ...
- [Unity3D]计时器/Timer
原地址:http://blog.sina.com.cn/s/blog_5b6cb9500101aejs.html https://github.com/xuzhiping7/Unity3d-Timer ...
- retain copy(浅复制) mutablecopy (深复制)
http://blog.csdn.net/xdrt81y/article/details/24331103 口诀: 1浅3深 NSArray copy (浅) 返回NSArray NSArra ...
- JAVA-- M选N的组合算法
M选N的组合算法 只要每个数字出现一次就可以 举例 :也就是说123与321和213属于重复 只算一组 此算法已经排除了重复数据 应用--彩票的注数算法 本程序的思路是开一个数组b,其长度 ...
- [ES4封装教程]3.使用 Easy Sysprep v4 封装 Windows 7
(一)安装与备份系统 1.安装 Windows 7 可能很多人会说,安装Win7谁不会,这也用说?装Win7的确人人都会,但如何安装才是最适合系统封装的,就未必是人人都会了.安装是封装之本,没有好的安 ...
- MQTT——安装、测试
MQTT学习笔记——MQTT协议体验 Mosquitto安装和使用 http://blog.csdn.net/xukai871105/article/details/39252653 ...
- iOS 中使用类别简化代码开发
最近需要一个函数,把CLLocation对象转化为NSDictionary,按照我以前的想法,我会写一个工具类,之后添加一个函数,类似这样 - (NSDictionary *)turnLocation ...
- Win7下虚拟机个人使用小结:Virtual PC,VMware和VirtualBox
想来用了很多年的虚拟机了,换了Win7之后,种种原因又需要使用虚拟机,这里就简单介绍和比较一下. 点击小图看大图. Virtual PC: 如果想做Windows虚拟机的话,Virtual PC在之前 ...
- Java for LeetCode 160 Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...
- Java for LeetCode 030 Substring with Concatenation of All Words【HARD】
You are given a string, s, and a list of words, words, that are all of the same length. Find all sta ...