# T4: Advanced Rendering

Warning

This tutorial is in construction.

While there are several renderer classes available for you to use in HIRO_DRAW library, sometimes, you may need a specific rendering implemented in your module. In this tutorial we learn how to derive and create custom renderer classes.

## Custom Renderer

A snippet of code simmilar to the one used in T2: Creating Custom Modules will be used. Now, however, the rendering will be done via new custom classes `MyRenderer` and `MyStyle` as shown bellow.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    class MyGadget : public hiro::Gadget
    {
    public:
      MyGadget(const hiro::Resource *res) : hiro::Gadget(res) {}

      virtual void Initialize() override
      {
        Gadget::Initialize();
        renderer_ = std::make_shared<MyRenderer>();
        style_ = std::make_shared<MyStyle>();
        this->AddRenderer(renderer_, style_);
      }

    private:
        PMyRenderer renderer_;
        PMyStyle style_;
    };