Wie findet ihr das Projekt 74
-
Mega Klasse (53) 72%
-
Sehr gut (13) 18%
-
Gut (2) 3%
-
Naja (3) 4%
-
Braucht man nicht (0) 0%
-
Unnötig (3) 4%
Hallo zusammen,
ich habe mich in letzter Zeit viel mit C++ beschäftigt und hatte die Idee mal was mit Autoit und C++ zusammen zu machen. Da mich an Autoit, besonders bei Spielen mit GDIPlus die Geschwindigkeit immer sehr gestört hat, habe ich mir überlegt mal ein DLL zu machen, mit der so einfach wie mit GDIPlus zeichen kann.
Ich würde mich freuen wenn ihr das Projekt mal testet und mir Fehler meldet oder wenn ihr Fragen habt - fragt. Ebenso wäre es gut wenn ihr mir Verbesserungvorschlägt nennt und ob ihr so ein Projekt überhaupt sinnvoll findet?
Changelog bis zur aktuellen Version:
Spoiler anzeigen
Update1!:
-Bilder
-Text
-Füllen / Texturieren / Umrisse zeichnen
-Drehen( bei Kreis / Text ) ... die anderen Objekte folgen
-Performance verbessert ohne Pause im Main Programm 1000 fps auf meinem Laptop
Formen:
Linie, Kreis, Rechteck, Viereck, Polygon, Text
Update2!!
Text mit Texture hinlegen Fehler beseitigt
Update3!!!
-UDF geordnet, Funktionen in _QuickDraw_... umbenannt, ausführliche Beschreibung der Funkionen
-Gui Titel kann verändert werden
-Fehler bei der Variable deklarierung behoben
-Clear Color
-Beta Version der Funktion CreateSurface - damit kann man den Render Kontext in einer Autoit Gui erstellen
Update 4!!!!
-Fonts können erstellt werden
-Texture Alpha Channel kann genutzt werden
-Polygon kann verschoben werden
-Blending verbessert
Update 5!!!!!
-Jedes Objekt kann nun mit der Funktion _QuickDraw_RotateNext( $x, $y, $deg ) um jeden Punkt gedreht werden
Update 6!!!!!!
-Bug beim Blending beseitigt
Update7!!!!!!!
-Alle Bildformate werden nun unterstützt mit transparenz
dafür wurde die FreeImaga Lib implementiert
Update8!!!!!!!!
-Linienbreite von Kreis, Rect und Linie einstellbar mit _QuickDraw_SetLineWidth( $Width ) - die anderen körper folgen im nächsten update
Update9!!!!!!!!
-Alphachannel fixed
Update10 autoit.de/wcf/attachment/11117/ autoit.de/wcf/attachment/11118/
Texturen können in fast jedem format gespeichert werden.
Texturen können aus dem Frame Buffer erstellt werden(Screen Capture)
Quelltext Demo:
Spoiler anzeigen
#include "QuickDraw.au3"
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
_QuickDraw_Enable( "QuickDraw (Titel kann geändert werden)", 1200, 600, 20, 60, False )
[/autoit] [autoit][/autoit] [autoit]_QuickDraw_SetLineWidth( 10 )
[/autoit] [autoit][/autoit] [autoit]Local $Texture = _QuickDraw_LoadTexture( "Texture.jpg" )
[/autoit] [autoit][/autoit] [autoit]_QuickDraw_SaveTexture( "Saved Image.png", $Texture )
[/autoit] [autoit][/autoit] [autoit]Local $AlphaTexture = _QuickDraw_LoadTexture( "Alpha.png" )
[/autoit] [autoit][/autoit] [autoit]Local $ptrFont = _QuickDraw_CreateFont( "Arial" )
Local $ptrFont2 = _QuickDraw_CreateFont( "Comic Sans MS" )
Local $ptrFont3 = _QuickDraw_CreateFont( "DigifaceWide" )
Local $ptrFontTest1 = _QuickDraw_CreateFont( "Arial", False, False, False )
Local $ptrFontTest2 = _QuickDraw_CreateFont( "Arial", True , False, False )
Local $ptrFontTest3 = _QuickDraw_CreateFont( "Arial", False, True , False )
Local $ptrFontTest4 = _QuickDraw_CreateFont( "Arial", False, False, True )
Local $Move = 0
Local $Pi_Div_180 = 0.01745329
Local $string = ""
Local $points1[5][2] = [[60,50],[80,50],[100,80],[90,90],[50,60]]
Local $points2[5][2] = [[60,100],[80,100],[120,130],[110,150],[50,160]]
Local $points3[5][2] = [[60,170],[90,180],[120,230],[140,240],[50,250]]
Local $Once = True
[/autoit] [autoit][/autoit] [autoit]Local $Dummy_Texture = -1
[/autoit] [autoit][/autoit] [autoit]_QuickDraw_SetRenderTarget( $Normal_Buffer)
[/autoit] [autoit][/autoit] [autoit]While( _QuickDraw_Running() And (GUIGetMsg() <> $GUI_EVENT_CLOSE) )
[/autoit] [autoit][/autoit] [autoit]_QuickDraw_ClearBuffer( 0xFFFFFFFF )
_QuickDraw_Point( 300, 300, 0xFF0000FF )
_QuickDraw_Point( 300, 301, 0xFF00FF00 )
_QuickDraw_Point( 301, 301, 0xFFFF0000 )
_QuickDraw_Point( 301, 300, 0xFFFFFF00 )
_QuickDraw_Text( 620, 300, "Lines", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Line( 600, 350, 700, 450, 0xFF0000FF )
_QuickDraw_Line( 700, 350, 650, 450, 0xFF00FF00 )
_QuickDraw_Line( 650, 350, 700, 400, 0xFFFF0000 )
_QuickDraw_Text( 20, 30, "Rect", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Rect( 20, 50, 60, 40, $Draw_Line, 0xFFFF0000 )
_QuickDraw_Rect( 20, 100, 80, 60, $Draw_Fill, 0xFF00FF00 )
_QuickDraw_Rect( 20, 170, 100, 80, $Dummy_Texture, 0xFFFFFFFF )
_QuickDraw_FreeTexture($Dummy_Texture)
[/autoit] [autoit][/autoit] [autoit]_QuickDraw_Text( 140, 30, "Circle", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
[/autoit] [autoit][/autoit] [autoit]_QuickDraw_Circle( 160, 70, 20, $Draw_Line, 0xFF00FF00 )
_QuickDraw_Circle( 170, 130, 30, $Draw_Fill, 0xFFFFFF00 )
_QuickDraw_Circle( 180, 210, 40, $Texture, 0xFFFFFFFF )
_QuickDraw_Text( 240, 30, "Polygon", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Polygon( 200, 0, $Points1, 5, $Draw_Line, 0xFF0000FF )
_QuickDraw_Polygon( 200, 0, $Points2, 5, $Draw_Fill, 0xFFFF0000 )
_QuickDraw_Polygon( 200, 0, $Points3, 5, $Texture, 0xFFFFFFFF )
_QuickDraw_Text( 370, 30, "Text", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Text( 370, 55, "Hallo Welt", 12, $ptrFont, $Draw_Line, 0xFF00FF00 )
_QuickDraw_Text( 370, 110, "Hallo Welt", 20, $ptrFont2, $Draw_Fill, 0xFF0000FF )
_QuickDraw_Text( 370, 190, "Hallo Welt", 28, $ptrFont3, $Texture, 0xFF000000 )
_QuickDraw_Text( 650, 30, "Font", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Text( 650, 60 , "Normal", 28, $ptrFontTest1, $Draw_Fill, 0xFF000000 )
_QuickDraw_Text( 650, 80 , "Italic", 28, $ptrFontTest2, $Draw_Fill, 0xFF000000 )
_QuickDraw_Text( 650, 100, "Underline", 28, $ptrFontTest3, $Draw_Fill, 0xFF000000 )
_QuickDraw_Text( 650, 120, "Strikeout", 28, $ptrFontTest3, $Draw_Fill, 0xFF000000 )
_QuickDraw_Text( 540, 30, "Quad", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Quad( 540, 50, 570, 70, 580, 90, 530, 80, $Draw_Line, 0xFF0000FF )
_QuickDraw_Quad( 540, 100, 600, 130, 590, 150, 530, 130, $Draw_Fill, 0xFFFF0000 )
_QuickDraw_Quad( 540, 170, 620, 190, 640, 250, 570, 250, $Texture, 0xFFFFFFFF )
_QuickDraw_Text( 20, 300, "Blend", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Circle( 70, 380, 50, $Draw_Fill, 0x88FF0000 )
_QuickDraw_Circle( 100, 430, 50, $Draw_Fill, 0x88FFFF00 )
_QuickDraw_Circle( 120, 380, 50, $Draw_Fill, 0x880000FF )
_QuickDraw_Text( 420, 300, "AlphaTexture", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Rect( 420, 340, 100, 100, $Draw_Fill, 0xFF000000 )
_QuickDraw_Rect( 420, 340, 100, 100, $AlphaTexture, 0xFFFFFFFF )
_QuickDraw_Text( 770, 30, "Rotate around any Center", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_RotateNext( 900, 400, $Move )
_QuickDraw_Rect( 850, 350, 150, 100, $Texture, 0xFFFFFFFF )
_QuickDraw_Line( 900, 380, 900, 420, 0xFF000000 )
_QuickDraw_Line( 880, 400, 920, 400, 0xFF000000 )
_QuickDraw_RotateNext( 820, 170, -$Move )
_QuickDraw_Polygon( 800, 0, $Points3, 5, $Texture, 0xFFFFFFFF )
_QuickDraw_Line( 820, 150, 820, 190, 0xFF000000 )
_QuickDraw_Line( 800, 170, 840, 170, 0xFF000000 )
_QuickDraw_RotateNext( 900, 250, -$Move )
_QuickDraw_Circle( 860, 250, 50, $Texture, 0xFFFFFFFF )
_QuickDraw_Line( 880, 250, 920, 250, 0xFF000000 )
_QuickDraw_Line( 900, 230, 900, 270, 0xFF000000 )
_QuickDraw_RotateNext( 1000, 300, -$Move )
_QuickDraw_Text( 950, 280 , "Drehwurm", 28, $ptrFont, $Draw_Fill, 0xFF000000 )
_QuickDraw_Line( 980, 300, 1020, 300, 0xFF000000 )
_QuickDraw_Line( 1000, 280, 1000, 320, 0xFF000000 )
; If $Once Then
; $Once = False
; _QuickDraw_Snapshot( "Test.bmp" )
; EndIf
_QuickDraw_SwapBuffers()
; If $Once Then
; $Once = False
$Dummy_Texture = _QuickDraw_ReadTextureFormBuffer(750,150,200,200)
; EndIf
$Move = Mod( $Move + 1, 360 )
$string = "Mausposition: " & _QuickDraw_GetMousePos(0) & "-" & _QuickDraw_GetMousePos(1) & _
" MouseLeft: " & _QuickDraw_GetMouseLeft() & _
" MouseRight: " & _QuickDraw_GetMouseRight() & _
" MouseWheel: " & "Geht noch nicht" & _ ;_QuickDraw_GetMouseWheel() & _
" Key: " & chr( _QuickDraw_GetKey() ) & _
" Colour: " & "Geht noch nicht";GetPixelColor( GetMousePos(0), GetMousePos(1) )
;Sleep(10)
[/autoit] [autoit][/autoit] [autoit]WEnd
[/autoit] [autoit][/autoit] [autoit]_QuickDraw_FreeTexture( $Texture )
_QuickDraw_FreeTexture( $AlphaTexture )
_QuickDraw_FreeFont( $ptrFont )
_QuickDraw_FreeFont( $ptrFont2 )
_QuickDraw_FreeFont( $ptrFont3 )
_QuickDraw_Disable()
[/autoit] [autoit][/autoit] [autoit][/autoit]Quelltext UDF:
Spoiler anzeigen
#include-once
[/autoit] [autoit][/autoit] [autoit]; #INDEX# =======================================================================================================================
; Title .........: QuickDraw
; Version .......: 0.5
; Language ......: English
; Description ...: RenderApi
; Author ........: Moritz
; Dll ...........: QuickDraw.dll
; ===============================================================================================================================
; #32 Bit# ======================================================================================================================
If @AutoItX64 Then
MsgBox( 48, "Fehler", "32 Bit Script" )
Exit(0)
EndIf
; ===============================================================================================================================
; #VARIABLES# ===================================================================================================================
Global $QuickDrawDLL = 0
Global $Draw_Line = 0
Global $Draw_Fill = 0
Global $Draw_Stencil = 0
Global $Normal_Buffer = 0
Global $Texture_Buffer = 0
Global $PixelStruct = DllStructCreate("char[4]")
Global $PixelStructPointer = DllStructGetPtr( $PixelStruct )
; ===============================================================================================================================
; #CURRENT# =====================================================================================================================
;_QuickDraw_Enable
;_QuickDraw_Disable
;_QuickDraw_Running
;_QuickDraw_CreateSurface
;_QuickDraw_ClearBuffer
;_QuickDraw_SwapBuffers
;_QuickDraw_GetPixelColor
;_QuickDraw_LoadTexture
;_QuickDraw_SaveTexture
;_QuickDraw_ReadTextureFormBuffer
;_QuickDraw_FreeTexture
;_QuickDraw_RotateNext
;_QuickDraw_SetLineWidth
;_QuickDraw_SetRenderTarget
;_QuickDraw_Point
;_QuickDraw_Line
;_QuickDraw_Rect
;_QuickDraw_Quad
;_QuickDraw_Circle
;_QuickDraw_Polygon
;_QuickDraw_Text
;_QuickDraw_GetMousePos
;_QuickDraw_GetMouseLeft
;_QuickDraw_GetMouseRight
;_QuickDraw_GetMouseWheel
;_QuickDraw_GetKey
; ===============================================================================================================================
; #INTERNAL_USE_ONLY# ===========================================================================================================
;__QuickDraw_SetVariables
; ===============================================================================================================================
; #Device# ======================================================================================================================
[/autoit] [autoit][/autoit] [autoit]; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: __QuickDraw_SetVariables
; Description ...: Opens the QuickDraw DLL and reads the all necessary Variables form the DLL
; Syntax.........: __QuickDraw_SetVariables( )
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: _QuickDraw_Enable / _QuickDraw_CreateSurface
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func __QuickDraw_SetVariables()
$QuickDrawDLL = DllOpen( "Autoit QuickDraw.dll" )
If @error Or $QuickDrawDLL = -1 Then
MsgBox( 48, "Fehler", "QuickDraw.dll wurde nicht gefunden." )
Return SetError(@error, @extended, False)
EndIf
Local $ptrRenderLine = DllCall( $QuickDrawDLL, "int:cdecl","Get_Render_Line")
If @error Then Return SetError(@error, @extended, False)
$Draw_Line = $ptrRenderLine[0]
Local $ptrRenderFill = DllCall( $QuickDrawDLL, "int:cdecl","Get_Render_Fill")
If @error Then Return SetError(@error, @extended, False)
$Draw_Fill = $ptrRenderFill[0]
Local $ptrRenderStencil = DllCall( $QuickDrawDLL, "int:cdecl","Get_Render_Stencil")
If @error Then Return SetError(@error, @extended, False)
$Draw_Stencil = $ptrRenderStencil[0]
Local $ptrRenderTargetBuffer = DllCall( $QuickDrawDLL, "int:cdecl","Get_Render_Normal_Buffer")
If @error Then Return SetError(@error, @extended, False)
$Normal_Buffer = $ptrRenderTargetBuffer[0]
Local $ptrRenderTargetTexture = DllCall( $QuickDrawDLL, "int:cdecl","Get_Render_Texture_Buffer")
If @error Then Return SetError(@error, @extended, False)
$Texture_Buffer = $ptrRenderTargetTexture[0]
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Enable
; Description ...: Calls __QuickDraw_SetVariables and creates a Render Device
; Syntax.........: _QuickDraw_Enable( $Width, $Height, $Fullscreen )
; Parameters ....: $Title - title of the device
; $Width - Width of the device
; $Height - Height of the device
; $Fullscreen - Fullscreenmodus flag
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: _QuickDraw_Disable
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Enable( $Title, $Width, $Height, $x, $y, $Fullscreen )
__QuickDraw_SetVariables()
If @error Then Return SetError(@error, @extended, False)
DllCall( $QuickDrawDLL, "bool:cdecl","CreateQuickDrawWindow","str", $Title,"int", $Width, "int", $Height, "int", $x, "int", $y, "bool", $Fullscreen)
If @error Then Return SetError(@error, @extended, False)
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Disable
; Description ...: Closes the Render Device and closes the QuickDraw DLL
; Syntax.........: _QuickDraw_Disable()
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: _QuickDraw_Enable
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Disable()
DllCall( $QuickDrawDLL, "bool:cdecl","CloseQuickDrawWindow")
If @error Then Return SetError(@error, @extended, False)
DllClose( $QuickDrawDLL )
If @error Then Return SetError(@error, @extended, False)
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_SetTitle
; Description ...: Set the title of the QuickDraw device
; Syntax.........: _QuickDraw_SetTitle( $title )
; Parameters ....: $title - new title of the window
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: _QuickDraw_Enable
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_SetTitle( $title )
DllCall( $QuickDrawDLL, "bool:cdecl","SetTitle","str",$title )
If @error Then Return SetError(@error, @extended, False)
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Running
; Description ...: Return whether the Device is still open
; Syntax.........: _QuickDraw_Running()
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Running()
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","Running")
If @error Then Return SetError(@error, @extended, False)
return $Result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_CreateSurface
; Description ...: Calls __QuickDraw_SetVariables() and creates a render context in an Autoit GUI
; Syntax.........: _QuickDraw_CreateSurface( $hWnd, $x, $y, $width, $height )
; Parameters ....: $hWnd - the handle of the gui the surface should be created in
; $x - x position of the surface in the device
; $y - y position of the surface in the device
; $width - Width of the surface int the device
; $height - Height of the surface int the device
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The function does not work correct yet - it creates the render context but does not support multisampling and
; the Surface can not be resized
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_CreateSurface( $hWnd, $x, $y, $width, $height )
__QuickDraw_SetVariables()
If @error Then Return SetError(@error, @extended, False)
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","CreateSurface","HWND",$hWnd, "int", $x, "int", $y, "int", $width, "int", $height )
If @error Then Return SetError(@error, @extended, False)
return $Result[0]
EndFunc
; #Buffer# ======================================================================================================================
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_ClearBuffer
; Description ...: Clears the render buffer to a user defined color
; Syntax.........: _QuickDraw_ClearBuffer( $color )
; Parameters ....: $color - Clearcolor
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_ClearBuffer( $color )
DllCall( $QuickDrawDLL, "bool:cdecl","ClearBuffer","DWORD", $color )
If @error Then Return SetError(@error, @extended, False)
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_SwapBuffers
; Description ...: Copies the render context in the device context
; Syntax.........: _QuickDraw_SwapBuffers()
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_SwapBuffers()
DllCall( $QuickDrawDLL, "bool:cdecl","Swap_Buffers")
If @error Then Return SetError(@error, @extended, False)
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Snapshot
; Description ...: Takes a snapshot of the device context
; Syntax.........: _QuickDraw_Snapshot( $filename )
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Snapshot( $filename )
DllCall( $QuickDrawDLL, "bool:cdecl","Snapshot","str", $filename )
If @error Then Return SetError(@error, @extended, False)
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_GetPixelColor
; Description ...: Returns the pixelcolor from the device context
; Syntax.........: _QuickDraw_GetPixelColor()
; Parameters ....: $x - x position of the pixel
; $y - y position of the pixel
; Return values .: Success - Color of the pixel
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: Does not work correct yet
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_GetPixelColor( $x, $y)
Local $Color = DllCall( $QuickDrawDLL, "long:cdecl","Get_Pixel_Color", "int", $x, "int", $y)
If @error Then Return SetError(@error, @extended, 0)
return $Color[0]
EndFunc
[/autoit] [autoit][/autoit] [autoit]; #Font# =======================================================================================================================
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_CreateFont
; Description ...: Creates a Font
; Syntax.........: _QuickDraw_CreateFont( $Font_Name, $Italic, $Underline, $Strikeout )
; Parameters ....: $Font_Name - Name of the font
; $Italic - Font italic
; $Underline - Font underlined
; $Strikeout - Font stricedout
; Return values .: Success - Pointer to the font
; Failure - NULL
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The font must not be freed explicit, because on exit the memory is freed automatically
; Related .......: _QuickDraw_FreeFont
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_CreateFont( $Font_Name, $Italic = False, $Underline = False, $Strikeout = False )
Local $Font = DllCall( $QuickDrawDLL, "ptr:cdecl","Create_Font", "str", $Font_Name, "bool", $Italic, "bool", $Underline, "bool", $Strikeout )
If @error Then Return SetError(@error, @extended, 0)
return $Font[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_FreeFont
; Description ...: Deletes a font in runtime
; Syntax.........: _QuickDraw_FreeFont( $Font )
; Parameters ....: $Font - Pointer to the font
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The font must not be freed explicit, because on exit the memory is freed automatically
; Related .......: _QuickDraw_CreateFont
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_FreeFont( $Font )
Local $Result = DllCall( $QuickDrawDLL, "ptr:cdecl","Free_Font", "ptr", $Font )
If @error Then Return SetError(@error, @extended, 0)
return $Result[0]
EndFunc
[/autoit] [autoit][/autoit] [autoit]; #Textures# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_LoadTexture
; Description ...: Loads a texture from file
; Syntax.........: _QuickDraw_LoadTexture( $filename )
; Parameters ....: $filename - filename of the texture
; Return values .: Success - Pointer to the texture
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: Supported file formats are all used imageformats;-) yeeeaaar
; The texture must not be freed explicit, because on exit the memory is freed automatically
; Related .......: _QuickDraw_FreeTexture
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_LoadTexture( $filename )
Local $ptrTexture = DllCall( $QuickDrawDLL, "int:cdecl","LoadTexture", "str", $filename)
If @error Then Return SetError(@error, @extended, 0)
Return $ptrTexture[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_ReadTextureFormBuffer
; Description ...: Loads a texture from file
; Syntax.........: _QuickDraw_ReadTextureFormBuffer( $x = 0, $y = 0, $width = 100, $height = 100 )
; Parameters ....: $x - x-Position of the buffer
; : $y - y-Position of the buffer
; : $width - Width of the buffer
; : $height - Height of the buffer
; Return values .: Success - Pointer to the texture
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: BETA -> The function needs much CPU Power, because the pixels are copied backwards into the RAM.
; : The texture must not be freed explicit, because on exit the memory is freed automatically
; Related .......: _QuickDraw_LoadTexture
; : _QuickDraw_FreeTexture
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_ReadTextureFormBuffer( $x = 0, $y = 0, $width = 100, $height = 100 )
Local $ptrTexture = DllCall( $QuickDrawDLL, "int:cdecl","ReadTextureFormBuffer", "int", $x, "int", $y, "int", $width, "int", $height )
If @error Then Return SetError(@error, @extended, 0)
Return $ptrTexture[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_SaveTexture
; Description ...: Saves a Texture to file
; Syntax.........: _QuickDraw_SaveTexture( $filename, $store_id )
; Parameters ....: $filename - filename to save texture in
; $store_id - the pointer to the texture, which should be saved to file
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: Supported file formats are all used imageformats;-) yeeeaaar
; Related .......: _QuickDraw_LoadTexture
; : _QuickDraw_FreeTexture
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_SaveTexture( $filename, $store_id )
Local $result = DllCall( $QuickDrawDLL, "int:cdecl","SaveTexture", "str", $filename, "int", $store_id)
If @error Then Return SetError(@error, @extended, 0)
Return $result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_FreeTexture
; Description ...: Frees the memory of a texture
; Syntax.........: _QuickDraw_FreeTexture( $ptrTexture )
; Parameters ....: -ptrTexture - pointer to the texture memory
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The texture must not be freed explicit, because on exit the memory is freed automatically
; Related .......: _QuickDraw_FreeTexture
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_FreeTexture( $ptrTexture )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","FreeTexture", "int", $ptrTexture)
If @error Then Return SetError(@error, @extended, 0)
Return $Result[0]
EndFunc
; #Render# ======================================================================================================================
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_RotateNext
; Description ...: The next rendered object will be rotated
; Syntax.........: _QuickDraw_RotateNext( $x, $y, $deg )
; Parameters ....: $x - x rotation origen
; $y - y rotation origen
; $deg - rotation in degree
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_RotateNext( $x, $y, $deg )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","NextRotated", "int", $x, "int", $y, "double", $deg )
If @error Then Return SetError(@error, @extended, 0)
Return $Result[0];
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_SetLineWidth
; Description ...: Sets the Line Width
; Syntax.........: _QuickDraw_SetLineWidth( $Width )
; Parameters ....: $Width - New line width
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_SetLineWidth( $Width )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","Set_Line_Width", "int", $Width )
If @error Then Return SetError(@error, @extended, 0)
Return $Result[0];
EndFunc
Func _QuickDraw_SetRenderTarget( $Target )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","Set_Render_Target", "int", $Target )
If @error Then Return SetError(@error, @extended, 0)
Return $Result[0];
EndFunc
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Point
; Description ...: Renders a point in the render context
; Syntax.........: _QuickDraw_Point( $x, $y, $Color )
; Parameters ....: $x - x position of the point
; $y - y position of the point
; $Color - color of the point
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Point( $x, $y, $Color )
DllCall( $QuickDrawDLL, "bool:cdecl","RenderPoint", "int", $x, "int", $y, "long", $Color )
If @error Then Return SetError(@error, @extended, 0)
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Line
; Description ...: Renders a line in the render context
; Syntax.........: _QuickDraw_Line( $x1, $y1, $x2, $y2, $Color )
; Parameters ....: $x1 - x position of the begin
; $y1 - y position of the begin
; $x2 - x position of the end
; $y2 - y position of the end
; $Color - Color of the line
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Line( $x1, $y1, $x2, $y2, $Color )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","RenderLine", "int", $x1, "int", $y1, "int", $x2, "int", $y2, "long", $Color )
If @error Then Return SetError(@error, @extended, 0)
Return True
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Rect
; Description ...: Renders a rect in the render context
; Syntax.........: _QuickDraw_Rect( $x, $y, $width, $height, $Draw_Type, $Color )
; Parameters ....: $x - x position of the left upper edge
; $y - y position of the left upper edge
; $width - Width of the rect
; $height - Height of the rect
; $Draw_Type - Draw Type specifies whether the rect form is rendered as frame, filled or with a texture
; $Color - Color of the rect
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The Color actually overrides the texture color
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Rect( $x, $y, $width, $height, $Draw_Type, $Color )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","RenderRect", "int", $x, "int", $y, "int", $width, "int", $height, "int", $Draw_Type, "long", $Color )
If @error Then Return SetError(@error, @extended, 0)
return $Result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Quad
; Description ...: Renders a quad in the render context
; Syntax.........: _QuickDraw_Quad( $x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4, $Draw_Type, $Color )
; Parameters ....: $x1 - x position of the left upper edge
; $y1 - y position of the left upper edge
; $x2 - x position of the right upper edge
; $y2 - y position of the right upper edge
; $x3 - x position of the right lower edge
; $y3 - y position of the right lower edge
; $x4 - x position of the left lower edge
; $y4 - y position of the left lower edge
; $Draw_Type - Draw Type specifies whether the quad form is rendered as frame, filled or with a texture
; $Color - Color of the quad
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The Color actually overrides the texture color
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Quad( $x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4, $Draw_Type, $Color )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","RenderQuad", "int", $x1, "int", $y1, "int", $x2, "int", $y2, "int", $x3, "int", $y3, "int", $x4, "int", $y4, "int", $Draw_Type, "long", $Color )
If @error Then Return SetError(@error, @extended, 0)
return $Result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Circle
; Description ...: Renders a circle in the render context
; Syntax.........: _QuickDraw_Circle( $x, $y, $radius, $Draw_Type, $Color, $Degree = 0 )
; Parameters ....: $x - x position of the circle's center
; $y - y position of the circle's center
; $radius - Radius of the circle
; $Draw_Type - Draw Type specifies whether the circle form is rendered as frame, filled or with a texture
; $Color - Color of the circle
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The Color actually overrides the texture color
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Circle( $x, $y, $radius, $Draw_Type, $Color )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","RenderCircle", "int", $x, "int", $y, "int", $radius, "int", $Draw_Type, "long", $Color )
If @error Then Return SetError(@error, @extended, 0)
return $Result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Polygon
; Description ...: Renders a polygon in the render context
; Syntax.........: _QuickDraw_Polygon( $Points, $Count, $Draw_Type, $Color )
; Parameters ....: $x - Add the valve to every point
; $y - Add the valve to every point
; $Points - An array storing all points of the polygon
; $Count - Count of the points
; $Draw_Type - Draw Type specifies whether the polygon form is rendered as frame, filled or with a texture
; $Color - Color of the polygon
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The Color actually overrides the texture color
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Polygon( $x, $y, $Points, $Count, $Draw_Type, $Color )
Local $StructPoints = DllStructCreate("int[" & $Count * 2 & "]")
Local $ptrPoints = DllStructGetPtr($StructPoints)
For $i = 0 To $Count-1 Step 1
DllStructSetData($StructPoints, 1, $Points[$i][0], $i*2+1)
DllStructSetData($StructPoints, 1, $Points[$i][1], $i*2+2)
Next
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","RenderPolygon", "int", $x, "int", $y, "ptr", $ptrPoints, "int", $Count, "int", $Draw_Type, "long", $Color )
If @error Then Return SetError(@error, @extended, 0)
return $Result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_Text
; Description ...: Renders a text in the render context
; Syntax.........: _QuickDraw_Text( $x, $y, $text, $size, $Draw_Type, $Color, $Degree = 0 )
; Parameters ....: $x - x position of the left lower edge
; $y - y position of the left lower edge
; $text - The text to be rendered
; $size - Fontsize of the text
; $Font - Pointer to the font
; $Draw_Type - Draw Type specifies whether the text form is rendered as frame, filled or with a texture
; $Color - Color of the text
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: The Color actually overrides the texture color
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_Text( $x, $y, $text, $size, $Font, $Draw_Type, $Color )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","RenderText", "int", $x, "int", $y, "str", $text, "int", $size, "int", $Font, "ptr", $Draw_Type, "long", $Color )
If @error Then Return SetError(@error, @extended, 0)
return $Result[0]
EndFunc
[/autoit] [autoit][/autoit] [autoit]; #Input# ======================================================================================================================
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_GetMousePos
; Description ...: Returns the absolute mouse position in the device
; Syntax.........: _QuickDraw_GetMousePos( $Dir = -1 )
; Parameters ....: $dir - specifies if x and y position shoult be returned or only x ( $Dir = 0 ) / only y ( $Dir = 1 )
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_GetMousePos( $Dir = -1 )
If $Dir = -1 Then
Local $x = DllCall( $QuickDrawDLL, "int:cdecl","GetMousePositionX" )
If @error Then Return SetError(@error, @extended, 0)
Local $y = DllCall( $QuickDrawDLL, "int:cdecl","GetMousePositionY" )
If @error Then Return SetError(@error, @extended, 0)
Local $Result[2] = [$x[0], $y[0]]
return $Result
ElseIf $Dir = 0 Then
Local $x = DllCall( $QuickDrawDLL, "int:cdecl","GetMousePositionX" )
If @error Then Return SetError(@error, @extended, 0)
return $x[0]
EndIf
Local $y = DllCall( $QuickDrawDLL, "int:cdecl","GetMousePositionY" )
If @error Then Return SetError(@error, @extended, 0)
return $y[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_GetMouseLeft
; Description ...: Returns whether the left mouse button is pressed
; Syntax.........: _QuickDraw_GetMouseLeft( )
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_GetMouseLeft( )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","GetMouseLeft" )
If @error Then Return SetError(@error, @extended, 0)
Return $Result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_GetMouseRight
; Description ...: Returns whether the right mouse button is pressed
; Syntax.........: _QuickDraw_GetMouseRight( )
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_GetMouseRight( )
Local $Result = DllCall( $QuickDrawDLL, "bool:cdecl","GetMouseRight" )
If @error Then Return SetError(@error, @extended, 0)
Return $Result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_GetMouseWheel
; Description ...: Returns the delta mouse wheel state
; Syntax.........: _QuickDraw_GetMouseWheel( )
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: Does not work yet
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_GetMouseWheel( )
Local $Result = DllCall( $QuickDrawDLL, "int:cdecl","GetMouseWheel" )
If @error Then Return SetError(@error, @extended, 0)
Return $Result[0]
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _QuickDraw_GetKey
; Description ...: Returns the last key pressed
; Syntax.........: _QuickDraw_GetKey( )
; Parameters ....: None
; Return values .: Success - True
; Failure - False
; Author ........: Moritz
; Modified.......: No
; Remarks .......: None
; Related .......: None
; Link ..........: None
; Example .......: Not yet
; ===============================================================================================================================
Func _QuickDraw_GetKey( )
Local $Result = DllCall( $QuickDrawDLL, "int:cdecl","GetKey" )
If @error Then Return SetError(@error, @extended, 0)
Return $Result[0]
EndFunc
[Blockierte Grafik: http://img831.imageshack.us/img831/7240/asdl.jpg]
gruß Moritz