Commit graph

375 commits

Author SHA1 Message Date
Marcin Zawiejski ca1c851dbd Try closing gracefully before terminating process
Use a Microsoft recommended way of process termination for the project
process run from the editor. This allows loaded DLLs to receive and handle
DLL_PROCESS_DETACH notification and cleanup any global state before the
process actually exits.
2018-08-20 22:41:06 +02:00
Aaron Franke cf136a91d6 [Core] Completely kill math_2d.h, change includes 2018-08-11 03:08:34 -05:00
Juan Linietsky ea3d997f9d
Revert "added get_creation_time function for gdscript" 2018-08-10 13:29:49 -03:00
Juan Linietsky 275e0d5ee4
Merge pull request #18914 from notwarp/master
added get_creation_time function for gdscript
2018-08-10 13:28:47 -03:00
Marcelo Fernandez 05fc12ddb6 Add OS::open_midi_inputs and OS::close_midi_inputs 2018-08-04 10:07:46 -03:00
Unknown 7fbb826422 Fix #20564 HDR import fail
Token has extra "0" at the end so it fail condition checking.
2018-07-31 21:34:44 +07:00
Rémi Verschelde 4e4702e386
Merge pull request #20464 from Calinou/add-editor-standalone-feature-tags
Add "editor" and "standalone" feature tags
2018-07-28 10:49:27 +02:00
Rémi Verschelde e6aec27428
Merge pull request #20511 from maksloboda/InputEventActionFix
Fixed shortcuts not working with InputEventActions
2018-07-28 09:48:44 +02:00
Max c2be1a75a0 Fixed shortcuts not working with InputEventActions 2018-07-27 15:09:41 +03:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Hugo Locurcio 0254a40817
Add "editor" and "standalone" feature tags
These feature tags can be used to check whether the project was
started from an editor binary or from an export template binary.
2018-07-25 23:27:50 +02:00
Marcelo Fernandez 7a5f9fc08e Added a new MIDIDriver class 2018-07-21 09:09:42 -03:00
Rémi Verschelde 8c9e10553c Fix build issues and typos after c69de2ba4 2018-07-20 08:37:10 +02:00
volzhs 515c848ba8 Fix unwanted restarting 2018-07-20 10:41:32 +09:00
Juan Linietsky c69de2ba46 -Project/Editor settings now use new inspector
-Project/Editor settings now show tooltips properly
-Settings thar require restart now will show a restart warning
-Video driver is now visible all the time, can be changed easily
-Added function to request current video driver
2018-07-19 19:02:04 -03:00
matthew1006 25e64ffa20 Fixed OS.has_feature not using custom feature tags. 2018-07-18 09:22:59 +01:00
unknown 9cc41a59ac Added support for extra mouse buttons. 2018-07-09 14:34:19 +03:00
Marcelo Fernandez deebeb2742 Add a new notification to detect crashes on native scripts 2018-07-02 16:18:58 -03:00
Saracen c5bdb5b1d8 IME context detection. 2018-06-11 17:22:11 +01:00
Daniele Giuliani d315b0fb8a added get_creation_time function for gdscript 2018-05-16 00:50:57 +02:00
Hein-Pieter van Braam e668757aa9
Merge pull request #14622 from bruvzg/non-rectangular-windows
Experimental support for windows with per-pixel transparency.
2018-05-08 16:44:35 +02:00
Blazej Floch c45f44d856 Local debugger fixes and extensions
- Adds q/quit option to console debugging
- Adds options (variable_prefix)
- Breaks into debugger with Ctrl-C in local debug mode (Unix/Windows)
- Added option to list all breakpoints
- Fixes add/remove breakpoint bug (invalid path parsing)
- Minor cleanup
2018-05-07 23:17:06 -04:00
Rémi Verschelde 18c28c159d
Merge pull request #17196 from RandomShaper/improve-gui-touch
Implement universal translation of touch to mouse (3.1)
2018-05-02 10:47:49 +02:00
Pedro J. Estébanez de9d40a953 Implement universal translation of touch to mouse
Now generating mouse events from touch is optional (on by default) and it's performed by `InputDefault` instead of having each OS abstraction doing it. (*)

The translation algorithm waits for a touch index to be pressed and tracks it translating its events to mouse events until it is raised, while ignoring other pointers.

Furthermore, to avoid an stuck "touch mouse", since not all platforms may report touches raised when the window is unfocused, it checks if touches are still down by the time it's focused again and if so it resets the state of the emulated mouse.

*: In the case of Windows, since it already provides touch-to-mouse translation by itself, "echo" mouse events are filtered out to have it working like the rest.

On X11 a little hack has been needed to avoid a case of a spurious mouse motion event that is generated during touch interaction.

Plus: Improve/fix tracking of current mouse position.

** Summary of changes to settings: **

