Code: Select all
/*
Written By: Hellbent aka CivReborn (Youtube)
Date Started: June 27th, 2018
Date Of Last Edit: July 3rd, 2018
Matrix Clicker v1.1
Paste: https://pastebin.com/yCTyiXYx
*/
#SingleInstance,Force
SetBatchLines,-1
CoordMode,Mouse,Screen
SetMouseDelay,30ms
OnExit,GuiClose
global Win:={W:400,H:250},Brush:=[],Pen:=[],Button1:={},Win2:={},Win3:={},Win4:={},Checks:={},Radio1:={}
global BC:=["Black","White","Yellow","Lime","Maroon","Aqua","Purple","0077ff","000211"],IsOn,pButton:={},String:={},letter_Array:=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0","!","@","#","$","%","^","&","*","(",")","-","_","=","+","~","<",",",".","?",":",";",">","|","\"," "],colours:=["ff00ff00","ff036F19","ff086714","ff24D95B","ff0D8422","ff00bb00","ff00aa00","ff11ff11","ff22ff22","ff33aa33","ff33dd33"]
global MovWin:=0,Always:=1,Free_Mode:=0,No_Count:=1,GUI_Count:=0,ToolTip_Count:=0,Target_X,Target_Y,tgui,num:="",HovOn:=0,Click_Count:=0,Click_Forever:=1,Fixed_Amount:=0,Fixed_Click_Amount:=0,SPSLD,Speed:=10
global Delay:=1000/speed,Startkey:="numpad1",StopKey:="Numpad2",PauseKey:="Numpad3",PauseOn:=0,Stop:=1
Hotkey,%StartKey%,SCLer
Hotkey,%StopKey%,STCLer
Hotkey,%PauseKey%,PCLer
CGUI()
OnMessage(0x200,"Whv")
OnMessage(0x07,"Show_Win")
CGUI2(),CGUI3(),CGUI4(),DBG(),ACB(),ACH(),ARB(),SetSPos(),AddTag(),CL_CoU(),SetUp()
SetTimer,M_Loop,10
return
GuiClose:
Loop,% Brush.Length()
Gdip_DeleteBrush(Brush[A_Index])
Gdip_DeletePen(Pen[A_Index])
Loop,% Button.Length()
Gdip_DisposeImage(Button1[A_Index].Bitmap)
Loop,% Checks.Length()
Gdip_DisposeImage(Checks[A_Index].Bitmap)
Layered_Window_ShutDown(Win),Layered_Window_ShutDown(Win2),Layered_Window_ShutDown(Win3),Layered_Window_ShutDown(Win4)
ExitApp
HotkeysGuiClose:
Gui,Hotkeys:Destroy
return
M_Loop:
Critical
Draw_Inner()
Loop,% String.Length()
String[A_Index].Update()
UpdateLayeredWindow(Win2.hwnd, Win2.hdc, Win2.X, Win2.Y, Win2.W, Win2.H)
return
Start:
Button1[Num].Draw_Pressed()
if(Free_Mode=1){
MsgShow(1)
return
}
gosub,SCLer
return
MTAG:
Try{
Run,https://www.youtube.com/user/CivReborn
}
return
Stop:
Button1[Num].Draw_Pressed()
Stop:=1
PauseOn:=0
SetTimer,M_Loop,on
return
Reload:
Button1[Num].Draw_Pressed()
Reload
return
Hotkeys:
Button1[Num].Draw_Pressed()
Gui,Hotkeys:Destroy
Gui,Hotkeys:+Owner1 +ToolWindow -Caption -DPIScale
Gui,Hotkeys:Color,002200,00ff00
Gui,Hotkeys:Font,cLime s10 Bold Q5,Microsoft YaHei UI
Gui,Hotkeys:Add,Text,cLime x10 y10 w50,Start:
Gui,Hotkeys:Add,Hotkey,x+10 w120 vStartKey,%StartKey%
Gui,Hotkeys:Add,Button,x+10 w90 h25 -Theme gUDSTRK,Update
Gui,Hotkeys:Add,Text,cLime x10 y+15 w50,Stop:
Gui,Hotkeys:Add,Hotkey,x+10 w120 vStopKey,% StopKey
Gui,Hotkeys:Add,Button,x+10 w90 h25 -Theme gUDSTPK,Update
Gui,Hotkeys:Add,Text,cLime x10 y+15 w50 ,Pause:
Gui,Hotkeys:Add,Hotkey,x+10 w120 vPauseKey,% PauseKey
Gui,Hotkeys:Add,Button,x+10 w90 h25 -Theme gUDPK,Update
Gui,Hotkeys:Add,Button,x30 y140 w240 h30 -Theme gHotkeysGuiClose,Done
Add_Border_Trim("Hotkeys",0,0,300,180,"00aa00",2)
Gui,Hotkeys:Show,w300 h180
return
UDSTRK:
GuiControlGet,newkey,,StartKey
if(newkey!=Startkey&&newkey!=null){
Hotkey,%StartKey%,SCLer,Off
StartKey:=NewKey
Hotkey,%StartKey%,SCLer,On
}
return
Add_Border_Trim(Window,x,y,w,h,Color,Thickness:=1){
y2:=y+h-Thickness,x2:=x+w-Thickness
Gui,%Window%:Add,Progress,x%x% y%y% w%w% h%Thickness% Background%color%
Gui,%Window%:Add,Progress,x%x% y%y% w%Thickness% h%h% Background%color%
Gui,%Window%:Add,Progress,x%x% y%y2% w%w% h%Thickness% Background%color%
Gui,%Window%:Add,Progress,x%x2% y%y% w%Thickness% h%h% Background%color%
}
AddTag(){
if(Stop=1){
DeleteObject(pbit),pbit:=Gdip_CreateBitmap(20,20),g:=Gdip_GraphicsFromImage(pbit),Gdip_SetSmoothingMode(g,1)
b1:=New_Brush("00aa00"),Fill_Box(g,b1,0,0,20,20),Gdip_DeleteBrush(b1),b1:=New_Brush("002200"),Fill_Box(g,b1,1,1,18,18)
Gdip_DeleteBrush(b1),b1:=Gdip_CreateLineBrushFromRect(2, 2,16,16,"0x33ffffff", "0xff000000"),Fill_Box(g,b1,2,2,16,16)
Gdip_DeleteBrush(b1),Gdip_TextToGraphics(g,"HB","y-1 s10 r5 cff00aa00 Bold vCenter Center","Microsoft YaHei UI",20,20)
Gdip_DrawImage(Win.G,pbit,15,6,20,20),UpdateLayeredWindow(Win.hwnd, Win.hdc),Gdip_DeleteGraphics(g)
}else if(Stop=0&&PauseOn=1){
DeleteObject(pbit),pbit:=Gdip_CreateBitmap(20,20),g:=Gdip_GraphicsFromImage(pbit),Gdip_SetSmoothingMode(g,1),b1:=New_Brush("bb7700")
Fill_Box(g,b1,0,0,20,20),Gdip_DeleteBrush(b1),b1:=New_Brush("002200"),Fill_Box(g,b1,1,1,18,18),Gdip_DeleteBrush(b1)
b1:=Gdip_CreateLineBrushFromRect(2, 2,16,16,"0x33ffffff", "0xff000000"),Fill_Box(g,b1,2,2,16,16),Gdip_DeleteBrush(b1)
Gdip_TextToGraphics(g,"HB","y-1 s10 r5 cff995500 Bold vCenter Center","Microsoft YaHei UI",20,20)
Gdip_DrawImage(Win.G,pbit,15,6,20,20),UpdateLayeredWindow(Win.hwnd, Win.hdc),Gdip_DeleteGraphics(g)
}else if(Stop=0&&PauseOn=0){
DeleteObject(pbit),pbit:=Gdip_CreateBitmap(20,20),g:=Gdip_GraphicsFromImage(pbit),Gdip_SetSmoothingMode(g,1)
b1:=New_Brush("ff0000"),Fill_Box(g,b1,0,0,20,20),Gdip_DeleteBrush(b1),b1:=New_Brush("002200"),Fill_Box(g,b1,1,1,18,18),Gdip_DeleteBrush(b1)
b1:=Gdip_CreateLineBrushFromRect(2, 2,16,16,"0x33ffffff", "0xff000000"),Fill_Box(g,b1,2,2,16,16),Gdip_DeleteBrush(b1)
Gdip_TextToGraphics(g,"HB","y-1 s10 r5 cffff0000 Bold vCenter Center","Microsoft YaHei UI",20,20)
Gdip_DrawImage(Win.G,pbit,15,6,20,20),UpdateLayeredWindow(Win.hwnd, Win.hdc),Gdip_DeleteGraphics(g)
}
}
SCLer:
if(Free_mode=0&&Target_X=null){
MsgShow(2)
return
}
SetTimer,M_Loop,off
Stop:=0,PauseOn:=0
(Speed=20)?(Offset:=21):(Speed=19)?(Offset:=23):(Speed=18)?(Offset:=25):(Speed=17)?(Offset:=27):(Speed=16)?(Offset:=29):(Speed=15)?(Offset:=30):(Speed=14)?(Offset:=32)
:(Speed=13)?(Offset:=35):(Speed=12)?(Offset:=37):(Speed=11)?(Offset:=39):(Speed=10)?(Offset:=41):(Speed=9)?(Offset:=43):(Speed=8)?(Offset:=50):(Speed=7)?(Offset:=58)
:(Speed=6)?(Offset:=70):(Speed=5)?(Offset:=82):(Speed=4)?(Offset:=94):(Speed=3)?(Offset:=126):(Speed=2)?(Offset:=158):(Speed=1)?(Offset:=350)
tca:=Fixed_Click_Amount,Start_Time:=A_TickCount
if(Fixed_Amount=1)
Click_Count:=0
AddTag()
DllCall("QueryPerformanceCounter", "Int64*", CounterBefore)
While(Stop=0){
if(PauseOn!=1){
DllCall("QueryPerformanceCounter", "Int64*", CounterAfter)
if(((CounterAfter - CounterBefore)/1000)>Delay+Offset){
DllCall("QueryPerformanceCounter", "Int64*", CounterBefore)
if(Free_Mode=1)
Click,
else if(Free_Mode=0)
Click,%Target_X%,%Target_Y%
if(GUI_Count=1){
Click_Count++
CL_CoU()
}
else if(Tooltip_Count=1)
Tooltip,% ++Click_Count
if(Fixed_Amount=1){
if(--tca<=0)
Stop:=1
}
}
}
}
Tooltip,
PauseOn:=0
AddTag()
SetTimer,M_Loop,on
return
UDSTPK:
GuiControlGet,newkey,,StopKey
if(newkey!=Stopkey&&newkey!=null){
Hotkey,%StopKey%,STCLer,Off
StopKey:=NewKey
Hotkey,%StopKey%,STCLer,On
}
return
STCLer:
Stop:=1
SetTimer,M_Loop,on
return
UDPK:
GuiControlGet,newkey,,PauseKey
if(newkey!=PauseKey&&newkey!=null){
Hotkey,%PauseKey%,PCLer,Off
PauseKey:=NewKey
Hotkey,%PauseKey%,PCLer,On
}
return
PCLer:
if(Stop=0){
PauseOn:=!PauseOn
if(PauseOn){
SetTimer,M_Loop,on
AddTag()
}
else {
SetTimer,M_Loop,off
AddTag()
}
}
return
Reset_Count:
Button1[Num].Draw_Pressed()
Click_Count:=0
CL_CoU()
return
Set_Position:
Button1[Num].Draw_Pressed()
Set_CP(Target_X,Target_Y)
SetSPos()
return
ADJSLD:
CoordMode,Mouse,Client
SetTimer,M_Loop,Off
slider1.UpDate()
SetTimer,M_Loop,on
CoordMode,Mouse,Screen
return
Counter:
Loop,3 {
if(Radio1[A_Index].Name=A_GuiControl){
Radio1[A_Index].Draw_One()
Radio1[A_Index].State:=1
}else {
Radio1[A_Index].Draw_Zero()
Radio1[A_Index].State:=0
}
}
(A_GuiControl="No_Count")?(No_Count:=1,GUI_Count:=0,ToolTip_Count:=0):(A_GuiControl="GUI_Count")?(No_Count:=0,GUI_Count:=1,ToolTip_Count:=0):(A_GuiControl="ToolTip_Count")?(No_Count:=0,GUI_Count:=0,ToolTip_Count:=1)
return
Duration:
Loop,2 {
if(Radio1[A_Index+3].Name=A_GuiControl){
Radio1[A_Index+3].Draw_One()
Radio1[A_Index+3].State:=1
}else {
Radio1[A_Index+3].Draw_Zero()
Radio1[A_Index+3].State:=0
}
}
(A_GuiControl="Click_Forever")?(Click_Forever:=1,Fixed_Amount:=0):(A_GuiControl="Fixed_Amount")?(Click_Forever:=0,Fixed_Amount:=1)
return
SubSl:
Slider1.Subtract()
return
AddSl:
slider1.Add()
return
ARB(){
Radio1[1]:=New Rad1(15,30,110,20,1,"33ff33","114411","No Count",12,"ff000000","ff777777","No_Count",1,"Counter")
Radio1[2]:=New Rad1(135,30,110,20,0,"33ff33","114411","GUI Count",12,"ff000000","ff777777","GUI_Count",1,"Counter")
Radio1[3]:=New Rad1(255,30,110,20,0,"33ff33","114411","ToolTip Count",12,"ff000000","ff777777","ToolTip_Count",1,"Counter")
Radio1[4]:=New Rad1(35,55,110,20,1,"33ff33","114411","Click Forever",12,"ff000000","ff777777","Click_Forever",2,"Duration")
Radio1[5]:=New Rad1(155,55,110,20,0,"33ff33","114411","Fixed Amount",12,"ff000000","ff777777","Fixed_Amount",2,"Duration")
Gui,3:Add,Text,x15 y30 w110 h20 vNo_Count gCounter
Gui,3:Add,Text,x135 y30 w110 h20 vGUI_Count gCounter
Gui,3:Add,Text,x255 y30 w110 h20 vToolTip_Count gCounter
Gui,3:Add,Text,x35 y55 w110 h20 vClick_Forever gDuration
Gui,3:Add,Text,x155 y55 w110 h20 vFixed_Amount gDuration
Gui,3:Add,Edit,x275 y56 w60 h18 Number Limit7 vFixed_Click_Amount gSetCAMOUNT,% Fixed_Click_Amount
Gui,1:Add,Text,x15 y6 w20 h20 gMTAG,
SetCAMOUNT()
}
CGUI4(){
global
Win4:=Layered_Window_SetUp(4,0,0,Win2.W,Win2.H,4,"+Parent2 -Caption -DPIScale +LastFound")
UpdateLayeredWindow(Win4.hwnd, Win4.hdc, Win4.X, Win4.Y, Win4.W, Win4.H)
slider1:=New Slide()
Gui, 4:Add, Text, x15 y110 w250 h36 vSPSLD gADJSLD
Gui, 4:Add, Text, x275 y113 w30 h30 vSubSl gSubSl
Gui, 4:Add, Text, x325 y113 w30 h30 vAddSl gAddSl
}
class Slide {
__New(){
This.LX:=10,This.LY:=Ly,This.LW:=300,This.LH:=5,This.BX:=110
This.BY:=118,This.BW:=Bw,This.BH:=Bh,This.Bitmap:="",This.Draw_Bottom(),This.Draw_Top(),This.Display()
}
Draw_Bottom(){
DeleteObject(This.Bitmap)
This.Bitmap2:=Gdip_CreateBitmap(250,36)
g:=Gdip_GraphicsFromImage(This.Bitmap2)
Gdip_SetSmoothingMode(g,1),This.Brush:=New_Brush("00aa00")
Fill_Box(g,This.Brush,0,0,250,36),Gdip_DeleteBrush(This.Brush)
This.Brush:=New_Brush("002200"),Fill_Box(g,This.Brush,1,1,248,34),Gdip_DeleteBrush(This.Brush)
This.Brush:=Gdip_CreateLineBrushFromRect(0, 0,250,36,"0x33ffffff", "0xff000000"),Fill_Box(g,This.Brush,2,2,246,32)
Gdip_SetSmoothingMode(g,2),This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,10,15,230,6),Gdip_DeleteBrush(This.Brush)
This.Brush:=New_Brush("000000","ff"),Fill_Box(g,This.Brush,12,17,226,2),Gdip_DeleteBrush(This.Brush)
Gdip_DrawImage(Win4.G, This.BitMap2,15,110,250,36),UpdateLayeredWindow(Win4.hwnd, Win4.hdc)
Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
}
Draw_Top(){
DeleteObject(This.Bitmap),This.Bitmap:=Gdip_CreateBitmap(50,20),g:=Gdip_GraphicsFromImage(This.Bitmap)
Gdip_SetSmoothingMode(g,2),This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,50,20),Gdip_DeleteBrush(This.Brush)
Gdip_SetSmoothingMode(g,1),This.Brush:=New_Brush("000000"),Fill_Box(g,This.Brush,1,1,48,18),Gdip_DeleteBrush(This.Brush)
This.Brush:=New_Brush("002200"),Fill_Box(g,This.Brush,2,2,46,16),Gdip_DeleteBrush(This.Brush)
This.Brush:=Gdip_CreateLineBrushFromRect(2, 2,46,16,"0x33ffffff", "0xff000000"),Fill_Box(g,This.Brush,2,2,46,16),xt:=8
Loop 4 {
Gdip_SetSmoothingMode(g,1),This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,xt,4,3,12)
Gdip_DeleteBrush(This.Brush),Gdip_SetSmoothingMode(g,2),This.Brush:=New_Brush("000000")
Fill_Box(g,This.Brush,xt+1,5,1,10),Gdip_DeleteBrush(This.Brush),xt+=10
}
Gdip_DrawImage(Win4.G, This.BitMap,This.BX,This.BY,50,20),UpdateLayeredWindow(Win4.hwnd, Win4.hdc),Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
}
UpDate(){
While(GetKeyState("LButton")){
MouseGetPos,slx,
if(slx>62&&slx<236)
This.BX:=slx-34
else if(slx<62)
This.BX:=62-34
else if(slx>236)
This.BX:=236-34
Gdip_GraphicsClear(Win4.G),Gdip_DrawImage(Win4.G, This.BitMap2,15,110,250,36)
Gdip_DrawImage(Win4.G, This.BitMap,This.BX,This.BY,50,20),speed:= Floor(This.BX/9.1578)-2
This.Display(),UpdateLayeredWindow(Win4.hwnd, Win4.hdc)
ToolTip,% speed
}
ToolTip,
Delay:=1000/Speed
}
Add(){
if(Speed<20){
Speed++
This.BX:=Speed*9.1578+16
if(Speed=20)
This.Bx:=236-34
Gdip_GraphicsClear(Win4.G),Gdip_DrawImage(Win4.G, This.BitMap2,15,110,250,36)
Gdip_DrawImage(Win4.G, This.BitMap,This.BX,This.BY,50,20),This.Display(),UpdateLayeredWindow(Win4.hwnd, Win4.hdc)
}
Delay:=1000/Speed
}
Subtract(){
if(Speed>1){
Speed--
This.BX:=Speed*9.1578+16
if(Speed=1)
This.Bx:=62-34
Gdip_GraphicsClear(Win4.G),Gdip_DrawImage(Win4.G, This.BitMap2,15,110,250,36)
Gdip_DrawImage(Win4.G, This.BitMap,This.BX,This.BY,50,20),This.Display(),UpdateLayeredWindow(Win4.hwnd, Win4.hdc)
}
Delay:=1000/Speed
}
Display(){
DeleteObject(This.Bitmap3),This.Bitmap3:=Gdip_CreateBitmap(90,30),g:=Gdip_GraphicsFromImage(This.Bitmap3)
Gdip_SetSmoothingMode(g,1),This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,90,30),Gdip_DeleteBrush(This.Brush)
Gdip_SetSmoothingMode(g,1),This.Brush:=New_Brush("000000"),Fill_Box(g,This.Brush,1,1,88,28),Gdip_DeleteBrush(This.Brush)
This.Brush:=New_Brush("002200"),Fill_Box(g,This.Brush,2,2,86,26),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("00ff00")
Fill_Box(g,This.Brush,30,4,1,22),Fill_Box(g,This.Brush,60,4,1,22),Gdip_DeleteBrush(This.Brush),This.Brush:=Gdip_CreateLineBrushFromRect(2, 2,86,26,"0x33ffffff", "0xff000000")
Fill_Box(g,This.Brush,2,2,86,26),Gdip_TextToGraphics(g,Speed," s12 r5 cff00ff00 Bold vCenter Center","Microsoft YaHei UI",90,30)
Gdip_TextToGraphics(g,"- +"," s12 r5 cff00ff00 Bold vCenter Center","Microsoft YaHei UI",90,30),Gdip_DrawImage(Win4.G, This.BitMap3,275,113,90,30)
UpdateLayeredWindow(Win4.hwnd, Win4.hdc),Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
}
}
class Butt {
__New(x,y,w,h,font_Size,Text_Colour,Text,Name,Hover_Text_Colour,Hover_BC_Colour,Win_Number,Pressed_BC_Colour:="",Pressed_Text_Colour:="",Underline_Flag:=0){
This.X:=x,This.Y:=y,This.W:=w,This.H:=h,This.Font_Size:=font_Size,This.Colour:=Text_Colour,This.Hover_Text_Colour:=Hover_Text_Colour
This.Pressed_Text_Colour:=Pressed_Text_Colour,This.Text:=Text,This.Name:=Name,This.Hover_BC_Colour:=Hover_BC_Colour
This.Pressed_BC_Colour:=Pressed_BC_Colour,This.Window_Number:=Win_Number,This.UnderLine_Flag:=Underline_Flag,This.Draw_Norm()
}
Draw_Norm(){
global
DeleteObject(This.Bitmap),This.Bitmap:=Gdip_CreateBitmap(This.W,This.H),g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,1)
This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,This.W,This.H),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("000000")
Fill_Box(g,This.Brush,1,1,This.W-2,This.H-2),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("002200"),Fill_Box(g,This.Brush,2,2,This.W-4,This.H-4)
Gdip_DeleteBrush(This.Brush),Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.Colour " Bold vCenter Center","Microsoft YaHei UI",This.W,This.H)
This.Brush:=Gdip_CreateLineBrushFromRect(2, 2,This.W-4,This.H-4,"0x33ffffff", "0xff000000"),Fill_Box(g,This.Brush,0,0,This.W,This.H)
if(This.Window_Number=1)
Gdip_DrawImage(Win.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win.hwnd, Win.hdc)
else if(This.Window_Number=3)
Gdip_DrawImage(Win3.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win3.hwnd, Win3.hdc)
Gdip_DeleteGraphics(g)
}
Draw_Hover(){
global
DeleteObject(This.Bitmap),This.Bitmap:=Gdip_CreateBitmap(This.W,This.H),g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,1)
This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,This.W,This.H),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("333333")
Fill_Box(g,This.Brush,1,1,This.W-2,This.H-2),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush(This.Hover_BC_Colour),Fill_Box(g,This.Brush,2,2,This.W-4,This.H-4)
Gdip_DeleteBrush(This.Brush)
If(This.UnderLine_Flag=1)
Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.Hover_Text_Colour " Bold Underline vCenter Center","Microsoft YaHei UI",This.W,This.H)
else
Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.Hover_Text_Colour " Bold vCenter Center","Microsoft YaHei UI",This.W,This.H)
This.Brush:=Gdip_CreateLineBrushFromRect(2, 2,This.W-4,This.H-4,"0x11ffffff", "0xff000000"),Fill_Box(g,This.Brush,0,0,This.W,This.H)
if(This.Window_Number=1)
Gdip_DrawImage(Win.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win.hwnd, Win.hdc)
else if(This.Window_Number=3)
Gdip_DrawImage(Win3.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win3.hwnd, Win3.hdc)
Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
}
Draw_Pressed(){
global
DeleteObject(This.Bitmap),This.Bitmap:=Gdip_CreateBitmap(This.W,This.H),g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,1)
This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,This.W,This.H),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("333333")
Fill_Box(g,This.Brush,1,1,This.W-2,This.H-2),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush(This.Pressed_BC_Colour)
Fill_Box(g,This.Brush,2,2,This.W-4,This.H-4),Gdip_DeleteBrush(This.Brush)
If(This.UnderLine_Flag=1)
Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.Pressed_Text_Colour " Bold Underline vCenter Center","Microsoft YaHei UI",This.W,This.H)
else
Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.Pressed_Text_Colour " Bold vCenter Center","Microsoft YaHei UI",This.W,This.H)
This.Brush:=Gdip_CreateLineBrushFromRect(2, 2,This.W-4,This.H-4,"0x11ffffff", "0xff000000"),Fill_Box(g,This.Brush,0,0,This.W,This.H)
if(This.Window_Number=1)
Gdip_DrawImage(Win.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win.hwnd, Win.hdc)
else if(This.Window_Number=3)
Gdip_DrawImage(Win3.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win3.hwnd, Win3.hdc)
Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
SetTimer,OT,Off
MouseGetPos,,,,ctrl1,2
While(GetKeyState("LButton"))
sleep,-1
MouseGetPos,,,,ctrl2,2
if(ctrl1=ctrl2)
This.Draw_Hover()
SetTimer,OT,On
}
}
class Rad1 {
__New(x,y,w,h,State,On_Colour,Off_Colour,Text,Font_Size,On_Font_Colour,Off_Font_Colour,Name,Group_Name,Label){
This.X:=x,This.Y:=y,This.W:=w,This.H:=h,This.Name:=Name,This.Label:=Label,This.Group_Name:=Group_Name,This.Text:=Text
This.On_Font_Colour:=On_Font_Colour,This.Off_Font_Colour:=Off_Font_Colour,This.Font_Size:=Font_Size,This.On_Colour:=On_Colour
This.Off_Colour:=Off_Colour,This.State:=State,This.Bitmap:=""
if(This.State=1)
This.Draw_One()
else
This.Draw_Zero()
}
Draw_One(){
DeleteObject(This.Bitmap),This.Bitmap:=Gdip_CreateBitmap(This.W,This.H),g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,1)
This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,This.W,This.H),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("000000")
Fill_Box(g,This.Brush,1,1,This.W-2,This.H-2),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush(This.On_Colour),Fill_Box(g,This.Brush,2,2,This.W-4,This.H-4)
Gdip_DeleteBrush(This.Brush),This.Brush:=Gdip_CreateLineBrushFromRect(0, 0,This.W-4,This.H-4,"0x11ffffff", "0xdd000000")
Fill_Box(g,This.Brush,0,0,This.W,This.H),Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.On_Font_Colour " Bold vCenter Center","Microsoft YaHei UI",This.W,This.H)
Gdip_DrawImage(Win3.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win3.hwnd, Win3.hdc),Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
}
Draw_Zero(){
DeleteObject(This.Bitmap),This.Bitmap:=Gdip_CreateBitmap(This.W,This.H),g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,1)
This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,This.W,This.H),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("000000")
Fill_Box(g,This.Brush,1,1,This.W-2,This.H-2),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush(This.Off_Colour),Fill_Box(g,This.Brush,2,2,This.W-4,This.H-4)
Gdip_DeleteBrush(This.Brush),This.Brush:=Gdip_CreateLineBrushFromRect(0, 0,This.W-4,This.H-4,"0x11ffffff", "0xdd000000"),Fill_Box(g,This.Brush,0,0,This.W,This.H)
Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.Off_Font_Colour " Bold vCenter Center","Microsoft YaHei UI",This.W,This.H)
Gdip_DrawImage(Win3.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win3.hwnd, Win3.hdc),Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
}
}
class Check1 {
__New(x,y,w,h,State,On_Colour,Off_Colour,Text,Font_Size,On_Font_Colour,Off_Font_Colour,Name){
This.X:=x,This.Y:=y,This.W:=w,This.H:=h,This.Name:=Name,This.Text:=Text,This.On_Font_Colour:=On_Font_Colour,This.Off_Font_Colour:=Off_Font_Colour
This.Font_Size:=Font_Size,This.On_Colour:=On_Colour,This.Off_Colour:=Off_Colour,This.State:=State,This.Bitmap:=""
if(This.State=1)
This.Draw_One()
else
This.Draw_Zero()
}
Draw_One(){
DeleteObject(This.Bitmap),This.Bitmap:=Gdip_CreateBitmap(This.W,This.H),g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,1)
This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,This.W,This.H),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("000000")
Fill_Box(g,This.Brush,1,1,This.W-2,This.H-2),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush(This.On_Colour),Fill_Box(g,This.Brush,2,2,This.W-4,This.H-4)
Gdip_DeleteBrush(This.Brush),This.Brush:=Gdip_CreateLineBrushFromRect(0, 0,This.W-4,This.H-4,"0x11ffffff", "0xdd000000"),Fill_Box(g,This.Brush,0,0,This.W,This.H)
Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.On_Font_Colour " Bold vCenter Center","Microsoft YaHei UI",This.W,This.H)
Gdip_DrawImage(Win3.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win3.hwnd, Win3.hdc),Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
}
Draw_Zero(){
DeleteObject(This.Bitmap),This.Bitmap:=Gdip_CreateBitmap(This.W,This.H),g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,1)
This.Brush:=New_Brush("00aa00"),Fill_Box(g,This.Brush,0,0,This.W,This.H),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush("000000")
Fill_Box(g,This.Brush,1,1,This.W-2,This.H-2),Gdip_DeleteBrush(This.Brush),This.Brush:=New_Brush(This.Off_Colour),Fill_Box(g,This.Brush,2,2,This.W-4,This.H-4)
Gdip_DeleteBrush(This.Brush),This.Brush:=Gdip_CreateLineBrushFromRect(0, 0,This.W-4,This.H-4,"0x11ffffff", "0xdd000000"),Fill_Box(g,This.Brush,0,0,This.W,This.H)
Gdip_TextToGraphics(g,This.Text,"s" This.Font_Size " r5 c" This.Off_Font_Colour " Bold vCenter Center","Microsoft YaHei UI",This.W,This.H)
Gdip_DrawImage(Win3.G, This.BitMap,This.X,This.Y,This.W,This.H),UpdateLayeredWindow(Win3.hwnd, Win3.hdc),Gdip_DeleteBrush(This.Brush),Gdip_DeleteGraphics(g)
}
}
Check_Pos(a1:="",a2:="",a3:="",a4:="",a5:="",a6:="",a7:="",a8:=""){
WinGetPos,a2,a6,,,HB M-Clicker
if(a1-a2<a3&&a1-a2>a4&&a5-a6>a7&&a5-a6<a8)
return true
else
return false
}
MW(){
SetTimer,M_Loop,Off
PostMessage,0xA1,2
MovWin:=1
While(GetKeyState("LButton"))
Sleep,10
SetTimer,M_Loop,30
MovWin:=0
}
MINW(){
Gui,1:Minimize
}
CGUI(){
global
Win:=Layered_Window_SetUp(4,A_ScreenWidth//2-Win.W//2,A_ScreenHeight//2-Win.H//2,Win.W,Win.H,1,"+AlwaysOnTop -Caption -DPIScale")
Gui,1:Add,Text,x70 y5 w260 h20 vtitle gMW
Gui,1:Add,Text,x350 y7 w15 h15 vWMB gMINW
Gui,1:Add,Text,x370 y7 w15 h15 vWCB gGuiClose
Gui,1:Show,,HB MC
}
CGUI2(){
global
Win2:=Layered_Window_SetUp(4,10,30,Win.W-20,Win.H-40,2,"+Parent1 -Caption -DPIScale")
}
CGUI3(){
global
Win3:=Layered_Window_SetUp(4,0,0,Win2.W,Win2.H,3,"+Parent2 -Caption -DPIScale +LastFound")
UpdateLayeredWindow(Win3.hwnd, Win3.hdc, Win3.X, Win3.Y, Win3.W, Win3.H)
}
Set_CP(ByRef Target_X,ByRef Target_Y){
While(!GetKeyState("LButton"))
ToolTip, Click Somewhere.
ToolTip,
MouseGetPos,Target_X,Target_Y
}
SetSPos(){
bitm:=Gdip_CreateBitmap(60,21),g:=Gdip_GraphicsFromImage(bitm),Gdip_SetSmoothingMode(g,2)
tbr:=New_Brush("22aa22","ff"),Fill_Box(g,tbr,0,0,60,21),tpn:=New_Pen("004400","ff",1)
Gdip_DrawRectangle(g, tpn,0,0,59,20),Gdip_DeletePen(tpn),Gdip_DeleteBrush(tbr)
Gdip_TextToGraphics(g,Target_X " " Target_Y," s10 r5 cff000000 Bold vCenter Center","Microsoft YaHei UI",60,21)
Gdip_DrawImage(Win3.G, bitm,100,81,60,21),UpdateLayeredWindow(Win3.hwnd, Win3.hdc),Gdip_DeleteGraphics(g),Gdip_DisposeImage(bitm)
}
CL_CoU(){
bitm:=Gdip_CreateBitmap(60,21),g:=Gdip_GraphicsFromImage(bitm),Gdip_SetSmoothingMode(g,2),tbr:=New_Brush("22aa22","ff")
Fill_Box(g,tbr,0,0,60,21),tpn:=New_Pen("004400","ff",1),Gdip_DrawRectangle(g, tpn,0,0,59,20),Gdip_DeletePen(tpn),Gdip_DeleteBrush(tbr)
Gdip_TextToGraphics(g,Click_Count," s10 r5 cff000000 Bold vCenter Center","Microsoft YaHei UI",60,21)
Gdip_DrawImage(Win3.G, bitm,290,81,60,21),UpdateLayeredWindow(Win3.hwnd, Win3.hdc),Gdip_DeleteGraphics(g),Gdip_DisposeImage(bitm)
}
ACB(){
global
Button1[1]:=New Butt(350,7,16,15,12,"ff33bb44","-","WMB","ff000000","22cc22",1),Button1[2]:=New Butt(370,7,16,15,12,"ff33bb55","X","WCB","ff000000","880000",1)
Button1[3]:=New Butt(70,3,260,24,12,"ff00ff00","HB Matrix Clicker","Title","ff000000","aaccaa",1,,,1),Button1[4]:=New Butt(5,153,120,25,14,"ff00ff00","Start","Start","ff000000","22cc22",3,"115511","ff000000",1)
Button1[5]:=New Butt(130,153,120,25,14,"ff00ff00","Stop","Stop","ff000000","22cc22",3,"115511","ff000000",1),Button1[6]:=New Butt(255,153,120,25,14,"ff00ff00","Reload","Reload","ff000000","22cc22",3,"115511","ff000000",1)
Button1[7]:=New Butt(20,182,340,25,14,"ff00ff00","HotKeys","Hotkeys","ff000000","22cc22",3,"115511","ff000000",1),Button1[8]:=New Butt(5,80,90,25,12,"ff00ff00","Set Position","Set_Position","ff000000","22cc22",3,"115511","ff000000",1)
Button1[9]:=New Butt(190,80,90,25,12,"ff00ff00","Reset Count","Reset_Count","ff000000","22cc22",3,"115511","ff000000",1)
Gui,3:Add,Text,x5 y153 w120 h25 gStart vStart
Gui,3:Add,Text,x130 y153 w120 h25 gStop vStop
Gui,3:Add,Text,x255 y153 w120 h25 gReload vReload
Gui,3:Add,Text,x20 y182 w340 h25 gHotkeys vHotkeys
Gui,3:Add,Text,x5 y80 w90 h25 gSet_Position vSet_Position
Gui,3:Add,Text,x190 y80 w90 h25 gReset_Count vReset_Count
}
SetCAMOUNT(){
gui,3:Submit,NoHide
bitm:=Gdip_CreateBitmap(60,21),g:=Gdip_GraphicsFromImage(bitm),Gdip_SetSmoothingMode(g,2),tbr:=New_Brush("22aa22","ff")
Fill_Box(g,tbr,0,0,60,21),tpn:=New_Pen("004400","ff",1),Gdip_DrawRectangle(g, tpn,0,0,59,20),Gdip_DeletePen(tpn),Gdip_DeleteBrush(tbr)
Gdip_TextToGraphics(g,Fixed_Click_Amount," s10 r5 cff000000 Bold vCenter Center","Microsoft YaHei UI",60,21)
Gdip_DrawImage(Win3.G, bitm,275,56,60,18),UpdateLayeredWindow(Win3.hwnd, Win3.hdc),Gdip_DeleteGraphics(g),Gdip_DisposeImage(bitm)
}
DBG(){
global
Brush[1]:=New_Brush("000000"),Gdip_FillRoundedRectangle(Win.G,Brush[1],0,0, Win.w, Win.h, 15),Brush[2]:=Gdip_CreateLineBrushFromRect(0, 0, Win.w, 150,"0x44aaffaa", "0xff000000")
Gdip_FillRoundedRectangle(Win.G,Brush[2],0,0,win.w, 100, 15),Pen[1]:=New_Pen("00bb00","ff",2),Gdip_DrawRoundedRectangle(Win.G, Pen[1],0,0, Win.w-1, Win.h-1, 15)
Gdip_DeletePen(Pen[1]),Pen[1]:=New_Pen("00bb00","ff",2),Gdip_DrawRoundedRectangle(Win.G, Pen[1],0,0, Win.w-1, Win.h, 15),Gdip_DeletePen(Pen[1])
Brush[4]:=New_Brush("ffffff","11"),Gdip_FillEllipse(Win.G,Brush[4], 0, 30, 5,200),Gdip_FillEllipse(Win.G,Brush[4], 390, 30, 5,200),Gdip_FillEllipse(Win.G,Brush[4], 15, 235, 370,10)
Pen[2]:=New_Pen("000000","ff",2),Gdip_DrawRectangle(Win1.G, Pen[2],9,29, Win.w-18, Win.h-38),Gdip_DeletePen(Pen[2]),Pen[2]:=New_Pen("00bb00","ff",1)
Gdip_DrawRectangle(Win.G, Pen[2],9,29, Win.w-18, Win.h-38),Gdip_DeletePen(Pen[2]),Draw_Inner()
UpdateLayeredWindow(Win.hwnd, Win.hdc, Win.X, Win.Y, Win.W, Win.H),UpdateLayeredWindow(Win2.hwnd, Win2.hdc, Win2.X, Win2.Y, Win2.W, Win2.H)
}
RandomNumber(min,max){
Random,out,Min,Max
return out
}
Draw_Inner(){
Brush[2]:=New_Brush("001100","55"),Fill_Box(Win2.G,Brush[2],0,0, Win2.w, Win2.h)
}
Class Strings {
__New(x,y,w,h){
This.X:=x,This.Y:=y,This.W:=w,This.H:=h,This.Font_Size:=RandomNumber(6,18),col:=RandomNumber(1,10),This.Counter:=RandomNumber(0,80),This.Colour:=colours[col]
This.Speed:=floor(This.Font_Size/4),This.Create_Bitmap()
}
Create_Bitmap(){
DeleteObject(This.Bitmap)
Gdip_DisposeImage(This.Bitmap)
This.Bitmap:=Gdip_CreateBitmap(This.W,This.H)
temp_Array:="",This.Array1:=[]
loop 70 {
val:=RandomNumber(1,34)
(val>30)?(temp_Array.=" `n",This.Array1[A_Index]:=" "):(temp_Array.=Letter_Array[val] "`n",This.Array1[A_Index]:=Letter_Array[val])
}
g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,4)
Gdip_TextToGraphics(g,temp_array,"s" This.Font_Size " r5 c" This.Colour " Bold Center","Chiller",20,400)
Gdip_DeleteGraphics(g)
}
Change_Things(){
DeleteObject(This.Bitmap)
Gdip_DisposeImage(This.Bitmap)
;~ DeleteObject(This.Bitmap)
This.Bitmap:=Gdip_CreateBitmap(This.W,This.H)
temp_Array:=""
loop 70 {
rn:=RandomNumber(1,5)
(rn=3)?(val:=RandomNumber(1,61),temp_Array.=Letter_Array[val] "`n"):(temp_Array.=This.Array1[A_Index] "`n")
}
g:=Gdip_GraphicsFromImage(This.Bitmap),Gdip_SetSmoothingMode(g,4)
Gdip_TextToGraphics(g,temp_array,"s" This.Font_Size " r5 c" This.Colour " Bold Center","Chiller",20,400)
Gdip_DeleteGraphics(g),DeleteObject(This.Bitmap)
}
UpDate(){
This.y+=This.Speed
if(++This.Counter>85)
This.Counter:=RandomNumber(0,80),This.Change_Things()
if(This.Y>Win.H){
This.Y:=RandomNumber(-400,-1150),This.X:=5*RandomNumber(0,Win.W//5-3)
This.Font_Size:=RandomNumber(6,22),This.Speed:=floor(This.Font_Size/4)
This.Create_Bitmap()
}
if(This.Y>-400&&This.Y<Win.H)
Gdip_DrawImage(Win2.G, This.BitMap,This.X,This.Y,This.W,This.H)
}
}
SetUp(){
x:=5
Loop, % Win2.W//5 - 3
String[A_Index]:=New Strings(x,RandomNumber(-400,-1150),20,400),x+=5
}
OT(){
MouseGetPos,,,,ctrl,2
GuiControlGet,name,%tgui%:Name,% ctrl
if(name!=Button1[Num].Name&&MovWin!=1){
Button1[Num].Draw_Norm(),Num:="",HovOn:=0,tgui:=""
SetTimer,OT,Off
}
}
Whv(){
if(HovOn=0){
MouseGetPos,,,,ctrl,2
GuiControlGet,name,%A_Gui%:Name,% ctrl
Loop, % Button1.Length()
if(Button1[A_Index].Name=name){
HovOn:=1,tgui:=A_Gui,Num:=A_Index
Button1[A_Index].Draw_Hover()
SetTimer,OT,30
}
}
if(Stop=0&&PauseOn=0&&Free_Mode=1){
Stop:=1
}
}
Show_Win(){
Button1[3].Draw_Norm()
}
ACH(){
global
Checks[1]:=New Check1(50,5,120,20,1,"33ff33","114411","AlwaysOnTop",12,"ff000000","ff777777","Always")
Checks[3]:=New Check1(210,5,120,20,0,"33ff33","114411","Free Mode",12,"ff000000","ff777777","Free_Mode")
Gui,3:Add,Text,x50 y5 w120 h25 gAOT vAlways
Gui,3:Add,Text,x210 y5 w120 h25 gFM vFree_Mode
}
FM(){
Free_Mode:=!Free_Mode
if(Free_Mode){
Checks[3].Draw_One()
}else {
Checks[3].Draw_Zero()
}
}
AOT(){
Always:=!Always
if(Always){
Checks[1].Draw_One()
Gui,1:+AlwaysOnTop
}else {
Checks[1].Draw_Zero()
Gui,1:-AlwaysOnTop
}
}
MsgShow(MsNum){
Gui,1:+OwnDialogs
if(MsNum=1)
MsgBox, 262192,Use Hotkeys,Use hotkeys to start and stop the auto clicker when in free mode.
else if(MsNum=2)
MsgBox, 262192,Set a position to click,Set a click position or switch to ""Free Mode""
}
Gdip_DeleteBrush(pBrush)
{
return DllCall("gdiplus\GdipDeleteBrush", A_PtrSize ? "UPtr" : "UInt", pBrush)
}
Gdip_DeletePen(pPen)
{
return DllCall("gdiplus\GdipDeletePen", A_PtrSize ? "UPtr" : "UInt", pPen)
}
Gdip_DisposeImage(pBitmap)
{
return DllCall("gdiplus\GdipDisposeImage", A_PtrSize ? "UPtr" : "UInt", pBitmap)
}
Layered_Window_ShutDown(This)
{
SelectObject(This.hdc,This.obm)
DeleteObject(This.hbm)
DeleteDC(This.hdc)
gdip_deleteGraphics(This.g)
Gdip_Shutdown(This.Token)
}
UpdateLayeredWindow(hwnd, hdc, x="", y="", w="", h="", Alpha=255)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if ((x != "") && (y != ""))
VarSetCapacity(pt, 8), NumPut(x, pt, 0, "UInt"), NumPut(y, pt, 4, "UInt")
if (w = "") ||(h = "")
WinGetPos,,, w, h, ahk_id %hwnd%
return DllCall("UpdateLayeredWindow"
, Ptr, hwnd
, Ptr, 0
, Ptr, ((x = "") && (y = "")) ? 0 : &pt
, "int64*", w|h<<32
, Ptr, hdc
, "int64*", 0
, "uint", 0
, "UInt*", Alpha<<16|1<<24
, "uint", 2)
}
DeleteObject(hObject)
{
return DllCall("DeleteObject", A_PtrSize ? "UPtr" : "UInt", hObject)
}
Gdip_CreateBitmap(Width, Height, Format=0x26200A)
{
DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, A_PtrSize ? "UPtr" : "UInt", 0, A_PtrSize ? "UPtr*" : "uint*", pBitmap)
Return pBitmap
}
Gdip_GraphicsFromImage(pBitmap)
{
DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
return pGraphics
}
Gdip_SetSmoothingMode(pGraphics, SmoothingMode)
{
return DllCall("gdiplus\GdipSetSmoothingMode", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", SmoothingMode)
}
New_Brush(colour:="000000",Alpha:="FF")
{
static Hellbent_Brush:=[]
new_colour := "0x" Alpha colour
Hellbent_Brush[Hellbent_Brush.Length()+1]:=Gdip_BrushCreateSolid(new_colour)
return Hellbent_Brush[Hellbent_Brush.Length()]
}
Fill_Box(pGraphics,pBrush,x,y,w,h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillRectangle"
, Ptr, pGraphics
, Ptr, pBrush
, "float", x
, "float", y
, "float", w
, "float", h)
}
Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1)
{
CreateRectF(RectF, x, y, w, h)
DllCall("gdiplus\GdipCreateLineBrushFromRect", A_PtrSize ? "UPtr" : "UInt", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
return LGpBrush
}
Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0)
{
IWidth := Width, IHeight:= Height
RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
RegExMatch(Options, "i)NoWrap", NoWrap)
RegExMatch(Options, "i)R(\d)", Rendering)
RegExMatch(Options, "i)S(\d+)(p*)", Size)
if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
PassBrush := 1, pBrush := Colour2
if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
return -1
Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
Loop, Parse, Styles, |
{
if RegExMatch(Options, "\b" A_loopField)
Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
}
Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
Loop, Parse, Alignments, |
{
if RegExMatch(Options, "\b" A_loopField)
Align |= A_Index//2.1 ; 0|0|1|1|2|2
}
xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
if !PassBrush
Colour := "0x" (Colour2 ? Colour2 : "ff000000")
Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
hFamily := Gdip_FontFamilyCreate(Font)
hFont := Gdip_FontCreate(hFamily, Size, Style)
FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
hFormat := Gdip_StringFormatCreate(FormatStyle)
pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
if !(hFamily && hFont && hFormat && pBrush && pGraphics)
return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
CreateRectF(RC, xpos, ypos, Width, Height)
Gdip_SetStringFormatAlign(hFormat, Align)
Gdip_SetTextRenderingHint(pGraphics, Rendering)
ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
if vPos
{
StringSplit, ReturnRC, ReturnRC, |
if (vPos = "vCentre") || (vPos = "vCenter")
ypos += (Height-ReturnRC4)//2
else if (vPos = "Top") || (vPos = "Up")
ypos := 0
else if (vPos = "Bottom") || (vPos = "Down")
ypos := Height-ReturnRC4
CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
}
if !Measure
E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
if !PassBrush
Gdip_DeleteBrush(pBrush)
Gdip_DeleteStringFormat(hFormat)
Gdip_DeleteFont(hFont)
Gdip_DeleteFontFamily(hFamily)
return E ? E : ReturnRC
}
Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="", sw="", sh="", Matrix=1)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if (Matrix&1 = "")
ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
else if (Matrix != 1)
ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
if (sx = "" && sy = "" && sw = "" && sh = "")
{
if (dx = "" && dy = "" && dw = "" && dh = "")
{
sx := dx := 0, sy := dy := 0
sw := dw := Gdip_GetImageWidth(pBitmap)
sh := dh := Gdip_GetImageHeight(pBitmap)
}
else
{
sx := sy := 0
sw := Gdip_GetImageWidth(pBitmap)
sh := Gdip_GetImageHeight(pBitmap)
}
}
E := DllCall("gdiplus\GdipDrawImageRectRect"
, Ptr, pGraphics
, Ptr, pBitmap
, "float", dx
, "float", dy
, "float", dw
, "float", dh
, "float", sx
, "float", sy
, "float", sw
, "float", sh
, "int", 2
, Ptr, ImageAttr
, Ptr, 0
, Ptr, 0)
if ImageAttr
Gdip_DisposeImageAttributes(ImageAttr)
return E
}
Gdip_DeleteGraphics(pGraphics)
{
return DllCall("gdiplus\GdipDeleteGraphics", A_PtrSize ? "UPtr" : "UInt", pGraphics)
}
Layered_Window_SetUp(Smoothing,Window_X,Window_Y,Window_W,Window_H,Window_Name:=1,Window_Options:="")
{
Layered:={}
Layered.W:=Window_W
Layered.H:=Window_H
Layered.X:=Window_X
Layered.Y:=Window_Y
Layered.Name:=Window_Name
Layered.Options:=Window_Options
Layered.Token:=Gdip_Startup()
Create_Layered_GUI(Layered)
Layered.hwnd:=winExist()
Layered.hbm := CreateDIBSection(Window_W,Window_H)
Layered.hdc := CreateCompatibleDC()
Layered.obm := SelectObject(Layered.hdc,Layered.hbm)
Layered.G := Gdip_GraphicsFromHDC(Layered.hdc)
Gdip_SetSmoothingMode(Layered.G,Smoothing)
return Layered
}
Gdip_GraphicsClear(pGraphics, ARGB=0x00ffffff)
{
return DllCall("gdiplus\GdipGraphicsClear", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", ARGB)
}
New_Pen(colour:="000000",Alpha:="FF",Width:= 5)
{
static Hellbent_Pen:=[]
new_colour := "0x" Alpha colour
Hellbent_Pen[Hellbent_Pen.Length()+1]:=Gdip_CreatePen(New_Colour,Width)
return Hellbent_Pen[Hellbent_Pen.Length()]
}
Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipDrawRectangle", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
}
Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r)
{
Region := Gdip_GetClipRegion(pGraphics)
Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
Gdip_SetClipRegion(pGraphics, Region, 0)
Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
Gdip_SetClipRegion(pGraphics, Region, 0)
Gdip_DeleteRegion(Region)
return E
}
Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r)
{
Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
Gdip_ResetClip(pGraphics)
Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
Gdip_ResetClip(pGraphics)
return E
}
Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillEllipse", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
}
SelectObject(hdc, hgdiobj)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("SelectObject", Ptr, hdc, Ptr, hgdiobj)
}
DeleteDC(hdc)
{
return DllCall("DeleteDC", A_PtrSize ? "UPtr" : "UInt", hdc)
}
Gdip_Shutdown(pToken)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
DllCall("gdiplus\GdiplusShutdown", Ptr, pToken)
if hModule := DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("FreeLibrary", Ptr, hModule)
return 0
}
Gdip_BrushCreateSolid(ARGB=0xff000000)
{
DllCall("gdiplus\GdipCreateSolidFill", "UInt", ARGB, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
return pBrush
}
CreateRectF(ByRef RectF, x, y, w, h)
{
VarSetCapacity(RectF, 16)
NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
}
Gdip_CloneBrush(pBrush)
{
DllCall("gdiplus\GdipCloneBrush", A_PtrSize ? "UPtr" : "UInt", pBrush, A_PtrSize ? "UPtr*" : "UInt*", pBrushClone)
return pBrushClone
}
Gdip_FontFamilyCreate(Font)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if (!A_IsUnicode)
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, "uint", 0, "int", 0)
VarSetCapacity(wFont, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, Ptr, &wFont, "int", nSize)
}
DllCall("gdiplus\GdipCreateFontFamilyFromName"
, Ptr, A_IsUnicode ? &Font : &wFont
, "uint", 0
, A_PtrSize ? "UPtr*" : "UInt*", hFamily)
return hFamily
}
Gdip_FontCreate(hFamily, Size, Style=0)
{
DllCall("gdiplus\GdipCreateFont", A_PtrSize ? "UPtr" : "UInt", hFamily, "float", Size, "int", Style, "int", 0, A_PtrSize ? "UPtr*" : "UInt*", hFont)
return hFont
}
Gdip_StringFormatCreate(Format=0, Lang=0)
{
DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, A_PtrSize ? "UPtr*" : "UInt*", hFormat)
return hFormat
}
Gdip_SetStringFormatAlign(hFormat, Align)
{
return DllCall("gdiplus\GdipSetStringFormatAlign", A_PtrSize ? "UPtr" : "UInt", hFormat, "int", Align)
}
Gdip_SetTextRenderingHint(pGraphics, RenderingHint)
{
return DllCall("gdiplus\GdipSetTextRenderingHint", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", RenderingHint)
}
Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
VarSetCapacity(RC, 16)
if !A_IsUnicode
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, "uint", 0, "int", 0)
VarSetCapacity(wString, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
}
DllCall("gdiplus\GdipMeasureString"
, Ptr, pGraphics
, Ptr, A_IsUnicode ? &sString : &wString
, "int", -1
, Ptr, hFont
, Ptr, &RectF
, Ptr, hFormat
, Ptr, &RC
, "uint*", Chars
, "uint*", Lines)
return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
}
Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if (!A_IsUnicode)
{
nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, 0, "int", 0)
VarSetCapacity(wString, nSize*2)
DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
}
return DllCall("gdiplus\GdipDrawString"
, Ptr, pGraphics
, Ptr, A_IsUnicode ? &sString : &wString
, "int", -1
, Ptr, hFont
, Ptr, &RectF
, Ptr, hFormat
, Ptr, pBrush)
}
Gdip_DeleteStringFormat(hFormat)
{
return DllCall("gdiplus\GdipDeleteStringFormat", A_PtrSize ? "UPtr" : "UInt", hFormat)
}
Gdip_DeleteFont(hFont)
{
return DllCall("gdiplus\GdipDeleteFont", A_PtrSize ? "UPtr" : "UInt", hFont)
}
Gdip_DeleteFontFamily(hFamily)
{
return DllCall("gdiplus\GdipDeleteFontFamily", A_PtrSize ? "UPtr" : "UInt", hFamily)
}
Gdip_SetImageAttributesColorMatrix(Matrix)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
VarSetCapacity(ColourMatrix, 100, 0)
Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])", "$1", "", 1), "[^\d-\.]+", "|")
StringSplit, Matrix, Matrix, |
Loop, 25
{
Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod(A_Index-1, 6) ? 0 : 1
NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
}
DllCall("gdiplus\GdipCreateImageAttributes", A_PtrSize ? "UPtr*" : "uint*", ImageAttr)
DllCall("gdiplus\GdipSetImageAttributesColorMatrix", Ptr, ImageAttr, "int", 1, "int", 1, Ptr, &ColourMatrix, Ptr, 0, "int", 0)
return ImageAttr
}
Gdip_GetImageWidth(pBitmap)
{
DllCall("gdiplus\GdipGetImageWidth", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Width)
return Width
}
Gdip_GetImageHeight(pBitmap)
{
DllCall("gdiplus\GdipGetImageHeight", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Height)
return Height
}
Gdip_DisposeImageAttributes(ImageAttr)
{
return DllCall("gdiplus\GdipDisposeImageAttributes", A_PtrSize ? "UPtr" : "UInt", ImageAttr)
}
Gdip_Startup()
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("LoadLibrary", "str", "gdiplus")
VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0)
return pToken
}
Create_Layered_GUI(Layered)
{
Gui,% Layered.Name ": +E0x80000 +LastFound " Layered.Options
Gui,% Layered.Name ":Show",% "x" Layered.X " y" Layered.Y " w" Layered.W " h" Layered.H " NA"
}
CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
hdc2 := hdc ? hdc : GetDC()
VarSetCapacity(bi, 40, 0)
NumPut(w, bi, 4, "uint")
, NumPut(h, bi, 8, "uint")
, NumPut(40, bi, 0, "uint")
, NumPut(1, bi, 12, "ushort")
, NumPut(0, bi, 16, "uInt")
, NumPut(bpp, bi, 14, "ushort")
hbm := DllCall("CreateDIBSection"
, Ptr, hdc2
, Ptr, &bi
, "uint", 0
, A_PtrSize ? "UPtr*" : "uint*", ppvBits
, Ptr, 0
, "uint", 0, Ptr)
if !hdc
ReleaseDC(hdc2)
return hbm
}
CreateCompatibleDC(hdc=0)
{
return DllCall("CreateCompatibleDC", A_PtrSize ? "UPtr" : "UInt", hdc)
}
Gdip_GraphicsFromHDC(hdc)
{
DllCall("gdiplus\GdipCreateFromHDC", A_PtrSize ? "UPtr" : "UInt", hdc, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
return pGraphics
}
Gdip_CreatePen(ARGB, w)
{
DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
return pPen
}
Gdip_GetClipRegion(pGraphics)
{
Region := Gdip_CreateRegion()
DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt*", Region)
return Region
}
Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0)
{
return DllCall("gdiplus\GdipSetClipRect", A_PtrSize ? "UPtr" : "UInt", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
}
Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipFillRectangle"
, Ptr, pGraphics
, Ptr, pBrush
, "float", x
, "float", y
, "float", w
, "float", h)
}
Gdip_SetClipRegion(pGraphics, Region, CombineMode=0)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipSetClipRegion", Ptr, pGraphics, Ptr, Region, "int", CombineMode)
}
Gdip_DeleteRegion(Region)
{
return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" : "UInt", Region)
}
Gdip_ResetClip(pGraphics)
{
return DllCall("gdiplus\GdipResetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics)
}
Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("gdiplus\GdipDrawEllipse", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
}
GetDC(hwnd=0)
{
return DllCall("GetDC", A_PtrSize ? "UPtr" : "UInt", hwnd)
}
ReleaseDC(hdc, hwnd=0)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
return DllCall("ReleaseDC", Ptr, hwnd, Ptr, hdc)
}
Gdip_CreateRegion()
{
DllCall("gdiplus\GdipCreateRegion", "UInt*", Region)
return Region
}