View Full Version : New article on TBGL website covering entity data signing
Petr Schreiber
10-07-2010, 17:15
Dear friends,
some time ago I announced awaking of TBGL website and this trends continues today with article on newly introduced entity data signing and enumeration.
TBGL_EntityEnumByDataSignature brings new air to design of your TBGL applications with ability of filtering entities of completely user defined type out.
Read more about it here:
TBGL Entity Data Signature (http://psch.thinbasic.com/tutorials/TBGL_entity_data_signature.pdf) [PDF]
You can access the article anytime later by visiting Tutorials (http://psch.thinbasic.com/tutorials.html) section of TBGL website.
Petr
Michael Hartlef
10-07-2010, 18:13
:eusaclap:
Petr, nice idea but, wouldn't it be easier and simpler to make it an optional parameter when creating an entity?
dim entity as long = tbgl_entitygetfreeid(scene, optional "signature string")
then behind the scenes tbgl would create the id, keep a list of the id with the string signature in the background.
Petr Schreiber
11-07-2010, 08:34
Hi Kent,
good thought, but you can already describe entity using string with TBGL_EntitySetName and retrieve using TBGL_EntityGetName.
The possible disadvantage of this are variable memory requirements while the data signature is always 4 bytes small while still providing great range of different values.
It would be possible to create the number from string as well (for example sum of the ASCII values), but that is up to the programmer.
I am prepairing multiple EntityEnum functions, so this will not be the only one. But it is the first in row, and I picked it to demonstrate new possibilities.
EnumByName could be another candidate in the row, maybe filtering just by partial names like "Rocket*"...
Thanks a lot for your opinion Kent, it is always interesting to hear and it only helps pushing TBGL forward.
Another thing I was thinking of was not enumerating to array, but directly executing functions with calling entity specified. The possibilities are endless.
If you remember the example we did with landscape and doctor Aeraix in the balloon, we had to prepare dedicated ID section for rockets. Now you could add rockets dynamicaly and then filter them out easily.
Thanks!,
Petr
P.S. Added RSS feed (http://psch.thinbasic.com/psch_thinbasic_com.php) for the TBGL website
Oh, didn't know about the new enums coming up too... then-- well done with this article!!