Problem moving image

I have tried to move an image by saving background and blitting
image, restoring background and so on. But I’m missing something
here and this doesn’t work, please look at this code:

area.w=sp->w;
area.h=sp->h,
area.x=1;
area.y=1;
//Save background area
SDL_BlitSurface(screen, &area, saved, &area);
// Then put image
SDL_BlitSurface(sp, NULL, screen, &area);
// And update screen area
SDL_UpdateRects(screen,1,&area);
for (i=1;i<=200;i++) { //Move sprite
//First, restore saved area
SDL_BlitSurface(saved, NULL, screen, &area);
SDL_UpdateRects(screen,1,&area);
//Increment x&y
area.x++;
area.y++;
SDL_BlitSurface(screen, &area, saved, &area);
SDL_BlitSurface(sp, NULL, screen, &area);
SDL_UpdateRects(screen,1,&area);
}

This leave a black square and the trasnparent part of the image
gets mixed with the backgound. What’s the problem?–
Roger D. Vargas

I just decided to go look at the archive of this list to find something
that was posted a few days ago, the archive page
(http://www.lokigames.com/ml/sdl/) took about 3 minutes to load :slight_smile:
has anyone thought of maybe splitting this into a few links for each month
or something like that so that?

(…whine whine, i want a faster connection… whine :wink: )–
Adam
@af7567_at_bris.ac.uk
adamf at one2one.net
adamf at snika.uklinux.net

I just decided to go look at the archive of this list to find something
that was posted a few days ago, the archive page
(http://www.lokigames.com/ml/sdl/) took about 3 minutes to load :slight_smile:
has anyone thought of maybe splitting this into a few links for each month
or something like that so that?

yeah. if the entire 2 year archive is going to be kept on one
page, can the contents at least be listed from newest to oldest.
that way one can stop the download after they’ve travelled back
in time far enough.

:]

area.w=sp->w;
area.h=sp->h,
area.x=1;
area.y=1;
//Save background area
SDL_BlitSurface(screen, &area, saved, &area);

This will save the area with the top left corner at (1,1) in saved, which
is fine if saved has the same dimensions as the screen. If saved is meant
to only be a copy of the area being blitted over then this should be:
SDL_BlitSurface(screen, &area, saved, NULL);

// Then put image
SDL_BlitSurface(sp, NULL, screen, &area);
// And update screen area
SDL_UpdateRects(screen,1,&area);
for (i=1;i<=200;i++) { //Move sprite
//First, restore saved area
SDL_BlitSurface(saved, NULL, screen, &area);

If saved is the same dimensions as the screen then:
SDL_BlitSurface(saved, &area, screen, &area);
… if saved is the size of the area being blitted to then your line is
correct.

  SDL_UpdateRects(screen,1,&area);
  //Increment x&y
  area.x++;
  area.y++;
  SDL_BlitSurface(screen, &area, saved, &area);

– SDL_BlitSurface(screen, &area, saved, NULL); - see above

  SDL_BlitSurface(sp, NULL, screen, &area);
  SDL_UpdateRects(screen,1,&area);

}

See man 3 SDL_BlitSurface
––
Only the position is used in the dstrect (the width and
height are ignored).

If either srcrect or dstrect are NULL, the entire surface
(src or dst) is copied.—


Adam
@af7567_at_bris.ac.uk
adamf at one2one.net
adamf at snika.uklinux.net

I just decided to go look at the archive of this list to find something
that was posted a few days ago, the archive page
(http://www.lokigames.com/ml/sdl/) took about 3 minutes to load :slight_smile:

Yep, anybody volunteer to turn it into a better searchable archive?

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Hey, I know! We could write an SDL program to do this and while were
at it, invent SDL_MailingListBrowse & SDL_MailingListSearch (to be
included in SDL’s core) and a whole new hacky protocol for
client/server interactions!–

Olivier A. Dagenais - Software Architect and Developer

“Sam Lantinga” wrote in message
news:E14kcaQ-0002tM-00 at roboto.devolution.com

I just decided to go look at the archive of this list to find
something

that was posted a few days ago, the archive page
(http://www.lokigames.com/ml/sdl/) took about 3 minutes to load :slight_smile:

Yep, anybody volunteer to turn it into a better searchable archive?

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

I would do it, if you have PHP on the server.> ----- Original Message -----

From: owner-sdl@lokigames.com [mailto:owner-sdl at lokigames.com]On Behalf
Of Sam Lantinga
Sent: Tuesday, April 03, 2001 9:00 PM
To: sdl at lokigames.com
Subject: Re: [SDL] Mailing list archive big

I just decided to go look at the archive of this list to find something
that was posted a few days ago, the archive page
(http://www.lokigames.com/ml/sdl/) took about 3 minutes to load :slight_smile:

Yep, anybody volunteer to turn it into a better searchable archive?

See ya,
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Yes! I had tried many combinations of &are and NULL, but didn’t worked.
Now, how to speed up that, maybe using double buffer? I used SDL_HWSURFACE
flag in SDL_init and in creatergbsurface for “saved”, but anyway the
moving image blinks very ugly.On Sat, 31 Mar 2001 af7567 at bris.ac.uk wrote:

This will save the area with the top left corner at (1,1) in saved, which
is fine if saved has the same dimensions as the screen. If saved is meant
to only be a copy of the area being blitted over then this should be:
SDL_BlitSurface(screen, &area, saved, NULL);

Roger D. Vargas