multi-polygone whit the rotation in Degres
Code: Select all
#dobro=1
#Police=1
#Sprite=1
#PI=3.1415926
Declare polygone(x.l,y.l,taille.l,angle.l,rotation.f,color.l,t)
; ***********************************
Resultat = InitSprite()
FontID = LoadFont(#Police, "arial", 18, #PB_Font_Bold )
EcranX = GetSystemMetrics_(#SM_CXSCREEN):;=largeur de l'ecran
EcranY = GetSystemMetrics_(#SM_CYSCREEN):;=hauteur de l'ecran
WindowID = OpenWindow(1, 0, 0, EcranX, EcranY, #PB_Window_SystemMenu|#PB_Window_BorderLess |#PB_Window_ScreenCentered , "hello")
WindowID = WindowID(1)
Result = OpenWindowedScreen(WindowID,0,0,800, 600, 1, 0,0)
Resultat = InitMouse()
Repeat
ExamineMouse()
Event=WindowEvent()
If MouseButton(2)
End
EndIf
;Star(x.l,y.l,intrad.l,n.l,phase.f,color.l)
x.l=400 ;location x
y.l=300 ; location y
taille.l=100
angle.l=4 ; pour un triangle 4 pour un carre , 8 pour un octogone ect ...
rotation.f=180
color.l=RGB($FF,$FF,$80)
For t=0 To 360
; Delay (200)
rotation.f=t
polygone(x.l,y.l,taille.l,angle.l,rotation.f,color.l,t)
FlipBuffers():; affiche l'ecran
ClearScreen(0,0,0)
ExamineMouse()
Event=WindowEvent()
If MouseButton(2)
End
EndIf
Next t
Until Event=#PB_Event_CloseWindow
Procedure polygone(x.l,y.l,taille.l,angle.l,rotation.f,color.l,t)
If angle.l=4
Else
EndIf
rotation.f= rotation.f*0.01745329
StartDrawing(ScreenOutput() )
DrawText(StrF( t))
alpha.f=2*(#PI/angle)
For t.l=1 To angle
d1.f=(t-1)*alpha+rotation.f
d3.f=t*alpha+rotation.f
LineXY(x+taille*Sin(d1),y+taille*Cos(d1),x+taille*Sin(d3),y+taille*Cos(d3),color)
Next
StopDrawing()
EndProcedure