From 592a9343f49736624a1b5e730aca2bc95261cb12 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Wed, 1 Jul 2020 20:36:49 +0800 Subject: [PATCH] add TileFont/FontManage --- CMCore | 2 +- inc/hgl/graph/font/FontManage.h | 26 +++++++++++++++++++ inc/hgl/graph/font/TileFont.h | 18 +++++++++++-- .../Vulkan/POD/VKTextureLoader.cpp | 4 +-- src/RenderDevice/Vulkan/VKTileData.cpp | 2 +- 5 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 inc/hgl/graph/font/FontManage.h diff --git a/CMCore b/CMCore index bb66ce1f..2e076881 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit bb66ce1f5a4b1f9dcbe61758813ffdd34ae7c1e3 +Subproject commit 2e076881513560dd8111d3f101222dc2fd0b333e diff --git a/inc/hgl/graph/font/FontManage.h b/inc/hgl/graph/font/FontManage.h new file mode 100644 index 00000000..cfe326d2 --- /dev/null +++ b/inc/hgl/graph/font/FontManage.h @@ -0,0 +1,26 @@ +#ifndef HGL_GRAPH_FONT_MANAGE_INCLUDE +#define HGL_GRAPH_FONT_MANAGE_INCLUDE + +#include +#include +namespace hgl +{ + namespace graph + { + struct FontConfig + { + };// + + /** + * 字体管理模块,包括所有的字体数据源,以及字符绘制器。
+ * 在可期的未来,我们会增加对字体、字符的使用情况统计信息 + */ + class FontManage + { + MapObject sources; + + TileFont * + };//class FontManage + }//namespace graph +}//namespace hgl +#endif//HGL_GRAPH_FONT_MANAGE_INCLUDE diff --git a/inc/hgl/graph/font/TileFont.h b/inc/hgl/graph/font/TileFont.h index 6a827d5e..f5d63bf2 100644 --- a/inc/hgl/graph/font/TileFont.h +++ b/inc/hgl/graph/font/TileFont.h @@ -3,20 +3,34 @@ #include #include +#include namespace hgl { namespace graph { + /** + * Tile字符管理
+ * 本模块允许有多个字符数据来源,每个来源也可以对应多个unicode块, 但一个unicode块只能对应一个字体数据来源 + */ class TileFont { - FontSource *source; + using FontSourcePointer=FontSource *; + using FontSourceTable=FontSourcePointer[(size_t)UnicodeBlock::RANGE_SIZE]; + + FontSourceTable source_map; + TileData *tile_data; public: - + TileFont() + { + hgl_zero(source_map); + } };//class TileFont + + TileFont *CreateTileFont(const Font &,const int=-1); }//namespace graph }//namespace hgl #endif//HGL_GRAPH_TILE_FONT_INCLUDE diff --git a/src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp b/src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp index aeb49d57..65e830ea 100644 --- a/src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp +++ b/src/RenderDevice/Vulkan/POD/VKTextureLoader.cpp @@ -157,7 +157,7 @@ Texture2D *CreateTextureFromFile(Device *device,const OSString &filename) return tex; } } - +/* struct Texture2DData { uint32 width; @@ -219,5 +219,5 @@ void *LoadTextureFromFile(const OSString &filename) delete buf; return tex; } -} +}*/ VK_NAMESPACE_END diff --git a/src/RenderDevice/Vulkan/VKTileData.cpp b/src/RenderDevice/Vulkan/VKTileData.cpp index b3c95d37..f0fcefce 100644 --- a/src/RenderDevice/Vulkan/VKTileData.cpp +++ b/src/RenderDevice/Vulkan/VKTileData.cpp @@ -95,6 +95,6 @@ TileData *Device::CreateTileData(const VkFormat format,const uint width,const ui else return(nullptr); - return(new TileData(tex,width,height)); + return(new TileData(this,tex,width,height)); } VK_NAMESPACE_END