Can i create a transparent Sprite with CreateSprite()?
Posted: Thu Dec 05, 2024 8:02 pm
Is there a way to create a transparent sprite with CreateSprite()?
I thought it would be nice to have an ingame overlay.
Edit: added #PB_Sprite_AlphaBlending
Black box should be transparent:
Is the only way LoadSprite() with a transparent *.png?
I thought it would be nice to have an ingame overlay.
Edit: added #PB_Sprite_AlphaBlending
Black box should be transparent:
Code: Select all
EnableExplicit
Procedure Render()
ClearScreen(#Red)
DisplayTransparentSprite(0,0,0)
FlipBuffers()
EndProcedure
Procedure Main()
OpenScreen(800,600,32,#Null$)
SetFrameRate(60)
CreateSprite(0,128,128,#PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(0))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0,0,SpriteWidth(0),SpriteHeight(0),RGBA(255,255,255,255))
Box(2,2,SpriteWidth(0) - 4,SpriteHeight(0) - 4,RGBA(0,0,0,0))
StopDrawing()
BindEvent(#PB_Event_RenderFrame,@Render())
PostEvent(#PB_Event_RenderFrame)
EndProcedure
Main()