Le code exemple fournit avec PB sur les images me donne un fond noir alors qu'il devrait afficher des lignes de couleurs
Code : Tout sélectionner
;
; ------------------------------------------------------------
;
; PureBasic - Image example file
;
; (c) 2001 - Fantaisie Software
;
; ------------------------------------------------------------
;
If OpenWindow(0, 100, 100, 500, 300, "PureBasic - Image")
If CreateImage(0, 255, 255)
StartDrawing(ImageOutput(0))
;==============LIGNES DE COULEUR ICI==========
For k=0 To 255
FrontColor(RGB(k,0, k)) ; a rainbow, from black to pink
Line(0, k, 255, 0)
Next
DrawingMode(#PB_2DDrawing_Transparent)
FrontColor(RGB(255,255,255)) ; print the text to white !
DrawText(40, 50, "An image created easely...")
StopDrawing() ; This is absolutely needed when the drawing operations are finished !!! Never forget it !
EndIf
CopyImage(0, 1)
ResizeImage(1, 100, 100)
GrabImage(0, 2, 100, 60, 150, 40)
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Repaint
StartDrawing(WindowOutput(0))
DrawImage(ImageID(0), 20, 10)
DrawImage(ImageID(1), 320, 80)
DrawImage(ImageID(2), 320, 200)
StopDrawing()
EndIf
Until EventID = #PB_Event_CloseWindow ; If the user has pressed on the close button
EndIf
End ; All the opened windows are closed automatically by PureBasic
Et le code toujours fournit avec PB sur les palette ne compile pas du tout
Code : Tout sélectionner
;
; ------------------------------------------------------------
;
; PureBasic - Palette example file
;
; (c) 2004 - Fantaisie Software
;
; ------------------------------------------------------------
;
CompilerIf Subsystem("directx7") = 0
CompilerError "This example only works with the DirectX7 subsystems"
CompilerEndIf
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitPalette() = 0
MessageRequester("Error", "Can't open DirectX 7 or later", 0)
End
EndIf
If OpenScreen(640, 480, 8, "PureBasic - Palette Example")
LoadSprite(0, #PB_Compiler_Home + "Examples\Sources\Data\AlphaChannel.bmp", 0)
; Build 256 precalculated palette to do a nice cycling effect !
;
For Palette = 0 To 255
CreatePalette(Palette)
For Index = 1 To 255 ; Let the first color always Black
Color = Index+Palette
If Color > 255
Color - 256
EndIf
SetPaletteColor(Palette, Index, Color << 8)
Next
Next
Palette = 0
Repeat
FlipBuffers() ; Flip for DoubleBuffering
ClearScreen(RGB(0, 0, 0))
DisplayPalette(Palette)
DisplaySprite(0, 100, 100)
Palette+1
If Palette > 255 : Palette = 0 : EndIf
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
EndIf
End
Et chez vous ?
Mesa.