[SOLVED] RoundBox not working in PB621
[SOLVED] RoundBox not working in PB621
Hi #PB_All
I don't know if this is a bug or not but I wasn't sure where to ask this question? I was using PB 611 until today when I changed to the latest PB621.
I'm writing a sprite based game in which I have some sprites that are boxes with rounded corners. These are sprites created at runtime and drawn to via StartDrawing etc, rather than sprites I made myself in Inkscape for example.
It works fine in PB611 but not in PB 621. I'm using Void Linux and the Ubuntu 24.04 x64 version of PB.
Any ideas?
Thanks,
Moulder.
I don't know if this is a bug or not but I wasn't sure where to ask this question? I was using PB 611 until today when I changed to the latest PB621.
I'm writing a sprite based game in which I have some sprites that are boxes with rounded corners. These are sprites created at runtime and drawn to via StartDrawing etc, rather than sprites I made myself in Inkscape for example.
It works fine in PB611 but not in PB 621. I'm using Void Linux and the Ubuntu 24.04 x64 version of PB.
Any ideas?
Thanks,
Moulder.
Last edited by moulder61 on Sat Jun 14, 2025 5:34 pm, edited 1 time in total.
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Re: RoundBox not working in PB621
Any code ?
Re: RoundBox not working in PB621
Hi Fred,
This is a typical sprite creation block of code that I'm using:
The sprites don't all have DrawingMode(#PB_2DDrawing_AlphaChannel), some have DrawingMode(#PB_2DDrawing_AlphaBlend). I can't remember why, I haven't looked at the code for a while, but I think it was to do with cutting a hole in the sprite?
Anyway, here are a couple of images using the same code on PB611 and PB621. The one with square corners is PB621.
Moulder.

