Hey all! New to SFML and trying to get the following code to work. Got all the dependencies to work, but now the text won't display.
I followed the tutorial on the site but to no avail. here's my code:
#define _WIN32_WINNT 0x500
#include<Windows.h>
#include<SFML/System.hpp>
#include<SFML/Graphics.hpp>
#include<iostream>
using namespace sf;
int main(int argc, char** argv)
{
HWND hwnd = GetConsoleWindow();
ShowWindow(hwnd, SW_HIDE);
RenderWindow app;
const Input& in = app.GetInput();
Image screen;
sf::Event e;
String text("Hello World",Font::GetDefaultFont(),100);
text.SetColor(Color(0,0,255));
text.SetStyle(String::Regular);
text.SetRotation(90.0f);
text.SetScale(2.0f,2.0f);
text.Move(10.0f, 10.0f);
app.Draw(text);
app.Create(VideoMode(800,600), "SFML Fonts");
app.Display();
while(app.IsOpened())
{
while(app.GetEvent(e))
{
if(e.Type == Event::Closed)
{
app.Close();
ShowWindow(hwnd, SW_RESTORE);
}
if((e.Type == Event::KeyPressed) && (e.Key.Code == Key::Escape))
{
app.Close();
}
if(e.Key.Code == Key::S)
{
screen = app.Capture();
screen.SaveToFile("screenshot.jpg");
}
}
app.Clear(Color(Color::White));
app.Draw(text);
app.Display();
}
return 0;
}