- `display/window/handheld/emulate_touchscreen` becomes `input/pointing_devices/emulate_touch_from_mouse`
- New setting: `input/pointing_devices/emulate_mouse_from_touch`
2018-04-30 19:03:38 +02:00
groud 0aa8b35ee6 Fixing input strength and the impossibility to erase action events 2018-04-25 22:32:09 +02:00
Gilles Roudiere 7e89dc432c Fixes left/up axis not mappable as actions 2018-04-18 21:38:52 +02:00
Juan Linietsky 1a3688d0cc
Merge pull request #16902 from groud/analog_action_system
Allow actions to provide an analog value
2018-04-18 07:21:29 -03:00
Gilles Roudiere ebfa731012 Allow actions to provide an analog value 2018-04-16 23:20:43 +02:00
Ruslan Mustakov 1d9a3a9b1c iPhone X support and iOS-related fixes
Starting from April 2018 Apple no longer accepts apps that do not
support iPhone X. For games this mainly means respecting the safe area,
unobstructed by notch and virtual home button. UI controls must be
placed within the safe area so that users can interact with them.

This commit:

- Adds OS::get_window_safe_area method that returns unobscured area of
  the window, where interactive controls should be rendered.

- Reorganizes how launch screens are exported - the previous way was
  incorrect and modern iPhones did not pick up the correct screens and
  because of that used a non-native resolution to render the game.

- Adds launch screen options for iPhone X.

- Makes launch screens optional in the export template. If not
  specified, a white screen will be used.

- Adds App Store icon (1024x1024) export option as it now has to be
  bundled with the app instead of being provided in iTunes Connect.

- Fixes crash when launching games in iOS Simulator. It happened because
  controllerWasConnected callback came before the engine was
  initialized. Now in such case the controllers will be queued up and
  registered after initialization is done.

- Fixes issue with the virtual keyboard where for some reason
  autocorrection panel would intersect with the keyboard itself and not
  allow you to use the top row of the keyboard. This is fixed by
  disabling autocorrection altogether.

