Hi again,
Think is a graphics issue? Actually got some time to start looking more indepth into SFML 2.0, and was running through some guides and tutorials. I ended up merging a few bits I found to try make something without the aid of the guides completely. However this might be where my errors occurred, I'm trying to get a simple bit of text to display in the window. I've searched these forums and Google, to no avail really. The program runs fine, no errors but the text is simply not there? Maybe another simple issue but I'd love a point in the right direction
#include <SFML\Window.hpp>
#include <SFML\Graphics.hpp>
#include <SFML\System.hpp>
using namespace sf;
int main()
{
VideoMode videoMode(320,240);
RenderWindow window(videoMode,"KeyEvent Window");
//Set objects in the window
sf::Font font;
font.loadFromFile("Fonts\BRADHTC.ttf");
sf::Text text;
text.setString("Hello");
text.setFont(font);
text.setCharacterSize(2);
text.setPosition(30, 30);
text.setColor(sf::Color::Black);
RectangleShape rectangle;
rectangle.setPosition(30,30);
rectangle.setSize(Vector2f(50, 30));
rectangle.setFillColor(Color::Green);
rectangle.setOutlineColor(Color::White);
rectangle.setOutlineThickness(3);
//
while (window.isOpen())
{
window.clear(sf::Color::White);
window.draw(text);
window.draw(rectangle);
window.display();
Event event;
while (window.pollEvent(event))
{
if ( (event.type == Event::Closed) ||
((event.type == Event::KeyPressed) && (event.key.code==Keyboard::Escape)) )
window.close();
else
{
if (event.type == Event::KeyPressed)
{
switch(event.key.code)
{
case Keyboard::Up: rectangle.move(0, -10);
break;
case Keyboard::Down: rectangle.move(0, 10);
break;
case Keyboard::Left: rectangle.move(-10, 0);
break;
case Keyboard::Right: rectangle.move(10, 0);
break;
}
}
}
}
}
return EXIT_SUCCESS;
}
If any of this code is a bit messy or unneeded, feel free to point that out aswell but I am still grasping this so don't know all the best ways to do things yet
Thanks to anyone who reads this..