Page 2 of 2

Posted: Wed Feb 18, 2004 5:46 pm
by Fred
It will work like this:

Code: Select all

MySprite = LoadSprite(#PB_Any, "sprite.bmp")

DisplaySprite(MySprite, x, y)
This managment is finished and will be available for the next release.

Posted: Wed Feb 18, 2004 7:30 pm
by GedB
What about releasing the Handles?

For example, will there be something like ...

Code: Select all

ReleaseSprite(MySprite)
... which will release the handle held by MySprite and make it available for use when #PB_Any is used again?

Posted: Wed Feb 18, 2004 11:09 pm
by Dare2
I am assuming that PB manages an internal table or list to avoid conflicts and so we could do something like:

Code: Select all

For i = 0 to 99
  MySpriteIds(i) = LoadSprite(#PB_Any, "sprite" + str(i) + ".bmp") 
Next
...
...
DisplaySprite(MySpriteIds(n), x, y)
If so, WooooHooooo!

That is exactly what the doctor ordered! :)

Posted: Sat Feb 21, 2004 4:55 pm
by Kris_a
woo! perfect :D

will this work with other things, too? sprites, dll functions, gadets, etc?

Posted: Mon Feb 23, 2004 11:14 am
by Fred
GedB wrote:What about releasing the Handles?

For example, will there be something like ...

Code: Select all

ReleaseSprite(MySprite)
... which will release the handle held by MySprite and make it available for use when #PB_Any is used again?
It's simply FreeSprite() which does this.

Dare2: in your example, the actual way is better ;)

Kris_a: yes

Posted: Mon Feb 23, 2004 12:51 pm
by freedimension
What about something like this:

Code: Select all

myID = LoadSprite(#PB_Any, "sprite.bmp")

For i=1 to 100
  LoadSprite(i, "sprite" + str(i) + ".bmp")
Next
Will this be possible without risking a conflict?
I can't think about a way to make it safe, except for reserverd number ranges that could be in conflict with older sourcecodes.
The compiler can't do anything about it as it does not know about the content of the variable i and on runtime it can't be predicted too (you can't change myID afterwards).

So what are your thoughts about that, Fred?

P.S.: I know that the example is only fictitious ;-)[/i]

Posted: Mon Feb 23, 2004 5:20 pm
by freak
You can combine them both savely. (which is really cool btw 8) )

The dynamic created numbers are very high ones (because they are in fact memory pointers)
This is how PB knows the difference.

There is no way, this can produce conflicts with old Code, because you were
never able to use such high numbers, PB would have allocated space for
all items from 0 to that number, which would have been a lot.

I have tested the new system very much, and it works perfectly.

Timo

Posted: Tue Feb 24, 2004 12:13 am
by freedimension
freak wrote:I have tested the new system very much, and it works perfectly.
Good to hear. Is the new Version still in alpha state or already in beta?
Will it be 3.9 or 3.82 ? :D

Posted: Tue Feb 24, 2004 3:40 am
by Dare2
This sounds most excellent! :D

Posted: Tue Feb 24, 2004 6:21 am
by Shannara
I definately agree, it would make game coding much much easier, instead of manual handles.