Palm Programming
Palm Programming Homepage Sourcecode Email Us
Palm    |    Windows   |    Unix
Subroutines and Snippets

Changing graphics modes

Displaying Bitmaps from a resource
The standard way to display a bitmap via program code.  (You may also place graphics on forms in your IDE)


Preloading Bitmaps into memory

For the fastest animation, load your bitmaps into offscreen windows, and use WinCopyRectangle() to display them.

Double buffered animation
First you draw the background, then the characters and objects, then the lasers and explosions, then start over with the background again for the next frame of animation - the result is a display where things appear to be erased and redrawn over and over.  To fix this, we use an offscreen window, hidden to the user, that we draw all our graphics on.  Each time we complete a screen we copy it to the visible screen for display to the user.  This gives a smooth animation display to any type of game.


Peeking at the screen

Direct screen access - reading.

Poking to the screen

Direct screen access - writing.

Saving and Loading data structures

Store your data in neat structures, and make saving the game in play a breeze.


Sound routines


Timing routines

Reading user input from a form

Scrolling text windows


Reading input from the pen


Reading input from the buttons

Fixed point math

Sometime floating point math is just too slow.  By using fixed point math we can transform floating point numbers into integers, giving up some precision in the results, to attain huge increases in speed of calculation.


Math tables

When fast just isn't fast enough, we can pre-calculate some of our equations and store them in tables.  This way our program can simply "look up" the answer instead of taking time to calculate it.  You wouldn't calculate PI every time you needed it would you?


3D graphics in 2D
Because sometimes, faking it is the right thing to do.


3D graphics in 3D

When only the real thing will do.  Here we put matrix math into use to give us ultra fast rotation and position control.


Fast polygon filling
We toss in an assembler routine to fill our polygons for maximum speed.


Physics modeling
Bouncing off the walls isn't as easy as falling off a log, but its close.  We look at gravity, friction, and angular reflection.


This section is for C programmers and is focused on game programming