namespace blobs {
namespace graphics {
+Font::Font(const std::string &src, int size, long index)
+: Font(src.c_str(), size, index) {
+}
+
Font::Font(const char *src, int size, long index)
: handle(TTF_OpenFontIndex(src, size, index)) {
if (!handle) {
return size;
}
+glm::ivec2 Font::TextSize(const std::string &text) const {
+ return TextSize(text.c_str());
+}
+
Texture Font::Render(const char *text) const {
Texture tex;
Render(text, tex);
return tex;
}
+Texture Font::Render(const std::string &text) const {
+ return Render(text.c_str());
+}
+
void Font::Render(const char *text, Texture &tex) const {
SDL_Surface *srf = TTF_RenderUTF8_Blended(handle, text, { 0xFF, 0xFF, 0xFF, 0xFF });
if (!srf) {
SDL_FreeSurface(srf);
}
+void Font::Render(const std::string &text, Texture &tex) const {
+ Render(text.c_str(), tex);
+}
+
Format::Format() noexcept
: format(GL_BGRA)
, type(GL_UNSIGNED_INT_8_8_8_8_REV)