This is my Code:
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create main window
sf::RenderWindow App(sf::VideoMode(800, 600), "SFML Fonts");
App.SetFramerateLimit(60);
// Load a font from a file
sf::Font MyFont;
if (!MyFont.LoadFromFile("Fonts/MyFont.ttf", 100))
return EXIT_FAILURE;
// Create a graphical string
std::string str;
sf::String text;
text.SetText("Hello !\nHow are you ?");
text.SetFont(MyFont);
text.SetColor(sf::Color(0, 128, 128));
text.SetPosition(0.f, 0.f);
text.SetSize(72.f);
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Character entered
if (Event.Type == sf::Event::TextEntered)
{
// Handle ASCII characters only
if (Event.Text.Unicode < 128)
{
str += static_cast<char>(Event.Text.Unicode);
text.SetText(str);
}
}
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear screen
App.Clear();
// Draw our strings
App.Draw(text);
// Finally, display rendered frame on screen
App.Display();
}
return EXIT_SUCCESS;
}
I want to compile it in Release-Mode with Visual Studio 2010. It just says : Buffer-Overflow! What could I do to avoid Buffer-Overflow and where does I get it?
The Stack frame says this: "Stack frame: Fonts.exe!__report_gsfailure() Line 298 + 0x7 Bytes.
Any ideas?