version_ScriptBinding.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. /*! @defgroup BuildInfoFunctions Build Info
  23. @ingroup TorqueScriptFunctions
  24. @{
  25. */
  26. /*! Use the isDebugBuild function to determine if this is a debug build.
  27. @return Returns true if this is a debug build, otherwise false.
  28. @sa getBuildString, getCompileTimeString, getVersionNumber, getVersionString
  29. */
  30. ConsoleFunctionWithDocs(isDebugBuild, ConsoleBool, 1, 1, ())
  31. {
  32. #ifdef TORQUE_DEBUG
  33. return true;
  34. #else
  35. return false;
  36. #endif
  37. }
  38. /*! Use the getVersionNumber function to get the version number of the currently executing engine.
  39. @return Returns an integer representing the engine's version number.
  40. @sa getBuildString, getCompileTimeString, getVersionString, isDebugBuild
  41. */
  42. ConsoleFunctionWithDocs( getVersionNumber, ConsoleInt, 1, 1, ())
  43. {
  44. return getVersionNumber();
  45. }
  46. /*! Use the getVersionString function to get the version name and number for the currently executing engine.
  47. @return Returns a string containing a name and an integer representing the engine's version type and version number.
  48. @sa getBuildString, getCompileTimeString, getVersionNumber, isDebugBuild
  49. */
  50. ConsoleFunctionWithDocs( getVersionString, ConsoleString, 1, 1, ())
  51. {
  52. return getVersionString();
  53. }
  54. /*! Use the getCompileTimeString function to determine when the currently running engine was built.
  55. @return Returns a string containing \Month Day Year at Hour:Minute:Second\ showing when this executable was built.
  56. @sa getBuildString, getVersionNumber, getVersionString, isDebugBuild
  57. */
  58. ConsoleFunctionWithDocs( getCompileTimeString, ConsoleString, 1, 1, ())
  59. {
  60. return getCompileTimeString();
  61. }
  62. /*! Use the getBuildString function to determine if this build is a \Debug\ release, or a \Release\ build.
  63. @return Returns a string, either \Debug\ for a debug build, or \Release\ for a release build.
  64. @sa getCompileTimeString, getVersionNumber, getVersionString, isDebugBuild
  65. */
  66. ConsoleFunctionWithDocs( getBuildString, ConsoleString, 1, 1, ())
  67. {
  68. #ifdef TORQUE_DEBUG
  69. return "Debug";
  70. #else
  71. return "Release";
  72. #endif
  73. }
  74. //-----------------------------------------------------------------------------
  75. /*! Gets the engine version.
  76. */
  77. ConsoleFunctionWithDocs( getEngineVersion, ConsoleString, 1, 1, ())
  78. {
  79. return T2D_ENGINE_VERSION;
  80. }
  81. //-----------------------------------------------------------------------------
  82. /*! Returns iPhone Tools Version
  83. */
  84. ConsoleFunctionWithDocs( getiPhoneToolsVersion, ConsoleString, 1, 1, ())
  85. {
  86. return T2D_IPHONETOOLS_VERSION;
  87. }
  88. //-----------------------------------------------------------------------------
  89. /*! Sets the company and product information.
  90. */
  91. ConsoleFunctionWithDocs(setCompanyAndProduct, ConsoleVoid, 3, 3, (company, product))
  92. {
  93. setCompanyName(StringTable->insert(argv[1]));
  94. setProductName(StringTable->insert(argv[2]));
  95. Con::setVariable("$Game::CompanyName", getCompanyName());
  96. Con::setVariable("$Game::ProductName", getProductName());
  97. char appDataPath[1024];
  98. dSprintf(appDataPath, sizeof(appDataPath), "%s/%s/%s", Platform::getUserDataDirectory(), getCompanyName(), getProductName());
  99. ResourceManager->addPath(appDataPath);
  100. }
  101. /*! @{ */ // group BuildInfoFunctions