While I was playing around with it I noticed that my test code reminded me of the old computer game Missile Command, so I turned my test code into a version of the game but used line intersections as the method of detecting hits, and that lead me to want to make an actual version of the game.
***Requires Windows 8 or higher and a copy of the GDIP.AHK lib found here on the forum.
The game still needs a second pass at cleaning up the code and I need to create most of the UI graphics and add in a few more extra features, but other than that, this is a fully working game.
I think that the current gameplay balance is pretty good, but I was doing a lot of testing (playing the game) so my skills are a bit heightened.
Let me know if you think the balance needs to be adjusted a bit.
You objective in the game is to destroy incoming missiles using your mouse and LButton. You earn points with each kill and these points can be used to by upgrades in the shop. Other than that, don't let the missiles hit the ground or you will lose health ( which you can heal by spending points in the shop ).
To run this script, simply paste this code into a new script and then edit the path to the gdip lib at the top, then just run the script.
====== VERSION: 0.2 ======
Code: Select all
;Written By: Hellbent aka CivReborn
;Date Started: Dec 2nd, 2021
;Current Version: 0.2
;Date of last Edit: Dec 5th, 2021
;System Requirements: Window 8+ ( 8 , 10 , 10000 , etc... )
;Tested on: Windows 8.1
;***************************************************************************************************
#Include, <My Altered GDIP LIB> ;GDIP.ahk
;~ #Include <PopUpWindow_V2> ;<<<<------------------- Already included at the bottom of this script
;~ #Include <Dark Layered Window Class> ;<<<<------------------- Already included at the bottom of this script
;***************************************************************************************************
#SingleInstance force
#NoEnv
CoordMode, Mouse, Client
SetBatchLines, -1
GDIP_StartUp()
Gui1 := New DarkWindow1( { X: "Center" , W: 1120 , H: 550 , Text: "AutoHotkey Missile Command" , MinWidth: 850 , MinHeight: 550 } )
Gui2 := New PopUpWindow( { X: 20 , Y: 30 , W: Gui1.W - 40 , H: Gui1.H - 50 , Options: " -DPIScale +AlwaysOnTop +Parent" Gui1.Hwnd , AutoShow: 1 } )
Gui2.PaintBackground( color := "0xFF2E2E2E" , 1 )
Gui3 := New PopUpWindow( { X: 0 , Y: 0 , W: 800 , H: 500 , Options: " -DPIScale +AlwaysOnTop +Parent" Gui2.Hwnd , AutoShow: 1 } )
Gui3.PaintBackground( { Color: "0xFF2E2E2E" , X: 1 , Y: 1 , W: Gui3.W - 2 , H: Gui3.H - 2 , Round: 10 } , 1 )
Gui5 := New PopUpWindow( { X: 0 , Y: 0 , W: 800 , H: 500 , Options: " -DPIScale +AlwaysOnTop +Parent" Gui3.Hwnd , AutoShow: 1 } )
Gui4 := New PopUpWindow( { X: 0 , Y: 0 , W: 800 , H: 500 , Options: " -DPIScale +AlwaysOnTop +Parent" Gui5.Hwnd , AutoShow: 1 } )
;~ Gui4.PaintBackground( Color := "0x22336699" , 1 )
;~ Gui4.DrawBitmap( RET() , { X: 0 , Y: 0 , W: 30 , H: 30 } , dispose := 1 , 1 )
Gui6 := New PopUpWindow( { X: 0 , Y: 0 , W: 800 , H: 500 , Options: " -DPIScale +AlwaysOnTop +Parent" Gui4.Hwnd , AutoShow: 1 } )
;~ Gui6.DrawBitmap( EnergyBar() , { X: 200 , Y: 0 , W: 200 , H: 50 } , dispose := 1 , 1 )
Gui6.DrawBitmap( EnergyBar2() , { X: 325 , Y: 10 , W: 150 , H: 16 } , dispose := 1 , 1 )
TextLayer := New PopUpWindow( { X: 0 , Y: 0 , W: 800 , H: 500 , Options: " -DPIScale +Parent" Gui6.Hwnd , AutoShow: 1 } )
Button_Layer := New PopUpWindow( { X: 0 , Y: 0 , W: 800 , H: 500 , Options: " -DPIScale +Parent" Gui3.Hwnd , AutoShow: 1 } )
;~ Button_Layer.PaintBackground( color := "0x11000000" ) ;{ Color: "0xFF000000" , X: 2 , Y: 2 , W: Button_Layer.W - 4 , H: Button_Layer.H - 4 , Round: 10 }
Button_Layer.DrawBitmap( StartButton() , cc := { X: 325 , Y: 300 , W: 150 , H: 50 } , dispose := 1 , 1 )
Gui, % Button_Layer.Hwnd ":Add", Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " +BackgroundTrans hwndhwnd gStart"
FlakLayer := New PopUpWindow( { X: 0 , Y: 0 , W: 800 , H: 500 , Options: " -DPIScale +Parent" Gui3.Hwnd , AutoShow: 1 } )
;~ FlakLayer.PaintBackground( color := "0x3300ff00" , 1) ;{ Color: "0xFF000000" , X: 2 , Y: 2 , W: FlakLayer.W - 4 , H: FlakLayer.H - 4 , Round: 10 }
ControlPanel := New PopUpWindow( { X: 820 , Y: 0 , W: 250 , H: 500 , Options: " -DPIScale +Parent" Gui2.Hwnd , AutoShow: 1 } )
ControlPanel.PaintBackground( { Color: "0xFF22262a" , X: 2 , Y: 2 , W: ControlPanel.W - 4 , H: ControlPanel.H - 4 , Round: 10 } , 1 )
ControlPanel.AddTrigger( { X: 20 , Y: 20 , W: 210 , H: 25 , Value: "" , Label: "" , BoundClass: "" , BoundMethod: "" } )
ControlPanel.DrawTriggers( color := "0xFFFF0000" , AutoUpdate := 1 )
Gui, % ControlPanel.Hwnd ":Add", Text, x20 y20 w210 h25 gAddSpeed
ControlPanel.AddTrigger( { X: 20 , Y: 50 , W: 210 , H: 25 , Value: "" , Label: "" , BoundClass: "" , BoundMethod: "" } )
ControlPanel.DrawTriggers( color := "0xFFFF0000" , AutoUpdate := 1 )
Gui, % ControlPanel.Hwnd ":Add", Text, x20 y50 w210 h25 gAddBlastRadius
ControlPanel.AddTrigger( { X: 20 , Y: 80 , W: 210 , H: 25 , Value: "" , Label: "" , BoundClass: "" , BoundMethod: "" } )
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Gui, % ControlPanel.Hwnd ":Add", Text, x20 y80 w210 h25 gAddPointsRate
ControlPanel.AddTrigger( { X: 20 , Y: 110 , W: 210 , H: 25 , Value: "" , Label: "" , BoundClass: "" , BoundMethod: "" } )
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Gui, % ControlPanel.Hwnd ":Add", Text, x20 y110 w210 h25 gAddEnergyRegen
ControlPanel.AddTrigger( { X: 20 , Y: 140 , W: 210 , H: 25 , Value: "" , Label: "" , BoundClass: "" , BoundMethod: "" } )
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Gui, % ControlPanel.Hwnd ":Add", Text, x20 y140 w210 h25 gAddFocusFire
ControlPanel.AddTrigger( { X: 20 , Y: 170 , W: 210 , H: 25 , Value: "" , Label: "" , BoundClass: "" , BoundMethod: "" } )
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Gui, % ControlPanel.Hwnd ":Add", Text, x20 y170 w210 h25 gAddHealth
global FlakSpeed := 5 , BlastRadius := 25 , Health := 10
global Score := 0
, Points := 0
, PointsRate := 10
, TopSpeed := 1.0
, EnergyCount := 99
, EnergyRate := 2
, Level := 0
, SpeedCost := [ 50 , 100 , 200 , 400 , 800 , 1600 , 3200 , 6400 , 12800 , 25600 , 51200 , 102400 , 204800 , 999999999 ]
, SpeedIndex := 1
, PointsCost := [ 10 , 25 , 50 , 100 , 150 , 200 , 250 , 300 , 350 , 400 , 450 , 500 , 550 , 600 , 650 , 700 , 750 , 800 , 850 , 900 , 950 , 1000 , 1050 , 1100 , 1150 , 1200 , 1250 , 1300 , 1350 , 1400 , 1450 , 1500 , 999999999 ]
, PointsIndex := 1
, EnergyCost := [ 100 , 200 , 400 , 800 , 1600 , 3200 , 6400 , 12800 , 25600 , 51200 , 102400 , 204800 , 999999999 ]
, EnergyIndex := 1
, RadiusCost := [ 25 , 50 , 100 , 150 , 200 , 250 , 300 , 350 , 400 , 450 , 500 , 550 , 600 , 650 , 700 , 750 , 800 , 850 , 900 , 950 , 1000 , 1050 , 1100 , 1150 , 1200 , 1250 , 1300 , 1350 , 1400 , 1450 , 1500 , 999999999 ]
, RadiusIndex := 1
, FocusCost := [ 500 , 2500 , 999999999 ]
, FocusIndex := 1
, FocusLevel := 0
, Swarm := 1
, TotalKills := 0
, HealthCost := [ 50 , 100 , 150 , 200 , 250 , 300 , 350 , 400 , 450 , 500 , 550 , 600 , 650 , 700 , 750 , 800 , 850 , 900 , 950 , 1000 , 1050 , 1100 , 1150 , 1200 , 1250 , 1300 , 1350 , 1400 , 1450 , 1500 , 999999999 ]
, HealthIndex := 1
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
IniRead, out, % A_ScriptFullPath, Details, HS
;~ ToolTip, % out
ControlPanel.DrawBitmap( HealthBar() , { X: 50 , Y: 200 , W: 100 , H: 200 } , dispose := 1 )
ControlPanel.UpdateWindow()
LvlIncrease := 3
;~ LvlIncrease := 33
MissileMax := Remaining := 0
HighScore := out
sc := Sb := 5000
;~ sc := Sb := 500
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
Numpad3::PopUpWindow.Helper()
Numpad1::Gui5.ClearWindow(1)
SoundBeep, 999
return
ResizeIt:
Gui2.UpdateSettings( { W: Gui1.W - 40 , H: Gui1.H - 50 } )
Gui1._RepositionControls()
Gui2.ShowWindow()
return
AddHealth:
if( !( Points >= HealthCost[ HealthIndex ] ) || Health > 9 )
return
Points -= HealthCost[ HealthIndex ]
HealthIndex++
Health += 1
;~ ToolTip, % FocusLevel "`n" Points
ScoreChanged := 1
;~ ToolTip, % FlakSpeed "`n" Points
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
ControlPanel.UpdateWindow()
return
AddFocusFire:
if( !( Points >= FocusCost[ FocusIndex ] ) )
return
Points -= FocusCost[ FocusIndex ]
FocusIndex++
FocusLevel += 1
;~ ToolTip, % FocusLevel "`n" Points
ScoreChanged := 1
;~ ToolTip, % FlakSpeed "`n" Points
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
ControlPanel.UpdateWindow()
return
AddSpeed:
if( !( Points >= SpeedCost[ SpeedIndex ] ) )
return
Points -= SpeedCost[ SpeedIndex ]
SpeedIndex++
FlakSpeed += 1
ScoreChanged := 1
;~ ToolTip, % FlakSpeed "`n" Points
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
ControlPanel.UpdateWindow()
return
AddBlastRadius:
if( !( Points >= RadiusCost[ RadiusIndex ] ) )
return
Points -= RadiusCost[ RadiusIndex ]
RadiusIndex++
BlastRadius += 1
;~ ToolTip, % BlastRadius
ScoreChanged := 1
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
ControlPanel.UpdateWindow()
return
AddPointsRate:
if( !( Points >= PointsCost[ PointsIndex ] ) )
return
Points -= PointsCost[ PointsIndex ]
PointsIndex++
PointsRate += 1
;~ ToolTip, % PointsRate
ScoreChanged := 1
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
ControlPanel.UpdateWindow()
return
AddEnergyRegen:
if( !( Points >= EnergyCost[ EnergyIndex ] ) )
return
Points -= EnergyCost[ EnergyIndex ]
EnergyIndex++
EnergyRate += 1
ScoreChanged := 1
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
ControlPanel.UpdateWindow()
return
Start:
if( !Health ){
FlakSpeed := 5 , BlastRadius := 25 , Health := 10
, Score := 0
, Points := 0
, PointsRate := 10
, TopSpeed := 1.0
, EnergyCount := 99
, EnergyRate := 2
, Level := 0
LvlIncrease := 3
MissileMax := Remaining := 0
sc := Sb := 3100
, SpeedCost := [ 50 , 100 , 200 , 400 , 800 , 1600 , 3200 , 6400 , 12800 , 25600 , 51200 , 102400 , 204800 , 999999999 ]
, SpeedIndex := 1
, PointsCost := [ 10 , 25 , 50 , 100 , 150 , 200 , 250 , 300 , 350 , 400 , 450 , 500 , 550 , 600 , 650 , 700 , 750 , 800 , 850 , 900 , 950 , 1000 , 1050 , 1100 , 1150 , 1200 , 1250 , 1300 , 1350 , 1400 , 1450 , 1500 , 999999999 ]
, PointsIndex := 1
, EnergyCost := [ 100 , 200 , 400 , 800 , 1600 , 3200 , 6400 , 12800 , 25600 , 51200 , 102400 , 204800 , 999999999 ]
, EnergyIndex := 1
, RadiusCost := [ 25 , 50 , 100 , 150 , 200 , 250 , 300 , 350 , 400 , 450 , 500 , 550 , 600 , 650 , 700 , 750 , 800 , 850 , 900 , 950 , 1000 , 1050 , 1100 , 1150 , 1200 , 1250 , 1300 , 1350 , 1400 , 1450 , 1500 , 999999999 ]
, RadiusIndex := 1
, FocusCost := [ 500 , 2500 , 999999999 ]
, FocusIndex := 1
, FocusLevel := 0
, Swarm := 1
, TotalKills := 0
, HealthCost := [ 50 , 100 , 150 , 200 , 250 , 300 , 350 , 400 , 450 , 500 , 550 , 600 , 650 , 700 , 750 , 800 , 850 , 900 , 950 , 1000 , 1050 , 1100 , 1150 , 1200 , 1250 , 1300 , 1350 , 1400 , 1450 , 1500 , 999999999 ]
, HealthIndex := 1
;~ ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 1 )
;~ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
;~ ControlPanel.DrawBitmap( HealthBar() , { X: 50 , Y: 200 , W: 100 , H: 200 } , dispose := 1 , 1 )
;~ ControlPanel.UpdateWindow()
}
Button_Layer.ClearWindow(1)
SoundBeep, 555
global Rets := []
FlakShots := []
MouseState := 0
HealthIndex := 1
Level++
Life := 10
lc := 0
Remaining := MissileMax += LvlIncrease
global ScoreChanged := 1
ControlPanel.DrawTriggers( color := "0xFFFFFF00" , AutoUpdate := 0 )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Speed: " FlakSpeed " $" SpeedCost[ SpeedIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y20" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "BlastRadius: " BlastRadius " $" RadiusCost[ RadiusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y50" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "PointsRate: " PointsRate " $" PointsCost[ PointsIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y80" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "EnergyRate: " EnergyRate " $" EnergyCost[ EnergyIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y110" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Focus Fire lvl: " FocusLevel " $" FocusCost[ FocusIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y140" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( ControlPanel.G , "Health: " Health " $" HealthCost[ HealthIndex ] , "s12 vCenter Bold c" Brush " x" 20 " y170" , "Segoe ui" , 210 , 25 ) , Gdip_DeleteBrush( Brush )
ControlPanel.DrawBitmap( HealthBar() , { X: 50 , Y: 200 , W: 100 , H: 200 } , dispose := 1 )
ControlPanel.UpdateWindow()
Bob := []
sc -= 100
;~ ToolTip, % sc " " topSpeed
;~ Colors := ["E8ffF29","610F34","8732A7","32FA90","9F54f9","139B5E","18DDB4","2DE3FD","2130B6","FEF311","00FF00","0aa0FF", "FF00FF" , "00FFFF" , "8833ff" , "00FF99" ]
Colors := ["1BF907","F5CA1D","04C8E0","E910B0","0FD4AF","A59CEF","D5F688","20FC33","01DFC5","DE00B6","E910B0","04C8E0","F5CA1D","E8019F","30D6E5"]
SetTimer, GameLoop, 30
LI := 0
Loop, % MissileMax {
Loop, % Swarm {
Bob.Push( New Missiles( { G: Gui3.G , Window: Gui3.Hwnd , Color: "0xFF" Colors[ Ran( 1 , Colors.Length() ) ] } ) )
if( !(--Remaining) )
break 2
( ( sc -= 10 ) > 30 ) ? ( sc ) : ( sc := 3000 , TopSpeed++ , Swarm++ )
sleep, 30
}
sleep, % sc
;~ ToolTip, % sc " " topSpeed
}
ToolTip,
return
GameLoop:
MouseGetPos, x, y
Gui4.ClearWindow()
Gui4.DrawBitmap( RET() , { X: x - 15 - 20 , Y: y - 15 - 30 , W: 30 , H: 30 } , dispose := 1 , 1 )
Gui3.PaintBackground( color := "0x212E2E2E" )
if( Bob.Length() )
Loop, % bl := Bob.Length() {
if( Bob[ bl - A_Index + 1 ].CheckTarget() ){
Bob[ bl - A_Index + 1 ].Explode()
if( !Bob[ bl - A_Index + 1 ].Ghost ){
Health--
Bob.RemoveAt( bl - A_Index + 1 )
ScoreChanged := 1
}else{
Bob[ bl - A_Index + 1 ] := New Missiles( { G: Gui3.G , Window: Gui3.Hwnd , Color: "0xFF" Colors[ Ran( 1 , Colors.Length() ) ] } )
}
}else{
Bob[ bl - A_Index + 1 ]._Draw()
Bob[ bl - A_Index + 1 ]._Update()
}
}
if( energyCount >= 100 && !MouseState && GetKeyState("LButton") && WinActive( "A" ) = Gui1.Hwnd && x >= 20 && x <= 820 ){
MouseState := 1
Gui5.DrawBitmap( PerRET() , { X: x - 15 - 20 , Y: y - 15 - 30 , W: 30 , H: 30 } , dispose := 1 , 1 )
energyCount := 0
Rets.Push( New HB_Vector( x - 15 - 20 , y - 15 - 30 ) )
lc := 0
FlakShots.Push( New Flak( x - 20 , y - 30 , FlakLayer.G ) )
;~ mouseVector := New HB_Vector( x - 20 , y - 30 )
;~ if( Bob.Length() )
;~ bl := Bob.Length()
;~ Loop, % bl {
;~ if( mouseVector.Dist( Bob[ Bob.Length() - A_Index + 1 ].Front ) < 1300 ){
;~ Bob[ bl - A_Index + 1 ].Explode()
;~ If( Bob[ bl - A_Index + 1 ].Ghost )
;~ ToolTip, You Caught a GHOST!
;~ Bob.RemoveAt( bl - A_Index + 1 )
;~ Points += PointsRate
;~ Score += PointsRate
;~ ScoreChanged := 1
;~ Rets.Pop()
;~ }
;~ }
}else if( MouseState && !GetKeyState("LButton") )
MouseState := 0
if( energyCount < 100 ){
energyCount += EnergyRate
( energyCount > 100 ) ? ( energyCount := 100 )
Gui4.ClearWindow()
Gui6.DrawBitmap( EnergyBar2( energyCount , EnergyRate ) , { X: 325 , Y: 10 , W: 150 , H: 16 } , dispose := 1 , 1 )
}
if( ++lc > 10 && !lc := 0 ){
Gui5.ClearWindow()
Rets.RemoveAt( 1 )
Loop, % Rets.Length() {
Gui5.DrawBitmap( PerRET() , { X: Rets[ A_Index ].X , Y: Rets[ A_Index ].Y , W: 30 , H: 30 } , dispose := 1 )
}
Gui5.UpdateWindow()
}
Gui3.UpdateWindow()
if( FlakShots.Length() ){
FlakLayer.ClearWindow()
;~ FlakLayer.PaintBackground( color := "0x3300ff00" , 1)
iT := tI := FlakShots.Length()
Loop, % tI {
if( FlakShots[ TI - A_Index + 1 ].Update( bob ) ){
FlakShots.RemoveAt( TI - A_Index + 1 )
iT--
}
;~ ToolTip, % "here " Flak[ A_Index ].Position.X
}
if( iT != tI )
FlakLayer.ClearWindow()
FlakLayer.UpdateWindow()
}
;~ ToolTip, % Remaining + Bob.Length()
if( ScoreChanged && !ScoreChanged := 0 || ( !( Remaining + Bob.Length() ) || !Health ) ){
;~ SoundBeep, 555
TextLayer.ClearWindow()
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "Score: " Score , "s12 vCenter Bold c" Brush " x" 10 " y21" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00FF00" ) , Gdip_TextToGraphics( TextLayer.G , "Score: " Score , "s12 vCenter Bold c" Brush " x" 11 " y22" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "Points: " Points , "s12 vCenter Bold c" Brush " x" 10 " y41" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFFFF00" ) , Gdip_TextToGraphics( TextLayer.G , "Points: " Points , "s12 vCenter Bold c" Brush " x" 11 " y42" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "Health: " Health , "s12 vCenter Bold c" Brush " x" 10 " y61" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFF0000" ) , Gdip_TextToGraphics( TextLayer.G , "Health: " Health , "s12 vCenter Bold c" Brush " x" 11 " y62" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "High Score: " HighScore , "s12 vCenter Bold c" Brush " x" 650 " y1" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFffFF00" ) , Gdip_TextToGraphics( TextLayer.G , "High Score: " HighScore , "s12 vCenter Bold c" Brush " x" 651 " y2" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "Missiles Remaining: " Remaining + Bob.Length() , "s12 vCenter Bold c" Brush " x" 650 " y21" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_TextToGraphics( TextLayer.G , "Missiles Remaining: " Remaining + Bob.Length() , "s12 vCenter Bold c" Brush " x" 651 " y22" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "Total Kills: " TotalKills , "s12 vCenter Bold c" Brush " x" 650 " y41" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_TextToGraphics( TextLayer.G , "Total Kills: " TotalKills , "s12 vCenter Bold c" Brush " x" 651 " y42" , "Segoe ui" , 150 , 20 ) , Gdip_DeleteBrush( Brush )
TextLayer.UpdateWindow()
}
if( !( Remaining + Bob.Length() ) || !Health ){
;~ SoundBeep, 666
;~ Sleep, 5000
;~ Gui3.ClearWindow( 1 )
Gui3.PaintBackground( color := "0xFF2E2E2E" , 1 ) ;{ Color: "0xFF000000" , X: 2 , Y: 2 , W: Gui1.W - 4 , H: Gui1.H - 4 , Round: 10 }
Gui5.ClearWindow( 1 )
Gui4.ClearWindow( 1 )
Gui6.DrawBitmap( EnergyBar2( energyCount := 100 , EnergyRate ) , { X: 325 , Y: 10 , W: 150 , H: 16 } , dispose := 1 , 1 )
;~ Gui6.PaintBackground( color := "0xFF000000" , 1 ) ;{ Color: "0xFF000000" , X: 2 , Y: 2 , W: Gui1.W - 4 , H: Gui1.H - 4 , Round: 10 }
;~ Gui6.ClearWindow( 1 )
FlakLayer.ClearWindow(1)
TextLayer.ClearWindow()
if( Health ){
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "Level`n" Level "`nComplete" , "s52 Center Bold c" Brush " x" 0 " y50" , "Comic sans Ms" , 800 , 200 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_TextToGraphics( TextLayer.G , "Level`n" Level "`nComplete" , "s52 Center Bold c" Brush " x" 2 " y52" , "Comic sans Ms" , 800 , 200 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , """It's Getting Harder""" , "s22 Center Bold c" Brush " x" 0 " y370" , "Comic sans Ms" , 800 , 100 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFFFF00" ) , Gdip_TextToGraphics( TextLayer.G , """It's Getting Harder""" , "s22 Center Bold c" Brush " x" 1 " y371" , "Comic sans Ms" , 800 , 100 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "-XI" , "s14 Center Bold c" Brush " x" 0 " y430" , "Comic sans Ms" , 1000 , 100 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF3399ff" ) , Gdip_TextToGraphics( TextLayer.G , "-XI" , "s14 Center Bold c" Brush " x" 1 " y431" , "Comic sans Ms" , 1000 , 100 ) , Gdip_DeleteBrush( Brush )
}else{
if( Score > HighScore ){
IniWrite, % Score, % A_ScriptFullPath, Details, HS
HighScore := Score
}
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "GAME`nOVER" , "s52 Center Bold c" Brush " x" 0 " y50" , "Comic sans Ms" , 800 , 200 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_TextToGraphics( TextLayer.G , "GAME`nOVER" , "s52 Center Bold c" Brush " x" 2 " y52" , "Comic sans Ms" , 800 , 200 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( TextLayer.G , "Score: " Score "`nLevel: " Level , "s22 Center Bold c" Brush " x" 0 " y370" , "Comic sans Ms" , 800 , 100 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFFFF00" ) , Gdip_TextToGraphics( TextLayer.G , "Score: " Score "`nLevel: " Level , "s22 Center Bold c" Brush " x" 1 " y371" , "Comic sans Ms" , 800 , 100 ) , Gdip_DeleteBrush( Brush )
}
TextLayer.UpdateWindow()
Button_Layer.DrawBitmap( StartButton() , cc := { X: cc.x , Y: cc.y , W: cc.w , H: cc.h } , dispose := 1 , 1 )
SetTimer, GameLoop, Off
;~ SetTimer, Start, -5000
return
}
;~ SetTimer, GameLoop, -30
return
Ran( Min , Max ){
Random, Out, Min, Max
return out
}
class Windows {
__New( obj ){
This.SetDefaults()
}
}
class Flak {
static Brush := [] , FT , index := 0
__New( x , y , G ){
if( !Flak.FT && Flak.FT := 1 ){
Flak.Brush[ 1 ] := Gdip_BrushCreateSolid( "0x66FF0000" )
Flak.Brush[ 2 ] := Gdip_BrushCreateSolid( "0x66FF0000" )
Flak.Brush[ 3 ] := Gdip_BrushCreateSolid( "0xFF00FF99" )
Flak.Brush[ 4 ] := Gdip_BrushCreateSolid( "0x660066FF" )
Flak.Brush[ 5 ] := Gdip_BrushCreateSolid( "0x66FF0000" )
Flak.Brush[ 6 ] := Gdip_BrushCreateSolid( "0xFF00FF99" )
}
This._SetDefaults( x , y , G )
;~ ToolTip, % "here " Flak[ A_Index ].Position.X
}
_SetDefaults( x , y , G ){
static positions := [ 20 , 200 , 400 , 600 , 780 ]
This.Color := "0xFF00FF99"
if( !FocusLevel ){
This.Position := New HB_Vector( ( ( ++Flak.Index > positions.Length() ) ) ? ( Positions[ Flak.Index := 1 ] ) : ( Positions[ Flak.Index ] ) , 500 )
}else if( FocusLevel = 1 ){
if( x < 400 ){
This.Position := New HB_Vector( Positions[ This.Rand( 1 , 3 ) ] , 500 )
}else{
This.Position := New HB_Vector( Positions[ This.Rand( 3 , 5 ) ] , 500 )
}
}else if( FocusLevel = 2 ){
( x < 150 ) ? ( tOut := 1 ) : ( ( x < 300 ) ? ( tOut := 2 ) : ( ( x < 450 ) ? ( tOut := 3 ) : ( ( x < 600 ) ? ( tOut := 4 ) : ( tOut := 5 ) ) ) )
This.Position := New HB_Vector( Positions[ tOut ] , 500 )
}
;~ ToolTip, % Flak.Index
This.Target := New HB_Vector( x , y )
This.Explode := 0
;~ This.ExplodeLoopLength := 10
This.ExplodeLoopLength := 3
This.ExplodeLoopIndex := 0
This.ExplodeRadius := 5
This.ExplodeRadiusIncrease := BlastRadius
;~ This.Speed := 20
;~ This.Speed := 10
This.Speed := FlakSpeed
This.Vector := New HB_Vector( x , y )
This.Vector.Sub( This.Position )
This.Vector.SetMag( This.Speed )
This.ReverseVector := New HB_Vector( x , y )
This.ReverseVector.Sub( This.Position )
tt := This.Speed / 6
This.ReverseVector.SetMag( ( tt < 3 ) ? ( 3 ) : ( tt ) )
This.LastPosition := New HB_Vector( This.Position.X , This.Position.Y )
This.Radius := 2
This.LifeCount := Ceil( This.Position.Dist( This.Target ) / This.Speed )
This.AttackRange := ( ( This.ExplodeLoopLength - 1 ) * This.ExplodeRadiusIncrease )
This.G := G
}
Update( targets ){
;~ ToolTip, % "Here " This.Position.X
if( !This.Explode ){
This.Position.Add( This.Vector )
}
if( !This.Explode && --This.LifeCount <= 0 ){
This.Explode := 1
This.Position.X := This.Target.X
This.Position.Y := This.Target.Y
This.CheckTargets( targets )
}
If( !This.Explode )
return This.Draw()
else
return This.DrawExplode()
}
Draw(){
;~ This.LastPosition
;~ Loop, % This.Speed / 6 + 1 {
Loop, % ( tt < 3 ) ? ( 3 ) : ( tt ) {
Gdip_FillEllipse( This.G , Flak.Brush[ ( A_Index > 6 ) ? ( 6 ) : ( A_Index ) ] , This.LastPosition.X - This.Radius , This.LastPosition.Y - This.Radius , This.Radius * 2 + 1 , This.Radius * 2 + 1 )
This.LastPosition.Add( This.ReverseVector )
}
;~ Gdip_FillEllipse( This.G , Flak.Brush1 , This.Position.X - This.Radius , This.Position.Y - This.Radius , This.Radius * 2 + 1 , This.Radius * 2 + 1 )
This.LastPosition := New HB_Vector( This.Position.X , This.Position.Y )
}
DrawExplode(){
Gdip_FillEllipse( This.G , Flak.Brush[ 1 ] , This.Position.X - This.ExplodeRadius , This.Position.Y - This.ExplodeRadius , This.ExplodeRadius * 2 + 1 , This.ExplodeRadius * 2 + 1 )
This.ExplodeRadius += This.ExplodeRadiusIncrease
if( ++This.ExplodeLoopIndex = This.ExplodeLoopLength )
return 1
}
CheckWalls(){
}
CheckTargets( targets ){
bl := targets.Length()
Loop, % bl {
if( This.Target.Dist( targets[ bl - A_Index + 1 ].Front ) < This.AttackRange ){
targets[ bl - A_Index + 1 ].Explode()
If( Bob[ bl - A_Index + 1 ].Ghost ){
ToolTip, You Caught a GHOST!
}
targets.RemoveAt( bl - A_Index + 1 )
Points += PointsRate
Score += PointsRate
TotalKills++
ScoreChanged := 1
Rets.Pop()
}
}
;~ mouseVector := New HB_Vector( x - 20 , y - 30 )
;~ if( Bob.Length() )
;~ bl := Bob.Length()
;~ Loop, % bl {
;~ if( mouseVector.Dist( Bob[ Bob.Length() - A_Index + 1 ].Front ) < 1300 ){
;~ Bob[ bl - A_Index + 1 ].Explode()
;~ If( Bob[ bl - A_Index + 1 ].Ghost )
;~ ToolTip, You Caught a GHOST!
;~ Bob.RemoveAt( bl - A_Index + 1 )
;~ Points += PointsRate
;~ Score += PointsRate
;~ ScoreChanged := 1
;~ Rets.Pop()
;~ }
;~ }
}
Rand( min , max ){
random, output, min, max
return output
}
}
class Missiles {
static Pens := {} , Brushes := {}
__New( obj ){
This._SetDefaults()
This._UpdateDefaults( obj )
}
_SetDefaults(){
static index := 0 , odds := Ran( 2 , 7 ) , tog
This.IsAlive := 1
;~ This.Speed := Ran( 0.1 , 5.0 )
;~ This.Speed := Ran( 1.00 , 2.00 )
This.Speed := Ran( 1.00 , TopSpeed + 0.00 )
;~ ToolTip, % This.Speed
This.Color := "0xFFFF0000"
This.Front := New HB_Vector( Ran( 10 , 790 ) , 0 )
This.LastFront := New HB_Vector( This.Front.X , This.Front.Y )
This.Target := New HB_Vector( Ran( 10 , 790 ) , 500 )
This.Vector := New HB_Vector( This.Target.X , This.Target.Y )
This.Vector.Sub( This.Front )
;~ This.Vector.SetMag( This.Speed )
;~ This.Vector.SetMag( ( tog := !tog ) ? ( 1 ) : ( 0.5 ) )
;~ This.Vector.SetMag( 0.5 )
;~ ToolTip, % This.Speed
( ++index != odds ) ? ( This.Vector.SetMag( This.Speed ) ) : ( This.Vector.Mult( 0.2 ) , Index := 0 , This.Ghost := 1 , odds := ran( 2 , 7 ) )
;~ ToolTip, % This.Vector.Mag()
This.AltColor := "0x66FFff00"
;~ This.AltColor := ( tog := !tog ) ? ( "0x6600ffff" ) : ( "0x66FFFF00" )
This.Life := 0
}
_UpdateDefaults( obj ){
for k, v in obj
This[ k ] := v
if( Missiles.Brushes[ This.Color ] = "" ){
Missiles.Brushes[ This.Color ] := Gdip_BrushCreateSolid( This.Color )
}
if( Missiles.Brushes[ This.AltColor ] = "" ){
Missiles.Brushes[ This.AltColor ] := Gdip_BrushCreateSolid( This.AltColor )
}
}
CheckTarget(){
if( This.Front.Y > This.Target.Y )
return 1
return 0
}
_Update(){
This.LastFront.X := This.Front.X , This.LastFront.Y := This.Front.Y
This.Front.Add( This.Vector )
}
_Draw(){
static tog
tempVector := New HB_Vector( This.Vector.X , This.Vector.Y )
lc := tempVector.Mag()
tempVector.Norm()
TempFront := New HB_Vector( This.Front.X , This.Front.Y )
;~ Loop, % lc {
Loop, % Ceil( lc ) {
Gdip_FillEllipse( This.G , ( Tog := !Tog ) ? ( Missiles.Brushes[ This.Color ] ) : ( Missiles.Brushes[ This.AltColor ] ) , TempFront.X - 1 , TempFront.Y - 1 , 3 , 3 )
;~ Gdip_FillEllipse( This.G , ( Tog := !Tog ) ? ( Missiles.Brushes[ This.Color ] ) : ( Missiles.Brushes[ This.AltColor ] ) , floor(TempFront.X - 1) * -1 , floor(TempFront.Y - 1) *-1, 3 , 3 )
;~ Gdip_FillEllipse( This.G , ( Tog := !Tog ) ? ( Missiles.Brushes[ This.Color ] ) : ( Missiles.Brushes[ This.AltColor ] ) , TempFront.X - A_Index , TempFront.Y - A_Index , A_Index * 2 + 1 , A_Index * 2 + 1 )
;~ Gdip_DrawLine( This.G , Main.Pen3 , This.Front.X , This.Front.Y , This.Back.X , This.Back.Y )
TempFront.Add( tempVector )
}
;~ ToolTip, % floor(TempFront.X - 1) "`n" floor(TempFront.Y - 1)
}
Explode(){
static tog
Gdip_FillEllipse( This.G , ( Tog := !Tog ) ? ( Missiles.Brushes[ This.Color ] ) : ( Missiles.Brushes[ This.AltColor ] ) , This.Front.X - 20 , This.Front.Y - 20 , 41 , 41 )
}
}
/*
[Details]
HS=21328
*/
StartButton(){
;Bitmap Created Using: HB Bitmap Maker
pBitmap := Gdip_CreateBitmap( 150 , 50 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_CreateLineBrushFromRect( 3 , 3 , 137 , 40 , "0xFF3399FF" , "0xFF000000" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 2 , 2 , 140 , 40 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 3 , 3 , 137 , 40 , "0xFF3399FF" , "0xFF0066cc" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 4 , 4 , 136 , 36 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 3 , 3 , 137 , 40 , "0x66F0F0F0" , "0x660066cc" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 4 , 4 , 136 , 36 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0x44F0F0F0" , "0x11000000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 12 , 6 , 120 , 20 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Start" , "s22 Center vCenter Bold c" Brush " x4 y7" , "Comic Sans MS" , 136 , 36 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Start" , "s22 Center vCenter Bold c" Brush " x6 y3" , "Comic Sans MS" , 136 , 36 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Start" , "s22 Center vCenter Bold c" Brush " x4 y4" , "Comic Sans MS" , 136 , 36 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "Start" , "s22 Center vCenter Bold c" Brush " x6 y7" , "Comic Sans MS" , 136 , 36 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ffff" ) , Gdip_TextToGraphics( G , "Start" , "s22 Center vCenter Bold c" Brush " x5 y5" , "Comic Sans MS" , 136 , 36 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 39 , 14 , 60 , 17 , "0xaaF0F0F0" , "0x33000000" , 1 , 1 ) , Gdip_TextToGraphics( G , "Start" , "s22 Center vCenter Bold c" Brush " x5 y5" , "Comic Sans MS" , 136 , 36 ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
return pBitmap
}
EnergyBar(){
;Bitmap Created Using: HB Bitmap Maker
pBitmap := Gdip_CreateBitmap( 200 , 50 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( "0xFF2E2E2E" ) , Gdip_FillRoundedRectangle( G , Brush , 7 , 7 , 186 , 36 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 11 , 11 , 192 , 39 , "0xFFff0000" , "0x00000000" , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 10 , 30 , 180 , 10 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 61 , 12 , 188 , 38 , "0xFFffFF00" , "0x00000000" , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 60 , 30 , 130 , 10 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 124 , 10 , 188 , 40 , "0xFF00FF00" , "0x00000000" , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 120 , 30 , 74 , 10 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 6 , 6 , 188 , 42 , "0xFF3399FF" , "0xFF333333" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 6 , 6 , 187 , 38 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 20 , 31 , 11 , 12 , "0xFFF0F0F0" , "0xFF000000" , 1 , 1 ) , Gdip_FillEllipse( G , Brush , 20 , 30 , 10 , 10 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF3399FF" ) , Gdip_FillEllipse( G , Brush , 21 , 31 , 8 , 8 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" ) , Gdip_FillRectangle( G , Brush , 10 , 11 , 178 , 16 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF444444" ) , Gdip_FillRectangle( G , Brush , 11 , 12 , 176 , 14 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrush( 13 , 14 , 185 , 26 , "0x33ffff00" , "0xFFffff00" , 1 ) , Gdip_FillRectangle( G , Brush , 13 , 14 , 70 , 10 ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
return pBitmap
}
EnergyBar2( energyCount := 0 , energyRate := 1 ){
;Bitmap Created Using: HB Bitmap Maker
pBitmap := Gdip_CreateBitmap( 150 , 16 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
;~ Brush := Gdip_CreateLineBrushFromRect( -1 , 0 , 148 , 24 , "0xFF252525" , "0xFF2D2D2D" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 1 , 1 , 146 , 12 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( -1 , 0 , 148 , 24 , "0xFF252525" , "0x66ff0000" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 1 , 1 , 146 , 12 ) , Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_CreateLineBrush( 0 , 0 , 147 , 24 , ( energyCount > 33 ) ? ( ( energyCount < 100 ) ? ( "0x99FFFF00" ) : ( "0x9900FF00" ) ) : ( "0x66FF0000" ) , ( energyCount > 66 ) ? ( "0xFF00FF00" ) : ( ( energyCount > 66 ) ? ( "0xFFFFFF00" ) : ( "0xFFFF0000" ) ) , 1 )
Brush := Gdip_CreateLineBrush( 0 , 0 , 147 , 24 , "0x6600FF00" , "0xFF00FF00" , 1 )
;~ , Gdip_FillRectangle( G , Brush , 2 , 2 , 25 , 10 ) , Gdip_DeleteBrush( Brush )
, Gdip_FillRectangle( G , Brush , 2 , 2 , ( ( t := ( ( 143 / 100 ) * energyCount - 2 ) ) > 143 ) ? ( 143 ) : ( t ) , 10 ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
return pBitmap
}
PerRet(){
;Bitmap Created Using: HB Bitmap Maker
;~ color := "0xFF3399FF"
color := "0xAAFF0000"
pBitmap := Gdip_CreateBitmap( 30 , 30 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , 13 , 5 , 3 , 9 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , 13 , 15 , 3 , 9 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , 4 , 13 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , 16 , 13 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
return pBitmap
}
RET(){
;Bitmap Created Using: HB Bitmap Maker
;~ color := "0xFF3399FF"
color := "0xFF00FF99"
pBitmap := Gdip_CreateBitmap( 30 , 30 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
Brush := Gdip_CreateLineBrush( 1 , 18 , 7 , 24 , color , "0xFF000000" , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 3 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawEllipse( G , Pen , 2 , 2 , 25 , 25 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , 13 , 5 , 3 , 9 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , 13 , 15 , 3 , 9 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , 4 , 13 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( color ) , Gdip_FillEllipse( G , Brush , 16 , 13 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
return pBitmap
}
HealthBar(){
;Bitmap Created Using: HB Bitmap Maker
pBitmap := Gdip_CreateBitmap( 100 , 200 ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
;~ Brush := Gdip_BrushCreateSolid( "0xFF2E2E2E" ) , Gdip_FillRectangle( G , Brush , -10 , -2 , 120 , 250 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 2 , 2 , 51 , 179 , "0xFF42464a" , "0xFF02060a" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 3 , 3 , 50 , 180 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 2 , 2 , 51 , 179 , "0xFF00ff99" , "0xFF02060a" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 4 , 4 , 48 , 178 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF2E2E2E" ) , Gdip_FillRoundedRectangle( G , Brush , 6 , 6 , 44 , 174 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFff0000" ) , Gdip_TextToGraphics( G , "Y" , "s26 Center vCenter Bold c" Brush " x5 y-4" , "webdings" , 50 , 50 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 9 , 30 , 35 , 101 , "0xFF333333" , "0xFF000000" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 10 , 32 , 35 , 103 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , 100 , 100 , "0xFF00ff99" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRectangle( G , Pen , 10 , 32 , 35 , 103 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFFFF0000" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 34 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFF0000" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 44 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 54 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 64 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 74 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 84 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 94 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 104 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 114 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF00ff00" ) , Gdip_FillRoundedRectangle( G , Brush , 12 , 124 , 31 , 9 , 3 ) , Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_CreateLineBrushFromRect( 10 , 138 , 34 , 21 , "0xFF009966" , "0xFFF0F0F0" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 10 , 139 , 35 , 20 ) , Gdip_DeleteBrush( Brush )
;~ Brush := Gdip_CreateLineBrushFromRect( 9 , 140 , 36 , 19 , "0xFF00ff99" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRectangle( G , Pen , 10 , 139 , 35 , 20 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 12 , 139 , 31 , 18 , "0xFF00ff99" , "0xFF030D0E" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 11 , 140 , 33 , 18 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 12 , 142 , 31 , 15 , "0xFFF0F0F0" , "0xFF00ff99" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( G , Pen , 11 , 140 , 33 , 18 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "+" , "s18 Center vCenter Bold c" Brush " x4 y125" , "Comic Sans MS" , 50 , 50 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFFFF00" ) , Gdip_TextToGraphics( G , "+" , "s18 Center vCenter Bold c" Brush " x3 y124" , "Comic Sans MS" , 50 , 50 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 9 , 160 , 33 , 19 , "0xFF000000" , "0xFF00ff99" , 1 , 1 ) , Gdip_FillRoundedRectangle( G , Brush , 8 , 161 , 40 , 15 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_TextToGraphics( G , "$1600" , "s10 Center vCenter Bold c" Brush " x4 y147" , "Comic Sans MS" , 50 , 50 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFFFFF00" ) , Gdip_TextToGraphics( G , "$1600" , "s10 Center vCenter Bold c" Brush " x3 y146" , "Comic Sans MS" , 50 , 50 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 41 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 51 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 61 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 71 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 81 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 91 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 101 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 111 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 121 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99000000" ) , Gdip_FillRectangle( G , Brush , 14 , 131 , 28 , 1 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 125 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 115 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 105 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 95 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 85 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 75 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 65 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 55 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 45 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0x99FFFFFF" ) , Gdip_FillRectangle( G , Brush , 14 , 35 , 28 , 2 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( -1 , 10 , 10 , 154 , "0xFF00ff99" , "0xFF3e3e3e" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 7 , 13 , 1 , 150 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( -1 , 10 , 10 , 154 , "0xFF00ff99" , "0xFF3e3e3e" , 1 , 1 ) , Gdip_FillRectangle( G , Brush , 48 , 13 , 1 , 150 ) , Gdip_DeleteBrush( Brush )
Gdip_DeleteGraphics( G )
return pBitmap
}
;****************************************************************
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
}
}
;**************************************************************************************************************************************************************************************************
;**************************************************************************************************************************************************************************************************
class DarkWindow1 {
;Written By: Hellbent
;Date: June 10th, 2021
static Index := 0 , Handles := [] , Windows := [] , pToken , FT , Methods := ["_CreateGUI","_AddControls","_RepositionControls","_CreateBitmap","_DrawGraphics","_UpdateWindow","ShowWindow"]
__New( obj := "" ){
if( !DarkWindow1.pToken )
DarkWindow1.pToken := GDIP_StartUp()
DarkWindow1.Index++
This._SetDefaults()
This.UpdateDefaults( obj )
Loop, % DarkWindow1.Methods.Length()
This[ DarkWindow1.Methods[ A_Index ] ]()
This._MoveWindow()
DarkWindow1.Handles[ This.Hwnd ] := DarkWindow1.Index
DarkWindow1.Windows[ DarkWindow1.Index ] := This
}
_SetDefaults(){
This.X := "Center"
This.Y := "Center"
This.W := 185
This.H := 192
This.MinWidth := 185
This.MinHeight := 192
This.WindowOptions := " +AlwaysOnTop -DPIScale "
This.MainColor := ""
This.TitleBarColor := ""
This.TextColor :=
This.Text := "Window"
This.Handles := []
This.Controls := []
This.Controls[1] := { Name: "CloseButton" , X: 11 , Y: 10 , W: 15 , H: 15 , Hwnd: "" , Method: "_CloseWindow" }
This.Controls[2] := { Name: "TitleBar" , X: 26 , Y: 0 , W: This.W - 36 , H: 27 , Hwnd: "" , Method: "_MoveWindow" }
This.Controls[3] := { Name: "ReSize" , X: This.W - 24 , Y: This.H - 24 , W: 15 , H: 15 , Hwnd: "" , Method: "_ResizeWindow" }
This.Hwnd := ""
This.hbm := ""
This.hdc := ""
This.obm := ""
This.G := ""
This.WindowSmoothing := 2
}
UpdateDefaults( obj := "" ){
for k, v in obj
This[ k ] := v
( This.X = "Center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 )
( This.Y = "Center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 )
if( !DarkWindow1.FT && DarkWindow1.FT := 1 )
return
This._DeleteBitmap()
This._CreateBitmap()
}
_DeleteBitmap(){
SelectObject( This.hdc , This.obm )
DeleteObject( This.hbm )
DeleteDC( This.hdc )
}
_CreateBitmap(){
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.WindowSmoothing )
}
_AddControls(){
local hwnd , bd
Loop, % This.Controls.Length() {
Gui, % This.Hwnd ":Add" , Text, % "x" This.Controls[ A_Index ].X " y" This.Controls[ A_Index ].Y " w" This.Controls[ A_Index ].W " h" This.Controls[ A_Index ].H " hwndhwnd"
This.Handles[ hwnd ] := A_Index
This.Controls[ A_Index ].Hwnd := hwnd
bd := This[ This.Controls[ A_Index ].Method ].Bind( This )
GuiControl, % This.Hwnd ":+G" , % hwnd , % bd
}
}
_CreateGUI(){
local hwnd
Gui, New, % " +E0x80000 hwndhwnd -Caption " This.WindowOptions
This.Hwnd := hwnd
}
_CloseWindow(){
This.DeleteWindow()
ExitApp
}
_MoveWindow(){
PostMessage, 0xA1, 2
While(GetKeyState("LButton"))
sleep, 30
WinGetPos, x, y,,, % "ahk_id " This.Hwnd
This.UpdateDefaults( { X: x , Y: y } )
;~ if(y < 1){
;~ ToolTip, here
;~ This.UpdateDefaults( { X: -12 , Y: -12 ,W: A_ScreenWidth + 24 , H: A_ScreenHeight - 70 } )
;~ This.ClearWindow()
;~ This._DrawGraphics()
;~ This._UpdateWindow()
;~ This._RepositionControls()
;~ }
}
_ResizeWindow(){
static lx
local x , y
CoordMode, Mouse, Screen
While(GetKeyState( "LButton" ) ){
MouseGetPos, x , y
if( lx != x ){
lx := x
This._GCycle( x , y )
gosub, ResizeIt
}
sleep, 30
}
This._RepositionControls()
gosub, ResizeIt
}
_RepositionControls(){
GuiControl, % This.Hwnd ":Move" , % This.Controls[ 2 ].Hwnd , % "w" This.W - 26 - 10
GuiControl, % This.Hwnd ":Move" , % This.Controls[ 3 ].Hwnd , % "x" This.W - 24 " y" This.H - 24
}
_GCycle( x , y ){
This.W := x - This.X + 5
This.H := y - This.Y + 5
if( This.W < This.MinWidth )
This.W := This.MinWidth
if( This.H < This.MinHeight )
This.H := This.MinHeight
This.UpdateDefaults()
This.ClearWindow()
This._DrawGraphics()
This._UpdateWindow()
}
ClearWindow(){
Gdip_GraphicsClear( This.G )
}
ShowWindow(){
Gui, % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H
}
_UpdateWindow(){
UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H )
}
_DrawGraphics(){
Brush := Gdip_CreateLineBrushFromRect( 0 , 0 , This.W , This.H , "0x01000000" , "0x66000000" , 1 , 1 ) , Gdip_FillRoundedRectangle( This.G , Brush , 13 , 1 , This.W - 15 , This.H - 4 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 6 , 6 , This.W - 12 , This.H - 12 , "0xff808080" , "0xFF474747" , 1 , 1 ) , Gdip_FillRoundedRectangle( This.G , Brush , 6 , 6 , This.W - 12 , This.H - 12 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_CreateLineBrushFromRect( 6 , 6 , This.W - 12 , This.H - 12 , "0xFF171717" , "0xFF000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( This.G , Pen , 6 , 6 , This.W - 12 , This.H - 12 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xff252525" ) , Gdip_FillRoundedRectangle( This.G , Brush , 8 , 8 , This.W - 16 , This.H - 16 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xff2E2E2E" ) , Gdip_FillRoundedRectangle( This.G , Brush , 8 , 28 , This.W - 16 , This.H - 36 , 5 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF2E2E2E" ) , Gdip_FillRectangle( This.G , Brush , 8 , 28 , This.W - 16 , This.H - 142 ) , Gdip_DeleteBrush( Brush )
Pen := Gdip_CreatePen( "0xFF383838" , 1 ) , Gdip_DrawLine( This.G , Pen , 9 , 28 , This.W - 9 , 28 ) , Gdip_DeletePen( Pen )
Brush := Gdip_CreateLineBrushFromRect( 5 , 10 , This.W - 12 , This.H - 22 , "0x66171717" , "0x66000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawRoundedRectangle( This.G , Pen , 8 , 8 , This.W - 16 , This.H - 16 , 5 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFFB6B6B6" ) , Gdip_FillEllipse( This.G , Brush , 11 , 10 , 15 , 15 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFF323232" ) , Gdip_TextToGraphics( This.G , "r" , "s11 Center vCenter Bold c" Brush " x11 y12" , "Webdings" , 15 , 15 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFB3B3B3" ) , Gdip_TextToGraphics( This.G , This.Text , "s12 Center vCenter Bold c" Brush " x0 y8" , "Verdana" , This.W , 25 ) , Gdip_DeleteBrush( Brush )
Brush := Gdip_BrushCreateSolid( "0xFFacacac" ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawLine( This.G , Pen , This.W - 24 , This.H - 12 , This.W - 12 , This.H - 24 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFFacacac" ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawLine( This.G , Pen , This.W - 20 , This.H - 12 , This.W - 12 , This.H - 20 ) , Gdip_DeletePen( Pen )
Brush := Gdip_BrushCreateSolid( "0xFFacacac" ) , Pen := Gdip_CreatePenFromBrush( Brush , 1 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawLine( This.G , Pen , This.W - 16 , This.H - 12 , This.W - 12 , This.H - 16 ) , Gdip_DeletePen( Pen )
}
DeleteWindow(){
Gui, % This.Hwnd ":Destroy"
SelectObject( This.hdc , This.obm )
DeleteObject( This.hbm )
DeleteDC( This.hdc )
Gdip_DeleteGraphics( This.G )
;~ GDIP_ShutDown( DarkWindow1.pToken )
hwnd := This.Hwnd
for k, v in DarkWindow1.Windows[ Hwnd ]
This[k] := ""
DarkWindow1.Windows[ Hwnd ] := ""
}
}
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
class PopUpWindow {
;PopUpWindow v2
;Date Written: Oct 28th, 2021
;Written By: Hellbent aka CivReborn
;SpcThanks: teadrinker , malcev
static Index := 0 , Windows := [] , Handles := [] , EditHwnd , HelperHwnd
__New( obj := "" ){
This._SetDefaults()
This.UpdateSettings( obj )
This._CreateWindow()
This._CreateWindowGraphics()
if( This.AutoShow )
This.ShowWindow( This.Title )
}
_SetDefaults(){
This.X := 10
This.Y := 10
This.W := 10
This.H := 10
This.Smoothing := 2
This.Options := " -DPIScale +AlwaysOnTop "
This.AutoShow := 0
This.GdipStartUp := 0
This.Title := ""
This.Controls := []
This.Handles := []
This.Index := 0
}
AddTrigger( obj ){
local k , v , cc , bd
This.Controls[ ++This.Index ] := { X: 10
, Y: 10
, W: 10
, H: 10 }
for k, v in obj
This.Controls[ This.Index ][ k ] := obj[ k ]
cc := This.Controls[ This.Index ]
Gui, % This.Hwnd ":Add", Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd"
This.Handles[ hwnd ] := This.Index
This.Controls[ This.Index ].Hwnd := hwnd
return hwnd
}
DrawTriggers( color := "0xFFFF0000" , AutoUpdate := 0 ){
local brush , cc
Brush := Gdip_BrushCreateSolid( color )
Gdip_SetSmoothingMode( This.G , 3 )
loop, % This.Controls.Length() {
cc := This.Controls[ A_Index ]
Gdip_FillRectangle( This.G , Brush , cc.x , cc.y , cc.w , cc.h )
}
Gdip_DeleteBrush( Brush )
Gdip_SetSmoothingMode( This.G , This.Smoothing )
if( AutoUpdate )
This.UpdateWindow()
}
UpdateSettings( obj := "" , UpdateGraphics := 0 ){
local k , v
if( IsObject( obj ) )
for k, v in obj
This[ k ] := obj[ k ]
( This.X = "Center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 )
( This.Y = "Center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 )
if( UpdateGraphics ){
This._DestroyWindowsGraphics()
This._CreateWindowGraphics()
}
}
_CreateWindow(){
local hwnd
Gui , New, % " +LastFound +E0x80000 hwndhwnd -Caption " This.Options
PopUpWindow.Index++
This.Index := PopUpWindow.Index
PopUpWindow.Windows[ PopUpWindow.Index ] := This
This.Hwnd := hwnd
PopUpWindow.Handles[ hwnd ] := PopUpWindow.Index
if( This.GdipStartUp && !PopUpWindow.pToken )
PopUpWindow.pToken := GDIP_STARTUP()
}
_DestroyWindowsGraphics(){
SelectObject( This.hdc , This.obm )
DeleteObject( This.hbm )
DeleteDC( This.hdc )
}
_CreateWindowGraphics(){
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 )
}
ShowWindow( Title := "" ){
Gui , % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
}
HideWindow(){
Gui , % This.Hwnd ":Hide",
}
UpdateWindow(){
UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H )
}
ClearWindow( AutoUpdate := 0 ){
Gdip_GraphicsClear( This.G )
if( Autoupdate )
This.UpdateWindow()
}
DrawBitmap( pBitmap , obj , dispose := 1 , AutoUpdate := 0 ){
Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
if( dispose )
Gdip_DisposeImage( pBitmap )
if( Autoupdate )
This.UpdateWindow()
}
PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ){
if( isObject( color ) ){
Brush := Gdip_BrushCreateSolid( ( color.HasKey( "Color" ) ) ? ( color.Color ) : ( "0xFF000000" ) )
if( color.Haskey( "Round" ) )
Gdip_FillRoundedRectangle( This.G , Brush , color.X , color.Y , color.W , color.H , color.Round )
else
Gdip_FillRectangle( This.G , Brush , color.X , color.Y , color.W , color.H )
}else{
Brush := Gdip_BrushCreateSolid( color )
Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 )
}
Gdip_DeleteBrush( Brush )
if( AutoUpdate )
This.UpdateWindow()
}
DeleteWindow( GDIPShutdown := 0 ){
Gui, % This.Hwnd ":Destroy"
SelectObject( This.hdc , This.obm )
DeleteObject( This.hbm )
DeleteDC( This.hdc )
Gdip_DeleteGraphics( This.G )
hwnd := This.Hwnd
for k, v in PopUpWindow.Windows[ Hwnd ]
This[k] := ""
PopUpWindow.Windows[ Hwnd ] := ""
if( GDIPShutdown ){
Gdip_Shutdown( PopUpWindow.pToken )
PopUpWindow.pToken := ""
}
}
_OnClose( wParam ){
if( wParam = 0xF060 ){ ;SC_CLOSE ;[ clicking on the gui close button ]
Try{
Gui, % PopUpWindow.HelperHwnd ":Destroy"
SoundBeep, 555
}
}
}
CreateCachedBitmap( pBitmap , Dispose := 0 ){
local pCachedBitmap
if( This.CachedBitmap )
This.DisposeCachedbitmap()
DllCall( "gdiplus\GdipCreateCachedBitmap" , "Ptr" , pBitmap , "Ptr" , this.G , "PtrP" , pCachedBitmap )
This.CachedBitmap := pCachedBitmap
if( Dispose )
Gdip_DisposeImage( pBitmap )
}
DrawCachedBitmap( AutoUpdate := 0 ){
DllCall( "gdiplus\GdipDrawCachedBitmap" , "Ptr" , this.G , "Ptr" , This.CachedBitmap , "Int" , 0 , "Int" , 0 )
if( AutoUpdate )
This.UpdateWindow()
}
DisposeCachedbitmap(){
DllCall( "gdiplus\GdipDeleteCachedBitmap" , "Ptr" , This.CachedBitmap )
}
Helper(){
local hwnd , MethodList := ["__New","UpdateSettings","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow" , "AddTrigger" , "DrawTriggers", "CreateCachedBitmap" , "DrawCachedBitmap" , "DisposeCachedbitmap" ]
Gui, New, +AlwaysOnTop +ToolWindow +HwndHwnd
PopUpWindow.HelperHwnd := hwnd
Gui, Add, Edit, xm ym w250 r1 Center hwndhwnd, Gui1
PopUpWindow.EditHwnd := hwnd
loop, % MethodList.Length()
Gui, Add, Button, xm y+1 w250 r1 gPopUpWindow._HelperClip, % MethodList[ A_Index ]
Gui, Show,,
OnMessage( 0x112 , This._OnClose.Bind( hwnd ) )
}
_HelperClip(){
local ClipList
GuiControlGet, out, % PopUpWindow.HelperHwnd ":", % PopUpWindow.EditHwnd
ClipList := { __New: " := New PopUpWindow( { X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight , Options: "" -DPIScale +AlwaysOnTop "" } )"
, UpdateSettings: ".UpdateSettings( { X: """" , Y: """" , W: """" , H: """" } , UpdateGraphics := 0 )"
, ShowWindow: ".ShowWindow( Title := """" )"
, HideWindow: ".HideWindow()"
, UpdateWindow: ".UpdateWindow()"
, ClearWindow: ".ClearWindow( AutoUpdate := 0 )"
, DrawBitmap: ".DrawBitmap( pBitmap := """" , { X: 0 , Y: 0 , W: " Out ".W , H: " Out ".H } , dispose := 1 )"
, PaintBackground: ".PaintBackground( color := ""0xFF000000"" ) " ";{ Color: ""0xFF000000"" , X: 2 , Y: 2 , W: " Out ".W - 4 , H: " Out ".H - 4 , Round: 10 }"
, DeleteWindow: ".DeleteWindow( GDIPShutdown := 0 )"
, AddTrigger: ".AddTrigger( { X: """" , Y: """" , W: """" , H: """" , Value: """" , Label: """" , BoundClass: """" , BoundMethod: """" } )"
, DrawTriggers: ".DrawTriggers( color := ""0xFFFF0000"" , AutoUpdate := 0 )"
, CreateCachedBitmap: ".CreateCachedBitmap( pBitmap , Dispose := 0 )"
, DrawCachedBitmap: ".DrawCachedBitmap( AutoUpdate := 0 )"
, DisposeCachedbitmap: ".DisposeCachedbitmap()" }
clipboard := Out ClipList[ A_GuiControl ]
}
}