Skip to content

Commit

Permalink
Merge pull request #51627 from mhilbrunner/todo-for-neikeq
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Aug 18, 2021
2 parents a619a92 + 5161c97 commit de7b6d1
Show file tree
Hide file tree
Showing 26 changed files with 1,008 additions and 1,055 deletions.
1,422 changes: 715 additions & 707 deletions core/core_bind.cpp

Large diffs are not rendered by default.

176 changes: 92 additions & 84 deletions core/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@
#include "core/os/thread.h"
#include "core/templates/safe_refcount.h"

class _ResourceLoader : public Object {
GDCLASS(_ResourceLoader, Object);
class MainLoop;

namespace core_bind {

class ResourceLoader : public Object {
GDCLASS(ResourceLoader, Object);

protected:
static void _bind_methods();
static _ResourceLoader *singleton;
static ResourceLoader *singleton;

public:
enum ThreadLoadStatus {
Expand All @@ -63,7 +67,7 @@ class _ResourceLoader : public Object {
CACHE_MODE_REPLACE, // Resource and subresource use path cache, but replace existing loaded resources when available with information from disk.
};

static _ResourceLoader *get_singleton() { return singleton; }
static ResourceLoader *get_singleton() { return singleton; }

Error load_threaded_request(const String &p_path, const String &p_type_hint = "", bool p_use_sub_threads = false);
ThreadLoadStatus load_threaded_get_status(const String &p_path, Array r_progress = Array());
Expand All @@ -77,18 +81,15 @@ class _ResourceLoader : public Object {
bool exists(const String &p_path, const String &p_type_hint = "");
ResourceUID::ID get_resource_uid(const String &p_path);

_ResourceLoader() { singleton = this; }
ResourceLoader() { singleton = this; }
};

VARIANT_ENUM_CAST(_ResourceLoader::ThreadLoadStatus);
VARIANT_ENUM_CAST(_ResourceLoader::CacheMode);

class _ResourceSaver : public Object {
GDCLASS(_ResourceSaver, Object);
class ResourceSaver : public Object {
GDCLASS(ResourceSaver, Object);

protected:
static void _bind_methods();
static _ResourceSaver *singleton;
static ResourceSaver *singleton;

public:
enum SaverFlags {
Expand All @@ -101,24 +102,20 @@ class _ResourceSaver : public Object {
FLAG_REPLACE_SUBRESOURCE_PATHS = 64,
};

static _ResourceSaver *get_singleton() { return singleton; }
static ResourceSaver *get_singleton() { return singleton; }

Error save(const String &p_path, const RES &p_resource, SaverFlags p_flags);
Vector<String> get_recognized_extensions(const RES &p_resource);

_ResourceSaver() { singleton = this; }
ResourceSaver() { singleton = this; }
};

VARIANT_ENUM_CAST(_ResourceSaver::SaverFlags);

class MainLoop;

class _OS : public Object {
GDCLASS(_OS, Object);
class OS : public Object {
GDCLASS(OS, Object);

protected:
static void _bind_methods();
static _OS *singleton;
static OS *singleton;

public:
enum VideoDriver {
Expand Down Expand Up @@ -245,26 +242,21 @@ class _OS : public Object {
bool request_permissions();
Vector<String> get_granted_permissions() const;

static _OS *get_singleton() { return singleton; }
static OS *get_singleton() { return singleton; }

_OS() { singleton = this; }
OS() { singleton = this; }
};

VARIANT_ENUM_CAST(_OS::VideoDriver);
VARIANT_ENUM_CAST(_OS::Weekday);
VARIANT_ENUM_CAST(_OS::Month);
VARIANT_ENUM_CAST(_OS::SystemDir);
class Geometry2D : public Object {
GDCLASS(Geometry2D, Object);

class _Geometry2D : public Object {
GDCLASS(_Geometry2D, Object);

static _Geometry2D *singleton;
static Geometry2D *singleton;

protected:
static void _bind_methods();

public:
static _Geometry2D *get_singleton();
static Geometry2D *get_singleton();
Variant segment_intersects_segment(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b);
Variant line_intersects_line(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b);
Vector<Vector2> get_closest_points_between_segments(const Vector2 &p1, const Vector2 &q1, const Vector2 &p2, const Vector2 &q2);
Expand Down Expand Up @@ -315,23 +307,19 @@ class _Geometry2D : public Object {

Dictionary make_atlas(const Vector<Size2> &p_rects);

_Geometry2D() { singleton = this; }
Geometry2D() { singleton = this; }
};

VARIANT_ENUM_CAST(_Geometry2D::PolyBooleanOperation);
VARIANT_ENUM_CAST(_Geometry2D::PolyJoinType);
VARIANT_ENUM_CAST(_Geometry2D::PolyEndType);

class _Geometry3D : public Object {
GDCLASS(_Geometry3D, Object);
class Geometry3D : public Object {
GDCLASS(Geometry3D, Object);

static _Geometry3D *singleton;
static Geometry3D *singleton;

protected:
static void _bind_methods();

public:
static _Geometry3D *get_singleton();
static Geometry3D *get_singleton();
Vector<Plane> build_box_planes(const Vector3 &p_extents);
Vector<Plane> build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z);
Vector<Plane> build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z);
Expand All @@ -347,11 +335,11 @@ class _Geometry3D : public Object {

Vector<Vector3> clip_polygon(const Vector<Vector3> &p_points, const Plane &p_plane);

_Geometry3D() { singleton = this; }
Geometry3D() { singleton = this; }
};

class _File : public RefCounted {
GDCLASS(_File, RefCounted);
class File : public RefCounted {
GDCLASS(File, RefCounted);

FileAccess *f = nullptr;
bool big_endian = false;
Expand Down Expand Up @@ -445,15 +433,12 @@ class _File : public RefCounted {

uint64_t get_modified_time(const String &p_file) const;

_File() {}
virtual ~_File();
File() {}
virtual ~File();
};

VARIANT_ENUM_CAST(_File::ModeFlags);
VARIANT_ENUM_CAST(_File::CompressionMode);

class _Directory : public RefCounted {
GDCLASS(_Directory, RefCounted);
class Directory : public RefCounted {
GDCLASS(Directory, RefCounted);
DirAccess *d;
bool dir_open = false;

Expand Down Expand Up @@ -490,24 +475,24 @@ class _Directory : public RefCounted {
Error rename(String p_from, String p_to);
Error remove(String p_name);

_Directory();
virtual ~_Directory();
Directory();
virtual ~Directory();

private:
bool _list_skip_navigational = false;
bool _list_skip_hidden = false;
};

class _Marshalls : public Object {
GDCLASS(_Marshalls, Object);
class Marshalls : public Object {
GDCLASS(Marshalls, Object);

static _Marshalls *singleton;
static Marshalls *singleton;

protected:
static void _bind_methods();

public:
static _Marshalls *get_singleton();
static Marshalls *get_singleton();

String variant_to_base64(const Variant &p_var, bool p_full_objects = false);
Variant base64_to_variant(const String &p_str, bool p_allow_objects = false);
Expand All @@ -518,13 +503,13 @@ class _Marshalls : public Object {
String utf8_to_base64(const String &p_str);
String base64_to_utf8(const String &p_str);

_Marshalls() { singleton = this; }
~_Marshalls() { singleton = nullptr; }
Marshalls() { singleton = this; }
~Marshalls() { singleton = nullptr; }
};

class _Mutex : public RefCounted {
GDCLASS(_Mutex, RefCounted);
Mutex mutex;
class Mutex : public RefCounted {
GDCLASS(Mutex, RefCounted);
::Mutex mutex;

static void _bind_methods();

Expand All @@ -534,9 +519,9 @@ class _Mutex : public RefCounted {
void unlock();
};

class _Semaphore : public RefCounted {
GDCLASS(_Semaphore, RefCounted);
Semaphore semaphore;
class Semaphore : public RefCounted {
GDCLASS(Semaphore, RefCounted);
::Semaphore semaphore;

static void _bind_methods();

Expand All @@ -546,16 +531,16 @@ class _Semaphore : public RefCounted {
void post();
};

class _Thread : public RefCounted {
GDCLASS(_Thread, RefCounted);
class Thread : public RefCounted {
GDCLASS(Thread, RefCounted);

protected:
Variant ret;
Variant userdata;
SafeFlag active;
Object *target_instance = nullptr;
StringName target_method;
Thread thread;
::Thread thread;
static void _bind_methods();
static void _start_func(void *ud);

Expand All @@ -573,10 +558,10 @@ class _Thread : public RefCounted {
Variant wait_to_finish();
};

VARIANT_ENUM_CAST(_Thread::Priority);
namespace special {

class _ClassDB : public Object {
GDCLASS(_ClassDB, Object);
class ClassDB : public Object {
GDCLASS(ClassDB, Object);

protected:
static void _bind_methods();
Expand Down Expand Up @@ -609,19 +594,21 @@ class _ClassDB : public Object {

bool is_class_enabled(StringName p_class) const;

_ClassDB() {}
~_ClassDB() {}
ClassDB() {}
~ClassDB() {}
};

class _Engine : public Object {
GDCLASS(_Engine, Object);
} // namespace special

class Engine : public Object {
GDCLASS(Engine, Object);

protected:
static void _bind_methods();
static _Engine *singleton;
static Engine *singleton;

public:
static _Engine *get_singleton() { return singleton; }
static Engine *get_singleton() { return singleton; }
void set_physics_ticks_per_second(int p_ips);
int get_physics_ticks_per_second() const;

Expand Down Expand Up @@ -661,14 +648,14 @@ class _Engine : public Object {
void set_print_error_messages(bool p_enabled);
bool is_printing_error_messages() const;

_Engine() { singleton = this; }
Engine() { singleton = this; }
};

class _EngineDebugger : public Object {
GDCLASS(_EngineDebugger, Object);
class EngineDebugger : public Object {
GDCLASS(EngineDebugger, Object);

class ProfilerCallable {
friend class _EngineDebugger;
friend class EngineDebugger;

Callable callable_toggle;
Callable callable_add;
Expand All @@ -689,10 +676,10 @@ class _EngineDebugger : public Object {

protected:
static void _bind_methods();
static _EngineDebugger *singleton;
static EngineDebugger *singleton;

public:
static _EngineDebugger *get_singleton() { return singleton; }
static EngineDebugger *get_singleton() { return singleton; }

bool is_active();

Expand All @@ -714,8 +701,29 @@ class _EngineDebugger : public Object {
static void call_tick(void *p_user, double p_frame_time, double p_idle_time, double p_physics_time, double p_physics_frame_time);
static Error call_capture(void *p_user, const String &p_cmd, const Array &p_data, bool &r_captured);

_EngineDebugger() { singleton = this; }
~_EngineDebugger();
EngineDebugger() { singleton = this; }
~EngineDebugger();
};

} // namespace core_bind

VARIANT_ENUM_CAST(core_bind::ResourceLoader::ThreadLoadStatus);
VARIANT_ENUM_CAST(core_bind::ResourceLoader::CacheMode);

VARIANT_ENUM_CAST(core_bind::ResourceSaver::SaverFlags);

VARIANT_ENUM_CAST(core_bind::OS::VideoDriver);
VARIANT_ENUM_CAST(core_bind::OS::Weekday);
VARIANT_ENUM_CAST(core_bind::OS::Month);
VARIANT_ENUM_CAST(core_bind::OS::SystemDir);

VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyBooleanOperation);
VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyJoinType);
VARIANT_ENUM_CAST(core_bind::Geometry2D::PolyEndType);

VARIANT_ENUM_CAST(core_bind::File::ModeFlags);
VARIANT_ENUM_CAST(core_bind::File::CompressionMode);

VARIANT_ENUM_CAST(core_bind::Thread::Priority);

#endif // CORE_BIND_H
Loading

0 comments on commit de7b6d1

Please sign in to comment.