class_timer.rst 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Timer:
  4. Timer
  5. =====
  6. **Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Member Functions
  11. ----------------
  12. +----------------------------+------------------------------------------------------------------------------------------------------------+
  13. | void | :ref:`set_wait_time<class_Timer_set_wait_time>` **(** :ref:`float<class_float>` time_sec **)** |
  14. +----------------------------+------------------------------------------------------------------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`get_wait_time<class_Timer_get_wait_time>` **(** **)** const |
  16. +----------------------------+------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`set_one_shot<class_Timer_set_one_shot>` **(** :ref:`bool<class_bool>` enable **)** |
  18. +----------------------------+------------------------------------------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`is_one_shot<class_Timer_is_one_shot>` **(** **)** const |
  20. +----------------------------+------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`set_autostart<class_Timer_set_autostart>` **(** :ref:`bool<class_bool>` enable **)** |
  22. +----------------------------+------------------------------------------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`has_autostart<class_Timer_has_autostart>` **(** **)** const |
  24. +----------------------------+------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`start<class_Timer_start>` **(** **)** |
  26. +----------------------------+------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`stop<class_Timer_stop>` **(** **)** |
  28. +----------------------------+------------------------------------------------------------------------------------------------------------+
  29. | :ref:`float<class_float>` | :ref:`get_time_left<class_Timer_get_time_left>` **(** **)** const |
  30. +----------------------------+------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_timer_process_mode<class_Timer_set_timer_process_mode>` **(** :ref:`int<class_int>` mode **)** |
  32. +----------------------------+------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`get_timer_process_mode<class_Timer_get_timer_process_mode>` **(** **)** const |
  34. +----------------------------+------------------------------------------------------------------------------------------------------------+
  35. Signals
  36. -------
  37. - **timeout** **(** **)**
  38. Numeric Constants
  39. -----------------
  40. - **TIMER_PROCESS_FIXED** = **0** --- Update the timer at fixed intervals (framerate processing).
  41. - **TIMER_PROCESS_IDLE** = **1** --- Update the timer during the idle time at each frame.
  42. Description
  43. -----------
  44. Timer node. This is a simple node that will emit a timeout callback when the timer runs out. It can optionally be set to loop.
  45. Member Function Description
  46. ---------------------------
  47. .. _class_Timer_set_wait_time:
  48. - void **set_wait_time** **(** :ref:`float<class_float>` time_sec **)**
  49. Set wait time in seconds. When the time is over, it will emit the timeout signal.
  50. .. _class_Timer_get_wait_time:
  51. - :ref:`float<class_float>` **get_wait_time** **(** **)** const
  52. Return the wait time in seconds.
  53. .. _class_Timer_set_one_shot:
  54. - void **set_one_shot** **(** :ref:`bool<class_bool>` enable **)**
  55. Set as one-shot. If enabled, the timer will stop after timeout, otherwise it will automatically restart.
  56. .. _class_Timer_is_one_shot:
  57. - :ref:`bool<class_bool>` **is_one_shot** **(** **)** const
  58. Return true if configured as one-shot.
  59. .. _class_Timer_set_autostart:
  60. - void **set_autostart** **(** :ref:`bool<class_bool>` enable **)**
  61. Set to automatically start when entering the scene.
  62. .. _class_Timer_has_autostart:
  63. - :ref:`bool<class_bool>` **has_autostart** **(** **)** const
  64. Return true if set to automatically start when entering the scene.
  65. .. _class_Timer_start:
  66. - void **start** **(** **)**
  67. Start the timer.
  68. .. _class_Timer_stop:
  69. - void **stop** **(** **)**
  70. Stop (cancel) the timer.
  71. .. _class_Timer_get_time_left:
  72. - :ref:`float<class_float>` **get_time_left** **(** **)** const
  73. Return the time left for timeout in seconds if the timer is active, 0 otherwise.
  74. .. _class_Timer_set_timer_process_mode:
  75. - void **set_timer_process_mode** **(** :ref:`int<class_int>` mode **)**
  76. Set the timer's processing mode (fixed or idle, use TIMER_PROCESS\_\* constants as argument).
  77. .. _class_Timer_get_timer_process_mode:
  78. - :ref:`int<class_int>` **get_timer_process_mode** **(** **)** const
  79. Return the timer's processing mode.