Commit graph

168 commits

Author SHA1 Message Date
Marcelo Fernandez ea1d726a46 Added OS::center_window to center the window precisely on desktop platforms 2018-02-12 15:45:41 -03:00
Pedro J. Estébanez ee2c31d306 Add new window setting: always on top
Implemented for Windows and Linux.
2018-01-05 21:31:04 +01:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Emmanuel Leblond e315c94900 Change OS::initialize signature to return Error (fix segfault on x11) 2018-01-04 15:15:55 +01:00
Rémi Verschelde 6322b0bbb7
Merge pull request #12814 from guilhermefelipecgs/add_hardware_custom_cursor
Custom hardware-accelerated mouse cursor
2018-01-03 08:35:59 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Guilherme Silva a392dbdbe3 Add implementation for custom hardware cursor 2017-12-17 13:40:29 -02:00
Juan Linietsky 652c98a7be Add epic hack so vsync can be toggled in run-time from script. Fixes #14458.
Call needs to be routed via visual server to reach the proper thread.
2017-12-16 17:11:02 -03:00
Ruslan Mustakov 9d6d20e67c Remove get_stack_bottom
It's not used in godot-nim any longer and there were no other uses for
it.
2017-12-16 13:10:26 +07:00
Rémi Verschelde fb84b49d87 Fix type mismatch in OS::set_borderless_window
Closes #14663.
2017-12-14 19:16:20 +01:00
Juan Linietsky f3ad14224e -Add lightmapper
-Fixes to unwrapper (remove degenerates), makes Thekla not crash
-Added optional cancel button in EditorProgress
-Added function to force processing of events (needed for cancel button)
2017-12-14 09:01:27 -03:00
Stefano Bonicatti c067cf2c6a Fixes vsync setting ignored when using a separate thread for rendering
Setting the vsync in the main thread, after the rendering thread starts
and takes the OpenGL context fails, so we need to do that before.
Also, for some reason, the main thread cannot make current the context
anymore.

Fixes #13447
2017-12-09 01:43:23 +01:00
Rémi Verschelde d5ca9e2f6f Style: Apply clang-format again on all files
Fixes issues introduced by newer clang-format versions or commits
pushed directly without using the clang-format pre-commit hook.
2017-12-07 08:02:00 +01:00
Juan Linietsky 9678231b10 Changed the dynamic library open function to allow setting the path of the library to open extra libraries. 2017-11-30 10:00:55 -03:00
Rémi Verschelde af9c67db0c Allow customizing user:// path (folder in OS::get_data_path())
This allows to specify any valid folder name (including with subfolders) to use
as user:// on all platforms. The folder is constrained to the platform-specific
OS::get_data_path() (typically what `XDG_DATA_HOME` resolves to).

Fixes #13236.
2017-11-26 19:02:32 +01:00
Juan Linietsky 62d86b1588 Modified low processor sleep to 8000 and made it customizable (should be customizable for editor too) 2017-11-22 14:41:45 -03:00
Ruslan Mustakov d42c5646a5 Return and repair file logging
And make it configurable, too.
2017-11-21 16:43:44 +07:00
Rémi Verschelde 450bdda97a
Merge pull request #12387 from santouits/x1111
Fix x11 boot logo position in fullscreen and in maximized
2017-11-20 15:48:08 +01:00
Rémi Verschelde 32c12a92a5 Add initial support for the XDG Base Directory spec
Spec version 0.7 from https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
(latest as of this commit).

Three virtual methods are added to OS for the various XDG paths we will use:
- OS::get_data_path gives XDG_DATA_HOME, or if missing:
  ~/.local/share on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_config_path gives XDG_CONFIG_HOME, or if missing:
  ~/.config on X11, ~/Library/Application Support/ on macOS and %APPDATA% on Windows
- OS::get_cache_path gives XDG_CACHE_HOME, or if missing:
  ~/.cache on X11, ~/Library/Caches on macOS and %APPDATA% on Windows

So for Windows there are no changes, for Linux we follow the full split spec
and for macOS stuff will move from ~/.godot to ~/Library/Application Support/Godot.

