Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GUIConstantsEx.au3>
- #include <S3d.au3>
- Main()
- Func Main()
- ; Create a window and initialize GDI+
- Local $hGUI = GUICreate("0", 650, 550)
- GUISetState()
- _GDIPlus_Startup()
- Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
- Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics(650, 550, $hGraphics)
- Local $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
- ; Select a Graphic object
- ; width = 650, height = 550
- _S3d_SelectGraphic($hGraphic, 650, 550)
- Local $hPenB = _GDIPlus_PenCreate(0xAA0044FF, 2)
- Local $hPenR = _GDIPlus_PenCreate(0xAAFF6633, 3)
- Local $i = 0, $j, $iCol = 0
- Local $aPos[3] = [0, 0, 0], $aV[3] = [3, 4, 6], $iSize = 40
- ; Loop until user exits
- Do
- ; Clear the Graphics object
- _S3d_Clear(0xFFFFFFFF)
- ; Set camera
- _S3d_SetCamera(350 * Cos($i), 350 * Sin($i), 150, 0, 0, 0)
- ; Select a pen obiect
- _S3d_SelectPen($hPenB)
- ; Draw cube
- _S3d_Box(-100, -100, -100, 100, 100, 100)
- ; Select a pen obiect
- _S3d_SelectPen($hPenR)
- ; Draw cube
- _S3d_Box($aPos[0], $aPos[1], $aPos[2], $aPos[0] + $iSize, $aPos[1] + $iSize, $aPos[2] + $iSize)
- For $j = 0 To 2
- If $aPos[$j] <= -100 Or 100 <= $aPos[$j] + $iSize Then
- $aV[$j] *= -1
- $iCol += 1
- WinSetTitle($hGUI, "", $iCol)
- EndIf
- $aPos[$j] += $aV[$j]
- Next
- ; Copy to the window
- _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
- $i += 0.02
- Sleep(40)
- Until GUIGetMsg() = $GUI_EVENT_CLOSE
- ; Clean up resources
- _GDIPlus_PenDispose($hPenB)
- _GDIPlus_PenDispose($hPenR)
- _GDIPlus_GraphicsDispose($hGraphic)
- _GDIPlus_BitmapDispose($hBitmap)
- _GDIPlus_GraphicsDispose($hGraphics)
- _GDIPlus_Shutdown()
- GUIDelete($hGUI)
- EndFunc ;==>Main
Advertisement
Add Comment
Please, Sign In to add comment