37 lines
873 B
C++
37 lines
873 B
C++
#pragma once
|
|
|
|
#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 TextData;
|
|
class SceneText;
|
|
|
|
struct ID2D1DeviceContext2;
|
|
struct ID2D1SolidColorBrush;
|
|
struct IDWriteFactory;
|
|
|
|
class DirectXTextPainter
|
|
{
|
|
public:
|
|
DirectXTextPainter();
|
|
|
|
void initialize(ID2D1DeviceContext2* d2dContext, IDWriteFactory* directWriteFactory);
|
|
|
|
void paint(SceneText* text, DrawingContext* context, ID2D1DeviceContext2* d2dContext, IDWriteFactory* directWriteFactory);
|
|
|
|
private:
|
|
void initializeBrush(ID2D1DeviceContext2* d2dContext);
|
|
void updateTextFormat(IDWriteFactory* directWriteFactory, float fontSize);
|
|
|
|
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> mTextBrush;
|
|
Microsoft::WRL::ComPtr<IDWriteTextFormat> mTextFormat;
|
|
};
|