cocos2d-x

cocos2d-x-3.0 draw vs onDraw

只愿长相守 提交于 2019-11-30 04:30:12
I'm using cocos2d-x v3.0 and in some test project I'm doing some custom drawing by overriding Node 's draw method, but in the DrawPrimitives example provided they do something like this: void DrawPrimitivesTest::draw() { _customCommand.init(_globalZOrder); _customCommand.func = CC_CALLBACK_0(DrawPrimitivesTest::onDraw, this); Director::getInstance()->getRenderer()->addCommand(&_customCommand); } void DrawPrimitivesTest::onDraw() { // drawing code here, why? } From reading the header and source files it seems like this may be some way of sending render commands straight to the renderer, is that

Use new firebase sdk in android eclipse project

邮差的信 提交于 2019-11-30 02:04:55
new firebase with awesome features was just announced, but according to documentation ( https://firebase.google.com/docs/android/setup#prerequisites ) android studio (as well as gradle) is required now. For now in my cocos2d-x apps I have to use ADT/Eclipse to build apps, because gradle isn't supported yet (however cocos2d-x team is working on it). I'm now using an older version of the sdk, which is just a jar file. Is there a way to use new firebase in eclipse? What worries me the most is that plugin: apply plugin: 'com.google.gms.google-services' Francisco Durdin Garcia Take a look at this

Cocos2d-x中Vector<T>容器以及实例介绍

人盡茶涼 提交于 2019-11-30 00:38:56
Vector<T> 是Cocos2d-x 3.x 推出的列表容器, 因此它所能容纳的是 Ref 及子类所创建的对象指针,其 中的 T 是模板,表示能够放入到容器中的类型,在 Cocos2d -x 3.x中T 表示 Ref 类 。Vector<T>是模仿C++ 的 std::vector<T> 模板类而设计的。在内存管理方面不使用__Array 的引用计数,它的内存管理是由编译器自动处理的,可以不用考虑内存释放问题。 Vector<T> 的性能优于 __Array 类, Coco 2d-x 官方将 Vector<T> 设计为__Array 的替代品, 推荐使用 Vector<T> 类。 1 、创建 Vector对象 创建Vector对象有很多函数,下面是总结常用的函数: Vector()。默认的构造函数。 Vector(ssize_t capacity) 。 创建Vector对象,并设置容量。 Vector(const Vector<T> &other) 。用一个已存在的Vector对象创建另一个Vector对象,其中 &other 是左值引用参数传递。 Vector(Vector<T> &&other) 。 用一个已存在的Vector对象创建另一个Vector对象,其中 &&other 是右值引用参数传递。 提示 左值与右值? C++ 中所有的表达式和变量要么是左值,要么是右值

Cocos2d-x 2.2+python开发环境配置和项目创建

天大地大妈咪最大 提交于 2019-11-30 00:30:35
由于一开始学习cocos2d-x时,用的是 2.1 版本,移植方面不太好,于是今天决定换成 2.2 版本的,以下给出配置过程( windows7 环境下的 )。 首先下载需要的工具: Cocos2d-x 2.2.1 下载链接: http://www.cocos2d-x.org/download Python 下载链接: http://www.python.org/getit/ 至于Visual Studio的话,大家可以使用自己喜欢的版本就行了,本人用的是 Visual Studio 2010 配置过程: 1.Cocos2d-x 2.2.1 首先将下载到的Cocos2d-x解压到自己选择的目录。( 这里强烈建议将 Cocos2d-x 解压到没有空格的路径,因为空格很容易引起一些不知的错误 ) 下图是我的解压目录: 然后进行安装,点击 built-win32.bat ,接下来要做的就是冲一杯茶,等待安装完毕。(当然,这个时候可以切换去做其他的事情的) 安装完之后,会自动弹出cocos2d-x 的实例项目 。 2.python 配置 Python同样是解压到自己选择的路径。 然后配置环境变量,将路径配置到环境变量 path 中 3.测试 Cocos2d-x会自动检测你的visual studio 的版本,所以在Cocos2d-x目录下选择对应的项目打开就可以了。 打开后

cocos2d-x v3.0新特性及使用

倖福魔咒の 提交于 2019-11-30 00:27:50
八月份cocos2d-x官网发布了v3.0版本,这次更新的内容特别多,包括2dx的架构以及使用 总得来说,给开发者带来了很大的便利: 运行环境需求: Android 2.3 or newer iOS 5.0 or newer OS X 10.7 or newer Windows (which version?) Linux Ubuntu 12.04 (or newer) 编译环境需求: Xcode 4.6 (for iOS or Mac) gcc 4.7 for Linux or Android. For Android ndk-r8e or newer is required. Visual Studio 2012 (for Windows) 重要更新内容: Replace Objective-C patters with C++ (C++11) patterns and best practices Improve Labels Improve renderer 其中C++ 11 新特性: A subset of C++11 features are being used in cocos2d-x: std::function , including lambda objects for callbacks strongly typed enums, for most of

跟着石头哥哥学cocos2d-x(四)--cocos2dx中的动画以及TexturePacker使用

拟墨画扇 提交于 2019-11-30 00:27:34
之前向Andreas Loew申请了一枚TexturePacker注册码,很快都下来了,作为回报我打算还是写一篇关于 TexturePacker的使用博客吧,有兴趣的可以在这里申请密钥, http://www.codeandweb.com ,前不久他也来信回访过问我使用感觉怎样,因为工作的原因,太忙了,这里我主要介绍下cocos2dx中的动画以及TexturePacker使用。 做动画之前,要准备素材,在demo中的你可以下载: http://pan.baidu.com/share/link?shareid=1419818902&uk=3088193979 打开 TexturePacker, 这个相信大家都看得懂,这里选择cocos2d,然后添加文件夹,该工具会自动加载纹理图片,选择打包的纹理图片以及plist输出路径: 各项参数设定完毕,发布,你会在设置的输出路径得到打包好的图片以及一个plist文件; 接下来,介绍下动画的创作: 动画创作有很多中方式,这里我就采用plist方式来创建动画;注意几点 1.精灵帧缓冲;2.精灵帧;3.动画序列容器;ps:再次建议学2dx的话,有精力, 把源码翻来看看,因为我们很多是记不住的 但是原理一定要明白。 这里直接上创建动画步骤,demo代码片段: 1、加载plist到缓冲帧里面,这里通过数组来创建动画帧序列; 2.将精灵帧添加到数组中; 3

跟着石头哥哥学cocos2d-x(三)---2dx引擎中的内存管理模型

戏子无情 提交于 2019-11-30 00:27:18
2dx引擎中的对象内存管理模型,很简单就是一个对象池+引用计数,本着学好2dx的好奇心,先这里开走吧,紧接上面两节,首先我们看一个编码场景代码: hello word : #ifndef __HELLOWORLD_SCENE_H__ #define __HELLOWORLD_SCENE_H__ #include "cocos2d.h" class HelloWorld : public cocos2d::CCLayer { public: // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone virtual bool init(); // there's no 'id' in cpp, so we recommend returning the class instance pointer static cocos2d::CCScene* scene(); // a selector callback void menuCloseCallback(CCObject* pSender); // implement the "static node()" method manually CREATE_FUNC

跟着石头哥哥学cocos2d-x(二)---2dx跨平台编译以及2dx概述

ⅰ亾dé卋堺 提交于 2019-11-30 00:27:03
ps:目录是2dx概述!!! 上一节中我大概简述了2dx引擎环境的搭建,在交叉编译一概而过,这一节我将详细说下这方面的内容, 有人提出不用cygwin来编译,用adt毫无压力,额 我只想说 adt从我搞android就没有碰过那玩意,一直用idea,现在的旗舰版idea12对android支持相当完美,搭配maven管理,发挥到极致。这就不说了,这里我放出cygwin离线安装: http://pan.baidu.com/share/link?shareid=4138200214&uk=3088193979 ,如果下在不了就告诉我下哈。 欲开发比如利器准备,这里我推荐cygiwn+vs2012(屌丝一枚 不像土豪)+idea12+vs助手; cygin:模拟win上的linux编译环境,vs开发语言c++ ,为啥vs2012 ,额这个主题不错深色的,不伤眼睛,idea12编译app; 1.创建一个项目,当然创建项目多样化,一种是直接在vs上创建(前提你已经按照上一节中安装了模版),另一种就是用python脚本来创建(也比较方便可以多个平台都创建),这里先说后面一种: 1.搭建python环境,这里要装pyhton版本是27的,笔者试过33的不行哈,环境搭建好了,切换 cocos2d-x-2.2的目录中进入到\tools\project-creator目录下 运行如下命令:

cocos2d-x游戏开发从基础到进阶视频教程

送分小仙女□ 提交于 2019-11-29 23:51:24
下载链接: https://www.yinxiangit.com/154.html 目录: Cocos2d-x 基础 1、Cocos2d-x 第一步 2、Cocos2dx常用功能-Cocos2dx开发常用控件详解 3、Cocos2d-x特效:场景切换效果、控件动作、逐帧动画 4、Cocos2d-x常用功能-Cocos2d-x用户交互事件处理:触摸、传感器、物理按键 5、Cocos2d-x常用功能-Cocos2d-x常用工具:计时器、数据读写、文件读写 6、TMX 地图解析 7、粒子系统初级应用 8、CocosStudio 2.0 容器控件 9、CocosStudio 2.0 文件格式解析 10、CocosStudio 2.0 基础控件 11、Cocos2d-x v3的3D功能 12、Cocos2d-x v3物理引擎 13、Cocos2d-x v3新增UI控件 14、Cocos2d-x v3游戏控制器 15、Cocos2d-x v3事件机制 16、开发环境搭建及cocos命令行工具的使用 17、Cocos2d-x 3.2截屏功能的使用 18、Cocos2d-x 3.x中自带物理引擎使用教程 12、Cocos2d-x 进阶 1、Cocos2d-x功能扩展-C++-Cocos2d-x-Android-iOS混合编程与NDK开发环境搭建 2、彩虹糖粒子特效 3、Cocos2d-x功能扩展

Cocos2d for iPhone vs. Cocos2d-x [closed]

若如初见. 提交于 2019-11-29 20:09:57
I have worked some with Cocos2d for iPhone and find it delightful. I am starting another project, and have stumbled across Cocos2d-x, a C++ port. I'm tempted by the notion of being able to (with consideration) build for multiple platforms at once. I'm equally comfortable with Obj-C and C++, and am not looking for comparisons between the two languages unless it's specifically related to working with Cocos2d. Has anyone worked with both versions of the engine, and can you comment on specific pros and cons of the two? Is Cocos2d-x "finished"? Reliable? The lure of multi-platform builds are a