DebugCapture¶
Manages draw state in Debug2D.
Description¶
The class is used as a controller for Debug2D which allows to play back draw commands at specified snapshots recorded with Debug2D.capture, This is useful for things like visualizing algorithms step-by-step.
For example, you can rewind the drawing using left and right keys:
func _input(event):
if event.is_action_pressed("ui_left"):
Debug2D.get_capture().draw_prev()
elif event.is_action_pressed("ui_right"):
Debug2D.get_capture().draw_next()
Properties¶
bool | accumulate |
Methods¶
void | draw ( int index ) |
void | draw_next ( ) |
void | draw_prev ( ) |
int | get_count ( ) |
void | reset ( ) |
Property Descriptions¶
- bool accumulate
Setter | set_accumulate(value) |
Getter | is_accumulating() |
If true
, the drawing canvas won’t be cleared. Set this to false
if you need to draw each snapshot individually.
Method Descriptions¶
- void draw ( int index )
Draws a specific snapshot at index.
- void draw_next ( )
Draws a next snapshot.
- void draw_prev ( )
Draws a previous snapshot.
- int get_count ( )
Return the number of draw snapshots previously captured with Debug2D.capture.
- void reset ( )
Makes Debug2D to draw all snapshots if accumulate is true
, otherwise only the first snapshot will be drawn.