打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
CC_UNUSED_PARAM

  2.#define CC_UNUSED_PARAM(unusedparam)   (void)unusedparam
  用CC_UNUSED_PARAM(event) 这样做的意义何在?查了一下有这样的解释don't use this for C++, it should only be used in plain C files or   ObjC methods, where leaving off the parameter name is not allowed;不要在C++中这样用,它应该用于纯c或object—c不用(leave off)参数的名字不允许的方法中。我问同事给的答案是“要是不用的话 编译器就会 警告有未用的参数”。做个helloworld 知道,这个没什么就是把传进来的参数强转一下,也不付给任何变量,这样就让编译器知道,这个值参数使用了。

  3.CCRenderTexture To render things into it, simpley construct a render target, call begin on it, call visit on any cocos scenes or objects to render them, and call end. For convienience, render texture andds aprite as it's display child with the results, so you can simply add the render texture to your scene and treat it like any other cocosNode. There are also funcitons for saving the render texture to disk in PNG or JPG format.注释掉CCRenderTextrue看看对比效果;不过这个还要牵扯云彩运动时,根据运动到的点来擦出,之前的背景,目前至看一下CCRenderTexture吧!

 发现一个屏过云时是黑色的。但是没有通过CCRenderTexture设置背景,那么可能是它设置了透明度的原因吧!改了改看看效果,不是,那个原因,zorder也不是!(怎么做到的呢?)

1  in_texture->begin();
2 new_game_scene_->visit();
3 in_texture->end();
4 addChild(in_texture,kZOrderMainMenuBackground);

实际上背景的是new_game_scene_->visit();CCObject的virtual vist方法:recursive method that vist its children and draw them.
查了下别人的总结:使用CCRenderTexture的5个步骤:

1.创建一个新的CCRenderTexture。这里,你可以指定将要创建的纹理的宽度和高度。
2.创建一个新的CCRenderTexture, begin方法启动OpenGL, 并且接下来, 任何绘图的命令都会渲染到CCRenderTexture里面去,而不是画到屏幕上。
3.绘制纹理。你可以使用原始的OpenGL调用来绘图,或者你也可以使用Cocos2d对象里面已经定义好的visit方法。(这个visit方法就会调用一些opengl命令来绘制cocos2d对象)
4.调用CCRenderTexture的end。此方法会渲染纹理,并且关闭渲染至CCRenderTexture的通道。
5.从生成的纹理中创建一个sprite。你现在可以使用CCRenderTexture的sprite.texture属性来轻松创建新的精灵了。
OpenGL还没看过不会呢,有空得补一下!现在学习很零碎,不系统。
  最近又看代码才知道,原来visit使用opengl重写了一下,才产生的如此过场动画的效果

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
商店按钮【三种状态】ShopItem And ShopMenu | Software MyZone
Video
【玩转cocos2d-x之二十四】截图保存功能的实现
关于OPENGL与OPENGL ES的区别
Мобильный LiveInternet Texture | гилана
Android使用OPENGL显示YUV图像
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服