1 | /**************************************************************************/ |
2 | /* core_bind.h */ |
3 | /**************************************************************************/ |
4 | /* This file is part of: */ |
5 | /* GODOT ENGINE */ |
6 | /* https://godotengine.org */ |
7 | /**************************************************************************/ |
8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
10 | /* */ |
11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
12 | /* a copy of this software and associated documentation files (the */ |
13 | /* "Software"), to deal in the Software without restriction, including */ |
14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
17 | /* the following conditions: */ |
18 | /* */ |
19 | /* The above copyright notice and this permission notice shall be */ |
20 | /* included in all copies or substantial portions of the Software. */ |
21 | /* */ |
22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
29 | /**************************************************************************/ |
30 | |
31 | #ifndef CORE_BIND_H |
32 | #define CORE_BIND_H |
33 | |
34 | #include "core/debugger/engine_profiler.h" |
35 | #include "core/io/image.h" |
36 | #include "core/io/resource_loader.h" |
37 | #include "core/io/resource_saver.h" |
38 | #include "core/object/script_language.h" |
39 | #include "core/os/os.h" |
40 | #include "core/os/semaphore.h" |
41 | #include "core/os/thread.h" |
42 | #include "core/templates/safe_refcount.h" |
43 | |
44 | class MainLoop; |
45 | template <typename T> |
46 | class TypedArray; |
47 | |
48 | namespace core_bind { |
49 | |
50 | class ResourceLoader : public Object { |
51 | GDCLASS(ResourceLoader, Object); |
52 | |
53 | protected: |
54 | static void _bind_methods(); |
55 | static ResourceLoader *singleton; |
56 | |
57 | public: |
58 | enum ThreadLoadStatus { |
59 | THREAD_LOAD_INVALID_RESOURCE, |
60 | THREAD_LOAD_IN_PROGRESS, |
61 | THREAD_LOAD_FAILED, |
62 | THREAD_LOAD_LOADED |
63 | }; |
64 | |
65 | enum CacheMode { |
66 | CACHE_MODE_IGNORE, // Resource and subresources do not use path cache, no path is set into resource. |
67 | CACHE_MODE_REUSE, // Resource and subresources use patch cache, reuse existing loaded resources instead of loading from disk when available. |
68 | CACHE_MODE_REPLACE, // Resource and subresource use path cache, but replace existing loaded resources when available with information from disk. |
69 | }; |
70 | |
71 | static ResourceLoader *get_singleton() { return singleton; } |
72 | |
73 | Error load_threaded_request(const String &p_path, const String &p_type_hint = "" , bool p_use_sub_threads = false, CacheMode p_cache_mode = CACHE_MODE_REUSE); |
74 | ThreadLoadStatus load_threaded_get_status(const String &p_path, Array r_progress = Array()); |
75 | Ref<Resource> load_threaded_get(const String &p_path); |
76 | |
77 | Ref<Resource> load(const String &p_path, const String &p_type_hint = "" , CacheMode p_cache_mode = CACHE_MODE_REUSE); |
78 | Vector<String> get_recognized_extensions_for_type(const String &p_type); |
79 | void add_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader, bool p_at_front); |
80 | void remove_resource_format_loader(Ref<ResourceFormatLoader> p_format_loader); |
81 | void set_abort_on_missing_resources(bool p_abort); |
82 | PackedStringArray get_dependencies(const String &p_path); |
83 | bool has_cached(const String &p_path); |
84 | bool exists(const String &p_path, const String &p_type_hint = "" ); |
85 | ResourceUID::ID get_resource_uid(const String &p_path); |
86 | |
87 | ResourceLoader() { singleton = this; } |
88 | }; |
89 | |
90 | class ResourceSaver : public Object { |
91 | GDCLASS(ResourceSaver, Object); |
92 | |
93 | protected: |
94 | static void _bind_methods(); |
95 | static ResourceSaver *singleton; |
96 | |
97 | public: |
98 | enum SaverFlags { |
99 | FLAG_NONE = 0, |
100 | FLAG_RELATIVE_PATHS = 1, |
101 | FLAG_BUNDLE_RESOURCES = 2, |
102 | FLAG_CHANGE_PATH = 4, |
103 | FLAG_OMIT_EDITOR_PROPERTIES = 8, |
104 | FLAG_SAVE_BIG_ENDIAN = 16, |
105 | FLAG_COMPRESS = 32, |
106 | FLAG_REPLACE_SUBRESOURCE_PATHS = 64, |
107 | }; |
108 | |
109 | static ResourceSaver *get_singleton() { return singleton; } |
110 | |
111 | Error save(const Ref<Resource> &p_resource, const String &p_path, BitField<SaverFlags> p_flags); |
112 | Vector<String> get_recognized_extensions(const Ref<Resource> &p_resource); |
113 | void add_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver, bool p_at_front); |
114 | void remove_resource_format_saver(Ref<ResourceFormatSaver> p_format_saver); |
115 | |
116 | ResourceSaver() { singleton = this; } |
117 | }; |
118 | |
119 | class OS : public Object { |
120 | GDCLASS(OS, Object); |
121 | |
122 | mutable HashMap<String, bool> feature_cache; |
123 | |
124 | protected: |
125 | static void _bind_methods(); |
126 | static OS *singleton; |
127 | |
128 | public: |
129 | enum RenderingDriver { |
130 | RENDERING_DRIVER_VULKAN, |
131 | RENDERING_DRIVER_OPENGL3, |
132 | }; |
133 | |
134 | virtual PackedStringArray get_connected_midi_inputs(); |
135 | virtual void open_midi_inputs(); |
136 | virtual void close_midi_inputs(); |
137 | |
138 | void set_low_processor_usage_mode(bool p_enabled); |
139 | bool is_in_low_processor_usage_mode() const; |
140 | |
141 | void set_low_processor_usage_mode_sleep_usec(int p_usec); |
142 | int get_low_processor_usage_mode_sleep_usec() const; |
143 | |
144 | void set_delta_smoothing(bool p_enabled); |
145 | bool is_delta_smoothing_enabled() const; |
146 | |
147 | void alert(const String &p_alert, const String &p_title = "ALERT!" ); |
148 | void crash(const String &p_message); |
149 | |
150 | Vector<String> get_system_fonts() const; |
151 | String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const; |
152 | Vector<String> get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const; |
153 | String get_executable_path() const; |
154 | String read_string_from_stdin(); |
155 | int execute(const String &p_path, const Vector<String> &p_arguments, Array r_output = Array(), bool p_read_stderr = false, bool p_open_console = false); |
156 | int create_process(const String &p_path, const Vector<String> &p_arguments, bool p_open_console = false); |
157 | int create_instance(const Vector<String> &p_arguments); |
158 | Error kill(int p_pid); |
159 | Error shell_open(String p_uri); |
160 | Error shell_show_in_file_manager(String p_path, bool p_open_folder = true); |
161 | |
162 | bool is_process_running(int p_pid) const; |
163 | int get_process_id() const; |
164 | |
165 | void set_restart_on_exit(bool p_restart, const Vector<String> &p_restart_arguments = Vector<String>()); |
166 | bool is_restart_on_exit_set() const; |
167 | Vector<String> get_restart_on_exit_arguments() const; |
168 | |
169 | bool has_environment(const String &p_var) const; |
170 | String get_environment(const String &p_var) const; |
171 | void set_environment(const String &p_var, const String &p_value) const; |
172 | void unset_environment(const String &p_var) const; |
173 | |
174 | String get_name() const; |
175 | String get_distribution_name() const; |
176 | String get_version() const; |
177 | Vector<String> get_cmdline_args(); |
178 | Vector<String> get_cmdline_user_args(); |
179 | |
180 | Vector<String> get_video_adapter_driver_info() const; |
181 | |
182 | String get_locale() const; |
183 | String get_locale_language() const; |
184 | |
185 | String get_model_name() const; |
186 | |
187 | bool is_debug_build() const; |
188 | |
189 | String get_unique_id() const; |
190 | |
191 | String get_keycode_string(Key p_code) const; |
192 | bool is_keycode_unicode(char32_t p_unicode) const; |
193 | Key find_keycode_from_string(const String &p_code) const; |
194 | |
195 | void set_use_file_access_save_and_swap(bool p_enable); |
196 | |
197 | uint64_t get_static_memory_usage() const; |
198 | uint64_t get_static_memory_peak_usage() const; |
199 | Dictionary get_memory_info() const; |
200 | |
201 | void delay_usec(int p_usec) const; |
202 | void delay_msec(int p_msec) const; |
203 | uint64_t get_ticks_msec() const; |
204 | uint64_t get_ticks_usec() const; |
205 | |
206 | bool is_userfs_persistent() const; |
207 | |
208 | bool is_stdout_verbose() const; |
209 | |
210 | int get_processor_count() const; |
211 | String get_processor_name() const; |
212 | |
213 | enum SystemDir { |
214 | SYSTEM_DIR_DESKTOP, |
215 | SYSTEM_DIR_DCIM, |
216 | SYSTEM_DIR_DOCUMENTS, |
217 | SYSTEM_DIR_DOWNLOADS, |
218 | SYSTEM_DIR_MOVIES, |
219 | SYSTEM_DIR_MUSIC, |
220 | SYSTEM_DIR_PICTURES, |
221 | SYSTEM_DIR_RINGTONES, |
222 | }; |
223 | |
224 | String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const; |
225 | |
226 | Error move_to_trash(const String &p_path) const; |
227 | String get_user_data_dir() const; |
228 | String get_config_dir() const; |
229 | String get_data_dir() const; |
230 | String get_cache_dir() const; |
231 | |
232 | Error set_thread_name(const String &p_name); |
233 | ::Thread::ID get_thread_caller_id() const; |
234 | ::Thread::ID get_main_thread_id() const; |
235 | |
236 | bool has_feature(const String &p_feature) const; |
237 | bool is_sandboxed() const; |
238 | |
239 | bool request_permission(const String &p_name); |
240 | bool request_permissions(); |
241 | Vector<String> get_granted_permissions() const; |
242 | void revoke_granted_permissions(); |
243 | |
244 | static OS *get_singleton() { return singleton; } |
245 | |
246 | OS() { singleton = this; } |
247 | }; |
248 | |
249 | class Geometry2D : public Object { |
250 | GDCLASS(Geometry2D, Object); |
251 | |
252 | static Geometry2D *singleton; |
253 | |
254 | protected: |
255 | static void _bind_methods(); |
256 | |
257 | public: |
258 | static Geometry2D *get_singleton(); |
259 | Variant segment_intersects_segment(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b); |
260 | Variant line_intersects_line(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b); |
261 | Vector<Vector2> get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2); |
262 | Vector2 get_closest_point_to_segment(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b); |
263 | Vector2 get_closest_point_to_segment_uncapped(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b); |
264 | bool point_is_inside_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) const; |
265 | |
266 | bool is_point_in_circle(const Vector2 &p_point, const Vector2 &p_circle_pos, real_t p_circle_radius); |
267 | real_t segment_intersects_circle(const Vector2 &p_from, const Vector2 &p_to, const Vector2 &p_circle_pos, real_t p_circle_radius); |
268 | |
269 | bool is_polygon_clockwise(const Vector<Vector2> &p_polygon); |
270 | bool is_point_in_polygon(const Point2 &p_point, const Vector<Vector2> &p_polygon); |
271 | Vector<int> triangulate_polygon(const Vector<Vector2> &p_polygon); |
272 | Vector<int> triangulate_delaunay(const Vector<Vector2> &p_points); |
273 | Vector<Point2> convex_hull(const Vector<Point2> &p_points); |
274 | TypedArray<PackedVector2Array> decompose_polygon_in_convex(const Vector<Vector2> &p_polygon); |
275 | |
276 | enum PolyBooleanOperation { |
277 | OPERATION_UNION, |
278 | OPERATION_DIFFERENCE, |
279 | OPERATION_INTERSECTION, |
280 | OPERATION_XOR |
281 | }; |
282 | // 2D polygon boolean operations. |
283 | TypedArray<PackedVector2Array> merge_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // Union (add). |
284 | TypedArray<PackedVector2Array> clip_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // Difference (subtract). |
285 | TypedArray<PackedVector2Array> intersect_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // Common area (multiply). |
286 | TypedArray<PackedVector2Array> exclude_polygons(const Vector<Vector2> &p_polygon_a, const Vector<Vector2> &p_polygon_b); // All but common area (xor). |
287 | |
288 | // 2D polyline vs polygon operations. |
289 | TypedArray<PackedVector2Array> clip_polyline_with_polygon(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon); // Cut. |
290 | TypedArray<PackedVector2Array> intersect_polyline_with_polygon(const Vector<Vector2> &p_polyline, const Vector<Vector2> &p_polygon); // Chop. |
291 | |
292 | // 2D offset polygons/polylines. |
293 | enum PolyJoinType { |
294 | JOIN_SQUARE, |
295 | JOIN_ROUND, |
296 | JOIN_MITER |
297 | }; |
298 | enum PolyEndType { |
299 | END_POLYGON, |
300 | END_JOINED, |
301 | END_BUTT, |
302 | END_SQUARE, |
303 | END_ROUND |
304 | }; |
305 | TypedArray<PackedVector2Array> offset_polygon(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE); |
306 | TypedArray<PackedVector2Array> offset_polyline(const Vector<Vector2> &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE, PolyEndType p_end_type = END_SQUARE); |
307 | |
308 | Dictionary make_atlas(const Vector<Size2> &p_rects); |
309 | |
310 | Geometry2D() { singleton = this; } |
311 | }; |
312 | |
313 | class Geometry3D : public Object { |
314 | GDCLASS(Geometry3D, Object); |
315 | |
316 | static Geometry3D *singleton; |
317 | |
318 | protected: |
319 | static void _bind_methods(); |
320 | |
321 | public: |
322 | static Geometry3D *get_singleton(); |
323 | Vector<Vector3> compute_convex_mesh_points(const TypedArray<Plane> &p_planes); |
324 | TypedArray<Plane> build_box_planes(const Vector3 &p_extents); |
325 | TypedArray<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z); |
326 | TypedArray<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z); |
327 | Vector<Vector3> get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2); |
328 | Vector3 get_closest_point_to_segment(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b); |
329 | Vector3 get_closest_point_to_segment_uncapped(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b); |
330 | Vector3 get_triangle_barycentric_coords(const Vector3 &p_point, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2); |
331 | Variant ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2); |
332 | Variant segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2); |
333 | |
334 | Vector<Vector3> segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius); |
335 | Vector<Vector3> segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius); |
336 | Vector<Vector3> segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const TypedArray<Plane> &p_planes); |
337 | |
338 | Vector<Vector3> clip_polygon(const Vector<Vector3> &p_points, const Plane &p_plane); |
339 | |
340 | Geometry3D() { singleton = this; } |
341 | }; |
342 | |
343 | class Marshalls : public Object { |
344 | GDCLASS(Marshalls, Object); |
345 | |
346 | static Marshalls *singleton; |
347 | |
348 | protected: |
349 | static void _bind_methods(); |
350 | |
351 | public: |
352 | static Marshalls *get_singleton(); |
353 | |
354 | String variant_to_base64(const Variant &p_var, bool p_full_objects = false); |
355 | Variant base64_to_variant(const String &p_str, bool p_allow_objects = false); |
356 | |
357 | String raw_to_base64(const Vector<uint8_t> &p_arr); |
358 | Vector<uint8_t> base64_to_raw(const String &p_str); |
359 | |
360 | String utf8_to_base64(const String &p_str); |
361 | String base64_to_utf8(const String &p_str); |
362 | |
363 | Marshalls() { singleton = this; } |
364 | ~Marshalls() { singleton = nullptr; } |
365 | }; |
366 | |
367 | class Mutex : public RefCounted { |
368 | GDCLASS(Mutex, RefCounted); |
369 | ::Mutex mutex; |
370 | |
371 | static void _bind_methods(); |
372 | |
373 | public: |
374 | void lock(); |
375 | bool try_lock(); |
376 | void unlock(); |
377 | }; |
378 | |
379 | class Semaphore : public RefCounted { |
380 | GDCLASS(Semaphore, RefCounted); |
381 | ::Semaphore semaphore; |
382 | |
383 | static void _bind_methods(); |
384 | |
385 | public: |
386 | void wait(); |
387 | bool try_wait(); |
388 | void post(); |
389 | }; |
390 | |
391 | class Thread : public RefCounted { |
392 | GDCLASS(Thread, RefCounted); |
393 | |
394 | protected: |
395 | Variant ret; |
396 | SafeFlag running; |
397 | Callable target_callable; |
398 | ::Thread thread; |
399 | static void _bind_methods(); |
400 | static void _start_func(void *ud); |
401 | |
402 | public: |
403 | enum Priority { |
404 | PRIORITY_LOW, |
405 | PRIORITY_NORMAL, |
406 | PRIORITY_HIGH, |
407 | PRIORITY_MAX |
408 | }; |
409 | |
410 | Error start(const Callable &p_callable, Priority p_priority = PRIORITY_NORMAL); |
411 | String get_id() const; |
412 | bool is_started() const; |
413 | bool is_alive() const; |
414 | Variant wait_to_finish(); |
415 | |
416 | static void set_thread_safety_checks_enabled(bool p_enabled); |
417 | }; |
418 | |
419 | namespace special { |
420 | |
421 | class ClassDB : public Object { |
422 | GDCLASS(ClassDB, Object); |
423 | |
424 | protected: |
425 | static void _bind_methods(); |
426 | |
427 | public: |
428 | PackedStringArray get_class_list() const; |
429 | PackedStringArray get_inheriters_from_class(const StringName &p_class) const; |
430 | StringName get_parent_class(const StringName &p_class) const; |
431 | bool class_exists(const StringName &p_class) const; |
432 | bool is_parent_class(const StringName &p_class, const StringName &p_inherits) const; |
433 | bool can_instantiate(const StringName &p_class) const; |
434 | Variant instantiate(const StringName &p_class) const; |
435 | |
436 | bool class_has_signal(StringName p_class, StringName p_signal) const; |
437 | Dictionary class_get_signal(StringName p_class, StringName p_signal) const; |
438 | TypedArray<Dictionary> class_get_signal_list(StringName p_class, bool p_no_inheritance = false) const; |
439 | |
440 | TypedArray<Dictionary> class_get_property_list(StringName p_class, bool p_no_inheritance = false) const; |
441 | Variant class_get_property(Object *p_object, const StringName &p_property) const; |
442 | Error class_set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const; |
443 | |
444 | bool class_has_method(StringName p_class, StringName p_method, bool p_no_inheritance = false) const; |
445 | |
446 | TypedArray<Dictionary> class_get_method_list(StringName p_class, bool p_no_inheritance = false) const; |
447 | |
448 | PackedStringArray class_get_integer_constant_list(const StringName &p_class, bool p_no_inheritance = false) const; |
449 | bool class_has_integer_constant(const StringName &p_class, const StringName &p_name) const; |
450 | int64_t class_get_integer_constant(const StringName &p_class, const StringName &p_name) const; |
451 | |
452 | bool class_has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const; |
453 | PackedStringArray class_get_enum_list(const StringName &p_class, bool p_no_inheritance = false) const; |
454 | PackedStringArray class_get_enum_constants(const StringName &p_class, const StringName &p_enum, bool p_no_inheritance = false) const; |
455 | StringName class_get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false) const; |
456 | |
457 | bool is_class_enabled(StringName p_class) const; |
458 | |
459 | ClassDB() {} |
460 | ~ClassDB() {} |
461 | }; |
462 | |
463 | } // namespace special |
464 | |
465 | class Engine : public Object { |
466 | GDCLASS(Engine, Object); |
467 | |
468 | protected: |
469 | static void _bind_methods(); |
470 | static Engine *singleton; |
471 | |
472 | public: |
473 | static Engine *get_singleton() { return singleton; } |
474 | void set_physics_ticks_per_second(int p_ips); |
475 | int get_physics_ticks_per_second() const; |
476 | |
477 | void set_max_physics_steps_per_frame(int p_max_physics_steps); |
478 | int get_max_physics_steps_per_frame() const; |
479 | |
480 | void set_physics_jitter_fix(double p_threshold); |
481 | double get_physics_jitter_fix() const; |
482 | double get_physics_interpolation_fraction() const; |
483 | |
484 | void set_max_fps(int p_fps); |
485 | int get_max_fps() const; |
486 | |
487 | double get_frames_per_second() const; |
488 | uint64_t get_physics_frames() const; |
489 | uint64_t get_process_frames() const; |
490 | |
491 | int get_frames_drawn(); |
492 | |
493 | void set_time_scale(double p_scale); |
494 | double get_time_scale(); |
495 | |
496 | MainLoop *get_main_loop() const; |
497 | |
498 | Dictionary get_version_info() const; |
499 | Dictionary get_author_info() const; |
500 | TypedArray<Dictionary> get_copyright_info() const; |
501 | Dictionary get_donor_info() const; |
502 | Dictionary get_license_info() const; |
503 | String get_license_text() const; |
504 | |
505 | String get_architecture_name() const; |
506 | |
507 | bool is_in_physics_frame() const; |
508 | |
509 | bool has_singleton(const StringName &p_name) const; |
510 | Object *get_singleton_object(const StringName &p_name) const; |
511 | void register_singleton(const StringName &p_name, Object *p_object); |
512 | void unregister_singleton(const StringName &p_name); |
513 | Vector<String> get_singleton_list() const; |
514 | |
515 | Error register_script_language(ScriptLanguage *p_language); |
516 | Error unregister_script_language(const ScriptLanguage *p_language); |
517 | int get_script_language_count(); |
518 | ScriptLanguage *get_script_language(int p_index) const; |
519 | |
520 | void set_editor_hint(bool p_enabled); |
521 | bool is_editor_hint() const; |
522 | |
523 | // `set_write_movie_path()` is not exposed to the scripting API as changing it at run-time has no effect. |
524 | String get_write_movie_path() const; |
525 | |
526 | void set_print_error_messages(bool p_enabled); |
527 | bool is_printing_error_messages() const; |
528 | |
529 | Engine() { singleton = this; } |
530 | }; |
531 | |
532 | class EngineDebugger : public Object { |
533 | GDCLASS(EngineDebugger, Object); |
534 | |
535 | HashMap<StringName, Callable> captures; |
536 | HashMap<StringName, Ref<EngineProfiler>> profilers; |
537 | |
538 | protected: |
539 | static void _bind_methods(); |
540 | static EngineDebugger *singleton; |
541 | |
542 | public: |
543 | static EngineDebugger *get_singleton() { return singleton; } |
544 | |
545 | bool is_active(); |
546 | |
547 | void register_profiler(const StringName &p_name, Ref<EngineProfiler> p_profiler); |
548 | void unregister_profiler(const StringName &p_name); |
549 | bool is_profiling(const StringName &p_name); |
550 | bool has_profiler(const StringName &p_name); |
551 | void profiler_add_frame_data(const StringName &p_name, const Array &p_data); |
552 | void profiler_enable(const StringName &p_name, bool p_enabled, const Array &p_opts = Array()); |
553 | |
554 | void register_message_capture(const StringName &p_name, const Callable &p_callable); |
555 | void unregister_message_capture(const StringName &p_name); |
556 | bool has_capture(const StringName &p_name); |
557 | |
558 | void send_message(const String &p_msg, const Array &p_data); |
559 | |
560 | static Error call_capture(void *p_user, const String &p_cmd, const Array &p_data, bool &r_captured); |
561 | |
562 | EngineDebugger() { singleton = this; } |
563 | ~EngineDebugger(); |
564 | }; |
565 | |
566 | } // namespace core_bind |
567 | |
568 | VARIANT_ENUM_CAST(core_bind::ResourceLoader::ThreadLoadStatus); |
569 | VARIANT_ENUM_CAST(core_bind::ResourceLoader::CacheMode); |
570 | |
571 | VARIANT_BITFIELD_CAST(core_bind::ResourceSaver::SaverFlags); |
572 | |
573 | VARIANT_ENUM_CAST(core_bind::OS::RenderingDriver); |
574 | VARIANT_ENUM_CAST(core_bind::OS::SystemDir); |
575 | |
576 | VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyBooleanOperation); |
577 | VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyJoinType); |
578 | VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyEndType); |
579 | |
580 | VARIANT_ENUM_CAST(core_bind::Thread::Priority); |
581 | |
582 | #endif // CORE_BIND_H |
583 | |