Singleton class for calling debugging 2D methods. More...
#include <debug_draw_2d.h>
Public Member Functions | |
Color | get_empty_color () const |
void | set_debug_enabled (const bool &_state) |
bool | is_debug_enabled () const |
void | set_config (Ref< DebugDraw2DConfig > _cfg) |
Ref< DebugDraw2DConfig > | get_config () const |
void | set_custom_canvas (Control *_canvas) |
Control * | get_custom_canvas () const |
Ref< DebugDraw2DStats > | get_render_stats () |
void | clear_all () |
void | begin_text_group (String group_title, int group_priority=0, Color group_color=Colors::white_smoke, bool show_title=true, int title_size=14, int text_size=12) |
void | end_text_group () |
void | set_text (String key, Variant value=Variant(), int priority=0, Color color_of_value=Colors::empty_color, real_t duration=-1) |
void | clear_texts () |
Ref< DebugDraw2DGraph > | create_graph (const StringName &title) |
Ref< DebugDraw2DGraph > | create_fps_graph (const StringName &title) |
void | graph_update_data (const StringName &title, real_t data) |
void | remove_graph (const StringName &title) |
void | clear_graphs () |
Ref< DebugDraw2DGraph > | get_graph (const StringName &title) |
PackedStringArray | get_graph_names () |
Static Public Member Functions | |
static DebugDraw2D * | get_singleton () |
Singleton class for calling debugging 2D methods.
Currently, this class supports drawing an overlay with text and graphs.
|
inlinestatic |
Get singleton. Not available in GDScript.
Color DebugDraw2D::get_empty_color | ( | ) | const |
Get the color that is used as the default parameter for draw_*
calls.
void DebugDraw2D::set_debug_enabled | ( | const bool & | _state | ) |
Set whether debug drawing works or not.
void DebugDraw2D::set_config | ( | Ref< DebugDraw2DConfig > | _cfg | ) |
Set the configuration global for everything in DebugDraw2D.
Ref< DebugDraw2DConfig > DebugDraw2D::get_config | ( | ) | const |
Get the DebugDraw2DConfig.
void DebugDraw2D::set_custom_canvas | ( | Control * | _canvas | ) |
Set a custom Control to be used as the canvas for drawing the graphic.
You can use any Control, even one that is in a different window.
Ref< DebugDraw2DStats > DebugDraw2D::get_render_stats | ( | ) |
Returns the DebugDraw2DStats instance with the current statistics.
Some data can be delayed by 1 frame.
void DebugDraw2D::clear_all | ( | ) |
Clear all 2D objects
void DebugDraw2D::begin_text_group | ( | String | group_title, |
int | group_priority = 0, | ||
Color | group_color = Colors::white_smoke, | ||
bool | show_title = true, | ||
int | title_size = 14, | ||
int | text_size = 12 ) |
Begin a text group to which all of the following text from DebugDraw2D.set_text will be added
group_title | Group title and ID |
group_priority | Group priority based on which groups will be sorted from top to bottom. |
group_color | Main color of the group |
show_title | Whether to show the title |
title_size | Title font size |
text_size | Text font size |
void DebugDraw2D::end_text_group | ( | ) |
Ends the text group. Should be called after DebugDraw2D.begin_text_group.
If you need to create multiple groups, just call DebugDraw2D.begin_text_group again and this function at the end.
void DebugDraw2D::set_text | ( | String | key, |
Variant | value = Variant(), | ||
int | priority = 0, | ||
Color | color_of_value = Colors::empty_color, | ||
real_t | duration = -1 ) |
Add or update text in an overlay
key | Left value if 'value' is set, otherwise the entire string is 'key' |
value | Value of field |
priority | Priority of this line. Lower value is higher position |
color_of_value | Value color |
duration | Expiration time |
void DebugDraw2D::clear_texts | ( | ) |
Clear all text
Ref< DebugDraw2DGraph > DebugDraw2D::create_graph | ( | const StringName & | title | ) |
Create a new graph for the custom data.
Use DebugDraw2D.graph_update_data to update the values.
title | Title of the graph |
Ref< DebugDraw2DGraph > DebugDraw2D::create_fps_graph | ( | const StringName & | title | ) |
Create a new graph with FPS that will be automatically updated.
title | Title of the graph |
void DebugDraw2D::graph_update_data | ( | const StringName & | title, |
real_t | data ) |
Update custom graph data
title | Title of the graph |
data | New data |
void DebugDraw2D::remove_graph | ( | const StringName & | title | ) |
Delete a graph by its title
title | Title of the graph |
void DebugDraw2D::clear_graphs | ( | ) |
Remove all graphs
Ref< DebugDraw2DGraph > DebugDraw2D::get_graph | ( | const StringName & | title | ) |
Get the configuration for a graph.
title | Title of the graph |
PackedStringArray DebugDraw2D::get_graph_names | ( | ) |
Get a list of titles of all existing graphs.