scar Code:
program ClickEm;
Var
Canvas : TCanvas;
C, CurrScore, Background, T, Timer : Integer;
Function RColor: Integer;
Begin
Result := Random(ClWhite);
End;
Procedure DrawSquare;
Var
Rw, Rh, Col : Integer;
Begin
Col := RColor;
Rh := Random(390) + 100;
Rw := Random(390) + 20;
GetDebugCanvas.Brush.Color := RColor;
Case Random(2) Of
0: getDebugCanvas.Rectangle((Rh - 1) - Random(20), (Rw - 1) - Random(20), (Rh + 1) + Random(20), (Rw + 1) + Random(20));
1: getDebugCanvas.Ellipse((Rh - 1) - Random(20), (Rw - 1) - Random(20), (Rh + 1) + Random(20), (Rw + 1) + Random(20));
End;
End;
Procedure ClearScreen;
Var
BmpCanv : TCanvas;
Begin
BmpCanv := GetBitmapCanvas(BackGround);
SafeCopyCanvas(BmpCanv, GetDebugCanvas, 0, 0, 499, 499, 1, 13, 499, 499);
End;
Procedure DelScore;
Begin
SafeCopyCanvas(GetBitmapCanvas(Background), GetDebugCanvas, 0, 0, 150, 20, 0, 0, 150, 20);
End;
Procedure DebugScore(Score : Integer);
Var
W, H : Integer;
Begin
DelScore;
Score := CreateBitmapMaskFromText('Your Score: ' + IntToStr(Score), UpChars);
GetBitmapSize(Score, W, H);
SafeCopyCanvas(GetBitmapCanvas(Score), Canvas, 0, 0, W, H, 0, 0, W, H);
FreeBitmap(Score);
End;
Procedure Winner;
Begin
DebugScore(CurrScore);
ClearScreen;
DrawSquare;
End;
function GetLValue(Color : TColor): Integer;
Var
H, S, L : Extended;
Begin
ColorToHSL(Color, H, S, L);
Result := Round(L);
End;
Procedure OnClick(Proc : Procedure);
Var
X, Y : Integer;
Begin
GetMousePos(X, Y);
If GetColor(X, Y) = 0 Then
Exit;
If (X < 0) Or (Y < 0) Or (X > 399) Or (Y > 459) Then //No Cheats
Exit;
IncEx(C, GetLValue(GetColor(X, Y)));
CurrScore := CurrScore + C;
Proc();
C := 0;
End;
Procedure CheckIt;
Begin
OnClick(@Winner);
End;
begin
DisplayDebugImgWindow(500, 500);
FindWindow('Debug Image');
Canvas := GetDebugCanvas;
Background := BitmapFromString(499, 499, '');
SafeCopyCanvas(GetBitmapCanvas(Background), Canvas, 0, 0, 499, 499, 0, 0, 499, 499);
T := GetTickCount;
DrawSquare;
Repeat
Timer := GetTickCount;
While GetTickCount - Timer < 751 Do
Begin
CheckIt;
Wait(33);
End;
ClearScreen;
DrawSquare;
Until (GetTickCount - T) >= 30000;
FreeBitmap(Background);
Writeln('Your score was: ' + IntToStr(CurrScore));
end.
And this was the post of the update: