PDA

View Full Version : Pixel Collide (My program crash) :(



maker3
04-11-2006, 01:26 AM
Hi

I was estudying the SDL tutorial of the Lazy Foo and I translated one from c++ to delphi. But I modified the collision function. I used the SDL_CollidePixel function from lib SDL_Collide.
My program crash when the dot move in position X=20 and y=140. I dont know why? Some one help me please.

The code is here: http://rapidshare.com/files/1806994/pixel_collide.zip.html

The crash is here:

...
4:
begin
[color=red]=> PixelColor := PUint32( bits )^; (Line 244)[/color]
end;
...


Sorry, my english is bad.

jasonf
04-11-2006, 01:45 AM
There's a Pixel collision function in Jedi-SDL I believe, (I don't think I wrote the one I use from scratch.. although it was a long time ago)..

I think you'd be better off looking into that than reinventing the wheel

imho :)

Welcome to the site BTW :D

jasonf
04-11-2006, 02:19 AM
I've just looked,

function SDL_PixelTest( SrcSurface1 : PSDL_Surface; SrcRect1 : PSDL_Rect; SrcSurface2 :
PSDL_Surface; SrcRect2 : PSDL_Rect; Left1, Top1, Left2, Top2 : integer ) : boolean;

In sdlutils.pas

Which can be located at http://sourceforge.net/projects/jedi-sdl

There's actually a lot of new/cool stuff in there which may be helpful.

savage
04-11-2006, 03:10 AM
I've moved this thread to the JEDI-SDL category.