SDL_UpdateRect?

I have a small program (I am playing with SDL to get the “hang of it”)
which simply draws a box on the screen (Pixel by pixel).

I removed the SDL_UpdateRect from my pixel plotting function and decided to
call it elsewhere. This means that I don’t call SDL_UpdateRect until all the
pixels are plotted (Hoping to save some instructions in an obvious bottleneck)
It doesn’t show anything whereas it used to.

Why?

for (y=1; y <240; ++y) {
for (x=1; x < 240; ++x)
DrawPix16(screen, x, y, 0); //16bits per pixel draw function
}
SDL_UpdateRect(screen, 1, 1, 240, 240);

Dave

SDL_UpdateRect(screen, 1, 1, 240, 240);

Coordinates start at (0,0)

Try:
SDL_UpdateRect(screen, 0, 0, 240, 240);

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

OOPS I made a dumb mistake
SDL_UpdateScreen in a 320x240 res does work if you don’t go off the end of the
screen.

should have been
SDL_UpdateRect(screen, 1, 1, 240, 239);
but I am allowed to point at address 240 and set it to a value without
crashing. HMM…> I have a small program (I am playing with SDL to get the “hang of it”)

which simply draws a box on the screen (Pixel by pixel).

I removed the SDL_UpdateRect from my pixel plotting function and decided to
call it elsewhere. This means that I don’t call SDL_UpdateRect until all the
pixels are plotted (Hoping to save some instructions in an obvious bottleneck)
It doesn’t show anything whereas it used to.

Why?

for (y=1; y <240; ++y) {
for (x=1; x < 240; ++x)
DrawPix16(screen, x, y, 0); //16bits per pixel draw function
}
SDL_UpdateRect(screen, 1, 1, 240, 240);

Dave