I am playing a short video with CCVideoPlayer in cocos2d and at the end of it I am capturing the very last frame of the video and I am showing it on the screen using a UIVeiw because trying to draw it on a CCLayer makes the image show up with slightly different colors. I would imagine that is because the way that things are drawn in cocos2d is different than the way they are drawn on a UIView. So I need some way to keep the image on the screen Using the UIview, and I need to be able to draw sprites etc... on top of this view. So my question is, Is there a way to make a CCLayer transparent so that the UIView containing the image can still be seen and then draw on top of the image using a CCLayer?
How to use a UIView with a CCLayer cocs2d?
(8 posts) (3 voices)-
Posted 6 months ago #
-
You can play with opacity of the color layer (CCLayerColor):
[m_colorLayer setOpacity:o];Posted 6 months ago # -
I have tried that but the background just goes black and the UIView will not show through.
Posted 6 months ago # -
I had to do something similar in the past and documented it here:
I'm not sure if that exact thing will work with the current version of cocos2d, but it might point you in the right direction.
Posted 6 months ago # -
You have to init CCLayerColor layer properly. You can have a transparent layer.
Posted 6 months ago # -
How do you initialize your layer? You should be able to control colors and opacity.
E.g:@interface CCGameLayer : CCLayerColor { //... }@implementation CCGameLayer - (id) initWithColor:(ccColor4B)color width: (GLfloat)w height:(GLfloat)h { if( (self=[super initWithColor:color width:w height:h]) ) { //... } return self; } //...Posted 6 months ago #
Reply
You must log in to post.