[SDL] Fast Way To Check If Certain Pixel is Inside Certain Surface

Phantom Lord thephantomlord at gmail.com
Mon Jul 3 17:19:07 PDT 2006


Hi, i'm working on a particle engine (pixel-based, for now) and i'd
implement the following code for checking if the pixel is inside that
Certain Surface:

for(int i=surface->clip_rect.x; i<surface->clip_rect.w; i++)
   for(int j=surface->clip_rect.y; j<surface->clip_rect.h; j++)
      if(particle.x == i && particle.y == j) do something.

But this carried me bigs "delays" whenever its executed.
Has somebody a better way to doing it?.

Thx, and sorry for my english, not native.

-- 
Leandro Ostera,
Caelis Interactive
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060703/780c1972/attachment.html 


More information about the SDL mailing list