摘要: cocos2d-x之触摸目标的判断需要在触摸事件的内部添加判断目标的代码 1 //EventListenerTouchOneByOne表示一个接一个的触发,每次触摸只能监听到一个触摸点 2 auto listener = EventListenerTouchOneByOne::create(... 阅读全文
posted @ 2015-03-29 08:23 silent-bobo 阅读(407) 评论(0) 推荐(0) 编辑
摘要: cocos2d-x之为label添加事件监听器,单点触摸在bool HelloWorld::init() 1 //获取可见区域的大小 2 Size visibleSize = Director::getInstance()->getVisibleSize(); 3 //定义一个文本,... 阅读全文
posted @ 2015-03-29 08:04 silent-bobo 阅读(1518) 评论(0) 推荐(0) 编辑
摘要: cocos2d-x之Menu菜单选项按钮简介 //创建一个menu,第一个参数是菜单项,可变参数,相当于java中的可变参数 //MenuItemImage::create(普通状态的图片背景, 被选中的图片背景, //callback(回调,事件回调,即按钮被点击后的要执行的方法)) //[]()... 阅读全文
posted @ 2015-03-28 08:14 silent-bobo 阅读(589) 评论(0) 推荐(0) 编辑
摘要: cocos2d-x中的内存管理机制 Object *obj = new Object(); obj->autorelease();//自动释放资源 // { // //在这段中使用obj // obj->retain();//保留对象 // obj->release();//手动释放资源 // ... 阅读全文
posted @ 2015-03-28 08:13 silent-bobo 阅读(147) 评论(0) 推荐(0) 编辑
摘要: cocos2d-x之TableView列表HelloWorld.h#ifndef __HELLOWORLD_SCENE_H__#define __HELLOWORLD_SCENE_H__#include "cocos2d.h"#include USING_NS_CC_EXT;USING_NS_CC;... 阅读全文
posted @ 2015-03-28 08:13 silent-bobo 阅读(2717) 评论(0) 推荐(0) 编辑
摘要: cocos2d-x之逐帧动画在bool HelloWorld::init()中添加如下内容//缓存,帧动画的帧的缓存 auto cache = SpriteFrameCache::getInstance(); cache->addSpriteFramesWithFile("anim.plist");... 阅读全文
posted @ 2015-03-28 08:12 silent-bobo 阅读(449) 评论(0) 推荐(0) 编辑
摘要: //实现动作的监听,动作序列执行完后,弹出一个MessageBox label->runAction( Sequence::create( MoveBy::create(1, Point(100,100)), RotateBy::create(1, 360), CallFunc::create( [... 阅读全文
posted @ 2015-03-28 08:11 silent-bobo 阅读(402) 评论(0) 推荐(0) 编辑
摘要: Cocos2d-x之Sequence动作序列执行//实现动作的序列执行,先执行移动,然后在执行旋转 label->runAction(Sequence::create(MoveBy::create(1, Point(100,100)), RotateBy::create(1, 360),NULL))... 阅读全文
posted @ 2015-03-28 08:10 silent-bobo 阅读(1498) 评论(0) 推荐(0) 编辑
摘要: Cocos2d-x之的动作混合//实现多个动作同时运行,同时移动同时旋转着,使用Spawn进行设置多个动作label->runAction( Spawn::create( MoveBy::create(1, Point(100, 100)), RotateBy::create(1, 360), NU... 阅读全文
posted @ 2015-03-28 08:09 silent-bobo 阅读(359) 评论(0) 推荐(0) 编辑
摘要: Cocos2d-x之的动作的重复在动作一篇中为其添加如下内容,最后的位置添加//label实现旋转,旋转了180度(时间,多少度)//label->runAction(RotateBy::create(1, 180));//让label重复执行 (动作,次数)//label->runAction(R... 阅读全文
posted @ 2015-03-28 08:08 silent-bobo 阅读(412) 评论(0) 推荐(0) 编辑