blob: a27676bdf44227f8669708dce5f2175dcc0a3507 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#pragma once
#include <memory>
#include <SDL2/SDL_ttf.h>
#include "../api/Asset.h"
#include "../api/Config.h"
#include "../Resource.h"
namespace crepe {
/**
* \brief Resource for managing font creation and destruction
*
* This class is a wrapper around an SDL_ttf font instance, encapsulating font loading and usage.
*/
class Font : public Resource{
public:
/**
* \param src Asset with font data to load.
* \param mediator use the SDLContext reference to get_font()
*/
Font(const Asset & src, Mediator & mediator);
/**
* \brief getter for TTF_Font
*
* \param src Asset with font data to load.
* \param mediator use the SDLContext reference to get_font()
*/
TTF_Font* get_font() const;
private:
//! The SDL_ttf font object with custom deleter.
std::unique_ptr<TTF_Font, decltype(&TTF_CloseFont)> font;
};
} // namespace crepe
|