aboutsummaryrefslogtreecommitdiff
path: root/include/ResourceCache.hpp
blob: de355009071692df1b188b870add8ffc42bb9dbc (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
#pragma once

#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <string>
#include <stdexcept>

namespace dchat
{
    class FailedToLoadResourceException : public std::runtime_error
    {
    public:
        FailedToLoadResourceException(const std::string &errMsg) : std::runtime_error(errMsg) {}
    };
    
    class ResourceCache
    {
    public:
        // Throws FailedToLoadResourceException on failure
        static const sf::Font* getFont(const std::string &filepath);
        
        // Throws FailedToLoadResourceException on failure
        static sf::Texture* getTexture(const std::string &filepath);
    };
}