Closes #17358. Fixes #17428. Fixes #17331.
2018-04-11 14:53:24 +07:00
Guilherme Felipe 4f05190fb0 Implement Input.set_default_cursor_shape to change the default shape
Closes #18043
2018-04-10 11:38:34 -03:00
bruvzg ddae098dee
Experimental support for windows with per-pixel transparency (macOS, X11 and Windows). 2018-04-07 17:11:45 +03:00
Andrea Catania 2f9354016f
Fixed signal input variable name 2018-04-06 09:09:40 +02:00
bruvzg 5ba984fc8c
[macOS] Fix keyboard shortcuts on non QWERTY keyboard layouts. 2018-03-28 20:22:59 +03:00
Leon Krause 25800ffb0e Add RWLockDummy for NO_THREADS builds 2018-03-20 05:37:42 +01:00
Hein-Pieter van Braam 9bc0503c91
Merge pull request #17376 from marcelofg55/file_get_path
Added File.get_path and File.get_path_absolute functions
2018-03-15 22:21:21 +01:00
Marcelo Fernandez a4e64c5454 Added File.get_path and File.get_path_absolute functions 2018-03-13 12:07:37 -03:00
Rémi Verschelde 18d543d7ab
Merge pull request #17311 from marcelofg55/export_err_checks
Improved error checking at EditorExportPlatformPC::export_project
2018-03-13 12:17:53 +01:00
Leon Krause 802b6d3669 Reinstate WebGL 1.0 driver in HTML5 platform 2018-03-07 20:38:14 +01:00
Marcelo Fernandez 0876502f72 Improved error checking at EditorExportPlatformPC::export_project 2018-03-06 14:23:17 -03:00
Marcelo Fernandez d780d774aa Clean and expose get_audio/video_driver_* funcs on OS class 2018-03-04 14:18:05 -03:00
Poommetee Ketson 67e20dc2b6 (Magnify|Pan)Gesture: implement as_text 2018-02-24 10:35:25 +07:00
Rémi Verschelde e0f43e0678
Merge pull request #15564 from RandomShaper/adpod-topmost
Add new window setting: always on top
2018-02-14 16:43:40 +01:00
Marcelo Fernandez ea1d726a46 Added OS::center_window to center the window precisely on desktop platforms 2018-02-12 15:45:41 -03:00
bruvzg b3ddf12fb1
Mono: Allow loading mscorlib from resources. 2018-01-31 09:20:46 +02:00
Ariel Manzur 81426ff0a8 - Improves portability in joystick buttons enum
- Fixes linking bug in modules split library
2018-01-24 19:12:54 -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
firefly2442 f066991aa7 found via cppcheck:
remove code that will never run
make definition and declaration names for parameters match
change floats that were being set to bool values
remove pointer that is never used
2018-01-03 21:23:48 -07: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
Juan Linietsky 988d29bdd8 Reimport now checks source path changes and imported files and their md5, fixes #14728 2017-12-27 15:22:04 -03:00
Juan Linietsky 4a2eef4ad8 Removed the InputEvent ID field, which was unused and can cause bugs. 2017-12-26 09:49:31 -03:00
Juan Linietsky 021f3c924b -Removed OpenMP support, replaced by a custom class.
-Disabled Opus, implementation is wrong.
2017-12-24 09:32:12 -03:00
Guilherme Silva a392dbdbe3 Add implementation for custom hardware cursor 2017-12-17 13:40:29 -02:00
Rémi Verschelde 6afb90c846
Merge pull request #14635 from poke1024/getline
Faster FileAccess::get_line()
2017-12-17 14:24:07 +01: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
poke1024 a3f1ed9af9 Faster FileAccess::get_line() 2017-12-16 16:27:21 +01: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
Pedro J. Estébanez 7fb9508cfa Fix Windows-to-Linux export error
Now chmod() returns ERR_UNAVAILABLE by default, to signal the caller the problem is lack of support instead of a failed operation.
2017-12-06 20:46:38 +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 bc2e8d99e5 Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
2017-11-25 00:09:40 -03:00
Andreas Haas c76a9b99b0
Core: Bind InputEventGesture events. 2017-11-24 19:23:04 +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
Rémi Verschelde bedcbdd420
Merge pull request #13130 from endragor/gdnative-android-export
Proper GDNative export on Android
2017-11-21 23:59:01 +01:00
Juan Linietsky 30dadb1228
Merge pull request #11933 from cxong/master
Use "Command" instead of "Meta" for macOS (#1619)
2017-11-21 14:25:09 -03:00
Ruslan Mustakov ebf9b80a47 Proper GDNative export on Android 2017-11-21 20:40:31 +07:00
Rémi Verschelde 6c9ee1f125
Merge pull request #13133 from endragor/resurrect-file-logging
Return and repair file logging
2017-11-21 14:25:33 +01:00
Ruslan Mustakov d42c5646a5 Return and repair file logging
And make it configurable, too.
2017-11-21 16:43:44 +07:00
Bernhard Liebl 80ad8afc85 Native pan and zoom for macOS 2017-11-21 09:11:39 +01:00
Ruslan Mustakov 8f0f327f02 Allow configuring iOS export
- EditorExportPlugin's _export_begin accepts all the arguments related
   to the current export (is_debug, path, flags).

 - EditorExportPlugin API is extended with methods allowing to configure
   iOS export: add_ios_framework, add_ios_plist_content,
   add_ios_linker_flags, add_ios_bundle_file.

 - iOS export template now contains Godot as a static library so that
   it can be linked with third-party Frameworks and GDNative static
   libraries.

 - Adds method to DirAccess for recursive copying of a directory.

 - Fixes iOS export to work with Xcode 9 (released recently).
2017-11-21 01:16:49 +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 4d5b82811f
Merge pull request #13006 from hoelzl/pr-placement-delete
Add placement deletes to avoid warnings on VC++
2017-11-20 13:16:23 +01:00
Rémi Verschelde 6947bed015 Pass engine name and version parts as proper strings
Removes the need for _MKSTR all over the place which has the drawback of
converting _MKSTR(UNKNOWN_DEFINE) to "UKNOWN_DEFINE" instead of throwing
a compilation error.
2017-11-20 00:51:14 +01:00
Matthias Hoelzl 4c76c6892c Add placement deletes to avoid warnings on VC++
When compiling with VC++ 2017, Godot generates huge numbers of
C4291 warnings about missing placement delete.

I have not found a way to disable these warnings using compiler
options: AFAICT there is no equivalent to `-f-no-exceptions` for
VC++ (there is only /EH to change the exception-handling model,
/GX is deprecated) and adding /wd4291  to the
`disable_nonessential_warnings` list in the `SConstruct` file
or even compiling with `warnings=no` does not disable the
messages.

Placement delete is only called when placement new throws an
exception, since Godot doesn't use exceptions this change should
have no runtime effect.

Fixes #12654 (probably, difficult to say without log)
2017-11-19 21:25:18 +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
Bastiaan Olij 2a230d571d Increase joystick axis from 8 to 10 2017-11-08 19:56:30 +11: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
jagt 4e94292573 move button/joy constants to enums 2017-10-23 13:36:50 +08:00
Poommetee Ketson 8265ff4c20 Bind MainLoop.notif_wm_go_back_request 2017-10-22 14:07:24 +07:00
Patrick Yates c433d83d81 Fix InputEventJoypadMotion::action_match for 0 axis values.
Make action_match ignore the sign if axis value is 0.
This means that an axis value of 0 will match actions defined for both positive and negative values, as expected.

Fixes #12223
2017-10-21 16:06:24 +11:00
Rémi Verschelde 20a32d6a2e Merge pull request #12039 from Hinsbart/expose_joy_connection
Input: expose joy_connection_changed()

[ci skip]
2017-10-11 23:01:33 +02:00
Andreas Haas 8f1ed9aaee
Input: expose joy_connection_changed() 2017-10-11 18:55:57 +02: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
Cong dd684eaaa0 Use "Command" instead of "Meta" for macOS (#1619) 2017-10-08 17:23:05 +10:00
Juan Linietsky d938de67ff Make sure to obey hidpi to off by default, as present in project settings. Set it to on by default for editor.
Many integrated GPUs can't really get enough performance to play games at hidpi, so this should be enabled manually.
2017-10-05 16:41:42 -03: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