6#ifndef VCL_BGFX_TEXT_FONT_TEXT_BUFFER_MANAGER_H
7#define VCL_BGFX_TEXT_FONT_TEXT_BUFFER_MANAGER_H
9#include "font_manager.h"
13BGFX_HANDLE(TextBufferHandle)
15#define MAX_TEXT_BUFFER_COUNT 64
33 STYLE_UNDERLINE = 1 << 1,
34 STYLE_STRIKE_THROUGH = 1 << 2,
35 STYLE_BACKGROUND = 1 << 3,
44class TextBufferManager
47 TextBufferManager(FontManager* _fontManager);
50 TextBufferHandle createTextBuffer(uint32_t _type, BufferType::Enum _bufferType);
51 void destroyTextBuffer(TextBufferHandle _handle);
52 void submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId _id, int32_t _depth = 0);
54 void setStyle(TextBufferHandle _handle, uint32_t _flags = STYLE_NORMAL);
55 void setTextColor(TextBufferHandle _handle, uint32_t _rgba = 0x000000FF);
56 void setBackgroundColor(TextBufferHandle _handle, uint32_t _rgba = 0x000000FF);
58 void setOverlineColor(TextBufferHandle _handle, uint32_t _rgba = 0x000000FF);
59 void setUnderlineColor(TextBufferHandle _handle, uint32_t _rgba = 0x000000FF);
60 void setStrikeThroughColor(TextBufferHandle _handle, uint32_t _rgba = 0x000000FF);
62 void setOutlineWidth(TextBufferHandle _handle,
float _outlineWidth = 3.0f);
63 void setOutlineColor(TextBufferHandle _handle, uint32_t _rgba = 0x000000FF);
65 void setDropShadowOffset(TextBufferHandle _handle,
float _u,
float _v);
66 void setDropShadowColor(TextBufferHandle _handle, uint32_t _rgba = 0x000000FF);
67 void setDropShadowSoftener(TextBufferHandle _handle,
float smoother = 1.0f);
69 void setPenPosition(TextBufferHandle _handle,
float _x,
float _y);
72 void appendText(TextBufferHandle _handle, FontHandle _fontHandle,
const char* _string,
const char* _end = NULL);
75 void appendText(TextBufferHandle _handle, FontHandle _fontHandle,
const wchar_t* _string,
const wchar_t* _end = NULL);
78 void appendAtlasFace(TextBufferHandle _handle, uint16_t _faceIndex);
81 void clearTextBuffer(TextBufferHandle _handle);
84 TextRectangle getRectangle(TextBufferHandle _handle)
const;
89 uint16_t indexBufferHandleIdx;
90 uint16_t vertexBufferHandleIdx;
91 TextBuffer* textBuffer;
92 BufferType::Enum bufferType;
96 BufferCache* m_textBuffers;
97 bx::HandleAllocT<MAX_TEXT_BUFFER_COUNT> m_textBufferHandles;
98 FontManager* m_fontManager;
99 bgfx::VertexLayout m_vertexLayout;
100 bgfx::UniformHandle s_texColor;
101 bgfx::UniformHandle u_dropShadowColor;
102 bgfx::UniformHandle u_params;