1 /** 2 Operating System functions. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.os; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.image; 23 /** 24 Operating System functions. 25 26 OS Wraps the most common functionality to communicate with the host Operating System, such as: mouse grabbing, mouse cursors, clipboard, video mode, date and time, timers, environment variables, execution of binaries, command line, etc. 27 */ 28 @GodotBaseClass struct OSSingleton 29 { 30 enum string _GODOT_internal_name = "_OS"; 31 public: 32 @nogc nothrow: 33 union { godot_object _godot_object; GodotObject _GODOT_base; } 34 alias _GODOT_base this; 35 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 36 package(godot) __gshared bool _classBindingInitialized = false; 37 package(godot) static struct _classBinding 38 { 39 __gshared: 40 godot_object _singleton; 41 immutable char* _singletonName = "OS"; 42 @GodotName("set_clipboard") GodotMethod!(void, String) setClipboard; 43 @GodotName("get_clipboard") GodotMethod!(String) getClipboard; 44 @GodotName("get_video_driver_count") GodotMethod!(long) getVideoDriverCount; 45 @GodotName("get_video_driver_name") GodotMethod!(String, long) getVideoDriverName; 46 @GodotName("get_audio_driver_count") GodotMethod!(long) getAudioDriverCount; 47 @GodotName("get_audio_driver_name") GodotMethod!(String, long) getAudioDriverName; 48 @GodotName("get_connected_midi_inputs") GodotMethod!(PoolStringArray) getConnectedMidiInputs; 49 @GodotName("open_midi_inputs") GodotMethod!(void) openMidiInputs; 50 @GodotName("close_midi_inputs") GodotMethod!(void) closeMidiInputs; 51 @GodotName("get_screen_count") GodotMethod!(long) getScreenCount; 52 @GodotName("get_current_screen") GodotMethod!(long) getCurrentScreen; 53 @GodotName("set_current_screen") GodotMethod!(void, long) setCurrentScreen; 54 @GodotName("get_screen_position") GodotMethod!(Vector2, long) getScreenPosition; 55 @GodotName("get_screen_size") GodotMethod!(Vector2, long) getScreenSize; 56 @GodotName("get_screen_dpi") GodotMethod!(long, long) getScreenDpi; 57 @GodotName("get_window_position") GodotMethod!(Vector2) getWindowPosition; 58 @GodotName("set_window_position") GodotMethod!(void, Vector2) setWindowPosition; 59 @GodotName("get_window_size") GodotMethod!(Vector2) getWindowSize; 60 @GodotName("set_window_size") GodotMethod!(void, Vector2) setWindowSize; 61 @GodotName("get_window_safe_area") GodotMethod!(Rect2) getWindowSafeArea; 62 @GodotName("set_window_fullscreen") GodotMethod!(void, bool) setWindowFullscreen; 63 @GodotName("is_window_fullscreen") GodotMethod!(bool) isWindowFullscreen; 64 @GodotName("set_window_resizable") GodotMethod!(void, bool) setWindowResizable; 65 @GodotName("is_window_resizable") GodotMethod!(bool) isWindowResizable; 66 @GodotName("set_window_minimized") GodotMethod!(void, bool) setWindowMinimized; 67 @GodotName("is_window_minimized") GodotMethod!(bool) isWindowMinimized; 68 @GodotName("set_window_maximized") GodotMethod!(void, bool) setWindowMaximized; 69 @GodotName("is_window_maximized") GodotMethod!(bool) isWindowMaximized; 70 @GodotName("set_window_always_on_top") GodotMethod!(void, bool) setWindowAlwaysOnTop; 71 @GodotName("is_window_always_on_top") GodotMethod!(bool) isWindowAlwaysOnTop; 72 @GodotName("request_attention") GodotMethod!(void) requestAttention; 73 @GodotName("get_real_window_size") GodotMethod!(Vector2) getRealWindowSize; 74 @GodotName("center_window") GodotMethod!(void) centerWindow; 75 @GodotName("set_borderless_window") GodotMethod!(void, bool) setBorderlessWindow; 76 @GodotName("get_borderless_window") GodotMethod!(bool) getBorderlessWindow; 77 @GodotName("get_window_per_pixel_transparency_enabled") GodotMethod!(bool) getWindowPerPixelTransparencyEnabled; 78 @GodotName("set_window_per_pixel_transparency_enabled") GodotMethod!(void, bool) setWindowPerPixelTransparencyEnabled; 79 @GodotName("set_ime_position") GodotMethod!(void, Vector2) setImePosition; 80 @GodotName("set_screen_orientation") GodotMethod!(void, long) setScreenOrientation; 81 @GodotName("get_screen_orientation") GodotMethod!(OS.ScreenOrientation) getScreenOrientation; 82 @GodotName("set_keep_screen_on") GodotMethod!(void, bool) setKeepScreenOn; 83 @GodotName("is_keep_screen_on") GodotMethod!(bool) isKeepScreenOn; 84 @GodotName("has_touchscreen_ui_hint") GodotMethod!(bool) hasTouchscreenUiHint; 85 @GodotName("set_window_title") GodotMethod!(void, String) setWindowTitle; 86 @GodotName("set_low_processor_usage_mode") GodotMethod!(void, bool) setLowProcessorUsageMode; 87 @GodotName("is_in_low_processor_usage_mode") GodotMethod!(bool) isInLowProcessorUsageMode; 88 @GodotName("get_processor_count") GodotMethod!(long) getProcessorCount; 89 @GodotName("get_executable_path") GodotMethod!(String) getExecutablePath; 90 @GodotName("execute") GodotMethod!(long, String, PoolStringArray, bool, Array) execute; 91 @GodotName("kill") GodotMethod!(GodotError, long) kill; 92 @GodotName("shell_open") GodotMethod!(GodotError, String) shellOpen; 93 @GodotName("get_process_id") GodotMethod!(long) getProcessId; 94 @GodotName("get_environment") GodotMethod!(String, String) getEnvironment; 95 @GodotName("has_environment") GodotMethod!(bool, String) hasEnvironment; 96 @GodotName("get_name") GodotMethod!(String) getName; 97 @GodotName("get_cmdline_args") GodotMethod!(PoolStringArray) getCmdlineArgs; 98 @GodotName("get_datetime") GodotMethod!(Dictionary, bool) getDatetime; 99 @GodotName("get_date") GodotMethod!(Dictionary, bool) getDate; 100 @GodotName("get_time") GodotMethod!(Dictionary, bool) getTime; 101 @GodotName("get_time_zone_info") GodotMethod!(Dictionary) getTimeZoneInfo; 102 @GodotName("get_unix_time") GodotMethod!(long) getUnixTime; 103 @GodotName("get_datetime_from_unix_time") GodotMethod!(Dictionary, long) getDatetimeFromUnixTime; 104 @GodotName("get_unix_time_from_datetime") GodotMethod!(long, Dictionary) getUnixTimeFromDatetime; 105 @GodotName("get_system_time_secs") GodotMethod!(long) getSystemTimeSecs; 106 @GodotName("set_icon") GodotMethod!(void, Image) setIcon; 107 @GodotName("get_exit_code") GodotMethod!(long) getExitCode; 108 @GodotName("set_exit_code") GodotMethod!(void, long) setExitCode; 109 @GodotName("delay_usec") GodotMethod!(void, long) delayUsec; 110 @GodotName("delay_msec") GodotMethod!(void, long) delayMsec; 111 @GodotName("get_ticks_msec") GodotMethod!(long) getTicksMsec; 112 @GodotName("get_ticks_usec") GodotMethod!(long) getTicksUsec; 113 @GodotName("get_splash_tick_msec") GodotMethod!(long) getSplashTickMsec; 114 @GodotName("get_locale") GodotMethod!(String) getLocale; 115 @GodotName("get_latin_keyboard_variant") GodotMethod!(String) getLatinKeyboardVariant; 116 @GodotName("get_model_name") GodotMethod!(String) getModelName; 117 @GodotName("can_draw") GodotMethod!(bool) canDraw; 118 @GodotName("is_userfs_persistent") GodotMethod!(bool) isUserfsPersistent; 119 @GodotName("is_stdout_verbose") GodotMethod!(bool) isStdoutVerbose; 120 @GodotName("can_use_threads") GodotMethod!(bool) canUseThreads; 121 @GodotName("is_debug_build") GodotMethod!(bool) isDebugBuild; 122 @GodotName("dump_memory_to_file") GodotMethod!(void, String) dumpMemoryToFile; 123 @GodotName("dump_resources_to_file") GodotMethod!(void, String) dumpResourcesToFile; 124 @GodotName("has_virtual_keyboard") GodotMethod!(bool) hasVirtualKeyboard; 125 @GodotName("show_virtual_keyboard") GodotMethod!(void, String) showVirtualKeyboard; 126 @GodotName("hide_virtual_keyboard") GodotMethod!(void) hideVirtualKeyboard; 127 @GodotName("get_virtual_keyboard_height") GodotMethod!(long) getVirtualKeyboardHeight; 128 @GodotName("print_resources_in_use") GodotMethod!(void, bool) printResourcesInUse; 129 @GodotName("print_all_resources") GodotMethod!(void, String) printAllResources; 130 @GodotName("get_static_memory_usage") GodotMethod!(long) getStaticMemoryUsage; 131 @GodotName("get_static_memory_peak_usage") GodotMethod!(long) getStaticMemoryPeakUsage; 132 @GodotName("get_dynamic_memory_usage") GodotMethod!(long) getDynamicMemoryUsage; 133 @GodotName("get_user_data_dir") GodotMethod!(String) getUserDataDir; 134 @GodotName("get_system_dir") GodotMethod!(String, long) getSystemDir; 135 @GodotName("get_unique_id") GodotMethod!(String) getUniqueId; 136 @GodotName("is_ok_left_and_cancel_right") GodotMethod!(bool) isOkLeftAndCancelRight; 137 @GodotName("print_all_textures_by_size") GodotMethod!(void) printAllTexturesBySize; 138 @GodotName("print_resources_by_type") GodotMethod!(void, PoolStringArray) printResourcesByType; 139 @GodotName("native_video_play") GodotMethod!(GodotError, String, double, String, String) nativeVideoPlay; 140 @GodotName("native_video_is_playing") GodotMethod!(bool) nativeVideoIsPlaying; 141 @GodotName("native_video_stop") GodotMethod!(void) nativeVideoStop; 142 @GodotName("native_video_pause") GodotMethod!(void) nativeVideoPause; 143 @GodotName("native_video_unpause") GodotMethod!(void) nativeVideoUnpause; 144 @GodotName("get_scancode_string") GodotMethod!(String, long) getScancodeString; 145 @GodotName("is_scancode_unicode") GodotMethod!(bool, long) isScancodeUnicode; 146 @GodotName("find_scancode_from_string") GodotMethod!(long, String) findScancodeFromString; 147 @GodotName("set_use_file_access_save_and_swap") GodotMethod!(void, bool) setUseFileAccessSaveAndSwap; 148 @GodotName("alert") GodotMethod!(void, String, String) alert; 149 @GodotName("set_thread_name") GodotMethod!(GodotError, String) setThreadName; 150 @GodotName("set_use_vsync") GodotMethod!(void, bool) setUseVsync; 151 @GodotName("is_vsync_enabled") GodotMethod!(bool) isVsyncEnabled; 152 @GodotName("has_feature") GodotMethod!(bool, String) hasFeature; 153 @GodotName("get_power_state") GodotMethod!(OS.PowerState) getPowerState; 154 @GodotName("get_power_seconds_left") GodotMethod!(long) getPowerSecondsLeft; 155 @GodotName("get_power_percent_left") GodotMethod!(long) getPowerPercentLeft; 156 } 157 bool opEquals(in OSSingleton other) const { return _godot_object.ptr is other._godot_object.ptr; } 158 OSSingleton opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 159 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 160 mixin baseCasts; 161 static OSSingleton _new() 162 { 163 static godot_class_constructor constructor; 164 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("_OS"); 165 if(constructor is null) return typeof(this).init; 166 return cast(OSSingleton)(constructor()); 167 } 168 @disable new(size_t s); 169 /// 170 enum SystemDir : int 171 { 172 /** 173 Desktop directory path. 174 */ 175 systemDirDesktop = 0, 176 /** 177 DCIM (Digital Camera Images) directory path. 178 */ 179 systemDirDcim = 1, 180 /** 181 Documents directory path. 182 */ 183 systemDirDocuments = 2, 184 /** 185 Downloads directory path. 186 */ 187 systemDirDownloads = 3, 188 /** 189 Movies directory path. 190 */ 191 systemDirMovies = 4, 192 /** 193 Music directory path. 194 */ 195 systemDirMusic = 5, 196 /** 197 Pictures directory path. 198 */ 199 systemDirPictures = 6, 200 /** 201 Ringtones directory path. 202 */ 203 systemDirRingtones = 7, 204 } 205 /// 206 enum ScreenOrientation : int 207 { 208 /** 209 Landscape screen orientation. 210 */ 211 screenOrientationLandscape = 0, 212 /** 213 Portrait screen orientation. 214 */ 215 screenOrientationPortrait = 1, 216 /** 217 Reverse landscape screen orientation. 218 */ 219 screenOrientationReverseLandscape = 2, 220 /** 221 Reverse portrait screen orientation. 222 */ 223 screenOrientationReversePortrait = 3, 224 /** 225 Uses landscape or reverse landscape based on the hardware sensor. 226 */ 227 screenOrientationSensorLandscape = 4, 228 /** 229 Uses portrait or reverse portrait based on the hardware sensor. 230 */ 231 screenOrientationSensorPortrait = 5, 232 /** 233 Uses most suitable orientation based on the hardware sensor. 234 */ 235 screenOrientationSensor = 6, 236 } 237 /// 238 enum PowerState : int 239 { 240 /** 241 Unknown powerstate. 242 */ 243 powerstateUnknown = 0, 244 /** 245 Unplugged, running on battery. 246 */ 247 powerstateOnBattery = 1, 248 /** 249 Plugged in, no battery available. 250 */ 251 powerstateNoBattery = 2, 252 /** 253 Plugged in, battery charging. 254 */ 255 powerstateCharging = 3, 256 /** 257 Plugged in, battery fully charged. 258 */ 259 powerstateCharged = 4, 260 } 261 /// 262 enum Month : int 263 { 264 /** 265 January. 266 */ 267 monthJanuary = 1, 268 /** 269 February. 270 */ 271 monthFebruary = 2, 272 /** 273 March. 274 */ 275 monthMarch = 3, 276 /** 277 April. 278 */ 279 monthApril = 4, 280 /** 281 May. 282 */ 283 monthMay = 5, 284 /** 285 June. 286 */ 287 monthJune = 6, 288 /** 289 July. 290 */ 291 monthJuly = 7, 292 /** 293 August. 294 */ 295 monthAugust = 8, 296 /** 297 September. 298 */ 299 monthSeptember = 9, 300 /** 301 October. 302 */ 303 monthOctober = 10, 304 /** 305 November. 306 */ 307 monthNovember = 11, 308 /** 309 December. 310 */ 311 monthDecember = 12, 312 } 313 /// 314 enum Weekday : int 315 { 316 /** 317 Sunday. 318 */ 319 daySunday = 0, 320 /** 321 Monday. 322 */ 323 dayMonday = 1, 324 /** 325 Tuesday. 326 */ 327 dayTuesday = 2, 328 /** 329 Wednesday. 330 */ 331 dayWednesday = 3, 332 /** 333 Thursday. 334 */ 335 dayThursday = 4, 336 /** 337 Friday. 338 */ 339 dayFriday = 5, 340 /** 341 Saturday. 342 */ 343 daySaturday = 6, 344 } 345 /// 346 enum Constants : int 347 { 348 powerstateUnknown = 0, 349 screenOrientationLandscape = 0, 350 systemDirDesktop = 0, 351 daySunday = 0, 352 screenOrientationPortrait = 1, 353 systemDirDcim = 1, 354 monthJanuary = 1, 355 dayMonday = 1, 356 powerstateOnBattery = 1, 357 powerstateNoBattery = 2, 358 monthFebruary = 2, 359 dayTuesday = 2, 360 screenOrientationReverseLandscape = 2, 361 systemDirDocuments = 2, 362 screenOrientationReversePortrait = 3, 363 monthMarch = 3, 364 powerstateCharging = 3, 365 systemDirDownloads = 3, 366 dayWednesday = 3, 367 screenOrientationSensorLandscape = 4, 368 powerstateCharged = 4, 369 dayThursday = 4, 370 systemDirMovies = 4, 371 monthApril = 4, 372 dayFriday = 5, 373 systemDirMusic = 5, 374 screenOrientationSensorPortrait = 5, 375 monthMay = 5, 376 screenOrientationSensor = 6, 377 daySaturday = 6, 378 monthJune = 6, 379 systemDirPictures = 6, 380 monthJuly = 7, 381 systemDirRingtones = 7, 382 monthAugust = 8, 383 monthSeptember = 9, 384 monthOctober = 10, 385 monthNovember = 11, 386 monthDecember = 12, 387 } 388 /** 389 390 */ 391 void setClipboard(StringArg0)(in StringArg0 clipboard) 392 { 393 checkClassBinding!(typeof(this))(); 394 ptrcall!(void)(_classBinding.setClipboard, _godot_object, clipboard); 395 } 396 /** 397 398 */ 399 String getClipboard() const 400 { 401 checkClassBinding!(typeof(this))(); 402 return ptrcall!(String)(_classBinding.getClipboard, _godot_object); 403 } 404 /** 405 406 */ 407 long getVideoDriverCount() const 408 { 409 checkClassBinding!(typeof(this))(); 410 return ptrcall!(long)(_classBinding.getVideoDriverCount, _godot_object); 411 } 412 /** 413 414 */ 415 String getVideoDriverName(in long driver) const 416 { 417 checkClassBinding!(typeof(this))(); 418 return ptrcall!(String)(_classBinding.getVideoDriverName, _godot_object, driver); 419 } 420 /** 421 Returns the total number of available audio drivers. 422 */ 423 long getAudioDriverCount() const 424 { 425 checkClassBinding!(typeof(this))(); 426 return ptrcall!(long)(_classBinding.getAudioDriverCount, _godot_object); 427 } 428 /** 429 Returns the audio driver name for the given index. 430 */ 431 String getAudioDriverName(in long driver) const 432 { 433 checkClassBinding!(typeof(this))(); 434 return ptrcall!(String)(_classBinding.getAudioDriverName, _godot_object, driver); 435 } 436 /** 437 438 */ 439 PoolStringArray getConnectedMidiInputs() 440 { 441 checkClassBinding!(typeof(this))(); 442 return ptrcall!(PoolStringArray)(_classBinding.getConnectedMidiInputs, _godot_object); 443 } 444 /** 445 446 */ 447 void openMidiInputs() 448 { 449 checkClassBinding!(typeof(this))(); 450 ptrcall!(void)(_classBinding.openMidiInputs, _godot_object); 451 } 452 /** 453 454 */ 455 void closeMidiInputs() 456 { 457 checkClassBinding!(typeof(this))(); 458 ptrcall!(void)(_classBinding.closeMidiInputs, _godot_object); 459 } 460 /** 461 Returns the number of displays attached to the host machine. 462 */ 463 long getScreenCount() const 464 { 465 checkClassBinding!(typeof(this))(); 466 return ptrcall!(long)(_classBinding.getScreenCount, _godot_object); 467 } 468 /** 469 470 */ 471 long getCurrentScreen() const 472 { 473 checkClassBinding!(typeof(this))(); 474 return ptrcall!(long)(_classBinding.getCurrentScreen, _godot_object); 475 } 476 /** 477 478 */ 479 void setCurrentScreen(in long screen) 480 { 481 checkClassBinding!(typeof(this))(); 482 ptrcall!(void)(_classBinding.setCurrentScreen, _godot_object, screen); 483 } 484 /** 485 Returns the position of the specified screen by index. If no screen index is provided, the current screen will be used. 486 */ 487 Vector2 getScreenPosition(in long screen = -1) const 488 { 489 checkClassBinding!(typeof(this))(); 490 return ptrcall!(Vector2)(_classBinding.getScreenPosition, _godot_object, screen); 491 } 492 /** 493 Returns the dimensions in pixels of the specified screen. 494 */ 495 Vector2 getScreenSize(in long screen = -1) const 496 { 497 checkClassBinding!(typeof(this))(); 498 return ptrcall!(Vector2)(_classBinding.getScreenSize, _godot_object, screen); 499 } 500 /** 501 Returns the dots per inch density of the specified screen. 502 On Android Devices, the actual screen densities are grouped into six generalized densities: 503 ldpi - 120 dpi 504 mdpi - 160 dpi 505 hdpi - 240 dpi 506 xhdpi - 320 dpi 507 xxhdpi - 480 dpi 508 xxxhdpi - 640 dpi 509 */ 510 long getScreenDpi(in long screen = -1) const 511 { 512 checkClassBinding!(typeof(this))(); 513 return ptrcall!(long)(_classBinding.getScreenDpi, _godot_object, screen); 514 } 515 /** 516 517 */ 518 Vector2 getWindowPosition() const 519 { 520 checkClassBinding!(typeof(this))(); 521 return ptrcall!(Vector2)(_classBinding.getWindowPosition, _godot_object); 522 } 523 /** 524 525 */ 526 void setWindowPosition(in Vector2 position) 527 { 528 checkClassBinding!(typeof(this))(); 529 ptrcall!(void)(_classBinding.setWindowPosition, _godot_object, position); 530 } 531 /** 532 533 */ 534 Vector2 getWindowSize() const 535 { 536 checkClassBinding!(typeof(this))(); 537 return ptrcall!(Vector2)(_classBinding.getWindowSize, _godot_object); 538 } 539 /** 540 541 */ 542 void setWindowSize(in Vector2 size) 543 { 544 checkClassBinding!(typeof(this))(); 545 ptrcall!(void)(_classBinding.setWindowSize, _godot_object, size); 546 } 547 /** 548 549 */ 550 Rect2 getWindowSafeArea() const 551 { 552 checkClassBinding!(typeof(this))(); 553 return ptrcall!(Rect2)(_classBinding.getWindowSafeArea, _godot_object); 554 } 555 /** 556 557 */ 558 void setWindowFullscreen(in bool enabled) 559 { 560 checkClassBinding!(typeof(this))(); 561 ptrcall!(void)(_classBinding.setWindowFullscreen, _godot_object, enabled); 562 } 563 /** 564 565 */ 566 bool isWindowFullscreen() const 567 { 568 checkClassBinding!(typeof(this))(); 569 return ptrcall!(bool)(_classBinding.isWindowFullscreen, _godot_object); 570 } 571 /** 572 573 */ 574 void setWindowResizable(in bool enabled) 575 { 576 checkClassBinding!(typeof(this))(); 577 ptrcall!(void)(_classBinding.setWindowResizable, _godot_object, enabled); 578 } 579 /** 580 581 */ 582 bool isWindowResizable() const 583 { 584 checkClassBinding!(typeof(this))(); 585 return ptrcall!(bool)(_classBinding.isWindowResizable, _godot_object); 586 } 587 /** 588 589 */ 590 void setWindowMinimized(in bool enabled) 591 { 592 checkClassBinding!(typeof(this))(); 593 ptrcall!(void)(_classBinding.setWindowMinimized, _godot_object, enabled); 594 } 595 /** 596 597 */ 598 bool isWindowMinimized() const 599 { 600 checkClassBinding!(typeof(this))(); 601 return ptrcall!(bool)(_classBinding.isWindowMinimized, _godot_object); 602 } 603 /** 604 605 */ 606 void setWindowMaximized(in bool enabled) 607 { 608 checkClassBinding!(typeof(this))(); 609 ptrcall!(void)(_classBinding.setWindowMaximized, _godot_object, enabled); 610 } 611 /** 612 613 */ 614 bool isWindowMaximized() const 615 { 616 checkClassBinding!(typeof(this))(); 617 return ptrcall!(bool)(_classBinding.isWindowMaximized, _godot_object); 618 } 619 /** 620 Sets whether the window should always be on top. 621 */ 622 void setWindowAlwaysOnTop(in bool enabled) 623 { 624 checkClassBinding!(typeof(this))(); 625 ptrcall!(void)(_classBinding.setWindowAlwaysOnTop, _godot_object, enabled); 626 } 627 /** 628 Returns `true` if the window should always be on top of other windows. 629 */ 630 bool isWindowAlwaysOnTop() const 631 { 632 checkClassBinding!(typeof(this))(); 633 return ptrcall!(bool)(_classBinding.isWindowAlwaysOnTop, _godot_object); 634 } 635 /** 636 Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX. 637 */ 638 void requestAttention() 639 { 640 checkClassBinding!(typeof(this))(); 641 ptrcall!(void)(_classBinding.requestAttention, _godot_object); 642 } 643 /** 644 Returns the window size including decorations like window borders. 645 */ 646 Vector2 getRealWindowSize() const 647 { 648 checkClassBinding!(typeof(this))(); 649 return ptrcall!(Vector2)(_classBinding.getRealWindowSize, _godot_object); 650 } 651 /** 652 Centers the window on the screen if in windowed mode. 653 */ 654 void centerWindow() 655 { 656 checkClassBinding!(typeof(this))(); 657 ptrcall!(void)(_classBinding.centerWindow, _godot_object); 658 } 659 /** 660 661 */ 662 void setBorderlessWindow(in bool borderless) 663 { 664 checkClassBinding!(typeof(this))(); 665 ptrcall!(void)(_classBinding.setBorderlessWindow, _godot_object, borderless); 666 } 667 /** 668 669 */ 670 bool getBorderlessWindow() const 671 { 672 checkClassBinding!(typeof(this))(); 673 return ptrcall!(bool)(_classBinding.getBorderlessWindow, _godot_object); 674 } 675 /** 676 677 */ 678 bool getWindowPerPixelTransparencyEnabled() const 679 { 680 checkClassBinding!(typeof(this))(); 681 return ptrcall!(bool)(_classBinding.getWindowPerPixelTransparencyEnabled, _godot_object); 682 } 683 /** 684 685 */ 686 void setWindowPerPixelTransparencyEnabled(in bool enabled) 687 { 688 checkClassBinding!(typeof(this))(); 689 ptrcall!(void)(_classBinding.setWindowPerPixelTransparencyEnabled, _godot_object, enabled); 690 } 691 /** 692 693 */ 694 void setImePosition(in Vector2 position) 695 { 696 checkClassBinding!(typeof(this))(); 697 ptrcall!(void)(_classBinding.setImePosition, _godot_object, position); 698 } 699 /** 700 701 */ 702 void setScreenOrientation(in long orientation) 703 { 704 checkClassBinding!(typeof(this))(); 705 ptrcall!(void)(_classBinding.setScreenOrientation, _godot_object, orientation); 706 } 707 /** 708 709 */ 710 OS.ScreenOrientation getScreenOrientation() const 711 { 712 checkClassBinding!(typeof(this))(); 713 return ptrcall!(OS.ScreenOrientation)(_classBinding.getScreenOrientation, _godot_object); 714 } 715 /** 716 717 */ 718 void setKeepScreenOn(in bool enabled) 719 { 720 checkClassBinding!(typeof(this))(); 721 ptrcall!(void)(_classBinding.setKeepScreenOn, _godot_object, enabled); 722 } 723 /** 724 725 */ 726 bool isKeepScreenOn() const 727 { 728 checkClassBinding!(typeof(this))(); 729 return ptrcall!(bool)(_classBinding.isKeepScreenOn, _godot_object); 730 } 731 /** 732 Returns `true` if the device has a touchscreen or emulates one. 733 */ 734 bool hasTouchscreenUiHint() const 735 { 736 checkClassBinding!(typeof(this))(); 737 return ptrcall!(bool)(_classBinding.hasTouchscreenUiHint, _godot_object); 738 } 739 /** 740 Sets the window title to the specified string. 741 */ 742 void setWindowTitle(StringArg0)(in StringArg0 title) 743 { 744 checkClassBinding!(typeof(this))(); 745 ptrcall!(void)(_classBinding.setWindowTitle, _godot_object, title); 746 } 747 /** 748 749 */ 750 void setLowProcessorUsageMode(in bool enable) 751 { 752 checkClassBinding!(typeof(this))(); 753 ptrcall!(void)(_classBinding.setLowProcessorUsageMode, _godot_object, enable); 754 } 755 /** 756 757 */ 758 bool isInLowProcessorUsageMode() const 759 { 760 checkClassBinding!(typeof(this))(); 761 return ptrcall!(bool)(_classBinding.isInLowProcessorUsageMode, _godot_object); 762 } 763 /** 764 Returns the number of cores available in the host machine. 765 */ 766 long getProcessorCount() const 767 { 768 checkClassBinding!(typeof(this))(); 769 return ptrcall!(long)(_classBinding.getProcessorCount, _godot_object); 770 } 771 /** 772 Returns the path to the current engine executable. 773 */ 774 String getExecutablePath() const 775 { 776 checkClassBinding!(typeof(this))(); 777 return ptrcall!(String)(_classBinding.getExecutablePath, _godot_object); 778 } 779 /** 780 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. 781 The arguments are used in the given order and separated by a space, so `OS.execute('ping', $(D '-w', '3', 'godotengine.org'), false)` will resolve to `ping -w 3 godotengine.org` in the system's shell. 782 This method has slightly different behaviour based on whether the `blocking` mode is enabled. 783 When `blocking` is enabled, the Godot thread will pause its execution while waiting for the process to terminate. The shell output of the process will be written to the `output` array as a single string. When the process terminates, the Godot thread will resume execution. 784 When `blocking` is disabled, the Godot thread will continue while the new process runs. It is not possible to retrieve the shell output in non-blocking mode, so `output` will be empty. 785 The return value also depends on the blocking mode. When blocking, the method will return -2 (no process ID information is available in blocking mode). When non-blocking, the method returns a process ID, which you can use to monitor the process (and potentially terminate it with $(D kill)). If the process forking (non-blocking) or opening (blocking) fails, the method will return -1. 786 Example of blocking mode and retrieving the shell output: 787 788 789 var output = [] 790 OS.execute('ls', $(D '-l', '/tmp'), true, output) 791 792 793 Example of non-blocking mode, running another instance of the project and storing its process ID: 794 795 796 var pid = OS.execute(OS.get_executable_path(), [], false) 797 798 799 If you wish to access a shell built-in or perform a composite command, a platform-specific shell can be invoked. For example: 800 801 802 OS.execute('CMD.exe', $(D '/C', 'cd %TEMP% && dir'), true, output) 803 804 805 */ 806 long execute(StringArg0)(in StringArg0 path, in PoolStringArray arguments, in bool blocking, in Array output = Array.empty_array) 807 { 808 checkClassBinding!(typeof(this))(); 809 return ptrcall!(long)(_classBinding.execute, _godot_object, path, arguments, blocking, output); 810 } 811 /** 812 Kill (terminate) the process identified by the given process ID (`pid`), e.g. the one returned by $(D execute) in non-blocking mode. 813 Note that this method can also be used to kill processes that were not spawned by the game. 814 */ 815 GodotError kill(in long pid) 816 { 817 checkClassBinding!(typeof(this))(); 818 return ptrcall!(GodotError)(_classBinding.kill, _godot_object, pid); 819 } 820 /** 821 Requests the OS to open a resource with the most appropriate program. For example. 822 `OS.shell_open("C:\\Users\name\Downloads")` on Windows opens the file explorer at the downloads folders of the user. 823 `OS.shell_open("http://godotengine.org")` opens the default web browser on the official Godot website. 824 */ 825 GodotError shellOpen(StringArg0)(in StringArg0 uri) 826 { 827 checkClassBinding!(typeof(this))(); 828 return ptrcall!(GodotError)(_classBinding.shellOpen, _godot_object, uri); 829 } 830 /** 831 Returns the game process ID 832 */ 833 long getProcessId() const 834 { 835 checkClassBinding!(typeof(this))(); 836 return ptrcall!(long)(_classBinding.getProcessId, _godot_object); 837 } 838 /** 839 Returns an environment variable. 840 */ 841 String getEnvironment(StringArg0)(in StringArg0 environment) const 842 { 843 checkClassBinding!(typeof(this))(); 844 return ptrcall!(String)(_classBinding.getEnvironment, _godot_object, environment); 845 } 846 /** 847 Returns `true` if an environment variable exists. 848 */ 849 bool hasEnvironment(StringArg0)(in StringArg0 environment) const 850 { 851 checkClassBinding!(typeof(this))(); 852 return ptrcall!(bool)(_classBinding.hasEnvironment, _godot_object, environment); 853 } 854 /** 855 Returns the name of the host OS. Possible values are: "Android", "Haiku", "iOS", "HTML5", "OSX", "Server", "Windows", "UWP", "X11". 856 */ 857 String getName() const 858 { 859 checkClassBinding!(typeof(this))(); 860 return ptrcall!(String)(_classBinding.getName, _godot_object); 861 } 862 /** 863 Returns the command line arguments passed to the engine. 864 */ 865 PoolStringArray getCmdlineArgs() 866 { 867 checkClassBinding!(typeof(this))(); 868 return ptrcall!(PoolStringArray)(_classBinding.getCmdlineArgs, _godot_object); 869 } 870 /** 871 Returns current datetime as a dictionary of keys: year, month, day, weekday, dst (daylight savings time), hour, minute, second. 872 */ 873 Dictionary getDatetime(in bool utc = false) const 874 { 875 checkClassBinding!(typeof(this))(); 876 return ptrcall!(Dictionary)(_classBinding.getDatetime, _godot_object, utc); 877 } 878 /** 879 Returns current date as a dictionary of keys: year, month, day, weekday, dst (daylight savings time). 880 */ 881 Dictionary getDate(in bool utc = false) const 882 { 883 checkClassBinding!(typeof(this))(); 884 return ptrcall!(Dictionary)(_classBinding.getDate, _godot_object, utc); 885 } 886 /** 887 Returns current time as a dictionary of keys: hour, minute, second. 888 */ 889 Dictionary getTime(in bool utc = false) const 890 { 891 checkClassBinding!(typeof(this))(); 892 return ptrcall!(Dictionary)(_classBinding.getTime, _godot_object, utc); 893 } 894 /** 895 Returns the current time zone as a dictionary with the keys: bias and name. 896 */ 897 Dictionary getTimeZoneInfo() const 898 { 899 checkClassBinding!(typeof(this))(); 900 return ptrcall!(Dictionary)(_classBinding.getTimeZoneInfo, _godot_object); 901 } 902 /** 903 Returns the current unix epoch timestamp. 904 */ 905 long getUnixTime() const 906 { 907 checkClassBinding!(typeof(this))(); 908 return ptrcall!(long)(_classBinding.getUnixTime, _godot_object); 909 } 910 /** 911 Get a dictionary of time values when given epoch time. 912 Dictionary Time values will be a union of values from $(D getTime) and $(D getDate) dictionaries (with the exception of dst = day light standard time, as it cannot be determined from epoch). 913 */ 914 Dictionary getDatetimeFromUnixTime(in long unix_time_val) const 915 { 916 checkClassBinding!(typeof(this))(); 917 return ptrcall!(Dictionary)(_classBinding.getDatetimeFromUnixTime, _godot_object, unix_time_val); 918 } 919 /** 920 Get an epoch time value from a dictionary of time values. 921 `datetime` must be populated with the following keys: year, month, day, hour, minute, second. 922 You can pass the output from $(D getDatetimeFromUnixTime) directly into this function. Daylight savings time (dst), if present, is ignored. 923 */ 924 long getUnixTimeFromDatetime(in Dictionary datetime) const 925 { 926 checkClassBinding!(typeof(this))(); 927 return ptrcall!(long)(_classBinding.getUnixTimeFromDatetime, _godot_object, datetime); 928 } 929 /** 930 Returns the epoch time of the operating system in seconds. 931 */ 932 long getSystemTimeSecs() const 933 { 934 checkClassBinding!(typeof(this))(); 935 return ptrcall!(long)(_classBinding.getSystemTimeSecs, _godot_object); 936 } 937 /** 938 Sets the game's icon. 939 */ 940 void setIcon(Image icon) 941 { 942 checkClassBinding!(typeof(this))(); 943 ptrcall!(void)(_classBinding.setIcon, _godot_object, icon); 944 } 945 /** 946 947 */ 948 long getExitCode() const 949 { 950 checkClassBinding!(typeof(this))(); 951 return ptrcall!(long)(_classBinding.getExitCode, _godot_object); 952 } 953 /** 954 955 */ 956 void setExitCode(in long code) 957 { 958 checkClassBinding!(typeof(this))(); 959 ptrcall!(void)(_classBinding.setExitCode, _godot_object, code); 960 } 961 /** 962 Delay execution of the current thread by given microseconds. 963 */ 964 void delayUsec(in long usec) const 965 { 966 checkClassBinding!(typeof(this))(); 967 ptrcall!(void)(_classBinding.delayUsec, _godot_object, usec); 968 } 969 /** 970 Delay execution of the current thread by given milliseconds. 971 */ 972 void delayMsec(in long msec) const 973 { 974 checkClassBinding!(typeof(this))(); 975 ptrcall!(void)(_classBinding.delayMsec, _godot_object, msec); 976 } 977 /** 978 Returns the amount of time passed in milliseconds since the engine started. 979 */ 980 long getTicksMsec() const 981 { 982 checkClassBinding!(typeof(this))(); 983 return ptrcall!(long)(_classBinding.getTicksMsec, _godot_object); 984 } 985 /** 986 Returns the amount of time passed in microseconds since the engine started. 987 */ 988 long getTicksUsec() const 989 { 990 checkClassBinding!(typeof(this))(); 991 return ptrcall!(long)(_classBinding.getTicksUsec, _godot_object); 992 } 993 /** 994 995 */ 996 long getSplashTickMsec() const 997 { 998 checkClassBinding!(typeof(this))(); 999 return ptrcall!(long)(_classBinding.getSplashTickMsec, _godot_object); 1000 } 1001 /** 1002 Returns the host OS locale. 1003 */ 1004 String getLocale() const 1005 { 1006 checkClassBinding!(typeof(this))(); 1007 return ptrcall!(String)(_classBinding.getLocale, _godot_object); 1008 } 1009 /** 1010 Returns the current latin keyboard variant as a String. 1011 Possible return values are: "QWERTY", "AZERTY", "QZERTY", "DVORAK", "NEO", "COLEMAK" or "ERROR". 1012 */ 1013 String getLatinKeyboardVariant() const 1014 { 1015 checkClassBinding!(typeof(this))(); 1016 return ptrcall!(String)(_classBinding.getLatinKeyboardVariant, _godot_object); 1017 } 1018 /** 1019 Returns the model name of the current device. 1020 */ 1021 String getModelName() const 1022 { 1023 checkClassBinding!(typeof(this))(); 1024 return ptrcall!(String)(_classBinding.getModelName, _godot_object); 1025 } 1026 /** 1027 Returns `true` if the host OS allows drawing. 1028 */ 1029 bool canDraw() const 1030 { 1031 checkClassBinding!(typeof(this))(); 1032 return ptrcall!(bool)(_classBinding.canDraw, _godot_object); 1033 } 1034 /** 1035 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. 1036 */ 1037 bool isUserfsPersistent() const 1038 { 1039 checkClassBinding!(typeof(this))(); 1040 return ptrcall!(bool)(_classBinding.isUserfsPersistent, _godot_object); 1041 } 1042 /** 1043 Returns `true` if the engine was executed with -v (verbose stdout). 1044 */ 1045 bool isStdoutVerbose() const 1046 { 1047 checkClassBinding!(typeof(this))(); 1048 return ptrcall!(bool)(_classBinding.isStdoutVerbose, _godot_object); 1049 } 1050 /** 1051 Returns `true` if the current host platform is using multiple threads. 1052 */ 1053 bool canUseThreads() const 1054 { 1055 checkClassBinding!(typeof(this))(); 1056 return ptrcall!(bool)(_classBinding.canUseThreads, _godot_object); 1057 } 1058 /** 1059 Returns `true` if the build is a debug build. 1060 Returns `true` when running in the editor. 1061 Returns `false` if the build is a release build. 1062 */ 1063 bool isDebugBuild() const 1064 { 1065 checkClassBinding!(typeof(this))(); 1066 return ptrcall!(bool)(_classBinding.isDebugBuild, _godot_object); 1067 } 1068 /** 1069 Dumps the memory allocation ringlist to a file (only works in debug). 1070 Entry format per line: "Address - Size - Description". 1071 */ 1072 void dumpMemoryToFile(StringArg0)(in StringArg0 file) 1073 { 1074 checkClassBinding!(typeof(this))(); 1075 ptrcall!(void)(_classBinding.dumpMemoryToFile, _godot_object, file); 1076 } 1077 /** 1078 Dumps all used resources to file (only works in debug). 1079 Entry format per line: "Resource Type : Resource Location". 1080 At the end of the file is a statistic of all used Resource Types. 1081 */ 1082 void dumpResourcesToFile(StringArg0)(in StringArg0 file) 1083 { 1084 checkClassBinding!(typeof(this))(); 1085 ptrcall!(void)(_classBinding.dumpResourcesToFile, _godot_object, file); 1086 } 1087 /** 1088 Returns `true` if the platform has a virtual keyboard, `false` otherwise. 1089 */ 1090 bool hasVirtualKeyboard() const 1091 { 1092 checkClassBinding!(typeof(this))(); 1093 return ptrcall!(bool)(_classBinding.hasVirtualKeyboard, _godot_object); 1094 } 1095 /** 1096 Shows the virtual keyboard if the platform has one. The $(I 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). 1097 */ 1098 void showVirtualKeyboard(StringArg0)(in StringArg0 existing_text = "") 1099 { 1100 checkClassBinding!(typeof(this))(); 1101 ptrcall!(void)(_classBinding.showVirtualKeyboard, _godot_object, existing_text); 1102 } 1103 /** 1104 Hides the virtual keyboard if it is shown, does nothing otherwise. 1105 */ 1106 void hideVirtualKeyboard() 1107 { 1108 checkClassBinding!(typeof(this))(); 1109 ptrcall!(void)(_classBinding.hideVirtualKeyboard, _godot_object); 1110 } 1111 /** 1112 Returns the on-screen keyboard's height in pixels. Returns 0 if there is no keyboard or it is currently hidden. 1113 */ 1114 long getVirtualKeyboardHeight() 1115 { 1116 checkClassBinding!(typeof(this))(); 1117 return ptrcall!(long)(_classBinding.getVirtualKeyboardHeight, _godot_object); 1118 } 1119 /** 1120 Shows all resources currently used by the game. 1121 */ 1122 void printResourcesInUse(in bool _short = false) 1123 { 1124 checkClassBinding!(typeof(this))(); 1125 ptrcall!(void)(_classBinding.printResourcesInUse, _godot_object, _short); 1126 } 1127 /** 1128 Shows all resources in the game. Optionally the list can be written to a file. 1129 */ 1130 void printAllResources(StringArg0)(in StringArg0 tofile = "") 1131 { 1132 checkClassBinding!(typeof(this))(); 1133 ptrcall!(void)(_classBinding.printAllResources, _godot_object, tofile); 1134 } 1135 /** 1136 Returns the amount of static memory being used by the program in bytes. 1137 */ 1138 long getStaticMemoryUsage() const 1139 { 1140 checkClassBinding!(typeof(this))(); 1141 return ptrcall!(long)(_classBinding.getStaticMemoryUsage, _godot_object); 1142 } 1143 /** 1144 Returns the max amount of static memory used (only works in debug). 1145 */ 1146 long getStaticMemoryPeakUsage() const 1147 { 1148 checkClassBinding!(typeof(this))(); 1149 return ptrcall!(long)(_classBinding.getStaticMemoryPeakUsage, _godot_object); 1150 } 1151 /** 1152 Returns the total amount of dynamic memory used (only works in debug). 1153 */ 1154 long getDynamicMemoryUsage() const 1155 { 1156 checkClassBinding!(typeof(this))(); 1157 return ptrcall!(long)(_classBinding.getDynamicMemoryUsage, _godot_object); 1158 } 1159 /** 1160 Returns the absolute directory path where user data is written (`user://`). 1161 On Linux, this is `~/.local/share/godot/app_userdata/$(D project_name)`, or `~/.local/share/$(D custom_name)` if `use_custom_user_dir` is set. 1162 On macOS, this is `~/Library/Application Support/Godot/app_userdata/$(D project_name)`, or `~/Library/Application Support/$(D custom_name)` if `use_custom_user_dir` is set. 1163 On Windows, this is `%APPDATA%/Godot/app_userdata/$(D project_name)`, or `%APPDATA%/$(D custom_name)` if `use_custom_user_dir` is set. 1164 If the project name is empty, `user://` falls back to `res://`. 1165 */ 1166 String getUserDataDir() const 1167 { 1168 checkClassBinding!(typeof(this))(); 1169 return ptrcall!(String)(_classBinding.getUserDataDir, _godot_object); 1170 } 1171 /** 1172 Returns the actual path to commonly used folders across different platforms. Available locations are specified in $(D OS.SystemDir). 1173 */ 1174 String getSystemDir(in long dir) const 1175 { 1176 checkClassBinding!(typeof(this))(); 1177 return ptrcall!(String)(_classBinding.getSystemDir, _godot_object, dir); 1178 } 1179 /** 1180 Returns a string that is unique to the device. 1181 Returns empty string on HTML5 and UWP which are not supported yet. 1182 */ 1183 String getUniqueId() const 1184 { 1185 checkClassBinding!(typeof(this))(); 1186 return ptrcall!(String)(_classBinding.getUniqueId, _godot_object); 1187 } 1188 /** 1189 Returns `true` if the "Okay" button should appear on the left and "Cancel" on the right. 1190 */ 1191 bool isOkLeftAndCancelRight() const 1192 { 1193 checkClassBinding!(typeof(this))(); 1194 return ptrcall!(bool)(_classBinding.isOkLeftAndCancelRight, _godot_object); 1195 } 1196 /** 1197 Shows the list of loaded textures sorted by size in memory. 1198 */ 1199 void printAllTexturesBySize() 1200 { 1201 checkClassBinding!(typeof(this))(); 1202 ptrcall!(void)(_classBinding.printAllTexturesBySize, _godot_object); 1203 } 1204 /** 1205 Shows the number of resources loaded by the game of the given types. 1206 */ 1207 void printResourcesByType(in PoolStringArray types) 1208 { 1209 checkClassBinding!(typeof(this))(); 1210 ptrcall!(void)(_classBinding.printResourcesByType, _godot_object, types); 1211 } 1212 /** 1213 Plays native video from the specified path, at the given volume and with audio and subtitle tracks. 1214 Note: This method is only implemented on Android and iOS, and the current Android implementation does not support the `volume`, `audio_track` and `subtitle_track` options. 1215 */ 1216 GodotError nativeVideoPlay(StringArg0, StringArg2, StringArg3)(in StringArg0 path, in double volume, in StringArg2 audio_track, in StringArg3 subtitle_track) 1217 { 1218 checkClassBinding!(typeof(this))(); 1219 return ptrcall!(GodotError)(_classBinding.nativeVideoPlay, _godot_object, path, volume, audio_track, subtitle_track); 1220 } 1221 /** 1222 Returns `true` if native video is playing. 1223 */ 1224 bool nativeVideoIsPlaying() 1225 { 1226 checkClassBinding!(typeof(this))(); 1227 return ptrcall!(bool)(_classBinding.nativeVideoIsPlaying, _godot_object); 1228 } 1229 /** 1230 Stops native video playback. 1231 */ 1232 void nativeVideoStop() 1233 { 1234 checkClassBinding!(typeof(this))(); 1235 ptrcall!(void)(_classBinding.nativeVideoStop, _godot_object); 1236 } 1237 /** 1238 Pauses native video playback. 1239 */ 1240 void nativeVideoPause() 1241 { 1242 checkClassBinding!(typeof(this))(); 1243 ptrcall!(void)(_classBinding.nativeVideoPause, _godot_object); 1244 } 1245 /** 1246 Resumes native video playback. 1247 */ 1248 void nativeVideoUnpause() 1249 { 1250 checkClassBinding!(typeof(this))(); 1251 ptrcall!(void)(_classBinding.nativeVideoUnpause, _godot_object); 1252 } 1253 /** 1254 Returns the given scancode as a string (e.g. Return values: "Escape", "Shift+Escape"). 1255 */ 1256 String getScancodeString(in long code) const 1257 { 1258 checkClassBinding!(typeof(this))(); 1259 return ptrcall!(String)(_classBinding.getScancodeString, _godot_object, code); 1260 } 1261 /** 1262 Returns `true` if the input code has a unicode character. 1263 */ 1264 bool isScancodeUnicode(in long code) const 1265 { 1266 checkClassBinding!(typeof(this))(); 1267 return ptrcall!(bool)(_classBinding.isScancodeUnicode, _godot_object, code); 1268 } 1269 /** 1270 Returns the scancode of the given string (e.g. "Escape") 1271 */ 1272 long findScancodeFromString(StringArg0)(in StringArg0 string) const 1273 { 1274 checkClassBinding!(typeof(this))(); 1275 return ptrcall!(long)(_classBinding.findScancodeFromString, _godot_object, string); 1276 } 1277 /** 1278 Enables backup saves if `enabled` is `true`. 1279 */ 1280 void setUseFileAccessSaveAndSwap(in bool enabled) 1281 { 1282 checkClassBinding!(typeof(this))(); 1283 ptrcall!(void)(_classBinding.setUseFileAccessSaveAndSwap, _godot_object, enabled); 1284 } 1285 /** 1286 Displays a modal dialog box utilizing the host OS. 1287 */ 1288 void alert(StringArg0, StringArg1)(in StringArg0 text, in StringArg1 title = "Alert!") 1289 { 1290 checkClassBinding!(typeof(this))(); 1291 ptrcall!(void)(_classBinding.alert, _godot_object, text, title); 1292 } 1293 /** 1294 Sets the name of the current thread. 1295 */ 1296 GodotError setThreadName(StringArg0)(in StringArg0 name) 1297 { 1298 checkClassBinding!(typeof(this))(); 1299 return ptrcall!(GodotError)(_classBinding.setThreadName, _godot_object, name); 1300 } 1301 /** 1302 1303 */ 1304 void setUseVsync(in bool enable) 1305 { 1306 checkClassBinding!(typeof(this))(); 1307 ptrcall!(void)(_classBinding.setUseVsync, _godot_object, enable); 1308 } 1309 /** 1310 1311 */ 1312 bool isVsyncEnabled() const 1313 { 1314 checkClassBinding!(typeof(this))(); 1315 return ptrcall!(bool)(_classBinding.isVsyncEnabled, _godot_object); 1316 } 1317 /** 1318 Returns `true` if the feature for the given feature tag is supported in the currently running instance, depending on platform, build etc. Can be used to check whether you're currently running a debug build, on a certain platform or arch, etc. See feature tags documentation. 1319 */ 1320 bool hasFeature(StringArg0)(in StringArg0 tag_name) const 1321 { 1322 checkClassBinding!(typeof(this))(); 1323 return ptrcall!(bool)(_classBinding.hasFeature, _godot_object, tag_name); 1324 } 1325 /** 1326 Returns the current state of the device regarding battery and power. See `POWERSTATE_*` constants. 1327 */ 1328 OS.PowerState getPowerState() 1329 { 1330 checkClassBinding!(typeof(this))(); 1331 return ptrcall!(OS.PowerState)(_classBinding.getPowerState, _godot_object); 1332 } 1333 /** 1334 Returns the time in seconds before the device runs out of battery. 1335 */ 1336 long getPowerSecondsLeft() 1337 { 1338 checkClassBinding!(typeof(this))(); 1339 return ptrcall!(long)(_classBinding.getPowerSecondsLeft, _godot_object); 1340 } 1341 /** 1342 Returns the amount of battery left in the device as a percentage. 1343 */ 1344 long getPowerPercentLeft() 1345 { 1346 checkClassBinding!(typeof(this))(); 1347 return ptrcall!(long)(_classBinding.getPowerPercentLeft, _godot_object); 1348 } 1349 /** 1350 The clipboard from the host OS. Might be unavailable on some platforms. 1351 */ 1352 @property String clipboard() 1353 { 1354 return getClipboard(); 1355 } 1356 /// ditto 1357 @property void clipboard(String v) 1358 { 1359 setClipboard(v); 1360 } 1361 /** 1362 The current screen index (starting from 0). 1363 */ 1364 @property long currentScreen() 1365 { 1366 return getCurrentScreen(); 1367 } 1368 /// ditto 1369 @property void currentScreen(long v) 1370 { 1371 setCurrentScreen(v); 1372 } 1373 /** 1374 The exit code passed to the OS when the main loop exits. 1375 */ 1376 @property long exitCode() 1377 { 1378 return getExitCode(); 1379 } 1380 /// ditto 1381 @property void exitCode(long v) 1382 { 1383 setExitCode(v); 1384 } 1385 /** 1386 If `true` vertical synchronization (Vsync) is enabled. 1387 */ 1388 @property bool vsyncEnabled() 1389 { 1390 return isVsyncEnabled(); 1391 } 1392 /// ditto 1393 @property void vsyncEnabled(bool v) 1394 { 1395 setUseVsync(v); 1396 } 1397 /** 1398 If `true` the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile. 1399 */ 1400 @property bool lowProcessorUsageMode() 1401 { 1402 return isInLowProcessorUsageMode(); 1403 } 1404 /// ditto 1405 @property void lowProcessorUsageMode(bool v) 1406 { 1407 setLowProcessorUsageMode(v); 1408 } 1409 /** 1410 If `true` the engine tries to keep the screen on while the game is running. Useful on mobile. 1411 */ 1412 @property bool keepScreenOn() 1413 { 1414 return isKeepScreenOn(); 1415 } 1416 /// ditto 1417 @property void keepScreenOn(bool v) 1418 { 1419 setKeepScreenOn(v); 1420 } 1421 /** 1422 The current screen orientation. 1423 */ 1424 @property OS.ScreenOrientation screenOrientation() 1425 { 1426 return getScreenOrientation(); 1427 } 1428 /// ditto 1429 @property void screenOrientation(long v) 1430 { 1431 setScreenOrientation(v); 1432 } 1433 /** 1434 If `true` removes the window frame. 1435 */ 1436 @property bool windowBorderless() 1437 { 1438 return getBorderlessWindow(); 1439 } 1440 /// ditto 1441 @property void windowBorderless(bool v) 1442 { 1443 setBorderlessWindow(v); 1444 } 1445 /** 1446 1447 */ 1448 @property bool windowPerPixelTransparencyEnabled() 1449 { 1450 return getWindowPerPixelTransparencyEnabled(); 1451 } 1452 /// ditto 1453 @property void windowPerPixelTransparencyEnabled(bool v) 1454 { 1455 setWindowPerPixelTransparencyEnabled(v); 1456 } 1457 /** 1458 If `true` the window is fullscreen. 1459 */ 1460 @property bool windowFullscreen() 1461 { 1462 return isWindowFullscreen(); 1463 } 1464 /// ditto 1465 @property void windowFullscreen(bool v) 1466 { 1467 setWindowFullscreen(v); 1468 } 1469 /** 1470 If `true` the window is maximized. 1471 */ 1472 @property bool windowMaximized() 1473 { 1474 return isWindowMaximized(); 1475 } 1476 /// ditto 1477 @property void windowMaximized(bool v) 1478 { 1479 setWindowMaximized(v); 1480 } 1481 /** 1482 If `true` the window is minimized. 1483 */ 1484 @property bool windowMinimized() 1485 { 1486 return isWindowMinimized(); 1487 } 1488 /// ditto 1489 @property void windowMinimized(bool v) 1490 { 1491 setWindowMinimized(v); 1492 } 1493 /** 1494 If `true`, the window is resizable by the user. 1495 */ 1496 @property bool windowResizable() 1497 { 1498 return isWindowResizable(); 1499 } 1500 /// ditto 1501 @property void windowResizable(bool v) 1502 { 1503 setWindowResizable(v); 1504 } 1505 /** 1506 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. 1507 */ 1508 @property Vector2 windowPosition() 1509 { 1510 return getWindowPosition(); 1511 } 1512 /// ditto 1513 @property void windowPosition(Vector2 v) 1514 { 1515 setWindowPosition(v); 1516 } 1517 /** 1518 The size of the window (without counting window manager decorations). 1519 */ 1520 @property Vector2 windowSize() 1521 { 1522 return getWindowSize(); 1523 } 1524 /// ditto 1525 @property void windowSize(Vector2 v) 1526 { 1527 setWindowSize(v); 1528 } 1529 } 1530 /// Returns: the OSSingleton 1531 @property @nogc nothrow pragma(inline, true) 1532 OSSingleton OS() 1533 { 1534 checkClassBinding!OSSingleton(); 1535 return OSSingleton(OSSingleton._classBinding._singleton); 1536 }