Newbie again
I have recently started learning SFML and have managed quite well so far. I have a program which displays a number of circles and a rectangle in a graphics window (I know it's not very exciting). This works perfectly but, when I tried to add a font I get an error: "example.exe has stopped working". If I comment out the references to the new font it runs OK again. I am using VS 2010 with sfml 2.0 rc.
I have included the code I wrote complete with the references to the new font, commented out.
Sorry if this is just another stupid problem but I really am a complete beginner to SFML and I have looked at the documentation and googled the problem with no luck, so any advice is welcome.
Thanks
-----------------------------------------------------------------Code follows-----------------------------------
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(1000, 600),"SFML works!");
window.setPosition(sf::Vector2i(550,100));
/*
sf::Font fnew;
if(!fnew.loadFromFile("c:/windows/fonts/comic.ttf"))
{
return 1;
}
*/
sf::CircleShape shape(10.f);//-----------------------------------diameter
shape.setFillColor(sf::Color::Yellow);
shape.setPosition(250,350);//-------------------position x,y
sf::CircleShape shape1(20.f);//-----------------------------------diameter
shape1.setFillColor(sf::Color::Red);
shape1.setPosition(350,350);//-------------------position x,y
sf::CircleShape shape2(30.f);//-----------------------------------diameter
shape2.setFillColor(sf::Color::Green);
shape2.setPosition(450,350);//-------------------position x,y
sf::CircleShape shape3(40.f);//-----------------------------------diameter
shape3.setFillColor(sf::Color::Yellow);
shape3.setPosition(550,350);//-------------------position x,y
sf::RectangleShape rec;
rec.setSize(sf::Vector2f(800, 150));
rec.setOutlineColor(sf::Color(255,0,0,150));
rec.setFillColor(sf::Color(255,255,255,100));
rec.setOutlineThickness(5);
rec.setPosition(100, 20);
sf::Text text("Test of text for graphics window");
text.setCharacterSize(30);
text.setColor(sf::Color::Green);
text.setPosition(150,20);
text.setRotation(0.f);//rotates text
text.setScale(1.f,1.f);//changes size
// text.setFont(fnew);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::Blue);
window.draw(shape);
window.draw(text);
window.draw(shape1);
window.draw(shape2);
window.draw(shape3);
window.draw(rec);
window.display();
}
return 0;
}