libmx2 2.2.1
C++20 multimedia and game-engine library (SDL2 / OpenGL / Vulkan)
Loading...
Searching...
No Matches
vk_text.hpp File Reference

Vulkan SDL_ttf text renderer. More...

#include "config.h"
#include <vulkan/vulkan.h>
#include "exception.hpp"
#include <SDL_vulkan.h>
#include <SDL_ttf.h>
#include <iostream>
#include <stdexcept>
#include <cstdlib>
#include <vector>
#include <string>
#include <cstring>
#include <unordered_map>
Include dependency graph for vk_text.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mx::CacheKey
 Cache key combining text content and colour. More...
struct  mx::CacheKeyHash
 Hash functor for CacheKey. More...
struct  mx::CachedTexture
 GPU texture resources cached for a rendered text string. More...
class  mx::VKText
 Renders SDL_ttf text into Vulkan image textures. More...
struct  mx::VKText::TextVertex
struct  mx::VKText::TextQuad

Namespaces

namespace  mx

Macros

#define VK_CHECK_RESULT(f)

Detailed Description

Vulkan SDL_ttf text renderer.

VKText rasterises text strings into SDL surfaces, uploads them as Vulkan image textures, and batches the resulting quads for submission during the render pass. Each printTextG_Solid() call adds one TextQuad to the pending queue, which is flushed by renderText().

Definition in file vk_text.hpp.

Macro Definition Documentation

◆ VK_CHECK_RESULT

#define VK_CHECK_RESULT ( f)
Value:
{ \
VkResult res = (f); \
if (res != VK_SUCCESS) { \
throw mx::Exception("Fatal : VkResult is \"" + std::to_string(res) + "\" in " + __FILE__ + " at line " + std::to_string(__LINE__)); \
} \
}
General-purpose exception class for the mx library.
Definition exception.hpp:20

Definition at line 33 of file vk_text.hpp.