aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/Font.cpp
blob: 51e96909532ba3a6b4bd98c1e16bd464ddae50b4 (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
#include <SDL2/SDL_ttf.h>

#include "../api/Asset.h"
#include "../api/Config.h"
#include "util/Log.h"
#include <iostream>
#include <string>

#include "Font.h"

using namespace std;
using namespace crepe;

Font::Font(const Asset & src, Mediator & mediator)
	: Resource(src, mediator){
	Config & config = Config::get_instance();
	const std::string FONT_PATH = src.get_path();

	this->path = FONT_PATH;

	cout << this->path << endl;
	/*
	TTF_Font * loaded_font = TTF_OpenFont(FONT_PATH.c_str(), config.font.size);
	if (loaded_font == NULL) {
		throw runtime_error(format("Font: {} (path: {})", TTF_GetError(), FONT_PATH));
	}
	this->font = {loaded_font, [](TTF_Font * close_font) { TTF_CloseFont(close_font); }};
}

TTF_Font * Font::get_font() const { return this->font.get(); }

const string & Font::get_path() const noexcept{
	return this->path;
}