# class hiro::Debugger

## Overview

API for rendering primitive debug objects. More…

    #include <Debugger.h>

    class Debugger: public hiro::Resource {
    public:
        // construction

        Debugger(const std::string& name);
        ~Debugger();

        // methods

        void DrawSphere(const geom::Sphere& sphere, const cogs::Color3f& color = cogs::color::LIME, float lifetime = 0.0f);
        void DrawBox(const geom::Aabb3& box, const cogs::Color3f& color = cogs::color::LIME, float lifetime = 0.0f);
        void DrawLines(const std::vector<geom::LineSegment3>& segments, const cogs::Color3f& color = cogs::color::LIME, float lifetime = 0.0f);
        void LogMessage(const std::string& text, float lifetime = 3.0f);
    };

### Inherited Members

    public:
        // fields

        const hiro::ResourceId ID;

        // methods

        virtual hiro::PGadget CreateGadget() = 0;
        void ResetGadgets();
        virtual void Update(float delta_time);

    protected:
        // methods

        void DrawOnNextUpdate() const;

## Detailed Documentation

API for rendering primitive debug objects.

### Construction

    Debugger(const std::string& name)

Default constructor, object is automatically created by the HIRO Engine and should not be created manually.

    ~Debugger()

Default destructor, properly removes the Impl pointer.

### Methods

    void DrawSphere(const geom::Sphere& sphere, const cogs::Color3f& color = cogs::color::LIME, float lifetime = 0.0f)

Draws a sphere for the lifetime seconds.

Parameters:

sphere | Sphere to be drawn.
color | Color to be used for the polygon wires.
lifetime | Lifetime in seconds, sphere will be removed after it expires. Value of 0 means visibility for one frame only.

    void DrawBox(const geom::Aabb3& box, const cogs::Color3f& color = cogs::color::LIME, float lifetime = 0.0f)

Draws a box for the lifetime seconds.

Parameters:

box | AABB box to be drawn.
color | Color to be used for the polygon wires.
lifetime | Lifetime in seconds, box will be removed after it expires. Value of 0 means visibility for one frame only.

    void DrawLines(const std::vector<geom::LineSegment3>& segments, const cogs::Color3f& color = cogs::color::LIME, float lifetime = 0.0f)

Draws given line segments for the lifetime seconds.

Parameters:

segments | Vector of line segments to be drawn.
color | Color to be used for the lines.
lifetime | Lifetime in seconds, lines will be removed after it expires. Value of 0 means visibility for one frame only.

    void LogMessage(const std::string& text, float lifetime = 3.0f)

Prints a debug text to the screen. Text will disappear when the time passes or when it is replaced by other print call.

Parameters:

text | Text to be printed.
lifetime | Lifetime in seconds, text will be removed after it expires. Value of 0 means visibility for one frame only.