summaryrefslogtreecommitdiff
path: root/core/os/os.h
AgeCommit message (Collapse)Author
2022-02-15Add an `OS.get_processor_name()` methodHugo Locurcio
This method can be used to get the CPU model name. It can be used in conjunction with `RenderingServer.get_video_adapter_name()` and `RenderingServer.get_video_adapter_vendor()` for annotating benchmarks and automatic graphics quality configuration.
2022-02-14[OS/Crypto] Add get_entropy to OS.Fabio Alessandrelli
Implemented via `BCryptGenRandom` on Windows. Implemented via `getentropy` syscall when available. Implemented via `/dev/urandom` device as a fallback. The `/dev/urandom` fallback can be disabled via the `NO_URANDOM` build flag. Note: The HTML5 version relies on emscripten file system urandom device which itself uses the Crypto API when available or the plain old not crypto-safe `Math.random()` otherwise. Restore get_entropy.
2022-02-12Improve compilation speed (forward declarations/includes cleanup)Hendrik Brucker
2022-01-18Replace use of `OS::set_exit_code()` by `SceneTree::quit()` in `EditorNode`Emmanuel Leblond
2022-01-17Merge pull request #56012 from bruvzg/wt🤎4Rémi Verschelde
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-18[Windows] Improve console handling and execute/create_process.bruvzg
Always build with the GUI subsystem. Redirect stdout and stderr output to the parent process console. Use CreateProcessW for blocking `execute` calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with `create_process`). Add `open_console` argument to the `execute` and `create_process` to open a new console window. Remove `interface/editor/hide_console_window` editor setting. Remove `Toggle System Console` menu option. Remove `set_console_visible` and `is_console_visible` functions.
2021-11-19[HTML5] Add WebGL2 (GLES3) support using the OpenGL renderer.Fabio Alessandrelli
Note, the editor build requires the mbedtls module to be manually enabled, as it is currently needed as a ResourceUID dependency. This will need to be addressed in a separate PR.
2021-11-02[OS] Add ThreadWorkPool default size to OS.Fabio Alessandrelli
Some platforms (*cough* web *cough*) have hard limits on the number of threads that can be spawned. Currently, ThreadPoolWork (mostly used in rendering/physics servers) will spawn as many threads as CPUs available causing exception on machines with high CPU count. This commit adds a new overridable method to OS that returns the default thread pool size (still the CPU count by default), and overrides it for the JavaScript platform so it always allocate only one thread. We can likely improve the whole ThreadPoolWork in the future to always allocate X amount of threads, and assign jobs to them on the fly, but that will require some more architectural changes.
2021-11-01[macOS] Add `create_instance` function to spawn editor copies.bruvzg
[macOS] Modify `create_project` function to detect and run app bundles using NSWorkspace to ensure app window is registered and activated correctly.
2021-10-30Add GLES2 2D renderer + Linux display managerlawnjelly
First implementation with Linux display manager. - Add single-threaded mode for EditorResourcePreview (needed for OpenGL). Co-authored-by: clayjohn <claynjohn@gmail.com> Co-authored-by: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
2021-10-28Update Time documentationAaron Franke
2021-10-14Implement toast notifications in the editorGilles Roudière
2021-09-30Merge pull request #48685 from bruvzg/bundle_icon_4Rémi Verschelde
2021-09-16Implement `OS::get_locale_language()` helper methodRémi Verschelde
This method extracts the 2 or 3-letter language code from `OS::get_locale()`, making it easier for users to identify the "main" language code for users that might have different OS locales due to different OS or region, but should be matched to the same translation (e.g. "generic" Spanish). Fixes #40703.
2021-09-15--single-window is passed through project manager.Jacob Edie
This means you can start godot with --single-window
2021-08-16Add partial support for Android scoped storage.ne0fhyk
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30. In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
2021-08-03[Headless] Add --headless switch (no rendering, no audio).Fabio Alessandrelli
Also remove now unused "--no-window" option, and relative OS getter and setter.
2021-07-22Move `alert` function from `DisplayServer` to `OS`.bruvzg
2021-07-06Restructure and reimplement vsync optionsHendrik Brucker
-Add a v-sync mode setting which allows to choose between DISABLED, ON, ADAPTIVE and MAILBOX -Removed the V-Sync via Compositor option
2021-06-11Add Time singletonAaron Franke
2021-06-10Add OS.get_external_data_dir() to get Android external directoryMarcel Admiraal
2021-05-13[macOS] Prefer .app bundle icon over the default one.bruvzg
2021-04-06Add flag to stop printing to stdout/stderrGeorge Marques
This allows the terminal output to be suppressed but still be captured by print/error handlers.
2021-02-25Remove GDScript bindings for OS.get/set_exit_code, ↵Emmanuel Leblond
SceneTree.quit(<exit_code>) should be used instead
2021-02-25Fix Godot returned status code on unexpected errorEmmanuel Leblond
2021-02-18Move tablet driver API from OS to DisplayServer.bruvzg
2021-01-09Split OS::execute into two methodsMarcel Admiraal
1. execute(): Executes a command and returns the results. 2. create_process(): Creates a new process and returns the new process' id.
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-09Static analyzer fixes:bruvzg
Removes unused code in OS. Fixes return types. Fixes few typos.
2020-11-16Remove empty lines around braces with the formatting scriptAaron Franke
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-09-24OS: Remove unused get_splash_tick_msecRémi Verschelde
It was added in 3e20391bf607dc7c452b056854aed4a8c99ba0f6 but it doesn't seem particularly useful, and it was only implemented for the custom splash branch and not the default one, so it could return an uninitialized int.
2020-09-02Register GDScript test tools as test commands to run via command-lineAndrii Doroshenko (Xrayez)
2020-07-09Keep debug & verbose options after loading project from project managerPouleyKetchoupp
2020-06-30Move frame delaying functions from Main to OS.Fabio Alessandrelli
Will allow specific platforms to override it and avoid blocking on the main/GUI thread.
2020-05-31Remove OS.get_system_time_secs/get_system_time_msecs and change ↵Emmanuel Leblond
OS.get_unix_time return type to double
2020-05-20[Windows] Add tablet driver selection.bruvzg
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-05-05[Windows] Add support for the WinTab API for pen input.bruvzg
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-26Add macOS DisplayServer implementation.bruvzg
Change global menu to use Callable, add support for check items and submenus.
2020-03-26Separate DisplayServer from OS on WindowsJuan Linietsky
2020-03-26Effective DisplayServer separation, rename X11 -> LinuxBSDJuan Linietsky
2020-03-25Style: Harmonize header guards to style guide [Core]Rémi Verschelde
2020-02-26Reimplement Mutex with C++'s <mutex>Pedro J. Estébanez
Main: - It's now implemented thanks to `<mutex>`. No more platform-specific implementations. - `BinaryMutex` (non-recursive) is added, as an alternative for special cases. - Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes. - Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts. - A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this. - `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`. - Thread-safe utilities are therefore simpler now. Misc.: - `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same. - Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock). - `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-18PoolVector is gone, replaced by VectorJuan Linietsky
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
2020-02-14Remove incomplete battery status/power APIRémi Verschelde
It was initially implemented in #5871 for Godot 3.0, but never really completed or thoroughly tested for most platforms. It then stayed in limbo and nobody seems really keen to finish it, so it's better to remove it in 4.0, and re-add eventually (possibly with a different API) if there's demand and an implementation confirmed working on all platforms. Closes #8770.
2020-02-11Add runtime GLES2 / Vulkan context selection.bruvzg