- 1 SpriteQuality(#PB_Sprite_BilinearFiltering)
bug with directx
I suggest to suppress this instruction and to put the bilinear filtering by default
- 2 DrawingMode(#PB_2DDrawing_Transparent)
on sprites, it is the alpha of the destination that is kept (unlike on images)
- 3 DisplayTransparentSprite
the color parameter sets the intensity (to 255)
Code: Select all
Procedure dessin(output)
StartDrawing(output)
DrawingMode(#PB_2DDrawing_AllChannels)
;Box(0,0,256,256,0) ; <---- for dirextx9 (unless backcolor is $ff000000)
DrawingMode(#PB_2DDrawing_AlphaBlend)
RandomSeed(0)
For i=0 To 100:Circle(Random(200)+36,Random(200)+36,Random(20),Random($ffffffff)):Next
BackColor($00ff00)
DrawingMode(#PB_2DDrawing_AllChannels|#PB_2DDrawing_Transparent)
DrawText(0,100,"le fond est transparent" ,$ffffffff)
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(0,120,"le fond est transparent" ,$ffffffff,$0)
StopDrawing()
EndProcedure
test3d=1
If test3d:InitEngine3D():EndIf
InitSprite():InitKeyboard():InitMouse()
SpriteQuality(#PB_Sprite_BilinearFiltering)
OpenWindow(1,0,0,256,256,"test")
CreateImage(0,256,256,32)
dessin(ImageOutput(0))
ImageGadget(0,0,0,256,256,ImageID(0))
OpenWindow(0, 0, 0, 1024, 720, "Esc tou quit", #PB_Window_ScreenCentered):OpenWindowedScreen(WindowID(0), 0, 0, 1024, 720, 0, 0, 0)
CreateSprite(0,256,256,#PB_Sprite_AlphaBlending)
dessin(SpriteOutput(0))
If test3d
CreateCamera(0, 0, 0, 100, 100):MoveCamera(0,0,0,-4):CameraLookAt(0,0,0,0)
CreateLight(0,$ffffff, 10000, 10000, 0000)
CreateTorus(0,1,0.25,64,64)
CreateMaterial(0,0,$888888):MaterialShininess(0,64,$ffffff)
CreateEntity(0,MeshID(0),MaterialID(0))
EndIf
Repeat
While WindowEvent():Wend
ExamineKeyboard():ExamineMouse()
If test3d:RotateEntity(0,0.1,0.2,0.3,#PB_Relative):RenderWorld():Else:ClearScreen(RGBA(0,0,0,0)):EndIf
DisplayTransparentSprite(0, 600,0,255)
For i=0 To 7:DisplayTransparentSprite(0, i*128,i*64, i*31 ,$ff):Next
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or MouseButton(3)