#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include "./include/2d.au3"
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
Global $gui
Enum $MODE_BOULE, $MODE_VAGUE
Global $YMAX = 11
Global $XMAX = 11
Global $offset = 30
Global $pi = 3.1415926535897932384626433
Global $losangeWidth = 30
Global $losangeHeight = $losangeWidth / 2
Global $taille[2] = [($XMAX + $YMAX + 1) * $losangeWidth/2 , ($XMAX + $YMAX + 1) * $losangeWidth/2 + 100]
Global $hBackbuffer = _createCanvas($taille[0], $taille[1])
GUISetOnEvent($GUI_EVENT_CLOSE, quit, $2d_Gui)
Global $brushTop = _GDIPlus_BrushCreateSolid(0xFF76AAAC)
Global $brushLeft = _GDIPlus_BrushCreateSolid(0xFF344B7A)
Global $brushRight = _GDIPlus_BrushCreateSolid(0xFFE3DBA4)
Global $whiteBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
Global $pos = 0
OnAutoItExitRegister(_freeRessources)
OnAutoItExitRegister(freeRessources)
While 1
loop($MODE_BOULE)
WEnd
Func loop($mode)
_GDIPlus_GraphicsFillRect($hBackbuffer, 0, 0, $taille[0], $taille[1], $whiteBrush)
For $yy = 0 To $YMAX - 1
For $xx = 0 To $XMAX - 1
Local $x = $taille[0] / 2 + ($xx - ($XMAX+2) / 2) * $losangeWidth / 2 - ($yy - ($YMAX) / 2) * $losangeWidth / 2
Local $y = $taille[1] / 2 + ($xx - ($XMAX) / 2) * $losangeHeight / 2 + ($yy - ($YMAX-1) / 2) * $losangeHeight / 2
Local $distX
Local $distY
If($mode = $MODE_BOULE) Then
$distX = ($xx - Ceiling(($XMAX - 1) / 2))
$distY = ($yy - Ceiling(($YMAX - 1) / 2))
ElseIf($mode = $MODE_VAGUE) Then
$distX = (($XMAX - $xx) / 2)
$distY = (($YMAX - $yy) / 2)
EndIf
Local $distCenter = Sqrt($distX * $distX + $distY * $distY)
If ($distCenter == 0) Then $distCenter = 0.9
Local $calc = $pos / 6 + ($distCenter) / ($XMAX - 1) * $pi * $pi
Local $sinpos = Sin($calc)
Local $ecart = $offset + ($sinpos + 1) * 50
Local $size = 2 * $ecart
If($mode == $MODE_BOULE) Then
$size = 2 * $ecart
ElseIf($mode == $MODE_VAGUE) Then
$size = $offset + 50
EndIf
drawBar($x, $y - $ecart, $losangeWidth, $losangeHeight, $size)
Next
Next
$pos -= 1
_show()
Sleep(1)
EndFunc
Func drawBar($x, $y, $width, $height, $size)
drawLosange($x, $y, $width, $height)
Local $points[5][2]
$points[0][0] = 4
$points[1][0] = $x
$points[1][1] = $y + $height / 2
$points[2][0] = $x + $width / 2
$points[2][1] = $y + $height
$points[3][0] = $x + $width / 2
$points[3][1] = $y + $size + $height / 2
$points[4][0] = $x
$points[4][1] = $y + $size
_GDIPlus_GraphicsFillPolygon($hBackbuffer, $points, $brushLeft)
;~ _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $points)
$points[1][0] = $x + $width
$points[1][1] = $y + $height / 2
$points[2][0] = $x + $width / 2
$points[2][1] = $y + $height
$points[3][0] = $x + $width / 2
$points[3][1] = $y + $size + $height / 2
$points[4][0] = $x + $width
$points[4][1] = $y + $size
_GDIPlus_GraphicsFillPolygon($hBackbuffer, $points, $brushRight)
;~ _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $points)
EndFunc
Func drawRectangle($x, $y, $width, $height)
_GDIPlus_GraphicsFillRect($hBackbuffer, $x, $y, $width, $height, $brushTop)
;~ _GDIPlus_GraphicsDrawRect($hBackbuffer, $x, $y, $width, $height)
EndFunc
Func drawLosange($x, $y, $width, $height)
Local $points[5][2]
$points[0][0] = 4
$points[1][0] = $x
$points[1][1] = $y + $height / 2
$points[2][0] = $x + $width / 2
$points[2][1] = $y
$points[3][0] = $x + $width
$points[3][1] = $y + $height / 2
$points[4][0] = $x + $width / 2
$points[4][1] = $y + $height
_GDIPlus_GraphicsFillPolygon($hBackbuffer, $points, $brushTop)
;~ _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $points)
EndFunc
Func quit()
Exit
EndFunc
Func freeRessources()
_GDIPlus_BrushDispose($brushTop)
_GDIPlus_BrushDispose($brushLeft)
_GDIPlus_BrushDispose($brushRight)
_GDIPlus_BrushDispose($whiteBrush)
EndFunc
#include <GUIConstantsEx.au3>
#include "./include/2d.au3"
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
Global $gui
Enum $MODE_BOULE, $MODE_VAGUE
Global $YMAX = 11
Global $XMAX = 11
Global $offset = 30
Global $pi = 3.1415926535897932384626433
Global $losangeWidth = 30
Global $losangeHeight = $losangeWidth / 2
Global $taille[2] = [($XMAX + $YMAX + 1) * $losangeWidth/2 , ($XMAX + $YMAX + 1) * $losangeWidth/2 + 100]
Global $hBackbuffer = _createCanvas($taille[0], $taille[1])
GUISetOnEvent($GUI_EVENT_CLOSE, quit, $2d_Gui)
Global $brushTop = _GDIPlus_BrushCreateSolid(0xFF76AAAC)
Global $brushLeft = _GDIPlus_BrushCreateSolid(0xFF344B7A)
Global $brushRight = _GDIPlus_BrushCreateSolid(0xFFE3DBA4)
Global $whiteBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
Global $pos = 0
OnAutoItExitRegister(_freeRessources)
OnAutoItExitRegister(freeRessources)
While 1
loop($MODE_BOULE)
WEnd
Func loop($mode)
_GDIPlus_GraphicsFillRect($hBackbuffer, 0, 0, $taille[0], $taille[1], $whiteBrush)
For $yy = 0 To $YMAX - 1
For $xx = 0 To $XMAX - 1
Local $x = $taille[0] / 2 + ($xx - ($XMAX+2) / 2) * $losangeWidth / 2 - ($yy - ($YMAX) / 2) * $losangeWidth / 2
Local $y = $taille[1] / 2 + ($xx - ($XMAX) / 2) * $losangeHeight / 2 + ($yy - ($YMAX-1) / 2) * $losangeHeight / 2
Local $distX
Local $distY
If($mode = $MODE_BOULE) Then
$distX = ($xx - Ceiling(($XMAX - 1) / 2))
$distY = ($yy - Ceiling(($YMAX - 1) / 2))
ElseIf($mode = $MODE_VAGUE) Then
$distX = (($XMAX - $xx) / 2)
$distY = (($YMAX - $yy) / 2)
EndIf
Local $distCenter = Sqrt($distX * $distX + $distY * $distY)
If ($distCenter == 0) Then $distCenter = 0.9
Local $calc = $pos / 6 + ($distCenter) / ($XMAX - 1) * $pi * $pi
Local $sinpos = Sin($calc)
Local $ecart = $offset + ($sinpos + 1) * 50
Local $size = 2 * $ecart
If($mode == $MODE_BOULE) Then
$size = 2 * $ecart
ElseIf($mode == $MODE_VAGUE) Then
$size = $offset + 50
EndIf
drawBar($x, $y - $ecart, $losangeWidth, $losangeHeight, $size)
Next
Next
$pos -= 1
_show()
Sleep(1)
EndFunc
Func drawBar($x, $y, $width, $height, $size)
drawLosange($x, $y, $width, $height)
Local $points[5][2]
$points[0][0] = 4
$points[1][0] = $x
$points[1][1] = $y + $height / 2
$points[2][0] = $x + $width / 2
$points[2][1] = $y + $height
$points[3][0] = $x + $width / 2
$points[3][1] = $y + $size + $height / 2
$points[4][0] = $x
$points[4][1] = $y + $size
_GDIPlus_GraphicsFillPolygon($hBackbuffer, $points, $brushLeft)
;~ _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $points)
$points[1][0] = $x + $width
$points[1][1] = $y + $height / 2
$points[2][0] = $x + $width / 2
$points[2][1] = $y + $height
$points[3][0] = $x + $width / 2
$points[3][1] = $y + $size + $height / 2
$points[4][0] = $x + $width
$points[4][1] = $y + $size
_GDIPlus_GraphicsFillPolygon($hBackbuffer, $points, $brushRight)
;~ _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $points)
EndFunc
Func drawRectangle($x, $y, $width, $height)
_GDIPlus_GraphicsFillRect($hBackbuffer, $x, $y, $width, $height, $brushTop)
;~ _GDIPlus_GraphicsDrawRect($hBackbuffer, $x, $y, $width, $height)
EndFunc
Func drawLosange($x, $y, $width, $height)
Local $points[5][2]
$points[0][0] = 4
$points[1][0] = $x
$points[1][1] = $y + $height / 2
$points[2][0] = $x + $width / 2
$points[2][1] = $y
$points[3][0] = $x + $width
$points[3][1] = $y + $height / 2
$points[4][0] = $x + $width / 2
$points[4][1] = $y + $height
_GDIPlus_GraphicsFillPolygon($hBackbuffer, $points, $brushTop)
;~ _GDIPlus_GraphicsDrawPolygon($hBackbuffer, $points)
EndFunc
Func quit()
Exit
EndFunc
Func freeRessources()
_GDIPlus_BrushDispose($brushTop)
_GDIPlus_BrushDispose($brushLeft)
_GDIPlus_BrushDispose($brushRight)
_GDIPlus_BrushDispose($whiteBrush)
EndFunc