Workaround until this is repaired
Update v1.01.2
Code: Select all
;-TOP
;- *** PB v6.21 Workaround DrawText by mk-soft, v1.01.2, 03.07.2025 ***
; Link: https://www.purebasic.fr/english/viewtopic.php?t=87121
CompilerIf #PB_Compiler_OS = #PB_OS_Windows And #PB_Compiler_Version = 621
Procedure.d _FixDrawText(x.d, y.d, Text$, FrontColor=-1, BackColor=-1)
Protected r1.d, dx.d
dx = TextWidth(Text$)
If x + dx <= 0.0
;Debug "No DrawText"
ProcedureReturn x + dx
EndIf
If FrontColor <> -1
If BackColor <> -1
r1 = DrawText(x, y, Text$, FrontColor, BackColor)
Else
r1 = DrawText(x, y, Text$, FrontColor)
EndIf
Else
r1 = DrawText(x, y, Text$)
EndIf
ProcedureReturn r1
EndProcedure
Macro DrawText(x, y, Text, FrontColor=-1, BackColor=-1)
_FixDrawText(x, y, Text, FrontColor, BackColor)
EndMacro
CompilerEndIf
;- ***
If OpenWindow(0, 0, 0, 200, 200, "2DDrawing Beispiel", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateImage(0, 200, 200) And StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0, 0, 200, 200, RGB(255, 255, 255))
For i = 1 To 30
DrawText(Random(300)-100, Random(200), "Hello World!", RGB(Random(255), Random(255), Random(255)))
Next i
StopDrawing()
ImageGadget(0, 0, 0, 200, 200, ImageID(0))
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf