Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Load the font from a file
- printf("├─ Loading file from %s..\n│ └─ ", file.c_str());
- sf::Font font;
- if (font.loadFromFile(file)) {
- printf("Success!\n├─ Creating resource..\n");
- // Begin making the resource inside the shared_ptr
- // and place inside the map of resources
- fonts_.insert(std::make_pair(file,
- std::make_shared<Resource<sf::Font>>
- (Resource<sf::Font>(font))));
- printf("├─ Retrieving font from resource..\n");
- found = fonts_.find(file);
- // If a resource was found
- if (found != fonts_.end()) {
- printf("└─ Font found!\n");
- return found->second->copy();
- // Snippet of my terminal with the output of the program
- ├─ Loading file from Assets/Fonts/Roboto/Roboto-Regular.ttf..
- │ └─ Success!
- ├─ Creating resource..
- Resource created.
- Resource deleted.
- ├─ Retrieving font from resource..
- └─ Font found!
- // Then another resource gets deleted at the end of the program when I expect it to be released
- // Note that the program acts as expected, with fonts working correctly
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement