Tag Archives: Apportable

Apportable

It’s taken me quite a bit of work to get as proficient with iOS and Objective C as I am. I’m not going to downplay the amount of time and energy I’ve spent on my skills, while simultaneously working full-time and going to graduate school full-time. It’s hard.

But iOS captures only about 45% of the Mobile Platform market. Over half of Mobile Devices are running Android now, and every developer needs to be at least familiar with the language.

But that means another 8 months of sleepless nights while crawling through the introductory exercises of a new library. Doesn’t it? Nope.

There are plenty of tools to compile Objective C code to the Android Platform. I started working with the Apportable Engine.

I’m a little skeptical, but I’m optimistic that this will really cut-down on the Android learning curve, especially for Video Game Development.

I’ll be posting my progress and some of the more, memorable, bugs I run into while using the Apportable Engine in the hopes that it might make some people’s lives a bit easier.

Compiling to Android

I ran into a really interesting, some might say frustrating, quirk of the Apportable Engine.

In order to get XCode to compile on the Android OS, it turns out that you have to explicitly add any file or resource that your project is going to use to your project.

In order to do this, first navigate to the Build Phase Tab in you Project Navigator.

Then, in the Compile Sources Section you’ll have to manually add references to your Class files.

Apportable_Adding Code

Then, in the Copy Bundle Resources Section you’ll have to manually add references to you resource file.

Apportable_Adding Reseources

 

And that should clear up the error.

Apportable CCClippingNode Problem

I had some trouble with the CCClippingNode on the Apportable Compiler earlier this week. I had it working perfectly well in iOS, but when I cross-compiled my application to Android, my CCClippingNode wasn’t working and all I was getting was this lovely little error message:

 [CCClippingNode initWithStencil:]_block_invoke : Stencil buffer is not enabled; enable it by passing GL_DEPTH24_STENCIL8_OES into the depthFormat parrameter when initializing CCGLView. Until then, everything will be drawn without stencil.

The solution to this problem is actually pretty simple. We will need to modify function setupView:  in Platforms/Android/CCGLView.m.

CCGLView is setting the depth and stencil size to 0 when it calls its eglChooseConfig method. In order to get non-zero values, we’ll have to add the data to our CCGLView class manually.

This can be done by adding the following two lines to structure configAttribs[] (at the very beginning of function setupView:)

Apportable_CCClippingNode_01

And Voila! We’ve got our CCClippingNode starting to clip contents on Android too.