Btw I just wanted to create archive and got error that libcocos2d tvOS.a is compiled without bitcode. I had to add OTHER_CFLAGS="-fembed-bitcode" in line 160 (build.sh). Then it worked.
edit:
app sent and waiting for review. Many thanks to @elvman
Hi Iām having the same problems as piotrros (on both simulator and device), Iām using your project as it is, using COCOS2DX_HOME, could you try adding a ācocos2d:ui::Buttonā to MainMenu.cpp? that seems to trigger these errors:
Btw I can compile and test on both the simulator and on device by not adding a cocos2d::ui:Button. So Im not sure why it doesnt work when I add that.
Undefined symbols for architecture x86_64:
"cocos2d::StencilStateManager::onAfterVisit()", referenced from:
cocos2d::ui::Layout::stencilClippingVisit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int) in libcocos2d tvOS.a(UILayout.o)
"cocos2d::StencilStateManager::onBeforeVisit()", referenced from:
cocos2d::ui::Layout::stencilClippingVisit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int) in libcocos2d tvOS.a(UILayout.o)
"cocos2d::StencilStateManager::onAfterDrawStencil()", referenced from:
cocos2d::ui::Layout::stencilClippingVisit(cocos2d::Renderer*, cocos2d::Mat4 const&, unsigned int) in libcocos2d tvOS.a(UILayout.o)
"cocos2d::StencilStateManager::StencilStateManager()", referenced from:
cocos2d::ui::Layout::Layout() in libcocos2d tvOS.a(UILayout.o)
"cocos2d::ui::PageViewIndicator::setDirection(cocos2d::ui::ScrollView::Direction)", referenced from:
cocos2d::ui::PageView::setDirection(cocos2d::ui::ScrollView::Direction) in libcocos2d tvOS.a(UIPageView.o)
cocos2d::ui::PageView::setIndicatorEnabled(bool) in libcocos2d tvOS.a(UIPageView.o)
"cocos2d::ui::PageViewIndicator::setSpaceBetweenIndexNodes(float)", referenced from:
cocos2d::ui::PageView::setIndicatorSpaceBetweenIndexNodes(float) in libcocos2d tvOS.a(UIPageView.o)
"cocos2d::ui::PageViewIndicator::reset(long)", referenced from:
cocos2d::ui::PageView::onItemListChanged() in libcocos2d tvOS.a(UIPageView.o)
"cocos2d::ui::PageViewIndicator::create()", referenced from:
cocos2d::ui::PageView::setIndicatorEnabled(bool) in libcocos2d tvOS.a(UIPageView.o)
"cocos2d::ui::PageViewIndicator::indicate(long)", referenced from:
cocos2d::ui::PageView::doLayout() in libcocos2d tvOS.a(UIPageView.o)
cocos2d::ui::PageView::moveInnerContainer(cocos2d::Vec2 const&, bool) in libcocos2d tvOS.a(UIPageView.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Well I donāt know why it isnāt working, but from most UI you wonāt get any benefit. Like ui::Button - it wonāt trigger clicking anyway. So I abandoned loading scene from studio and did everything from code. Itās not most comfortable solution though.
Yeah I would too but all my game ui is made using ui::Buttons, mainly to use the scale9 stretching, last time I saw it was available only to ui:: widgets.
Found the error, actually Iām not sure its an error, perhaps this was done on purpose? but the ui/widgets/UIPageViewIndicator.cpp and base/CCStencilStateManager.cpp were not marked as part of the tvos target, on the cocos2d_libs project.
How to get called menuPlayCallback method. I am running app on Apple Tv 4th generation device. I was not be able do detect MenuItemSprite is focused and touched. How to move remote point to that button.
Please suggest how to get click listener on menuitem sprite.
I am running this sample on real device. Sample is running but I will not be able to get call MenuItemSprite click listener function. How to move remote to menu item place. I move the finger on remote and I got the log of key up, left, right, down with value but not getting selecting effect on MenuItemSprite (Blue Color).
May Be I am missing anything in use of remote. Not getting select hint so user can see whether he is on screen.
Please give me some clue to I will start further working.I am stuck on this.
Without MenuItemSprite click listener how we navigate between screens.
In device user direct touch on screen, In apple Tv user doesāt getting any like mouse point so user click on it.
I have odd behavior on this. When I exit the app using MENU then start it again and then press the MENU again it will ALWAYS exit the app even if [super pressesBegan:presses withEvent:event] is NOT CALLED.
Do you have similar behavior? Any idea what is going on?
Thanks!
Does anyone know if Cocos2d-x will officially support tvOS?
@elvman It is very impressive how you put all of this together.
Iāve played around with it some and have the sample working.
Only issue was that for some reason tvOS doesnt like UIKeyboardWillShowNotification, UIKeyboardDidShowNotification, UIKeyboardWillHideNotification and UIKeyboardDidHideNotification, so needed to comment the use of those out in CCEAGLView-tvos.mm.
Iām just getting started with tvOS, so havenāt looked into tvOS requirements yet.
Have you looked into changing the tvos/RootViewController into a subclass of GCEventViewController and then setting controllerUserInteractionEnabled = NO to trap menu button presses to prevent exiting the app when you are showing a scene that should not exit the app?
This video has some info at about 18:00 that discusses how to manage exiting your app as described above. Not certain yet if elvmanās sample app is 100% compliant with trapping menu button calls and preventing the system from exiting the appā¦ I will be testing that soon.
A related issue that I am also working on is that sounds are not playing properly after exiting the app and then resuming it.
There is no substitute for getting your hands dirty. You will understand the work you did to get there. Seriously. No joke, not trying to be a smart ass. But asking for a handout in a thread that clearly accomplishes what you want probably seems naive.
FIXED by adding all cocos/audio/ios files into cocos2d_libs project.
Also needed to update CDAudioManager files from the link shown in header of this topics.
Thanks!