Page 1 of 1

PostPosted: Sun Jan 09, 2005 3:31 am
by zboot

I'm new to PocketC and I'm working on developing an 8-way scroller using animated sprites. I don't have the cash for Codewarrior so I'm looking at PocketC as a very cheap alternative. I'm currently getting up to speed on drawing and displaying bitmaps before I start to move on to the real sprite work, and I can't get the thing to draw in the native mode or use setscale to switch into a 320x320 mode. I created an image using Paint then pilrc and par to embed it into a resource.

Here is my code:
Code: Select all

library "PToolboxLib"

   int num, nWidth, nHeight, nDepth, nTrans, nComp, id;

   num = OpenBmpDb("my_bmp"); // attempt to open bitmap

   if (!num)
       alert("BITMAP not found");
   if (SetDepth(16)== 0) // attempt to set depth to 16bit
      alert("Depth not supported by device");
   drawnative(1); // draw using devices true pixels, not scaled to 160x160
   graph_on(); // switch to graphics form      

   FastBmp(0,0,1000); // draw my_bmp starting at coords 0,0

   waitp(); // wait for pen event before exiting

My bitmap was created in Paint as a 320x320 pixel image, saved as 16bit. What displays on my screen is 160x160 of my original image. In other words, only 1/4 of the image. Its not that the scaling is wrong. . it just only displays a fourth of what I expect.

PostPosted: Sun Jan 09, 2005 5:13 am
by jstadolnik
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
I don't have the cash for Codewarrior so I'm looking at PocketC as a very cheap alternative.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

Use PODS (the PalmOS Developer Suite from It's like Codewarrior but free. PocketC is too slow for managing multiple or complex sprite behavior.


BTW: Likely your bitmap is way over the 65Kbyte size limit for palmOS resources. You'll have to split it up into pieces. Also make sure you are using the DENSITY keyword in PilRC correctly.

The PToolboxLib guy.

PostPosted: Sun Jan 09, 2005 6:04 am
by zboot
this is my rcp file:
am i missing somthing?

PostPosted: Sun Jan 09, 2005 1:15 pm
by jstadolnik
If you are running PilRC through PDE, you may be missing errors generated by PilRC. If you are using PDE, try running PilRC by itself in a dos or bash shell. This will show any error or warnings that PilRC generates.

Also, it looks like the DENSITY keyword only works when using the bitmap family format (example from PilRC manual):

BITMAP "bmp-1.bmp" BPP 1
BITMAP "bmp-4.bmp" BPP 2 DENSITY 72
BITMAP "bmp-4.bmp" BPP 4 DENSITY 72
BITMAP "bmp-8.bmp" BPP 8 DENSITY 72
BITMAP "bmp-16.bmp" BPP 16 DENSITY 72

Finally, make sure that the bitmap generated is not over 65k in size, otherwise it won't hotsync (note: compression will allow larger bitmaps to fit under this 65k size limit).


The PToolboxLib guy.

PostPosted: Sun Jan 09, 2005 2:35 pm
by zboot

Thanks Joe for the help. I redid the rcp file using BITMAP instead of BITMAPCOLOR16K and set the BPP myself. This time, my image appears exactly as I wanted.

I suppose this is the section to talk about this. I've downloaded PODS. I guess I'll give that a try. For some reason, I feel more confident programming in lightweight languages. The only problem is, they are all inherently very slow. I'll probably do a lot of initial playing around on PocketC and then start moving over to PODS once I start throwing my zodiac down the stairs because it can run stuntcar extreme and yet cannot render more than 1 fps with my prog 8)