摘要: 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) 编辑
摘要: Cocos2d-x之实现动作的反转//实现动作的反转,即向相反方向移动//原动作是向右下角移动的label->runAction(MoveBy::create(1, Point(-50, -50)));//反转之后原动作是向右上角移动的label->runAction(MoveBy::create(... 阅读全文
posted @ 2015-03-28 08:07 silent-bobo 阅读(821) 评论(0) 推荐(0) 编辑
摘要: Cocos2d-x之动作(偏移) bool HelloWorld::init(),添加内容如下://获取可见区域的大小 Size visibleSize = Director::getInstance()->getVisibleSize(); //定义一个label,这里使用了c++11中的auto... 阅读全文
posted @ 2015-03-28 08:06 silent-bobo 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 在上次的场景切换中增加代码,并在res中添加一个图片,作为第一个场景中的图片HelloWorldScene.cpp中的bool HelloWorld::init(){ ////////////////////////////// // 1. super init first if ( !Layer:... 阅读全文
posted @ 2015-03-28 08:01 silent-bobo 阅读(363) 评论(0) 推荐(0) 编辑
摘要: /*** 以下代码实现的是切换场景的目的,* 点击文本框中的字体时,切换场景,有图片*///1.修改bool HelloWorld::init()方法//2.创建ImageScene方法,c++//3.将创建的场景添加到bool HelloWorld::init()中,//4.在最开始的位置上添加#... 阅读全文
posted @ 2015-03-28 07:59 silent-bobo 阅读(463) 评论(0) 推荐(0) 编辑
摘要: 1 如何使用文本标签 LabelText 2 //获取可见区域的大小 3 Size size = Director::getInstance()->getVisibleSize(); 4 5 LabelTTF *label = LabelTTF::creat... 阅读全文
posted @ 2015-03-28 07:56 silent-bobo 阅读(966) 评论(0) 推荐(0) 编辑
摘要: 如何实现输入文本TextFiledTTF 1 //获得可见区域的大小 2 Size visibleSize = Director::getInstance()->getVisibleSize(); 3 4 //使用一个默认要先呈现一段文字 5 TextFieldTT... 阅读全文
posted @ 2015-03-28 07:54 silent-bobo 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 跨平台的日志输出的API-----Log log(“”);的使用方法与c语言中的printf()输出一样 可在控制台查看 阅读全文
posted @ 2015-03-28 07:53 silent-bobo 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 弹出对话框---MessageBox MessageBox("消息内容", "消息标题"); 阅读全文
posted @ 2015-03-28 07:50 silent-bobo 阅读(259) 评论(0) 推荐(0) 编辑
摘要: director是导演,功能用于切换scene 只有在第一次时使用 runWithScene(scene) 以后使用replaceScene() 然后用HelloWorldScene.cpp中的createScene()创建场景,并返回 在创建场景时创建一个层,并把层添加进场景中 然后将游戏的元素添... 阅读全文
posted @ 2015-03-28 07:49 silent-bobo 阅读(340) 评论(0) 推荐(0) 编辑