Search PalmPower's 487 Palm-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
PROGRAMMING POWER
Setting application preferences
By Alan Jay Weiner

Last month I started writing a small game for my son. This month we'll add a couple of small features and allow some configurability. Configurations should be "sticky" -- they should remain set until we change them, even if we run other programs and then return to the original application.

Palm applications use "preferences databases" to store these kinds of user configurations. Applications may store a small amount of data as a preferences record. They retrieve that data when they start, they store it when they exit. Having everyone use the same database saves each application from creating a special database just for their user configurations and provides a uniform method for applications to preserve configuration data between runs.

Changes to rocketship
Before we get into how to use preferences, lets take a quick look at what I changed in Rocketship.

First, I added a few definitions in the beginning, including the Creator ID. I'll speak about that in a moment.

Second, I added a menu to allow configuring the vertical speed. At the same time, I changed SetPrelaunch and LaunchRocket so they set vertspeed from the configured speed (cfg_vertspeed) at launch time rather than pre-launch. SetPrelaunch occurs after the rocket hits the top, at the end of the game (such as it is). If you play a game, and then change the speed, it wouldn't take effect on the next game since that game's speed was already set. Setting vertspeed at launch time fixes this problem.

I also fixed two bugs. The first allowed tapping the screen to make the rocket go faster. It decremented vertspeed for each tap, but it allowed it to go below zero. This should've caused problems, but didn't because of the second bug. That one failed to use vertspeed as a counter at all! If you look at RedrawRocket from last month's listing, I never updated lastmovetime. So after the first movement delay, the rocket was going full speed! Oops...RedrawRocket now updates the lastmovetime value.

This had an interesting effect. It turns out that the value I picked for the initial time delay was way too slow. I've changed these so they range from 0 (fast) to 10 (very slow).


1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Phones and PDAs > Palm and Treo > Programming (24 articles)
   How PDA software is born
   Program with Simplicity
   Kinectivity 2.0 brings enterprise application developers new tools
Home > Games > Palm Games > Writing a Game (3 articles)
   Finishing up Rocketship
   Rocketship: writing a PalmPilot game
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Other PalmPower Articles
Palm gets up to date with new Tungsten family of handhelds
Create handwritten email with riteMail
Presenter-to-Go puts PowerPoint presentations on your Palm OS handheld
Looking for the cutting edge
Gain remote access to databases and PLCs
PalmSource Open House showcases what's new in the Palm community
Analysis: handheld market share
More from the ZATZ journals
Computing Unplugged: Eight steps to successful and reliable home backups
David Gewirtz Online: CNN commentary and analysis
DominoPower: What to look for in a Domino-based document management solution
OutlookPower: Can Outlook run when it's not running (and other mysteries)?
-- Advertisement --

ONLINE GROUP CALENDAR - FOR UP TO 100 OF YOUR CLOSEST FRIENDS
Stay organized and in control with 24/7 access to all of your important events, projects and files --whether you're at work, at home or on the road.

You can share your calendar, projects and files so everyone in your office is up to date. Plus, search your entire group to find times when everyone is available to meet, manage company resources and much more.

Organize your entire team for as low as $9.95 per year (and yes, that's where the decimal place is supposed to be!)

Tap here to get started right away.

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2009, ZATZ Publishing. All rights reserved worldwide.
Editor's Login