unit comm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Types, Graphics;
const
STARTX= 0; //矩阵起点x
STARTY= 0; //矩阵起点Y
ENDX= 18; //矩阵终点x
ENDY= 10; //矩阵终点Y
STARTLEFT= 17; //游戏窗体第一个图片的Left值
STARTTOP= 184; //游戏窗体第一个图片的top值
SIGNWIDTH= 27; //字典图片的宽度
SIGNHEIGHT= 31; //字典图片高度
SIGNWIDTHEX= 31; //每个图片在link游戏中的扩展宽度
SIGNHEIGHTEX= 35; //每个图片在link游戏中的扩展高度
WINDWIDTH= 800; //游戏窗体宽
WINDHEIGHT= 600; //游戏窗体高
CANNTVIEW= 999; //不识别图代码(signNo值)
WORK='Work'; //热键ATM值
STOP='Stop'; //热键ATM值
COMPAREPERCENT= 90; //比较相似百分比
MAXDICSIGN= 100; //最多支持的字典图标个数.
type
TMatrix= array[0..10,0..18] of Integer; //整形矩阵
TBMPMatrix= array[0..10,0..18] of TBitmap; //图片矩阵
TLink = record //两个能连接的点.
StartPoint: TPoint;
EndPoint:TPoint;
end;
PLinks= ^TLinks;
TLinks= array of TLink;
PPoints= ^TPoints;
TPoints = array of TPoint;
PBitmaps= ^TBitMaps;
TBitmaps= array of TBitmap;
TTractilePoints= record //点的上,下,左,右的可延伸点坐标.
Top: TPoint;
Bottom: TPoint;
Left: TPoint;
Right: TPoint;
end;
implementation
end.
unit imgParse2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, CheckLst, ComCtrls, ExtCtrls, Buttons, comm, Matrix;
type
PThsRGBColor = ^ThsRGBColor;
ThsRGBColor = packed record
Blue:Byte;
Green:Byte;
Red:Byte;
end;
type
TfrmLinkTool = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Label1: TLabel;
btnWork: TButton;
Memo1: TMemo;
btnStop: TButton;
Panel3: TPanel;
Label4: TLabel;
edtLink: TEdit;
Label2: TLabel;
edtPt: TEdit;
Label3: TLabel;
edtDownUP: TEdit;
Timer1: TTimer;
Label5: TLabel;
Label6: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btnWorkClick(Sender: TObject);
procedure btnStopClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
atmStop,atmWork:ATOM; //这册热键所需的ATM
isWorking:Boolean; //标志程序的
工作状态.
AppPath:string; //运行路径
DicPath:string; //字典图片路径
Fullscreen : TBitmap; //存放真个游戏窗体的图片
bmpMatrix:TBMPMatrix; //游戏中的小图构成的矩阵
Matrix:TMatrix; //用作分析的数字矩阵
DICBmps:TBitmap
s; //字典图片数组.
procedure SleepEx(Time:Integer);
function StrToIntEx(Value:string):Integer;
procedure SetWorking(isValue:Boolean);
procedure RegHotKey();
procedure UnRegHotKey();
// procedure DICBmp();
function SetWindPos(HWND_TOPMOST:LongWord):Boolean;
function GetWindowBMP():TBitmap;
function GetOneBMP(x, y: Integer): TBitmap;
function CompareBMP(bmp1,bmp2:TBitmap):Boolean;
procedure InitBMPMatrix();
procedure GetDICBmps(DicPath:string);
procedure TransformMatrix(BMPMatrix:TBmpMatrix;var Matrix:TMatrix; DicBmps:TBitMaps);
procedure ClickLink(Link: TLink);
procedure ClickPoint(Point:TPoint);
function CheckLink(Link: TLink):Boolean;
function CheckPoint(Point:TPoint):Boolean;
function xyToPoint(MatrixPoint:TPoint):TPoint;
procedure HotKey(var msg:tmessage);message wm_hotkey;
public
{ Public declarations }
procedure init();
function TempOK2():TLinks;
end;
var
frmLinkTool: TfrmLinkTool;
implementation
{$R *.dfm}
{窗体加载}
procedure TfrmLin