Leaderboard
Popular Content
Showing content with the highest reputation on 07/12/2015 in all areas
-
2 points
-
Added a "Post #" indicator at the top right of a post as I know some people like saying "look at post #4" rather than linking.2 points
-
Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^1 point
-
JSONgen: JSON generator
argumentum reacted to guinness for a topic
The help file explains it quite well under Dim.1 point -
This is the way I would implement rectangle collision detection. I have changed the strategy a little bit. Instead of using the midpoint for collision detection I'm using upper/left corner. But I'm still only using one point. When you divide by two to calculate the midpoint, you have to deal with half pixels every second time. Half a pixel is not a good thing. Using upper/left corner all calculations are simple integer calculations. Using upper/left corner the dotted rectangle to test collisions looks like this: And this is the example code to illustrate the method: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> AutoItSetOption( "GUIOnEventMode", 1 ) AutoItSetOption( "MouseCoordMode", 2 ) ; Relative to window AutoItSetOption( "MustDeclareVars", 1 ) AutoItSetOption( "WinWaitDelay", 10 ) ; Only used to draw debug info Global Const $iTitleBarHeight = 30 Global Const $iBorderWidth = _WinAPI_GetSystemMetrics( $SM_CXFRAME ) Global $hGui, $iGuiWidth, $iGuiHeight, $aInfo, $fRedraw = False Global $idGuiMenuItem0, $idGuiMenuItem1, $idGuiMenuItem2, $idGuiMenuItem3, $idGuiMenuItem4, _ $idGuiMenuItem5, $idGuiMenuItem6, $idGuiMenuItem7, $idGuiMenuItem8, $idGuiMenuItem9 ; Information about the rectangles Global $aRects[1000][8], $iRects = 0 ; 0: $idLabel ; 1 - 4: $x, $y, $w, $h ; Pos, size ; 5 - 6: $wx, $wy ; Window collision boundaries ; 7: $iColor Example() Func Example() ; Create GUI $hGui = GUICreate( "Rectangle collision detection", 800, 600, -1, -1, $WS_OVERLAPPEDWINDOW - $WS_MAXIMIZEBOX + $WS_CLIPCHILDREN ) GUISetOnEvent( $GUI_EVENT_RESIZED, "Resized" ) GUISetOnEvent( $GUI_EVENT_CLOSE, "Close" ) ; Window context menu Local $idGuiMenu = GUICtrlCreateContextMenu() $idGuiMenuItem0 = GUICtrlCreateMenuItem( "Create rectangle", $idGuiMenu ) $idGuiMenuItem1 = GUICtrlCreateMenuItem( "Create 5 rects", $idGuiMenu ) $idGuiMenuItem2 = GUICtrlCreateMenuItem( "Create 10 rects", $idGuiMenu ) $idGuiMenuItem3 = GUICtrlCreateMenuItem( "Create 20 rects", $idGuiMenu ) $idGuiMenuItem4 = GUICtrlCreateMenuItem( "Create 30 rects", $idGuiMenu ) $idGuiMenuItem5 = GUICtrlCreateMenuItem( "Create 40 rects", $idGuiMenu ) $idGuiMenuItem6 = GUICtrlCreateMenuItem( "Create 50 rects", $idGuiMenu ) $idGuiMenuItem7 = GUICtrlCreateMenuItem( "Create 100 rects", $idGuiMenu ) $idGuiMenuItem8 = GUICtrlCreateMenuItem( "Create 1000 rects", $idGuiMenu ) $idGuiMenuItem9 = GUICtrlCreateMenuItem( "Delete all rectangles", $idGuiMenu ) GUICtrlSetOnEvent( $idGuiMenuItem0, "CreateRectangle" ) GUICtrlSetOnEvent( $idGuiMenuItem1, "CreateMultipleRects" ) GUICtrlSetOnEvent( $idGuiMenuItem2, "CreateMultipleRects" ) GUICtrlSetOnEvent( $idGuiMenuItem3, "CreateMultipleRects" ) GUICtrlSetOnEvent( $idGuiMenuItem4, "CreateMultipleRects" ) GUICtrlSetOnEvent( $idGuiMenuItem5, "CreateMultipleRects" ) GUICtrlSetOnEvent( $idGuiMenuItem6, "CreateMultipleRects" ) GUICtrlSetOnEvent( $idGuiMenuItem7, "CreateMultipleRects" ) GUICtrlSetOnEvent( $idGuiMenuItem8, "CreateMultipleRects" ) GUICtrlSetOnEvent( $idGuiMenuItem9, "DeleteAllRects" ) ; Window size Local $aSize = WinGetClientSize( $hGui ) $iGuiWidth = $aSize[0] $iGuiHeight = $aSize[1] ; Show GUI GUISetState() MsgBox( 0, "Rectangle collision detection", _ "Secondary click to open context menu with items to create rectangles (random colored labels)." & @CRLF & _ "Click and drag with primary mouse button to define size of rectangle (limited to 4x4 - 200x200)." & @CRLF & @CRLF & _ "Click and drag a rectangle with primary mouse button to check collisions against window borders" & @CRLF & _ "and stationary rectangles." & @CRLF & @CRLF & _ "Secondary click a rectangle to open context menu to draw lines that shows collision boundaries." & @CRLF & _ "Collisions against window borders and stationary rectangles are detected with moving rectangle" & @CRLF & _ "upper/left corner. Click in free area to erase the red dotted lines that shows collision boundaries.", 0, $hGui ) Local $idLabel, $iCurRect, $aDotRects[1000][4] While 1 ; Wait for primary mouse click $aInfo = GUIGetCursorInfo() While Sleep(10) And IsArray( $aInfo ) And Not $aInfo[2] $aInfo = GUIGetCursorInfo() WEnd If Not IsArray( $aInfo ) Then ContinueLoop ; Redraw window? ; (Erase dotted rectangles) If $fRedraw Then ; Erase dotted rectangles _WinAPI_RedrawWindow( $hGui, 0, 0, $RDW_INVALIDATE + $RDW_ERASE ) ; Repaint labels For $i = 0 To $iRects - 1 GUICtrlSetState( $aRects[$i][0], $GUI_HIDE ) ; Force a label repaint GUICtrlSetState( $aRects[$i][0], $GUI_SHOW ) Next $fRedraw = False EndIf ; Current label $idLabel = $aInfo[4] If Not $idLabel Then ContinueLoop ; Current rectangle (moving rectangle) $iCurRect = ( $idLabel - $aRects[0][0] ) / 5 ConsoleWrite( "Current rectangle: " & $iCurRect & @CRLF ) ; Calculate boundaries (red dotted lines) for all stationary rectangles to detect collisions. ; Collisions against stationary rectangles are detected with moving rectangle upper/left corner. Local $iStatRects = 0, $j = 0 For $i = 0 To $iRects - 1 If $i = $iCurRect Then ContinueLoop $aDotRects[$j][0] = $aRects[$i][1] - $aRects[$iCurRect][3] ; $x1 $aDotRects[$j][1] = $aRects[$i][2] - $aRects[$iCurRect][4] ; $y1 $aDotRects[$j][2] = $aRects[$i][1] + $aRects[$i][3] ; $x2 $aDotRects[$j][3] = $aRects[$i][2] + $aRects[$i][4] ; $y2 $j += 1 Next $iStatRects = $j ; Calculate boundaries (red dotted lines) to detect collisions against window edges. ; Collisions against window edges are detected with moving rectangle upper/left corner. Local $wx = $aRects[$iCurRect][5] + 2, $wy = $aRects[$iCurRect][6] + 2 ; Variables to calculate upper/left corner ($x,$y) of moving rectangle Local $x0 = $aInfo[0], $y0 = $aInfo[1], $x, $y Local $x1 = $aRects[$iCurRect][1] - $x0, $y1 = $aRects[$iCurRect][2] - $y0 ; Variables for collision action (flashing black/white rectangle) Local $hTimer = 0, $iCollRect, $idLblCollision, $idLblColor, $iColor = 0xFFFFFF ; Move current rectangle While $aInfo[2] $aInfo = GUIGetCursorInfo() $x = $x1 + $aInfo[0] $y = $y1 + $aInfo[1] ; Collision against window edges? ; (Collision if upper/left corner of moving rectangle ($x,$y) is outside the (0,0,$wx,$wy) rectangle) If Not ( 0 <= $x And $x < $wx And 0 <= $y And $y < $wy ) Then ContinueLoop ; Collision against stationary rectangles? ; (Collision if upper/left corner of moving rectangle ($x,$y) is inside the $aDotRects rectangles) For $i = 0 To $iStatRects - 1 If $aDotRects[$i][0] < $x And $x < $aDotRects[$i][2] And $aDotRects[$i][1] < $y And $y < $aDotRects[$i][3] Then ExitLoop Next If $i < $iStatRects Then ; Collision ($i < $iStatRects => ExitLoop has been executed) If Not $hTimer Then ; Information about the collision $iCollRect = $i < $iCurRect ? $i : $i + 1 CollisionInfo( $x, $y, $iCurRect, $iCollRect ) ; Start collision action (flashing rectangle) $idLblCollision = $aRects[$iCollRect][0] $idLblColor = $aRects[$iCollRect][7] GUICtrlSetBkColor( $idLblCollision, $iColor ) GUICtrlSetState( $idLblCollision, $GUI_HIDE ) ; Force a label repaint GUICtrlSetState( $idLblCollision, $GUI_SHOW ) $iColor = $iColor ? 0x000000 : 0xFFFFFF $hTimer = TimerInit() ElseIf TimerDiff( $hTimer ) > 200 Then ; Continue flashing the rectangle GUICtrlSetBkColor( $idLblCollision, $iColor ) GUICtrlSetState( $idLblCollision, $GUI_HIDE ) ; Force a label repaint GUICtrlSetState( $idLblCollision, $GUI_SHOW ) $iColor = $iColor ? 0x000000 : 0xFFFFFF $hTimer = TimerInit() EndIf ; Add code to execute on collision here ;ContinueLoop ; Skip GUICtrlSetPos below ElseIf $hTimer Then ; No collision ; If collision action is started then stop it $hTimer = 0 GUICtrlSetBkColor( $idLblCollision, $idLblColor ) GUICtrlSetState( $idLblCollision, $GUI_HIDE ) ; Flashing rectangle GUICtrlSetState( $idLblCollision, $GUI_SHOW ) ; Force a label repaint GUICtrlSetBkColor( $idLabel, $aRects[$iCurRect][7] ) ; Moving rectangle GUICtrlSetState( $idLabel, $GUI_HIDE ) ; Force a label repaint GUICtrlSetState( $idLabel, $GUI_SHOW ) EndIf ; Set new position of current rectangle GUICtrlSetPos( $idLabel, $x, $y ) WEnd ; Store new position of current rectangle $aRects[$iCurRect][1] += $aInfo[0] - $x0 $aRects[$iCurRect][2] += $aInfo[1] - $y0 WEnd EndFunc Func CollisionInfo( $x, $y, $iCurRect, $iCollRect ) ConsoleWrite( "Collision against rect: " & $iCollRect & @CRLF ) Select Case $x + $aRects[$iCurRect][3] - $aRects[$iCollRect][1] < 4 ; Left edge Select Case $y + $aRects[$iCurRect][4] - $aRects[$iCollRect][2] < 4 ; Upper edge ConsoleWrite( " At upper/left corner" & @CRLF ) Case $aRects[$iCollRect][2] + $aRects[$iCollRect][4] - $y < 4 ; Lower edge ConsoleWrite( " At lower/left corner" & @CRLF ) Case Else ConsoleWrite( " At left edge" & @CRLF ) EndSelect Case $y + $aRects[$iCurRect][4] - $aRects[$iCollRect][2] < 4 ; Upper edge Select Case $x + $aRects[$iCurRect][3] - $aRects[$iCollRect][1] < 4 ; Left edge ConsoleWrite( " At upper/left corner" & @CRLF ) Case $aRects[$iCollRect][1] + $aRects[$iCollRect][3] - $x < 4 ; Right edge ConsoleWrite( " At upper/right corner" & @CRLF ) Case Else ConsoleWrite( " At upper edge" & @CRLF ) EndSelect Case $aRects[$iCollRect][1] + $aRects[$iCollRect][3] - $x < 4 ; Right edge Select Case $y + $aRects[$iCurRect][4] - $aRects[$iCollRect][2] < 4 ; Upper edge ConsoleWrite( " At upper/right corner" & @CRLF ) Case $aRects[$iCollRect][2] + $aRects[$iCollRect][4] - $y < 4 ; Lower edge ConsoleWrite( " At lower/right corner" & @CRLF ) Case Else ConsoleWrite( " At right edge" & @CRLF ) EndSelect Case $aRects[$iCollRect][2] + $aRects[$iCollRect][4] - $y < 4 ; Lower edge Select Case $x + $aRects[$iCurRect][3] - $aRects[$iCollRect][1] < 4 ; Left edge ConsoleWrite( " At lower/left corner" & @CRLF ) Case $aRects[$iCollRect][1] + $aRects[$iCollRect][3] - $x < 4 ; Right edge ConsoleWrite( " At lower/right corner" & @CRLF ) Case Else ConsoleWrite( " At lower edge" & @CRLF ) EndSelect EndSelect EndFunc Func CreateRectangle() If $fRedraw Then ; Erase red dotted rectangles if any exists _WinAPI_RedrawWindow( $hGui, 0, 0, $RDW_INVALIDATE + $RDW_ERASE ) $fRedraw = False EndIf ; Wait max. 2 seconds to start rectangle creation WinSetTitle( $hGui, "", "Click and drag rectangle with primary mouse button" ) Local $iWait = 0 While Sleep(10) $iWait += 1 If $iWait = 200 Then WinSetTitle( $hGui, "", "Rectangle collision detection" ) Return EndIf If GUIGetCursorInfo()[2] Then ExitLoop WEnd WinSetTitle( $hGui, "", "Rectangle collision detection" ) ; Create rectangle (label control) Local $aInfo = GUIGetCursorInfo(), $x = $aInfo[0], $y = $aInfo[1], $w = 0, $h = 0, $dw, $dh Local $iColor = Random(0,255,1)*256*256 + Random(0,255,1)*256 + Random(0,255,1) Local $idLabel = GUICtrlCreateLabel( "", $x, $y, $w, $h ) GUICtrlSetResizing( $idLabel, $GUI_DOCKALL ) GUICtrlSetBkColor( $idLabel, $iColor ) ; Drag with mouse to define rectangle size until it's at least 4x4 pixels While $aInfo[2] And ( $dw < 4 Or $dh < 4 ) $aInfo = GUIGetCursorInfo() $dw = $aInfo[0] - $x $dh = $aInfo[1] - $y If $dw < 200 Then $w = $dw If $dh < 200 Then $h = $dh GUICtrlSetPos( $idLabel, $x, $y, $w, $h ) Sleep(10) WEnd ; Drag with mouse to define rectangle size between 4x4 and 200x200 pixels While $aInfo[2] $aInfo = GUIGetCursorInfo() $dw = $aInfo[0] - $x $dh = $aInfo[1] - $y If 4 < $dw And $dw < 200 Then $w = $dw If 4 < $dh And $dh < 200 Then $h = $dh GUICtrlSetPos( $idLabel, $x, $y, $w, $h ) Sleep(10) WEnd ; Cancel if not rectangle size is between 4x4 and 200x200 pixels If Not ( 4 < $w And $w < 200 And 4 < $h And $h < 200 And $iRects < 100 ) Then GUICtrlDelete( $idLabel ) Return EndIf ; Create and store rectangle info in $aRects CreateRectInfo( $x, $y, $w, $h, $idLabel, $iColor ) EndFunc Func CreateMultipleRects() If $fRedraw Then ; Erase red dotted rectangles if any exists _WinAPI_RedrawWindow( $hGui, 0, 0, $RDW_INVALIDATE + $RDW_ERASE ) $fRedraw = False EndIf ; Delete all rectangles DeleteAllRects() ; Number of rectangles Local $n, $hw = 200 Switch @GUI_CtrlId Case $idGuiMenuItem1 $n = 5 Case $idGuiMenuItem2 $n = 10 Case $idGuiMenuItem3 $n = 20 Case $idGuiMenuItem4 $n = 30 Case $idGuiMenuItem5 $n = 40 Case $idGuiMenuItem6 $n = 50 Case $idGuiMenuItem7 $n = 100 $hw = 100 Case $idGuiMenuItem8 $n = 1000 $hw = 20 EndSwitch ; Create rectangles Local $x = 10, $y = 10, $yMax = 0, $w, $h For $i = 0 To $n - 1 ; Rectangle width/height $w = Random(4,$hw,1) $h = Random(4,$hw,1) If $x + $w > $iGuiWidth Then ; New row of rectangles $x = 10 $y = $yMax + 10 EndIf If $y + $h > $iGuiHeight Then ; Cancel if GUI too small for all rectangles ConsoleWrite( "Created rectangles: " & $i & @CRLF ) Return EndIf ; Create rectangle Local $iColor = Random(0,255,1)*256*256 + Random(0,255,1)*256 + Random(0,255,1) Local $idLabel = GUICtrlCreateLabel( "", $x, $y, $w, $h ) GUICtrlSetResizing( $idLabel, $GUI_DOCKALL ) GUICtrlSetBkColor( $idLabel, $iColor ) CreateRectInfo( $x, $y, $w, $h, $idLabel, $iColor ) GUICtrlSetState( $idLabel, $GUI_HIDE ) ; Force a label repaint GUICtrlSetState( $idLabel, $GUI_SHOW ) ; Update $yMax and $x If $y + $h > $yMax Then $yMax = $y + $h $x += $w + 10 Next ConsoleWrite( "Created rectangles: " & $n & @CRLF ) EndFunc ; Create and store rectangle info in $aRects Func CreateRectInfo( $x, $y, $w, $h, $idLabel, $iColor ) Local $idMenu = GUICtrlCreateContextMenu( $idLabel ) ; Debug menu Local $idMenuItem1 = GUICtrlCreateMenuItem( "Rectangle information", $idMenu ) Local $idMenuItem2 = GUICtrlCreateMenuItem( "Window collision boundaries", $idMenu ) Local $idMenuItem3 = GUICtrlCreateMenuItem( "Rectangles collision boundaries", $idMenu ) GUICtrlSetOnEvent( $idMenuItem1, "RectangleInformation" ) GUICtrlSetOnEvent( $idMenuItem2, "DrawWinCollisionBounds" ) GUICtrlSetOnEvent( $idMenuItem3, "DrawRectsCollisionBounds" ) $aRects[$iRects][0] = $idLabel $aRects[$iRects][1] = $x ; Pos $aRects[$iRects][2] = $y $aRects[$iRects][3] = $w ; Size $aRects[$iRects][4] = $h $aRects[$iRects][5] = $iGuiWidth - $w ; Window collision boundaries $aRects[$iRects][6] = $iGuiHeight - $h $aRects[$iRects][7] = $iColor $iRects += 1 EndFunc Func DeleteAllRects() For $i = 0 To $iRects - 1 GUICtrlDelete( $aRects[$i][0] ) ; $idLabel GUICtrlDelete( $aRects[$i][0]+1 ) ; $idMenu GUICtrlDelete( $aRects[$i][0]+2 ) ; $idMenuItem1 GUICtrlDelete( $aRects[$i][0]+3 ) ; $idMenuItem2 GUICtrlDelete( $aRects[$i][0]+4 ) ; $idMenuItem3 Next $iRects = 0 EndFunc ; If the window is resized, the col- ; lision boundaries must be recalculated. Func Resized() Local $aSize = WinGetClientSize( $hGui ) $iGuiWidth = $aSize[0] $iGuiHeight = $aSize[1] For $i = 0 To $iRects - 1 $aRects[$i][5] = $iGuiWidth - $aRects[$i][3] ; Window collision boundaries $aRects[$i][6] = $iGuiHeight - $aRects[$i][4] Next EndFunc Func Close() GUIDelete() Exit EndFunc ; --- Debug functions -------------------------------------------------------------------------------------------------- ; Rectangle information in SciTE console Func RectangleInformation() If Not $aInfo[4] Then Return ; $idLabel (current rectangle) Local $iCurRect = ( $aInfo[4] - $aRects[0][0] ) / 5 ; Current rectangle as index in $aRects If $fRedraw Then _WinAPI_RedrawWindow( $hGui, 0, 0, $RDW_INVALIDATE + $RDW_ERASE ) ; Erase previous red dotted rectangles ConsoleWrite( "Current rectangle: " & $iCurRect & @CRLF ) ConsoleWrite( " $idLabel: " & $aRects[$iCurRect][0] & @CRLF ) ConsoleWrite( " ($x,$y): (" & $aRects[$iCurRect][1] & "," & $aRects[$iCurRect][2] & ")" & @CRLF ) ConsoleWrite( " ($w,$h): (" & $aRects[$iCurRect][3] & "," & $aRects[$iCurRect][4] & ")" & @CRLF ) ConsoleWrite( " $iColor: " & "0x" & Hex( $aRects[$iCurRect][7], 6 ) & @CRLF ) $fRedraw = False EndFunc ; Draw red dotted lines that shows the ; collision boundaries to the window edges. Func DrawWinCollisionBounds() If Not $aInfo[4] Then Return ; $idLabel (current rectangle) Local $iCurRect = ( $aInfo[4] - $aRects[0][0] ) / 5 ; Current rectangle as index in $aRects If $fRedraw Then _WinAPI_RedrawWindow( $hGui, 0, 0, $RDW_INVALIDATE + $RDW_ERASE ) ; Erase previous red dotted rectangles DrawRedDottedRect( 0, 0, $aRects[$iCurRect][5], $aRects[$iCurRect][6] ) ; 0, 0, $wx, $wy EndFunc ; Draw red dotted lines that shows the ; collision boundaries to other rectangles. Func DrawRectsCollisionBounds() If Not $aInfo[4] Then Return ; $idLabel (current rectangle) Local $iCurRect = ( $aInfo[4] - $aRects[0][0] ) / 5 ; Current rectangle as index in $aRects If $fRedraw Then _WinAPI_RedrawWindow( $hGui, 0, 0, $RDW_INVALIDATE + $RDW_ERASE ) ; Erase previous red dotted rectangles For $i = 0 To $iRects - 1 If $i = $iCurRect Then ContinueLoop DrawRedDottedRect( $aRects[$i][1] - $aRects[$iCurRect][3], _ ; $x1 $aRects[$i][2] - $aRects[$iCurRect][4], _ ; $y1 $aRects[$i][1] + $aRects[$i][3], _ ; $x2 $aRects[$i][2] + $aRects[$i][4] ) ; $y2 Next EndFunc Func DrawRedDottedRect( $p1x, $p1y, $p2x, $p2y ) Local $x1 = $p1x + $iBorderWidth - 1, $y1 = $p1y + $iTitleBarHeight - 1, $x2 = $p2x + $iBorderWidth, $y2 = $p2y + $iTitleBarHeight Local $hDC = _WinAPI_GetWindowDC( $hGui ), $hPen = _WinAPI_CreatePen( $PS_DOT, 1, 0x0000FF ), $hObj = _WinAPI_SelectObject( $hDC, $hPen ) _WinAPI_DrawLine( $hDC, $x1, $y1, $x2, $y1 ) _WinAPI_DrawLine( $hDC, $x2, $y1, $x2, $y2 ) _WinAPI_DrawLine( $hDC, $x2, $y2, $x1, $y2 ) _WinAPI_DrawLine( $hDC, $x1, $y2, $x1, $y1 ) _WinAPI_SelectObject( $hDC, $hObj ) _WinAPI_DeleteObject( $hPen ) _WinAPI_ReleaseDC( $hGui, $hDC ) $fRedraw = True EndFunc Secondary click in window to create rectangles. Secondary click a rectangle to draw red dotted collision boundaries. Primary click and drag to move a rectangle. The loop to test collisions with the moving rectangle against the stationary rectangles is very simple and very fast: ; Collision against stationary rectangles? ; (Collision if upper/left corner of moving rectangle ($x,$y) is inside the $aDotRects rectangles) For $i = 0 To $iStatRects - 1 If $aDotRects[$i][0] < $x And $x < $aDotRects[$i][2] And $aDotRects[$i][1] < $y And $y < $aDotRects[$i][3] Then ExitLoop Next On my old XP i can test collisions against 1000 stationary rectangles in about 2.5 milliseconds.1 point
-
SciTE Customization GUI -- [03/04/2017]
UEZ reacted to jaberwacky for a topic
Updated! See OP for details.1 point -
1 point