Support for system-wide installation of templates on Unix was removed for now,
as it's a bit hackish and I don't think anyone uses it.

user:// will still be OS::get_data_path() + "/godot/app_userdata/$name" by
default, but when using the application/config/use_shared_user_dir option
it will now use XDG_DATA_HOME/$name, e.g. ~/.local/share/MyGame.

For now everything still goes in EditorSettings::get_settings_dir(), but
this will be changed in a later commit to make use of the new splitting
where relevant.

Part of #3513.
2017-11-19 20:54:24 +01:00
Rémi Verschelde 73049d115e Rename OS::get_data_dir to OS::get_user_data_dir
Will be needed to avoid confusion with system data path (XDG_DATA_HOME)
and editor data dir in upcoming refactoring.
2017-11-17 20:55:09 +01:00
Rémi Verschelde ed57f0a0d4 Remove get_default_video_mode definition on OSX/iOS
It had been missed in d09160a8b6 and broke compilation
for those platforms.

Took the opportunity to run clang-format on the code base to fix some corner cases
that went through our static tests/were overlooked recently.
2017-11-09 23:36:08 +01:00
Juan Linietsky d09160a8b6 Make video mode initialization more intuitive, fixes #12022 2017-11-09 13:02:26 -03:00
N0hbdy f3fc07272c Add Colemak keybindings to editor for osx 2017-10-30 22:51:02 +01:00
santouits 55fae24710 Fix x11 boot logo position in fullscreen and in maximized 2017-10-26 01:06:26 +03:00
Rémi Verschelde e8b9cca614 Merge pull request #11810 from marcelofg55/osx_export_improv
OS X export code improvements
2017-10-09 12:20:39 +02:00
Gilles Roudiere 5b9b158354 Merge pull request #11823 from endragor/virtual-keyboard-height
Allow to obtain virtual keyboard height
2017-10-04 18:16:28 +02:00
Ruslan Mustakov 275e537058 Allow to obtain virtual keyboard height
On mobile platforms virtual keyboards take up significant amount of
screen space and UI containing a text box may need to be adjusted
after the keyboard appears to keep the text box visible to user. This
commit adds a way to obtain virtual keyabord height so that controls
are aware of how much they need to move.
2017-10-04 17:21:05 +07:00
Juan Linietsky 3cadecf17b fixed the OS.has_feature() API, and added support for 32 and 64. 2017-10-03 17:36:14 -03:00
Marcelo Fernandez 4b695c3bdf OS::execute can now read from stderr too when executing with a pipe 2017-10-03 15:09:04 -03:00
Hein-Pieter van Braam 2bece6bbd3 Merge pull request #11782 from eska014/persistent-userfs-test
Add OS::is_userfs_persistent, allow starting HTML5 platform in private mode
2017-10-03 12:24:11 +02:00
Andreas Haas 132ba0ed97 Merge pull request #11568 from endragor/loggers
Extract logging logic
2017-10-02 23:51:26 +02:00
Leon Krause 7b23665e72 Add OS::is_userfs_persistent to check user:// persistence
Allows starting HTML5 export when IndexedDB is not available.
2017-10-02 21:07:05 +02:00
Marcelo Fernandez 20918587d3 FileSystemDock will now remove files/dirs to trashcan using OS::move_to_trash 2017-09-25 21:49:01 -03:00
Ruslan Mustakov 1a2311e350 Extract logging logic
Previously logging logic was scattered over OS class implementations
with plenty of duplication. Major changes in this commit:

 - Extracted logging logic into a separate Logger hierarchy. It allows
   easy configuration of logging mechanism depending on compile-time or
   run-time configuration.

 - Implemented RotatedFileLogger which is usually used with StdLogger,
   providing persistency of logs. It is often important to be able to
   obtain logs of the game even in production to be able to understand
   what happened prior to some problem. On mobile there previously was
   no way to obtain the logs aside from having the device connected to
   your machine.

 - flush() is not performed in release mode for every logged line. It
   is only performed for errors.
