Here is a POC for you. Take a look at this and let me know if this is something that works for you.
2: When you first run the script you will see nothing, but if you move your mouse to the top of the screen you should see a small button fade in at the top left corner (the position can easily be changed)
.
.
3: Move your cursor away from the top of the screen and the button should fade out.
4: Move your Cursor to the top of the screen and right click the button, that will cause it to be hidden for 5 seconds ( this is in the case that it is in the way of something under it.)
5: Press the button. This will cause some hotkeys to become active and show the HUD Window
.
.
6: Press The button Again. This will turn off the hotkeys and hide the HUD Window
7: With the HUD active, wheel up or down close to one of the squares. This will cause the distance from your cursor to the center of the squares to be calculated. If the distance to the closest square is less than some amount, a line will be draw showing that a action will be triggered on that control.
.
.
Give it a go, and if it works for you I can get a more flushed out prototype made up.
.
Code: Select all
;***************************************************************************************************
#Include <LayeredWindow Class>
#Include <My Altered Gdip Lib>
;***************************************************************************************************
#SingleInstance, force
SetBatchLines, -1
CoordMode, Mouse, Screen
OnMessage(0x0200,"MouseMovement")
global Active , Reveal := 1
Trans := 0
Direction := 1
Com := 0
TriggerWindow := New LayeredWindow(x := 0 , y := 0 , w := A_ScreenWidth , h := 50 , window := "Trigger" , title := " " , smoothing := 2 , options := "+AlwaysOnTop -DPIScale +ToolWindow" , autoShow := 1 , GdipStart := 1 , WinMover := { x: 0 , y: 0 , w: w , h: 20 } , BackgroundColor := "0x0122262a")
Gui, ActivateWindow:+AlwaysOnTop -DpiScale +OwnerTrigger hwndActivateWindowHwnd -Caption
Gui, ActivateWindow:Color, 22262a
Gui, ActivateWindow:Add, Text, cWhite x0 y0 w80 h25 Border Center 0x200 gToggleHUD, Activate
Gui, ActivateWindow:Show, x0 y0 w80 h25
WinSet , Transparent , % Trans , % "ahk_id " ActivateWindowHwnd
HUDWindow := New LayeredWindow(x := 0 , y := 0 , w := A_ScreenWidth , h := A_ScreenHeight , window := 1 , title := " " , smoothing := 2 , options := "+AlwaysOnTop +OwnerTrigger +E0x20" , autoShow := 1 )
HUDWindow.Draw_Rectangle(Thickness:="2",PosObj:={x:100,y:100,w:15,h:15},Color1:=0xFF880000,Color2:="",PosObj2:="",update:=0)
HUDWindow.Draw_Rectangle(Thickness:="2",PosObj:={x:300,y:150,w:15,h:15},Color1:=0xFF880000,Color2:="",PosObj2:="",update:=0)
HUDWindow.Draw_Rectangle(Thickness:="2",PosObj:={x:500,y:150,w:15,h:15},Color1:=0xFF880000,Color2:="",PosObj2:="",update:=0)
HUDWindow.Draw_Rectangle(Thickness:="2",PosObj:={x:530,y:150,w:15,h:15},Color1:=0xFF880000,Color2:="",PosObj2:="",update:=0)
HUDWindow.Draw_Rectangle(Thickness:="2",PosObj:={x:250,y:200,w:15,h:15},Color1:=0xFF880000,Color2:="",PosObj2:="",update:=0)
Button := []
Button[1] := New HB_Vector( 108 , 108 )
Button[2] := New HB_Vector( 308 , 158 )
Button[3] := New HB_Vector( 508 , 158 )
Button[4] := New HB_Vector( 538 , 158 )
Button[5] := New HB_Vector( 258 , 208 )
Gui, 1:Hide
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
#If (HUD)
WheelUP::
WheelDown::
Distance := 1000000
MouseGetPos, tx, ty
MousePos := New HB_Vector(tx,ty)
Loop, % Button.Length(){
if( MousePos.Dist( Button[A_Index] ) < Distance )
Distance := MousePos.Dist( Button[A_Index] ) , index := A_Index
}
if(Distance < 150){
HUDWindow.Draw_Line(Thickness:="2",{x1:MousePos.X,y1:MousePos.Y,x2:Button[Index].X,y2:Button[Index].Y},Color1:="0xFF000000",Color2:="",Update:=1)
}
return
#If
ActivateWindowGuiContextMenu:
SetTimer, Reveal, -5000
Gui, ActivateWindow:Hide
Reveal := 0
return
Reveal:
Gui, ActivateWindow:Show
Reveal := 1
WinSet , Transparent , % Trans := 0 , % "ahk_id " ActivateWindowHwnd
return
Transition:
if( Direction && !Com ){
if( ( Trans += 20 ) < 255 ){
WinSet , Transparent , % Trans , % "ahk_id " ActivateWindowHwnd
}else{
WinSet , Transparent , % Trans := 255 , % "ahk_id " ActivateWindow.Hwnd
++Com
}
return
}else if( !Direction && !Com ){
if( ( Trans -= 20 ) > 0 ){
WinSet , Transparent , % Trans , % "ahk_id " ActivateWindowHwnd
}else{
WinSet , Transparent , % Trans := 0 , % "ahk_id " ActivateWindowHwnd
SetTimer, Transition, Off
Direction := 1
Active := 0
}
return
}
MouseGetPos,,my
if(my>150){
Direction := 0 , Com := 0
}
return
ToggleHUD:
if( HUD := !HUD ){
Gui, 1:Show
HUDWindow.UpdateWindow()
}else
Gui, 1:Hide
return
MouseMovement(){
if( A_Gui != "Trigger" && A_Gui != "ActivateWindow")
return
if( !Active && Reveal && Active := 1 ){
SetTimer, Transition, 60
}
}
Class HB_Vector {
__New(x:=0,y:=0){
This.X:=x
This.Y:=y
}
Add(Other_HB_Vector){
This.X+=Other_HB_Vector.X
This.Y+=Other_HB_Vector.Y
}
Sub(Other_HB_Vector){
This.X-=Other_HB_Vector.X
This.Y-=Other_HB_Vector.Y
}
mag(){
return Sqrt(This.X*This.X + This.Y*This.Y)
}
magsq(){
return This.Mag()**2
}
setMag(in1){
m:=This.Mag()
This.X := This.X * in1/m
This.Y := This.Y * in1/m
return This
}
mult(in1,in2:="",in3:="",in4:="",in5:=""){
if(IsObject(in1)&&in2=""){
This.X*=In1.X
This.Y*=In1.Y
}else if(!IsObject(In1)&&In2=""){
This.X*=In1
This.Y*=In1
}else if(!IsObject(In1)&&IsObject(In2)){
This.X*=In1*In2.X
This.Y*=In1*In2.Y
}else if(IsObject(In1)&&IsObject(In2)){
This.X*=In1.X*In2.X
This.Y*=In1.Y*In2.Y
}
}
div(in1,in2:="",in3:="",in4:="",in5:=""){
if(IsObject(in1)&&in2=""){
This.X/=In1.X
This.Y/=In1.Y
}else if(!IsObject(In1)&&In2=""){
This.X/=In1
This.Y/=In1
}else if(!IsObject(In1)&&IsObject(In2)){
This.X/=In1/In2.X
This.Y/=In1/In2.Y
}else if(IsObject(In1)&&IsObject(In2)){
This.X/=In1.X/In2.X
This.Y/=In1.Y/In2.Y
}
}
dist(in1){
return Sqrt(((This.X-In1.X)**2) + ((This.Y-In1.Y)**2))
}
dot(in1){
return (This.X*in1.X)+(This.Y*In1.Y)
}
cross(in1){
return This.X*In1.Y-This.Y*In1.X
}
Norm(){
m:=This.Mag()
This.X/=m
This.Y/=m
}
}