@@ -58,76 +58,18 @@ Main record used to interact with the {ref}`Mouse`.
5858
5959{$IFDEF WL_DEBUG_MOUSE}
6060procedure TMouse._Debug();
61- var
62- p: TPoint;
63- i,x,y,wid,hei: Integer;
64- clr, tol,heat: Integer;
65- hue,sat: Double;
66- m: TSingleMatrix;
67- mats: array of TSingleMatrix;
68- tmp,ClientBitmap, DebugBitmap: TImage;
69- TPA: TPointArray;
70- function AlphaColor(A,B: TColor; Weight: Double): TColor;
71- var R1,R2,G1,G2,B1,B2: Integer;
72- begin
73- ColorToRGB(A, R1,G1,B1);
74- ColorToRGB(A, R1,G1,B1);
75- Result := RGBtoColor(Round(R1*weight+R2*(1-Weight)), Round(G1*weight+G2*(1-Weight)), Round(B1*weight+B2*(1-Weight)))
76- end;
7761begin
78- self.DebugLn('Generating a heatmap from clicks and movements...');
79-
80- ClientBitmap := Target.GetImage();
81- DebugBitmap := ClientBitmap.Copy();
82- wid := DebugBitmap.GetWidth();
83- hei := DebugBitmap.GetHeight();
84- DebugBitmap.SetSize(wid*2, hei);
85- ClientBitmap.DrawTransparent(wid, 0, DebugBitmap);
86-
87- mats := [Self.DebugClicks, Self.DebugMovement];
88- for i:=0 to High(mats) do
89- begin
90- SetLength(m, 0);
91- SetLength(m, Length(mats[i]));
92- for x:=0 to High(m) do m[x] := Copy(mats[i][x]);
93- for 0 to 2 do m.Smoothen(3);
94- if Length(m) = 0 then
95- continue;
96-
97- tmp.Init();
98- tmp.DrawMatrix(m, 1);
99-
100- for y:=0 to tmp.GetHeight() - 1 do
101- for x:=0 to tmp.GetWidth() - 1 do
102- if tmp.GetPixel(x,y) <> 0 then
103- begin
104- heat := tmp.GetPixel(x,y);
105- ACA([0,heat], 1, clr, tol, hue, sat);
106-
107- if tol < 20 then DebugBitmap.SetPixel(x+wid*i,y, AlphaColor(ClientBitmap.GetPixel(x,y), heat, 1-tol/20))
108- else DebugBitmap.SetPixel(x+wid*i,y,tmp.GetPixel(x,y));
109- end;
110- tmp.Free();
111- end;
112-
113- ShowBitmap(DebugBitmap);
114- ClientBitmap.Free();
115- DebugBitmap.Free();
62+ WriteLn 'TODO...';
11663end;
11764
118- procedure TMouse._DebugCallback(Sender: PMouse; X, Y: Integer); static;
119- var
120- w,h: Integer;
65+ procedure TMouse._DebugTeleport(sender: TTarget; data: TTargetEventData);
12166begin
122- GetClientDimensions(W,H);
123- if Sender^.DebugMovement = nil then
124- begin
125- Sender^.DebugMovement.SetSize(W,H);
126- AddOnTerminate(@Sender^._Debug);
127- end;
67+ WriteLn 'TODO...';
68+ end;
12869
129- if InRange(x,0,W-1) and InRange(y,0,H-1) then
130- Sender^.DebugMovement[y,x] += 1;
70+ procedure TMouse._DebugClick(sender: TTarget; data: TTargetEventData);
71+ begin
72+ WriteLn 'TODO...';
13173end;
13274{$ENDIF}
13375
15294 Self.CanIdle := True;
15395
15496 {$IFDEF WL_DEBUG_MOUSE}
155- Self.OnTeleport := @Self._DebugCallback;
97+ Target.AddEvent(ETargetEvent.MOUSE_TELEPORT, @Self._DebugTeleport);
98+ Target.AddEvent(ETargetEvent.MOUSE_TELEPORT, @Self._DebugClick);
99+ AddOnTerminate(@Self._Debug);
156100 {$ENDIF}
157101end;
158102
0 commit comments