mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-13 07:33:34 +00:00
adding multiple font support
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/06 16:24:11 by maldavid #+# #+# */
|
||||
/* Updated: 2023/12/13 00:24:21 by kbz_8 ### ########.fr */
|
||||
/* Updated: 2023/12/14 17:39:51 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <unordered_set>
|
||||
#include <renderer/text_library.h>
|
||||
#include <mlx_profile.h>
|
||||
#include <utils/combine_hash.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
@@ -35,6 +36,7 @@ namespace mlx
|
||||
TextDrawData(std::string text, int _color, int _x, int _y);
|
||||
void init(TextLibrary& library, Font* const font) noexcept;
|
||||
bool operator==(const TextDrawData& rhs) const { return text == rhs.text && x == rhs.x && y == rhs.y && color == rhs.color; }
|
||||
TextDrawData() = default;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -45,7 +47,9 @@ namespace std
|
||||
{
|
||||
std::size_t operator()(const mlx::TextDrawData& d) const noexcept
|
||||
{
|
||||
return std::hash<std::string>()(d.text) + std::hash<int>()(d.x) + std::hash<int>()(d.y) + std::hash<int>()(d.color);
|
||||
std::size_t hash = 0;
|
||||
mlx::hashCombine(hash, d.text, d.x, d.y, d.color);
|
||||
return hash;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -59,9 +63,9 @@ namespace mlx
|
||||
|
||||
void init(Renderer* renderer) noexcept;
|
||||
void put(int x, int y, int color, std::string str);
|
||||
inline void clear() { _drawlist.clear(); }
|
||||
inline void clear() { _drawlist.clear(); _library.clearLibrary(); }
|
||||
void loadFont(const std::filesystem::path& filepath, float scale);
|
||||
void render();
|
||||
void render(std::array<VkDescriptorSet, 2>& sets);
|
||||
void destroy() noexcept;
|
||||
|
||||
~TextPutPipeline() = default;
|
||||
|
||||
Reference in New Issue
Block a user