marpis
2009-05-20 13:50:20
I tried the IsMoving function made by Bullzeye95, edited by Nava2 but i didn't find it work as it should, so i made my own which i think is pretty reliable.
I also think PixelShift() is very useful for many things, just use your imagination
works with smart.
UPDATE THE SRL ONE?
or at least make a function like this, cause the current function doesn't work properly.
please someone test it and tell me how it works and how fast it is!
my computer is somehow broken and its über laggy
edit: omg freebitmaps :o
edit: tested with smart and it works. also edited IsMoving a bit (120 -> 150)
edit: added step
I also think PixelShift() is very useful for many things, just use your imagination
works with smart.
UPDATE THE SRL ONE?
or at least make a function like this, cause the current function doesn't work properly.
please someone test it and tell me how it works and how fast it is!
my computer is somehow broken and its über laggy
function PixelShift(x1, y1, x2, y2, step, t: integer): integer;
var
bmp, bmp2, x, y: integer;
begin
bmp := BitmapFromString((x2 -x1), (y2 - y1), '');
bmp2 := BitmapFromString((x2 -x1), (y2 - y1), '');
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp), x1, y1, x2, y2, 0, 0, (x2 - x1), (y2 - y1));
wait(t);
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp2), x1, y1, x2, y2, 0, 0, (x2 - x1), (y2 - y1));
for x := 1 to ((x2 - x1)/step) do
for y := 1 to ((y2 - y1)/step) do
if FastGetPixel(bmp2, x * step, y * step) <> FastGetPixel(bmp, x * step, y * step) then
Inc(result);
FreeBitmap(bmp);
FreeBitmap(bmp2);
end;
function m_IsMoving: boolean;
begin
result := PixelShift(MMX1, MMY1, MMX2, MMY2, 5, 200) > 100;
end;
edit: omg freebitmaps :o
edit: tested with smart and it works. also edited IsMoving a bit (120 -> 150)
edit: added step