2dkg/2dkg_zad5/2dgk_zad5/KFont.h
2022-01-20 08:52:14 +01:00

38 lines
782 B
C++

#pragma once
#include <SDL_ttf.h>
#include <string>
namespace KapitanGame {
//Font wrapper class
class KTexture;
class KFont {
public:
KFont();
~KFont();
KFont(const KFont& other) = delete;
KFont(KFont&& other) noexcept;
KFont& operator=(const KFont& other) = delete;
KFont& operator=(KFont&& other) noexcept;
//Loads image at specified path
bool LoadFromFile(const std::string& path, int ptSize);
//Deallocates Font
void Free();
KTexture GetTextTexture(const std::string& text, SDL_Color textColor, SDL_Renderer* renderer) const;
KTexture GetTextWithOutlineTexture(const std::string& text, SDL_Color fgColor, SDL_Color bgColor, int outlineSize, SDL_Renderer* renderer) const;
private:
//The actual hardware font
TTF_Font* Font{};
};
}