Une petite commande de dessin d'un damier. J'en ai eu besoin pour un projet sur lequel je travaille en ce moment.
A+
Guimauve
Code : Tout sélectionner
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Nom du projet : DrawChecker
; Nom du fichier : DrawChecker.pb
; Version du fichier : 1.0.1
; Programmation : OK
; Programmé par : Guimauve
; Correction par : Le Soldat Inconnu
; Date : 29-01-2012
; Mise à jour : 03-02-2012
; Code PureBasic : 4.61
; Plateforme : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Procedure DrawChecker(ImageID, Size.w, BoxCount.l, Color00.l, Color01.l)
If CreateImage(ImageID, Size, Size)
If StartDrawing(ImageOutput(ImageID))
BoxSize.l = Size / BoxCount
For LineCount = 0 To BoxCount
For RowCount = 0 To BoxCount
If (LineCount + RowCount) & %1 = 1
Box(x, y, BoxSize, BoxSize, Color01)
Else
Box(x, y, BoxSize, BoxSize, Color00)
EndIf
x + BoxSize
Next
y + BoxSize
x = 0
Next
StopDrawing()
EndIf
EndIf
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< !!! ATTENTION - CODE D'ESSAI !!! <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#Size = 512
If OpenWindow(0, 0, 0, #Size + 10, #Size + 10, "DrawChecker", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
DrawChecker(0, #Size, 8, RGB(255,255,000), RGB(000,000,000))
ImageGadget(0, 5, 5, #Size, #Size, ImageID(0))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
; <<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< FIN DU FICHIER <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<