Il doit y avoir des techniques, j'imagine!

Code : Tout sélectionner
Enumeration
#Window_Main
#Image
EndEnumeration
WindowWidth = 640
WindowHeight = 480
MaxModes = 1
If OpenWindow(#Window_Main, 0, 0, WindowWidth, WindowHeight, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered, "MyWindow")
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Escape, #PB_Shortcut_Escape)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_F1, #PB_Shortcut_F1)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Left, #PB_Shortcut_Left)
AddKeyboardShortcut(#Window_Main, #PB_Shortcut_Right, #PB_Shortcut_Right)
If CreateGadgetList(WindowID(#Window_Main))
EndIf
ImageID = CreateImage(#Image, WindowWidth, WindowHeight)
cx = WIndowWidth / 2
cy = WindowHeight / 2
Quit = #FALSE
Repeat
StartDrawing(ImageOutput())
Radius = 100 * Int(WindowHeight / 100) / 2
Select Mode
Case 0
yRadius = Radius
For xRadius = yRadius To 0 Step -1
Color = 255 * xRadius / Radius
Ellipse(cx, cy, xRadius, yRadius, Color)
Next
Case 1
For x = 0 To Radius
Color = 255 * x / Radius
Circle(cx - x / 2, cy + x / 3, Radius - x, Color)
Next
EndSelect
StopDrawing()
Select WindowEvent()
Case #PB_Event_CloseWindow
Quit = #TRUE
Case #PB_Event_Menu
Select EventMenuID()
Case #PB_Shortcut_Escape
Quit = #TRUE
Case #PB_Shortcut_F1
Statistics = 1 - Statistics
Case #PB_Shortcut_Left
Mode - 1
If Mode < 0
Mode = 0
EndIf
Case #PB_Shortcut_Right
Mode + 1
If Mode > MaxModes
Mode = MaxModes
EndIf
EndSelect
Case #PB_Event_SizeWindow
WindowWidth = WindowWidth()
WindowHeight = WindowHeight()
ImageID = CreateImage(#Image, WindowWidth, WindowHeight)
cx = WIndowWidth / 2
cy = WindowHeight / 2
EndSelect
StartDrawing(WindowOutput())
DrawImage(ImageID, 0, 0)
If Statistics
BackColor(0, 0, 40)
FrontColor(255, 255, 255)
Locate(10, 10)
DrawText("FPS : " + Str(FPS))
EndIf
StopDrawing()
NFrames + 1
If ElapsedMilliseconds() - tz => 1000
FPS = NFrames
NFrames = 0
tz = ElapsedMilliseconds()
EndIf
Delay(1)
Until Quit
EndIf
End
Code : Tout sélectionner
Rayon = 45
x = 50
y = 50
Couleur = RGB(50, 200, 25)
CreateImage(0, 100, 100)
StartDrawing(ImageOutput())
For n = 0 To Rayon - 1
CouleurCercle = ColorLuminosity(Couleur, 0.75 + n / Rayon / 2)
DeplacementCercle = n / (2 * Sqr(2))
Circle(x - DeplacementCercle, y - DeplacementCercle, Rayon - n, CouleurCercle)
Next
StopDrawing()
If OpenWindow(0, 0, 0, 300, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget, "Test") = 0 Or CreateGadgetList(WindowID()) = 0
End
EndIf
ImageGadget(0, 0, 0, 100, 100, UseImage(0))
Repeat
Event = WaitWindowEvent()
Until Event = #PB_EventCloseWindow