Good documentation doesn’t come easy
Documenting source code is rarely something a coder likes to do. I’m just as guilty as anyone else. I know it’s a “good thing”, but my natural inclination is to code first and document later. Sometimes later comes so late that it’s a chore to get it done. I’ve been forcing myself to document as I go, and it usually works out pretty well in the end.
I’m a control freak
What’s made this process easier for me is to completely dump the notion of auto-generated documentation (I’m looking at you, javadoc, jsdoc, yuidoc, ruby-doc and the like). Instead, I favor writing the documentation for a given piece of code with markdown.
Continuing with my explorations in the webOS 1.4.5 SDK, I’ve picked out a couple of other useful calls to the PalmSystem object. Both can be added to the “hello world” example I started in part one, and they’re really quick.
A common requirement for mobile apps is the ability to respond to device orientation. I’m still digging around to see where you can hook into these events, but in the meantime here’s a simple call which is quite useful:
This tells webOS to let your app rotate along with the device orientation, switching from portrait to landscape as necessary. It’s a high-value one-liner call which should serve most orientation needs.
You can also specify a “locked” orientation with different strings in place of “free”. Options are: up (default portrait), down, left and right. So if you have a side-scroller game that would benefit from horizontal presentation, just use:
Step one: Make a web app and test it in Chrome or Safari.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Save this into a new folder (using a folder name of “hello” in this example) as index.html. This will become your app folder. You can test your app in Chrome or Safari by simply opening this file in your browser. Not terribly impressive, but hey, it’s a start.
So, when I made Jo, many of the controls were ported over from an older library used in my webOS titles. I was never completely happy with the flicky-scrolly-control, mostly due to sorting out event annoyances, especially between mobile platforms. Now it’s even worse, and I’m tempted to have platform-specific code for certain platforms which have their own enhanced gesture systems. More code, little build complexity, but possibly a big payoff. The animation will still be CSS3-based, so really it’s a matter of sorting out gestures from tap and drag events.