clean to color
a b

For example in this code should be or shouldn't be: clear_to_color(buffer,makecol(255,255,255)); ??????????????

while(index!=10)
{
index++;
clear_to_color(buffer,makecol(255,255,255));
blit(board,buffer,0,0,0,0,board->w,board->h); 
masked_blit(pawn,buffer,0,0,tab[0][index],tab[1][index],pawn->w,pawn->h);  
blit(buffer,screen,0,0,0,0,SCREEN_W,SCREEN_H);
}

gnolam

What the hell do we know?

If "board" covers the entirety of "buffer", then no, you don't need to clear the buffer. Otherwise, you probably do.

a b

yes it covers everything but is it good that all overlaps on yourself ?? without clear_to_color(buffer,makecol(255,255,255)); everything looks good but is it pretty that this overlaps without clear?

X-G

Don't do it, gnolam! Run while you still can!

a b

X-G please go away if you don't want write somothing helpful.

gnolam

Oh Bog. I forgot who I was replying to! :-X

Quote:

yes it covers everything but is it good that all overlaps on yourself ?? without clear_to_color(buffer,makecol(255,255,255)); everything looks good but is it pretty that this overlaps without clear?

If everything gets overdrawn every frame there is no reason to clear the buffer.

Kauhiz

If it looks the same without the line, remove it. It's that simple. I know it'll probably take another 180 posts to get the point through to you, but here's hoping it won't.

a b

ok - simply english is very important for me !! :)

Kikaru

That's what we give you though! It's like saying you want peanuts when we give you a bag of them! >:(

a b

what ? I don't understand.........

Kauhiz

Was your question answered already?

a b

Kikaru wrote something:
"That's what we give you though! It's like saying you want peanuts when we give you a bag of them! "
and I don't understand :)

Kauhiz

No, but was the original question answered? Do you still need help?

a b

I got good answer and I needn't help :)

Kikaru

You said you wanted "simply English" - and that's what we already give you! We aren't speaking French or anything! ;)

(P.S. sorry if I come across as rude, I am just rather irked with lots of incoherent new people.)

LennyLen
Quote:

P.S. sorry if I come across as rude, I am just rather irked with lots of incoherent new people.

And I seem to remember you having an irksome habit of not using google or reading the replies to your questions when you first started posting here. :P

Evert
Quote:

You said you wanted "simply English"

It's quite clear that he meant "simple English", or "elementary English". As I'm sure you've noticed, it's not his first language.

CGamesPlay
Quote:

but is it good that all overlaps on yourself

You don't understand what is happening. blit actually copies the data, so "overlaps" isn't an issue at all. Now, if blit actually moved the data, this would be a concern.

Kikaru

blit() uses memcpy() on each line, doesn't it? To move the data, you would be using memmove(). Anyway, cool stuff! :)

(P.S. My frustration is also on another forum, and the fact that I have had only 20 min. of free time over the last week (mon-fri). :-/)

Evert
Quote:

blit() uses memcpy() on each line, doesn't it? To move the data, you would be using memmove().

blit() actually uses memmove().

Quote:

My frustration is also on another forum, and the fact that I have had only 20 min. of free time over the last week (mon-fri). :-/

Is ok. As long as it isn't personal we don't mind you taking it out on us. ;)

CGamesPlay
Quote:

To move the data, you would be using memmove().

The difference between memcpy and memmove is that with memmove, the memory areas may overlap. memmove copies the data.

Kikaru

I thought it cleared the first area too... hmmm...

Audric

I've never understood what kind of useful result you would get, when blitting a bitmap on (part of) itself.
Does anybody know why blit() is implemented this way? (memmove vs memcpy)
Is it implemented this way because the overhead of checking is tiny, and the consequences would be severe (hang?) if the memory areas were overlapping ?

Evert
Quote:

I've never understood what kind of useful result you would get, when blitting a bitmap on (part of) itself.

You can use it for implementing scrolling maps where you only redraw the strip that is "new". Essentially, blit the back buffer to itself with some off-set and then fill in the blank spot. I've used it for this in the past (1999-ish), and it was a lot faster than redrawing the entire tilemap. It probably doesn't matter too much these days.

Quote:

Does anybody know why blit() is implemented this way? (memmove vs memcpy)

I do, because I'm the one who made it use memmove instead of the older code that was in place before. Historically, blit() has always allowed for overlapping regions, which does work with memmove and not with memcpy (more specifically, the behavior is undefined).

Quote:

Is it implemented this way because the overhead of checking is tiny, and the consequences would be severe (hang?) if the memory areas were overlapping ?

I found no measurable speed difference between memmove and memcpy.

Audric

Thank you Evert

Evert said:

I found no measurable speed difference between memmove and memcpy.

Good reason!

Arthur Kalliokoski

IIRC, one of the mem* routines simply checked if areas overlapped and, and started copying from the high end in memory if the source was the "high" chunk.

Thread #589649. Printed from Allegro.cc