Using 2D or 3D? Best way to query Torquescript for that?
by Charlie Patterson · in General Discussion · 05/30/2012 (3:05 pm) · 6 replies
Hi. Lukas and I are making sure Twillex (the free "tweening" engine for Torque) works in both t2d and t3d. TorqueScript works mostly naturally across both, but there are are a few small differences that are important, like one has setSize() and one has setScale(). I'd like to query TS and set a mode appropriately.
Does anyone know how to *easily* query TorqueScript to find out if the engine (classes) is 2D or 3D? You can do a getVersionString(), but it seems that this function isn't very friendly. I get the name "Torque Game Builder" followed by a very old version number, and t3d appears to give just a version number. I'm not sure i trust this solution is very robust across the ages.
Ideas?
Thanks.
Does anyone know how to *easily* query TorqueScript to find out if the engine (classes) is 2D or 3D? You can do a getVersionString(), but it seems that this function isn't very friendly. I get the name "Torque Game Builder" followed by a very old version number, and t3d appears to give just a version number. I'm not sure i trust this solution is very robust across the ages.
Ideas?
Thanks.
#2
getVersionNumber() or getVersionString(), both return the version of the build as a string.
The one that may work better, and be cleaner code-wise for you, is getEngineName(). This returns the name of the product as a string, in this case you would be getting back either "Torque 2D" or "Torque 3D"
05/30/2012 (3:41 pm)
Yep, there's actually a few different ones.getVersionNumber() or getVersionString(), both return the version of the build as a string.
The one that may work better, and be cleaner code-wise for you, is getEngineName(). This returns the name of the product as a string, in this case you would be getting back either "Torque 2D" or "Torque 3D"
#3
The Plastic Gems no5 Resource, might may be of use as reference on portability even though it was concerned with the differences between TGE and TGEa... which have similar differences as between T2D and T3D.
05/30/2012 (4:36 pm)
Using getEngineName() and comparing that return against a set of strings will probably be the simplest solution.The Plastic Gems no5 Resource, might may be of use as reference on portability even though it was concerned with the differences between TGE and TGEa... which have similar differences as between T2D and T3D.
#4
Thanks and I'll look at the Plastic Gems to see if that helps.
05/30/2012 (8:44 pm)
I do not appear to have getEngineName() in T2D. (I'm using 1.7.5). Is this a feature of 1.7.6?Thanks and I'll look at the Plastic Gems to see if that helps.
#5
05/30/2012 (8:57 pm)
T3D was where I found that, getEngineName() may have been something new that was introduced in T3D then. I don't have T2D on this machine, but I do have a version of iT2D and it looks like it has the other two. Take a look in version.cc.
#6
In other words, the string "Torque Game Builder" appears to be unique to 2D products. And 3D either only return the version number from this call, or return some other string.
Would someone mind trying getVersionString() on iT2D and let me know what it says? :)
Thanks.
P.s. I have iT2D but it crashes for me and I'm not too worried about supporting it yet.
05/30/2012 (9:05 pm)
OK. Unless someone knows otherwise, it looks like I'll do a little hack along the lines of:$Twillex::dimensions = 3;
if (strstr(getVersionString(), "Torque Game Builder") > -1)
$Twillex::dimensions = 2;In other words, the string "Torque Game Builder" appears to be unique to 2D products. And 3D either only return the version number from this call, or return some other string.
Would someone mind trying getVersionString() on iT2D and let me know what it says? :)
Thanks.
P.s. I have iT2D but it crashes for me and I'm not too worried about supporting it yet.
Associate Scott Burns
GG Alumni