| 948 | }; |
| 949 | |
| 950 | class CTextRender : public IEngineTextRender |
| 951 | { |
| 952 | IConsole *m_pConsole; |
| 953 | IGraphics *m_pGraphics; |
| 954 | IStorage *m_pStorage; |
| 955 | IConsole *Console() { return m_pConsole; } |
| 956 | IGraphics *Graphics() { return m_pGraphics; } |
| 957 | IStorage *Storage() { return m_pStorage; } |
| 958 | |
| 959 | CGlyphMap *m_pGlyphMap; |
| 960 | std::vector<void *> m_vpFontData; |
| 961 | |
| 962 | std::vector<SFontLanguageVariant> m_vVariants; |
| 963 | |
| 964 | unsigned m_RenderFlags; |
| 965 | |
| 966 | ColorRGBA m_Color; |
| 967 | ColorRGBA m_OutlineColor; |
| 968 | ColorRGBA m_SelectionColor; |
| 969 | |
| 970 | FT_Library m_FTLibrary; |
| 971 | |
| 972 | std::vector<STextContainer *> m_vpTextContainers; |
| 973 | std::vector<int> m_vTextContainerIndices; |
| 974 | int m_FirstFreeTextContainerIndex; |
| 975 | |
| 976 | SBufferContainerInfo m_DefaultTextContainerInfo; |
| 977 | |
| 978 | std::chrono::nanoseconds m_CursorRenderTime; |
| 979 | |
| 980 | int GetFreeTextContainerIndex() |
| 981 | { |
| 982 | if(m_FirstFreeTextContainerIndex == -1) |
| 983 | { |
| 984 | const int Index = (int)m_vTextContainerIndices.size(); |
| 985 | m_vTextContainerIndices.push_back(Index); |
| 986 | return Index; |
| 987 | } |
| 988 | else |
| 989 | { |
| 990 | const int Index = m_FirstFreeTextContainerIndex; |
| 991 | m_FirstFreeTextContainerIndex = m_vTextContainerIndices[Index]; |
| 992 | m_vTextContainerIndices[Index] = Index; |
| 993 | return Index; |
| 994 | } |
| 995 | } |
| 996 | |
| 997 | void FreeTextContainerIndex(STextContainerIndex &Index) |
| 998 | { |
| 999 | m_vTextContainerIndices[Index.m_Index] = m_FirstFreeTextContainerIndex; |
| 1000 | m_FirstFreeTextContainerIndex = Index.m_Index; |
| 1001 | Index.Reset(); |
| 1002 | } |
| 1003 | |
| 1004 | void FreeTextContainer(STextContainerIndex &Index) |
| 1005 | { |
| 1006 | m_vpTextContainers[Index.m_Index]->Reset(); |
| 1007 | FreeTextContainerIndex(Index); |