Commit graph

142 commits

Author SHA1 Message Date
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
Juan Linietsky 633bbdb231
Merge pull request #17353 from zmanuel/timer_hysteresis_multiframe_pr1
Use hysteresis for smoother physics update frequency
2018-05-07 19:27:32 -03:00
Juan Linietsky 69a96ff4a6
Merge pull request #15943 from poke1024/geometry-line-line
Add Geometry::line_intersects_line_2d()
2018-05-07 17:54:33 -03: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
Manuel Moos d5abd4eb75 Add hysteresis to physics timestep count per frame
Add new class _TimerSync to manage timestep calculations.
The new class handles the decisions about simulation progression
previously handled by main::iteration(). It is fed the current timer
ticks and determines how many physics updates are to be run and what
the delta argument to the _process() functions should be.

The new class tries to keep the number of physics updates per frame as
constant as possible from frame to frame. Ideally, it would be N steps
every render frame, but even with perfectly regular rendering, the
general case is that N or N+1 steps are required per frame, for some
fixed N. The best guess for N is stored in typical_physics_steps.

When determining the number of steps to take, no restrictions are
imposed between the choice of typical_physics_steps and
typical_physics_steps+1 steps. Should more or less steps than that be
required, the accumulated remaining time (as before, stored in
time_accum) needs to surpass its boundaries by some minimal threshold.
Once surpassed, typical_physics_steps is updated to allow the new step
count for future updates.

Care is taken that the modified calculation of the number of physics
steps is not observable from game code that only checks the delta
parameters to the _process and _physics_process functions; in addition
to modifying the number of steps, the _process argument is modified as
well to stay in expected bounds. Extra care is taken that the accumulated
steps still sum up to roughly the real elapsed time, up to a maximum
tolerated difference.

To allow the hysteresis code to work correctly on higher refresh
monitors, the number of typical physics steps is not only recorded and
kept consistent for single render frames, but for groups of them.
Currently, up to 12 frames are grouped that way.

The engine parameter physics_jitter_fix controls both the maximum
tolerated difference between wall clock time and summed up _process
arguments and the threshold for changing typical_physics_steps. It is
given in units of the real physics frame slice 1/physics_fps. Set
physics_jitter_fix to 0 to disable the effects of the new code here.
It starts to be effective against the random physics jitter at around
0.02 to 0.05. at values greater than 1 it starts having ill effects on
the engine's ability to react sensibly to dropped frames and framerate
changes.
2018-04-09 22:27:29 +02:00
bruvzg ddae098dee
Experimental support for windows with per-pixel transparency (macOS, X11 and Windows). 2018-04-07 17:11:45 +03:00
Marcelo Fernandez a4e64c5454 Added File.get_path and File.get_path_absolute functions 2018-03-13 12:07:37 -03:00
Marcelo Fernandez d780d774aa Clean and expose get_audio/video_driver_* funcs on OS class 2018-03-04 14:18:05 -03: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
Bernhard Liebl c1e099b48f Add Geometry::line_intersects_line_2d() 2018-01-21 15:31:34 +01:00
Paul Joannon a066f896d8 get_target_fps and set_target_fps now both use an int 2018-01-12 14:26:21 +01: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
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
Rémi Verschelde e6f3253f7d
Merge pull request #12603 from GodotExplorer/beautify-json
Add indent and sort keys support for JSON.print
2017-12-06 23:53:05 +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
Leon Krause 9b7b46143d Move singleton management from ProjectSettings to Engine 2017-11-14 15:15:13 +01:00
Geequlim f7168bf217 Add indent and sort keys support for JSON.print 2017-11-07 11:52:45 +08:00
Bernhard Liebl 7ec32b6d09 Basic docs for Geometry plus two new functions 2017-11-05 07:56:27 +01: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
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
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
AndreaCatania 4537977d6d Renamed fixed_process to physics_process 2017-09-30 16:19:07 +02: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 41715c1e8f Merge pull request #11294 from karroffel/json-object
added JSON singleton
2017-09-17 16:31:27 +02:00
Ignacio Etcheverry f1f8fd1b68 Adds _OS::PowerState enum 2017-09-16 12:28:23 +02:00
karroffel 308d20aba5 added JSON singleton
There was no way to access JSON functionality in scripting languages
apart from GDScript because the JSON class wasn't exposed to ClassDB.
2017-09-15 15:40:27 +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
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Rémi Verschelde 7f49e2a7a0 Merge pull request #10487 from marcelofg55/curscr_as_default
p_screen param from get_screen_* funcs now default to the current screen
2017-08-22 08:12:04 +02:00
Juan Linietsky 2cc8309249 Merge pull request #10351 from neikeq/enums-are-for-the-weak
ClassDB: Provide the enum name of integer constants
2017-08-21 19:56:08 -03: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
Rémi Verschelde 93f1fb1c2f Fixes for new two-dash long command line arguments
- Fixes some single-dash leftovers that were missed in the previous commit
- Reorder the help output for clarity, and document missing options
- Drop obsolete options: --noop, --pack, --editor-scene, --level, --import, --import-script, --no-quit
- Improve error message on malformed arguments and do not display help on error
- Always use long form of arguments when starting a new Godot process from C++, for clarity and easy grepping
- Cleanup obsolete code here and there
2017-08-21 08:09:22 +02:00
Ignacio Etcheverry 32dd9a9f66 ClassDB: Provide the enum name of integer constants 2017-08-20 22:07:43 +02:00
Juan Linietsky 541fdffc0a Merge pull request #10319 from neikeq/pr-engine-editor-hint
Adds Engine::is_editor_hint() method
2017-08-20 12:55:46 -03:00
Juan Linietsky b9dcebb37c Revert "Second take at making command-line arguments more UNIX-like + main.cpp and help cleanup" 2017-08-19 17:47:27 -03:00
Rémi Verschelde 70b0857f6c Fixes for new two-dash long command line arguments
- Fixes some single-dash leftovers that were missed in the previous commit
- Reorder the help output for clarity, and document missing options
- Drop obsolete options: --noop, --pack, --editor-scene, --level, --import, --import-script, --no-quit
- Improve error message on malformed arguments and do not display help on error
- Cleanup obsolete code here and there
2017-08-19 16:48:11 +02:00
Ignacio Etcheverry fd69604bd9 Adds editor_hint to Engine class 2017-08-19 01:03:12 +02:00
TwistedTwigleg 00f6c85928 Synchronize parameter names in definition and declaration
Fixes #10244.
2017-08-16 17:22:23 +02:00
Indah Sylvia 5ae78fdf6a Makes all Godot API's methods Lower Case 2017-08-07 18:24:35 +07:00
George Marques 0f765c86e5
Add GZIP compression support
- Fix a wrong call in PoolByteArray::compress
2017-07-13 14:41:10 -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
George Marques 5c779c574a
Add compression support for File object 2017-06-19 16:38:37 -03:00
kubeczek a81b706e09 Fixed thread check, solves: #3698 2017-06-13 17:49:28 +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 f29dc079dc Merge pull request #8333 from touilleMan/classdb-class_sget_property-binding
Add _ClassDB.class_[g|s]et_property to ClassDB exposed methods
2017-04-09 17:46:35 +02:00