-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlmacenDeFuentes.hpp
More file actions
56 lines (40 loc) · 1.44 KB
/
AlmacenDeFuentes.hpp
File metadata and controls
56 lines (40 loc) · 1.44 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef ALMACENDEFUENTES_H
#define ALMACENDEFUENTES_H
#include "Almacen.hpp"
/**
* @brief Objeto single-tin (objeto de una sola creacción), para almacenar las fuentes de texto, hereda de Almacen
* por lo que su copia está prohibida y su constructor está protegido. Debe instanciarse con el método getInstancia()
**/
class AlmacenDeFuentes : public Almacen
{
public:
/** \brief Obtiene una instancia de AlmacenDeFuentes, si no existía aún lo crea y si existía lo crea y devuelve la referencia.
*
*/
static const AlmacenDeFuentes& getInstancia()
{
static const AlmacenDeFuentes instancia;
return instancia;
}
/** \brief Obtiene la fuente Arial
*/
const sf::Font& getArial() const {return arial;}
/** \brief Obtiene la fuente Calibri
*/
const sf::Font& getCalibri() const {return calibri;}
private:
/** \brief Carga las fuentes desde disco. Lanza excepción si fuente no encontrada.
*/
AlmacenDeFuentes()
{
if (!arial.loadFromFile("./Fonts/arial.ttf")) throw "Fuente arial no encontrada";
if (!calibri.loadFromFile("./Fonts/calibri.ttf")) throw "Fuente calibri no encontrada";
}
/** \brief Fuente de texto Arial.
*/
sf::Font arial;
/** \brief Fuente de texto Calibri.
*/
sf::Font calibri;
};
#endif // ALMACENDEFUENTES_H