Page 1 of 1

[solved] CreateSprite() bug?

Posted: Mon Jan 23, 2023 4:23 pm
by Alex777
The following code is not working in PB ver. 6.00 LTS(x86) with or without optimizer, However, it works in PB ver. 5.73 LTS(x86).

Is this a bug or an error in my code?

Code: Select all

InitSprite()

ExamineDesktops()
Define Win.i = OpenWindow(#PB_Any, 0, 0, DesktopWidth(0), DesktopHeight(0), "bug?", #PB_Window_NoGadgets | #PB_Window_BorderLess)
OpenWindowedScreen(WindowID(Win), 0, 0, WindowWidth(Win), WindowHeight(Win))                            
       
Define Test.i = CreateSprite(#PB_Any, 200, 24, #PB_Sprite_AlphaBlending)

StartDrawing(SpriteOutput(Test))
    Box(0, 0, SpriteWidth(Test), SpriteHeight(Test), $DEDEDA)
StopDrawing()

Repeat
    
    While WindowEvent() : Wend
    
    ClearScreen(#Black)
    DisplayTransparentSprite(Test, 100, 100)
    FlipBuffers()
    
ForEver

Re: CreateSprite() bug?

Posted: Mon Jan 23, 2023 4:33 pm
by netmaestro
By 'not working' what do you mean? It makes and displays a rectangular sprite here without problems. I had to add a test at the end for a keypress so the window could be closed without resorting to the task manager but that's nothing to do with the sprite creation or display.

Re: CreateSprite() bug?

Posted: Mon Jan 23, 2023 4:35 pm
by RASHAD
Use Compiler Options --> Libarary Subsystem --> directx9
InitSprite()
This function tries to initialize DirectX 9, so if it fails, it's probably because DirectX is not found or is a previous version.

Re: CreateSprite() bug?

Posted: Mon Jan 23, 2023 5:09 pm
by Alex777
Use Compiler Options --> Libarary Subsystem --> directx9
Thanks. Solved.
By 'not working' what do you mean?
Sorry I was unclear. I meant simply "not displaying the sprite".