Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance,Force
- #Include,Hellbents gdip.ahk
- OnExit,GuiClose
- ;~ gui,1:add,button,x300 y200 w100 h30 ,button 4
- OnMessage(0x201,"Window_Clicks"),OnMessage(0x200,"Window_Hover")
- winval:={X:0,Y:0,W:1220,H:500,Name1:1,Name2:2,Smoothing:4,Options1:"+AlwaysOnTop -DPIScale",Options2:"+Parent1 +AlwaysOnTop -Caption +LastFound -DPIScale",Title:"Simple Clicker v2",x_Offset:3,y_Offset:26,BackGround:"171717"} ;171717
- global Btn:={},Current:=""
- global Window:=New Window(winval)
- /* Button Prototype
- ;This shows every value and meaning in a button setup object
- Button_Prototype := {
- X: 10, ;The X position of the button on the gui
- Y: 10, ;The Y position of the button on the gui
- W: 150, ;The Width of the button in px (size drawn and size on the gui)
- H: 30, ;The Height of the button in px (size drawn and size on the gui)
- }
- */
- ;~ Button_1:={X:10,Y:10,W:150,H:30,C11:"000000",C12:"33ff33",C13:"222222",C21:"000000",C22:"33ff33",C23:"343434",C31:"000000",C32:"000000",C33:"272727",Text:"Button " Btn.Length()+1,Smoothing:1,Options:" vCenter s14 r5 cff33ff33 Center",Options2:"vCenter s14 r5 cff33ff33 Center Underline",Options3:"x1 y1 vCenter s14 r5 cff33ff33 Center Underline",Font:"Arial Black"}
- ;~ Btn[Btn.Length()+1]:=New Button_Class_1(Button_1)
- x:=10
- Loop 5
- {
- y:=10
- Loop 5
- {
- Button_1:={X:x,Y:y,W:150,H:30,C11:"000000",C12:"33ff33",C13:"222222",C21:"000000",C22:"33ff33",C23:"0066aa",C31:"000000",C32:"000000",C33:"272727",Text:"Button " Btn.Length()+1,Smoothing:1,Options:" vCenter s14 r5 cff33ff33 Center",Options2:"vCenter s14 r5 cff33ff33 Center Underline",Options3:"x1 y1 vCenter s14 r5 cff33ff33 Center Underline",Font:"Arial Black"}
- Btn[Btn.Length()+1]:=New Button_Class_1(Button_1)
- y+=40
- }
- x+=160
- }
- Button_1:={X:x,Y:y,W:250,H:50,C11:"000000",C12:"33ff33",C13:"222222",C21:"000000",C22:"33ff33",C23:"ff0000",C31:"000000",C32:"000000",C33:"eeeeee",Text:"Button " Btn.Length()+1,Smoothing:1,Options:" vCenter s14 r5 cff33ff33 Center",Options2:"vCenter s14 r5 cff000000 Center Underline",Options3:"x1 y1 vCenter s14 r5 cff33ff33 Center Underline",Font:"Arial Black"}
- Btn[Btn.Length()+1]:=New Button_Class_1(Button_1)
- Button_1:={X:10,Y:y+=60,W:250,H:50,C11:"000000",C12:"777777",C13:"222222",C21:"000000",C22:"777777",C23:"ff0000",C31:"000000",C32:"000000",C33:"eeeeee",Text:"Button " Btn.Length()+1,Smoothing:1,Options:" vCenter s14 r5 cff33ff33 Center",Options2:"vCenter s14 r5 cff000000 Center Underline",Options3:"x1 y1 vCenter s14 r5 cff33ff33 Center Underline",Font:"Arial Black"}
- Btn[Btn.Length()+1]:=New Button_Class_1(Button_1)
- global Ready:=1
- return
- GuiClose:
- GuiEscape:
- *^ESC::
- Loop,% btn.Length()
- btn[A_Index].Button_ShutDown()
- window.Shutdown()
- ExitApp
- Class Button_Class_1
- {
- __New(Settings)
- {
- for k, v in settings
- This[k]:=v
- This.Bitmap_1:=This.Create_Bitmaps(This.C11,This.C12,This.C13,This.Options)
- This.Bitmap_2:=This.Create_Bitmaps(This.C21,This.C22,This.C23,This.Options2)
- This.Bitmap_3:=This.Create_Bitmaps(This.C31,This.C32,This.C33,This.Options3)
- This.Draw_Buttons(This.Bitmap_1)
- }
- Create_Bitmaps(c1,c2,c3,o)
- {
- pBitmap:=Gdip_CreateBitmap(This.W,This.H)
- G := Gdip_GraphicsFromImage(pBitmap)
- Gdip_SetSmoothingMode(G,This.Smoothing)
- brush1:=New_Brush(c1)
- brush2:=New_Brush(c2)
- brush3:=New_Brush(c3)
- brush4:=Gdip_CreateLineBrushFromRect(0, 0, this.w, this.h,0x33ffffff, 0x77000000,1)
- Gdip_FillRectangle(G,brush1,0,0,This.W,This.H)
- Gdip_FillRectangle(G,brush2,0,0,This.W-1,This.H-1)
- Gdip_FillRectangle(G,brush3,1,1,This.W-2,This.H-2)
- Gdip_FillRectangle(G,brush4,2,2,This.W-4,This.H-4)
- Gdip_TextToGraphics(G,This.Text,o,This.Font, This.W, This.H)
- Gdip_DeleteBrush(brush1)
- Gdip_DeleteBrush(brush2)
- Gdip_DeleteBrush(brush3)
- Gdip_DeleteBrush(brush4)
- Gdip_DeleteGraphics(G)
- return pBitmap
- }
- Draw_Buttons(bitmap)
- {
- Gdip_DrawImage(Window.G,bitmap,This.X,This.Y,This.W,This.H)
- Window.Update()
- }
- Button_Hover()
- {
- Tooltip,
- tip_counter:=1
- this.Draw_Buttons(This.Bitmap_2)
- Mousegetpos,tx,ty
- While(tx >= This.x &&tx <= (This.x+This.W)&& ty >= This.Y && ty <= This.Y+This.H)
- {
- Mousegetpos,tx,ty
- if(GetKeyState("LButton"))
- Window_Clicks()
- if(++Tip_Counter=30000)
- {
- Tip_Counter:=1
- Tooltip,% "This button is at x:" This.X " and y:" This.Y
- }
- }
- this.Draw_Buttons(This.Bitmap_1)
- Tooltip,
- }
- Button_Press()
- {
- Tooltip,
- this.Draw_Buttons(This.Bitmap_3)
- While(GetKeyState("LButton"))
- sleep,10
- ;~ gosub,Tray_tips
- this.Draw_Buttons(This.Bitmap_1)
- Window_Hover()
- }
- Button_ShutDown()
- {
- Gdip_DisposeImage(This.Bitmap_1)
- Gdip_DisposeImage(This.Bitmap_2)
- Gdip_DisposeImage(This.Bitmap_3)
- }
- }
- Class Window
- {
- ;~ __New(x,y,w,h,name1,name2,smoothing,options1,options2,title,x_offset,y_offset,Background)
- __New(winval)
- {
- for k, v in winval
- This[k]:=v
- if(This.Name1!=""){
- Gui,% This.Name1 ": " This.Options1
- Gui,% This.Name1 ": Show",% "w" This.W " h" This.H, % This.Title
- }
- This.Layered_Window_SetUp()
- }
- Draw_Background()
- {
- This.Background_Brush:=New_Brush(This.Background)
- Gdip_FillRectangle(This.G,This.Background_Brush,This.X-1,This.Y-1,This.W+2,This.H+2)
- }
- UpDate()
- {
- UpdateLayeredWindow(This.hwnd,This.hdc,This.X,This.Y,This.W,This.H)
- }
- Shutdown()
- {
- SelectObject(This.hdc,This.obm)
- DeleteObject(This.hbm)
- DeleteDC(This.hdc)
- gdip_deleteGraphics(This.g)
- Gdip_Shutdown(This.pToken)
- }
- Layered_Window_SetUp()
- {
- This.Token:=Gdip_Startup()
- Gui,% This.Name2 ": +E0x80000 +LastFound " This.Options2
- Gui,% This.Name2 ":Show",% "x" This.X " y" This.Y " w" This.W " h" This.H " NA"
- This.hwnd:=winExist()
- This.hbm := CreateDIBSection(This.W,This.H)
- This.hdc := CreateCompatibleDC()
- This.obm := SelectObject(This.hdc,This.hbm)
- This.G := Gdip_GraphicsFromHDC(This.hdc)
- Gdip_SetSmoothingMode(This.G,This.Smoothing)
- This.Draw_Background()
- This.UpDate()
- }
- }
- Window_Clicks()
- {
- if(Ready=1){
- Coordmode,Mouse,client
- MouseGetPos,tx,ty
- Loop,% Btn.Length()
- {
- if(tx >= Btn[A_Index].x &&tx <= (Btn[A_Index].x+Btn[A_Index].W)&& ty >= Btn[A_Index].Y && ty <= Btn[A_Index].Y+Btn[A_Index].H)
- Current:=A_Index,Btn[A_Index].Button_Press()
- }
- }
- }
- Window_Hover()
- {
- if(Winactive(Window.title)&&Ready=1){
- Coordmode,Mouse,client
- MouseGetPos,tx,ty
- Loop,% Btn.Length()
- {
- if(tx >= Btn[A_Index].x &&tx <= (Btn[A_Index].x+Btn[A_Index].W)&& ty >= Btn[A_Index].Y && ty <= Btn[A_Index].Y+Btn[A_Index].H)
- Btn[A_Index].Button_Hover()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement