#pragma once

#include "FontItem.h"
#include "Color.h"

#include <wrl.h>
#include <dwrite.h>
#include <d2d1_3.h>
#include <d2d1_1.h>
#include <d3d12.h>

#include <unordered_map>
#include <memory>

class DrawingContext;
class DirectXShaderProgram;
class DirectX2dInterface;

class TextData;
class SceneText;

struct ID2D1DeviceContext2;
struct ID2D1SolidColorBrush;
struct IDWriteFactory;

class DirectXTextPainter
{
public:
    DirectXTextPainter();

    void paint(SceneText* text, DrawingContext* context);

    void setD2dInterface(DirectX2dInterface* d2dIterface);

private:
    void updateTextFormat(SceneText* text);

    D2D1::ColorF toD2dColor(const Color& color);

    DirectX2dInterface* mD2dInterface{ nullptr };
    Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> mTextBrush;
    Microsoft::WRL::ComPtr<IDWriteTextFormat> mTextFormat;
};
