gdscript_functions.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /**************************************************************************/
  2. /* gdscript_functions.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef GDSCRIPT_FUNCTIONS_H
  31. #define GDSCRIPT_FUNCTIONS_H
  32. #include "core/variant.h"
  33. class GDScriptFunctions {
  34. public:
  35. enum Function {
  36. MATH_SIN,
  37. MATH_COS,
  38. MATH_TAN,
  39. MATH_SINH,
  40. MATH_COSH,
  41. MATH_TANH,
  42. MATH_ASIN,
  43. MATH_ACOS,
  44. MATH_ATAN,
  45. MATH_ATAN2,
  46. MATH_SQRT,
  47. MATH_FMOD,
  48. MATH_FPOSMOD,
  49. MATH_POSMOD,
  50. MATH_FLOOR,
  51. MATH_CEIL,
  52. MATH_ROUND,
  53. MATH_ABS,
  54. MATH_SIGN,
  55. MATH_POW,
  56. MATH_LOG,
  57. MATH_EXP,
  58. MATH_ISNAN,
  59. MATH_ISINF,
  60. MATH_ISEQUALAPPROX,
  61. MATH_ISZEROAPPROX,
  62. MATH_EASE,
  63. MATH_DECIMALS,
  64. MATH_STEP_DECIMALS,
  65. MATH_STEPIFY,
  66. MATH_LERP,
  67. MATH_LERP_ANGLE,
  68. MATH_INVERSE_LERP,
  69. MATH_RANGE_LERP,
  70. MATH_SMOOTHSTEP,
  71. MATH_MOVE_TOWARD,
  72. MATH_DECTIME,
  73. MATH_RANDOMIZE,
  74. MATH_RAND,
  75. MATH_RANDF,
  76. MATH_RANDOM,
  77. MATH_SEED,
  78. MATH_RANDSEED,
  79. MATH_DEG2RAD,
  80. MATH_RAD2DEG,
  81. MATH_LINEAR2DB,
  82. MATH_DB2LINEAR,
  83. MATH_POLAR2CARTESIAN,
  84. MATH_CARTESIAN2POLAR,
  85. MATH_WRAP,
  86. MATH_WRAPF,
  87. LOGIC_MAX,
  88. LOGIC_MIN,
  89. LOGIC_CLAMP,
  90. LOGIC_NEAREST_PO2,
  91. OBJ_WEAKREF,
  92. FUNC_FUNCREF,
  93. TYPE_CONVERT,
  94. TYPE_OF,
  95. TYPE_EXISTS,
  96. TEXT_CHAR,
  97. TEXT_ORD,
  98. TEXT_STR,
  99. TEXT_PRINT,
  100. TEXT_PRINT_TABBED,
  101. TEXT_PRINT_SPACED,
  102. TEXT_PRINTERR,
  103. TEXT_PRINTRAW,
  104. TEXT_PRINT_DEBUG,
  105. PUSH_ERROR,
  106. PUSH_WARNING,
  107. VAR_TO_STR,
  108. STR_TO_VAR,
  109. VAR_TO_BYTES,
  110. BYTES_TO_VAR,
  111. GEN_RANGE,
  112. RESOURCE_LOAD,
  113. INST2DICT,
  114. DICT2INST,
  115. VALIDATE_JSON,
  116. PARSE_JSON,
  117. TO_JSON,
  118. HASH,
  119. COLOR8,
  120. COLORN,
  121. PRINT_STACK,
  122. GET_STACK,
  123. INSTANCE_FROM_ID,
  124. LEN,
  125. IS_INSTANCE_VALID,
  126. DEEP_EQUAL,
  127. FUNC_MAX
  128. };
  129. static const char *get_func_name(Function p_func);
  130. static void call(Function p_func, const Variant **p_args, int p_arg_count, Variant &r_ret, Variant::CallError &r_error);
  131. static bool is_deterministic(Function p_func);
  132. static MethodInfo get_info(Function p_func);
  133. };
  134. #endif // GDSCRIPT_FUNCTIONS_H