2016-06-18 14:46:12 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* core_bind.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2016-06-18 14:46:12 +02:00
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2017-04-08 00:11:42 +02:00
|
|
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
2016-06-18 14:46:12 +02:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2014-02-10 02:10:30 +01:00
|
|
|
#ifndef CORE_BIND_H
|
|
|
|
#define CORE_BIND_H
|
|
|
|
|
2017-05-17 12:36:47 +02:00
|
|
|
#include "image.h"
|
2017-06-19 18:28:00 +02:00
|
|
|
#include "io/compression.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "io/resource_loader.h"
|
|
|
|
#include "io/resource_saver.h"
|
|
|
|
#include "os/dir_access.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "os/file_access.h"
|
2017-09-12 21:09:06 +02:00
|
|
|
#include "os/os.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "os/semaphore.h"
|
|
|
|
#include "os/thread.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
class _ResourceLoader : public Object {
|
|
|
|
GDCLASS(_ResourceLoader, Object);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
static _ResourceLoader *singleton;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2014-02-10 02:10:30 +01:00
|
|
|
static _ResourceLoader *get_singleton() { return singleton; }
|
2017-03-05 16:44:50 +01:00
|
|
|
Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_type_hint = "");
|
|
|
|
RES load(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false);
|
|
|
|
PoolVector<String> get_recognized_extensions_for_type(const String &p_type);
|
2014-02-10 02:10:30 +01:00
|
|
|
void set_abort_on_missing_resources(bool p_abort);
|
2017-03-05 16:44:50 +01:00
|
|
|
PoolStringArray get_dependencies(const String &p_path);
|
|
|
|
bool has(const String &p_path);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
_ResourceLoader();
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
class _ResourceSaver : public Object {
|
|
|
|
GDCLASS(_ResourceSaver, Object);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
static _ResourceSaver *singleton;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2014-05-24 06:35:47 +02:00
|
|
|
enum SaverFlags {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
FLAG_RELATIVE_PATHS = 1,
|
|
|
|
FLAG_BUNDLE_RESOURCES = 2,
|
|
|
|
FLAG_CHANGE_PATH = 4,
|
|
|
|
FLAG_OMIT_EDITOR_PROPERTIES = 8,
|
|
|
|
FLAG_SAVE_BIG_ENDIAN = 16,
|
|
|
|
FLAG_COMPRESS = 32,
|
2014-05-24 06:35:47 +02:00
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
static _ResourceSaver *get_singleton() { return singleton; }
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error save(const String &p_path, const RES &p_resource, uint32_t p_flags);
|
|
|
|
PoolVector<String> get_recognized_extensions(const RES &p_resource);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
_ResourceSaver();
|
|
|
|
};
|
|
|
|
|
2017-08-20 17:45:01 +02:00
|
|
|
VARIANT_ENUM_CAST(_ResourceSaver::SaverFlags);
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
class MainLoop;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
class _OS : public Object {
|
|
|
|
GDCLASS(_OS, Object);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
static _OS *singleton;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2017-09-16 12:28:23 +02:00
|
|
|
enum PowerState {
|
|
|
|
POWERSTATE_UNKNOWN, /**< cannot determine power status */
|
|
|
|
POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
|
|
|
|
POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
|
|
|
|
POWERSTATE_CHARGING, /**< Plugged in, charging battery */
|
|
|
|
POWERSTATE_CHARGED /**< Plugged in, battery charged */
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum Weekday {
|
|
|
|
DAY_SUNDAY,
|
|
|
|
DAY_MONDAY,
|
|
|
|
DAY_TUESDAY,
|
|
|
|
DAY_WEDNESDAY,
|
|
|
|
DAY_THURSDAY,
|
|
|
|
DAY_FRIDAY,
|
|
|
|
DAY_SATURDAY
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Month {
|
2016-03-13 03:13:57 +01:00
|
|
|
/// Start at 1 to follow Windows SYSTEMTIME structure
|
|
|
|
/// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx
|
|
|
|
MONTH_JANUARY = 1,
|
2014-02-10 02:10:30 +01:00
|
|
|
MONTH_FEBRUARY,
|
|
|
|
MONTH_MARCH,
|
|
|
|
MONTH_APRIL,
|
|
|
|
MONTH_MAY,
|
|
|
|
MONTH_JUNE,
|
|
|
|
MONTH_JULY,
|
|
|
|
MONTH_AUGUST,
|
|
|
|
MONTH_SEPTEMBER,
|
|
|
|
MONTH_OCTOBER,
|
|
|
|
MONTH_NOVEMBER,
|
|
|
|
MONTH_DECEMBER
|
|
|
|
};
|
|
|
|
|
2017-03-29 17:29:38 +02:00
|
|
|
Point2 get_mouse_position() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_window_title(const String &p_title);
|
2014-02-10 02:10:30 +01:00
|
|
|
int get_mouse_button_state() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_clipboard(const String &p_text);
|
2014-02-10 02:10:30 +01:00
|
|
|
String get_clipboard() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen = 0);
|
|
|
|
Size2 get_video_mode(int p_screen = 0) const;
|
|
|
|
bool is_video_mode_fullscreen(int p_screen = 0) const;
|
|
|
|
bool is_video_mode_resizable(int p_screen = 0) const;
|
|
|
|
Array get_fullscreen_mode_list(int p_screen = 0) const;
|
2015-03-22 23:00:50 +01:00
|
|
|
|
2015-01-11 11:52:42 +01:00
|
|
|
virtual int get_screen_count() const;
|
2015-03-22 23:00:50 +01:00
|
|
|
virtual int get_current_screen() const;
|
|
|
|
virtual void set_current_screen(int p_screen);
|
2017-08-20 21:12:29 +02:00
|
|
|
virtual Point2 get_screen_position(int p_screen = -1) const;
|
|
|
|
virtual Size2 get_screen_size(int p_screen = -1) const;
|
|
|
|
virtual int get_screen_dpi(int p_screen = -1) const;
|
2015-01-11 08:47:27 +01:00
|
|
|
virtual Point2 get_window_position() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void set_window_position(const Point2 &p_position);
|
2015-01-11 10:36:56 +01:00
|
|
|
virtual Size2 get_window_size() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void set_window_size(const Size2 &p_size);
|
2015-03-22 23:00:50 +01:00
|
|
|
virtual void set_window_fullscreen(bool p_enabled);
|
|
|
|
virtual bool is_window_fullscreen() const;
|
|
|
|
virtual void set_window_resizable(bool p_enabled);
|
|
|
|
virtual bool is_window_resizable() const;
|
|
|
|
virtual void set_window_minimized(bool p_enabled);
|
|
|
|
virtual bool is_window_minimized() const;
|
|
|
|
virtual void set_window_maximized(bool p_enabled);
|
|
|
|
virtual bool is_window_maximized() const;
|
2016-07-05 17:29:08 +02:00
|
|
|
virtual void request_attention();
|
2015-03-22 23:00:50 +01:00
|
|
|
|
2016-01-03 05:18:28 +01:00
|
|
|
virtual void set_borderless_window(bool p_borderless);
|
|
|
|
virtual bool get_borderless_window() const;
|
2015-01-10 08:47:34 +01:00
|
|
|
|
2017-06-25 17:50:45 +02:00
|
|
|
virtual void set_ime_position(const Point2 &p_pos);
|
|
|
|
|
2014-11-17 11:46:11 +01:00
|
|
|
Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
|
2014-03-14 02:57:24 +01:00
|
|
|
bool native_video_is_playing();
|
|
|
|
void native_video_pause();
|
2016-02-19 05:09:06 +01:00
|
|
|
void native_video_unpause();
|
2014-03-14 02:57:24 +01:00
|
|
|
void native_video_stop();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void set_low_processor_usage_mode(bool p_enabled);
|
|
|
|
bool is_in_low_processor_usage_mode() const;
|
|
|
|
|
|
|
|
String get_executable_path() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
int execute(const String &p_path, const Vector<String> &p_arguments, bool p_blocking, Array p_output = Array());
|
2014-06-30 04:24:05 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
Error kill(int p_pid);
|
|
|
|
Error shell_open(String p_uri);
|
|
|
|
|
2017-08-07 12:17:31 +02:00
|
|
|
int get_process_id() const;
|
2014-04-05 17:39:30 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool has_environment(const String &p_var) const;
|
|
|
|
String get_environment(const String &p_var) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
String get_name() const;
|
|
|
|
Vector<String> get_cmdline_args();
|
|
|
|
|
|
|
|
String get_locale() const;
|
2016-07-02 20:52:36 +02:00
|
|
|
String get_latin_keyboard_variant() const;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
String get_model_name() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void dump_memory_to_file(const String &p_file);
|
|
|
|
void dump_resources_to_file(const String &p_file);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-07-21 23:58:58 +02:00
|
|
|
bool has_virtual_keyboard() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void show_virtual_keyboard(const String &p_existing_text = "");
|
2016-07-21 23:58:58 +02:00
|
|
|
void hide_virtual_keyboard();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void print_resources_in_use(bool p_short = false);
|
|
|
|
void print_all_resources(const String &p_to_file);
|
2014-02-26 14:08:17 +01:00
|
|
|
void print_all_textures_by_size();
|
2017-03-05 16:44:50 +01:00
|
|
|
void print_resources_by_type(const Vector<String> &p_types);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
bool has_touchscreen_ui_hint() const;
|
|
|
|
|
2014-11-02 15:31:01 +01:00
|
|
|
bool is_debug_build() const;
|
|
|
|
|
2017-08-07 12:17:31 +02:00
|
|
|
String get_unique_id() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2015-05-17 18:11:55 +02:00
|
|
|
String get_scancode_string(uint32_t p_code) const;
|
|
|
|
bool is_scancode_unicode(uint32_t p_unicode) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
int find_scancode_from_string(const String &p_code) const;
|
2015-05-17 18:11:55 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/*
|
|
|
|
struct Date {
|
|
|
|
|
|
|
|
int year;
|
|
|
|
Month month;
|
|
|
|
int day;
|
|
|
|
Weekday weekday;
|
|
|
|
bool dst;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Time {
|
|
|
|
|
|
|
|
int hour;
|
|
|
|
int min;
|
|
|
|
int sec;
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
2014-08-02 03:10:38 +02:00
|
|
|
void set_use_file_access_save_and_swap(bool p_enable);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-05-17 12:36:47 +02:00
|
|
|
void set_icon(const Ref<Image> &p_icon);
|
2017-01-07 18:55:48 +01:00
|
|
|
|
|
|
|
int get_exit_code() const;
|
|
|
|
void set_exit_code(int p_code);
|
2015-06-06 03:40:56 +02:00
|
|
|
Dictionary get_date(bool utc) const;
|
|
|
|
Dictionary get_time(bool utc) const;
|
2016-03-16 05:17:10 +01:00
|
|
|
Dictionary get_datetime(bool utc) const;
|
|
|
|
Dictionary get_datetime_from_unix_time(uint64_t unix_time_val) const;
|
|
|
|
uint64_t get_unix_time_from_datetime(Dictionary datetime) const;
|
2015-06-06 05:35:38 +02:00
|
|
|
Dictionary get_time_zone_info() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
uint64_t get_unix_time() const;
|
2016-01-10 22:24:55 +01:00
|
|
|
uint64_t get_system_time_secs() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
int get_static_memory_usage() const;
|
|
|
|
int get_static_memory_peak_usage() const;
|
|
|
|
int get_dynamic_memory_usage() const;
|
|
|
|
|
|
|
|
void delay_usec(uint32_t p_usec) const;
|
|
|
|
void delay_msec(uint32_t p_msec) const;
|
|
|
|
uint32_t get_ticks_msec() const;
|
2015-04-12 22:55:01 +02:00
|
|
|
uint32_t get_splash_tick_msec() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-03-14 02:57:24 +01:00
|
|
|
bool can_use_threads() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
bool can_draw() const;
|
|
|
|
|
2017-10-02 16:09:24 +02:00
|
|
|
bool is_userfs_persistent() const;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
bool is_stdout_verbose() const;
|
|
|
|
|
|
|
|
int get_processor_count() const;
|
|
|
|
|
2014-12-02 18:02:41 +01:00
|
|
|
enum SystemDir {
|
|
|
|
SYSTEM_DIR_DESKTOP,
|
|
|
|
SYSTEM_DIR_DCIM,
|
|
|
|
SYSTEM_DIR_DOCUMENTS,
|
|
|
|
SYSTEM_DIR_DOWNLOADS,
|
|
|
|
SYSTEM_DIR_MOVIES,
|
|
|
|
SYSTEM_DIR_MUSIC,
|
|
|
|
SYSTEM_DIR_PICTURES,
|
|
|
|
SYSTEM_DIR_RINGTONES,
|
|
|
|
};
|
|
|
|
|
2015-08-04 23:09:51 +02:00
|
|
|
enum ScreenOrientation {
|
|
|
|
|
|
|
|
SCREEN_ORIENTATION_LANDSCAPE,
|
|
|
|
SCREEN_ORIENTATION_PORTRAIT,
|
|
|
|
SCREEN_ORIENTATION_REVERSE_LANDSCAPE,
|
|
|
|
SCREEN_ORIENTATION_REVERSE_PORTRAIT,
|
|
|
|
SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
|
|
|
|
SCREEN_ORIENTATION_SENSOR_PORTRAIT,
|
|
|
|
SCREEN_ORIENTATION_SENSOR,
|
|
|
|
};
|
|
|
|
|
2014-12-02 18:02:41 +01:00
|
|
|
String get_system_dir(SystemDir p_dir) const;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
String get_data_dir() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void alert(const String &p_alert, const String &p_title = "ALERT!");
|
2015-09-21 14:39:46 +02:00
|
|
|
|
2015-08-04 23:09:51 +02:00
|
|
|
void set_screen_orientation(ScreenOrientation p_orientation);
|
|
|
|
ScreenOrientation get_screen_orientation() const;
|
|
|
|
|
2015-11-27 15:40:04 +01:00
|
|
|
void set_keep_screen_on(bool p_enabled);
|
|
|
|
bool is_keep_screen_on() const;
|
|
|
|
|
2015-02-15 05:19:46 +01:00
|
|
|
bool is_ok_left_and_cancel_right() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error set_thread_name(const String &p_name);
|
2016-02-01 00:22:38 +01:00
|
|
|
|
2016-06-06 00:14:33 +02:00
|
|
|
void set_use_vsync(bool p_enable);
|
2016-11-08 15:06:57 +01:00
|
|
|
bool is_vsync_enabled() const;
|
2016-06-06 00:14:33 +02:00
|
|
|
|
2017-09-16 12:28:23 +02:00
|
|
|
PowerState get_power_state();
|
2016-07-23 13:15:55 +02:00
|
|
|
int get_power_seconds_left();
|
|
|
|
int get_power_percent_left();
|
|
|
|
|
2017-10-02 21:38:39 +02:00
|
|
|
bool has_feature(const String &p_feature) const;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
static _OS *get_singleton() { return singleton; }
|
|
|
|
|
|
|
|
_OS();
|
|
|
|
};
|
|
|
|
|
2017-09-16 12:28:23 +02:00
|
|
|
VARIANT_ENUM_CAST(_OS::PowerState);
|
2017-08-20 17:45:01 +02:00
|
|
|
VARIANT_ENUM_CAST(_OS::Weekday);
|
|
|
|
VARIANT_ENUM_CAST(_OS::Month);
|
2014-12-02 18:02:41 +01:00
|
|
|
VARIANT_ENUM_CAST(_OS::SystemDir);
|
2015-08-04 23:09:51 +02:00
|
|
|
VARIANT_ENUM_CAST(_OS::ScreenOrientation);
|
2014-12-02 18:02:41 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
class _Geometry : public Object {
|
|
|
|
|
2017-01-03 03:03:46 +01:00
|
|
|
GDCLASS(_Geometry, Object);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
static _Geometry *singleton;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
protected:
|
2014-02-10 02:10:30 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2014-02-10 02:10:30 +01:00
|
|
|
static _Geometry *get_singleton();
|
2017-03-05 16:44:50 +01:00
|
|
|
PoolVector<Plane> build_box_planes(const Vector3 &p_extents);
|
|
|
|
PoolVector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z);
|
|
|
|
PoolVector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z);
|
|
|
|
Variant segment_intersects_segment_2d(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b);
|
|
|
|
PoolVector<Vector2> get_closest_points_between_segments_2d(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2);
|
|
|
|
PoolVector<Vector3> get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2);
|
|
|
|
Vector2 get_closest_point_to_segment_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b);
|
|
|
|
Vector3 get_closest_point_to_segment(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b);
|
|
|
|
Vector2 get_closest_point_to_segment_uncapped_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b);
|
|
|
|
Vector3 get_closest_point_to_segment_uncapped(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b);
|
|
|
|
Variant ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2);
|
|
|
|
Variant segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2);
|
|
|
|
bool point_is_inside_triangle(const Vector2 &s, const Vector2 &a, const Vector2 &b, const Vector2 &c) const;
|
|
|
|
|
|
|
|
PoolVector<Vector3> segment_intersects_sphere(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_sphere_pos, real_t p_sphere_radius);
|
|
|
|
PoolVector<Vector3> segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius);
|
|
|
|
PoolVector<Vector3> segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const Vector<Plane> &p_planes);
|
|
|
|
real_t segment_intersects_circle(const Vector2 &p_from, const Vector2 &p_to, const Vector2 &p_circle_pos, real_t p_circle_radius);
|
|
|
|
int get_uv84_normal_bit(const Vector3 &p_vector);
|
|
|
|
|
|
|
|
Vector<int> triangulate_polygon(const Vector<Vector2> &p_polygon);
|
|
|
|
|
|
|
|
Dictionary make_atlas(const Vector<Size2> &p_rects);
|
2014-10-03 05:10:51 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
_Geometry();
|
|
|
|
};
|
|
|
|
|
|
|
|
class _File : public Reference {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(_File, Reference);
|
2014-02-10 02:10:30 +01:00
|
|
|
FileAccess *f;
|
|
|
|
bool eswap;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
protected:
|
2014-02-10 02:10:30 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
|
|
|
enum ModeFlags {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
READ = 1,
|
|
|
|
WRITE = 2,
|
|
|
|
READ_WRITE = 3,
|
|
|
|
WRITE_READ = 7,
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-06-19 18:28:00 +02:00
|
|
|
enum CompressionMode {
|
|
|
|
COMPRESSION_FASTLZ = Compression::MODE_FASTLZ,
|
|
|
|
COMPRESSION_DEFLATE = Compression::MODE_DEFLATE,
|
2017-07-13 19:41:10 +02:00
|
|
|
COMPRESSION_ZSTD = Compression::MODE_ZSTD,
|
|
|
|
COMPRESSION_GZIP = Compression::MODE_GZIP
|
2017-06-19 18:28:00 +02:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error open_encrypted(const String &p_path, int p_mode_flags, const Vector<uint8_t> &p_key);
|
|
|
|
Error open_encrypted_pass(const String &p_path, int p_mode_flags, const String &p_pass);
|
2017-06-19 18:28:00 +02:00
|
|
|
Error open_compressed(const String &p_path, int p_mode_flags, int p_compress_mode = 0);
|
2014-04-15 03:43:44 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error open(const String &p_path, int p_mode_flags); ///< open a file
|
2014-02-10 02:10:30 +01:00
|
|
|
void close(); ///< close a file
|
|
|
|
bool is_open() const; ///< true when file is open
|
|
|
|
|
|
|
|
void seek(int64_t p_position); ///< seek to a given position
|
2017-03-05 16:44:50 +01:00
|
|
|
void seek_end(int64_t p_position = 0); ///< seek from the end of file
|
2017-09-10 15:37:49 +02:00
|
|
|
int64_t get_position() const; ///< get position in the file
|
2014-02-10 02:10:30 +01:00
|
|
|
int64_t get_len() const; ///< get size of the file
|
|
|
|
|
|
|
|
bool eof_reached() const; ///< reading passed EOF
|
|
|
|
|
|
|
|
uint8_t get_8() const; ///< get a byte
|
|
|
|
uint16_t get_16() const; ///< get 16 bits uint
|
|
|
|
uint32_t get_32() const; ///< get 32 bits uint
|
|
|
|
uint64_t get_64() const; ///< get 64 bits uint
|
|
|
|
|
|
|
|
float get_float() const;
|
|
|
|
double get_double() const;
|
|
|
|
real_t get_real() const;
|
|
|
|
|
|
|
|
Variant get_var() const;
|
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<uint8_t> get_buffer(int p_length) const; ///< get an array of bytes
|
2014-02-10 02:10:30 +01:00
|
|
|
String get_line() const;
|
|
|
|
String get_as_text() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
String get_md5(const String &p_path) const;
|
|
|
|
String get_sha256(const String &p_path) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/**< use this for files WRITTEN in _big_ endian machines (ie, amiga/mac)
|
|
|
|
* It's not about the current CPU type but file formats.
|
|
|
|
* this flags get reset to false (little endian) on each open
|
|
|
|
*/
|
|
|
|
|
|
|
|
void set_endian_swap(bool p_swap);
|
|
|
|
bool get_endian_swap();
|
|
|
|
|
|
|
|
Error get_error() const; ///< get last error
|
|
|
|
|
|
|
|
void store_8(uint8_t p_dest); ///< store a byte
|
|
|
|
void store_16(uint16_t p_dest); ///< store 16 bits uint
|
|
|
|
void store_32(uint32_t p_dest); ///< store 32 bits uint
|
|
|
|
void store_64(uint64_t p_dest); ///< store 64 bits uint
|
|
|
|
|
|
|
|
void store_float(float p_dest);
|
|
|
|
void store_double(double p_dest);
|
|
|
|
void store_real(real_t p_real);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void store_string(const String &p_string);
|
|
|
|
void store_line(const String &p_string);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void store_pascal_string(const String &p_string);
|
2014-03-14 02:57:24 +01:00
|
|
|
virtual String get_pascal_string();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<String> get_csv_line(String delim = ",") const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void store_buffer(const PoolVector<uint8_t> &p_buffer); ///< store an array of bytes
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void store_var(const Variant &p_var);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool file_exists(const String &p_name) const; ///< return true if a file exists
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
uint64_t get_modified_time(const String &p_file) const;
|
2017-01-23 22:33:02 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
_File();
|
|
|
|
virtual ~_File();
|
|
|
|
};
|
|
|
|
|
2017-08-20 17:45:01 +02:00
|
|
|
VARIANT_ENUM_CAST(_File::ModeFlags);
|
|
|
|
VARIANT_ENUM_CAST(_File::CompressionMode);
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
class _Directory : public Reference {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(_Directory, Reference);
|
2014-02-10 02:10:30 +01:00
|
|
|
DirAccess *d;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
protected:
|
2014-02-10 02:10:30 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
|
|
|
Error open(const String &p_path);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-08-11 21:10:05 +02:00
|
|
|
Error list_dir_begin(bool p_skip_navigational = false, bool p_skip_hidden = false); ///< This starts dir listing
|
2014-02-10 02:10:30 +01:00
|
|
|
String get_next();
|
|
|
|
bool current_is_dir() const;
|
|
|
|
|
|
|
|
void list_dir_end(); ///<
|
|
|
|
|
|
|
|
int get_drive_count();
|
|
|
|
String get_drive(int p_drive);
|
2017-01-14 17:01:43 +01:00
|
|
|
int get_current_drive();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
Error change_dir(String p_dir); ///< can be relative or absolute, return false on success
|
|
|
|
String get_current_dir(); ///< return current dir location
|
|
|
|
|
|
|
|
Error make_dir(String p_dir);
|
|
|
|
Error make_dir_recursive(String p_dir);
|
|
|
|
|
|
|
|
bool file_exists(String p_file);
|
2014-05-25 05:34:51 +02:00
|
|
|
bool dir_exists(String p_dir);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
int get_space_left();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error copy(String p_from, String p_to);
|
2014-02-10 02:10:30 +01:00
|
|
|
Error rename(String p_from, String p_to);
|
|
|
|
Error remove(String p_name);
|
|
|
|
|
|
|
|
_Directory();
|
|
|
|
virtual ~_Directory();
|
|
|
|
|
2017-01-16 23:19:43 +01:00
|
|
|
private:
|
|
|
|
bool _list_skip_navigational;
|
|
|
|
bool _list_skip_hidden;
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class _Marshalls : public Reference {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(_Marshalls, Reference);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
static _Marshalls *singleton;
|
2016-11-05 17:13:04 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2017-03-05 16:44:50 +01:00
|
|
|
static _Marshalls *get_singleton();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String variant_to_base64(const Variant &p_var);
|
|
|
|
Variant base64_to_variant(const String &p_str);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String raw_to_base64(const PoolVector<uint8_t> &p_arr);
|
|
|
|
PoolVector<uint8_t> base64_to_raw(const String &p_str);
|
2015-07-28 12:50:52 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String utf8_to_base64(const String &p_str);
|
|
|
|
String base64_to_utf8(const String &p_str);
|
2015-07-28 12:50:52 +02:00
|
|
|
|
2016-11-05 17:13:04 +01:00
|
|
|
_Marshalls() { singleton = this; }
|
|
|
|
~_Marshalls() { singleton = NULL; }
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class _Mutex : public Reference {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(_Mutex, Reference);
|
2014-02-10 02:10:30 +01:00
|
|
|
Mutex *mutex;
|
|
|
|
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2014-02-10 02:10:30 +01:00
|
|
|
void lock();
|
|
|
|
Error try_lock();
|
|
|
|
void unlock();
|
|
|
|
|
|
|
|
_Mutex();
|
|
|
|
~_Mutex();
|
|
|
|
};
|
|
|
|
|
|
|
|
class _Semaphore : public Reference {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(_Semaphore, Reference);
|
2014-02-10 02:10:30 +01:00
|
|
|
Semaphore *semaphore;
|
|
|
|
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2014-02-10 02:10:30 +01:00
|
|
|
Error wait();
|
|
|
|
Error post();
|
|
|
|
|
|
|
|
_Semaphore();
|
|
|
|
~_Semaphore();
|
|
|
|
};
|
|
|
|
|
|
|
|
class _Thread : public Reference {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(_Thread, Reference);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Variant ret;
|
|
|
|
Variant userdata;
|
|
|
|
volatile bool active;
|
|
|
|
Object *target_instance;
|
|
|
|
StringName target_method;
|
|
|
|
Thread *thread;
|
|
|
|
static void _bind_methods();
|
|
|
|
static void _start_func(void *ud);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2014-02-10 02:10:30 +01:00
|
|
|
enum Priority {
|
|
|
|
|
|
|
|
PRIORITY_LOW,
|
|
|
|
PRIORITY_NORMAL,
|
|
|
|
PRIORITY_HIGH
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error start(Object *p_instance, const StringName &p_method, const Variant &p_userdata = Variant(), int p_priority = PRIORITY_NORMAL);
|
2014-02-10 02:10:30 +01:00
|
|
|
String get_id() const;
|
|
|
|
bool is_active() const;
|
|
|
|
Variant wait_to_finish();
|
|
|
|
|
|
|
|
_Thread();
|
|
|
|
~_Thread();
|
|
|
|
};
|
|
|
|
|
2017-08-20 17:45:01 +02:00
|
|
|
VARIANT_ENUM_CAST(_Thread::Priority);
|
|
|
|
|
2017-01-03 03:03:46 +01:00
|
|
|
class _ClassDB : public Object {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(_ClassDB, Object)
|
2017-01-03 03:03:46 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2017-01-11 04:52:51 +01:00
|
|
|
PoolStringArray get_class_list() const;
|
2017-03-05 16:44:50 +01:00
|
|
|
PoolStringArray get_inheriters_from_class(const StringName &p_class) const;
|
|
|
|
StringName get_parent_class(const StringName &p_class) const;
|
2017-01-03 03:03:46 +01:00
|
|
|
bool class_exists(const StringName &p_class) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
bool is_parent_class(const StringName &p_class, const StringName &p_inherits) const;
|
2017-01-03 03:03:46 +01:00
|
|
|
bool can_instance(const StringName &p_class) const;
|
|
|
|
Variant instance(const StringName &p_class) const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool has_signal(StringName p_class, StringName p_signal) const;
|
|
|
|
Dictionary get_signal(StringName p_class, StringName p_signal) const;
|
|
|
|
Array get_signal_list(StringName p_class, bool p_no_inheritance = false) const;
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Array get_property_list(StringName p_class, bool p_no_inheritance = false) const;
|
2017-04-09 13:26:48 +02:00
|
|
|
Variant get_property(Object *p_object, const StringName &p_property) const;
|
|
|
|
Error set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const;
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool has_method(StringName p_class, StringName p_method, bool p_no_inheritance = false) const;
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Array get_method_list(StringName p_class, bool p_no_inheritance = false) const;
|
2017-01-03 03:03:46 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
PoolStringArray get_integer_constant_list(const StringName &p_class, bool p_no_inheritance = false) const;
|
|
|
|
bool has_integer_constant(const StringName &p_class, const StringName &p_name) const;
|
|
|
|
int get_integer_constant(const StringName &p_class, const StringName &p_name) const;
|
|
|
|
StringName get_category(const StringName &p_node) const;
|
2017-01-03 03:03:46 +01:00
|
|
|
|
|
|
|
bool is_class_enabled(StringName p_class) const;
|
|
|
|
|
|
|
|
_ClassDB();
|
|
|
|
~_ClassDB();
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
class _Engine : public Object {
|
|
|
|
GDCLASS(_Engine, Object);
|
2017-01-13 16:51:14 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
static _Engine *singleton;
|
|
|
|
|
|
|
|
public:
|
2017-03-05 16:44:50 +01:00
|
|
|
static _Engine *get_singleton() { return singleton; }
|
2017-01-13 16:51:14 +01:00
|
|
|
void set_iterations_per_second(int p_ips);
|
|
|
|
int get_iterations_per_second() const;
|
|
|
|
|
|
|
|
void set_target_fps(int p_fps);
|
|
|
|
float get_target_fps() const;
|
|
|
|
|
|
|
|
float get_frames_per_second() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
int get_frames_drawn();
|
2017-01-13 16:51:14 +01:00
|
|
|
|
|
|
|
void set_time_scale(float p_scale);
|
|
|
|
float get_time_scale();
|
|
|
|
|
|
|
|
MainLoop *get_main_loop() const;
|
|
|
|
|
2017-01-13 18:25:43 +01:00
|
|
|
Dictionary get_version_info() const;
|
2017-01-13 16:51:14 +01:00
|
|
|
|
2017-09-30 16:19:07 +02:00
|
|
|
bool is_in_physics_frame() const;
|
2017-06-13 17:49:28 +02:00
|
|
|
|
2017-08-13 16:21:45 +02:00
|
|
|
void set_editor_hint(bool p_enabled);
|
|
|
|
bool is_editor_hint() const;
|
|
|
|
|
2017-01-13 16:51:14 +01:00
|
|
|
_Engine();
|
|
|
|
};
|
|
|
|
|
2017-09-15 15:40:27 +02:00
|
|
|
class _JSON;
|
|
|
|
|
|
|
|
class JSONParseResult : public Reference {
|
|
|
|
GDCLASS(JSONParseResult, Reference)
|
|
|
|
|
|
|
|
friend class _JSON;
|
|
|
|
|
|
|
|
Error error;
|
|
|
|
String error_string;
|
|
|
|
int error_line;
|
|
|
|
|
|
|
|
Variant result;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void set_error(Error p_error);
|
|
|
|
Error get_error() const;
|
|
|
|
|
|
|
|
void set_error_string(const String &p_error_string);
|
|
|
|
String get_error_string() const;
|
|
|
|
|
|
|
|
void set_error_line(int p_error_line);
|
|
|
|
int get_error_line() const;
|
|
|
|
|
|
|
|
void set_result(const Variant &p_result);
|
|
|
|
Variant get_result() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
class _JSON : public Object {
|
|
|
|
GDCLASS(_JSON, Object)
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
static _JSON *singleton;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static _JSON *get_singleton() { return singleton; }
|
|
|
|
|
|
|
|
String print(const Variant &p_value);
|
|
|
|
Ref<JSONParseResult> parse(const String &p_json);
|
|
|
|
|
|
|
|
_JSON();
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#endif // CORE_BIND_H
|