[SDL] Fast Way To Check If Certain Pixel is Inside Certain Surface
Phantom Lord
thephantomlord at gmail.com
Tue Jul 4 09:49:06 PDT 2006
Thx guys.
2006/7/4, Vassilis Virvilis <vasvir at iit.demokritos.gr>:
>
> Phantom Lord wrote:
> > 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.
> >
>
> if ((particle.x >= surface->clip_rect.x) &&
> (particle.x < surface->clip_rect.x + surface->clip_rect.w) &&
> (particle.y >= surface->clip_rect.y) &&
> (particle.y < surface->clip_rect.y + surface->clip_rect.h)) {
> do_something();
> }
>
> .bill
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>
--
Phantom Lord
Caelis Studios ---> From Gods Hands To Yours
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060704/a41889db/attachment.htm
More information about the SDL
mailing list