I am currently attempting to write a resource manager for SFML to make my life easier. Ironically, it made my life harder. After having had two different managers, for fonts and textures, I decided to switch over to making a general manager that uses templates. This, however did not work out as expected.
I have submitted the entire class on pastebin:
http://pastebin.com/ggynEjXPUsing this class causes the stack to corrupt around either the variable
"line" or
"tempResource" (seems to be random?) in the
"LoadCollection" function. What weirds me out is that Visual Studio breaks on the closing bracket of the function and the call stack says the function
"GetResource" leads to the corruption of both of these variables, when it doesn't even contain them.
This code snippet, that uses the manager, seems to be triggering the issue:
...
game->client->fontManager.LoadCollection("Error");
errorTextLn1.setFont(*game->client->fontManager.GetResource("arial.ttf")); // <-- Call stack refers to this.
...
Any help would be vastly appreciated since I'm sitting in an error storm, which is not too much of a nice experience. Thanks in advance.