Saturday, January 04, 2014

Automating CCB Creation

Cocos2d-x is awesome because you can use cocosbuilder for creating scenes / animations with ease. But there could be scenarios where you want to create multiple CCB (cocosbuilder files) like

1) Same animation but different images
     You might want to create a large number of ccb files with different images but same animations. This could be done in the code as well but this would make it easier.
2) Create a starting point for animation.
    If you had to move the images around in the ccb but you know for sure that all the images have to be dragged into the scene and animated.

So how do we do this?...

Well the "CCB" files are nothing but XML files to be more precise they are PLIST files. So all you have to do is create these XML files using a script of some sort so your manual labour is reduced.

Python was the language of choice here because it's very versatile at doing things like these. I was going to use the xml Etree module for handling this but i quickly realized that it was going to be a nightmare if i didn't have a library that could understand and use plists directly. That is when i found the plistlib which has enabled me to manipulate / update the "CCB" files much easier.

With these in hand a couple of template "CCB" files i was able to quickly generate the target "CCB" files with a single script. Pretty neat :) This is going to be crucial for our Comic Next framework.




Thursday, December 26, 2013

QuickDictionary

The Qt5.2.0 is adding support for android and i couldn't be more excited. After fiddling around with the basic Qt based stuff, i realized that the QtQuick is the way to go for making interfaces for the mobile devices. The tutorial video about getting started with QtQuick is a good start for getting acquainted with the QtQuick.

The tutorial covers how to make scalable interfaces only the basic stuff though but it should be good enough to get you started.

Here is the URL:
http://qt-project.org/videos/watch/using-qt-quick-for-rapid-ui-prototyping-and-development

With this as a starting point iv'e been able to create a dictionary app with just QtQuick framework. Well why a dictionary app?

1) I found a really cool minimalistic UI design
2) Had a couple of cool looking color schemes that i could pick
3) I didn't have to create an infinite scrolling list :D
4) Minimal requirements.

With these i've started designing the application. Most of the tutorials claim that the mobile version will just work if the desktop version is working. This is mostly true but as you might expect.. it's not totally true. There are a couple of quirks i had to deal with while developing the dictionary app.

Here are the screenShots of the app on phone



1) Input Line edit has some weird behavior. We should set inputMethodHints: Qt.ImhNoPredictiveText to be able to use it properly.
2) Do not use eval for converting Json string to object. Use JSON.parse instead.
3) Making ui for different Display Sizes is tricky but easy with QtQuick.

Here is the video of the app in action on Nexus5

video


This needs some more tweaks to be awesome .. ill' be uploading the src soon on github.