Commit graph

168 commits

Author SHA1 Message Date
Andrii Doroshenko (Xrayez) 24e9a881c0 Expose 2D Delaunay triangulation in Geometry singleton
Can be used via scripting as `Geometry.triangulate_delaunay_2d(points)`

The interface is the same as in `Triangulate` library, returning indices
into triangulated points.
2019-05-24 13:10:13 +03:00
Andrii Doroshenko (Xrayez) 883ef8570a Expose 2D polygon boolean operations in Geometry singleton
Clipper 6.4.2 is used internally to perform polypaths clipping, as well
as inflating/deflating polypaths. The following methods were added:

```
Geometry.merge_polygons_2d(poly_a, poly_b) # union
Geometry.clip_polygons_2d(poly_a, poly_b) # difference
Geometry.intersect_polygons_2d(poly_a, poly_b) # intersection
Geometry.exclude_polygons_2d(poly_a, poly_b) # xor

Geometry.clip_polyline_with_polygon_2d(poly_a, poly_b)
Geometry.intersect_polyline_with_polygon_2d(poly_a, poly_b)

Geometry.offset_polygon_2d(polygon, delta) # inflate/deflate
Geometry.offset_polyline_2d(polyline, delta) # returns polygons

// This one helps to implement CSG-like behaviour:
Geometry.transform_points_2d(points, transform)
```

All the methods return an array of polygons/polylines. The resulting
polygons could possibly be holes which could be checked with
`Geometry.is_polygon_clockwise()` which was exposed to scripting as well.
2019-05-22 17:12:39 +03:00
Ignacio Etcheverry ebe2f4ea09 core_bind: Use the appropriate enum instead of int 2019-04-07 18:52:39 +02:00
Fabio Alessandrelli 393e62b98a Add object encoding param to serialization methods
Network peers get_var/put_var
File get_var/store_var
GDScript/Mono/VisualScript bytes2var/var2bytes
Add MultiplayerAPI.allow_object_decoding member which deprecates PacketPeer.allow_object_decoding.

Break ABI compatibaility (API compatibility for GDNative).
2019-04-01 15:53:19 +02:00
DESKTOP-3H3MR3A\eloisa b22cf46fdb Request Android record permission when needed 2019-03-08 12:38:36 -03:00
Rémi Verschelde 7a79eee523 Expose OS::get_current_video_driver to scripting languages 2019-02-16 14:41:07 +01:00
Pedro J. Estébanez 496d8f19fc Let memory stat functions return uint64_t 2019-01-30 19:07:46 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
volzhs 84d060c768 Added OS.get_system_time_msecs() 2018-12-20 18:50:50 +09:00
bruvzg 4554c682e6
Changes IME input to use notification instead of callback, exposes IME methods to gdscript/gdnative. 2018-11-23 14:07:48 +02:00
Kanabenki 48166a9f3c Add store_csv_line method for File 2018-11-16 11:09:05 +01:00
Marcelo Fernandez 4de0cbba15 Expose OS::move_window_to_foreground 2018-11-07 11:51:15 -03:00
Andrii Doroshenko (Xrayez) 31f6fad90e Bind missing subresource flag in ResourceSaver 2018-10-18 17:58:44 +03:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Juan Linietsky c6b340ea98
Merge pull request #20712 from marcelofg55/midi_open_close
Add OS::open_midi_inputs and OS::close_midi_inputs
2018-08-24 12:17:14 -03:00
RaphaelHunter 43825dce47 fix #20390 :get_unix_time_from_datetime and get_date_time_from_unix_time can handle time before year 1970 now 2018-08-13 15:37:27 +08:00
Rémi Verschelde d29ea4337f Fix ResourceLoader::exists() false negative and readd deprecated has() 2018-08-12 12:44:38 +02:00
Juan Linietsky 852378109f Added function ResourceLoader.exists(), to check if a resource exists. Closes #19140 2018-08-10 15:57:43 -03: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
Marcelo Fernandez 7a5f9fc08e Added a new MIDIDriver class 2018-07-21 09:09:42 -03:00
Marc Gilleron 4705dc4f00 Expose OS.get_ticks_usec() 2018-06-18 21:03:55 +02:00
Saracen c5bdb5b1d8 IME context detection. 2018-06-11 17:22:11 +01:00
Ibrahn Sahir 1433c2cbbb GDScript access to copyright, license, author and donor information.
Adds following functions to the Engine singleton:
get_author_info - names of Godot authors
get_copyright_info - detailed source copyright get_license_info
get_donor_info - donor names
get_license_info - full text of licenses used, indexed by license names
get_license_text - the text of the Godot Expat license
2018-05-19 00:40:16 +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
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