2017-09-25 16:19:21 +07:00
letheed 5ad9be4c24 Rename pos to position in user facing methods and variables
Rename user facing methods and variables as well as the corresponding
C++ methods according to the folloming changes:

* pos -> position
* rot -> rotation
* loc -> location

C++ variables are left as is.
2017-09-20 13:11:10 +02:00
Thomas Herzog 7dffed485b Merge pull request #11230 from maxim-sheronov/fix_enum_bindings
Fix enums bindings
2017-09-15 08:43:35 +02:00
Maxim Sheronov 0fffa45158 Fix enums bindings
Add missed bindings for enums
Move some enums to class to have correct output of api.json
2017-09-13 20:57:07 +03:00
Marcelo Fernandez 83fe937362 Added a crash handler to dump the backtrace on Windows, Linux and OS X 2017-09-13 10:07:23 -03:00
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Marcelo Fernandez 63f847b306 p_screen param from get_screen_* funcs now default to the current screen 2017-08-21 18:28:29 -03:00
bruvzg 8aa86cb9bc Implement NSTextInputClient protocol for IME 2017-08-09 19:09:33 +03:00
Indah Sylvia 5ae78fdf6a Makes all Godot API's methods Lower Case 2017-08-07 18:24:35 +07:00
Karroffel 135c2112ad added an optional parameter to OS symbol lookup
When looking up a symbol from a library, previously an error was
shown when the symbol did not exist. That caused confusion when the
lookup was completely optional.
This adds a new parameter to that method so that those errors can
be handled manually if needed.
2017-07-27 11:13:21 +02:00
Ruslan Mustakov 3b88476130 Add a way to retrieve stack bottom of the main thread
I'm working on Nim bindings and Nim GC needs to know the stack
boundaries to check whether certain pointers are located on the stack
or in the heap. This commit adds godot_get_stack_bottom procedure
to gdnative module which returns pointer to the stack bottom of the
main thread. Later on this may be improved to return stack bottom of
the current thread.
2017-07-25 10:53:31 +07:00
Juan Linietsky 25678b1876 -Renamed GlobalConfig to ProjectSettings, makes more sense.
-Added system for feature overrides, it's pretty cool :)
2017-07-19 17:06:03 -03:00
geequlim 7358766ff6 IME window follow the input cursor.
Abstruct set_ime_position to OS class.
Update ime position for LineEdit and TextEdit.
2017-07-11 18:36:20 +08:00
Karroffel 6bda2876f1 fixed PowerState enum cast
Quite a while ago I made a commit (131631b) where I did a weird
thing to fix compilation with PTRCALL_ENABLED. And I couldn't
sleep because of this after all these months. So here is the
proper version.
2017-06-01 00:16:33 +02:00
Juan Linietsky 98a3296702 Removal of Image from Variant, converted to a Resource. 2017-05-17 07:37:45 -03:00
Sergey Pusnei 8589ca3903 Rename [gs]et_pos to [gs]et_position for Controls
Control set_pos -> set_position
Control set_global_pos -> set_global_position
[gs]et_mouse_pos -> [gs]et_mouse_position
[gs]et_global_mouse_pos -> [gs]et_global_mouse_position
fixes #8005
2017-04-10 08:27:34 +02:00
Rémi Verschelde df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Karroffel fd55308786 added dlscript module
This module was written by bojidar-bg and me, with the help of ClikCode and touilleMan.

This adds a module to Godot that enables the use of dynamic libraries as a source for scripts.
That also allows third party libraries to be linked to Godot more easily and without creating modules.

