class_os.rst 86 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the OS.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_OS:
  5. OS
  6. ==
  7. **Inherits:** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Operating System functions.
  12. Properties
  13. ----------
  14. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  15. | :ref:`String<class_String>` | :ref:`clipboard<class_OS_property_clipboard>` |
  16. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  17. | :ref:`int<class_int>` | :ref:`current_screen<class_OS_property_current_screen>` |
  18. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  19. | :ref:`int<class_int>` | :ref:`exit_code<class_OS_property_exit_code>` |
  20. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`keep_screen_on<class_OS_property_keep_screen_on>` |
  22. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`low_processor_usage_mode<class_OS_property_low_processor_usage_mode>` |
  24. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  25. | :ref:`ScreenOrientation<enum_OS_ScreenOrientation>` | :ref:`screen_orientation<class_OS_property_screen_orientation>` |
  26. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`vsync_enabled<class_OS_property_vsync_enabled>` |
  28. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`window_borderless<class_OS_property_window_borderless>` |
  30. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`window_fullscreen<class_OS_property_window_fullscreen>` |
  32. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`window_maximized<class_OS_property_window_maximized>` |
  34. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`window_minimized<class_OS_property_window_minimized>` |
  36. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`window_per_pixel_transparency_enabled<class_OS_property_window_per_pixel_transparency_enabled>` |
  38. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  39. | :ref:`Vector2<class_Vector2>` | :ref:`window_position<class_OS_property_window_position>` |
  40. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`window_resizable<class_OS_property_window_resizable>` |
  42. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  43. | :ref:`Vector2<class_Vector2>` | :ref:`window_size<class_OS_property_window_size>` |
  44. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
  45. Methods
  46. -------
  47. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`alert<class_OS_method_alert>` **(** :ref:`String<class_String>` text, :ref:`String<class_String>` title="Alert!" **)** |
  49. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`bool<class_bool>` | :ref:`can_draw<class_OS_method_can_draw>` **(** **)** const |
  51. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`bool<class_bool>` | :ref:`can_use_threads<class_OS_method_can_use_threads>` **(** **)** const |
  53. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`center_window<class_OS_method_center_window>` **(** **)** |
  55. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`close_midi_inputs<class_OS_method_close_midi_inputs>` **(** **)** |
  57. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`delay_msec<class_OS_method_delay_msec>` **(** :ref:`int<class_int>` msec **)** const |
  59. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`delay_usec<class_OS_method_delay_usec>` **(** :ref:`int<class_int>` usec **)** const |
  61. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`dump_memory_to_file<class_OS_method_dump_memory_to_file>` **(** :ref:`String<class_String>` file **)** |
  63. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`dump_resources_to_file<class_OS_method_dump_resources_to_file>` **(** :ref:`String<class_String>` file **)** |
  65. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`int<class_int>` | :ref:`execute<class_OS_method_execute>` **(** :ref:`String<class_String>` path, :ref:`PoolStringArray<class_PoolStringArray>` arguments, :ref:`bool<class_bool>` blocking, :ref:`Array<class_Array>` output=[ ] **)** |
  67. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`int<class_int>` | :ref:`find_scancode_from_string<class_OS_method_find_scancode_from_string>` **(** :ref:`String<class_String>` string **)** const |
  69. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`int<class_int>` | :ref:`get_audio_driver_count<class_OS_method_get_audio_driver_count>` **(** **)** const |
  71. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`String<class_String>` | :ref:`get_audio_driver_name<class_OS_method_get_audio_driver_name>` **(** :ref:`int<class_int>` driver **)** const |
  73. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_cmdline_args<class_OS_method_get_cmdline_args>` **(** **)** |
  75. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_connected_midi_inputs<class_OS_method_get_connected_midi_inputs>` **(** **)** |
  77. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`VideoDriver<enum_OS_VideoDriver>` | :ref:`get_current_video_driver<class_OS_method_get_current_video_driver>` **(** **)** const |
  79. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_date<class_OS_method_get_date>` **(** :ref:`bool<class_bool>` utc=false **)** const |
  81. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_datetime<class_OS_method_get_datetime>` **(** :ref:`bool<class_bool>` utc=false **)** const |
  83. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_datetime_from_unix_time<class_OS_method_get_datetime_from_unix_time>` **(** :ref:`int<class_int>` unix_time_val **)** const |
  85. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`int<class_int>` | :ref:`get_dynamic_memory_usage<class_OS_method_get_dynamic_memory_usage>` **(** **)** const |
  87. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`String<class_String>` | :ref:`get_environment<class_OS_method_get_environment>` **(** :ref:`String<class_String>` environment **)** const |
  89. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`String<class_String>` | :ref:`get_executable_path<class_OS_method_get_executable_path>` **(** **)** const |
  91. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`Vector2<class_Vector2>` | :ref:`get_ime_selection<class_OS_method_get_ime_selection>` **(** **)** const |
  93. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`String<class_String>` | :ref:`get_ime_text<class_OS_method_get_ime_text>` **(** **)** const |
  95. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`String<class_String>` | :ref:`get_latin_keyboard_variant<class_OS_method_get_latin_keyboard_variant>` **(** **)** const |
  97. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`String<class_String>` | :ref:`get_locale<class_OS_method_get_locale>` **(** **)** const |
  99. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`String<class_String>` | :ref:`get_model_name<class_OS_method_get_model_name>` **(** **)** const |
  101. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`String<class_String>` | :ref:`get_name<class_OS_method_get_name>` **(** **)** const |
  103. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`int<class_int>` | :ref:`get_power_percent_left<class_OS_method_get_power_percent_left>` **(** **)** |
  105. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`int<class_int>` | :ref:`get_power_seconds_left<class_OS_method_get_power_seconds_left>` **(** **)** |
  107. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :ref:`PowerState<enum_OS_PowerState>` | :ref:`get_power_state<class_OS_method_get_power_state>` **(** **)** |
  109. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`int<class_int>` | :ref:`get_process_id<class_OS_method_get_process_id>` **(** **)** const |
  111. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`int<class_int>` | :ref:`get_processor_count<class_OS_method_get_processor_count>` **(** **)** const |
  113. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`Vector2<class_Vector2>` | :ref:`get_real_window_size<class_OS_method_get_real_window_size>` **(** **)** const |
  115. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`String<class_String>` | :ref:`get_scancode_string<class_OS_method_get_scancode_string>` **(** :ref:`int<class_int>` code **)** const |
  117. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`int<class_int>` | :ref:`get_screen_count<class_OS_method_get_screen_count>` **(** **)** const |
  119. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`int<class_int>` | :ref:`get_screen_dpi<class_OS_method_get_screen_dpi>` **(** :ref:`int<class_int>` screen=-1 **)** const |
  121. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`Vector2<class_Vector2>` | :ref:`get_screen_position<class_OS_method_get_screen_position>` **(** :ref:`int<class_int>` screen=-1 **)** const |
  123. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | :ref:`Vector2<class_Vector2>` | :ref:`get_screen_size<class_OS_method_get_screen_size>` **(** :ref:`int<class_int>` screen=-1 **)** const |
  125. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | :ref:`int<class_int>` | :ref:`get_splash_tick_msec<class_OS_method_get_splash_tick_msec>` **(** **)** const |
  127. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :ref:`int<class_int>` | :ref:`get_static_memory_peak_usage<class_OS_method_get_static_memory_peak_usage>` **(** **)** const |
  129. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`int<class_int>` | :ref:`get_static_memory_usage<class_OS_method_get_static_memory_usage>` **(** **)** const |
  131. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`String<class_String>` | :ref:`get_system_dir<class_OS_method_get_system_dir>` **(** :ref:`SystemDir<enum_OS_SystemDir>` dir **)** const |
  133. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`int<class_int>` | :ref:`get_system_time_msecs<class_OS_method_get_system_time_msecs>` **(** **)** const |
  135. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`int<class_int>` | :ref:`get_system_time_secs<class_OS_method_get_system_time_secs>` **(** **)** const |
  137. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`int<class_int>` | :ref:`get_ticks_msec<class_OS_method_get_ticks_msec>` **(** **)** const |
  139. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | :ref:`int<class_int>` | :ref:`get_ticks_usec<class_OS_method_get_ticks_usec>` **(** **)** const |
  141. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_time<class_OS_method_get_time>` **(** :ref:`bool<class_bool>` utc=false **)** const |
  143. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_time_zone_info<class_OS_method_get_time_zone_info>` **(** **)** const |
  145. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | :ref:`String<class_String>` | :ref:`get_unique_id<class_OS_method_get_unique_id>` **(** **)** const |
  147. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | :ref:`int<class_int>` | :ref:`get_unix_time<class_OS_method_get_unix_time>` **(** **)** const |
  149. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | :ref:`int<class_int>` | :ref:`get_unix_time_from_datetime<class_OS_method_get_unix_time_from_datetime>` **(** :ref:`Dictionary<class_Dictionary>` datetime **)** const |
  151. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | :ref:`String<class_String>` | :ref:`get_user_data_dir<class_OS_method_get_user_data_dir>` **(** **)** const |
  153. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | :ref:`int<class_int>` | :ref:`get_video_driver_count<class_OS_method_get_video_driver_count>` **(** **)** const |
  155. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | :ref:`String<class_String>` | :ref:`get_video_driver_name<class_OS_method_get_video_driver_name>` **(** :ref:`VideoDriver<enum_OS_VideoDriver>` driver **)** const |
  157. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | :ref:`int<class_int>` | :ref:`get_virtual_keyboard_height<class_OS_method_get_virtual_keyboard_height>` **(** **)** |
  159. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | :ref:`Rect2<class_Rect2>` | :ref:`get_window_safe_area<class_OS_method_get_window_safe_area>` **(** **)** const |
  161. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | :ref:`bool<class_bool>` | :ref:`has_environment<class_OS_method_has_environment>` **(** :ref:`String<class_String>` environment **)** const |
  163. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. | :ref:`bool<class_bool>` | :ref:`has_feature<class_OS_method_has_feature>` **(** :ref:`String<class_String>` tag_name **)** const |
  165. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  166. | :ref:`bool<class_bool>` | :ref:`has_touchscreen_ui_hint<class_OS_method_has_touchscreen_ui_hint>` **(** **)** const |
  167. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  168. | :ref:`bool<class_bool>` | :ref:`has_virtual_keyboard<class_OS_method_has_virtual_keyboard>` **(** **)** const |
  169. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  170. | void | :ref:`hide_virtual_keyboard<class_OS_method_hide_virtual_keyboard>` **(** **)** |
  171. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  172. | :ref:`bool<class_bool>` | :ref:`is_debug_build<class_OS_method_is_debug_build>` **(** **)** const |
  173. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  174. | :ref:`bool<class_bool>` | :ref:`is_ok_left_and_cancel_right<class_OS_method_is_ok_left_and_cancel_right>` **(** **)** const |
  175. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  176. | :ref:`bool<class_bool>` | :ref:`is_scancode_unicode<class_OS_method_is_scancode_unicode>` **(** :ref:`int<class_int>` code **)** const |
  177. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  178. | :ref:`bool<class_bool>` | :ref:`is_stdout_verbose<class_OS_method_is_stdout_verbose>` **(** **)** const |
  179. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  180. | :ref:`bool<class_bool>` | :ref:`is_userfs_persistent<class_OS_method_is_userfs_persistent>` **(** **)** const |
  181. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  182. | :ref:`bool<class_bool>` | :ref:`is_window_always_on_top<class_OS_method_is_window_always_on_top>` **(** **)** const |
  183. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  184. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`kill<class_OS_method_kill>` **(** :ref:`int<class_int>` pid **)** |
  185. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  186. | void | :ref:`move_window_to_foreground<class_OS_method_move_window_to_foreground>` **(** **)** |
  187. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  188. | :ref:`bool<class_bool>` | :ref:`native_video_is_playing<class_OS_method_native_video_is_playing>` **(** **)** |
  189. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  190. | void | :ref:`native_video_pause<class_OS_method_native_video_pause>` **(** **)** |
  191. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  192. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`native_video_play<class_OS_method_native_video_play>` **(** :ref:`String<class_String>` path, :ref:`float<class_float>` volume, :ref:`String<class_String>` audio_track, :ref:`String<class_String>` subtitle_track **)** |
  193. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  194. | void | :ref:`native_video_stop<class_OS_method_native_video_stop>` **(** **)** |
  195. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  196. | void | :ref:`native_video_unpause<class_OS_method_native_video_unpause>` **(** **)** |
  197. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  198. | void | :ref:`open_midi_inputs<class_OS_method_open_midi_inputs>` **(** **)** |
  199. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  200. | void | :ref:`print_all_resources<class_OS_method_print_all_resources>` **(** :ref:`String<class_String>` tofile="" **)** |
  201. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  202. | void | :ref:`print_all_textures_by_size<class_OS_method_print_all_textures_by_size>` **(** **)** |
  203. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  204. | void | :ref:`print_resources_by_type<class_OS_method_print_resources_by_type>` **(** :ref:`PoolStringArray<class_PoolStringArray>` types **)** |
  205. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  206. | void | :ref:`print_resources_in_use<class_OS_method_print_resources_in_use>` **(** :ref:`bool<class_bool>` short=false **)** |
  207. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  208. | void | :ref:`request_attention<class_OS_method_request_attention>` **(** **)** |
  209. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  210. | :ref:`bool<class_bool>` | :ref:`request_permission<class_OS_method_request_permission>` **(** :ref:`String<class_String>` name **)** |
  211. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  212. | void | :ref:`set_icon<class_OS_method_set_icon>` **(** :ref:`Image<class_Image>` icon **)** |
  213. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  214. | void | :ref:`set_ime_active<class_OS_method_set_ime_active>` **(** :ref:`bool<class_bool>` active **)** |
  215. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  216. | void | :ref:`set_ime_position<class_OS_method_set_ime_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  217. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  218. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`set_thread_name<class_OS_method_set_thread_name>` **(** :ref:`String<class_String>` name **)** |
  219. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  220. | void | :ref:`set_use_file_access_save_and_swap<class_OS_method_set_use_file_access_save_and_swap>` **(** :ref:`bool<class_bool>` enabled **)** |
  221. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  222. | void | :ref:`set_window_always_on_top<class_OS_method_set_window_always_on_top>` **(** :ref:`bool<class_bool>` enabled **)** |
  223. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  224. | void | :ref:`set_window_title<class_OS_method_set_window_title>` **(** :ref:`String<class_String>` title **)** |
  225. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  226. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`shell_open<class_OS_method_shell_open>` **(** :ref:`String<class_String>` uri **)** |
  227. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  228. | void | :ref:`show_virtual_keyboard<class_OS_method_show_virtual_keyboard>` **(** :ref:`String<class_String>` existing_text="" **)** |
  229. +-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  230. Enumerations
  231. ------------
  232. .. _enum_OS_VideoDriver:
  233. .. _class_OS_constant_VIDEO_DRIVER_GLES2:
  234. .. _class_OS_constant_VIDEO_DRIVER_GLES3:
  235. enum **VideoDriver**:
  236. - **VIDEO_DRIVER_GLES2** = **1** --- The GLES2 rendering backend. It uses OpenGL ES 2.0 on mobile devices, OpenGL 2.1 on desktop platforms and WebGL 1.0 on the web.
  237. - **VIDEO_DRIVER_GLES3** = **0** --- The GLES3 rendering backend. It uses OpenGL ES 3.0 on mobile devices, OpenGL 3.3 on desktop platforms and WebGL 2.0 on the web.
  238. .. _enum_OS_Weekday:
  239. .. _class_OS_constant_DAY_SUNDAY:
  240. .. _class_OS_constant_DAY_MONDAY:
  241. .. _class_OS_constant_DAY_TUESDAY:
  242. .. _class_OS_constant_DAY_WEDNESDAY:
  243. .. _class_OS_constant_DAY_THURSDAY:
  244. .. _class_OS_constant_DAY_FRIDAY:
  245. .. _class_OS_constant_DAY_SATURDAY:
  246. enum **Weekday**:
  247. - **DAY_SUNDAY** = **0** --- Sunday.
  248. - **DAY_MONDAY** = **1** --- Monday.
  249. - **DAY_TUESDAY** = **2** --- Tuesday.
  250. - **DAY_WEDNESDAY** = **3** --- Wednesday.
  251. - **DAY_THURSDAY** = **4** --- Thursday.
  252. - **DAY_FRIDAY** = **5** --- Friday.
  253. - **DAY_SATURDAY** = **6** --- Saturday.
  254. .. _enum_OS_Month:
  255. .. _class_OS_constant_MONTH_JANUARY:
  256. .. _class_OS_constant_MONTH_FEBRUARY:
  257. .. _class_OS_constant_MONTH_MARCH:
  258. .. _class_OS_constant_MONTH_APRIL:
  259. .. _class_OS_constant_MONTH_MAY:
  260. .. _class_OS_constant_MONTH_JUNE:
  261. .. _class_OS_constant_MONTH_JULY:
  262. .. _class_OS_constant_MONTH_AUGUST:
  263. .. _class_OS_constant_MONTH_SEPTEMBER:
  264. .. _class_OS_constant_MONTH_OCTOBER:
  265. .. _class_OS_constant_MONTH_NOVEMBER:
  266. .. _class_OS_constant_MONTH_DECEMBER:
  267. enum **Month**:
  268. - **MONTH_JANUARY** = **1** --- January.
  269. - **MONTH_FEBRUARY** = **2** --- February.
  270. - **MONTH_MARCH** = **3** --- March.
  271. - **MONTH_APRIL** = **4** --- April.
  272. - **MONTH_MAY** = **5** --- May.
  273. - **MONTH_JUNE** = **6** --- June.
  274. - **MONTH_JULY** = **7** --- July.
  275. - **MONTH_AUGUST** = **8** --- August.
  276. - **MONTH_SEPTEMBER** = **9** --- September.
  277. - **MONTH_OCTOBER** = **10** --- October.
  278. - **MONTH_NOVEMBER** = **11** --- November.
  279. - **MONTH_DECEMBER** = **12** --- December.
  280. .. _enum_OS_ScreenOrientation:
  281. .. _class_OS_constant_SCREEN_ORIENTATION_LANDSCAPE:
  282. .. _class_OS_constant_SCREEN_ORIENTATION_PORTRAIT:
  283. .. _class_OS_constant_SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
  284. .. _class_OS_constant_SCREEN_ORIENTATION_REVERSE_PORTRAIT:
  285. .. _class_OS_constant_SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
  286. .. _class_OS_constant_SCREEN_ORIENTATION_SENSOR_PORTRAIT:
  287. .. _class_OS_constant_SCREEN_ORIENTATION_SENSOR:
  288. enum **ScreenOrientation**:
  289. - **SCREEN_ORIENTATION_LANDSCAPE** = **0** --- Landscape screen orientation.
  290. - **SCREEN_ORIENTATION_PORTRAIT** = **1** --- Portrait screen orientation.
  291. - **SCREEN_ORIENTATION_REVERSE_LANDSCAPE** = **2** --- Reverse landscape screen orientation.
  292. - **SCREEN_ORIENTATION_REVERSE_PORTRAIT** = **3** --- Reverse portrait screen orientation.
  293. - **SCREEN_ORIENTATION_SENSOR_LANDSCAPE** = **4** --- Uses landscape or reverse landscape based on the hardware sensor.
  294. - **SCREEN_ORIENTATION_SENSOR_PORTRAIT** = **5** --- Uses portrait or reverse portrait based on the hardware sensor.
  295. - **SCREEN_ORIENTATION_SENSOR** = **6** --- Uses most suitable orientation based on the hardware sensor.
  296. .. _enum_OS_SystemDir:
  297. .. _class_OS_constant_SYSTEM_DIR_DESKTOP:
  298. .. _class_OS_constant_SYSTEM_DIR_DCIM:
  299. .. _class_OS_constant_SYSTEM_DIR_DOCUMENTS:
  300. .. _class_OS_constant_SYSTEM_DIR_DOWNLOADS:
  301. .. _class_OS_constant_SYSTEM_DIR_MOVIES:
  302. .. _class_OS_constant_SYSTEM_DIR_MUSIC:
  303. .. _class_OS_constant_SYSTEM_DIR_PICTURES:
  304. .. _class_OS_constant_SYSTEM_DIR_RINGTONES:
  305. enum **SystemDir**:
  306. - **SYSTEM_DIR_DESKTOP** = **0** --- Desktop directory path.
  307. - **SYSTEM_DIR_DCIM** = **1** --- DCIM (Digital Camera Images) directory path.
  308. - **SYSTEM_DIR_DOCUMENTS** = **2** --- Documents directory path.
  309. - **SYSTEM_DIR_DOWNLOADS** = **3** --- Downloads directory path.
  310. - **SYSTEM_DIR_MOVIES** = **4** --- Movies directory path.
  311. - **SYSTEM_DIR_MUSIC** = **5** --- Music directory path.
  312. - **SYSTEM_DIR_PICTURES** = **6** --- Pictures directory path.
  313. - **SYSTEM_DIR_RINGTONES** = **7** --- Ringtones directory path.
  314. .. _enum_OS_PowerState:
  315. .. _class_OS_constant_POWERSTATE_UNKNOWN:
  316. .. _class_OS_constant_POWERSTATE_ON_BATTERY:
  317. .. _class_OS_constant_POWERSTATE_NO_BATTERY:
  318. .. _class_OS_constant_POWERSTATE_CHARGING:
  319. .. _class_OS_constant_POWERSTATE_CHARGED:
  320. enum **PowerState**:
  321. - **POWERSTATE_UNKNOWN** = **0** --- Unknown powerstate.
  322. - **POWERSTATE_ON_BATTERY** = **1** --- Unplugged, running on battery.
  323. - **POWERSTATE_NO_BATTERY** = **2** --- Plugged in, no battery available.
  324. - **POWERSTATE_CHARGING** = **3** --- Plugged in, battery charging.
  325. - **POWERSTATE_CHARGED** = **4** --- Plugged in, battery fully charged.
  326. Description
  327. -----------
  328. Operating System functions. OS Wraps the most common functionality to communicate with the host Operating System, such as: mouse grabbing, mouse cursors, clipboard, video mode, date and time, timers, environment variables, execution of binaries, command line, etc.
  329. Property Descriptions
  330. ---------------------
  331. .. _class_OS_property_clipboard:
  332. - :ref:`String<class_String>` **clipboard**
  333. +----------+----------------------+
  334. | *Setter* | set_clipboard(value) |
  335. +----------+----------------------+
  336. | *Getter* | get_clipboard() |
  337. +----------+----------------------+
  338. The clipboard from the host OS. Might be unavailable on some platforms.
  339. .. _class_OS_property_current_screen:
  340. - :ref:`int<class_int>` **current_screen**
  341. +----------+---------------------------+
  342. | *Setter* | set_current_screen(value) |
  343. +----------+---------------------------+
  344. | *Getter* | get_current_screen() |
  345. +----------+---------------------------+
  346. The current screen index (starting from 0).
  347. .. _class_OS_property_exit_code:
  348. - :ref:`int<class_int>` **exit_code**
  349. +----------+----------------------+
  350. | *Setter* | set_exit_code(value) |
  351. +----------+----------------------+
  352. | *Getter* | get_exit_code() |
  353. +----------+----------------------+
  354. The exit code passed to the OS when the main loop exits.
  355. .. _class_OS_property_keep_screen_on:
  356. - :ref:`bool<class_bool>` **keep_screen_on**
  357. +----------+---------------------------+
  358. | *Setter* | set_keep_screen_on(value) |
  359. +----------+---------------------------+
  360. | *Getter* | is_keep_screen_on() |
  361. +----------+---------------------------+
  362. If ``true``, the engine tries to keep the screen on while the game is running. Useful on mobile.
  363. .. _class_OS_property_low_processor_usage_mode:
  364. - :ref:`bool<class_bool>` **low_processor_usage_mode**
  365. +----------+-------------------------------------+
  366. | *Setter* | set_low_processor_usage_mode(value) |
  367. +----------+-------------------------------------+
  368. | *Getter* | is_in_low_processor_usage_mode() |
  369. +----------+-------------------------------------+
  370. If ``true``, the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile.
  371. .. _class_OS_property_screen_orientation:
  372. - :ref:`ScreenOrientation<enum_OS_ScreenOrientation>` **screen_orientation**
  373. +----------+-------------------------------+
  374. | *Setter* | set_screen_orientation(value) |
  375. +----------+-------------------------------+
  376. | *Getter* | get_screen_orientation() |
  377. +----------+-------------------------------+
  378. The current screen orientation.
  379. .. _class_OS_property_vsync_enabled:
  380. - :ref:`bool<class_bool>` **vsync_enabled**
  381. +----------+----------------------+
  382. | *Setter* | set_use_vsync(value) |
  383. +----------+----------------------+
  384. | *Getter* | is_vsync_enabled() |
  385. +----------+----------------------+
  386. If ``true``, vertical synchronization (Vsync) is enabled.
  387. .. _class_OS_property_window_borderless:
  388. - :ref:`bool<class_bool>` **window_borderless**
  389. +----------+------------------------------+
  390. | *Setter* | set_borderless_window(value) |
  391. +----------+------------------------------+
  392. | *Getter* | get_borderless_window() |
  393. +----------+------------------------------+
  394. If ``true``, removes the window frame.
  395. .. _class_OS_property_window_fullscreen:
  396. - :ref:`bool<class_bool>` **window_fullscreen**
  397. +----------+------------------------------+
  398. | *Setter* | set_window_fullscreen(value) |
  399. +----------+------------------------------+
  400. | *Getter* | is_window_fullscreen() |
  401. +----------+------------------------------+
  402. If ``true``, the window is fullscreen.
  403. .. _class_OS_property_window_maximized:
  404. - :ref:`bool<class_bool>` **window_maximized**
  405. +----------+-----------------------------+
  406. | *Setter* | set_window_maximized(value) |
  407. +----------+-----------------------------+
  408. | *Getter* | is_window_maximized() |
  409. +----------+-----------------------------+
  410. If ``true``, the window is maximized.
  411. .. _class_OS_property_window_minimized:
  412. - :ref:`bool<class_bool>` **window_minimized**
  413. +----------+-----------------------------+
  414. | *Setter* | set_window_minimized(value) |
  415. +----------+-----------------------------+
  416. | *Getter* | is_window_minimized() |
  417. +----------+-----------------------------+
  418. If ``true``, the window is minimized.
  419. .. _class_OS_property_window_per_pixel_transparency_enabled:
  420. - :ref:`bool<class_bool>` **window_per_pixel_transparency_enabled**
  421. +----------+--------------------------------------------------+
  422. | *Setter* | set_window_per_pixel_transparency_enabled(value) |
  423. +----------+--------------------------------------------------+
  424. | *Getter* | get_window_per_pixel_transparency_enabled() |
  425. +----------+--------------------------------------------------+
  426. .. _class_OS_property_window_position:
  427. - :ref:`Vector2<class_Vector2>` **window_position**
  428. +----------+----------------------------+
  429. | *Setter* | set_window_position(value) |
  430. +----------+----------------------------+
  431. | *Getter* | get_window_position() |
  432. +----------+----------------------------+
  433. The window position relative to the screen, the origin is the top left corner, +Y axis goes to the bottom and +X axis goes to the right.
  434. .. _class_OS_property_window_resizable:
  435. - :ref:`bool<class_bool>` **window_resizable**
  436. +----------+-----------------------------+
  437. | *Setter* | set_window_resizable(value) |
  438. +----------+-----------------------------+
  439. | *Getter* | is_window_resizable() |
  440. +----------+-----------------------------+
  441. If ``true``, the window is resizable by the user.
  442. .. _class_OS_property_window_size:
  443. - :ref:`Vector2<class_Vector2>` **window_size**
  444. +----------+------------------------+
  445. | *Setter* | set_window_size(value) |
  446. +----------+------------------------+
  447. | *Getter* | get_window_size() |
  448. +----------+------------------------+
  449. The size of the window (without counting window manager decorations).
  450. Method Descriptions
  451. -------------------
  452. .. _class_OS_method_alert:
  453. - void **alert** **(** :ref:`String<class_String>` text, :ref:`String<class_String>` title="Alert!" **)**
  454. Displays a modal dialog box utilizing the host OS.
  455. .. _class_OS_method_can_draw:
  456. - :ref:`bool<class_bool>` **can_draw** **(** **)** const
  457. Returns ``true`` if the host OS allows drawing.
  458. .. _class_OS_method_can_use_threads:
  459. - :ref:`bool<class_bool>` **can_use_threads** **(** **)** const
  460. Returns ``true`` if the current host platform is using multiple threads.
  461. .. _class_OS_method_center_window:
  462. - void **center_window** **(** **)**
  463. Centers the window on the screen if in windowed mode.
  464. .. _class_OS_method_close_midi_inputs:
  465. - void **close_midi_inputs** **(** **)**
  466. .. _class_OS_method_delay_msec:
  467. - void **delay_msec** **(** :ref:`int<class_int>` msec **)** const
  468. Delay execution of the current thread by given milliseconds.
  469. .. _class_OS_method_delay_usec:
  470. - void **delay_usec** **(** :ref:`int<class_int>` usec **)** const
  471. Delay execution of the current thread by given microseconds.
  472. .. _class_OS_method_dump_memory_to_file:
  473. - void **dump_memory_to_file** **(** :ref:`String<class_String>` file **)**
  474. Dumps the memory allocation ringlist to a file (only works in debug).
  475. Entry format per line: "Address - Size - Description".
  476. .. _class_OS_method_dump_resources_to_file:
  477. - void **dump_resources_to_file** **(** :ref:`String<class_String>` file **)**
  478. Dumps all used resources to file (only works in debug).
  479. Entry format per line: "Resource Type : Resource Location".
  480. At the end of the file is a statistic of all used Resource Types.
  481. .. _class_OS_method_execute:
  482. - :ref:`int<class_int>` **execute** **(** :ref:`String<class_String>` path, :ref:`PoolStringArray<class_PoolStringArray>` arguments, :ref:`bool<class_bool>` blocking, :ref:`Array<class_Array>` output=[ ] **)**
  483. Execute the file at the given path with the arguments passed as an array of strings. Platform path resolution will take place. The resolved file must exist and be executable.
  484. The arguments are used in the given order and separated by a space, so ``OS.execute('ping', ['-w', '3', 'godotengine.org'], false)`` will resolve to ``ping -w 3 godotengine.org`` in the system's shell.
  485. This method has slightly different behaviour based on whether the ``blocking`` mode is enabled.
  486. When ``blocking`` is enabled, the Godot thread will pause its execution while waiting for the process to terminate. The shell output of the process will be written to the ``output`` array as a single string. When the process terminates, the Godot thread will resume execution.
  487. When ``blocking`` is disabled, the Godot thread will continue while the new process runs. It is not possible to retrieve the shell output in non-blocking mode, so ``output`` will be empty.
  488. The return value also depends on the blocking mode. When blocking, the method will return -2 (no process ID information is available in blocking mode). When non-blocking, the method returns a process ID, which you can use to monitor the process (and potentially terminate it with :ref:`kill<class_OS_method_kill>`). If the process forking (non-blocking) or opening (blocking) fails, the method will return -1.
  489. Example of blocking mode and retrieving the shell output:
  490. ::
  491. var output = []
  492. OS.execute('ls', ['-l', '/tmp'], true, output)
  493. Example of non-blocking mode, running another instance of the project and storing its process ID:
  494. ::
  495. var pid = OS.execute(OS.get_executable_path(), [], false)
  496. If you wish to access a shell built-in or perform a composite command, a platform-specific shell can be invoked. For example:
  497. ::
  498. OS.execute('CMD.exe', ['/C', 'cd %TEMP% && dir'], true, output)
  499. .. _class_OS_method_find_scancode_from_string:
  500. - :ref:`int<class_int>` **find_scancode_from_string** **(** :ref:`String<class_String>` string **)** const
  501. Returns the scancode of the given string (e.g. "Escape")
  502. .. _class_OS_method_get_audio_driver_count:
  503. - :ref:`int<class_int>` **get_audio_driver_count** **(** **)** const
  504. Returns the total number of available audio drivers.
  505. .. _class_OS_method_get_audio_driver_name:
  506. - :ref:`String<class_String>` **get_audio_driver_name** **(** :ref:`int<class_int>` driver **)** const
  507. Returns the audio driver name for the given index.
  508. .. _class_OS_method_get_cmdline_args:
  509. - :ref:`PoolStringArray<class_PoolStringArray>` **get_cmdline_args** **(** **)**
  510. Returns the command line arguments passed to the engine.
  511. .. _class_OS_method_get_connected_midi_inputs:
  512. - :ref:`PoolStringArray<class_PoolStringArray>` **get_connected_midi_inputs** **(** **)**
  513. .. _class_OS_method_get_current_video_driver:
  514. - :ref:`VideoDriver<enum_OS_VideoDriver>` **get_current_video_driver** **(** **)** const
  515. Returns the currently used video driver, using one of the values from :ref:`VideoDriver<enum_OS_VideoDriver>`.
  516. .. _class_OS_method_get_date:
  517. - :ref:`Dictionary<class_Dictionary>` **get_date** **(** :ref:`bool<class_bool>` utc=false **)** const
  518. Returns current date as a dictionary of keys: year, month, day, weekday, dst (daylight savings time).
  519. .. _class_OS_method_get_datetime:
  520. - :ref:`Dictionary<class_Dictionary>` **get_datetime** **(** :ref:`bool<class_bool>` utc=false **)** const
  521. Returns current datetime as a dictionary of keys: year, month, day, weekday, dst (daylight savings time), hour, minute, second.
  522. .. _class_OS_method_get_datetime_from_unix_time:
  523. - :ref:`Dictionary<class_Dictionary>` **get_datetime_from_unix_time** **(** :ref:`int<class_int>` unix_time_val **)** const
  524. Get a dictionary of time values when given epoch time.
  525. Dictionary Time values will be a union of values from :ref:`get_time<class_OS_method_get_time>` and :ref:`get_date<class_OS_method_get_date>` dictionaries (with the exception of dst = day light standard time, as it cannot be determined from epoch).
  526. .. _class_OS_method_get_dynamic_memory_usage:
  527. - :ref:`int<class_int>` **get_dynamic_memory_usage** **(** **)** const
  528. Returns the total amount of dynamic memory used (only works in debug).
  529. .. _class_OS_method_get_environment:
  530. - :ref:`String<class_String>` **get_environment** **(** :ref:`String<class_String>` environment **)** const
  531. Returns an environment variable.
  532. .. _class_OS_method_get_executable_path:
  533. - :ref:`String<class_String>` **get_executable_path** **(** **)** const
  534. Returns the path to the current engine executable.
  535. .. _class_OS_method_get_ime_selection:
  536. - :ref:`Vector2<class_Vector2>` **get_ime_selection** **(** **)** const
  537. Returns IME selection range.
  538. .. _class_OS_method_get_ime_text:
  539. - :ref:`String<class_String>` **get_ime_text** **(** **)** const
  540. Returns IME intermediate text.
  541. .. _class_OS_method_get_latin_keyboard_variant:
  542. - :ref:`String<class_String>` **get_latin_keyboard_variant** **(** **)** const
  543. Returns the current latin keyboard variant as a String.
  544. Possible return values are: "QWERTY", "AZERTY", "QZERTY", "DVORAK", "NEO", "COLEMAK" or "ERROR".
  545. .. _class_OS_method_get_locale:
  546. - :ref:`String<class_String>` **get_locale** **(** **)** const
  547. Returns the host OS locale.
  548. .. _class_OS_method_get_model_name:
  549. - :ref:`String<class_String>` **get_model_name** **(** **)** const
  550. Returns the model name of the current device.
  551. .. _class_OS_method_get_name:
  552. - :ref:`String<class_String>` **get_name** **(** **)** const
  553. Returns the name of the host OS. Possible values are: "Android", "Haiku", "iOS", "HTML5", "OSX", "Server", "Windows", "UWP", "X11".
  554. .. _class_OS_method_get_power_percent_left:
  555. - :ref:`int<class_int>` **get_power_percent_left** **(** **)**
  556. Returns the amount of battery left in the device as a percentage.
  557. .. _class_OS_method_get_power_seconds_left:
  558. - :ref:`int<class_int>` **get_power_seconds_left** **(** **)**
  559. Returns the time in seconds before the device runs out of battery.
  560. .. _class_OS_method_get_power_state:
  561. - :ref:`PowerState<enum_OS_PowerState>` **get_power_state** **(** **)**
  562. Returns the current state of the device regarding battery and power. See ``POWERSTATE_*`` constants.
  563. .. _class_OS_method_get_process_id:
  564. - :ref:`int<class_int>` **get_process_id** **(** **)** const
  565. Returns the game process ID
  566. .. _class_OS_method_get_processor_count:
  567. - :ref:`int<class_int>` **get_processor_count** **(** **)** const
  568. Returns the number of cores available in the host machine.
  569. .. _class_OS_method_get_real_window_size:
  570. - :ref:`Vector2<class_Vector2>` **get_real_window_size** **(** **)** const
  571. Returns the window size including decorations like window borders.
  572. .. _class_OS_method_get_scancode_string:
  573. - :ref:`String<class_String>` **get_scancode_string** **(** :ref:`int<class_int>` code **)** const
  574. Returns the given scancode as a string (e.g. Return values: "Escape", "Shift+Escape").
  575. .. _class_OS_method_get_screen_count:
  576. - :ref:`int<class_int>` **get_screen_count** **(** **)** const
  577. Returns the number of displays attached to the host machine.
  578. .. _class_OS_method_get_screen_dpi:
  579. - :ref:`int<class_int>` **get_screen_dpi** **(** :ref:`int<class_int>` screen=-1 **)** const
  580. Returns the dots per inch density of the specified screen.
  581. On Android Devices, the actual screen densities are grouped into six generalized densities:
  582. ldpi - 120 dpi
  583. mdpi - 160 dpi
  584. hdpi - 240 dpi
  585. xhdpi - 320 dpi
  586. xxhdpi - 480 dpi
  587. xxxhdpi - 640 dpi
  588. .. _class_OS_method_get_screen_position:
  589. - :ref:`Vector2<class_Vector2>` **get_screen_position** **(** :ref:`int<class_int>` screen=-1 **)** const
  590. Returns the position of the specified screen by index. If no screen index is provided, the current screen will be used.
  591. .. _class_OS_method_get_screen_size:
  592. - :ref:`Vector2<class_Vector2>` **get_screen_size** **(** :ref:`int<class_int>` screen=-1 **)** const
  593. Returns the dimensions in pixels of the specified screen.
  594. .. _class_OS_method_get_splash_tick_msec:
  595. - :ref:`int<class_int>` **get_splash_tick_msec** **(** **)** const
  596. .. _class_OS_method_get_static_memory_peak_usage:
  597. - :ref:`int<class_int>` **get_static_memory_peak_usage** **(** **)** const
  598. Returns the max amount of static memory used (only works in debug).
  599. .. _class_OS_method_get_static_memory_usage:
  600. - :ref:`int<class_int>` **get_static_memory_usage** **(** **)** const
  601. Returns the amount of static memory being used by the program in bytes.
  602. .. _class_OS_method_get_system_dir:
  603. - :ref:`String<class_String>` **get_system_dir** **(** :ref:`SystemDir<enum_OS_SystemDir>` dir **)** const
  604. Returns the actual path to commonly used folders across different platforms. Available locations are specified in :ref:`SystemDir<enum_OS_SystemDir>`.
  605. .. _class_OS_method_get_system_time_msecs:
  606. - :ref:`int<class_int>` **get_system_time_msecs** **(** **)** const
  607. Returns the epoch time of the operating system in milliseconds.
  608. .. _class_OS_method_get_system_time_secs:
  609. - :ref:`int<class_int>` **get_system_time_secs** **(** **)** const
  610. Returns the epoch time of the operating system in seconds.
  611. .. _class_OS_method_get_ticks_msec:
  612. - :ref:`int<class_int>` **get_ticks_msec** **(** **)** const
  613. Returns the amount of time passed in milliseconds since the engine started.
  614. .. _class_OS_method_get_ticks_usec:
  615. - :ref:`int<class_int>` **get_ticks_usec** **(** **)** const
  616. Returns the amount of time passed in microseconds since the engine started.
  617. .. _class_OS_method_get_time:
  618. - :ref:`Dictionary<class_Dictionary>` **get_time** **(** :ref:`bool<class_bool>` utc=false **)** const
  619. Returns current time as a dictionary of keys: hour, minute, second.
  620. .. _class_OS_method_get_time_zone_info:
  621. - :ref:`Dictionary<class_Dictionary>` **get_time_zone_info** **(** **)** const
  622. Returns the current time zone as a dictionary with the keys: bias and name.
  623. .. _class_OS_method_get_unique_id:
  624. - :ref:`String<class_String>` **get_unique_id** **(** **)** const
  625. Returns a string that is unique to the device.
  626. Returns empty string on HTML5 and UWP which are not supported yet.
  627. .. _class_OS_method_get_unix_time:
  628. - :ref:`int<class_int>` **get_unix_time** **(** **)** const
  629. Returns the current unix epoch timestamp.
  630. .. _class_OS_method_get_unix_time_from_datetime:
  631. - :ref:`int<class_int>` **get_unix_time_from_datetime** **(** :ref:`Dictionary<class_Dictionary>` datetime **)** const
  632. Get an epoch time value from a dictionary of time values.
  633. ``datetime`` must be populated with the following keys: year, month, day, hour, minute, second.
  634. You can pass the output from :ref:`get_datetime_from_unix_time<class_OS_method_get_datetime_from_unix_time>` directly into this function. Daylight savings time (dst), if present, is ignored.
  635. .. _class_OS_method_get_user_data_dir:
  636. - :ref:`String<class_String>` **get_user_data_dir** **(** **)** const
  637. Returns the absolute directory path where user data is written (``user://``).
  638. On Linux, this is ``~/.local/share/godot/app_userdata/[project_name]``, or ``~/.local/share/[custom_name]`` if ``use_custom_user_dir`` is set.
  639. On macOS, this is ``~/Library/Application Support/Godot/app_userdata/[project_name]``, or ``~/Library/Application Support/[custom_name]`` if ``use_custom_user_dir`` is set.
  640. On Windows, this is ``%APPDATA%/Godot/app_userdata/[project_name]``, or ``%APPDATA%/[custom_name]`` if ``use_custom_user_dir`` is set.
  641. If the project name is empty, ``user://`` falls back to ``res://``.
  642. .. _class_OS_method_get_video_driver_count:
  643. - :ref:`int<class_int>` **get_video_driver_count** **(** **)** const
  644. Returns the number of video drivers supported on the current platform.
  645. .. _class_OS_method_get_video_driver_name:
  646. - :ref:`String<class_String>` **get_video_driver_name** **(** :ref:`VideoDriver<enum_OS_VideoDriver>` driver **)** const
  647. Returns the name of the video driver matching the given ``driver`` index. This index is a value from :ref:`VideoDriver<enum_OS_VideoDriver>`, and you can use :ref:`get_current_video_driver<class_OS_method_get_current_video_driver>` to get the current backend's index.
  648. .. _class_OS_method_get_virtual_keyboard_height:
  649. - :ref:`int<class_int>` **get_virtual_keyboard_height** **(** **)**
  650. Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or it is currently hidden.
  651. .. _class_OS_method_get_window_safe_area:
  652. - :ref:`Rect2<class_Rect2>` **get_window_safe_area** **(** **)** const
  653. .. _class_OS_method_has_environment:
  654. - :ref:`bool<class_bool>` **has_environment** **(** :ref:`String<class_String>` environment **)** const
  655. Returns ``true`` if an environment variable exists.
  656. .. _class_OS_method_has_feature:
  657. - :ref:`bool<class_bool>` **has_feature** **(** :ref:`String<class_String>` tag_name **)** const
  658. Returns ``true`` if the feature for the given feature tag is supported in the currently running instance, depending on platform, build etc. Can be used to check whether you're currently running a debug build, on a certain platform or arch, etc. See feature tags documentation.
  659. .. _class_OS_method_has_touchscreen_ui_hint:
  660. - :ref:`bool<class_bool>` **has_touchscreen_ui_hint** **(** **)** const
  661. Returns ``true`` if the device has a touchscreen or emulates one.
  662. .. _class_OS_method_has_virtual_keyboard:
  663. - :ref:`bool<class_bool>` **has_virtual_keyboard** **(** **)** const
  664. Returns ``true`` if the platform has a virtual keyboard, ``false`` otherwise.
  665. .. _class_OS_method_hide_virtual_keyboard:
  666. - void **hide_virtual_keyboard** **(** **)**
  667. Hides the virtual keyboard if it is shown, does nothing otherwise.
  668. .. _class_OS_method_is_debug_build:
  669. - :ref:`bool<class_bool>` **is_debug_build** **(** **)** const
  670. Returns ``true`` if the build is a debug build.
  671. Returns ``true`` when running in the editor.
  672. Returns ``false`` if the build is a release build.
  673. .. _class_OS_method_is_ok_left_and_cancel_right:
  674. - :ref:`bool<class_bool>` **is_ok_left_and_cancel_right** **(** **)** const
  675. Returns ``true`` if the "Okay" button should appear on the left and "Cancel" on the right.
  676. .. _class_OS_method_is_scancode_unicode:
  677. - :ref:`bool<class_bool>` **is_scancode_unicode** **(** :ref:`int<class_int>` code **)** const
  678. Returns ``true`` if the input code has a unicode character.
  679. .. _class_OS_method_is_stdout_verbose:
  680. - :ref:`bool<class_bool>` **is_stdout_verbose** **(** **)** const
  681. Returns ``true`` if the engine was executed with -v (verbose stdout).
  682. .. _class_OS_method_is_userfs_persistent:
  683. - :ref:`bool<class_bool>` **is_userfs_persistent** **(** **)** const
  684. If ``true``, the ``user://`` file system is persistent, so that its state is the same after a player quits and starts the game again. Relevant to the HTML5 platform, where this persistence may be unavailable.
  685. .. _class_OS_method_is_window_always_on_top:
  686. - :ref:`bool<class_bool>` **is_window_always_on_top** **(** **)** const
  687. Returns ``true`` if the window should always be on top of other windows.
  688. .. _class_OS_method_kill:
  689. - :ref:`Error<enum_@GlobalScope_Error>` **kill** **(** :ref:`int<class_int>` pid **)**
  690. Kill (terminate) the process identified by the given process ID (``pid``), e.g. the one returned by :ref:`execute<class_OS_method_execute>` in non-blocking mode.
  691. Note that this method can also be used to kill processes that were not spawned by the game.
  692. .. _class_OS_method_move_window_to_foreground:
  693. - void **move_window_to_foreground** **(** **)**
  694. Moves the window to the front.
  695. .. _class_OS_method_native_video_is_playing:
  696. - :ref:`bool<class_bool>` **native_video_is_playing** **(** **)**
  697. Returns ``true`` if native video is playing.
  698. .. _class_OS_method_native_video_pause:
  699. - void **native_video_pause** **(** **)**
  700. Pauses native video playback.
  701. .. _class_OS_method_native_video_play:
  702. - :ref:`Error<enum_@GlobalScope_Error>` **native_video_play** **(** :ref:`String<class_String>` path, :ref:`float<class_float>` volume, :ref:`String<class_String>` audio_track, :ref:`String<class_String>` subtitle_track **)**
  703. Plays native video from the specified path, at the given volume and with audio and subtitle tracks.
  704. Note: This method is only implemented on Android and iOS, and the current Android implementation does not support the ``volume``, ``audio_track`` and ``subtitle_track`` options.
  705. .. _class_OS_method_native_video_stop:
  706. - void **native_video_stop** **(** **)**
  707. Stops native video playback.
  708. .. _class_OS_method_native_video_unpause:
  709. - void **native_video_unpause** **(** **)**
  710. Resumes native video playback.
  711. .. _class_OS_method_open_midi_inputs:
  712. - void **open_midi_inputs** **(** **)**
  713. .. _class_OS_method_print_all_resources:
  714. - void **print_all_resources** **(** :ref:`String<class_String>` tofile="" **)**
  715. Shows all resources in the game. Optionally the list can be written to a file.
  716. .. _class_OS_method_print_all_textures_by_size:
  717. - void **print_all_textures_by_size** **(** **)**
  718. Shows the list of loaded textures sorted by size in memory.
  719. .. _class_OS_method_print_resources_by_type:
  720. - void **print_resources_by_type** **(** :ref:`PoolStringArray<class_PoolStringArray>` types **)**
  721. Shows the number of resources loaded by the game of the given types.
  722. .. _class_OS_method_print_resources_in_use:
  723. - void **print_resources_in_use** **(** :ref:`bool<class_bool>` short=false **)**
  724. Shows all resources currently used by the game.
  725. .. _class_OS_method_request_attention:
  726. - void **request_attention** **(** **)**
  727. Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX.
  728. .. _class_OS_method_request_permission:
  729. - :ref:`bool<class_bool>` **request_permission** **(** :ref:`String<class_String>` name **)**
  730. At the moment this function is only used by ``AudioDriverOpenSL`` to request permission for ``RECORD_AUDIO`` on Android.
  731. .. _class_OS_method_set_icon:
  732. - void **set_icon** **(** :ref:`Image<class_Image>` icon **)**
  733. Sets the game's icon.
  734. .. _class_OS_method_set_ime_active:
  735. - void **set_ime_active** **(** :ref:`bool<class_bool>` active **)**
  736. Sets whether IME input mode should be enabled.
  737. .. _class_OS_method_set_ime_position:
  738. - void **set_ime_position** **(** :ref:`Vector2<class_Vector2>` position **)**
  739. Sets position of IME suggestion list popup (in window coordinates).
  740. .. _class_OS_method_set_thread_name:
  741. - :ref:`Error<enum_@GlobalScope_Error>` **set_thread_name** **(** :ref:`String<class_String>` name **)**
  742. Sets the name of the current thread.
  743. .. _class_OS_method_set_use_file_access_save_and_swap:
  744. - void **set_use_file_access_save_and_swap** **(** :ref:`bool<class_bool>` enabled **)**
  745. Enables backup saves if ``enabled`` is ``true``.
  746. .. _class_OS_method_set_window_always_on_top:
  747. - void **set_window_always_on_top** **(** :ref:`bool<class_bool>` enabled **)**
  748. Sets whether the window should always be on top.
  749. .. _class_OS_method_set_window_title:
  750. - void **set_window_title** **(** :ref:`String<class_String>` title **)**
  751. Sets the window title to the specified string.
  752. .. _class_OS_method_shell_open:
  753. - :ref:`Error<enum_@GlobalScope_Error>` **shell_open** **(** :ref:`String<class_String>` uri **)**
  754. Requests the OS to open a resource with the most appropriate program. For example.
  755. ``OS.shell_open("C:\\Users\name\Downloads")`` on Windows opens the file explorer at the downloads folders of the user.
  756. ``OS.shell_open("https://godotengine.org")`` opens the default web browser on the official Godot website.
  757. .. _class_OS_method_show_virtual_keyboard:
  758. - void **show_virtual_keyboard** **(** :ref:`String<class_String>` existing_text="" **)**
  759. Shows the virtual keyboard if the platform has one. The *existing_text* parameter is useful for implementing your own LineEdit, as it tells the virtual keyboard what text has already been typed (the virtual keyboard uses it for auto-correct and predictions).