Page 1 of 1

Flickering Sprite

Posted: Sat Jun 20, 2015 1:55 pm
by Steve Elliott2
Hi,

I've decided to give the latest version of Pure BASIC a go for games.

Loading and displaying the background sprite leads to flickering at first until things settle down - then the flickering stops.
I'm guessing it's something to do with flip, but I've tried all sorts of combinations, with no luck.

Code: Select all

UsePNGImageDecoder()

If InitSprite() And InitKeyboard() And OpenScreen( 1920, 1080, 32, "GameGrid", #PB_Screen_WaitSynchronization )

    img = LoadSprite(  #PB_Any, "Gamegrid.png" )
    col_cls.i = RGB( 0, 0, 0 )
    
    If img

        Repeat
 
            ClearScreen( col_cls )
            StartDrawing( ScreenOutput() )
                DisplaySprite( img, 0, 0 )
            StopDrawing()
            FlipBuffers()
            ExamineKeyboard()
            
        Until KeyboardPushed( #PB_Key_Escape )
        FreeSprite( img )
        
    EndIf

EndIf

Steve

Re: Flickering Sprite

Posted: Sat Jun 20, 2015 1:57 pm
by Shield
You don't need Start / StopDrawing for displaying sprites. :wink: Just remove it.

Re: Flickering Sprite

Posted: Sat Jun 20, 2015 2:05 pm
by Steve Elliott2
Awesome! Thanks, I've been playing around with that code for ages lol...Works perfectly now :D

Re: Flickering Sprite

Posted: Sat Jun 20, 2015 7:07 pm
by Steve Elliott2
It seems Pure BASIC has come on since I last looked regards gaming. Good Sprite routines, alpha blending, pixel perfect collisions, 3D - and 64-bit! :)

Onwards and upwards with my game...

And a library for Pure ;)