OK on PB6.20 and ERROR on PB6.21b9

Just starting out? Need help? Post your questions and find answers here.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 566
Joined: Tue Jan 04, 2011 6:21 pm

OK on PB6.20 and ERROR on PB6.21b9

Post by SPH »

Hi,

My game runs on PB6.20 but not on PB6.21b9.
I tried to find the bug, but I can't find it yet... :arrow: :shock:

Code here :
viewtopic.php?t=86911


// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
infratec
Always Here
Always Here
Posts: 7604
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: OK on PB6.20 and ERROR on PB6.21b9

Post by infratec »

As written in the error message:

add #PB_Sprite_AlphaBlending at all CreateSprite() procedures.
User avatar
diceman
User
User
Posts: 66
Joined: Tue Apr 10, 2018 9:42 pm

Re: OK on PB6.20 and ERROR on PB6.21b9

Post by diceman »

FYI: TransparentSpriteColor() no longer defaults to full black - now it has to be defined always, after creating a new Sprite. :)
Now these points of data make a beautiful line,
And we're out of Beta, we're releasing on time.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 566
Joined: Tue Jan 04, 2011 6:21 pm

Re: OK on PB6.20 and ERROR on PB6.21b9

Post by SPH »

[14 :43 :02] Attente du démarrage du programme...
[14 :43 :02] Type d'exécutable: Windows - x64 (64bit, Unicode)
[14 :43 :02] Exécutable démarré.
[14 :43 :09] [ERREUR] Magic_4x4_12a.pb (Ligne: 773)
[14 :43 :09] [ERREUR] DisplayTransparentSprite(): A sprite should be created with the flag #PB_Sprite_AlphaBlending to use this command.
[14 :43 :31] Le programme a été arrêté.
Does the solution exist with this beta 9?
(If so, which one? Because I heard that the option will only be available in the future non-beta version)

Or should I wait for version PB 6.30?

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
miso
Enthusiast
Enthusiast
Posts: 464
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: OK on PB6.20 and ERROR on PB6.21b9

Post by miso »

Hello SPH. It won't be resolved, the flag will be necessary after the beta. It has it's reason.
Good news, that the flag is compatible with the old versions, so you can add them now, it will still work with 6.20 (and I guess with 5.73 also)
but will compile with the beta and the future releases. PS:I already told, your game is cool. ;)
dcr3
Enthusiast
Enthusiast
Posts: 184
Joined: Fri Aug 04, 2017 11:03 pm

Re: OK on PB6.20 and ERROR on PB6.21b9

Post by dcr3 »

SPH wrote: Sat May 31, 2025 1:49 pm Does the solution exist with this beta 9?
Yes? :?
infratec wrote: Sat May 31, 2025 12:54 pm As written in the error message:

add #PB_Sprite_AlphaBlending at all CreateSprite() procedures.
Just add #PB_Sprite_AlphaBlending

CreateSprite(0, zoom/rang,zoom/rang,#PB_Sprite_AlphaBlending)

CreateSprite(1000, zoom/rang,zoom/rang,#PB_Sprite_AlphaBlending)

CreateSprite(i, zoom/rang,zoom/rang,#PB_Sprite_AlphaBlending)
Last edited by dcr3 on Sat May 31, 2025 6:12 pm, edited 1 time in total.
miso
Enthusiast
Enthusiast
Posts: 464
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: OK on PB6.20 and ERROR on PB6.21b9

Post by miso »

Sorry. Yes, the solution exists since 5.73 (at least), but was not necessary to use until the recent beta.

Edit: This sprite creation method worked for me the best. Works with both the beta or the current or older versions.
For transparent color instead of alpha channel, diceman can add more info, as he uses that method heavily in his game.

Code: Select all

ExamineDesktops()
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0,0,0,DesktopUnscaledX(DesktopWidth(0)),DesktopUnscaledY(DesktopHeight(0)),"Sprite Creation", #PB_Window_BorderLess)
OpenWindowedScreen(WindowID(0),0,0,WindowWidth(0),WindowHeight(0),1,0,0,#PB_Screen_SmartSynchronization)
SetFrameRate(60)

;Sprite Creation
  CreateSprite(1,64,64,#PB_Sprite_AlphaBlending)
  StartDrawing(SpriteOutput(1))
  DrawingMode(#PB_2DDrawing_AllChannels)
  Box(0,0,OutputWidth(),OutputHeight(),RGBA(0,0,0,0)) ; This sets the alpha channel to transparent fully
  Circle(OutputWidth()/2,OutputHeight()/2,SpriteHeight(1)/2-1,RGBA(255,0,0,255)) ; drawing a red circle
  StopDrawing()

Repeat
  Repeat: Until Not WindowEvent()
  ExamineKeyboard() : ExamineMouse() : ClearScreen(RGB(50,20,20))
  
  DisplayTransparentSprite(1,ScreenWidth()/2-SpriteWidth(1)/2,ScreenHeight()/2-SpriteHeight(1)/2)  
  
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
  
Post Reply