Screens and Sprites

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

I have a problem with Screens and Sprites.
Can't show the code because it's way too big - but what I do is simply this:

Open a window with the size 740x540
Open a windowed Screen with the size 896x512
Load some Sprites
Display some Sprites (on 28 different locations - sprite size 128x128)
Mess around with the code...
Display some Sprites again
Repeat messing around...
Stop displaying Sprites
Close the Screen
Open a new windowed Screen with the size 1024x512
Display some Sprites again < crash !!!!!!!!!!!!!!!!!

Suppose the problem is that the output buffer has changed.
I don't like the idea to free all the sprites and reload them after opening a new screen.
(because every Level of the game need a modified screen size)

How can I set the right output buffer :)
UseBuffer(#Sprite) is only used if you render on a sprite.

Played with ScreenOutput() and StartDrawing() but nothing worked...

Do I have to reload all my Sprites or is there a solution :)

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pupil.
Originally posted by Franco

I have a problem with Screens and Sprites.
Can't show the code because it's way too big - but what I do is simply this:

Open a window with the size 740x540
Open a windowed Screen with the size 896x512
Load some Sprites
Display some Sprites (on 28 different locations - sprite size 128x128)
Mess around with the code...
Display some Sprites again
Repeat messing around...
Stop displaying Sprites
Close the Screen
Open a new windowed Screen with the size 1024x512
Display some Sprites again < crash !!!!!!!!!!!!!!!!!

Suppose the problem is that the output buffer has changed.
I don't like the idea to free all the sprites and reload them after opening a new screen.
(because every Level of the game need a modified screen size)

How can I set the right output buffer :)
UseBuffer(#Sprite) is only used if you render on a sprite.

Played with ScreenOutput() and StartDrawing() but nothing worked...

Do I have to reload all my Sprites or is there a solution :)
Seems as if all the sprites get unloaded when closing the screen, you probably have to load them all over again. When i ran a little test with debugger turned on i got the message that my sprite object wasn't initilized..
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

You only need 1 command: ReloadSprites()

Now write it...

cya
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Thanks Pupil, you are right.
Well, I didn't expect to loose the sprites after closing the windowed screen because the program is still running.
After rereading the help files it jumped right in my eye's (still hurts...):

"...After closing a screen, all the sprites must be reloaded as the
screen format has been lost and the video memory release..."

Well...

My question now:
Is it really necessary to kill all sprites instead of redirecting the output :)
IMHO it would be faster.

@Danilo
> You only need 1 command: ReloadSprites()
> Now write it...

This seems to be the only way for now...

Thanks for your comments.

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
Post Reply