class_os.rst 110 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the OS.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_OS:
  6. OS
  7. ==
  8. **Inherits:** :ref:`Object<class_Object>`
  9. Operating System functions.
  10. Description
  11. -----------
  12. Operating System functions. OS wraps the most common functionality to communicate with the host operating system, such as the clipboard, video driver, date and time, timers, environment variables, execution of binaries, command line, etc.
  13. Properties
  14. ----------
  15. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  16. | :ref:`String<class_String>` | :ref:`clipboard<class_OS_property_clipboard>` | ``""`` |
  17. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  18. | :ref:`int<class_int>` | :ref:`current_screen<class_OS_property_current_screen>` | ``0`` |
  19. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  20. | :ref:`int<class_int>` | :ref:`exit_code<class_OS_property_exit_code>` | ``0`` |
  21. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  22. | :ref:`bool<class_bool>` | :ref:`keep_screen_on<class_OS_property_keep_screen_on>` | ``true`` |
  23. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  24. | :ref:`bool<class_bool>` | :ref:`low_processor_usage_mode<class_OS_property_low_processor_usage_mode>` | ``false`` |
  25. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  26. | :ref:`int<class_int>` | :ref:`low_processor_usage_mode_sleep_usec<class_OS_property_low_processor_usage_mode_sleep_usec>` | ``6900`` |
  27. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  28. | :ref:`Vector2<class_Vector2>` | :ref:`max_window_size<class_OS_property_max_window_size>` | ``Vector2( 0, 0 )`` |
  29. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  30. | :ref:`Vector2<class_Vector2>` | :ref:`min_window_size<class_OS_property_min_window_size>` | ``Vector2( 0, 0 )`` |
  31. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  32. | :ref:`ScreenOrientation<enum_OS_ScreenOrientation>` | :ref:`screen_orientation<class_OS_property_screen_orientation>` | ``0`` |
  33. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  34. | :ref:`bool<class_bool>` | :ref:`vsync_enabled<class_OS_property_vsync_enabled>` | ``true`` |
  35. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  36. | :ref:`bool<class_bool>` | :ref:`vsync_via_compositor<class_OS_property_vsync_via_compositor>` | ``false`` |
  37. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  38. | :ref:`bool<class_bool>` | :ref:`window_borderless<class_OS_property_window_borderless>` | ``false`` |
  39. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  40. | :ref:`bool<class_bool>` | :ref:`window_fullscreen<class_OS_property_window_fullscreen>` | ``false`` |
  41. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  42. | :ref:`bool<class_bool>` | :ref:`window_maximized<class_OS_property_window_maximized>` | ``false`` |
  43. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  44. | :ref:`bool<class_bool>` | :ref:`window_minimized<class_OS_property_window_minimized>` | ``false`` |
  45. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  46. | :ref:`bool<class_bool>` | :ref:`window_per_pixel_transparency_enabled<class_OS_property_window_per_pixel_transparency_enabled>` | ``false`` |
  47. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  48. | :ref:`Vector2<class_Vector2>` | :ref:`window_position<class_OS_property_window_position>` | ``Vector2( 0, 0 )`` |
  49. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  50. | :ref:`bool<class_bool>` | :ref:`window_resizable<class_OS_property_window_resizable>` | ``true`` |
  51. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  52. | :ref:`Vector2<class_Vector2>` | :ref:`window_size<class_OS_property_window_size>` | ``Vector2( 0, 0 )`` |
  53. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+---------------------+
  54. Methods
  55. -------
  56. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`alert<class_OS_method_alert>` **(** :ref:`String<class_String>` text, :ref:`String<class_String>` title="Alert!" **)** |
  58. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`can_draw<class_OS_method_can_draw>` **(** **)** const |
  60. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`can_use_threads<class_OS_method_can_use_threads>` **(** **)** const |
  62. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`center_window<class_OS_method_center_window>` **(** **)** |
  64. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`close_midi_inputs<class_OS_method_close_midi_inputs>` **(** **)** |
  66. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`delay_msec<class_OS_method_delay_msec>` **(** :ref:`int<class_int>` msec **)** const |
  68. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`delay_usec<class_OS_method_delay_usec>` **(** :ref:`int<class_int>` usec **)** const |
  70. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`dump_memory_to_file<class_OS_method_dump_memory_to_file>` **(** :ref:`String<class_String>` file **)** |
  72. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`dump_resources_to_file<class_OS_method_dump_resources_to_file>` **(** :ref:`String<class_String>` file **)** |
  74. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`int<class_int>` | :ref:`execute<class_OS_method_execute>` **(** :ref:`String<class_String>` path, :ref:`PackedStringArray<class_PackedStringArray>` arguments, :ref:`bool<class_bool>` blocking=true, :ref:`Array<class_Array>` output=[ ], :ref:`bool<class_bool>` read_stderr=false **)** |
  76. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`int<class_int>` | :ref:`find_keycode_from_string<class_OS_method_find_keycode_from_string>` **(** :ref:`String<class_String>` string **)** const |
  78. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`int<class_int>` | :ref:`get_audio_driver_count<class_OS_method_get_audio_driver_count>` **(** **)** const |
  80. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`String<class_String>` | :ref:`get_audio_driver_name<class_OS_method_get_audio_driver_name>` **(** :ref:`int<class_int>` driver **)** const |
  82. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_cmdline_args<class_OS_method_get_cmdline_args>` **(** **)** |
  84. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_connected_midi_inputs<class_OS_method_get_connected_midi_inputs>` **(** **)** |
  86. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`VideoDriver<enum_OS_VideoDriver>` | :ref:`get_current_video_driver<class_OS_method_get_current_video_driver>` **(** **)** const |
  88. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_date<class_OS_method_get_date>` **(** :ref:`bool<class_bool>` utc=false **)** const |
  90. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_datetime<class_OS_method_get_datetime>` **(** :ref:`bool<class_bool>` utc=false **)** const |
  92. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :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 |
  94. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`String<class_String>` | :ref:`get_environment<class_OS_method_get_environment>` **(** :ref:`String<class_String>` environment **)** const |
  96. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`String<class_String>` | :ref:`get_executable_path<class_OS_method_get_executable_path>` **(** **)** const |
  98. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_granted_permissions<class_OS_method_get_granted_permissions>` **(** **)** const |
  100. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`Vector2<class_Vector2>` | :ref:`get_ime_selection<class_OS_method_get_ime_selection>` **(** **)** const |
  102. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`String<class_String>` | :ref:`get_ime_text<class_OS_method_get_ime_text>` **(** **)** const |
  104. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`String<class_String>` | :ref:`get_keycode_string<class_OS_method_get_keycode_string>` **(** :ref:`int<class_int>` code **)** const |
  106. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`String<class_String>` | :ref:`get_latin_keyboard_variant<class_OS_method_get_latin_keyboard_variant>` **(** **)** const |
  108. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`String<class_String>` | :ref:`get_locale<class_OS_method_get_locale>` **(** **)** const |
  110. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`String<class_String>` | :ref:`get_model_name<class_OS_method_get_model_name>` **(** **)** const |
  112. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`String<class_String>` | :ref:`get_name<class_OS_method_get_name>` **(** **)** const |
  114. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`int<class_int>` | :ref:`get_process_id<class_OS_method_get_process_id>` **(** **)** const |
  116. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | :ref:`int<class_int>` | :ref:`get_processor_count<class_OS_method_get_processor_count>` **(** **)** const |
  118. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`Vector2<class_Vector2>` | :ref:`get_real_window_size<class_OS_method_get_real_window_size>` **(** **)** const |
  120. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`int<class_int>` | :ref:`get_screen_count<class_OS_method_get_screen_count>` **(** **)** const |
  122. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`int<class_int>` | :ref:`get_screen_dpi<class_OS_method_get_screen_dpi>` **(** :ref:`int<class_int>` screen=-1 **)** const |
  124. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | :ref:`Vector2<class_Vector2>` | :ref:`get_screen_position<class_OS_method_get_screen_position>` **(** :ref:`int<class_int>` screen=-1 **)** const |
  126. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`Vector2<class_Vector2>` | :ref:`get_screen_size<class_OS_method_get_screen_size>` **(** :ref:`int<class_int>` screen=-1 **)** const |
  128. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`int<class_int>` | :ref:`get_splash_tick_msec<class_OS_method_get_splash_tick_msec>` **(** **)** const |
  130. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`int<class_int>` | :ref:`get_static_memory_peak_usage<class_OS_method_get_static_memory_peak_usage>` **(** **)** const |
  132. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | :ref:`int<class_int>` | :ref:`get_static_memory_usage<class_OS_method_get_static_memory_usage>` **(** **)** const |
  134. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | :ref:`String<class_String>` | :ref:`get_system_dir<class_OS_method_get_system_dir>` **(** :ref:`SystemDir<enum_OS_SystemDir>` dir **)** const |
  136. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | :ref:`int<class_int>` | :ref:`get_system_time_msecs<class_OS_method_get_system_time_msecs>` **(** **)** const |
  138. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | :ref:`int<class_int>` | :ref:`get_system_time_secs<class_OS_method_get_system_time_secs>` **(** **)** const |
  140. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | :ref:`int<class_int>` | :ref:`get_ticks_msec<class_OS_method_get_ticks_msec>` **(** **)** const |
  142. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | :ref:`int<class_int>` | :ref:`get_ticks_usec<class_OS_method_get_ticks_usec>` **(** **)** const |
  144. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_time<class_OS_method_get_time>` **(** :ref:`bool<class_bool>` utc=false **)** const |
  146. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_time_zone_info<class_OS_method_get_time_zone_info>` **(** **)** const |
  148. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | :ref:`String<class_String>` | :ref:`get_unique_id<class_OS_method_get_unique_id>` **(** **)** const |
  150. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | :ref:`int<class_int>` | :ref:`get_unix_time<class_OS_method_get_unix_time>` **(** **)** const |
  152. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | :ref:`int<class_int>` | :ref:`get_unix_time_from_datetime<class_OS_method_get_unix_time_from_datetime>` **(** :ref:`Dictionary<class_Dictionary>` datetime **)** const |
  154. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | :ref:`String<class_String>` | :ref:`get_user_data_dir<class_OS_method_get_user_data_dir>` **(** **)** const |
  156. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | :ref:`int<class_int>` | :ref:`get_video_driver_count<class_OS_method_get_video_driver_count>` **(** **)** const |
  158. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | :ref:`String<class_String>` | :ref:`get_video_driver_name<class_OS_method_get_video_driver_name>` **(** :ref:`VideoDriver<enum_OS_VideoDriver>` driver **)** const |
  160. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | :ref:`int<class_int>` | :ref:`get_virtual_keyboard_height<class_OS_method_get_virtual_keyboard_height>` **(** **)** |
  162. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | :ref:`Rect2<class_Rect2>` | :ref:`get_window_safe_area<class_OS_method_get_window_safe_area>` **(** **)** const |
  164. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | void | :ref:`global_menu_add_item<class_OS_method_global_menu_add_item>` **(** :ref:`String<class_String>` menu, :ref:`String<class_String>` label, :ref:`Variant<class_Variant>` id, :ref:`Variant<class_Variant>` meta **)** |
  166. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | void | :ref:`global_menu_add_separator<class_OS_method_global_menu_add_separator>` **(** :ref:`String<class_String>` menu **)** |
  168. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | void | :ref:`global_menu_clear<class_OS_method_global_menu_clear>` **(** :ref:`String<class_String>` menu **)** |
  170. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | void | :ref:`global_menu_remove_item<class_OS_method_global_menu_remove_item>` **(** :ref:`String<class_String>` menu, :ref:`int<class_int>` idx **)** |
  172. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | :ref:`bool<class_bool>` | :ref:`has_environment<class_OS_method_has_environment>` **(** :ref:`String<class_String>` environment **)** const |
  174. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | :ref:`bool<class_bool>` | :ref:`has_feature<class_OS_method_has_feature>` **(** :ref:`String<class_String>` tag_name **)** const |
  176. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. | :ref:`bool<class_bool>` | :ref:`has_touchscreen_ui_hint<class_OS_method_has_touchscreen_ui_hint>` **(** **)** const |
  178. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  179. | :ref:`bool<class_bool>` | :ref:`has_virtual_keyboard<class_OS_method_has_virtual_keyboard>` **(** **)** const |
  180. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  181. | void | :ref:`hide_virtual_keyboard<class_OS_method_hide_virtual_keyboard>` **(** **)** |
  182. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  183. | :ref:`bool<class_bool>` | :ref:`is_debug_build<class_OS_method_is_debug_build>` **(** **)** const |
  184. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  185. | :ref:`bool<class_bool>` | :ref:`is_keycode_unicode<class_OS_method_is_keycode_unicode>` **(** :ref:`int<class_int>` code **)** const |
  186. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  187. | :ref:`bool<class_bool>` | :ref:`is_ok_left_and_cancel_right<class_OS_method_is_ok_left_and_cancel_right>` **(** **)** const |
  188. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  189. | :ref:`bool<class_bool>` | :ref:`is_stdout_verbose<class_OS_method_is_stdout_verbose>` **(** **)** const |
  190. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  191. | :ref:`bool<class_bool>` | :ref:`is_userfs_persistent<class_OS_method_is_userfs_persistent>` **(** **)** const |
  192. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  193. | :ref:`bool<class_bool>` | :ref:`is_window_always_on_top<class_OS_method_is_window_always_on_top>` **(** **)** const |
  194. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  195. | :ref:`bool<class_bool>` | :ref:`is_window_focused<class_OS_method_is_window_focused>` **(** **)** const |
  196. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  197. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`kill<class_OS_method_kill>` **(** :ref:`int<class_int>` pid **)** |
  198. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  199. | void | :ref:`move_window_to_foreground<class_OS_method_move_window_to_foreground>` **(** **)** |
  200. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  201. | :ref:`bool<class_bool>` | :ref:`native_video_is_playing<class_OS_method_native_video_is_playing>` **(** **)** |
  202. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  203. | void | :ref:`native_video_pause<class_OS_method_native_video_pause>` **(** **)** |
  204. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  205. | :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 **)** |
  206. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  207. | void | :ref:`native_video_stop<class_OS_method_native_video_stop>` **(** **)** |
  208. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  209. | void | :ref:`native_video_unpause<class_OS_method_native_video_unpause>` **(** **)** |
  210. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  211. | void | :ref:`open_midi_inputs<class_OS_method_open_midi_inputs>` **(** **)** |
  212. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  213. | void | :ref:`print_all_resources<class_OS_method_print_all_resources>` **(** :ref:`String<class_String>` tofile="" **)** |
  214. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  215. | void | :ref:`print_all_textures_by_size<class_OS_method_print_all_textures_by_size>` **(** **)** |
  216. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  217. | void | :ref:`print_resources_by_type<class_OS_method_print_resources_by_type>` **(** :ref:`PackedStringArray<class_PackedStringArray>` types **)** |
  218. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  219. | void | :ref:`print_resources_in_use<class_OS_method_print_resources_in_use>` **(** :ref:`bool<class_bool>` short=false **)** |
  220. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  221. | void | :ref:`request_attention<class_OS_method_request_attention>` **(** **)** |
  222. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  223. | :ref:`bool<class_bool>` | :ref:`request_permission<class_OS_method_request_permission>` **(** :ref:`String<class_String>` name **)** |
  224. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  225. | :ref:`bool<class_bool>` | :ref:`request_permissions<class_OS_method_request_permissions>` **(** **)** |
  226. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  227. | void | :ref:`set_icon<class_OS_method_set_icon>` **(** :ref:`Image<class_Image>` icon **)** |
  228. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  229. | void | :ref:`set_ime_active<class_OS_method_set_ime_active>` **(** :ref:`bool<class_bool>` active **)** |
  230. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  231. | void | :ref:`set_ime_position<class_OS_method_set_ime_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |
  232. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  233. | void | :ref:`set_native_icon<class_OS_method_set_native_icon>` **(** :ref:`String<class_String>` filename **)** |
  234. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  235. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`set_thread_name<class_OS_method_set_thread_name>` **(** :ref:`String<class_String>` name **)** |
  236. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  237. | void | :ref:`set_use_file_access_save_and_swap<class_OS_method_set_use_file_access_save_and_swap>` **(** :ref:`bool<class_bool>` enabled **)** |
  238. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  239. | void | :ref:`set_window_always_on_top<class_OS_method_set_window_always_on_top>` **(** :ref:`bool<class_bool>` enabled **)** |
  240. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  241. | void | :ref:`set_window_title<class_OS_method_set_window_title>` **(** :ref:`String<class_String>` title **)** |
  242. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  243. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`shell_open<class_OS_method_shell_open>` **(** :ref:`String<class_String>` uri **)** |
  244. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  245. | void | :ref:`show_virtual_keyboard<class_OS_method_show_virtual_keyboard>` **(** :ref:`String<class_String>` existing_text="" **)** |
  246. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  247. Enumerations
  248. ------------
  249. .. _enum_OS_VideoDriver:
  250. .. _class_OS_constant_VIDEO_DRIVER_GLES2:
  251. .. _class_OS_constant_VIDEO_DRIVER_VULKAN:
  252. enum **VideoDriver**:
  253. - **VIDEO_DRIVER_GLES2** = **0** --- 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.
  254. - **VIDEO_DRIVER_VULKAN** = **1** --- The Vulkan rendering backend.
  255. ----
  256. .. _enum_OS_Weekday:
  257. .. _class_OS_constant_DAY_SUNDAY:
  258. .. _class_OS_constant_DAY_MONDAY:
  259. .. _class_OS_constant_DAY_TUESDAY:
  260. .. _class_OS_constant_DAY_WEDNESDAY:
  261. .. _class_OS_constant_DAY_THURSDAY:
  262. .. _class_OS_constant_DAY_FRIDAY:
  263. .. _class_OS_constant_DAY_SATURDAY:
  264. enum **Weekday**:
  265. - **DAY_SUNDAY** = **0** --- Sunday.
  266. - **DAY_MONDAY** = **1** --- Monday.
  267. - **DAY_TUESDAY** = **2** --- Tuesday.
  268. - **DAY_WEDNESDAY** = **3** --- Wednesday.
  269. - **DAY_THURSDAY** = **4** --- Thursday.
  270. - **DAY_FRIDAY** = **5** --- Friday.
  271. - **DAY_SATURDAY** = **6** --- Saturday.
  272. ----
  273. .. _enum_OS_Month:
  274. .. _class_OS_constant_MONTH_JANUARY:
  275. .. _class_OS_constant_MONTH_FEBRUARY:
  276. .. _class_OS_constant_MONTH_MARCH:
  277. .. _class_OS_constant_MONTH_APRIL:
  278. .. _class_OS_constant_MONTH_MAY:
  279. .. _class_OS_constant_MONTH_JUNE:
  280. .. _class_OS_constant_MONTH_JULY:
  281. .. _class_OS_constant_MONTH_AUGUST:
  282. .. _class_OS_constant_MONTH_SEPTEMBER:
  283. .. _class_OS_constant_MONTH_OCTOBER:
  284. .. _class_OS_constant_MONTH_NOVEMBER:
  285. .. _class_OS_constant_MONTH_DECEMBER:
  286. enum **Month**:
  287. - **MONTH_JANUARY** = **1** --- January.
  288. - **MONTH_FEBRUARY** = **2** --- February.
  289. - **MONTH_MARCH** = **3** --- March.
  290. - **MONTH_APRIL** = **4** --- April.
  291. - **MONTH_MAY** = **5** --- May.
  292. - **MONTH_JUNE** = **6** --- June.
  293. - **MONTH_JULY** = **7** --- July.
  294. - **MONTH_AUGUST** = **8** --- August.
  295. - **MONTH_SEPTEMBER** = **9** --- September.
  296. - **MONTH_OCTOBER** = **10** --- October.
  297. - **MONTH_NOVEMBER** = **11** --- November.
  298. - **MONTH_DECEMBER** = **12** --- December.
  299. ----
  300. .. _enum_OS_ScreenOrientation:
  301. .. _class_OS_constant_SCREEN_ORIENTATION_LANDSCAPE:
  302. .. _class_OS_constant_SCREEN_ORIENTATION_PORTRAIT:
  303. .. _class_OS_constant_SCREEN_ORIENTATION_REVERSE_LANDSCAPE:
  304. .. _class_OS_constant_SCREEN_ORIENTATION_REVERSE_PORTRAIT:
  305. .. _class_OS_constant_SCREEN_ORIENTATION_SENSOR_LANDSCAPE:
  306. .. _class_OS_constant_SCREEN_ORIENTATION_SENSOR_PORTRAIT:
  307. .. _class_OS_constant_SCREEN_ORIENTATION_SENSOR:
  308. enum **ScreenOrientation**:
  309. - **SCREEN_ORIENTATION_LANDSCAPE** = **0** --- Landscape screen orientation.
  310. - **SCREEN_ORIENTATION_PORTRAIT** = **1** --- Portrait screen orientation.
  311. - **SCREEN_ORIENTATION_REVERSE_LANDSCAPE** = **2** --- Reverse landscape screen orientation.
  312. - **SCREEN_ORIENTATION_REVERSE_PORTRAIT** = **3** --- Reverse portrait screen orientation.
  313. - **SCREEN_ORIENTATION_SENSOR_LANDSCAPE** = **4** --- Uses landscape or reverse landscape based on the hardware sensor.
  314. - **SCREEN_ORIENTATION_SENSOR_PORTRAIT** = **5** --- Uses portrait or reverse portrait based on the hardware sensor.
  315. - **SCREEN_ORIENTATION_SENSOR** = **6** --- Uses most suitable orientation based on the hardware sensor.
  316. ----
  317. .. _enum_OS_SystemDir:
  318. .. _class_OS_constant_SYSTEM_DIR_DESKTOP:
  319. .. _class_OS_constant_SYSTEM_DIR_DCIM:
  320. .. _class_OS_constant_SYSTEM_DIR_DOCUMENTS:
  321. .. _class_OS_constant_SYSTEM_DIR_DOWNLOADS:
  322. .. _class_OS_constant_SYSTEM_DIR_MOVIES:
  323. .. _class_OS_constant_SYSTEM_DIR_MUSIC:
  324. .. _class_OS_constant_SYSTEM_DIR_PICTURES:
  325. .. _class_OS_constant_SYSTEM_DIR_RINGTONES:
  326. enum **SystemDir**:
  327. - **SYSTEM_DIR_DESKTOP** = **0** --- Desktop directory path.
  328. - **SYSTEM_DIR_DCIM** = **1** --- DCIM (Digital Camera Images) directory path.
  329. - **SYSTEM_DIR_DOCUMENTS** = **2** --- Documents directory path.
  330. - **SYSTEM_DIR_DOWNLOADS** = **3** --- Downloads directory path.
  331. - **SYSTEM_DIR_MOVIES** = **4** --- Movies directory path.
  332. - **SYSTEM_DIR_MUSIC** = **5** --- Music directory path.
  333. - **SYSTEM_DIR_PICTURES** = **6** --- Pictures directory path.
  334. - **SYSTEM_DIR_RINGTONES** = **7** --- Ringtones directory path.
  335. Property Descriptions
  336. ---------------------
  337. .. _class_OS_property_clipboard:
  338. - :ref:`String<class_String>` **clipboard**
  339. +-----------+----------------------+
  340. | *Default* | ``""`` |
  341. +-----------+----------------------+
  342. | *Setter* | set_clipboard(value) |
  343. +-----------+----------------------+
  344. | *Getter* | get_clipboard() |
  345. +-----------+----------------------+
  346. The clipboard from the host OS. Might be unavailable on some platforms.
  347. ----
  348. .. _class_OS_property_current_screen:
  349. - :ref:`int<class_int>` **current_screen**
  350. +-----------+---------------------------+
  351. | *Default* | ``0`` |
  352. +-----------+---------------------------+
  353. | *Setter* | set_current_screen(value) |
  354. +-----------+---------------------------+
  355. | *Getter* | get_current_screen() |
  356. +-----------+---------------------------+
  357. The current screen index (starting from 0).
  358. ----
  359. .. _class_OS_property_exit_code:
  360. - :ref:`int<class_int>` **exit_code**
  361. +-----------+----------------------+
  362. | *Default* | ``0`` |
  363. +-----------+----------------------+
  364. | *Setter* | set_exit_code(value) |
  365. +-----------+----------------------+
  366. | *Getter* | get_exit_code() |
  367. +-----------+----------------------+
  368. The exit code passed to the OS when the main loop exits. By convention, an exit code of ``0`` indicates success whereas a non-zero exit code indicates an error. For portability reasons, the exit code should be set between 0 and 125 (inclusive).
  369. **Note:** This value will be ignored if using :ref:`SceneTree.quit<class_SceneTree_method_quit>` with an ``exit_code`` argument passed.
  370. ----
  371. .. _class_OS_property_keep_screen_on:
  372. - :ref:`bool<class_bool>` **keep_screen_on**
  373. +-----------+---------------------------+
  374. | *Default* | ``true`` |
  375. +-----------+---------------------------+
  376. | *Setter* | set_keep_screen_on(value) |
  377. +-----------+---------------------------+
  378. | *Getter* | is_keep_screen_on() |
  379. +-----------+---------------------------+
  380. If ``true``, the engine tries to keep the screen on while the game is running. Useful on mobile.
  381. ----
  382. .. _class_OS_property_low_processor_usage_mode:
  383. - :ref:`bool<class_bool>` **low_processor_usage_mode**
  384. +-----------+-------------------------------------+
  385. | *Default* | ``false`` |
  386. +-----------+-------------------------------------+
  387. | *Setter* | set_low_processor_usage_mode(value) |
  388. +-----------+-------------------------------------+
  389. | *Getter* | is_in_low_processor_usage_mode() |
  390. +-----------+-------------------------------------+
  391. If ``true``, the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile.
  392. ----
  393. .. _class_OS_property_low_processor_usage_mode_sleep_usec:
  394. - :ref:`int<class_int>` **low_processor_usage_mode_sleep_usec**
  395. +-----------+------------------------------------------------+
  396. | *Default* | ``6900`` |
  397. +-----------+------------------------------------------------+
  398. | *Setter* | set_low_processor_usage_mode_sleep_usec(value) |
  399. +-----------+------------------------------------------------+
  400. | *Getter* | get_low_processor_usage_mode_sleep_usec() |
  401. +-----------+------------------------------------------------+
  402. The amount of sleeping between frames when the low-processor usage mode is enabled (in microseconds). Higher values will result in lower CPU usage.
  403. ----
  404. .. _class_OS_property_max_window_size:
  405. - :ref:`Vector2<class_Vector2>` **max_window_size**
  406. +-----------+----------------------------+
  407. | *Default* | ``Vector2( 0, 0 )`` |
  408. +-----------+----------------------------+
  409. | *Setter* | set_max_window_size(value) |
  410. +-----------+----------------------------+
  411. | *Getter* | get_max_window_size() |
  412. +-----------+----------------------------+
  413. The maximum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to ``(0, 0)`` to reset to the system default value.
  414. ----
  415. .. _class_OS_property_min_window_size:
  416. - :ref:`Vector2<class_Vector2>` **min_window_size**
  417. +-----------+----------------------------+
  418. | *Default* | ``Vector2( 0, 0 )`` |
  419. +-----------+----------------------------+
  420. | *Setter* | set_min_window_size(value) |
  421. +-----------+----------------------------+
  422. | *Getter* | get_min_window_size() |
  423. +-----------+----------------------------+
  424. The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to ``(0, 0)`` to reset to the system default value.
  425. ----
  426. .. _class_OS_property_screen_orientation:
  427. - :ref:`ScreenOrientation<enum_OS_ScreenOrientation>` **screen_orientation**
  428. +-----------+-------------------------------+
  429. | *Default* | ``0`` |
  430. +-----------+-------------------------------+
  431. | *Setter* | set_screen_orientation(value) |
  432. +-----------+-------------------------------+
  433. | *Getter* | get_screen_orientation() |
  434. +-----------+-------------------------------+
  435. The current screen orientation.
  436. ----
  437. .. _class_OS_property_vsync_enabled:
  438. - :ref:`bool<class_bool>` **vsync_enabled**
  439. +-----------+----------------------+
  440. | *Default* | ``true`` |
  441. +-----------+----------------------+
  442. | *Setter* | set_use_vsync(value) |
  443. +-----------+----------------------+
  444. | *Getter* | is_vsync_enabled() |
  445. +-----------+----------------------+
  446. If ``true``, vertical synchronization (Vsync) is enabled.
  447. ----
  448. .. _class_OS_property_vsync_via_compositor:
  449. - :ref:`bool<class_bool>` **vsync_via_compositor**
  450. +-----------+-----------------------------------+
  451. | *Default* | ``false`` |
  452. +-----------+-----------------------------------+
  453. | *Setter* | set_vsync_via_compositor(value) |
  454. +-----------+-----------------------------------+
  455. | *Getter* | is_vsync_via_compositor_enabled() |
  456. +-----------+-----------------------------------+
  457. If ``true`` and ``vsync_enabled`` is true, the operating system's window compositor will be used for vsync when the compositor is enabled and the game is in windowed mode.
  458. **Note:** This option is experimental and meant to alleviate stutter experienced by some users. However, some users have experienced a Vsync framerate halving (e.g. from 60 FPS to 30 FPS) when using it.
  459. **Note:** This property is only implemented on Windows.
  460. ----
  461. .. _class_OS_property_window_borderless:
  462. - :ref:`bool<class_bool>` **window_borderless**
  463. +-----------+------------------------------+
  464. | *Default* | ``false`` |
  465. +-----------+------------------------------+
  466. | *Setter* | set_borderless_window(value) |
  467. +-----------+------------------------------+
  468. | *Getter* | get_borderless_window() |
  469. +-----------+------------------------------+
  470. If ``true``, removes the window frame.
  471. **Note:** Setting ``window_borderless`` to ``false`` disables per-pixel transparency.
  472. ----
  473. .. _class_OS_property_window_fullscreen:
  474. - :ref:`bool<class_bool>` **window_fullscreen**
  475. +-----------+------------------------------+
  476. | *Default* | ``false`` |
  477. +-----------+------------------------------+
  478. | *Setter* | set_window_fullscreen(value) |
  479. +-----------+------------------------------+
  480. | *Getter* | is_window_fullscreen() |
  481. +-----------+------------------------------+
  482. If ``true``, the window is fullscreen.
  483. ----
  484. .. _class_OS_property_window_maximized:
  485. - :ref:`bool<class_bool>` **window_maximized**
  486. +-----------+-----------------------------+
  487. | *Default* | ``false`` |
  488. +-----------+-----------------------------+
  489. | *Setter* | set_window_maximized(value) |
  490. +-----------+-----------------------------+
  491. | *Getter* | is_window_maximized() |
  492. +-----------+-----------------------------+
  493. If ``true``, the window is maximized.
  494. ----
  495. .. _class_OS_property_window_minimized:
  496. - :ref:`bool<class_bool>` **window_minimized**
  497. +-----------+-----------------------------+
  498. | *Default* | ``false`` |
  499. +-----------+-----------------------------+
  500. | *Setter* | set_window_minimized(value) |
  501. +-----------+-----------------------------+
  502. | *Getter* | is_window_minimized() |
  503. +-----------+-----------------------------+
  504. If ``true``, the window is minimized.
  505. ----
  506. .. _class_OS_property_window_per_pixel_transparency_enabled:
  507. - :ref:`bool<class_bool>` **window_per_pixel_transparency_enabled**
  508. +-----------+--------------------------------------------------+
  509. | *Default* | ``false`` |
  510. +-----------+--------------------------------------------------+
  511. | *Setter* | set_window_per_pixel_transparency_enabled(value) |
  512. +-----------+--------------------------------------------------+
  513. | *Getter* | get_window_per_pixel_transparency_enabled() |
  514. +-----------+--------------------------------------------------+
  515. If ``true``, the window background is transparent and window frame is removed.
  516. Use ``get_tree().get_root().set_transparent_background(true)`` to disable main viewport background rendering.
  517. **Note:** This property has no effect if **Project > Project Settings > Display > Window > Per-pixel transparency > Allowed** setting is disabled.
  518. **Note:** This property is implemented on HTML5, Linux, macOS and Windows.
  519. ----
  520. .. _class_OS_property_window_position:
  521. - :ref:`Vector2<class_Vector2>` **window_position**
  522. +-----------+----------------------------+
  523. | *Default* | ``Vector2( 0, 0 )`` |
  524. +-----------+----------------------------+
  525. | *Setter* | set_window_position(value) |
  526. +-----------+----------------------------+
  527. | *Getter* | get_window_position() |
  528. +-----------+----------------------------+
  529. 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.
  530. ----
  531. .. _class_OS_property_window_resizable:
  532. - :ref:`bool<class_bool>` **window_resizable**
  533. +-----------+-----------------------------+
  534. | *Default* | ``true`` |
  535. +-----------+-----------------------------+
  536. | *Setter* | set_window_resizable(value) |
  537. +-----------+-----------------------------+
  538. | *Getter* | is_window_resizable() |
  539. +-----------+-----------------------------+
  540. If ``true``, the window is resizable by the user.
  541. ----
  542. .. _class_OS_property_window_size:
  543. - :ref:`Vector2<class_Vector2>` **window_size**
  544. +-----------+------------------------+
  545. | *Default* | ``Vector2( 0, 0 )`` |
  546. +-----------+------------------------+
  547. | *Setter* | set_window_size(value) |
  548. +-----------+------------------------+
  549. | *Getter* | get_window_size() |
  550. +-----------+------------------------+
  551. The size of the window (without counting window manager decorations).
  552. Method Descriptions
  553. -------------------
  554. .. _class_OS_method_alert:
  555. - void **alert** **(** :ref:`String<class_String>` text, :ref:`String<class_String>` title="Alert!" **)**
  556. Displays a modal dialog box using the host OS' facilities. Execution is blocked until the dialog is closed.
  557. ----
  558. .. _class_OS_method_can_draw:
  559. - :ref:`bool<class_bool>` **can_draw** **(** **)** const
  560. Returns ``true`` if the host OS allows drawing.
  561. ----
  562. .. _class_OS_method_can_use_threads:
  563. - :ref:`bool<class_bool>` **can_use_threads** **(** **)** const
  564. Returns ``true`` if the current host platform is using multiple threads.
  565. ----
  566. .. _class_OS_method_center_window:
  567. - void **center_window** **(** **)**
  568. Centers the window on the screen if in windowed mode.
  569. ----
  570. .. _class_OS_method_close_midi_inputs:
  571. - void **close_midi_inputs** **(** **)**
  572. Shuts down system MIDI driver.
  573. **Note:** This method is implemented on Linux, macOS and Windows.
  574. ----
  575. .. _class_OS_method_delay_msec:
  576. - void **delay_msec** **(** :ref:`int<class_int>` msec **)** const
  577. Delay execution of the current thread by ``msec`` milliseconds.
  578. ----
  579. .. _class_OS_method_delay_usec:
  580. - void **delay_usec** **(** :ref:`int<class_int>` usec **)** const
  581. Delay execution of the current thread by ``usec`` microseconds.
  582. ----
  583. .. _class_OS_method_dump_memory_to_file:
  584. - void **dump_memory_to_file** **(** :ref:`String<class_String>` file **)**
  585. Dumps the memory allocation ringlist to a file (only works in debug).
  586. Entry format per line: "Address - Size - Description".
  587. ----
  588. .. _class_OS_method_dump_resources_to_file:
  589. - void **dump_resources_to_file** **(** :ref:`String<class_String>` file **)**
  590. Dumps all used resources to file (only works in debug).
  591. Entry format per line: "Resource Type : Resource Location".
  592. At the end of the file is a statistic of all used Resource Types.
  593. ----
  594. .. _class_OS_method_execute:
  595. - :ref:`int<class_int>` **execute** **(** :ref:`String<class_String>` path, :ref:`PackedStringArray<class_PackedStringArray>` arguments, :ref:`bool<class_bool>` blocking=true, :ref:`Array<class_Array>` output=[ ], :ref:`bool<class_bool>` read_stderr=false **)**
  596. 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.
  597. 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.
  598. This method has slightly different behavior based on whether the ``blocking`` mode is enabled.
  599. If ``blocking`` is ``true``, 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.
  600. If ``blocking`` is ``false``, 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.
  601. The return value also depends on the blocking mode. When blocking, the method will return an exit code of the process. 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`` or another exit code.
  602. Example of blocking mode and retrieving the shell output:
  603. ::
  604. var output = []
  605. var exit_code = OS.execute("ls", ["-l", "/tmp"], true, output)
  606. Example of non-blocking mode, running another instance of the project and storing its process ID:
  607. ::
  608. var pid = OS.execute(OS.get_executable_path(), [], false)
  609. If you wish to access a shell built-in or perform a composite command, a platform-specific shell can be invoked. For example:
  610. ::
  611. OS.execute("CMD.exe", ["/C", "cd %TEMP% && dir"], true, output)
  612. **Note:** This method is implemented on Android, iOS, Linux, macOS and Windows.
  613. ----
  614. .. _class_OS_method_find_keycode_from_string:
  615. - :ref:`int<class_int>` **find_keycode_from_string** **(** :ref:`String<class_String>` string **)** const
  616. Returns the keycode of the given string (e.g. "Escape").
  617. ----
  618. .. _class_OS_method_get_audio_driver_count:
  619. - :ref:`int<class_int>` **get_audio_driver_count** **(** **)** const
  620. Returns the total number of available audio drivers.
  621. ----
  622. .. _class_OS_method_get_audio_driver_name:
  623. - :ref:`String<class_String>` **get_audio_driver_name** **(** :ref:`int<class_int>` driver **)** const
  624. Returns the audio driver name for the given index.
  625. ----
  626. .. _class_OS_method_get_cmdline_args:
  627. - :ref:`PackedStringArray<class_PackedStringArray>` **get_cmdline_args** **(** **)**
  628. Returns the command line arguments passed to the engine.
  629. ----
  630. .. _class_OS_method_get_connected_midi_inputs:
  631. - :ref:`PackedStringArray<class_PackedStringArray>` **get_connected_midi_inputs** **(** **)**
  632. Returns an array of MIDI device names.
  633. The returned array will be empty if the system MIDI driver has not previously been initialised with :ref:`open_midi_inputs<class_OS_method_open_midi_inputs>`.
  634. **Note:** This method is implemented on Linux, macOS and Windows.
  635. ----
  636. .. _class_OS_method_get_current_video_driver:
  637. - :ref:`VideoDriver<enum_OS_VideoDriver>` **get_current_video_driver** **(** **)** const
  638. Returns the currently used video driver, using one of the values from :ref:`VideoDriver<enum_OS_VideoDriver>`.
  639. ----
  640. .. _class_OS_method_get_date:
  641. - :ref:`Dictionary<class_Dictionary>` **get_date** **(** :ref:`bool<class_bool>` utc=false **)** const
  642. Returns current date as a dictionary of keys: ``year``, ``month``, ``day``, ``weekday``, ``dst`` (Daylight Savings Time).
  643. ----
  644. .. _class_OS_method_get_datetime:
  645. - :ref:`Dictionary<class_Dictionary>` **get_datetime** **(** :ref:`bool<class_bool>` utc=false **)** const
  646. Returns current datetime as a dictionary of keys: ``year``, ``month``, ``day``, ``weekday``, ``dst`` (Daylight Savings Time), ``hour``, ``minute``, ``second``.
  647. ----
  648. .. _class_OS_method_get_datetime_from_unix_time:
  649. - :ref:`Dictionary<class_Dictionary>` **get_datetime_from_unix_time** **(** :ref:`int<class_int>` unix_time_val **)** const
  650. Gets a dictionary of time values corresponding to the given UNIX epoch time (in seconds).
  651. The returned Dictionary's values will be the same as :ref:`get_datetime<class_OS_method_get_datetime>`, with the exception of Daylight Savings Time as it cannot be determined from the epoch.
  652. ----
  653. .. _class_OS_method_get_environment:
  654. - :ref:`String<class_String>` **get_environment** **(** :ref:`String<class_String>` environment **)** const
  655. Returns an environment variable.
  656. ----
  657. .. _class_OS_method_get_executable_path:
  658. - :ref:`String<class_String>` **get_executable_path** **(** **)** const
  659. Returns the path to the current engine executable.
  660. ----
  661. .. _class_OS_method_get_granted_permissions:
  662. - :ref:`PackedStringArray<class_PackedStringArray>` **get_granted_permissions** **(** **)** const
  663. With this function you can get the list of dangerous permissions that have been granted to the Android application.
  664. **Note:** This method is implemented on Android.
  665. ----
  666. .. _class_OS_method_get_ime_selection:
  667. - :ref:`Vector2<class_Vector2>` **get_ime_selection** **(** **)** const
  668. Returns the IME cursor position (the currently-edited portion of the string) relative to the characters in the composition string.
  669. :ref:`MainLoop.NOTIFICATION_OS_IME_UPDATE<class_MainLoop_constant_NOTIFICATION_OS_IME_UPDATE>` is sent to the application to notify it of changes to the IME cursor position.
  670. **Note:** This method is implemented on macOS.
  671. ----
  672. .. _class_OS_method_get_ime_text:
  673. - :ref:`String<class_String>` **get_ime_text** **(** **)** const
  674. Returns the IME intermediate composition string.
  675. :ref:`MainLoop.NOTIFICATION_OS_IME_UPDATE<class_MainLoop_constant_NOTIFICATION_OS_IME_UPDATE>` is sent to the application to notify it of changes to the IME composition string.
  676. **Note:** This method is implemented on macOS.
  677. ----
  678. .. _class_OS_method_get_keycode_string:
  679. - :ref:`String<class_String>` **get_keycode_string** **(** :ref:`int<class_int>` code **)** const
  680. Returns the given keycode as a string (e.g. Return values: ``"Escape"``, ``"Shift+Escape"``).
  681. See also :ref:`InputEventKey.keycode<class_InputEventKey_property_keycode>` and :ref:`InputEventKey.get_keycode_with_modifiers<class_InputEventKey_method_get_keycode_with_modifiers>`.
  682. ----
  683. .. _class_OS_method_get_latin_keyboard_variant:
  684. - :ref:`String<class_String>` **get_latin_keyboard_variant** **(** **)** const
  685. Returns the current latin keyboard variant as a String.
  686. Possible return values are: ``"QWERTY"``, ``"AZERTY"``, ``"QZERTY"``, ``"DVORAK"``, ``"NEO"``, ``"COLEMAK"`` or ``"ERROR"``.
  687. **Note:** This method is implemented on Linux, macOS and Windows. Returns ``"QWERTY"`` on unsupported platforms.
  688. ----
  689. .. _class_OS_method_get_locale:
  690. - :ref:`String<class_String>` **get_locale** **(** **)** const
  691. Returns the host OS locale.
  692. ----
  693. .. _class_OS_method_get_model_name:
  694. - :ref:`String<class_String>` **get_model_name** **(** **)** const
  695. Returns the model name of the current device.
  696. **Note:** This method is implemented on Android and iOS. Returns ``"GenericDevice"`` on unsupported platforms.
  697. ----
  698. .. _class_OS_method_get_name:
  699. - :ref:`String<class_String>` **get_name** **(** **)** const
  700. Returns the name of the host OS. Possible values are: ``"Android"``, ``"Haiku"``, ``"iOS"``, ``"HTML5"``, ``"OSX"``, ``"Server"``, ``"Windows"``, ``"UWP"``, ``"X11"``.
  701. ----
  702. .. _class_OS_method_get_process_id:
  703. - :ref:`int<class_int>` **get_process_id** **(** **)** const
  704. Returns the project's process ID.
  705. **Note:** This method is implemented on Android, iOS, Linux, macOS and Windows.
  706. ----
  707. .. _class_OS_method_get_processor_count:
  708. - :ref:`int<class_int>` **get_processor_count** **(** **)** const
  709. Returns the number of threads available on the host machine.
  710. ----
  711. .. _class_OS_method_get_real_window_size:
  712. - :ref:`Vector2<class_Vector2>` **get_real_window_size** **(** **)** const
  713. Returns the window size including decorations like window borders.
  714. ----
  715. .. _class_OS_method_get_screen_count:
  716. - :ref:`int<class_int>` **get_screen_count** **(** **)** const
  717. Returns the number of displays attached to the host machine.
  718. ----
  719. .. _class_OS_method_get_screen_dpi:
  720. - :ref:`int<class_int>` **get_screen_dpi** **(** :ref:`int<class_int>` screen=-1 **)** const
  721. Returns the dots per inch density of the specified screen. If ``screen`` is ``-1`` (the default value), the current screen will be used.
  722. On Android devices, the actual screen densities are grouped into six generalized densities:
  723. ::
  724. ldpi - 120 dpi
  725. mdpi - 160 dpi
  726. hdpi - 240 dpi
  727. xhdpi - 320 dpi
  728. xxhdpi - 480 dpi
  729. xxxhdpi - 640 dpi
  730. **Note:** This method is implemented on Android, Linux, macOS and Windows. Returns ``72`` on unsupported platforms.
  731. ----
  732. .. _class_OS_method_get_screen_position:
  733. - :ref:`Vector2<class_Vector2>` **get_screen_position** **(** :ref:`int<class_int>` screen=-1 **)** const
  734. Returns the position of the specified screen by index. If ``screen`` is ``-1`` (the default value), the current screen will be used.
  735. ----
  736. .. _class_OS_method_get_screen_size:
  737. - :ref:`Vector2<class_Vector2>` **get_screen_size** **(** :ref:`int<class_int>` screen=-1 **)** const
  738. Returns the dimensions in pixels of the specified screen. If ``screen`` is ``-1`` (the default value), the current screen will be used.
  739. ----
  740. .. _class_OS_method_get_splash_tick_msec:
  741. - :ref:`int<class_int>` **get_splash_tick_msec** **(** **)** const
  742. Returns the amount of time in milliseconds it took for the boot logo to appear.
  743. ----
  744. .. _class_OS_method_get_static_memory_peak_usage:
  745. - :ref:`int<class_int>` **get_static_memory_peak_usage** **(** **)** const
  746. Returns the maximum amount of static memory used (only works in debug).
  747. ----
  748. .. _class_OS_method_get_static_memory_usage:
  749. - :ref:`int<class_int>` **get_static_memory_usage** **(** **)** const
  750. Returns the amount of static memory being used by the program in bytes.
  751. ----
  752. .. _class_OS_method_get_system_dir:
  753. - :ref:`String<class_String>` **get_system_dir** **(** :ref:`SystemDir<enum_OS_SystemDir>` dir **)** const
  754. Returns the actual path to commonly used folders across different platforms. Available locations are specified in :ref:`SystemDir<enum_OS_SystemDir>`.
  755. **Note:** This method is implemented on Android, Linux, macOS and Windows.
  756. ----
  757. .. _class_OS_method_get_system_time_msecs:
  758. - :ref:`int<class_int>` **get_system_time_msecs** **(** **)** const
  759. Returns the epoch time of the operating system in milliseconds.
  760. ----
  761. .. _class_OS_method_get_system_time_secs:
  762. - :ref:`int<class_int>` **get_system_time_secs** **(** **)** const
  763. Returns the epoch time of the operating system in seconds.
  764. ----
  765. .. _class_OS_method_get_ticks_msec:
  766. - :ref:`int<class_int>` **get_ticks_msec** **(** **)** const
  767. Returns the amount of time passed in milliseconds since the engine started.
  768. ----
  769. .. _class_OS_method_get_ticks_usec:
  770. - :ref:`int<class_int>` **get_ticks_usec** **(** **)** const
  771. Returns the amount of time passed in microseconds since the engine started.
  772. ----
  773. .. _class_OS_method_get_time:
  774. - :ref:`Dictionary<class_Dictionary>` **get_time** **(** :ref:`bool<class_bool>` utc=false **)** const
  775. Returns current time as a dictionary of keys: hour, minute, second.
  776. ----
  777. .. _class_OS_method_get_time_zone_info:
  778. - :ref:`Dictionary<class_Dictionary>` **get_time_zone_info** **(** **)** const
  779. Returns the current time zone as a dictionary with the keys: bias and name.
  780. ----
  781. .. _class_OS_method_get_unique_id:
  782. - :ref:`String<class_String>` **get_unique_id** **(** **)** const
  783. Returns a string that is unique to the device.
  784. **Note:** Returns an empty string on HTML5 and UWP, as this method isn't implemented on those platforms yet.
  785. ----
  786. .. _class_OS_method_get_unix_time:
  787. - :ref:`int<class_int>` **get_unix_time** **(** **)** const
  788. Returns the current UNIX epoch timestamp.
  789. ----
  790. .. _class_OS_method_get_unix_time_from_datetime:
  791. - :ref:`int<class_int>` **get_unix_time_from_datetime** **(** :ref:`Dictionary<class_Dictionary>` datetime **)** const
  792. Gets an epoch time value from a dictionary of time values.
  793. ``datetime`` must be populated with the following keys: ``year``, ``month``, ``day``, ``hour``, ``minute``, ``second``.
  794. 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.
  795. ----
  796. .. _class_OS_method_get_user_data_dir:
  797. - :ref:`String<class_String>` **get_user_data_dir** **(** **)** const
  798. Returns the absolute directory path where user data is written (``user://``).
  799. On Linux, this is ``~/.local/share/godot/app_userdata/[project_name]``, or ``~/.local/share/[custom_name]`` if ``use_custom_user_dir`` is set.
  800. 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.
  801. On Windows, this is ``%APPDATA%\Godot\app_userdata\[project_name]``, or ``%APPDATA%\[custom_name]`` if ``use_custom_user_dir`` is set. ``%APPDATA%`` expands to ``%USERPROFILE%\AppData\Roaming``.
  802. If the project name is empty, ``user://`` falls back to ``res://``.
  803. ----
  804. .. _class_OS_method_get_video_driver_count:
  805. - :ref:`int<class_int>` **get_video_driver_count** **(** **)** const
  806. Returns the number of video drivers supported on the current platform.
  807. ----
  808. .. _class_OS_method_get_video_driver_name:
  809. - :ref:`String<class_String>` **get_video_driver_name** **(** :ref:`VideoDriver<enum_OS_VideoDriver>` driver **)** const
  810. 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.
  811. ----
  812. .. _class_OS_method_get_virtual_keyboard_height:
  813. - :ref:`int<class_int>` **get_virtual_keyboard_height** **(** **)**
  814. Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or if it is currently hidden.
  815. ----
  816. .. _class_OS_method_get_window_safe_area:
  817. - :ref:`Rect2<class_Rect2>` **get_window_safe_area** **(** **)** const
  818. Returns unobscured area of the window where interactive controls should be rendered.
  819. ----
  820. .. _class_OS_method_global_menu_add_item:
  821. - void **global_menu_add_item** **(** :ref:`String<class_String>` menu, :ref:`String<class_String>` label, :ref:`Variant<class_Variant>` id, :ref:`Variant<class_Variant>` meta **)**
  822. Add a new item with text "label" to global menu. Use "_dock" menu to add item to the macOS dock icon menu.
  823. **Note:** This method is implemented on macOS.
  824. ----
  825. .. _class_OS_method_global_menu_add_separator:
  826. - void **global_menu_add_separator** **(** :ref:`String<class_String>` menu **)**
  827. Add a separator between items. Separators also occupy an index.
  828. **Note:** This method is implemented on macOS.
  829. ----
  830. .. _class_OS_method_global_menu_clear:
  831. - void **global_menu_clear** **(** :ref:`String<class_String>` menu **)**
  832. Clear the global menu, in effect removing all items.
  833. **Note:** This method is implemented on macOS.
  834. ----
  835. .. _class_OS_method_global_menu_remove_item:
  836. - void **global_menu_remove_item** **(** :ref:`String<class_String>` menu, :ref:`int<class_int>` idx **)**
  837. Removes the item at index "idx" from the global menu. Note that the indexes of items after the removed item are going to be shifted by one.
  838. **Note:** This method is implemented on macOS.
  839. ----
  840. .. _class_OS_method_has_environment:
  841. - :ref:`bool<class_bool>` **has_environment** **(** :ref:`String<class_String>` environment **)** const
  842. Returns ``true`` if an environment variable exists.
  843. ----
  844. .. _class_OS_method_has_feature:
  845. - :ref:`bool<class_bool>` **has_feature** **(** :ref:`String<class_String>` tag_name **)** const
  846. 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. Refer to the `Feature Tags <https://docs.godotengine.org/en/latest/tutorials/export/feature_tags.html>`_ documentation for more details.
  847. **Note:** Tag names are case-sensitive.
  848. ----
  849. .. _class_OS_method_has_touchscreen_ui_hint:
  850. - :ref:`bool<class_bool>` **has_touchscreen_ui_hint** **(** **)** const
  851. Returns ``true`` if the device has a touchscreen or emulates one.
  852. ----
  853. .. _class_OS_method_has_virtual_keyboard:
  854. - :ref:`bool<class_bool>` **has_virtual_keyboard** **(** **)** const
  855. Returns ``true`` if the platform has a virtual keyboard, ``false`` otherwise.
  856. ----
  857. .. _class_OS_method_hide_virtual_keyboard:
  858. - void **hide_virtual_keyboard** **(** **)**
  859. Hides the virtual keyboard if it is shown, does nothing otherwise.
  860. ----
  861. .. _class_OS_method_is_debug_build:
  862. - :ref:`bool<class_bool>` **is_debug_build** **(** **)** const
  863. Returns ``true`` if the Godot binary used to run the project is a *debug* export template, or when running in the editor.
  864. Returns ``false`` if the Godot binary used to run the project is a *release* export template.
  865. To check whether the Godot binary used to run the project is an export template (debug or release), use ``OS.has_feature("standalone")`` instead.
  866. ----
  867. .. _class_OS_method_is_keycode_unicode:
  868. - :ref:`bool<class_bool>` **is_keycode_unicode** **(** :ref:`int<class_int>` code **)** const
  869. Returns ``true`` if the input keycode corresponds to a Unicode character.
  870. ----
  871. .. _class_OS_method_is_ok_left_and_cancel_right:
  872. - :ref:`bool<class_bool>` **is_ok_left_and_cancel_right** **(** **)** const
  873. Returns ``true`` if the **OK** button should appear on the left and **Cancel** on the right.
  874. ----
  875. .. _class_OS_method_is_stdout_verbose:
  876. - :ref:`bool<class_bool>` **is_stdout_verbose** **(** **)** const
  877. Returns ``true`` if the engine was executed with ``-v`` (verbose stdout).
  878. ----
  879. .. _class_OS_method_is_userfs_persistent:
  880. - :ref:`bool<class_bool>` **is_userfs_persistent** **(** **)** const
  881. 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.
  882. ----
  883. .. _class_OS_method_is_window_always_on_top:
  884. - :ref:`bool<class_bool>` **is_window_always_on_top** **(** **)** const
  885. Returns ``true`` if the window should always be on top of other windows.
  886. ----
  887. .. _class_OS_method_is_window_focused:
  888. - :ref:`bool<class_bool>` **is_window_focused** **(** **)** const
  889. Returns ``true`` if the window is currently focused.
  890. **Note:** Only implemented on desktop platforms. On other platforms, it will always return ``true``.
  891. ----
  892. .. _class_OS_method_kill:
  893. - :ref:`Error<enum_@GlobalScope_Error>` **kill** **(** :ref:`int<class_int>` pid **)**
  894. 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.
  895. **Note:** This method can also be used to kill processes that were not spawned by the game.
  896. **Note:** This method is implemented on Android, iOS, Linux, macOS and Windows.
  897. ----
  898. .. _class_OS_method_move_window_to_foreground:
  899. - void **move_window_to_foreground** **(** **)**
  900. Moves the window to the front.
  901. **Note:** This method is implemented on Linux, macOS and Windows.
  902. ----
  903. .. _class_OS_method_native_video_is_playing:
  904. - :ref:`bool<class_bool>` **native_video_is_playing** **(** **)**
  905. Returns ``true`` if native video is playing.
  906. **Note:** This method is implemented on Android and iOS.
  907. ----
  908. .. _class_OS_method_native_video_pause:
  909. - void **native_video_pause** **(** **)**
  910. Pauses native video playback.
  911. **Note:** This method is implemented on Android and iOS.
  912. ----
  913. .. _class_OS_method_native_video_play:
  914. - :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 **)**
  915. Plays native video from the specified path, at the given volume and with audio and subtitle tracks.
  916. **Note:** This method is implemented on Android and iOS, and the current Android implementation does not support the ``volume``, ``audio_track`` and ``subtitle_track`` options.
  917. ----
  918. .. _class_OS_method_native_video_stop:
  919. - void **native_video_stop** **(** **)**
  920. Stops native video playback.
  921. **Note:** This method is implemented on Android and iOS.
  922. ----
  923. .. _class_OS_method_native_video_unpause:
  924. - void **native_video_unpause** **(** **)**
  925. Resumes native video playback.
  926. **Note:** This method is implemented on Android and iOS.
  927. ----
  928. .. _class_OS_method_open_midi_inputs:
  929. - void **open_midi_inputs** **(** **)**
  930. Initialises the singleton for the system MIDI driver.
  931. **Note:** This method is implemented on Linux, macOS and Windows.
  932. ----
  933. .. _class_OS_method_print_all_resources:
  934. - void **print_all_resources** **(** :ref:`String<class_String>` tofile="" **)**
  935. Shows all resources in the game. Optionally, the list can be written to a file by specifying a file path in ``tofile``.
  936. ----
  937. .. _class_OS_method_print_all_textures_by_size:
  938. - void **print_all_textures_by_size** **(** **)**
  939. Shows the list of loaded textures sorted by size in memory.
  940. ----
  941. .. _class_OS_method_print_resources_by_type:
  942. - void **print_resources_by_type** **(** :ref:`PackedStringArray<class_PackedStringArray>` types **)**
  943. Shows the number of resources loaded by the game of the given types.
  944. ----
  945. .. _class_OS_method_print_resources_in_use:
  946. - void **print_resources_in_use** **(** :ref:`bool<class_bool>` short=false **)**
  947. Shows all resources currently used by the game.
  948. ----
  949. .. _class_OS_method_request_attention:
  950. - void **request_attention** **(** **)**
  951. Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX.
  952. **Note:** This method is implemented on Linux, macOS and Windows.
  953. ----
  954. .. _class_OS_method_request_permission:
  955. - :ref:`bool<class_bool>` **request_permission** **(** :ref:`String<class_String>` name **)**
  956. At the moment this function is only used by ``AudioDriverOpenSL`` to request permission for ``RECORD_AUDIO`` on Android.
  957. ----
  958. .. _class_OS_method_request_permissions:
  959. - :ref:`bool<class_bool>` **request_permissions** **(** **)**
  960. With this function you can request dangerous permissions since normal permissions are automatically granted at install time in Android application.
  961. **Note:** This method is implemented on Android.
  962. ----
  963. .. _class_OS_method_set_icon:
  964. - void **set_icon** **(** :ref:`Image<class_Image>` icon **)**
  965. Sets the game's icon using an :ref:`Image<class_Image>` resource.
  966. The same image is used for window caption, taskbar/dock and window selection dialog. Image is scaled as needed.
  967. **Note:** This method is implemented on HTML5, Linux, macOS and Windows.
  968. ----
  969. .. _class_OS_method_set_ime_active:
  970. - void **set_ime_active** **(** :ref:`bool<class_bool>` active **)**
  971. Sets whether IME input mode should be enabled.
  972. If active IME handles key events before the application and creates an composition string and suggestion list.
  973. Application can retrieve the composition status by using :ref:`get_ime_selection<class_OS_method_get_ime_selection>` and :ref:`get_ime_text<class_OS_method_get_ime_text>` functions.
  974. Completed composition string is committed when input is finished.
  975. **Note:** This method is implemented on Linux, macOS and Windows.
  976. ----
  977. .. _class_OS_method_set_ime_position:
  978. - void **set_ime_position** **(** :ref:`Vector2<class_Vector2>` position **)**
  979. Sets position of IME suggestion list popup (in window coordinates).
  980. **Note:** This method is implemented on Linux, macOS and Windows.
  981. ----
  982. .. _class_OS_method_set_native_icon:
  983. - void **set_native_icon** **(** :ref:`String<class_String>` filename **)**
  984. Sets the game's icon using a multi-size platform-specific icon file (``*.ico`` on Windows and ``*.icns`` on macOS).
  985. Appropriate size sub-icons are used for window caption, taskbar/dock and window selection dialog.
  986. **Note:** This method is implemented on macOS and Windows.
  987. ----
  988. .. _class_OS_method_set_thread_name:
  989. - :ref:`Error<enum_@GlobalScope_Error>` **set_thread_name** **(** :ref:`String<class_String>` name **)**
  990. Sets the name of the current thread.
  991. ----
  992. .. _class_OS_method_set_use_file_access_save_and_swap:
  993. - void **set_use_file_access_save_and_swap** **(** :ref:`bool<class_bool>` enabled **)**
  994. Enables backup saves if ``enabled`` is ``true``.
  995. ----
  996. .. _class_OS_method_set_window_always_on_top:
  997. - void **set_window_always_on_top** **(** :ref:`bool<class_bool>` enabled **)**
  998. Sets whether the window should always be on top.
  999. **Note:** This method is implemented on Linux, macOS and Windows.
  1000. ----
  1001. .. _class_OS_method_set_window_title:
  1002. - void **set_window_title** **(** :ref:`String<class_String>` title **)**
  1003. Sets the window title to the specified string.
  1004. **Note:** This should be used sporadically. Don't set this every frame, as that will negatively affect performance on some window managers.
  1005. **Note:** This method is implemented on HTML5, Linux, macOS and Windows.
  1006. ----
  1007. .. _class_OS_method_shell_open:
  1008. - :ref:`Error<enum_@GlobalScope_Error>` **shell_open** **(** :ref:`String<class_String>` uri **)**
  1009. Requests the OS to open a resource with the most appropriate program. For example:
  1010. - ``OS.shell_open("C:\\Users\name\Downloads")`` on Windows opens the file explorer at the user's Downloads folder.
  1011. - ``OS.shell_open("https://godotengine.org")`` opens the default web browser on the official Godot website.
  1012. - ``OS.shell_open("mailto:[email protected]")`` opens the default email client with the "To" field set to ``[email protected]``. See `Customizing ``mailto:`` Links <https://blog.escapecreative.com/customizing-mailto-links/>`_ for a list of fields that can be added.
  1013. **Note:** This method is implemented on Android, iOS, HTML5, Linux, macOS and Windows.
  1014. ----
  1015. .. _class_OS_method_show_virtual_keyboard:
  1016. - void **show_virtual_keyboard** **(** :ref:`String<class_String>` existing_text="" **)**
  1017. 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).
  1018. **Note:** This method is implemented on Android, iOS and UWP.