hedgewars/uTouch.pas
changeset 11782 77afc967f38e
parent 11597 49b2dcfb89d0
child 11783 d8a9be46dede
equal deleted inserted replaced
11781:f2031643fe98 11782:77afc967f38e
   357 function addFinger(x,y: Longword; id: TSDL_FingerId): PTouch_Data;
   357 function addFinger(x,y: Longword; id: TSDL_FingerId): PTouch_Data;
   358 var
   358 var
   359     xCursor, yCursor, index : LongInt;
   359     xCursor, yCursor, index : LongInt;
   360 begin
   360 begin
   361     //Check array sizes
   361     //Check array sizes
   362     if length(fingers) < pointerCount then
   362     while Length(fingers) <= pointerCount do
   363     begin
   363         begin
   364         setLength(fingers, length(fingers)*2);
   364         setLength(fingers, Length(fingers)*2);
   365         for index := length(fingers) div 2 to length(fingers) do
   365         for index := Length(fingers) div 2 to (Length(fingers)-1) do
   366             fingers[index].id := nilFingerId;
   366             fingers[index].id := nilFingerId;
   367     end;
   367         end;
   368 
   368 
   369     xCursor := convertToCursorX(x);
   369     xCursor := convertToCursorX(x);
   370     yCursor := convertToCursorY(y);
   370     yCursor := convertToCursorY(y);
   371 
   371 
   372     //on removing fingers, all fingers are moved to the left
   372     //on removing fingers, all fingers are moved to the left
   511 
   511 
   512 function findFinger(id: TSDL_FingerId): PTouch_Data;
   512 function findFinger(id: TSDL_FingerId): PTouch_Data;
   513 var
   513 var
   514     index: LongWord;
   514     index: LongWord;
   515 begin
   515 begin
   516     for index:= 0 to length(fingers) do
   516     for index:= 0 to (Length(fingers)-1) do
   517         if fingers[index].id = id then
   517         if fingers[index].id = id then
   518             begin
   518             begin
   519             findFinger:= @fingers[index];
   519             findFinger:= @fingers[index];
   520             exit;
   520             exit;
   521             end;
   521             end;
   639 begin
   639 begin
   640     buttonsDown:= 0;
   640     buttonsDown:= 0;
   641     pointerCount:= 0;
   641     pointerCount:= 0;
   642 
   642 
   643     setLength(fingers, 4);
   643     setLength(fingers, 4);
   644     for index := 0 to length(fingers) do
   644     for index := 0 to (Length(fingers)-1) do
   645         fingers[index].id := 0;
   645         fingers[index].id := 0;
   646 
   646 
   647     rectSize:= baseRectSize;
   647     rectSize:= baseRectSize;
   648     halfRectSize:= baseRectSize shr 1;
   648     halfRectSize:= baseRectSize shr 1;
   649 end;
   649 end;