For a readme see https://github.com/GodotNativeTools/godot_headers/blob/master/README.md
2017-04-03 17:20:11 +02:00
Karroffel 2281942fb3 Added methods for opening dynamic libraries to OS 2017-03-29 23:05:15 +02:00
Rémi Verschelde 5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Julian Murgia 94103c0c02 Add API to access battery power state
Done:
- X11, server (tested)
- Windows (developed, would be nice to retest)
- OSX (not tested)
Prepared (not developed):
- Android (code is here, but may not compile)
- iphone
- winrt
- bb10
- haiku
- javascript
2017-03-04 18:04:29 +01:00
Juan Linietsky 6f2e16306a Several bugfixes, improving the import workflow 2017-02-06 00:38:39 -03:00
Ilija Boshkov 1005a56e5a Added focus tracking in X11 and Windows classes, added new confined mouse mode (#7162) 2017-01-25 19:21:41 +01:00
Rémi Verschelde d2aae675e9 Replace Engine version API by preexisting OS one
It outputs a single Dictionary with all relevant information as
keys, that will less bloat the documentation and provide all details
in one function call.
2017-01-13 18:25:49 +01:00
Juan Linietsky e53c247cb1 Created new Engine singleton, and moved engine related OS functions to it. 2017-01-13 12:51:14 -03:00
Rémi Verschelde 3f3f5a5359 Merge remote-tracking branch 'origin/gles3' into gles3-on-master
Various merge conflicts have been fixed manually and some mistakes
might have been made - time will tell :)
2017-01-02 21:52:26 +01:00
Rémi Verschelde c7bc44d5ad Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!
2017-01-01 22:03:33 +01:00
ISylvox b5c383fd61 vsnc --> vsync 2016-11-08 21:06:57 +07:00
Juan Linietsky 1527cf8c0d 2D Shaders are working again using the new syntax, though all is buggy in general 2016-10-10 18:31:01 -03:00
Pedro J. Estébanez 66dac878ac Improve debug focus behavior
Fix focusing debugged game on Windows
Add re-focusing editor on continue
2016-09-14 04:02:18 +02:00
Juan Linietsky 5b96c3a552 -Modified Input and added is_action_just_pressed() as well as is_action_just_released() 2016-09-01 18:59:46 -03:00
Rémi Verschelde d723e5a62f Merge pull request #5560 from vnen/os-request-attention
Add OS.request_attention() for Windows
2016-07-21 17:29:45 +02:00
Rémi Verschelde b2953bc1cc OS: Add get_engine_version method
Fixes #5693.
2016-07-18 00:54:56 +02:00
George Marques 5c355a63d3
Add OS.request_attention() for Windows 2016-07-05 12:29:08 -03:00
Juan Linietsky 2420e46b44 vsync support
-works on windows
-may not work on X11, if so please fix
-OSX does not seem to support disabling vsync
2016-06-05 19:14:33 -03:00
volzhs 9073dc9963 change invalid characters when get user data dir on Windows & Unix
Can't create user data folder when project name has ``\ / : * ? " < > |`` characters on OS_Windows & OS_Unix.
So, change it to ``-`` to be able to make folder.

fixes #4928 and it's altanative to #4986.
2016-06-03 03:39:37 +09:00
Juan Linietsky 9b1f8230ec -Some fixes to OSX retina scaling for window functions
-Implemented HiDPI detection and support for Godot Editor!
2016-05-30 00:28:29 -03:00
Juan Linietsky 4f100f92d8 DPI Detection support
Windows only for now.
Many builds may break (older visual studio, mingw32)
2016-05-29 13:40:21 -03:00
Kyle Luce feef563f3f Fixes the month consistency issue in enums and get_date etc
- Also updated the docs to reflect this.
- Added some vim temp files to gitignore
- Changed NaCL to be consistent with the other OS_Unix::get_date implementation
   (added 1 to month to map to 1-12)

