#include <mxvk/include/mxvk/mxvk_text.hpp>
Public Member Functions | |
| void | clearCache () |
| Destroy all cached text textures, freeing GPU memory. | |
| void | clearQueue () |
| Discard all pending text quads without rendering them. | |
| bool | getTextDimensions (const std::string &text, int &width, int &height) |
| Measure the pixel dimensions of a string with the current font. | |
| bool | getTextDimensions (const std::string &text, int &width, int &height, const Font &textFont) |
| bool | getTextDimensions (const std::string &text, int &width, int &height, TTF_Font *textFont) |
| VK_Text & | operator= (const VK_Text &)=delete |
| VK_Text & | operator= (VK_Text &&)=delete |
| void | printTextG_Solid (const std::string &text, int x, int y, const SDL_Color &col) |
| Queue a text string for solid (opaque) rendering. | |
| void | printTextG_Solid (const std::string &text, int x, int y, const SDL_Color &col, const Font &textFont) |
| void | printTextG_Solid (const std::string &text, int x, int y, const SDL_Color &col, TTF_Font *textFont) |
| void | renderText (VkCommandBuffer cmdBuffer, VkPipelineLayout pipelineLayout, uint32_t screenWidth, uint32_t screenHeight) |
| Record all queued text quads into a command buffer. | |
| void | setDescriptorSetLayout (VkDescriptorSetLayout layout) |
| Assign an external descriptor-set layout. | |
| void | setFont (const std::string &fontPath, int fontSize) |
| Change the active font. | |
| VK_Text (const VK_Text &)=delete | |
| VK_Text (VK_Text &&)=delete | |
| VK_Text (VkDevice device, VkPhysicalDevice physicalDevice, VkQueue graphicsQueue, VkCommandPool commandPool, const std::string &fontPath, int fontSize=24) | |
| Construct VKText and load the font. | |
| ~VK_Text () | |
| Destructor – destroys all Vulkan and SDL_ttf resources. | |
Public Attributes | |
| VkSampler | fontSampler = VK_NULL_HANDLE |
| Sampler used for all text textures. | |
Definition at line 114 of file mxvk_text.hpp.
| mxvk::VK_Text::VK_Text | ( | VkDevice | device, |
| VkPhysicalDevice | physicalDevice, | ||
| VkQueue | graphicsQueue, | ||
| VkCommandPool | commandPool, | ||
| const std::string & | fontPath, | ||
| int | fontSize = 24 ) |
Construct VKText and load the font.
| device | Logical device. |
| physicalDevice | Physical device. |
| graphicsQueue | Graphics queue. |
| commandPool | Command pool for staging. |
| fontPath | Path to the TTF font file. |
| fontSize | Point size. |
Definition at line 71 of file mxvk_text.cpp.
| mxvk::VK_Text::~VK_Text | ( | ) |
Destructor – destroys all Vulkan and SDL_ttf resources.
Definition at line 82 of file mxvk_text.cpp.
|
delete |
|
delete |
| void mxvk::VK_Text::clearCache | ( | ) |
Destroy all cached text textures, freeing GPU memory.
Definition at line 104 of file mxvk_text.cpp.
| void mxvk::VK_Text::clearQueue | ( | ) |
Discard all pending text quads without rendering them.
Definition at line 528 of file mxvk_text.cpp.
| bool mxvk::VK_Text::getTextDimensions | ( | const std::string & | text, |
| int & | width, | ||
| int & | height ) |
Measure the pixel dimensions of a string with the current font.
| text | String to measure. |
| width | Output: pixel width. |
| height | Output: pixel height. |
true if measurement succeeded. Definition at line 601 of file mxvk_text.cpp.
| bool mxvk::VK_Text::getTextDimensions | ( | const std::string & | text, |
| int & | width, | ||
| int & | height, | ||
| const Font & | textFont ) |
Definition at line 616 of file mxvk_text.cpp.
| bool mxvk::VK_Text::getTextDimensions | ( | const std::string & | text, |
| int & | width, | ||
| int & | height, | ||
| TTF_Font * | textFont ) |
Definition at line 605 of file mxvk_text.cpp.
| void mxvk::VK_Text::printTextG_Solid | ( | const std::string & | text, |
| int | x, | ||
| int | y, | ||
| const SDL_Color & | col ) |
Queue a text string for solid (opaque) rendering.
| text | String to draw. |
| x | Destination X in pixels. |
| y | Destination Y in pixels. |
| col | Text colour. |
Definition at line 298 of file mxvk_text.cpp.
| void mxvk::VK_Text::printTextG_Solid | ( | const std::string & | text, |
| int | x, | ||
| int | y, | ||
| const SDL_Color & | col, | ||
| const Font & | textFont ) |
Definition at line 306 of file mxvk_text.cpp.
| void mxvk::VK_Text::printTextG_Solid | ( | const std::string & | text, |
| int | x, | ||
| int | y, | ||
| const SDL_Color & | col, | ||
| TTF_Font * | textFont ) |
Definition at line 302 of file mxvk_text.cpp.
| void mxvk::VK_Text::renderText | ( | VkCommandBuffer | cmdBuffer, |
| VkPipelineLayout | pipelineLayout, | ||
| uint32_t | screenWidth, | ||
| uint32_t | screenHeight ) |
Record all queued text quads into a command buffer.
| cmdBuffer | Active Vulkan command buffer. |
| pipelineLayout | Pipeline layout for push constants. |
| screenWidth | Viewport width. |
| screenHeight | Viewport height. |
Definition at line 505 of file mxvk_text.cpp.
|
inline |
Assign an external descriptor-set layout.
Definition at line 161 of file mxvk_text.hpp.
| void mxvk::VK_Text::setFont | ( | const std::string & | fontPath, |
| int | fontSize ) |
Change the active font.
| fontPath | New font file path. |
| fontSize | New point size. |
Definition at line 260 of file mxvk_text.cpp.
| VkSampler mxvk::VK_Text::fontSampler = VK_NULL_HANDLE |
Sampler used for all text textures.
Definition at line 184 of file mxvk_text.hpp.