Sruthi,
I do exactly this in a card game I wrote - I have one large bitmap which
contains the entire pack of cards.
I copy this bitmap to an off screen window on the launch of the
application, and when required I copy a section of that off screen
window (a single playing card in my case) to the active draw window.

Here's a snip of the code that may help;

cardWindow is global and initialised to NULL
DeckBitmapFamily is the name of my pack of cards bitmap family.

on app launch I run this code;

void InitialiseDeck(Boolean startNewGame)
{
        static Word wError;
        VoidHand ObjectBitmapHandle;
        BitmapPtr ObjectBitmapLockedHandle;
//  Create a virtual window, and put the bitmap of the card deck into it
        if(cardWindow==NULL)
        {
        
cardWindow=WinCreateOffscreenWindow(336,24,screenFormat,&wError);
        
ObjectBitmapHandle=DmGetResource(bitmapRsc,DeckBitmapFamily);
        
ObjectBitmapLockedHandle=MemHandleLock(ObjectBitmapHandle);
                WinSetDrawWindow(cardWindow);
                WinDrawBitmap(ObjectBitmapLockedHandle,0,0);
                MemPtrUnlock(ObjectBitmapLockedHandle);
                DmReleaseResource(ObjectBitmapHandle);
                WinSetDrawWindow(WinGetActiveWindow());
        }
}

When I want to draw a single card to the display I do this;

sourceRectangle.topLeft.x=g->Balls[x][y]*13;
sourceRectangle.topLeft.y=0;
sourceRectangle.extent.x=12;
sourceRectangle.extent.y=12;
destRectangle.topLeft.x=x_offset+x*x_space;
destRectangle.topLeft.y=y_offset+y*y_space;
destRectangle.extent.x=12;
destRectangle.extent.y=12;
//WinEraseRectangle(&destRectangle,0);
WinCopyRectangle
(cardWindow,WinGetDrawWindow(),&sourceRectangle,destRectangle.topLeft.x,
destRectangle.topLeft.y,scrCopy);
WinEraseRectangleFrame (simpleFrame,&destRectangle); 

Hope that's what you were after.

Regards
John Sutton


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sruthi
Sent: 26 January 2007 09:25
To: Palm Developer Forum
Subject: Sprite Image Display

Hi ..
        We are working on a game application. During the animation part
we encounter an issue in placing the sprite image. Like we can cut a
small image from the whole image . The issue we face is in placing this
image. Like i need to specify the x,y co-ordinates. Any suggestions or
advice will be welcomed

thanks,
Sruthi

--
For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to