X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2Frender.cpp;h=7e048408b5091239ca10e35e89a8dfe2fcec4035;hb=46b18a88fdda816f3c2c547aba68b0a5ea7970f7;hp=3d0bbd47c6cf2e00feb6efb10798c22469a694a8;hpb=282d731ea8f10342efa82012028de7043b3dd639;p=blank.git diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 3d0bbd4..7e04840 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -34,6 +34,31 @@ Font &Font::operator =(Font &&other) noexcept { } +int Font::Style() const noexcept { + return TTF_GetFontStyle(handle); +} + +void Font::Style(int s) const noexcept { + TTF_SetFontStyle(handle, s); +} + +int Font::Outline() const noexcept { + return TTF_GetFontOutline(handle); +} + +void Font::Outline(int px) noexcept { + TTF_SetFontOutline(handle, px); +} + + +int Font::Hinting() const noexcept { + return TTF_GetFontHinting(handle); +} + +void Font::Hinting(int h) const noexcept { + TTF_SetFontHinting(handle, h); +} + bool Font::Kerning() const noexcept { return TTF_GetFontKerning(handle); } @@ -60,6 +85,15 @@ int Font::LineSkip() const noexcept { } +const char *Font::FamilyName() const noexcept { + return TTF_FontFaceFamilyName(handle); +} + +const char *Font::StyleName() const noexcept { + return TTF_FontFaceStyleName(handle); +} + + bool Font::HasGlyph(Uint16 c) const noexcept { return TTF_GlyphIsProvided(handle, c); } @@ -74,16 +108,19 @@ glm::tvec2 Font::TextSize(const char *text) const { } Texture Font::Render(const char *text, SDL_Color color) const { + Texture tex; + return tex; +} + +void Font::Render(const char *text, SDL_Color color, Texture &tex) const { SDL_Surface *srf = TTF_RenderUTF8_Blended(handle, text, color); if (!srf) { throw std::runtime_error(TTF_GetError()); } - Texture tex; tex.Bind(); tex.Data(*srf, false); tex.FilterLinear(); SDL_FreeSurface(srf); - return tex; }