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: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
DominoPower: Application development, William Shatner, and the origin of the universe
OutlookPower: More about disappearing text
-- Advertisement --

SECURE YOUR SITE WITH AN IRONCLAD SSL CERTIFICATE
An IronClad SSL Certificate helps you build an impenetrable fortress around your customer's credit card information. IronClad SSL Certificates are:

  • Fully validated
  • Up to 256-bit encryption
  • Up to 10 years validity
  • Stringent authentication
  • Around-the-clock customer support

Build trust. Protect your customers. Grow your online business.

Tap here now and be IronClad with SSL tonight.

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