summaryrefslogtreecommitdiff
path: root/core/bind/core_bind.h
diff options
context:
space:
mode:
authorsimpu <id.simpu@gmail.com>2020-05-18 20:25:49 +0530
committersimpu <id.simpu@gmail.com>2020-08-26 11:24:51 +0530
commitea2eaf8c276e5d694aee075f8701467c3db76735 (patch)
tree35d4738a5d9769f2dc71d41b8407ac033e3e2c4a /core/bind/core_bind.h
parenta609b30ddb77bcc1c64008a7848da07b5448a10d (diff)
Added debugger plugin support
Changes: * EngineDebugger is exposed to gdscript. Game side of communication can be implemented through it. * EditorDebuggerPlugin is added which handles the editor side of communication.
Diffstat (limited to 'core/bind/core_bind.h')
-rw-r--r--core/bind/core_bind.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index a1fedf1bb8..a59fcda60c 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -715,4 +715,58 @@ public:
_JSON() { singleton = this; }
};
+class _EngineDebugger : public Object {
+ GDCLASS(_EngineDebugger, Object);
+
+ class ProfilerCallable {
+ friend class _EngineDebugger;
+
+ Callable callable_toggle;
+ Callable callable_add;
+ Callable callable_tick;
+
+ public:
+ ProfilerCallable() {}
+
+ ProfilerCallable(const Callable &p_toggle, const Callable &p_add, const Callable &p_tick) {
+ callable_toggle = p_toggle;
+ callable_add = p_add;
+ callable_tick = p_tick;
+ }
+ };
+
+ Map<StringName, Callable> captures;
+ Map<StringName, ProfilerCallable> profilers;
+
+protected:
+ static void _bind_methods();
+ static _EngineDebugger *singleton;
+
+public:
+ static _EngineDebugger *get_singleton() { return singleton; }
+
+ bool is_active();
+
+ void register_profiler(const StringName &p_name, const Callable &p_toggle, const Callable &p_add, const Callable &p_tick);
+ void unregister_profiler(const StringName &p_name);
+ bool is_profiling(const StringName &p_name);
+ bool has_profiler(const StringName &p_name);
+ void profiler_add_frame_data(const StringName &p_name, const Array &p_data);
+ void profiler_enable(const StringName &p_name, bool p_enabled, const Array &p_opts = Array());
+
+ void register_message_capture(const StringName &p_name, const Callable &p_callable);
+ void unregister_message_capture(const StringName &p_name);
+ bool has_capture(const StringName &p_name);
+
+ void send_message(const String &p_msg, const Array &p_data);
+
+ static void call_toggle(void *p_user, bool p_enable, const Array &p_opts);
+ static void call_add(void *p_user, const Array &p_data);
+ static void call_tick(void *p_user, float p_frame_time, float p_idle_time, float p_physics_time, float 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();
+};
+
#endif // CORE_BIND_H