Abend zusammen
hat jemand von euch ne idee wie ich ein Bild in einer GUI highlighten kann, sodass es zum beispiell heller erscheint?
Abend zusammen
hat jemand von euch ne idee wie ich ein Bild in einer GUI highlighten kann, sodass es zum beispiell heller erscheint?
Abend zusammen,
ich wolllte ein programm schreiben mit dem ich eben schnell bei svz gucken kann ob neue nachrichten oder der gleichen gekommen sind. Dafür muss sich das script einlogen und auf die eigene seite gehen. So weit bin ih shcon gekommen:
include <GUIConstants.au3>
#include <IE.au3>
#include <file.au3>
Opt("WinTitleMatchMode", 1)
[/autoit] [autoit][/autoit] [autoit]Func login()
$addy = "name"
$pw = "pw"
$oI = _IECreate("http://www.schuelervz.net/Login",1,1)
;Sleep(1000)
[/autoit] [autoit][/autoit] [autoit]WinMove("schuelerVZ","",@desktopwidth,0)
$o_form = _IEFormGetObjByName($oI, "login")
;$ok = _IEFormElementGetObjByName($o_form, "Einloggen")
$o_login = _IEFormElementGetObjByName($o_form, "login_email")
$o_password = _IEFormElementGetObjByName($o_form, "login_password")
;write_simgleletter($addy,$o_login)
;write_simgleletter($pw,$o_password)
_IEFormElementSetValue($o_login,$addy)
_IEFormElementSetValue($o_password,$pw)
;$ok = _IEFormElementGetObjByName($o_form, "login_email")
[/autoit] [autoit][/autoit] [autoit];_IEAction ($ok, "click" )
[/autoit] [autoit][/autoit] [autoit]WinSetState("schuelerVZ","",@SW_SHOW)
WinSetState("schuelerVZ","",@SW_ENABLE)
Send("{enter}")
[/autoit] [autoit][/autoit] [autoit]Sleep(1000)
[/autoit] [autoit][/autoit] [autoit]If WinExists("Sicherheitshinweis") Then Send("{enter}")
[/autoit] [autoit][/autoit] [autoit]Sleep(1000)
[/autoit] [autoit][/autoit] [autoit]_IELinkClickByText ($oI,"Meine Seite")
[/autoit] [autoit][/autoit] [autoit]WinMove("schuelerVZ","",0,0)
[/autoit] [autoit][/autoit] [autoit]$o_form = _IEFormGetObjByName($oI, "pinnwand")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Sleep(5000)
[/autoit] [autoit][/autoit] [autoit];_IELinkClickByText ($oI,"Einloggen")
[/autoit] [autoit][/autoit] [autoit];_IEFormSubmit ($o_form)
Exit
EndFunc
login()
[/autoit] [autoit][/autoit] [autoit]Func write_simgleletter($word,$obj)
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To StringLen($word) Step 1
[/autoit] [autoit][/autoit] [autoit]_IEFormElementSetValue($obj,StringRight($word,$i))
[/autoit] [autoit][/autoit] [autoit]Sleep(100)
[/autoit] [autoit][/autoit] [autoit]Next
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit]Hat den keiner ne Idee?
Abend mit gdiplus kann du objekte wie kreise, viereckt oder als so was zeichen außerdem kannst du bilder darstellen
Abend zusammen,
ich habe im Englischen Forum OpenGL Funktionen und Constants gefunden
ich habe es auch schon soweit hinbekommen Kreise, Rechtecke usw zu zeichen jedoch nicht Texturen zu laden oder gar darzustellen. Bei Google habe ich nur die Info gefunden das OpenGL selber nicht die Texturen laden kann sonder das man sie selber irgentwie öffnen muss. Bis jetzt war ich soweit:
#include <OpenGLfunctions.au3>
#include <OpenGLconstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global Const $PFD_TYPE_RGBA = 0
Global Const $PFD_MAIN_PLANE = 0
Global Const $PFD_DOUBLEBUFFER = 1
Global Const $PFD_DRAW_TO_WINDOW = 4
Global Const $PFD_SUPPORT_OPENGL = 32
Global $bild
Global $width = @DesktopHeight
Global $height = @DesktopHeight
Global $gui = GUICreate("OpenGL", $width,$height,$WS_POPUP, $WS_EX_TOPMOST);@DesktopWidth,@DesktopHeight)
GUISetBkColor(0xFFFFFF)
Global $dc
EnableOpenGL($gui, $dc)
glMatrixMode($GL_PROJECTION)
glViewport(0, 0,$width,$height)
glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers
GUISetState(@SW_SHOW)
GUISetOnEvent(-3, "Quit")
glGenTextures(1, $bild)
glBindTexture($GL_TEXTURE_2D, $bild)
glTexEnvf( $GL_TEXTURE_ENV, $GL_TEXTURE_ENV_MODE, $GL_MODULATE )
glTexParameterf( $GL_TEXTURE_2D, $GL_TEXTURE_MIN_FILTER, $GL_LINEAR_MIPMAP_NEAREST );
glTexParameterf( $GL_TEXTURE_2D, $GL_TEXTURE_MAG_FILTER, $GL_LINEAR );
glTexParameterf( $GL_TEXTURE_2D, $GL_TEXTURE_WRAP_S, $GL_REPEAT );
glTexParameterf( $GL_TEXTURE_2D, $GL_TEXTURE_WRAP_T, $GL_REPEAT );
Global $texture1 = glTexImage2D($GL_TEXTURE_2D, 0, $Gl_RGBA, 256, 256, 0, $Gl_RGBA, $GL_UNSIGNED_BYTE, @ScriptDir & "\bild.bmp")
While 1
glClear($GL_COLOR_BUFFER_BIT)
glEnable($GL_TEXTURE_2D)
glBindTexture($GL_TEXTURE_2D, $bild)
glBegin($GL_QUADS)
glTexcoord2f(0, 0)
glTexcoord2f(0, 0)
glTexcoord2f(0, 1)
glTexcoord2f(0, 1)
glTexcoord2f(1, 1)
glTexcoord2f(1, 1)
glTexcoord2f(1, 0)
glTexcoord2f(1, 0)
glEnd()
; _DrawViereck(500,500,800,500,800,800,500,800)
; _DrawViereck(10,10,10,800,80,800,50,10)
; _DrawQuadrat(100,100,20,20)
SwapBuffers($dc)
WEnd
Func _DrawViereck($x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4)
glBegin($GL_QUADS)
glColor3f(0, 1, 0)
glVertex2f(($x1 - ($width / 2)) / ($width / 2), ($y1 - $height / 2) / ($height / 2))
glColor3f(1, 0, 0)
glVertex2f(($x2 - ($width / 2)) / ($width / 2), ($y2 - $height / 2) / ($height / 2))
glColor3f(0, 0, 1)
glVertex2f(($x3 - ($width / 2)) / ($width / 2), ($y3 - $height / 2) / ($height / 2))
glColor3f(1, 1, 0)
glVertex2f(($x4 - ($width / 2)) / ($width / 2), ($y4 - $height / 2) / ($height / 2))
glEnd()
EndFunc
Func _DrawQuadrat($x1,$y1,$width1,$height1)
glBegin($GL_QUADS)
glColor3f(0, 1, 0)
glVertex2f(($x1 - ($width / 2)) / ($width / 2), ($y1 - $height / 2) / ($height / 2))
glColor3f(1, 0, 0)
glVertex2f((($x1 + $width1) - ($width / 2)) / ($width / 2), ($y1 - $height / 2) / ($height / 2))
glColor3f(0, 0, 1)
glVertex2f((($x1 + $width1) - ($width / 2)) / ($width / 2), (($y1 + $height1) - $height / 2) / ($height / 2))
glColor3f(1, 1, 0)
glVertex2f(($x1 - ($width / 2)) / ($width / 2), (($y1 + $height1) - $height / 2) / ($height / 2))
;ToolTip (($x1 - ($width / 2)) / ($width / 2) & " | " & ($y1 - $height / 2) / ($height / 2) & " | " & ($x2 - ($width / 2)) / ($width / 2) & " | " & ($y2 - $height / 2) / ($height / 2) & " | " &($x3 - ($width / 2)) / ($width / 2) & " | " & ($y3 - $height / 2) / ($height / 2) & " | " &($x4 - ($width / 2)) / ($width / 2) & " | " & ($y4 - $height / 2) / ($height / 2))
glEnd()
EndFunc
Func EnableOpenGL($hwnd, ByRef $hDC)
Local $pfd = DllStructCreate("short nSize;" & _
"short nVersion;" & _
"dword dwFlags;" & _
"byte iPixelType;" & _
"byte cColorBits;" & _
"byte cRedBits;" & _
"byte cRedShift;" & _
"byte cGreenBits;" & _
"byte cGreenShift;" & _
"byte cBlueBits;" & _
"byte cBlueShift;" & _
"byte cAlphaBits;" & _
"byte cAlphaShift;" & _
"byte cAccumBits;" & _
"byte cAccumRedBits;" & _
"byte cAccumGreenBits;" & _
"byte cAccumBlueBits;" & _
"byte cAccumAlphaBits;" & _
"byte cDepthBits;" & _
"byte cStencilBits;" & _
"byte cAuxBuffers;" & _
"byte iLayerType;" & _
"byte bReserved;" & _
"dword dwLayerMask;" & _
"dword dwVisibleMask;" & _
"dword dwDamageMask;")
Local $h_dc = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hwnd)
DllStructSetData($pfd, "nSize", DllStructGetSize($pfd))
DllStructSetData($pfd, "nVersion", $GL_VERSION_1_1)
DllStructSetData($pfd, "dwFlags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER))
DllStructSetData($pfd, "iPixelType", $PFD_TYPE_RGBA)
DllStructSetData($pfd, "cColorBits", 24)
DllStructSetData($pfd, "cDepthBits", 32)
DllStructSetData($pfd, "iLayerType", $PFD_MAIN_PLANE)
DllOpen("gdi32.dll")
DllOpen("opengl32.dll")
DllOpen("glu32.dll")
Local $iFormat = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $h_dc[0], "ptr", DllStructGetPtr($pfd))
Local $iSetFormat = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $h_dc[0], "int", $iFormat[0], "ptr", DllStructGetPtr($pfd))
Local $h_cont = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $h_dc[0])
Local $iRet = DllCall("opengl32.dll", "int", "wglMakeCurrent", "int", $h_dc[0], "int", $h_cont[0])
$hDC = $h_dc[0]
Return 1
EndFunc ;==>EnableOpenGL
Func gluNewQuadric()
$h_qu = DllCall("glu32.dll", "hwnd", "gluNewQuadric")
Return $h_qu[0]
EndFunc ;==>gluNewQuadric
Func SwapBuffers($hDC)
DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC)
EndFunc ;==>SwapBuffers
Func Quit()
Exit
EndFunc ;==>Quit
Wäre cool wenn einer von den Profs hier ne Idee hätte
Edit: Hat den keiner ne Idee???
ich habe irrlicht schon, jedoch ist ihrlich eine komplette 3d engine, ich brauche iwas mit dem man einfach objekte spricht Kreis viereckt etc. und vllt auch bilder zeichen kann.
Weiß jemand ob es in autoit möglich ist mir directx oder opengl sachen dazustellen, da gdiplus ziehlich langsam ist.
Sieht nicht schlecht aus vielleicht mache ich ja noch das man sein fahrzeug wählen kann, mal schauen.
So ich habe die Bugs jetzt hofentlich gefixt, außerdem habe ich noch nen Pfiff eingefügt:
@ UEZ die Kollision mit Kugeln ist ja ach relativ leicht jedoch hat jede Kugel zwei bewegungrichtungen, von denen die schwächere aufgehoben wird, der Fehler liegt wahrscheinlich in dem Teil der Kraft übertragung. Aber auf jedenfall erstmal danke für die Seite, die ist echt gut gemacht.
Hallo zusammen,
ich bin echt erstaunt wie toll ihr mein spiel findet , dies gebt mir den Anreiz eine weitere Version zu machen. Dabei sollte ich mir als erstes Ziel setzen die Kollision zu fixen, wäre cool wenn sich hier die Mathe-Genies im Forum den Code mal anschauen können. Die Schrift werde ich natürlich auch erstmal ändern bis ich eine Lösung gefunden habe und die Lan funktion werde ich fertig schreiben.
Sen danke für das grundpaket, das Pept das Spiel nochmal richtig auf.
und die Sache mit dem Ballbewegen mit der Maus, das hatte ich irgentwenn mal gemacht um den Bot zu testen, habe aber scheinbar vergessen es wieder zu löschen :S.
Also die funktion dafür ist
Func _GDIPlus_GraphicsDrawStringColor($hGraphics, $sString, $nX, $nY, $sFont = "Arial", $nSize = 10, $iFormat = 0, $iBrush = 0xFF000000)
Local $hBrush, $iError, $hFamily, $hFont, $hFormat, $aInfo, $tLayout, $bResult
$hBrush = _GDIPlus_BrushCreateSolid($iBrush)
$hFormat = _GDIPlus_StringFormatCreate($iFormat)
$hFamily = _GDIPlus_FontFamilyCreate($sFont)
$hFont = _GDIPlus_FontCreate($hFamily, $nSize)
$tLayout = _GDIPlus_RectFCreate($nX, $nY, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat)
$bResult = _GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
$iError = @error
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
Return SetError($iError, 0, $bResult)
EndFunc ; ==> String in Farbe zeichnen
ich habe auch nen paar freunde da geht das und bei anderen wieder nicht, deshalb bin ich auch ratlos
Jap dein Script sieht auch nicht gerade einfach aus Ich habe neulich auch angefangen ne 3D Enginen mit autoit zu schreiben aber ich glaube Autoit ist dafür zu langsam. Hat vllt jemand lust mir dabei zu helfen die weiter zu machen, hier ist noch nen Pic
es freut mich zu sehen das das spiel sovielen gefällt und werde mich bemühen eure Ideen umzusetzten. Wenn ihr den Quelltext gesehen hat dann werdet ihr vielleicht gesehen haben das ich ein lan funktion eingebaut habe jedoch muss ich diese noch auf den guioneventmode umstellen aber wenn ich das getan habe wird man es bald auch über lan spielen können. Dieser Bug das sich die Autos verharken ist ziehmich kompliziert zu lösen da jedes auto in zwei Richtungen fährt einmal die in die mal lenkt und dann die Abprallrichtung, aber ich denke das bekomme ich hin.
hier ist noch die funktion mit der man Bilder drehen kann
$Buffer[1] = _GDIPlus_ImageGetGraphicsContext($Bitmap)
$hImage = _GDIPlus_ImageLoadFromFile("gfx\Auto.gif")
$iWidth = _GDIPlus_ImageGetWidth ($hImage) ;/ 2
$iHeight = _GDIPlus_ImageGetHeight ($hImage); / 2
Func _gdiplus_matrix_draw_xy_degree ($ix,$iy,$irotate,$ii)
_GDIPlus_MatrixDispose ($hMatrix)
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, $ix, $iy)
_GDIPlus_MatrixRotate($hMatrix,-$irotate + 90, "False")
_GDIPlus_GraphicsSetTransform($Buffer[1], $hMatrix)
_GDIPlus_GraphicsDrawImage($Buffer[1], $hImage, -$iWidth / 2 , -$iHeight / 2)
EndFunc
Alles anzeigen
@ UEZ hast recht danke für die funktion Aus deinem AutoIteroids Spiel oder?
@All habt ihr alle keine Score anzeigen, den eigentlich besitzt das spiele eine sogar in farbe, geht bei euch den die anzeigen wenn ein tor ist ? So sieht das Spiel bei mir aus: Der Score wird angezeigt, Die Player haben Namen und bei Tor kommt ne Schrift
Guten Abend miteinander
ich möchte hier mein Spiel Auto Ball vorstellen um Verbesserungsvorschläge und Anregungen zu bekomme. Ich habe an dem Spiel die letzten zwei Monate gearbeitet, mitlerweile ist es in einer spielbaren Version.
Die neuste Version ist: v1.7 wenn man zwei Spieler wählt kann man mit l ein lan spiel erstellen und auch joinen, jedoch ist diese funktion noch in der beta Phase
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Auto-Ball.ico
#AutoIt3Wrapper_Outfile=Auto-Ball.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Thanks to http://www.autoit.de
#AutoIt3Wrapper_Res_Description=Auto-Ball
#AutoIt3Wrapper_Res_Fileversion=1.5.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Moritz
#AutoIt3Wrapper_Res_Language=3079
#AutoIt3Wrapper_Res_Field=Author|Moritz
#AutoIt3Wrapper_Res_Field=Author eMail|moritz (at) gmx.at
#AutoIt3Wrapper_Res_Field=Orginaldateiname|Auto Ball.exe
#AutoIt3Wrapper_Res_Field=Produktname|Auto-Ball
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiConstants.au3>
#include <GDIPlus.au3>
;#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Sound.au3>
#include <Misc.au3>
#include <Date.au3>
HotKeySet("{ESC}", "_beenden")
HotKeySet("{l}", "_lan_create")
Opt('MustDeclareVars', 1)
Opt('GuiOnEventMode', 1)
Opt ('MouseCoordMode', 0)
Global Const $width = 640
Global Const $height = 400
Global Const $titel = "Auto Ball"
Global Const $version = " v1.5"
Global Const $Testversion = "no" ; "2009/03/28 23:59:59" ;oder "no"
Global $player[2], $player_score[2] = [0,0]
Global $hGUI, $hWnd, $hGraphic, $Bitmap, $Buffer[2], $msg, $hBrush[1] , $background, $rand_dist = 0, $hMatrix, $hImage, $iWidth, $iHeight
Global Const $pi = 3.14159265358979, $radToDeg = 180 / $pi
Global $rotate[2] = [270,90] , $x[2] = [68,572], $y[2] = [200,200], $schwung[2], $auto_radius = 32 ;, $auto_masse = $pi*$auto_radius^2
Global $rotate_abprall[2], $schwung_abprall[2]
Global $ball_rotate, $ball_x = 304, $ball_y = 200, $ball_schwung = 8, $ball_radius = 12 ;, $ball_massse = $pi*$ball_radius^2
Global $ConnectedSocket_join = -1, $ConnectedSocket_host = -1, $IP, $recv
Global $i, $c, $var1, $return
Global $max_speed = 4, $reibung = 0.02, $ball_max_speed = 4, $ball_reibung = 0.01, $game_status, $game_speed = 10
Global Const $WS_EX_COMPOSITED = 0x2000000 ; Gegen "Flackern"
Global $sound_schuss
Global $ConnectedSocket_join = -1, $ConnectedSocket_host = -1
Global $GUI, $button_join, $button_host, $input_ip, $msg, $info, $button_ok, $text[3]
Global $PC_IP = @IPAddress1, $return
;_server("host",$IP) ; (Ob join oder erstellen , Die IP und der Port)
[/autoit] [autoit][/autoit] [autoit];Global $dll = DllOpen("user32.dll")
[/autoit] [autoit][/autoit] [autoit]If $Testversion <> "no" Then _testversion_check ()
[/autoit] [autoit][/autoit] [autoit]$sound_schuss = _SoundOpen("sounds\schuss.wav")
[/autoit] [autoit][/autoit] [autoit]$hGUI = GUICreate($Titel & $version, $width, $height,-1,-1)
$hWnd = WinGetHandle($Titel & $version)
GUISetBkColor (0xFFFFFF)
GUISetOnEvent($GUI_EVENT_CLOSE, "_beenden")
GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit];GUISetCursor(16) ;invisible
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup ()
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
$Bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
$Buffer[0] = _GDIPlus_ImageGetGraphicsContext($Bitmap)
_GDIPlus_GraphicsSetSmoothingMode($Buffer, 4)
_GDIPlus_GraphicsClear($Buffer,0xFF000000)
$background = _GDIPlus_ImageLoadFromFile ("gfx\background.gif")
$hBrush[0] = _GDIPlus_BrushCreateSolid (0xFF80FF00)
$Buffer[1] = _GDIPlus_ImageGetGraphicsContext($Bitmap)
$hImage = _GDIPlus_ImageLoadFromFile("gfx\Auto.gif")
$iWidth = _GDIPlus_ImageGetWidth ($hImage) ;/ 2
$iHeight = _GDIPlus_ImageGetHeight ($hImage); / 2
_menue ()
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep (100)
WEnd
Func _main ()
[/autoit] [autoit][/autoit] [autoit];##### Player1 ########################################################
[/autoit] [autoit][/autoit] [autoit]If _IsPressed ("27") Then $Rotate[0] -= 5
If _IsPressed ("25") Then $Rotate[0] += 5
If _IsPressed ("26") Then $schwung[0] -= 0.1
If _IsPressed ("28") Then $schwung[0] += 0.1
;##### Player2 ########################################################
;If $game_status <> "Bot" Then
If _IsPressed ("44") Then $Rotate[1] -= 5
If _IsPressed ("41") Then $Rotate[1] += 5
If _IsPressed ("57") Then $schwung[1] -= 0.1
If _IsPressed ("53") Then $schwung[1] += 0.1
;EndIf
;##### Korrektur & Limit ##############################################
For $i = 0 To 1 Step 1
[/autoit] [autoit][/autoit] [autoit]If $schwung[$i] < 0 Then
$schwung[$i] += $reibung
ElseIf $schwung[$i] > 0 Then
$schwung[$i] -= $reibung
EndIf
If $schwung_abprall[$i] < 0 Then
$schwung_abprall[$i] += $reibung
ElseIf $schwung_abprall[$i] > 0 Then
$schwung_abprall[$i] -= $reibung
EndIf
If $schwung[$i] >= $max_speed Then $schwung[$i] = $max_speed
If $schwung[$i] <= -$max_speed Then $schwung[$i] = -$max_speed
Next
;##### Collision Seiten ################################################
For $i = 0 To 1 Step 1
[/autoit] [autoit][/autoit] [autoit]If $x[$i] <= 32 + $rand_dist Then
If $schwung[$i] < 0 Then
$x[$i] -= $schwung[$i]
Else
$x[$i] += $schwung[$i]
EndIf
If $schwung[$i] > $schwung_abprall[$i] And $schwung[$i] > 0 Then
$schwung_abprall[$i] = $schwung[$i] * 0.5
$schwung[$i] = 0
$rotate_abprall[$i] = -$rotate[$i]
ElseIf $schwung[$i] < $schwung_abprall[$i] And $schwung[$i] < 0 Then
$schwung_abprall[$i] = $schwung[$i] * 0.5
$schwung[$i] = 0
$rotate_abprall[$i] = -$rotate[$i]
Else
$rotate_abprall[$i] = -$rotate_abprall[$i]
EndIf
EndIf
If $x[$i] >= $width - 32 - $rand_dist Then
If $schwung[$i] > 0 Then
$x[$i] -= $schwung[$i]
Else
$x[$i] += $schwung[$i]
EndIf
If $schwung[$i] > $schwung_abprall[$i] And $schwung[$i] > 0 Then
$schwung_abprall[$i] = $schwung[$i] * 0.5
$schwung[$i] = 0
$rotate_abprall[$i] = -$rotate[$i]
ElseIf $schwung[$i] < $schwung_abprall[$i] And $schwung[$i] < 0 Then
$schwung_abprall[$i] = $schwung[$i] * 0.5
$schwung[$i] = 0
$rotate_abprall[$i] = -$rotate[$i]
Else
$rotate_abprall[$i] = -$rotate_abprall[$i]
EndIf
EndIf
If $y[$i] <= 32 + $rand_dist Then
[/autoit] [autoit][/autoit] [autoit]; $rotate_abprall[$i] = (($rotate[$i] + 90) * -1) - 90
If $schwung[$i] < 0 Then
$y[$i] -= $schwung[$i]
Else
$y[$i] += $schwung[$i]
EndIf
If $schwung[$i] > $schwung_abprall[$i] And $schwung[$i] > 0 Then
$schwung_abprall[$i] = $schwung[$i] * 0.5
$schwung[$i] = 0
$rotate_abprall[$i] = (($rotate[$i] + 90) * -1) - 90
ElseIf $schwung[$i] < $schwung_abprall[$i] And $schwung[$i] < 0 Then
$schwung_abprall[$i] = $schwung[$i] * 0.5
$schwung[$i] = 0
$rotate_abprall[$i] = (($rotate[$i] + 90) * -1) - 90
Else
$rotate_abprall[$i] = (($rotate_abprall[$i] + 90) * -1) - 90
EndIf
EndIf
If $y[$i] >= $height - 32 - $rand_dist Then
If $schwung[$i] > 0 Then
$y[$i] -= $schwung[$i]
Else
$y[$i] += $schwung[$i]
EndIf
If $schwung[$i] > $schwung_abprall[$i] And $schwung[$i] > 0 Then
$schwung_abprall[$i] = $schwung[$i] * 0.5
$schwung[$i] = 0
$rotate_abprall[$i] = (($rotate[$i] + 90) * -1) - 90
ElseIf $schwung[$i] < $schwung_abprall[$i] And $schwung[$i] < 0 Then
$schwung_abprall[$i] = $schwung[$i] * 0.5
$schwung[$i] = 0
$rotate_abprall[$i] = (($rotate[$i] + 90) * -1) - 90
Else
$rotate_abprall[$i] = (($rotate_abprall[$i] + 90) * -1) - 90
EndIf
EndIf
Next
If $ball_x <= $ball_radius + $rand_dist Then
$ball_rotate = -$ball_rotate
$ball_x += 1
EndIf
If $ball_x >= $width - $ball_radius - $rand_dist Then
$ball_rotate = -$ball_rotate
$ball_x -= 1
EndIf
If $ball_y <= $ball_radius + $rand_dist Then
$ball_rotate += 90
$ball_rotate = -$ball_rotate
$ball_rotate -= 90
$ball_y += 1
EndIf
If $ball_y >= $height - $ball_radius - $rand_dist Then
$ball_rotate += 90
$ball_rotate = -$ball_rotate
$ball_rotate -= 90
$ball_y -= 1
EndIf
;##### /Collision Seiten ###############################################
[/autoit] [autoit][/autoit] [autoit]If $ball_y > 150 And $ball_y < 218 Then
If $ball_x < 22 + $rand_dist Then
_tor(1)
ElseIf $ball_x > 614 - $rand_dist Then
_tor(0)
EndIf
EndIf
;#### Collisionen #####################################################
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To 1 Step 1
$c = Sqrt (($ball_x - $x[$i]) ^ 2 + ($ball_y - $y[$i]) ^ 2) ;C = Wurzel (A^2+B^2), erst wird Ball_x bzw y von x bzw y subtrahiert.
$var1 = ($ball_x - $x[$i]) / $c ; Verhältnis zwischen a und c zur anschließenden ACos berechnung
If $c <= 32 + $ball_radius Then
_SoundPlay ($sound_schuss)
If $schwung[$i] + $schwung_abprall[$i] < 0 Then
$ball_schwung = $schwung[$i] + $ball_schwung + $schwung_abprall[$i]
Else
$ball_schwung = -$schwung[$i] + $ball_schwung - $schwung_abprall[$i]
EndIf
$ball_rotate = ACos ($var1) * $radToDeg
If $ball_y > $y[$i] Then $ball_rotate = -$ball_rotate
$ball_rotate -= 90
EndIf
Next
$c = Sqrt (($x[1] - $x[0])^2+($y[1] - $y[0])^2) ;C = Wurzel (A^2+B^2)
$var1 = ($x[1] - $x[0]) / $c
If $c <= 64 Then
$rotate_abprall[0] = $rotate[1]
$rotate_abprall[1] = $rotate[0]
If $schwung[1] < $schwung_abprall[0] And $schwung[1] < 0 Then
$schwung_abprall[0] = $schwung[1]
ElseIf $schwung[1] > $schwung_abprall[0] And $schwung[1] > 0 Then
$schwung_abprall[0] = $schwung[1]
Else
$schwung_abprall[0] = $schwung_abprall[1]
EndIf
If $schwung[0] < $schwung_abprall[1] And $schwung[0] < 0 Then
$schwung_abprall[1] = $schwung[0]
ElseIf $schwung[0] > $schwung_abprall[1] And $schwung[0] > 1 Then
$schwung_abprall[1] = $schwung[0]
Else
$schwung_abprall[1] = $schwung_abprall[0]
EndIf
; $schwung_abprall[1] = $schwung[0]
$schwung[0] = 0
$schwung[1] = 0
EndIf
[/autoit] [autoit][/autoit] [autoit];#### /Collisionen ####################################################
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit];#### NPC Spieler #####################################################
[/autoit] [autoit][/autoit] [autoit]If $game_status = "Bot" Then _bot ()
;#### /NPC Spieler ####################################################
If $ball_schwung > 0 Then
$ball_schwung -= $ball_reibung
ElseIf $ball_schwung < 0 Then
$ball_schwung += $ball_reibung
EndIf
If $ball_schwung < -$ball_max_speed Then $ball_schwung = -$ball_max_speed
If $ball_schwung > $ball_max_speed Then $ball_schwung = $ball_max_speed
For $i = 0 To 1 Step 1
$x[$i] += Sin (($rotate[$i])*$Pi/180)*$schwung[$i] ;errechnet x
$y[$i] += Cos (($rotate[$i])*$Pi/180)*$schwung[$i] ;errechnet y
$x[$i] += Sin (($rotate_abprall[$i])*$Pi/180)*$schwung_abprall[$i] ;errechnet x
$y[$i] += Cos (($rotate_abprall[$i])*$Pi/180)*$schwung_abprall[$i] ;errechnet y
Next
$ball_x += Sin (($ball_rotate)*$Pi/180)*$ball_schwung ;errechnet x
$ball_y += Cos (($ball_rotate)*$Pi/180)*$ball_schwung ;errechnet y
_zeichnen ()
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _menue ()
Local $mGUI, $Button[3], $move_in, $input[2]
$mGUI = GUICreate($Titel, 640, 400,0,25,$WS_POPUP, $WS_EX_MDICHILD + $WS_EX_LAYERED + $WS_EX_COMPOSITED,$hGUI)
GUISetBkColor (0xFFFFFF)
GUICtrlCreatePic("gfx\BK.gif", 0, 0, 640, 400, $WS_BORDER)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button[0] = GUICtrlCreateButton ("1 Spieler",-150,200,140,50)
; $Button[0] = GUICtrlCreateLabel("1 Spieler",250,100,140,50, $SS_CENTER)
GUICtrlSetColor (-1,0xFF0000)
GUICtrlSetFont(-1, 18, 400, 0, "Ellis")
; GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1, 0)
GUICtrlSetState (-1, $GUI_ONTOP)
GUICtrlSetOnEvent (-1,"_info_button")
$Button[1] = GUICtrlCreateButton ("2 Spieler",650,270,140,50)
GUICtrlSetColor (-1,0xFF0000)
GUICtrlSetFont(-1, 18, 400, 0, "Ellis")
GUICtrlSetCursor(-1, 0)
GUICtrlSetState (-1, $GUI_ONTOP)
GUICtrlSetOnEvent (-1,"_info_button")
$Input[0] = GUICtrlCreateInput ("",250,270,140,50)
GUICtrlSetColor (-1,0xFF0000)
GUICtrlSetFont(-1, 18, 400, 0, "Ellis")
GUICtrlSetCursor(-1, 0)
GUICtrlSetOnEvent (-1,"_info_button")
GUICtrlSetState (-1,@SW_HIDE)
$Button[2] = GUICtrlCreatePic ("gfx\Home.gif",10,5,32,32)
; GUICtrlSetColor (-1,0xFF0000)
; GUICtrlSetFont(-1, 18, 400, 0, "Ellis")
; GUICtrlSetImage(-1, "shell32.dll", 22)
GUICtrlSetCursor(-1, 0)
GUICtrlSetState (-1, $GUI_ONTOP)
GUICtrlSetOnEvent (-1,"_info_button")
GUICtrlCreateLabel ($titel & " " & $version, 20, 370)
GUICtrlSetState (-1, $GUI_ONTOP)
GUISetState (@SW_SHOW)
Sleep (1000)
[/autoit] [autoit][/autoit] [autoit]For $move_in = 0 To 400 Step 40
GUICtrlSetPos ($Button[0], -150 + $move_in, 200)
GUICtrlSetPos ($Button[1], 650 - $move_in, 270)
Sleep (10)
Next
While 1
If $msg <> 0 Then
If $msg = 4 Then
$msg = 0
GUICtrlSetState ($Input[0], $GUI_ONTOP)
GUICtrlSetData ($Input[0], "Player1")
GUICtrlSetState ($Input[0], $GUI_FOCUS)
; GUICtrlSetState ($Input[0],@SW_SHOW)
; GUICtrlSetState ($Button[1],@SW_HIDE)
GUICtrlSetData ($Button[0], "OK")
GUICtrlSetPos ($Button[1], $width, $height)
For $move_in = 0 To 400 Step 40
GUICtrlSetPos ($Button[0], 650 - $move_in, 200)
GUICtrlSetPos ($Input[0], -150 + $move_in, 270)
Sleep (10)
Next
While 1
If $msg = 4 Then
AdlibEnable ( "_main" , $game_speed )
$game_status = "Bot"
$Player[0] = GUICtrlRead ($Input[0])
$player[1] = "Crabby"
ExitLoop 2
EndIf
WEnd
ElseIf $msg = 5 Then
GUICtrlSetState ($Input[0], $GUI_ONTOP)
GUICtrlSetData ($Input[0], "Player1")
GUICtrlSetState ($Input[0], $GUI_FOCUS)
; GUICtrlSetState ($Input[0],@SW_SHOW)
; GUICtrlSetState ($Button[1],@SW_HIDE)
GUICtrlSetData ($Button[0], "OK")
GUICtrlSetPos ($Button[1], $width, $height)
For $move_in = 0 To 400 Step 40
GUICtrlSetPos ($Button[0], 650 - $move_in, 200)
GUICtrlSetPos ($Input[0], -150 + $move_in, 270)
Sleep (10)
Next
While 1
If $msg = 4 Then
For $move_in = 0 To 400 Step 40
GUICtrlSetPos ($Button[0], -150 + $move_in, 200)
GUICtrlSetPos ($Input[0], 650 - $move_in, 270)
Sleep (10)
Next
$msg = 0
$Player[0] = GUICtrlRead ($Input[0])
GUICtrlSetData ($Input[0], "Player2")
GUICtrlSetState ($Input[0], $GUI_FOCUS)
While 1
If $msg = 4 Then
$Player[1] = GUICtrlRead ($Input[0])
For $move_in = 0 To 400 Step 40
GUICtrlSetPos ($Button[0], 250 + $move_in, 200)
GUICtrlSetPos ($Input[0], 250 - $move_in, 270)
Sleep (10)
Next
ExitLoop 2
EndIf
Sleep (10)
WEnd
Sleep (10)
EndIf
WEnd
AdlibEnable ( "_main" , $game_speed )
ExitLoop
EndIf
$msg = 0
EndIf
Sleep (10)
WEnd
GUIDelete ()
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _info_button ()
$msg = @GUI_CtrlId
Return 0
EndFunc
Func _zeichnen ()
_GDIPlus_GraphicsClear($Buffer[0],0xFFFFFFFF)
_GDIPlus_GraphicsDrawImage ($Buffer[0],$background,0,0)
; _GDIPlus_GraphicsDrawPie ($Buffer,$x[0] - 32,$y[0] - 32,64,64,0 - $Rotate[0] - 90,360,$hPen)
; _GDIPlus_GraphicsDrawPie ($Buffer,$x[1] - 32,$y[1] - 32,64,64,0 - $Rotate[1] - 90,360,$hPen2)
_GDIPlus_GraphicsFillEllipse($Buffer[0], $ball_x - $ball_radius, $ball_y - $ball_radius, $ball_radius * 2, $ball_radius * 2, $hBrush[0])
_GDIPlus_GraphicsDrawStringColor($Buffer[0], $player[0], $x[0] - 32, $y[0] - 56, "Ellis", 10, 0, 0xFF0000FF)
_GDIPlus_GraphicsDrawStringColor($Buffer[0], $player[1], $x[1] - 32, $y[1] - 56, "Ellis", 10, 0, 0xFFFF0000)
; _GDIPlus_GraphicsDrawString ($Buffer,$player[0],$x - 32,$y - 32 - 24,"Ellis")
; _GDIPlus_GraphicsDrawString ($Buffer,$player[1],$x2 - 32,$y2 - 32 - 24,"Ellis")
_GDIPlus_GraphicsDrawStringColor($Buffer[0], $player_score[0] , 280, 5, "Ellis", 20, 0, 0xFF0000FF)
_GDIPlus_GraphicsDrawStringColor($Buffer[0], $player_score[1] , 350, 5, "Ellis", 20, 0, 0xFFFF0000)
; _GDIPlus_GraphicsDrawString ($Buffer,$player_score[0],100,5,"Ellis",20)
; _GDIPlus_GraphicsDrawString ($Buffer,$player_score[1],500,5,"Ellis",20)
_gdiplus_matrix_draw_xy_degree ($x[0],$y[0],$rotate[0],0)
_gdiplus_matrix_draw_xy_degree ($x[1],$y[1],$rotate[1],1)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $Bitmap,0,0, $width, $height)
EndFunc
Func _gdiplus_matrix_draw_xy_degree ($ix,$iy,$irotate,$ii)
_GDIPlus_MatrixDispose ($hMatrix)
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, $ix, $iy)
_GDIPlus_MatrixRotate($hMatrix,-$irotate + 90, "False")
_GDIPlus_GraphicsSetTransform($Buffer[1], $hMatrix)
_GDIPlus_GraphicsDrawImage($Buffer[1], $hImage, -$iWidth / 2 , -$iHeight / 2)
EndFunc
Func _bot ()
Local $info[3], $m, $t
$m = $rotate[1]
$c = Sqrt (($ball_x ) ^ 2 + ($ball_y - 200) ^ 2)
$var1 = ($ball_x) / $c
$info[0] = ACos ($var1) * $radToDeg
If 200 > $ball_y Then $info[0] = -$info[0]
$info[0] -= 90
$c = Sqrt (($x[1]) ^ 2 + ($y[1] - 200) ^ 2)
$var1 = ($x[1]) / $c
$info[1] = ACos ($var1) * $radToDeg
If 200 > $y[1] Then $info[1] = -$info[1]
$info[1] -= 90
$c = Sqrt (($ball_x - $x[1]) ^ 2 + ($ball_y - $y[1]) ^ 2) ;C = Wurzel (A^2+B^2), erst wird Ball_x bzw y von x bzw y subtrahiert.
$var1 = ($ball_x - $x[1]) / $c ; Verhältnis zwischen a und c zur anschließenden ACos berechtung
$info[2] = ACos ($var1) * $radToDeg
If $ball_y > $y[1] Then $info[2] = -$info[2]
$info[2] -= 90
; ToolTip ("Ball & Tor: " & Int ($info[0]) & " " & "Auto & Tor: " & Int ($info[1]) & " " & "Auto & Ball: " & Int ($rotate[1]))
If _IsPressed (1) Then
$t = MouseGetPos ()
$ball_x = $t[0]
$ball_y = $t[1] - 32
$ball_schwung = 0
EndIf
If $c > 100 Then
If $c > 300 Then $schwung[1] -= 0.05
$schwung[1] -= 0.025
$rotate[1] = $info[2]
Else
If $schwung[1] < -4 Then $schwung[1] += 0.5
[/autoit] [autoit][/autoit] [autoit]If $info[0] < $info[1] Then
If $rotate[1] < -0 Then $rotate[1] += 5
If $rotate[1] > 0 Then $rotate[1] -= 5
Else
If $rotate[1] < 180 Then $rotate[1] += 5
If $rotate[1] > 180 Then $rotate[1] -= 5
EndIf
If $rotate[1] > 175 And $rotate[1] < 185 Then $rotate[1] = 180
If $rotate[1] > -5 And $rotate[1] < 5 Then $rotate[1] = 0
If Int ($info[0]) <> Int ($info[1]) Then
If $rotate[1] = 0 Or $rotate[1] = 180 Then $schwung[1] -= 0.05
Else
$rotate[1] = $info[2]
$schwung[1] -= 0.05
; If $rotate[1] < $info[2] Then $rotate[1] += 5
; If $rotate[1] > $info[2] Then $rotate[1] -= 5
; If $rotate[1] < $info[2] + 5 And $rotate[1] > $info[2] - 5 Then $rotate[1] = $info[2]
EndIf
EndIf
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _tor ($player_num)
Local $color[5] = [0xFF0000FF, 0xFF00FF00, 0xFFFF0000, 0xFFFFFF00, 0xFF00FFFF]
For $i = 0 To 10 Step 0.4
_GDIPlus_GraphicsDrawStringColor($Buffer[0], "Tor", 195 - $i * 26, 100 - $i * 16, "Ellis", 100 + $i * 16, 0, $color[Random (0,4,1)] )
_GDIPlus_GraphicsDrawImageRect($hGraphic, $Bitmap,0,0, $width, $height)
Sleep (10)
Next
Sleep (500)
$player_score[$player_num] += 1
If $player_score[$player_num] = 5 Then
MsgBox (0,"Winner",$player[$player_num] & " hat das Spiel gewonnen")
$player_score[0] = 0
$player_score[1] = 0
EndIf
$rotate_abprall[0] = 0
$rotate_abprall[1] = 0
$schwung_abprall[0] = 0
$schwung_abprall[1] = 0
$rotate[0] = 270
$x[0] = 68
$y[0] = 200
$schwung[0] = 0
$rotate[1] = 90
$x[1] = 572
$y[1] = $y[0]
$schwung[1] = 0
$ball_rotate = 0
$ball_x = 304
$ball_y = $y[0]
$ball_schwung = 8
EndFunc
Func _lan_create ()
[/autoit] [autoit][/autoit] [autoit]Local $IP, $recv
[/autoit] [autoit][/autoit] [autoit]If StringLeft ($PC_IP,7) <> "192.168" Then
$return = MsgBox (3,"Komische IP", "Ihre IP: " & $PC_IP & " scheint verstellt oder durch andere Programmme" & @CRLF & "verändert, wolle sie sie korrigieren?")
If $return = 6 Then
Do
$PC_IP = InputBox ("IP korrigieren","Bitte geben sie ihre normal Lan IP ein")
Until MsgBox (3, "IP korrigieren", "Wollen sie die IP: " & $PC_IP & " beibehalten") = 6
EndIf
EndIf
$GUI = GUICreate ("Deine IP: " & $PC_IP, 400, 150, -1, -1)
GUISetBkColor (0xFFFFFF)
$button_host = GUICtrlCreateButton ("Host ", 120,100,60,30)
GUICtrlSetBkColor (-1,0xFFFFFF)
GUICtrlSetColor (-1,0x00FF00)
GUICtrlSetFont(-1, 18, 400, 0, "Comic Sans MS")
GUICtrlSetCursor(-1, 0)
$button_join = GUICtrlCreateButton ("Join ", 200,100,60,30)
GUICtrlSetBkColor (-1,0xFFFFFF)
GUICtrlSetColor (-1,0x00FF00)
GUICtrlSetFont(-1, 18, 400, 0, "Comic Sans MS")
GUICtrlSetCursor(-1, 0)
$button_ok = GUICtrlCreateButton (" OK ",400,0,0,0)
GUICtrlSetBkColor (-1,0xFFFFFF)
GUICtrlSetColor (-1,0x00FF00)
GUICtrlSetFont(-1, 18, 400, 0, "Comic Sans MS")
GUICtrlSetCursor(-1, 0)
$info = GUICtrlCreateLabel ("Wähle eine Aktion aus",20,5,360,30)
GUICtrlSetColor (-1,0x0000FF)
GUICtrlSetFont(-1, 12, 400, 0, "Comic Sans MS")
$input_ip = GUICtrlCreateInput ("",400,0,0,0)
GUICtrlSetColor (-1,0x00FF00)
GUICtrlSetFont(-1, 18, 400, 0, "Comic Sans MS")
GUICtrlSetCursor(-1, 0)
GUISetState ()
While True
$msg = GUIGetMsg ()
If $msg = $GUI_EVENT_CLOSE Then Exit
If $msg = $button_host Then
GUICtrlSetData ($info,"Geben sie die IP ein, die der Server haben soll")
GUICtrlSetData ($input_ip,@IPAddress1)
GUICtrlSetPos ($input_ip,20,100,300,40)
GUICtrlSetPos ($button_ok,320,100,60,30)
GUICtrlSetPos ($button_join,400,0,0,0)
GUICtrlSetPos ($button_host,400,0,0,0)
While True
$msg = GUIGetMsg ()
If $msg = $GUI_EVENT_CLOSE Then Exit
If $msg = $button_ok Then
$ip = GUICtrlRead ($input_ip)
GUICtrlSetData ($info,"Der Server wird nun erstellt...")
GUICtrlSetPos ($button_ok,400,0,0,0)
GUICtrlSetPos ($input_ip,400,0,0,0)
GUICtrlSetPos ($info,20,50,360,60)
_server("host",$IP)
If $error = 1 Then ExitLoop
ExitLoop 2
EndIf
WEnd
ElseIf $msg = $button_join Then
GUICtrlSetData ($info,"Geben sie die IP des Servers ein ")
GUICtrlSetPos ($input_ip,20,100,300,40)
GUICtrlSetPos ($button_ok,320,100,60,30)
GUICtrlSetPos ($button_join,400,0,0,0)
GUICtrlSetPos ($button_host,400,0,0,0)
While True
$msg = GUIGetMsg ()
If $msg = $GUI_EVENT_CLOSE Then Exit
If $msg = $button_ok Then
$ip = GUICtrlRead ($input_ip)
GUICtrlSetData ($info,"Es wird versucht ein Verbindung herzustellen...")
GUICtrlSetPos ($button_ok,400,0,0,0)
GUICtrlSetPos ($input_ip,400,0,0,0)
GUICtrlSetPos ($info,20,50,360,60)
_server("join",$IP)
If $error = 1 Then ExitLoop
ExitLoop 2
EndIf
WEnd
EndIf
WEnd
GUICtrlSetData ($info,"")
GUICtrlSetData ($input_ip,"")
GUICtrlSetData ($button_ok," Send ")
GUICtrlSetPos ($info,20,5,360,90)
GUICtrlSetPos ($input_ip,20,100,300,40)
GUICtrlSetPos ($button_ok,320,100,60,30)
While True
$msg = GUIGetMsg ()
If $msg = $GUI_EVENT_CLOSE Then Exit
If $msg = $button_ok Then
$text[0] = GUICtrlRead ($input_ip)
GUICtrlSetData ($input_ip,"")
TCPSend($ConnectedSocket_join, $text[0])
EndIf
$text[1] = TCPRecv($ConnectedSocket_host, 2048)
If $text[1] <> "" Then
; $text[2] = $text[2] & @CRLF & $text[1]
GUICtrlSetData ($info, $text[1])
EndIf
WEnd
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _server ($job,$IP)
Local $ip_anderer
$error = 0
TCPStartup()
If $job = "host" Then
$ip_anderer = _host ($IP, 33891)
If $error = 1 Then Return 0
GUICtrlSetData ($info,"Die Verbindung zu " & $ip_anderer & " steht")
Sleep (500)
GUICtrlSetData ($info,"IP Adressen werden nun ausgetauscht")
_join ($ip_anderer, 33890)
GUICtrlSetData ($info,"Server wurde erfolgreich erstellt")
ElseIf $job = "join" Then
_join ($IP, 33891)
GUICtrlSetData ($info,"IP Adressen werden nun ausgetauscht")
$ip_anderer = _host ($PC_IP, 33890)
If $error = 1 Then Return 0
GUICtrlSetData ($info,"Die Verbindung zu " & $IP & " steht")
EndIf
EndFunc
Func _host ($host_ip, $host_port)
Local $socket, $recv
$Socket = TCPListen($host_ip, $host_port)
If $Socket = -1 Then
GUICtrlSetData ($info,"Ein Fehler bei der Erstellung des Servers ist aufgetreten!")
Sleep (1000)
GUICtrlSetData ($info,"Wähle eine Aktion aus")
GUICtrlSetPos ($button_host, 120,100,60,30)
GUICtrlSetPos ($button_join, 200,100,60,30)
GUICtrlSetPos ($info,20,5,360,60)
$error = 1
Return 0
EndIf
Do
$ConnectedSocket_host = TCPAccept($Socket)
Until $ConnectedSocket_host <> -1
Do
$recv = TCPRecv($ConnectedSocket_host, 2048)
Until $recv <> ""
Return $recv
EndFunc
Func _join ($join_ip, $join_port)
Local $socket, $recv
$ConnectedSocket_join = TCPConnect($join_ip, $join_port)
TCPSend($ConnectedSocket_join, $PC_IP)
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _GDIPlus_GraphicsDrawStringColor($hGraphics, $sString, $nX, $nY, $sFont = "Arial", $nSize = 10, $iFormat = 0, $iBrush = 0xFF000000)
Local $hBrush, $iError, $hFamily, $hFont, $hFormat, $aInfo, $tLayout, $bResult
$hBrush = _GDIPlus_BrushCreateSolid($iBrush)
$hFormat = _GDIPlus_StringFormatCreate($iFormat)
$hFamily = _GDIPlus_FontFamilyCreate($sFont)
$hFont = _GDIPlus_FontCreate($hFamily, $nSize)
$tLayout = _GDIPlus_RectFCreate($nX, $nY, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat)
$bResult = _GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
$iError = @error
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
Return SetError($iError, 0, $bResult)
EndFunc ; ==> String in Farbe zeichnen
Func _testversion_check ()
Local $iDateCalc = _DateDiff( 's',$Testversion,_NowCalc())
If $iDateCalc > 0 Then
MsgBox (0,"","Die Test-Version von " & $Titel & " ist abgelaufen!")
Exit
EndIf
EndFunc ; ==> Prüft ob die Version aktuell ist
[/autoit] [autoit][/autoit] [autoit]Func _beenden ()
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_BitmapDispose ($Bitmap)
_GDIPlus_GraphicsDispose ($Buffer[0])
_GDIPlus_GraphicsDispose ($Buffer[1])
_GDIPlus_ImageDispose ($background)
_GDIPlus_BrushDispose ($hBrush[0])
_GDIPlus_Shutdown ()
_SoundClose ($sound_schuss)
; DllClose ($dll)
Exit
EndFunc
oder statt run könnte ich acuh shellexecute machen
und nebenbei du bist nen guter hellseher außer war es iwie dumm von mir da nicht selber drauf zu kommen
nein ohne es vorher zu extrahieren meinte ich es nicht manuel zu extramieren ich möchte das autoit es selber aus der exe rausholt und als button dastell.t ich möchte später noch machen, dass wenn man dann auf das icon in der GUI klickt das dann das spiel /programm startet
einfach in der GUI Fläche nicht oben in der leiste