Sprite: DrawText
Posted: Thu May 08, 2025 9:54 pm
Windows 11 Pro: 24H2
PureBasic 6.21 Beta 9
The following code used to produce a transparent background but now it's black.
I'm not sure if I'm missing something obvious with all the recent changes.
If this is confirmed to be a bug, please move to the correct forum.
PureBasic 6.21 Beta 9
The following code used to produce a transparent background but now it's black.
I'm not sure if I'm missing something obvious with all the recent changes.
If this is confirmed to be a bug, please move to the correct forum.
Code: Select all
Enumeration
#MainWindow
#HiScore
EndEnumeration
InitSprite() : InitKeyboard()
WindowWidth = 800 : WindowHeight = 600
If OpenWindow(#MainWindow, 0, 0, WindowWidth, WindowHeight, "DrawText", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(#MainWindow), 0, 0, WindowWidth, WindowHeight)
CreateSprite(#HiScore, 220, 50, #PB_Sprite_AlphaBlending)
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
Select EventWindow()
Case #MainWindow : Break 2
EndSelect
EndSelect
Until Not Event
FlipBuffers() : ClearScreen($FFFFFF) : ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape) : Break : EndIf
FreeSprite(#HiScore)
CreateSprite(#HiScore, 220, 50, #PB_Sprite_AlphaBlending)
If StartDrawing(SpriteOutput(#HiScore))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(0, 0, "HI-SCORE: 999999", RGB(255, 140, 0))
StopDrawing()
EndIf
DisplayTransparentSprite(#HiScore, 16, 25)
ForEver
EndIf
EndIf