Wie findet ihr die neue Version von QuickDraw: AutoItDrawObjekt= 18
-
Sehr gut, besonders die Objekte (14) 78%
-
Sehr gut, aber Objekte muss nicht sein (4) 22%
-
Okey, nicht sehr gut aber auch nicht schlecht (0) 0%
-
Schlecht, es fehlen wichtige Funktionen (0) 0%
-
Schlecht, zu komplex (0) 0%
-
Unnötig (0) 0%
Hey Leute,
es ist so weit, ich habe die erste Nachfolgeversion von Quickdraw fertig, AutoItDrawObject. Hierbei habe ich auf die Fähigkeit von AutoIt gesetzt, mit Objekten zu arbeiten und ich denke es ist mir ganz gut gelungen. Weiterhin habe ich AutoItDrawObject komplett neu mit Directx11 geschrieben, da Opengl mit den ganzen Erweiterungen zu umständlich ist und Fehler nur sehr schwer zu finden sind. Weitere Erweiterungen sind, dass AutoItDrawObject die Sichtbarkeit der Objekte prüft (Stichwort Frustum), ebenso kann man Objekte aneinander "heften"(Parent) und auf Kollision testen. Ich hoffe es war der richtige Schritt, dass ganze mit Objekten zu machen und hoffe euch gefällt die neue Version!
Eventuell ist es bei dem ein oder anderen noch notwendig das directx sdk zu installieren: http://www.microsoft.com/download/en/details.aspx?id=6812
Alle Features:
Spoiler anzeigen
-Directx11
-Objekte
-Sichtbarkeitsprüfung
-Parentmodell
-Transparenz
-Kollisionserkennung
Das Klassenmodel:
Spoiler anzeigen
© moritz1243
#### AutoItDrawObject Hierarchy ####
+ Hierarchy
- AutoItDrawObject - Device -+- Texture
|
+- Rect
|
+- Circle
|
+- Font
|
+- String
+ Methods & Variables:
r = readable variable
w = writeable variable
- Device -+- Methodes -+- CreateDevice( LPCWSTR title, INT width, INT height, INT x, INT y, INT windowed, unsigned INT samples, INT vsync, HWND parent )
| |
| +- Frustum( FLOAT x, FLOAT x, FLOAT width, FLOAT height )
| |
| +- Draw( VOID )
|
+- Variables -+- ClearColor r,w
|
+- Width r,w
|
+- Height r,w
|
+- X r,w
|
+- Y r,w
|
+- Fullscreen r,w
|
+- Title r,w
|
+- MouseX r
|
+- MouseY r
|
+- MouseWheel r
|
+- Fps r
|
+- Fms r
|
+- Keyboard( INT key ) r
|
+- Running r
- Rect -+- Methodes -+- getCollision( Rect rect )
| |
| +- getCollision( Circle circle )
|
+- Variables -+- X r,w
|
+- Y r,w
|
+- Width r,w
|
+- Height r,w
|
+- Rotation r,w
|
+- Color r,w
|
+- Parent r,w
|
+- RenderMode r,w
|
+- Texture r,w
|
+- Type r
- Circle -+- Methodes -+- getCollision( Rect rect )
|
+- Variables -+- X r,w
|
+- Y r,w
|
+- Radius r,w
|
+- Rotation r,w
|
+- Color r,w
|
+- Parent r,w
|
+- RenderMode r,w
|
+- Texture r,w
|
+- Type r
- Texture -+- Methodes -+- load( LPCWSTR filename )
| |
| +- save( LPCWSTR filename )
|
+- Variables -+- Width r
|
+- Height r
|
+- Alpha r
|
+- Height r
|
+- Scroll_X r,w
|
+- Scroll_Y r,w
|
+- Tex_X r,w
|
+- Tex_Y r,w
- Font -+- Variables -+- Name r
|
+- Quality r
|
+- Bold r
|
+- Italic r
- String -+- Variables -+- X r,w
|
+- Y r,w
|
+- Rotation r,w
|
+- Color r,w
|
+- Parent r,w
|
+- RenderMode r,w
|
+- Texture r,w
|
+- Text r,w
|
+- Font r,w
|
+- Size r,w
|
+- Type r
- Collision -+- Variables -+- getCount r
|
+- getX( INT id ) r
|
+- getY( INT id ) r
|
+- getCenterX r
|
+- getCenterY r
Alles anzeigen
AutoItDrawObject UDF:
Spoiler anzeigen
#include-once
; #INDEX# =======================================================================================================================
; Title .........: AutoItDrawObject © moritz1243
; AutoIt Version : 3.2.8++
; Language ......: English
; Description ...: -
; Author(s) .....: Moritz
; Dll(s) ........: AutoItDrawObject.dll
; ===============================================================================================================================
; #CONSTANTS# ===================================================================================================================
[/autoit] [autoit][/autoit] [autoit]Global Const $ADO_RGB = 0x1907
Global Const $ADO_RGBA = 0x1908
Global Const $ADO_TEXTURE_2D = 0x0DE1
Global Const $ADO_TEXTURE_RECTANGLE = 0x84F5
Global Const $ADO_RECT = 0
Global Const $ADO_CIRCLE = 1
Global Const $ADO_STRING = 2
Global Const $ADO_TEXTURE = 3
Global Const $ADO_POLYGON = 4
Global Const $ADO_ASYNCHRONOUS = False
Global Const $ADO_SYNCHRONOUS = True
Global Const $ADO_NOVSYNC = False
Global Const $ADO_VSYNC = True
Global Const $ADO_WINDOW = True
Global Const $ADO_FULLSCREEN = False
Global Const $ADO_RED = 0xFF0000FF
Global Const $ADO_GREEN = 0x00FF00FF
Global Const $ADO_BLUE = 0x0000FFFF
Global Const $ADO_YELLOW = 0xFFFF00FF
Global Const $ADO_WHITE= 0xFFFFFFFF
Global Const $ADO_BLACK= 0x000000FF
Global Const $ADO_RENDER_NOT= 0
Global Const $ADO_RENDER_BORDERS= 1
Global Const $ADO_RENDER_SURFACE= 2
Global Const $ADO_FONT_QUALITY_LOW= 0
Global Const $ADO_FONT_QUALITY_MIDDLE= 1
Global Const $ADO_FONT_QUALITY_HIGH= 2
Global Const $ADO_SAMPLES_0= 0
Global Const $ADO_SAMPLES_1= 1
Global Const $ADO_SAMPLES_2= 2
Global Const $ADO_SAMPLES_4= 4
Global Const $ADO_SAMPLES_8= 8
Global Const $ADO_SAMPLES_16= 16
Global Const $ADO_INFINITE= 0xFFFFFFFF
[/autoit] [autoit][/autoit] [autoit]; BUTTONS
[/autoit] [autoit][/autoit] [autoit]Global Const $ADO_LBUTTON = 0x01 ; Left mouse button
Global Const $ADO_RBUTTON = 0x02 ; Right mouse button
Global Const $ADO_LEFT = 0x25 ; LEFT ARROW key
Global Const $ADO_UP = 0x26 ; UP ARROW key
Global Const $ADO_RIGHT = 0x27 ; RIGHT ARROW key
Global Const $ADO_DOWN = 0x28 ; DOWN ARROW key
Global Const $ADO_0= 0x30 ; 0 key 48
Global Const $ADO_1= 0x31 ; 1 key 49
Global Const $ADO_2= 0x32 ; 2 key 50
Global Const $ADO_3= 0x33 ; 3 key 51
Global Const $ADO_4= 0x34 ; 4 key 52
Global Const $ADO_5= 0x35 ; 5 key 53
Global Const $ADO_6= 0x36 ; 6 key 54
Global Const $ADO_7= 0x37 ; 7 key 55
Global Const $ADO_8= 0x38 ; 8 key 56
Global Const $ADO_9= 0x39 ; 9 key 57
Global Const $ADO_A= 0x41 ; A key 65
Global Const $ADO_B= 0x42 ; B key 66
Global Const $ADO_C= 0x43 ; C key 67
Global Const $ADO_D= 0x44 ; D key 68
Global Const $ADO_E= 0x45 ; E key 69
Global Const $ADO_F= 0x46 ; F key 70
Global Const $ADO_G= 0x47 ; G key 71
Global Const $ADO_H= 0x48 ; H key 72
Global Const $ADO_I= 0x49 ; I key 73
Global Const $ADO_J= 0x4A ; J key 74
Global Const $ADO_K= 0x4B ; K key 75
Global Const $ADO_L= 0x4C ; L key 76
Global Const $ADO_M= 0x4D ; M key 77
Global Const $ADO_N= 0x4E ; N key 78
Global Const $ADO_O= 0x4F ; O key 79
Global Const $ADO_P= 0x50 ; P key 80
Global Const $ADO_Q= 0x51 ; Q key 81
Global Const $ADO_R= 0x52 ; R key 82
Global Const $ADO_S= 0x53 ; S key 83
Global Const $ADO_T= 0x54 ; T key 84
Global Const $ADO_U= 0x55 ; U key 85
Global Const $ADO_V= 0x56 ; V key 86
Global Const $ADO_W= 0x57 ; W key 87
Global Const $ADO_X= 0x58 ; X key 88
Global Const $ADO_Y= 0x59 ; Y key 89
Global Const $ADO_Z= 0x5A ; Z key 90
Global Const $ADO_NO_PARENT= 0
Global Const $ADO_NO_TEXTURE = 0
Global $ADO_DLL_PATH = "AutoitDrawObject.dll"
[/autoit] [autoit][/autoit] [autoit]Func _ADO_CreateAutoItDrawObject( $Path = -1 )
If $Path <> -1 Then $ADO_DLL_PATH = $Path
Global $ADO_DLL = DllOpen($ADO_DLL_PATH)
[/autoit] [autoit][/autoit] [autoit]If $ADO_DLL = -1 Then
MsgBox(0,"Error","Failed to open AutoitDrawObject.dll")
Return 0
EndIf
Local $iResult = DllCall($ADO_DLL, "IDispatch", "CreateAutoitDrawObject")
If @error Then Return 0
Return $iResult[0]
EndFunc
Und die Demo:
Spoiler anzeigen
#include "AutoitDrawObject.au3"
#include <Timers.au3>
Global Const $WIDTH = 1024
Global Const $HEIGHT = 600
Global Const $FULLSCREEN = $ADO_WINDOW
Local $oAutoitObject = _ADO_CreateAutoItDrawObject()
[/autoit] [autoit][/autoit] [autoit]Local $oAutoitObjectDevice = $oAutoitObject.CreateDevice( "AutoItDrawObject v0.6", $WIDTH, $HEIGHT, 400, 0, $FULLSCREEN, 8, $ADO_NoVsync, 0 )
$oAutoitObjectDevice.ClearColor = 0xFFFF8000
Local $AspectRatio = 1024 / 600
$oAutoitObjectDevice.Frustum( -1 * $AspectRatio, -1, 2 * $AspectRatio, 2 )
Local $oTextureCirlce = $oAutoitObjectDevice.CreateTexture( "AutoItDrawObject.jpg" )
Local $oTextureRect = $oTextureCirlce
Local $oTextureBK = $oAutoitObjectDevice.CreateTexture( "Scroll.jpg" )
;$oTexture.save( @DesktopDir & "/output.bmp" )
Local $oRectBK = $oAutoitObjectDevice.CreateRect( 0.0, 0.0, 16.0*$AspectRatio, 2.0, 0.0, $ADO_RENDER_SURFACE, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]$oRectBK.texture = $oTextureBK
[/autoit] [autoit][/autoit] [autoit]Local $oCircle = $oAutoitObjectDevice.CreateCircle( 0.3, 0.3, 0.3, 0.0, $ADO_RENDER_SURFACE, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]$oCircle.texture = $oTextureCirlce
[/autoit] [autoit][/autoit] [autoit]Local $oCircle2 = $oAutoitObjectDevice.CreateCircle( 0.3, -0.3, 0.3, 0.0, $ADO_RENDER_SURFACE, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]$oCircle2.texture = $oTextureCirlce
[/autoit] [autoit][/autoit] [autoit]Local $oRect = $oAutoitObjectDevice.CreateRect( -0.3, -0.3, 1.0, 0.2, 0.0, $ADO_RENDER_SURFACE, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]$oRect.texture = $oTextureRect
$oRect.parent = $oCircle
Local $oRect2 = $oAutoitObjectDevice.CreateRect( -0.3, -0.3, 1.0, 0.2, 0.0, $ADO_RENDER_SURFACE, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]$oRect2.texture = $oTextureRect
Local $oCollisionPoint[16]
For $i = 0 To 15 Step 1
$oCollisionPoint[$i] = $oAutoitObjectDevice.CreateCircle( 0.0, 0.0, 0.01, 0.0, $ADO_RENDER_SURFACE, $ADO_BLUE)
Next
Local $oCollisionPoint2[16]
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To 15 Step 1
$oCollisionPoint2[$i] = $oAutoitObjectDevice.CreateCircle( 0.0, 0.0, 0.01, 0.0, $ADO_RENDER_SURFACE, $ADO_GREEN)
Next
Local $oCollisionPoint3[16]
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To 15 Step 1
$oCollisionPoint3[$i] = $oAutoitObjectDevice.CreateCircle( 0.0, 0.0, 0.01, 0.0, $ADO_RENDER_SURFACE, $ADO_RED)
Next
Local $oFont = $oAutoitObjectDevice.CreateFont( "Arial", False, False, $ADO_FONT_QUALITY_LOW )
[/autoit] [autoit][/autoit] [autoit]Local $oString = $oAutoitObjectDevice.CreateString( "Fps: 1", $oFont, -0.9, 0.9, 0.05, 0.0, 1, 0xFF000000 )
[/autoit] [autoit][/autoit] [autoit]Local $timer = _Timer_Init()
[/autoit] [autoit][/autoit] [autoit]Local $oHit = 0
Local $oPick = 0
while( $oAutoitObjectDevice.running )
$oAutoitObjectDevice.draw
Local $collision = $oRect.getCollision( $oRect2 )
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To $collision.getCount-1 Step 1
$oCollisionPoint[$i].X = $collision.getX( $i )
$oCollisionPoint[$i].Y = $collision.getY( $i )
$oCollisionPoint[$i].RenderMode = $ADO_RENDER_SURFACE
Next
For $i = $collision.getCount To 15 Step 1
$oCollisionPoint[$i].RenderMode = $ADO_RENDER_NOT
Next
Local $collision2 = $oRect2.getCollision( $oCircle )
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To $collision2.getCount-1 Step 1
$oCollisionPoint2[$i].X = $collision2.getX( $i )
$oCollisionPoint2[$i].Y = $collision2.getY( $i )
$oCollisionPoint2[$i].RenderMode = $ADO_RENDER_SURFACE
Next
For $i = $collision2.getCount To 15 Step 1
$oCollisionPoint2[$i].RenderMode = $ADO_RENDER_NOT
Next
Local $collision3 = $oCircle.getCollision( $oCircle2 )
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To $collision3.getCount-1 Step 1
$oCollisionPoint3[$i].X = $collision3.getX( $i )
$oCollisionPoint3[$i].Y = $collision3.getY( $i )
$oCollisionPoint3[$i].RenderMode = $ADO_RENDER_SURFACE
Next
For $i = $collision3.getCount To 15 Step 1
$oCollisionPoint3[$i].RenderMode = $ADO_RENDER_NOT
Next
$oString.text = "Fps: " & $oAutoitObjectDevice.fps & " Mouse: " & $oAutoitObjectDevice.MouseX & " " & $oAutoitObjectDevice.MouseY & " Wheel: " & $oAutoitObjectDevice.MouseWheel & " Key: " & $oAutoitObjectDevice.Key & " Collisions: " & $collision.getCount & " Collision2: " & $collision2.getCount & " Collision3: " & $collision3.getCount
[/autoit] [autoit][/autoit] [autoit]Local $diff = _Timer_Diff( $timer )
[/autoit] [autoit][/autoit] [autoit]If $oAutoitObjectDevice.Keyboard( $ADO_R ) Then
$oRect.Rotation = $oRect.Rotation+1
$oRect2.Rotation = $oRect2.Rotation+4
$oCircle.Rotation = $oCircle.Rotation+1
EndIf
$oTextureBK.Tex_X = $diff * 0.00001
[/autoit] [autoit][/autoit] [autoit]If $oAutoitObjectDevice.Keyboard( $ADO_F ) Then $oAutoitObjectDevice.Fullscreen = Not $oAutoitObjectDevice.Fullscreen ; also possible with alt + enter
[/autoit] [autoit][/autoit] [autoit]If IsObj($oHit) Then $oHit.Color = 0xFFFFFFFF
[/autoit] [autoit][/autoit] [autoit]Local $oHit = $oAutoitObjectDevice.getObject( $oAutoitObjectDevice.MouseX / $WIDTH * 2 * $AspectRatio - 1*$AspectRatio, $oAutoitObjectDevice.MouseY / $HEIGHT * -2 + 1 )
[/autoit] [autoit][/autoit] [autoit]If IsObj( $oHit ) Then
$oHit.Color = 0xFF0000FF
If $oAutoitObjectDevice.Keyboard( $ADO_LBUTTON ) And $oPick = 0 Then $oPick = $oHit
EndIf
If IsObj( $oPick ) Then
$oPick.x = $oAutoitObjectDevice.MouseX / $WIDTH * 2 * $AspectRatio - 1*$AspectRatio
$oPick.y = $oAutoitObjectDevice.MouseY / $HEIGHT * -2 + 1
If Not $oAutoitObjectDevice.Keyboard( $ADO_LBUTTON ) Then $oPick = 0
EndIf
Sleep(10)
WEnd
Exit( 0 )
[/autoit]