#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\..\Programme\AutoIt3\Icons\au3.ico
#AutoIt3Wrapper_outfile=C:\Users\mmfeoca\Desktop\Matrix.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

;~ Opt('MustDeclareVars', 1)


OnAutoItExitRegister("OnExit")


Global $iWidth = @DesktopWidth, $iHeight = @DesktopHeight
Global $aPos[50][3]
Global $hFont, $hFamily, $hFormat, $hBrush, $hGraphic, $hBackBuffer, $sString
Global $Abweichung[UBound($aPos)]
Global $sString[UBound($aPos)]

For $s = 0 To UBound($aPos) - 1
	$aPos[$s][0] = (@DesktopWidth/UBound($aPos))*$s
	$aPos[0][1] = 10
	$Abweichung[$s] = 0
	$sString[$s] = Chr(Random(0, 255, 0))
Next
$Schritt = 20


_Main()

Func _Main()
	Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
	Local $aInfo


	$hGUI = GUICreate("GDI+", $iWidth, $iHeight, 0, 0, -2147483648)
	GUISetBkColor(0x000000)

	GUISetState()


	_GDIPlus_Startup ()
	$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
	$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth,$iHeight,$hGraphic)

	$hBackBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
	_GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000)
	$hBrush = _GDIPlus_BrushCreateSolid (0xFF00DF00)
	$hFormat = _GDIPlus_StringFormatCreate ()
	$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
	$hFont = _GDIPlus_FontCreate ($hFamily, 15, 0)

	While GUIGetMsg() <> -3
		_GDIPlus_GraphicsClear($hBackbuffer, 0x05000000)
		For $px = 0 To UBound($aPos) - 1
			If $aPos[$px][2] < 10 Then
				$aPos[$px][2] = Round(Random(0,10),0)
				$Abweichung[$px] = Round(Random(-10,10),0)

			ElseIf $aPos[$px][2] = 10 Then
				For $py = 0 To 1
					$sString[$px] = Chr(Random(0, 255, 0))
					$aPos[$px][1] = $aPos[$px][1] - $Schritt
					$tLayout = _GDIPlus_RectFCreate ($aPos[$px][0]+$Abweichung[$px], $aPos[$px][1], 0, 0)
					$aInfo = _GDIPlus_GraphicsMeasureString ($hGraphic, $sString[$px], $hFont, $tLayout, $hFormat)
					_GDIPlus_GraphicsDrawStringEx ($hGraphic, $sString[$px], $hFont, $aInfo[0], $hFormat, $hBrush)
				next
				$hBrush = _GDIPlus_BrushCreateSolid (0xFF00DF00)
				$aPos[$px][1] += 3.5 * $Schritt
				$Dunkler = 1280
				If $aPos[$px][1] >= @DesktopHeight + 160 Then
					$aPos[$px][1] = 0
					$aPos[$px][2] = 0
				EndIf
			EndIf
		Next
		_GDIPlus_GraphicsDrawImage($hGraphic,$hBitmap,0,0)
	WEnd


	OnExit()


EndFunc





Func OnExit()
	_GDIPlus_FontDispose ($hFont)
	_GDIPlus_FontFamilyDispose ($hFamily)
	_GDIPlus_StringFormatDispose ($hFormat)
	_GDIPlus_BrushDispose ($hBrush)
	_GDIPlus_GraphicsDispose ($hGraphic)
	_GDIPlus_Shutdown ()
	Exit
EndFunc