Blitting bmps

Hi everyone!

Ive been dabbling and experimenting with blitting
bmps. I created a bitmap that has two images (template
2x1) and have tried to blit one image after the other
from the same bmp.

Here’s my code:

SDL_Surface*bmp=SDL_LoadBMP(“image.bmp”);

int posx;

SDL_Rect image;

for(posx=0; posx>=1 ;posx++)

image.x=posx*51;
image.y=0;
image.w=50;
image.h=50;

SDL_BlitSurface(bmp,&image,Surface,&dest);

The total bmp size is 101 pix and each image is 50x50.
there’s a line that separates the two bitmap images at
position pixel x=50. I’ve tried to use the for loop to
get the blitter to blit first, the bmp at (0,0) then
the image at (0,51), the upper left location of the
second image. Needless to say, it only blits one of
the images and not the second. Any ideas why and am I
way off on this idea using the for loop? If this is
unworkable, please tell me so I can stop wasting my
time trying to get this to work.

thanks

Richard__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/

Well, according to the info you have me, your loop is incorrect. The
following code should work:

SDL_Surface*bmp=SDL_LoadBMP(“image.bmp”);
int posx;
SDL_Rect image;

for(posx=0; posx<=1 ;posx++)
{
image.x=posx*51;
image.y=0;
image.w=50;
image.h=50;

SDL_BlitSurface(bmp,&image,Surface,&dest);

}

----Original Message Follows----From: richardperrine_rpcv@yahoo.com (Richard Perrine)
Reply-To: sdl at libsdl.org
To: SDLgroup
Subject: [SDL] blitting bmps
Date: Mon, 1 Apr 2002 11:11:48 -0800 (PST)
MIME-Version: 1.0
Received: from [66.224.24.122] by hotmail.com (3.2) with ESMTP id
MHotMailBE71FD27001D40042A0842E0187A92C90; Mon, 01 Apr 2002 11:16:59 -0800
Received: from localhost.localdomain ([127.0.0.1]
helo=twomix.devolution.com)by twomix.devolution.com with esmtp (Exim 3.22
#2)id 16s7Dm-0003T9-00; Mon, 01 Apr 2002 11:12:02 -0800
Received: from [216.136.175.63] (helo=web13405.mail.yahoo.com)by
twomix.devolution.com with smtp (Exim 3.22 #2)id 16s7DZ-0003Su-00for
sdl at libsdl.org; Mon, 01 Apr 2002 11:11:49 -0800
Received: from [129.112.109.252] by web13405.mail.yahoo.com via HTTP; Mon,
01 Apr 2002 11:11:48 PST

From sdl-admin at libsdl.org Mon, 01 Apr 2002 11:18:34 -0800
Message-ID: <20020401191148.36742.qmail at web13405.mail.yahoo.com>
Sender: sdl-admin at libsdl.org
Errors-To: sdl-admin at libsdl.org
X-BeenThere: sdl at libsdl.org
X-Mailman-Version: 2.0.5
Precedence: bulk
List-Help: <mailto:sdl-request at libsdl.org?subject=help>
List-Post: <mailto:sdl at libsdl.org>
List-Subscribe:
http://www.libsdl.org/mailman/listinfo/sdl,<mailto:sdl-request at libsdl.org?subject=subscribe>
List-Id: A list for developers using the SDL library. (includes
SDL-announce) <sdl.libsdl.org>
List-Unsubscribe:
http://www.libsdl.org/mailman/listinfo/sdl,<mailto:sdl-request at libsdl.org?subject=unsubscribe>
List-Archive: http://www.libsdl.org/pipermail/sdl/
X-Original-Date: Mon, 1 Apr 2002 11:11:48 -0800 (PST)

Hi everyone!

Ive been dabbling and experimenting with blitting
bmps. I created a bitmap that has two images (template
2x1) and have tried to blit one image after the other
from the same bmp.

Here’s my code:

SDL_Surface*bmp=SDL_LoadBMP(“image.bmp”);

int posx;

SDL_Rect image;

for(posx=0; posx>=1 ;posx++)

image.x=posx*51;
image.y=0;
image.w=50;
image.h=50;

SDL_BlitSurface(bmp,&image,Surface,&dest);

The total bmp size is 101 pix and each image is 50x50.
there’s a line that separates the two bitmap images at
position pixel x=50. I’ve tried to use the for loop to
get the blitter to blit first, the bmp at (0,0) then
the image at (0,51), the upper left location of the
second image. Needless to say, it only blits one of
the images and not the second. Any ideas why and am I
way off on this idea using the for loop? If this is
unworkable, please tell me so I can stop wasting my
time trying to get this to work.

thanks

Richard


Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

???V?I?T?A?L?I?Y???


Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.