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 --

NO HASSLE PHOTO PRINTING, SHARING, AND STORAGE -- AS LOW AS $2.54 PER MONTH
Discover an easier way to share, print and manage your photos online! Get your own online photo album site for sharing photos, as well as easy-to-use editing tools to make sure your photos look their very best. You can even order high quality prints directly from your album -- and have them delivered right to your door!

Best of all, you can also get login-free photo sharing at your personal domain name (if you have one), so your friends and family don't have to hassle with signing up or logging in just to view your pictures. It's the perfect solution for sharing, printing and storing all your favorite images!

And it's only from The Duck! Tap here to get started.

-- Advertisement --

Write for Computing Unplugged!
Share your experience and expertise with other handheld device users. There are new opportunities at ZATZ for contributing authors and editors.

Write about something you're an expert on and get your name in lights.

For Writers' Guidelines and to discuss topics, contact Staff Editor Steve Niles. This is your opportunity to shine in front of your peers, your clients, and friends.

Click for more info!

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