aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/font.h
blob: a8d80405f04e0c33331731a1ebb635c93680b4f6 (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
#pragma once

#include <memory>
#include <SDL2/SDL_ttf.h>

#include "../api/Asset.h"

namespace crepe {

/**
 * \brief Font resource facade
 *
 * This class is a wrapper around an SDL_ttf font instance, encapsulating font loading and usage.
 */
class Font : public Resource{
public:
    /**
     * \param res A unique pointer to an Asset holding the font resource.
     */
    Font(const Asset & src, Mediator & mediator);

    /**
     * \brief Destructor to clean up font resources.
     */
    ~Font() = default;
private:
	//! The SDL_ttf font object with custom deleter.
    std::unique_ptr<TTF_Font, decltype(&TTF_CloseFont)> font; 
};

} // namespace crepe