I have my own Text
class which uses sf::Text to display text on the screen.
First I couldn't get the text to display on the screen, my solution was that I forgot to give the text a font before displaying it.
So I gave the text a font, which lead to a complete crash.
All it gave me was some pretty useless information :
Unhandled exception at 0x0FFC2AA4 (sfml-graphics-d-2.dll) in SFML_Game.exe: 0xC0000005: Access violation reading location 0x0000000D.
My game crashed at this line of code :
window->draw(text);
And my window variable is this :
Text::Text(sf::RenderWindow* _window, char* _text, int size, sf::Vector2f position, float rotation, sf::Color color, int style, char* PATH)
{
this->window = _window;
// (more code.........)
My window variable is of this type :
sf::RenderWindow* window;
When the constructor of my Text
class is called, it has these parameters :
&window, "I am just a text. :]", 24, sf::Vector2f(100, 100), 0, sf::Color::White, sf::Text::Style::Bold, "Res/Fonts/arial.ttf"
I've checked the font, it seems to load properly.
Also, not sure if it matters but my Text object is stored inside of a std::vector
.... :
std::vector<Text>texts;
texts.push_back(Text(&window, "I am just a text. :]", 24, sf::Vector2f(100, 100), 0, sf::Color::White, sf::Text::Style::Bold, "Res/Fonts/arial.ttf"));
Texts does render by just creating a sf::Font
and sf::Text
and rendering it.
So, I did this :
---Not sure if this means anything at all... :3
Also noticed that sometimes I get a Microsoft Visual C++ Runtime Library
crash.
And if I press retry it triggers a breakpoint.
window->draw(text);
is the problem, and as my updated posts picture says, I can for some reason not see what the variable text is. :/ – BiiX Dec 29 '15 at 15:34texts.push_back(Text(&window
should probably betexts.push_back(Text(window
: you seem to be passing a reference to a pointer instead of a pointer. And to improve your debugging, you would need the PDBs for the SFML along the DLL. – Alexandre Vaillancourt Dec 30 '15 at 23:35