Debug Draw 3D (and 2D) 1.4.5
Draw 3D debug graphics and 2D overlays with this add-on.
Loading...
Searching...
No Matches
DebugDraw2D Class Reference

Singleton class for calling debugging 2D methods. More...

#include <debug_draw_2d.h>

Inheritance diagram for DebugDraw2D:

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< DebugDraw2DConfigget_config () const
 
void set_custom_canvas (Control *_canvas)
 
Control * get_custom_canvas () const
 
Ref< DebugDraw2DStatsget_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< DebugDraw2DGraphcreate_graph (const StringName &title)
 
Ref< DebugDraw2DGraphcreate_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< DebugDraw2DGraphget_graph (const StringName &title)
 
PackedStringArray get_graph_names ()
 

Static Public Member Functions

static DebugDraw2Dget_singleton ()
 

Detailed Description

Singleton class for calling debugging 2D methods.

Currently, this class supports drawing an overlay with text and graphs.

Member Function Documentation

◆ get_singleton()

static DebugDraw2D * DebugDraw2D::get_singleton ( )
inlinestatic

Get singleton. Not available in GDScript.

◆ get_empty_color()

Color DebugDraw2D::get_empty_color ( ) const

Get the color that is used as the default parameter for draw_* calls.

◆ set_debug_enabled()

void DebugDraw2D::set_debug_enabled ( const bool & _state)

Set whether debug drawing works or not.

◆ set_config()

void DebugDraw2D::set_config ( Ref< DebugDraw2DConfig > _cfg)

Set the configuration global for everything in DebugDraw2D.

◆ get_config()

Ref< DebugDraw2DConfig > DebugDraw2D::get_config ( ) const

◆ set_custom_canvas()

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.

◆ get_render_stats()

Ref< DebugDraw2DStats > DebugDraw2D::get_render_stats ( )

Returns the DebugDraw2DStats instance with the current statistics.

Some data can be delayed by 1 frame.

◆ clear_all()

void DebugDraw2D::clear_all ( )

Clear all 2D objects

◆ begin_text_group()

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

Parameters
group_titleGroup title and ID
group_priorityGroup priority based on which groups will be sorted from top to bottom.
group_colorMain color of the group
show_titleWhether to show the title
title_sizeTitle font size
text_sizeText font size

◆ end_text_group()

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.

◆ set_text()

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

Parameters
keyLeft value if 'value' is set, otherwise the entire string is 'key'
valueValue of field
priorityPriority of this line. Lower value is higher position
color_of_valueValue color
durationExpiration time

◆ clear_texts()

void DebugDraw2D::clear_texts ( )

Clear all text

◆ create_graph()

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.

Parameters
titleTitle of the graph

◆ create_fps_graph()

Ref< DebugDraw2DGraph > DebugDraw2D::create_fps_graph ( const StringName & title)

Create a new graph with FPS that will be automatically updated.

Parameters
titleTitle of the graph

◆ graph_update_data()

void DebugDraw2D::graph_update_data ( const StringName & title,
real_t data )

Update custom graph data

Parameters
titleTitle of the graph
dataNew data

◆ remove_graph()

void DebugDraw2D::remove_graph ( const StringName & title)

Delete a graph by its title

Parameters
titleTitle of the graph

◆ clear_graphs()

void DebugDraw2D::clear_graphs ( )

Remove all graphs

◆ get_graph()

Ref< DebugDraw2DGraph > DebugDraw2D::get_graph ( const StringName & title)

Get the configuration for a graph.

Parameters
titleTitle of the graph

◆ get_graph_names()

PackedStringArray DebugDraw2D::get_graph_names ( )

Get a list of titles of all existing graphs.


The documentation for this class was generated from the following file: