wPlot2D version: 0.1.0
A lightweight C++ library for clear and customizable 2D scientific plots.
Loading...
Searching...
No Matches
wAssetManager.hpp
Go to the documentation of this file.
1/*
2+---------------------------------------------------------------------------------------------------------------------------------------------------+
3Created by Wilfried Koch.
4Copyright @ 2025 Wilfried Koch. All rights reserved.
5+---------------------------------------------------------------------------------------------------------------------------------------------------+
6*/
7
8#ifndef W_ASSET_MANAGER_HPP
9#define W_ASSET_MANAGER_HPP
10
11#pragma GCC diagnostic push
12#pragma GCC diagnostic ignored "-Wfloat-equal"
13#pragma GCC diagnostic ignored "-Wswitch-default"
14#include <SFML/Graphics.hpp>
15#pragma GCC diagnostic pop
16
17#include <string>
18#include <map>
19#include <stdexcept>
20#include <iostream>
21
22namespace wEngine
23{
24
50 {
51 public:
52 AssetManager( ) = default;
53 AssetManager( const AssetManager& ) = delete;
54 AssetManager& operator=( const AssetManager& ) = delete;
55 ~AssetManager( ) = default;
56
68 void LoadFont( const std::string& name, const std::string& fileName );
69
76 sf::Font& getFont( const std::string& name );
77
83 void RemoveFont( const std::string& name );
84
88 void debugPrintFonts( ) const;
89 private:
90 std::map< std::string, sf::Font > mFont;
91
105 template < typename Map >
106 static void EnsureExists( const Map& map, const std::string& name, const std::string& type );
107 };
108
109}//End of namespace wEngine
110
111#endif
AssetManager & operator=(const AssetManager &)=delete
sf::Font & getFont(const std::string &name)
Retrieves a reference to a previously loaded font.
Definition wAssetManager.cpp:29
void debugPrintFonts() const
Prints the list of loaded fonts to standard output.
Definition wAssetManager.cpp:42
void LoadFont(const std::string &name, const std::string &fileName)
Loads a font from file and stores it under a given name.
Definition wAssetManager.cpp:19
void RemoveFont(const std::string &name)
Removes a previously loaded font from memory.
Definition wAssetManager.cpp:35
AssetManager(const AssetManager &)=delete
Definition wColorComponent.cpp:9