Leaderboard
Popular Content
Showing content with the highest reputation on 05/10/2020 in all areas
-
AutoIt v3.3.15.1 Beta View File 3.3.15.1 (10th May, 2020) (Beta) AutoIt: - Changed: PCRE regular expression engine updated to 8.41. - Added #3741: GUISetStyle() example to avoid blank title bar. - Fixed #2806: GUICtrlCreateIcon() doc when filename="". - Fixed #3580: FileSetAttrib() crashing on root folders. - Fixed #3636: Applied the SS_NOPREFIX style to the SplashTextOn dialog to treat an ampersand in the 'text' parameter character in stead of a hotkey mnemonic prefix indicator. - Fixed #3689: GUICtrlSetOnEvent ( controlID, "" ) wasn't disabling the previous set UDF and returned error=1. - Fixed #3707: GUISetOnEvent($GUI_EVENT_CLOSE, "") wasn't disabling the previous set UDF and returned error=1. - Fixed: GUIOnEventMode and TrayOnEventMode options had unnecessary slow downs. - Fixed: Workarounds added to alleviate slow downs on Windows 10 1809 and later (OS bug/design change). AutoItX: - Changed: AutoItX .NET assembly updated to .NET 4.0 / CLR 4. - Changed: AutoIt PowerShell CmdLets updated to .NET 4.0 / CLR 4. - Changed: Updated C++ example. - Fixed #3642: ControlTreeView example. Au3Check: - Fixed #2822: object('item')('item') syntax support. - Fixed #3560: parentheses around function reference. UDFs: - Changed: slight improvement when _DebugReport() display "error code:" different from 0. - Changed: _WinAPI_Reg*() doc and examples. - Changed: _SQLite 3.22.0.0 -> 3.28.0.0. - Added: Extras\AutoUpdateIt\AutoSQLiteUpdateIt.au3 script to download sqlite dll's used by _SQLite_Startup(). - Added #3149: _SQLite_GetTableData2D() simplified version of _SQLite_GetTable2d() returning just data. - Added: RegWrite() doc and example about #requireAdmin. - Added: $ARRAYDISPLAY_ROWPREFIX to change the prefix of the row numbering in _ArrayDisplay(). - Added: _Assert() use if needed _DebugReport(). - Added #3027: _WinAPI_RegEnumKey() return the lastWriteTime of the subkey in @extended. - Added: _WinAPI_RegCreateKey() and _WinAPI_RegOpenkey() can use $hKey as in RegRead(). - Added: _WinAPI_RegDeleteKey() new parameter $iSamDesired. - Added: $ARRAYDISPLAY_CHECKERROR for _ArrayDisplay() avoid display after _Array*() errors. - Added: _DebugArrayDisplay() write a _DebugReport() if @error set when called. - Added: _WinAPI_ShellQueryRecycleBin() example. - Added: $REG_ERROR_MORE_DATA for _WinAPI_RegQueryValue(). - Added: _DebugReportVar() support Array 3D. - Added: _GUICtrl*() using GUICtrlInternals.au3 (Internal maintenability). - Added #3753: _GUICtrlListView_SetImageList sanity check on $iType parameter. - Fixed #3605: _GUICtrlListView_SetBkImage() does not accept control ID. - Fixed: _GUICtrlEdit_GetCueBanner() and _GUICtrlEdit_ShowBalloonTip() using Unicode string. - Fixed: Use _WinAPI_GetString() instead of _WinAPI_WideCharToMultiByte() to handle Unicode. - Fixed #3618: $tagNMLVKEYDOWN, $tagNMTVKEYDOWN, $tagNMTCKEYDOWN structure alignment. - Fixed #3619: _WinAPI_LocalFree() doc. - Fixed #3243: _WinAPI_MoveFileEx() if $sNewFile = 0 and $MOVE_FILE_DELAY_UNTIL_REBOOT - Fixed #3264: _INetSmtpMail() bad $sFirst default value. - Fixed #3265: _INetSmtpMail() bad Bias calculation. - Fixed: _WinAPI_GetErrorMessage(), _WinAPI_GetLastErrorMessage() returning @error. - Fixed: _WinAPI_GUIDFromStringEx() return on error. - Fixed: _WinAPI_EnumProcessHandles() seting @extended if too many Handles. - Fixed #3626: _WinAPI_GetSaveFileName() example. - Fixed: _WinAPI_RegQueryValue() wrong return on success and does not return error $ERROR_MORE_DATA - Fixed #3628: _WinAPI_GetCaretPos() bad return. - Fixed #3632: _Net_Share_ShareCheck() 2nd parameter is a $sResourcePath. - Fixed: _ArrayInsert() range element comparison datatype mismatch. - Fixed #3637: _ArrayDisplay() error when Array is empty and Range parameter exists. - Fixed #3657: _GUICtrlListView_SimpleSort selected item when no selection. - Fixed #3687: Corrected HSL constant values for RGB-HSL-RGB conversion. - Fixed #3699: _ArrayMin, _ArrayxMinIndex, _ArrayMax and _ArrayMinIndex examples - Fixed #3708: _WinAPI_LoadCursor() and _WinAPI_GetIconInfo() must use $OCR_* instead of $IDC_* that are used in AutoIt Mouse builtin. - Fixed #3711: _WinAPI_EnumWindows() and _WinAPI_EnumWindowsPopup() examples. - Fixed #3713: missing $ENM_NONE definition. - Fixed #3716: _ArrayToClip() example. - Fixed #3714: _GUICtrlTreeView_Sort() crash with 1 element TreeView. - Fixed #2962: GUICtrlSetImage() on GUICtrlCreatePIC() with $SS_SUNKEN or WS_EX_DLGMODALFRAME - Fixed #3744: _Crypt_DestroyKey() does not return error on wrong key. - Fixed: $LANG_FRENCH value in _WinAPILangConstants.au3. - Fixed #3733: _FileListToArrayRec() sometimes hanging when ".." filename was returned causing an endless recursion. - Fixed #3737: _ArrayUnique() failed with a single element array when using $iBase parameter. - Fixed #3755: _ArrayInsert/Delete $vRange delimited string failing. - Fixed: _GUICtrlTreeview_*() running in X64 mode. Submitter Jon Submitted 05/09/2020 Category Beta2 points
-
#include <GUIConstants.au3> #include <GuiListView.au3> $GUI = GUICreate("gui") GUISetState() $ListView = GUICtrlCreateListView("Name1|Name2|Surrealneme3|", 10, 10, 250, 350, $LVS_SHOWSELALWAYS) _GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) _GUICtrlListView_SetColumnWidth($ListView, 10, 0) $LV = GUICtrlGetHandle($ListView) For $i = 0 To 9 GUICtrlCreateListViewItem("name" & $i & "|surname" & $i & "|surrealizm" & $i, $ListView) Next FileDelete('tmp.ini') $button_copy = GUICtrlCreateButton("Copy", 300, 70, 70, 25) $button_paste = GUICtrlCreateButton("Paste", 300, 100, 70, 25) $button_exit = GUICtrlCreateButton("Exit", 300, 200, 70, 30) Local $ReadAdd = '' While 1 Switch GUIGetMsg() Case $button_exit,$GUI_EVENT_CLOSE Exit ;============================================================================= Case $button_copy FileDelete('tmp.ini') $Size = _GUICtrlListView_GetItemCount($LV) For $r = 0 To $Size If _GUICtrlListView_GetItemSelected($LV, $r) Then $GetArrayTxt = _GUICtrlListView_GetItemTextArray($LV, $r) For $l = 1 To $GetArrayTxt[0] If $l = $GetArrayTxt[0] Then $ReadAdd &= $GetArrayTxt[$l] Else $ReadAdd &= $GetArrayTxt[$l]&'|' EndIf Next IniWrite('tmp.ini', 'Selected', 'Line'&$r, $ReadAdd) $ReadAdd = '' EndIf Next ;============================================================================= Case $button_paste ; how to paste more then 1 item $Size = _GUICtrlListView_GetItemCount($LV) $Section = IniReadSection('tmp.ini', 'Selected') If IsArray($Section) Then For $s=1 to $Section[0][0] $NI = _GUICtrlListView_AddItem($LV, '') $Split = StringSplit($Section[$s][1], '|', 1) For $p=1 to $Split[0] ConsoleWrite('$Split[$p]:'&$p&' - '& $Split[$p]&@CRLF) _GUICtrlListView_SetItemText($LV, $NI, $Split[$p], $p-1) Next $Size = $Size +1 Next FileDelete('tmp.ini') EndIf EndSwitch WEnd This should be able to deal with multiple, varying amount of columns. As you can notice, it is a different approach.1 point
-
3D Sinus Wave (GDI / GDI+)
jaberwacky reacted to UEZ for a topic
As requested by @Lakes here: GDI and GDI+ versions of 3D Sinus Wave. GDI ≠ GDI+! GDI: ;coded by UEZ build 2017-01-18 #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GuiConstantsEx.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> Global $__f1, $__f2, $__f3, $__fY0, $__fZ0, $__fX1, $__fY1 Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit, $fZoom = 5.0 Global Const $iW = @DesktopWidth * 0.75, $iH = @DesktopHeight * 0.75, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ 3D Sinus Wave v1.1 coded by UEZ / FPS: " Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi, $fPi2 = ACos(-1) * 2 AutoItSetOption("GUIOnEventMode", 1) GDIPlus_3DSinusWave() AutoItSetOption("GUIOnEventMode", 0) Func GDIPlus_3DSinusWave() $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH) ;, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hBitmapGDI = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) Local Const $hObjOld = _WinAPI_SelectObject($hGfxDC, $hBitmapGDI) Local Const $hPen = _WinAPI_GetStockObject($DC_PEN) Local Const $hPen_Old = _WinAPI_SelectObject($hGfxDC, $hPen) _WinAPI_SetStretchBltMode($hDC, $HALFTONE) $iFPS = 0 Local Const $fEuler = 2.7182818284 Local $fSpace = 6, $iPoints = 16, $fSpace2 = $fSpace / 2, $iPoints2 = $iPoints / 2 Local $fRotX = Random(-360, 360), $fRotY = Random(-360, 360), $fRotZ = Random(-360, 360), $fPower = 20.0 Local $fRx = Random(-1.5, 1,5), $fRy = Random(-1.5, 1,5), $fRz = Random(-1.5, 1,5) Local $c = 0, $t = 0, $aCoords[$iPoints ^ 2][3] Local $i, $j, $x, $y, $z, $x1, $y1, $z1, $x2, $y2, $z2, $x3, $y3, $z3, $fDistance, $r, $g, $b Local $hDLL_gdi32 = DllOpen("gdi32.dll") Local $tLOGBRUSH = DllStructCreate($tagLOGBRUSH) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") AdlibRegister("CalcFPS", 1000) Do _WinAPI_BitBlt($hGfxDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $WHITENESS) ;erase canvas background $c = 0 For $i = 0 To $iPoints - 1 For $j = 0 To $iPoints - 1 $aCoords[$c][0] = $fSpace * $i + $fSpace2 - $fSpace * $iPoints2 $aCoords[$c][1] = $fSpace * $j + $fSpace2 - $fSpace * $iPoints2 $fDistance = Dist(0, 0, $aCoords[$c][0], $aCoords[$c][1]) $aCoords[$c][2] = $fEuler ^ (-$fDistance / 50) * Sin(($fDistance / 10) - $t) * $fPower $c += 1 $t += 0.00075 Next Next For $i = 0 To $iPoints - 2 For $j = 0 To $iPoints - 2 $r = Int(0x80 + $aCoords[$j + $iPoints * $i][0] * 2) $g = Int(0x80 + $aCoords[$j + $iPoints * $i][1] * 2) $b = Int(0x80 + $aCoords[$j + $iPoints * $i][2] * 2) DllCall($hDLL_gdi32, "dword", "SetDCPenColor", "handle", $hGfxDC, "dword", BitShift($b, -16) + BitShift($g, -8) + $r) _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[$j + $iPoints * ($i + 1)][0], $aCoords[$j + $iPoints * ($i + 1)][1], $aCoords[$j + $iPoints * ($i + 1)][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($hDLL_gdi32, "bool", "MoveToEx", "handle", $hGfxDC, "int", $iWh + $x1 * $fZoom, "int", $iHh + $y1 * $fZoom, "ptr", 0) DllCall($hDLL_gdi32, "bool", "LineTo", "handle", $hGfxDC, "int", $iWh + $x2 * $fZoom, "int", $iHh + $y2 * $fZoom) _3Dto2D($aCoords[($j + 1) + $iPoints * $i][0], $aCoords[($j + 1) + $iPoints * $i][1], $aCoords[($j + 1) + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($hDLL_gdi32, "bool", "MoveToEx", "handle", $hGfxDC, "int", $iWh + $x1 * $fZoom, "int", $iHh + $y1 * $fZoom, "ptr", 0) DllCall($hDLL_gdi32, "bool", "LineTo", "handle", $hGfxDC, "int", $iWh + $x2 * $fZoom, "int", $iHh + $y2 * $fZoom) Next Next For $i = 0 To $iPoints - 2 $r = Int(0x80 + $aCoords[$j + $iPoints * $i][0] * 2) $g = Int(0x80 + $aCoords[$j + $iPoints * $i][1] * 2) $b = Int(0x80 + $aCoords[$j + $iPoints * $i][2] * 2) DllCall($hDLL_gdi32, "dword", "SetDCPenColor", "handle", $hGfxDC, "dword", BitShift($b, -16) + BitShift($g, -8) + $r) _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[$j + $iPoints * ($i + 1)][0], $aCoords[$j + $iPoints * ($i + 1)][1], $aCoords[$j + $iPoints * ($i + 1)][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($hDLL_gdi32, "bool", "MoveToEx", "handle", $hGfxDC, "int", $iWh + $x1 * $fZoom, "int", $iHh + $y1 * $fZoom, "ptr", 0) DllCall($hDLL_gdi32, "bool", "LineTo", "handle", $hGfxDC, "int", $iWh + $x2 * $fZoom, "int", $iHh + $y2 * $fZoom) Next For $j = 0 To $iPoints - 2 $r = Int(0x80 + $aCoords[$j + $iPoints * $i][0] * 2) $g = Int(0x80 + $aCoords[$j + $iPoints * $i][1] * 2) $b = Int(0x80 + $aCoords[$j + $iPoints * $i][2] * 2) DllCall($hDLL_gdi32, "dword", "SetDCPenColor", "handle", $hGfxDC, "dword", BitShift($b, -16) + BitShift($g, -8) + $r) _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[($j + 1) + $iPoints * $i][0], $aCoords[($j + 1) + $iPoints * $i][1], $aCoords[($j + 1) + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($hDLL_gdi32, "bool", "MoveToEx", "handle", $hGfxDC, "int", $iWh + $x1 * $fZoom, "int", $iHh + $y1 * $fZoom, "ptr", 0) DllCall($hDLL_gdi32, "bool", "LineTo", "handle", $hGfxDC, "int", $iWh + $x2 * $fZoom, "int", $iHh + $y2 * $fZoom) Next $fRotX += $fRx $fRotY += $fRy $fRotZ += $fRz _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(10) GUIRegisterMsg($WM_MOUSEWHEEL, "") AdlibUnRegister("CalcFPS") ;release resources _WinAPI_SelectObject($hGfxDC, $hPen_Old) _WinAPI_DeleteObject($hPen) _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) GUIDelete($hGUI) DllClose($hDLL_gdi32) EndFunc ;==>GDIPlus_3DSinusWave Func WM_MOUSEWHEEL($hGUI, $iMsg, $wParam, $lParam) Local $wheel_Dir = _WinAPI_HiWord($wParam) If $wheel_Dir > 0 Then $fZoom += 0.25 $fZoom = $fZoom > 20 ? 20 : $fZoom Else $fZoom -= 0.25 $fZoom = $fZoom < 0.25 ? 0.25 : $fZoom EndIf Return "GUI_RUNDEFMSG" EndFunc ;==>WM_MOUSEWHEEL Func Dist($x1, $y1, $x2, $y2) Return Sqrt(($x1 - $x2) * ($x1 - $x2) + ($y1 - $y2) * ($y1 - $y2)) EndFunc ;==>Dist Func _3Dto2D($fX, $fY, $fZ, $fRotX, $fRotY, $fRotZ, ByRef $__fXPos, ByRef $__fYPos, ByRef $__fZPos) ;apply the x-axis rotation to transform coordinates ($fX, $fY, $fZ) into coordinates ($fX0, $fY0, $fZ0) $__f1 = $fRotX * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fY0 = $fY * $__f2 + $fZ * $__f3 $__fZ0 = $fZ * $__f2 - $fY * $__f3 ;apply the y-axis rotation to ($fX0, $__fY0, $fZ0) to obtain ($__fX1, $__fY1, $fZ1) $__f1 = $fRotY * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fX1 = $fX * $__f2 - $__fZ0 * $__f3 $__fY1 = $__fY0 ;~ $__fZ1 = $__fZ0 * $__f2 + $fX * $__f2 ;finally, apply the z-axis rotation to obtain the point ($fXPos, $fYPos) $__f1 = $fRotZ * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fXPos = $__fX1 * $__f2 + $__fY1 * $__f3 $__fYPos = $__fY1 * $__f2 - $__fX1 * $__f3 $__fZPos = $__fZ0 EndFunc ;==>_3Dto2D Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 WinSetTitle($hGUI, "", $sTitle & $iShowFPS) EndFunc ;==>CalcFPS GDI+ ;coded by UEZ build 2017-01-17 #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $__f1, $__f2, $__f3, $__fY0, $__fZ0, $__fX1, $__fY1 Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = @DesktopWidth * 0.75, $iH = @DesktopHeight * 0.75, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ 3D Sinus Wave v1.0 coded by UEZ" Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi, $fPi2 = ACos(-1) * 2 AutoItSetOption("GUIOnEventMode", 1) GDIPlus_3DSinusWave() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_3DSinusWave() $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH) ;, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFFFFFFFF), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0808080), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16), _ $hPath = _GDIPlus_PathCreate(), _ $hPen = _GDIPlus_PenCreate(0xCF101010, 1.25) _GDIPlus_PenSetLineJoin($hPen, 2) ;~ _GDIPlus_PenSetDashCap($hPen, $GDIP_DASHCAPROUND) ;~ _GDIPlus_PenSetLineCap($hPen, 0x12, 0x12, 2) $iFPS = 0 Local $fEuler = 2.7182818284 Local $fSpace = 6, $iPoints = 16, $fSpace2 = $fSpace / 2, $iPoints2 = $iPoints / 2 Local $fRotX = Random(-360, 360), $fRotY = Random(-360, 360), $fRotZ = Random(-360, 360), $fZoom = 5.0, $fPower = 20.0 Local $fRx = Random(-1.5, 1,5), $fRy = Random(-1.5, 1,5), $fRz = Random(-1.5, 1,5) Local $c = 0, $t = 0, $aCoords[$iPoints ^ 2][3] Local $i, $j, $x, $y, $z, $x1, $y1, $z1, $x2, $y2, $z2, $x3, $y3, $z3, $fDistance, $r, $g, $b GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Do ;~ DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, _ ;~ "float", $iW, "float", $iH) ;erase canvas background _WinAPI_BitBlt($hDC_backbuffer, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $WHITENESS) $c = 0 For $i = 0 To $iPoints - 1 For $j = 0 To $iPoints - 1 $aCoords[$c][0] = ($fSpace * $i + $fSpace2 - $fSpace * $iPoints2) $aCoords[$c][1] = ($fSpace * $j + $fSpace2 - $fSpace * $iPoints2) $fDistance = Dist(0, 0, $aCoords[$c][0], $aCoords[$c][1]) $aCoords[$c][2] = $fEuler ^ (-$fDistance / 50) * Sin(($fDistance / 10) - $t) * $fPower $c += 1 $t += 0.00075 Next Next For $i = 0 To $iPoints - 2 For $j = 0 To $iPoints - 2 _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[$j + $iPoints * ($i + 1)][0], $aCoords[$j + $iPoints * ($i + 1)][1], $aCoords[$j + $iPoints * ($i + 1)][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $hCanvas, "handle", $hPen, _ "float", $iWh + $x1 * $fZoom, "float", $iHh + $y1 * $fZoom, "float", $iWh + $x2 * $fZoom, "float", $iHh + $y2 * $fZoom) _3Dto2D($aCoords[($j + 1) + $iPoints * $i][0], $aCoords[($j + 1) + $iPoints * $i][1], $aCoords[($j + 1) + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $hCanvas, "handle", $hPen, _ "float", $iWh + $x1 * $fZoom, "float", $iHh + $y1 * $fZoom, "float", $iWh + $x2 * $fZoom, "float", $iHh + $y2 * $fZoom) Next Next For $i = 0 To $iPoints - 2 _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[$j + $iPoints * ($i + 1)][0], $aCoords[$j + $iPoints * ($i + 1)][1], $aCoords[$j + $iPoints * ($i + 1)][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $hCanvas, "handle", $hPen, _ "float", $iWh + $x1 * $fZoom, "float", $iHh + $y1 * $fZoom, "float", $iWh + $x2 * $fZoom, "float", $iHh + $y2 * $fZoom) Next For $j = 0 To $iPoints - 2 _3Dto2D($aCoords[$j + $iPoints * $i][0], $aCoords[$j + $iPoints * $i][1], $aCoords[$j + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x1, $y1, $z1) _3Dto2D($aCoords[($j + 1) + $iPoints * $i][0], $aCoords[($j + 1) + $iPoints * $i][1], $aCoords[($j + 1) + $iPoints * $i][2], $fRotX, $fRotY, $fRotZ, $x2, $y2, $z2) DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $hCanvas, "handle", $hPen, _ "float", $iWh + $x1 * $fZoom, "float", $iHh + $y1 * $fZoom, "float", $iWh + $x2 * $fZoom, "float", $iHh + $y2 * $fZoom) Next $fRotX += $fRx $fRotY += $fRy $fRotZ += $fRz _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) ;draw background message text _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(10) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_PenDispose($hPen) _GDIPlus_PathDispose($hPath) _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) EndFunc ;==>GDIPlus_3DSinusWave Func Dist($x1, $y1, $x2, $y2) Return Sqrt(($x1 - $x2) * ($x1 - $x2) + ($y1 - $y2) * ($y1 - $y2)) EndFunc ;==>Dist Func _3Dto2D($fX, $fY, $fZ, $fRotX, $fRotY, $fRotZ, ByRef $__fXPos, ByRef $__fYPos, ByRef $__fZPos) ;apply the x-axis rotation to transform coordinates ($fX, $fY, $fZ) into coordinates ($fX0, $fY0, $fZ0) $__f1 = $fRotX * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fY0 = $fY * $__f2 + $fZ * $__f3 $__fZ0 = $fZ * $__f2 - $fY * $__f3 ;apply the y-axis rotation to ($fX0, $__fY0, $fZ0) to obtain ($__fX1, $__fY1, $fZ1) $__f1 = $fRotY * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fX1 = $fX * $__f2 - $__fZ0 * $__f3 $__fY1 = $__fY0 ;~ $__fZ1 = $__fZ0 * $__f2 + $fX * $__f2 ;finally, apply the z-axis rotation to obtain the point ($fXPos, $fYPos) $__f1 = $fRotZ * $fRad $__f2 = Cos($__f1) $__f3 = Sin($__f1) $__fXPos = $__fX1 * $__f2 + $__fY1 * $__f3 $__fYPos = $__fY1 * $__f2 - $__fX1 * $__f3 $__fZPos = $__fZ0 EndFunc ;==>_3Dto2D Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS In the attached 7-Zip file you can find the compiled and also a FreeBasic version. -> DL: 3D Sinus Wave.7z Have fun.1 point -
Here some useless graphical examples using GDI+, made for fun (my 1st GDI+ codes ): !Some examples may run slowly on WinXP machines (workaround in this thread)! Some examples using Hex() function need adjustment when running on AutoIt version 3.3.8.0+ otherwise colors are flashing (fixed versions in AiO package below)!!! #01 Flying Pearl Necklaces: Source code here (577 downloads previously)! Flying Pearl Necklaces.au3 #02 Flying Squares: Source code here (265 downloads previously)! Flying Squares.au3 #03 Rotating Squares: Source code here! Rotating_Squares.au3 #04 Plasma & Plasma Variant: Source codes here! Plasma: Plasma.au3 Plasma Variant: Plasma Variante.au3 #05 L-System Fractals: Source code here (382 downloads previously)! L-System Fractals.7z #06 Sinus Scroller: Source code here (218 downloads previously)! Sinus Scroller.au3 #07 Visualization: Analog Meter: download here (including source, needed files and compiled exe): Source code + needed files here (473 downloads previously)! Visualizer_Analog Meter.7z More GDI+ visualizations here by monoceres or by Eukalyptus Audio Visualization Collection (German site) #08 Particle Catapult: Source code here (70 downloads previously)! Particle_Catapult.au3 #09 Rotating Cube: Source code here (79 downloads previously)! Rotating_Cube.au3 #10 Simple Ball Collision Simulation: Source code here (35 downloads previously)! Simple_Ball_Collision_Simulation.au3 (it is not finished yet! look from time to time into this thread for an update! Nice tutorial here) #11 Particle Explosions: Source code here: Explosions__from_AutoIteroids_.au3 #12 Rotating Letters: Source codes here: Rotating Letters.au3 Transparent version (87 downloads previously): Rotating Letters Transparent.au3 #13 Rotating Cube 2: Source code here (53 downloads previously): Rotating Cube 2.au3 #14 Rotating Cube 2 with Textures: Source code here (68 downloads previously): Rotating Cube 2 + Textures.7z #15 Rotating Cube 2 with some examples from above on each surface: Source code here (55 downloads previously): Rotating Cube 2 + animated surfaces.7z #16 Rotating Cube 2 simple: Source code here: Rotating Cube 2 - Simple.au3 Or with background pic or Rotating Cube 2 simple + Background #17 Tramp of Particles: Source code here: Tramp of Particles.au3 #18 Twister: Source code here: Twister.au3 WinAPI version is 2.5x faster (look in AiO archive)! #19 Star Burst: Source code here: Star Burst.au3 #20 Warp Starfield: Source code here: Warp Starfield.au3 #21 Plasma 2: Source code here: Plasma 2.au3 #22 Isometric Level-3 Cube: Source code here: Isometric Level-3 Cube.au3 #23 Zoomer: Source code here (7 downloads previously): Zoomer.au3 GDIP.au3 needed for Zoomer! #24 Suspended Cloth Simulation: Source code here: Suspended Cloth Simulation.au3 #25 Visualizer: Oscilloscope Farbrausch: Source code here (30 downloads previously): Visualizer Oscilloscope Farbrausch.au3 To run Visualizer Oscilloscope Farbrausch.au3 properly you need following files: Bass.au3, BassExt.au3, Bass.dll and BassExt.dll. These files can be found in AiO package or on German AutoIt site! #26 Im- Exploding Particle Logo: Source code here: Im- Exploding Particle Logo.7z #27 Pixel Text Effect: Source code here (12 downloads previously): Pixel Text Effect.7z or with ♬chip sound♫ aka demo style (download from German AutoIt site or from AiO archive). #27 works best on Vista+ machines! #28 Star Wars Scroller: Source code here: Star Wars Scroller.au3 For a complete Star Wars Intro have a look to eukalyptus' Star-Wars Intro (see below!) #29 Rotated Letters Simple: Source code here: Rotated Letters Simple.au3 #30 Ballet of Letters: Source code here: Ballet of Letters.au3 #31 Perfect Illusion: Source code here: Perfect Illusion Variant 1.au3 Perfect Illusion Variant 2.au3 Perfect Illusion Variant 3.au3 Mesmerizing Squares Screensaver (previous downloads approx. 100): Mesmerizing_Squares_Screensaver.au3 (compiled version here): Don't stare too long on it or you will be mesmerized One more: Rotating triangle + vertical scroller + music (modification of monoceres' code): Magic Lines Screesaver (110 downloads previously): Magic Lines Screensaver.7z Another screensaver - 3D Star Scrolling Screensaver (83 downloads previously): GDI+ 3D Star Scrolling Screensaver.au3 !Some examples may run slowly on WinXP machines (workaround in this thread)! Some examples using Hex() function need adjustment when running on AutoIt version 3.3.8.0+ otherwise colors are flashing (fixed versions in AiO package below)!!! AiO download link ☞ AiO1 or AiO2 ☜ (all examples above compiled + source codes packed with 7-Zip) Have a look also to the game I made using GDI+: Link: AUTOITEROIDS v1.018 Build 2011-06-09 (Final) (a clone of the game Asteroids made by Atari 1979) I hope you like it! Any kind of comment is welcome!!! My examples are all done with AutoIt v3.3.0.0 on Vista x32! Kudos to: monoceres, smashly, malkey, Eukalyptus and Authenticity! Check out Some Graphical Examples using GDI+ Vol. II build 2016-01-25 More examples made by other members in this thread (thanks you very much!): Spinning Flying Pearl Necklaces by smashly: Spinning Flying Squares by smashly and ProgAndy LMP Visualization by youknowwho4eva: SineWorm by monoceres: Enterprise Warp by youknowwho4eva: Confused ASCII by monoceres: Lissajous Curve by monoceres: Butterfly Curve by monoceres: ParticleCollisionFun2 by crashdemons: Extreme nice physic engine by moritz1243 (German site): Lingering Line by MvGulik: Scroller Sine Blobs by Lakes: Cube surface and 3D axis and by Lakes: by eukalyptus: by eukalyptus: Two more examples by eukalyptus: and FEEL FREE TO POST YOUR GDI+ EXAMPLES HERE,TOO!!! Have fun and regards, UEZ ✌ PS: more modified examples also here in this topic History of my useless scripts above:1 point