Re: Mapping Actions over Time
Posted: 24 Sep 2021, 17:22
Thanks for the update & explanations.
Let's help each other out
https://www.autohotkey.com/boards/
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=94963
Code: Select all
;****************************************************************************************************************************************************************************
#Include <My Altered GDIP lib> ;Gdip by Tic
#Include <PopUpWindow Class> ;https://www.autohotkey.com/boards/viewtopic.php?f=6&t=94961
;****************************************************************************************************************************************************************************
#SingleInstance, Force
SetBatchlines, -1
Gdip_Startup()
gosub, AddGui
gosub, Activate
return
*ESC::ExitApp
NumPad3::PopUpWindow.Helper()
#If ( Active )
~*LButton::
Clicks++
Return
#If
Numpad1::
Activate:
if( Active := !Active ){
clicks := 0
Gosub, Advance
SetTimer, Advance, 1000
SetTimer, DrawGui, 30
}else{
Gosub, Advance
SetTimer, Advance, Off
SetTimer, DrawGui, Off
Loop, % Gui1.BarCount
Gui1.DisplayArray[ A_Index ] := Gui1.StorageArray[ A_Index ] := ""
Gui1.ClearWindow()
Gui1.UpdateWindow()
}
return
AddGui:
w := 550 , h := 100
Gui1 := New PopUpWindow( { WindowName: "2" , WindowOptions: " -DPIScale +AlwaysOnTop +E0x20" , WindowSmoothing: 2 , X: 0 , Y: "10" , W: w , H: h } )
;~ Gui1 := New PopUpWindow( { WindowName: "2" , WindowOptions: " -DPIScale +AlwaysOnTop +E0x20" , WindowSmoothing: 2 , X: "Center" , Y: "Center" , W: w , H: h } )
Gui1.ShowWindow()
Gui1.DisplayArray := []
Gui1.YMid := h / 2
Gui1.StorageArray := []
Gui1.BarWidth := 2
Gui1.BarScale := 3 ;px per click
Gui1.BarCount := 180
Gui1.BarColor1 := "0xFFff0000" ;BAR COLOR
Gui1.BarCoror2 := "0x00000000"
Gui1.BarStyle := 2 ;2 = above and below the center
Gui1.BGRound := 10
Gui1.BGColor1 := "0xFFaaaaaa"
Gui1.BGColor2 := "0xFF112233"
Loop, % Gui1.BarCount
Gui1.DisplayArray[ A_Index ] := Gui1.StorageArray[ A_Index ] := Random(0,9)
HB_BITMAP_MAKER( obj , clicks )
Gui1.UpdateWindow()
return
Advance:
Gui1.StorageArray.Insert( 1, Clicks )
Clicks := 0
Gui1.StorageArray.Pop()
Return
DrawGui:
Loop, % Gui1.BarCount
Gui1.DisplayArray[ A_Index ] := Gui1.StorageArray[ A_Index ]
Gui1.ClearWindow()
HB_BITMAP_MAKER( Gui1 , clicks )
Gui1.UpdateWindow()
return
HB_BITMAP_MAKER( obj , clicks ){
;Bitmap Created Using: HB Bitmap Maker
Loop, % pos := Obj.BarCount
Pen := Gdip_CreatePen( Obj.BarColor1 , Obj.BarWidth ) , Gdip_DrawLine( Obj.G , Pen , ( A_Index * ( Obj.BarWidth + 1 ) ) + 3 , Obj.YMid + ( ( obj.DisplayArray[A_Index] * obj.BarScale ) + 1 ) , ( A_Index * ( Obj.BarWidth + 1 ) ) + 3 , Obj.YMid - ( ( obj.DisplayArray[A_Index] * obj.BarScale ) + 1 ) ) , Gdip_DeletePen( Pen )
;reverse order
;~ Pen := Gdip_CreatePen( Obj.BarColor1 , Obj.BarWidth ) , Gdip_DrawLine( Obj.G , Pen , ( A_Index * ( Obj.BarWidth + 1 ) ) + 3 , Obj.YMid + ( ( obj.DisplayArray[pos] * obj.BarScale ) + 1 ) , ( A_Index * ( Obj.BarWidth + 1 ) ) + 3 , Obj.YMid - ( ( obj.DisplayArray[pos--] * obj.BarScale ) + 1 ) ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0x66000000" ) , Gdip_FillRoundedRectangle( Obj.G , Brush , 0 , 0 , 80 , 20 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFFFFFF" ) , Gdip_TextToGraphics( Obj.G , "CPS: " , "s16 Bold c" Brush " x10 y0" , "Segoe ui" , 50 , 50 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFffffff" ) , Gdip_TextToGraphics( Obj.G , clicks , "s16 Bold c" Brush " x54 y-1" , "Segoe ui" , 50 , 50 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_TextToGraphics( Obj.G , clicks , "s16 Bold c" Brush " x55 y0" , "Segoe ui" , 50 , 50 ) , Gdip_DeleteBrush( Brush )
}
Random(Min, Max){
local out
Random, out, min, max
return out
}