From 3e78da3b451756ac0446bf460461010b66f6dda2 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Wed, 16 Feb 2022 16:54:19 +0800 Subject: [PATCH] updated names of many params --- example/Vulkan/DrawText.cpp | 4 ++-- inc/hgl/graph/VKPhysicalDevice.h | 5 ++--- inc/hgl/graph/font/TextLayout.h | 9 ++++----- src/SceneGraph/Vulkan/VKInstance.cpp | 2 +- src/SceneGraph/font/TextLayout.cpp | 10 +++++----- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/example/Vulkan/DrawText.cpp b/example/Vulkan/DrawText.cpp index 47a16716..2056dcfa 100644 --- a/example/Vulkan/DrawText.cpp +++ b/example/Vulkan/DrawText.cpp @@ -16,7 +16,7 @@ using namespace hgl::graph; constexpr uint32_t SCREEN_WIDTH =1280; constexpr uint32_t SCREEN_HEIGHT=SCREEN_WIDTH/16*9; -constexpr uint CHAR_BITMAP_SIZE=12; //字符尺寸 +constexpr uint CHAR_BITMAP_SIZE=16; //字符尺寸 class TestApp:public VulkanApplicationFramework { @@ -156,7 +156,7 @@ private: tla.line_gap=0.1f; tl_engine.SetFont(tile_font->GetFontSource()); - tl_engine.SetTLA(&tla); + tl_engine.Set(&tla); tl_engine.SetTextDirection(0); tl_engine.SetAlign(TextAlign::Left); tl_engine.SetMaxWidth(0); diff --git a/inc/hgl/graph/VKPhysicalDevice.h b/inc/hgl/graph/VKPhysicalDevice.h index 652a44b1..c35a6109 100644 --- a/inc/hgl/graph/VKPhysicalDevice.h +++ b/inc/hgl/graph/VKPhysicalDevice.h @@ -34,8 +34,8 @@ public: GPUPhysicalDevice(VkInstance,VkPhysicalDevice); ~GPUPhysicalDevice()=default; - operator VkPhysicalDevice(){return physical_device;} - operator const VkPhysicalDevice()const{return physical_device;} + operator VkPhysicalDevice() {return physical_device;} + operator const VkPhysicalDevice()const {return physical_device;} const int GetMemoryType(uint32_t,VkMemoryPropertyFlags)const; @@ -117,7 +117,6 @@ public: const VkBool32 SupportGeometryShader ()const{return features.geometryShader;} const VkBool32 SupportCubeMapArray ()const{return features.imageCubeArray;} - // support != open, so please don't direct use GetFeatures(). // open any features in CreateDevice()&SetDeviceFeatures() functions. const bool SupportMDI ()const diff --git a/inc/hgl/graph/font/TextLayout.h b/inc/hgl/graph/font/TextLayout.h index a56f4995..30748e80 100644 --- a/inc/hgl/graph/font/TextLayout.h +++ b/inc/hgl/graph/font/TextLayout.h @@ -20,10 +20,9 @@ namespace hgl { bool bold =false; ///<加粗 bool italic =false; ///<右斜 - bool underline =false; ///<下划线 Color4f CharColor; ///<字符颜色 - Color4f BackgroundColor; ///<背影颜色 + Color4f BackgroundColor; ///<背景颜色 };//struct CharLayoutAttr /** @@ -99,8 +98,8 @@ namespace hgl int draw_chars_count; ///<要绘制字符列表 - SortedSets alone_chars; ///<不重复字符统计缓冲区 - TileUVFloatMap alone_chars_uv; ///<所有要绘制字符的uv + SortedSets chars_sets; ///<不重复字符统计缓冲区 + TileUVFloatMap chars_uv; ///<所有要绘制字符的uv struct CharDrawAttr { @@ -156,7 +155,7 @@ namespace hgl virtual ~TextLayout()=default; - void SetTLA (const TextLayoutAttributes *_tla) {if(_tla)memcpy(&tla,_tla,sizeof(TextLayoutAttributes));} + void Set (const TextLayoutAttributes *_tla) {if(_tla)hgl_cpy(&tla,_tla);} void SetFont (FontSource *fs) {if(fs)font_source=fs;} void SetTextDirection (const uint8 &td) {tla.text_direction=td;} void SetAlign (const TextAlign &ta) {tla.align=ta;} diff --git a/src/SceneGraph/Vulkan/VKInstance.cpp b/src/SceneGraph/Vulkan/VKInstance.cpp index 7427202c..4a85a39a 100644 --- a/src/SceneGraph/Vulkan/VKInstance.cpp +++ b/src/SceneGraph/Vulkan/VKInstance.cpp @@ -20,7 +20,7 @@ VulkanInstance *CreateInstance(const AnsiString &app_name,VKDebugOut *out,Create app_info.applicationVersion = 1; app_info.pEngineName = "CMGameEngine/ULRE"; app_info.engineVersion = 1; - app_info.apiVersion = VK_API_VERSION_1_0; + app_info.apiVersion = VK_API_VERSION_1_3; ext_list.Add(VK_KHR_SURFACE_EXTENSION_NAME); ext_list.Add(HGL_VK_SURFACE_EXTENSION_NAME); //此宏在VKSurfaceExtensionName.h中定义 diff --git a/src/SceneGraph/font/TextLayout.cpp b/src/SceneGraph/font/TextLayout.cpp index 908b0ed4..0591d666 100644 --- a/src/SceneGraph/font/TextLayout.cpp +++ b/src/SceneGraph/font/TextLayout.cpp @@ -58,7 +58,7 @@ namespace hgl //遍历所有字符,取得每一个字符的基本绘制信息 { draw_chars_count=0; - alone_chars.ClearData(); + chars_sets.ClearData(); draw_chars_list.ClearData(); const T *cp=str; @@ -72,7 +72,7 @@ namespace hgl if(cda->cla->visible) { - alone_chars.Add(*cp); //统计所有不重复字符 + chars_sets.Add(*cp); //统计所有不重复字符 ++draw_chars_count; } @@ -83,10 +83,10 @@ namespace hgl } //注册不重复字符给tile font系统,获取所有字符的UV - if(!tile_font->Registry(alone_chars_uv,alone_chars.GetData(),alone_chars.GetCount())) + if(!tile_font->Registry(chars_uv,chars_sets.GetData(),chars_sets.GetCount())) { draw_chars_list.ClearData(); - alone_chars.ClearData(); + chars_sets.ClearData(); return(false); } @@ -97,7 +97,7 @@ namespace hgl for(int i=0;icla->attr->ch,(*cda)->uv); + chars_uv.Get((*cda)->cla->attr->ch,(*cda)->uv); ++cda; }