This is a typical sprite creation block of code that I'm using:
Code: Select all
CreateSprite(#GridBG, GridW + Border * 2, GridH + Border * 2, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(#GridBG))
DrawingMode(#PB_2DDrawing_AlphaChannel)
RoundBox(0, 0, GridW + Border * 2, GridH + Border * 2, 10, 10, $FF000000)
StopDrawing()
Anyway, here are a couple of images using the same code on PB611 and PB621. The one with square corners is PB621.
Moulder.


"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Re: RoundBox not working in PB621
Please a full working snippet, it's not easy to replicate without it.
Re: RoundBox not working in PB621
Hi Fred,
I took the RoundBox example in the help and added a bit of my code(sort of). It seems to display the same behaviour i.e. it works in 611 not 621.
Moulder.
I took the RoundBox example in the help and added a bit of my code(sort of). It seems to display the same behaviour i.e. it works in 611 not 621.
Moulder.
Code: Select all
InitSprite()
If OpenWindow(0, 0, 0, 500, 500, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 500, 500)
CreateSprite(0, 300, 150, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(0))
DrawingMode(#PB_2DDrawing_AlphaBlend)
RoundBox(0, 0, 300, 150, 8, 8, $bb000000)
StopDrawing()
Repeat
ClearScreen(RGB(255,255,255))
DisplayTransparentSprite(0, 100, 175)
FlipBuffers()
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Re: RoundBox not working in PB621
Hi, playing with it I think you can draw the round corner sprites:
Code: Select all
InitSprite()
If OpenWindow(0, 0, 0, 500, 500, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 500, 500)
CreateSprite(0, 300, 150, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(0))
DrawingMode(#PB_2DDrawing_AlphaBlend)
RoundBox(0, 0, 300, 150, 18, 18, RGBA(255,0,0,255))
StopDrawing()
Repeat
Event = WindowEvent()
ClearScreen(RGB(255,255,255))
TransparentSpriteColor(0, #Black)
DisplayTransparentSprite(0, 100, 175)
DisplayTransparentSprite(0, 130, 205)
FlipBuffers()
Until Event = #PB_Event_CloseWindow
EndIf
Re: RoundBox not working in PB621
@Caronte3D
That looks interesting, thanks.
My code worked fine before, nothing has changed except that I started using PB621 after being on PB611 for quite a while.
Unfortunately, I want a black box with rounded corners, not a red one!
I tried modifying your code, but I don't seem to be able to get it working how I want?
Thanks anyway.
Moulder.
That looks interesting, thanks.
My code worked fine before, nothing has changed except that I started using PB621 after being on PB611 for quite a while.
Unfortunately, I want a black box with rounded corners, not a red one!
I tried modifying your code, but I don't seem to be able to get it working how I want?
Thanks anyway.
Moulder.
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Re: RoundBox not working in PB621
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Re: RoundBox not working in PB621
moulder61 wrote: Fri Jun 13, 2025 11:11 pm Unfortunately, I want a black box with rounded corners, not a red one!
Code: Select all
InitSprite()
If OpenWindow(0, 0, 0, 500, 500, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 500, 500)
CreateSprite(0, 300, 150, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(0))
DrawingMode(#PB_2DDrawing_AlphaBlend)
RoundBox(0, 0, 300, 150, 18, 18, RGBA(255,0,0,255))
StopDrawing()
Repeat
Event = WindowEvent()
ClearScreen(RGB(255,255,255))
TransparentSpriteColor(0, #Black)
DisplayTransparentSprite(0, 100, 175,255,#Black)
DisplayTransparentSprite(0, 130, 205,255,#Black)
FlipBuffers()
Until Event = #PB_Event_CloseWindow
EndIf
Re: RoundBox not working in PB621
The new #PB_Sprite_Transparent flag should be used in v6.21 & you should alse remove the TransparentSpriteColor(), works here on Windows.
Edit: See Freds' post here: viewtopic.php?p=640126&hilit=PB_Sprite_ ... nt#p640126
Code: Select all
InitSprite()
If OpenWindow(0, 0, 0, 500, 500, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 500, 500)
; >>>>> new flag on CreateSprite() - #PB_Sprite_Transparent
CreateSprite(0, 300, 150, #PB_Sprite_AlphaBlending|#PB_Sprite_Transparent)
StartDrawing(SpriteOutput(0))
DrawingMode(#PB_2DDrawing_AlphaBlend)
RoundBox(0, 0, 300, 150, 18, 18, $BB000000)
StopDrawing()
Repeat
Event = WindowEvent()
;>>>> Removed: TransparentSpriteColor(0, #Black)
ClearScreen(RGB(255,255,255))
DisplayTransparentSprite(0, 100, 175)
DisplayTransparentSprite(0, 130, 205)
FlipBuffers()
Until Event = #PB_Event_CloseWindow
EndIf
Edit: See Freds' post here: viewtopic.php?p=640126&hilit=PB_Sprite_ ... nt#p640126
Re: RoundBox not working in PB621
I missed it.pjay wrote: Sat Jun 14, 2025 6:18 am See Freds' post here: viewtopic.php?p=640126&hilit=PB_Sprite_ ... nt#p640126
Thanks!

Re: RoundBox not working in PB621
@pjay
Thanks for the explanation, that's very helpful. I vaguely remember hearing something about transparent sprites. In Caronte3D's example, I did wonder how setting the transparent colour to black would allow me to have a black box?
@Caronte3D
Thanks for your help. Kudos for getting it working even though it wasn't the "correct" way. I like people that think outside the box.
See what I did there?
Moulder.
Thanks for the explanation, that's very helpful. I vaguely remember hearing something about transparent sprites. In Caronte3D's example, I did wonder how setting the transparent colour to black would allow me to have a black box?
@Caronte3D
Thanks for your help. Kudos for getting it working even though it wasn't the "correct" way. I like people that think outside the box.

See what I did there?

Moulder.
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Re: RoundBox not working in PB621
@Anyone that knows
I wasn't sure if it was a bug in the first place, but it turns out it was a change to the way PB 621> handles transparent sprites, so should I mark this thread as "SOLVED" or "I SHOULD HAVE RTFM" or what?
Thanks,
Moulder.
I wasn't sure if it was a bug in the first place, but it turns out it was a change to the way PB 621> handles transparent sprites, so should I mark this thread as "SOLVED" or "I SHOULD HAVE RTFM" or what?
Thanks,
Moulder.
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Re: RoundBox not working in PB621
I think [Solved] is correct.
Re: [SOLVED] RoundBox not working in PB621
@Caronte3D
I'll take your word for it.
Thanks again for your input.
Moulder.
I'll take your word for it.

Thanks again for your input.
Moulder.
"If it ain't broke, fix it until it is!
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
This message is brought to you thanks to SenselessComments.com
My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV