Play video and game in same scene in cocos2dx

Play video and game in same scene in cocos2dx
0.0 0


COCOS2dX masters ,I just started game development with COCOS2dX and stuck at some point.

I am developing a simplegame in android platform by learning from sample provided by cocos2dx development kit.Every thing is working good.

Game requirements:

  1. Game has single screen.
  2. screen will divided into to parts.
  3. 40 of screen will use to play video clips.
  4. 60 of screen will use for play the game.

What I have done with is:

  1. Game is working and uses whole screen.
  2. Able to play video it also uses whole screen.

What I have to achieve :

  1. Video should be plays continuously in 40% of screen
  2. Remaining part should be use for playing game.

In short I need to perform both the functionality in single “CCScene”

Both the things are working properly but in different scene.
Thanks in advance for best solution.


What about having 2 layers as part of the CCScene, each taking up the 40 and 60 of the screen? a split view, essentially.


Exactly I tried that but setContentSize() for video layer is not working. Video always show in full screen.


can you show me how you make the layers and set the size?


See this post to view my complete code


I dont see where you actually create 2 layers. Maybe I am missing something……I just see the one…


Answered here :


Thanks to all cocos2d-X masters for the help.Find the solution.