Operating System functions.
Operating System functions. OS Wraps the most common functionality to communicate with the host Operating System, such as: mouse grabbing, mouse cursors, clipboard, video mode, date and time, timers, environment variables, execution of binaries, command line, etc.
Displays a modal dialog box utilizing the host OS.
Returns [code]true[/code] if the host OS allows drawing.
Returns [code]true[/code] if the current host platform is using multiple threads.
Delay executing of the current thread by given milliseconds.
Delay executing of the current thread by given microseconds.
Dumps the memory allocation ringlist to a file (only works in debug).
Entry format per line: "Address - Size - Description"
Dumps all used resources to file (only works in debug).
Entry format per line: "Resource Type : Resource Location"
At the end of the file is a statistic of all used Resource Types.
Execute the binary file in given path, optionally blocking until it returns. A process ID is returned.
Returns the scancode of the given string (e.g. "Escape")
Returns the command line arguments passed to the engine.
Returns current date as a dictionary of keys: year, month, day, weekday, dst (daylight savings time).
Returns current datetime as a dictionary of keys: year, month, day, weekday, dst (daylight savings time), hour, minute, second.
Get a dictionary of time values when given epoch time.
Dictionary Time values will be a union of values from [method get_time] and [method get_date] dictionaries (with the exception of dst = day light standard time, as it cannot be determined from epoch).
Returns the total amount of dynamic memory used (only works in debug).
Returns an environment variable.
Returns the path to the current engine executable.
Returns the current latin keyboard variant as a String.
Possible return values are: "QWERTY", "AZERTY", "QZERTY", "DVORAK", "NEO", "COLEMAK" or "ERROR".
Returns the host OS locale.
Returns the model name of the current device.
Returns the name of the host OS. Possible values are: "Android", "Haiku", "iOS", "HTML5", "OSX", "Server", "Windows", "UWP", "X11".
Returns the amount of battery left in the device as a percentage.
Returns the time in seconds before the device runs out of battery.
Returns the current state of the device regarding battery and power. See [code]POWERSTATE_*[/code] constants.
Returns the game process ID
Returns the number of cores available in the host machine.
Returns the given scancode as a string (e.g. Return values: "Escape", "Shift+Escape").
Returns the number of displays attached to the host machine.
Returns the dots per inch density of the specified screen.
On Android Devices, the actual screen densities are grouped into six generalized densities:
ldpi - 120 dpi
mdpi - 160 dpi
hdpi - 240 dpi
xhdpi - 320 dpi
xxhdpi - 480 dpi
xxxhdpi - 640 dpi
Returns the position of the specified screen by index. If no screen index is provided, the current screen will be used.
Returns the dimensions in pixels of the specified screen.
Returns the max amount of static memory used (only works in debug).
Returns the amount of static memory being used by the program in bytes.
Returns the actual path to commonly used folders across different platforms. Available locations are specified in [OS.SystemDir].
Returns the epoch time of the operating system in seconds.
Returns the amount of time passed in milliseconds since the engine started.
Returns current time as a dictionary of keys: hour, minute, second.
Returns the current time zone as a dictionary with the keys: bias and name.
Returns a string that is unique to the device. Currently only works on Android and iOS. Returns empty string on other platforms.
Return the current unix timestamp.
Get an epoch time value from a dictionary of time values.
[code]datetime[/code] must be populated with the following keys: year, month, day, hour, minute, second.
You can pass the output from [method get_datetime_from_unix_time] directly into this function. Daylight savings time (dst), if present, is ignored.
Returns the absolute directory path where user data is written ([code]user://[/code]).
Returns [code]true[/code] if an environment variable exists.
Returns [code]true[/code] if the device has a touchscreen or emulates one.
Returns [code]true[/code] if the platform has a virtual keyboard, [code]false[/code] otherwise.
Hides the virtual keyboard if it is shown, does nothing otherwise.
Returns [code]true[/code] if the build is a debug build.
Returns [code]true[/code] when running in the editor.
Returns [code]false[/code] if the build is a release build.
Returns [code]true[/code] if the "Okay" button should appear on the left and "Cancel" on the right.
Returns [code]true[/code] if the input code has a unicode character.
Returns [code]true[/code] if the engine was executed with -v (verbose stdout).
If [code]true[/code], the [code]user://[/code] 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.
Kill a process ID (this method can be used to kill processes that were not spawned by the game).
Returns [code]true[/code] if native video is playing.
Pauses native video playback.
Plays native video from the specified path, at the given volume and with audio and subtitle tracks.
Stops native video playback.
Resumes native video playback.
Shows all resources in the game. Optionally the list can be written to a file.
Shows the list of loaded textures sorted by size in memory.
Shows the number of resources loaded by the game of the given types.
Shows all resources currently used by the game.
Request the user attention to the window. It'll flash the taskbar button on Windows or bounce the dock icon on OSX.
Sets the game's icon.
Sets the name of the current thread.
Enables backup saves if [code]enabled[/code] is [code]true[/code].
Sets the window title to the specified string.
Requests the OS to open a resource with the most appropriate program. For example.
[code]OS.shell_open("C:\\Users\name\Downloads")[/code] on Windows opens the file explorer at the downloads folders of the user.
[code]OS.shell_open("http://godotengine.org")[/code] opens the default web browser on the official Godot website.
Shows the virtual keyboard if the platform has one. The [i]existing_text[/i] 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).
The clipboard from the host OS. Might be unavailable on some platforms.
The current screen index (starting from 0).
The current screen orientation.
If [code]true[/code], removes the window frame.
If [code]true[/code], the window is fullscreen.
If [code]true[/code], the window is maximized.
If [code]true[/code], the window is minimized.
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.
If [code]true[/code], the window is resizable by the user.
The size of the window (without counting window manager decorations).