Ticket:
https://github.com/godotengine/godot/issues/4025
2016-03-13 15:27:39 -07:00
Saracen 6eb4812317 Borderless window support for the Win32 build. Default window position is now also centred. 2016-03-12 16:38:12 +00:00
Hubert Jarosz 4a4f247914
remove trailing whitespace 2016-03-09 00:00:52 +01:00
Aren Villanueva 7b25641813 Reject any native video player calls on iOS that point to files within .pck archives.
Fix the paths for both res:// and user:// specified video files.
2016-02-19 16:05:49 +11:00
Rémi Verschelde c0aade4ba4 Merge pull request #3493 from Hinsbart/wm_class
x11: use different strings for WM_CLASS depending on context
2016-02-03 11:30:22 +01:00
Juan Linietsky f6a8a0f513 -Correctly flip BG texture if viewport is flipped, fixes #3507 2016-02-02 07:40:38 -03:00
hondres 11e4c128ac x11: use different strings for WM_CLASS depending on context 2016-01-27 21:53:37 +01:00
George Marques f4a39692b9 Change default window size for desktop
Fix #3149
2016-01-24 17:52:33 -02:00
volzhs fb2bf78591 Add ability to set "keep screen on" for android 2016-01-16 20:57:34 +09:00
punto- 7393e40452 Merge pull request #3272 from Hinsbart/joy-binding
Add some joystick functions to input. Enables manipulation of mapping…
2016-01-12 03:59:19 -03:00
Juan Linietsky a120c66f98 -Removed OS.get_system_time_msec(), this is undoable on Windows and also unusable from GDscript due to precision.
-Added, instead an OS.get_system_time_secs(), which is 32 bits friendly, fixes #3143
2016-01-10 18:24:55 -03:00
hondres c632c13c66 Add some joystick functions to input. Enables manipulation of mappings at runtime 2016-01-08 00:40:41 +01:00
George Marques 5be9ff7b67 Update copyright to 2016 in headers 2016-01-01 11:50:53 -02:00
Juan Linietsky cc7880fba5 -added windowed mode with -w, fixes #3020
-changed default windowed resolution to 1280x720
2015-12-12 12:06:53 -03:00
est31 e1d02e4831 Make the setting unix-only.
For this, put the detection into the OS class and its subclass.
2015-11-30 02:35:59 +01:00
Juan Linietsky 79e5ced7e6 -A little More control about pixel snapping in 2D 2015-10-13 15:53:34 -03:00
Juan Linietsky cf57a654d7 new editor settings customization of where to run the game from the editor 2015-08-30 23:36:46 -03:00
Maximillian 6f9a084ac8 Add OS.get_system_time_msec 2015-08-06 10:29:33 -07:00
est31 c5338fd6c4 Add OS.get_time_zone_info function
The returned dictionary maps "name" to the
name of the current time zone, and "bias" to
a bias from UTC in minutes.
2015-06-06 05:57:33 +02:00
est31 803069886e Add utc param to get_time and get_date methods
If utc == false, we return the local time, like before.
Otherwise, we return UTC time.
utc defaults to false to not break behaviour.
2015-06-06 05:55:28 +02:00
Juan Linietsky fdaa2920eb Updated copyright year in all headers 2015-04-18 14:38:54 -03:00
Juan Linietsky 3e20391bf6 -Changed bootsplash option to use a file, fixes #1539
-Added OS.get_splash_tick_msec() to query when splash appeared
2015-04-12 17:55:01 -03:00
Juan Linietsky 23e13ce3c2 fixes to new window management API
-needs testing on Linux
-needs testing on Windows
-NEED SOMEONE TO IMPLEMENT IT ON OSX!! PLEASE HELP!
2015-03-22 19:00:50 -03:00
hurikhan f5d2e1f42c Renamed EXPERIMENTAL_WM_API to NEW_WM_API 2015-02-15 18:26:49 +08:00
hurikhan 716971655e added the following methods:
* set_minimized(bool)
 * bool is_minimized()
 * set_maximized(bool)
 * bool is_maximized()
2015-01-17 00:18:45 +09:00
hurikhan d269344bbd WIP -- set_resizable() + is_resizable added 2015-01-15 22:50:23 +09:00
hurikhan 790d8ecbb9 get_screen() + set_screen() added 2015-01-14 12:02:59 +08:00
hurikhan ce7c7a862e get_screen_position() added 2015-01-13 17:25:50 +08:00
hurikhan c0d3632667 introduced the scons experimental_wm_api switch:
================================================

Usage:
    scons p=x11 experimental_wm_api=yes
2015-01-13 15:44:39 +08:00