Hallo,
versuche gerade Pong in GDI+ zu progamieren, aber wie mach ich den Strich beweglich ( in der Hoch Funktion )
Spoiler anzeigen
#Include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
HotKeySet ( "{ESC}", "_ende" )
[/autoit] [autoit][/autoit] [autoit]Global $Titel="Pong"
Global $Rahmenbreite = 10
Global $dll = DllOpen("user32.dll")
_GDIPlus_Startup()
Global $hGUI = GUICreate( "Pong" , @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)
Global $hwnd = WinGetHandle($Titel)
GUISetBkColor(0x0)
$Willkommen=GUICtrlCreateLabel ( "Willkommen bei Pong made by Greek", @DesktopWidth/4, @DesktopHeight/2-150, 1000, 200 )
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUISetState(@SW_SHOW)
Do
Sleep ( 100 )
Until _IsPressed ( "0D", $dll ) Or _IsPressed ( "20", $dll )
GUICtrlSetState ( $Willkommen, $GUI_HIDE )
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
$hPenRahmen = _GDIPlus_PenCreate (0xFF00FF00, 15, 2)
$hPen = _GDIPlus_PenCreate (0xFFFFFFFF, 15, 2)
;~ _GDIPlus_GraphicsDrawLine ($hGraphic, 100, 100, 100, 250, $hPen)
$b=_GDIPlus_GraphicsDrawLine ($hGraphic, 100, @DesktopHeight/2.5, 100, @DesktopHeight/1.8, $hPen)
_GDIPlus_GraphicsDrawLine ($hGraphic, @DesktopWidth-100, @DesktopHeight/2.5, @DesktopWidth-100, @DesktopHeight/1.8, $hPen)
_DrawRahmen()
$Spielstand=GUICtrlCreateLabel ( "0:0", @DesktopWidth/2, @DesktopHeight/15, 100, 100 )
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
HotKeySet( "w", "_hoch" )
HotKeySet( "s", "_runter" )
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _ende()
_GDIPlus_Shutdown()
Exit
EndFunc
Func _DrawRahmen()
_GDIPlus_GraphicsDrawLine($hGraphic, $Rahmenbreite / 2, 0, $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, $Rahmenbreite / 2, @DesktopWidth, $Rahmenbreite / 2, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - $Rahmenbreite / 2, 0, @DesktopWidth - $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, @DesktopHeight - $Rahmenbreite / 2, @DesktopWidth, @DesktopHeight - $Rahmenbreite / 2, $hPenRahmen)
EndFunc ;==>_DrawRahmen
Func _hoch()
While _IsPressed ( "57", $dll )
WEnd
EndFunc
Func _runter()
EndFunc
Würde mich auch über andere Tipps freuern, wie z.B. ich den Ball richtig fliegen lasse oder er merkt das der Ball gegen die Wand gekommen ist.