[solved] CreateSprite() bug?

Just starting out? Need help? Post your questions and find answers here.
Alex777
User
User
Posts: 49
Joined: Sun Nov 16, 2008 12:47 am
Location: Cayman Is.
Contact:

[solved] CreateSprite() bug?

Post 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
Last edited by Alex777 on Mon Jan 23, 2023 5:10 pm, edited 1 time in total.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: CreateSprite() bug?

Post 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.
BERESHEIT
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4995
Joined: Sun Apr 12, 2009 6:27 am

Re: CreateSprite() bug?

Post 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.
Egypt my love
Alex777
User
User
Posts: 49
Joined: Sun Nov 16, 2008 12:47 am
Location: Cayman Is.
Contact:

Re: CreateSprite() bug?

Post 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".
Post Reply