Building for the new AppleTV / tvOS

Hi @umai, sorry for being a bit late to reply. I am using precompiled bitcode enabled libs for the tvOS/iOS app mentioned above and it works flawlessly. @elvman provided the precompiled libs that get included when building the cocos2d-x libs. Just check out his post to this thread earlier.

Do you still plan on adding tvos support in v3.11?
I can imagine that you were busy with releasing Cocos creator and also with GDCā€¦

@ShunLin any update on this?

Hey,

Will it be available this week by any chanceā€¦ I really want to submit my game for the applovin competition.

https://blog.applovin.com/two-weeks-until-the-deadline-for-the-tvos-contest/

Deadline is 31st March. :frowning:

Thanks

Just use what is available @b12345, it works great. Especially for the competition, where you will only submit a TestFlight build and not release to thousands of users.

Is the TVOS Kit freely available? How is it possible to get it?

You can get it is you sign up to be an Apple Developer. developer.apple.com

The tvOS 9.3 update removed notifications related to the on-screen keyboard.
see the changes here:
https://developer.apple.com/library/tvos/releasenotes/General/tvOS92APIDiffs/Objective-C/UIKit.html
Has anybody got a workaround yet?

@elvman Everything works great on apple tv simulatorā€¦ but i get the following error when testing it on a ATV device

(ftbase.ios8_arm64.o), building for tvOS, but linking in object file built for iOS, for architecture arm64

Iā€™ve tried replacing the prebuilt libraries but nothing seems to work. What am I doing wrong?

@elvman thanks i made it work!

Things that still donā€™t work
-cocos2d ui elements ( i had to remove shop from my game since it was based on scroll layers)
-Clipping Nodes (i had to remove all HUD from gameā€¦ add simpler ones)

Thanks again :smile:

You should check out my 2D game engine ā€œouzelā€ (https://github.com/elvman/ouzel), because I am a bit upset with cocos2d-x and decided to push my effort towards my own engine and not waste time on numerous pull requests that are not being merged into the core of cocos2d-x.

@elvman it turns out i cannot generate a buildā€¦ it gives me an error that all libraries should be built in arm64. submission time is almost up 5 hrs left. :frowning:

Cocos2d-x 3.8

tvOS support

do you use system font? I can not set color of a system font. It works great for iOS/OSX but under tvOS the text color is always black. Any hints?

auto *n =  Label::createWithSystemFont("BBåŸŗęœ¬ē‰Œå †åˆ°äø“ę—¶AA", font, fontSize, dimensions, hAlignment, vAlignment);

n->setColor(Color3B::RED);
n->setTextColor(Color4B::RED);
n->updateDisplayedColor(Color3B::RED);

result is still blackā€¦
TTF font is unusable for orient languages because the file size is 25MB at minimum (what Iā€™ve found so far).

FOUND solution for colored system font on tvOS:
FIX: CCDevice-tvos.mm:

ORIG:

      [str drawInRect:rect withAttributes:@{ NSFontAttributeName: font, NSParagraphStyleAttributeName:paragraphStyle }];

NEW:

[str drawInRect:rect withAttributes:@{ NSFontAttributeName: font, NSParagraphStyleAttributeName:paragraphStyle,
    NSForegroundColorAttributeName:[UIColor colorWithRed:info->tintColorR green:info->tintColorG blue:info->tintColorB alpha:info->tintColorA]
}];
2 Likes

Hello all
Can we create new Apple tv os project using latest cocos2dx version 3.13?

I believe you can :slight_smile:

1 Like

Thanks for your reply @slackmoehrle .

I followed following tutorial link to add spotlight effect for apple tv game.

I am getting white patches on the screen, but same code works fine in iPad and iPhone versions.

Can anyone tried implementing shaders for apple tv using cocos2dx?
Is there any specific steps to include to add shaders for tvOs version?

Can anyone help me to resolve this issue.
Thanks in advance

This is amazing. I was able to run my game on the simulator. Thanks!