2019-09-05 00:26:26 +08:00
|
|
|
#pragma once
|
|
|
|
#include <winrt/base.h>
|
|
|
|
#include <dwrite.h>
|
|
|
|
|
2020-03-05 18:07:06 +08:00
|
|
|
class D2DText
|
|
|
|
{
|
2019-09-05 00:26:26 +08:00
|
|
|
public:
|
2020-03-05 18:07:06 +08:00
|
|
|
D2DText(float text_size = 15.0f, float scale = 1.0f);
|
|
|
|
D2DText& resize(float text_size, float scale);
|
2020-05-27 22:58:47 +08:00
|
|
|
D2DText& set_alignment_left();
|
|
|
|
D2DText& set_alignment_center();
|
|
|
|
D2DText& set_alignment_right();
|
2020-03-05 18:07:06 +08:00
|
|
|
void write(ID2D1DeviceContext5* d2d_dc, D2D1_COLOR_F color, D2D1_RECT_F rect, std::wstring text);
|
|
|
|
|
2019-09-05 00:26:26 +08:00
|
|
|
private:
|
2020-03-05 18:07:06 +08:00
|
|
|
winrt::com_ptr<IDWriteFactory> factory;
|
|
|
|
winrt::com_ptr<IDWriteTextFormat> format;
|
2019-09-05 00:26:26 +08:00
|
|
|
};
|