Oct 22, 2013 at 4:23am UTC
so im building this app, but im completely new to sfml (its 1.6 btw; dont ask. i am required to use it) and am having trouble with the tutorial. heres my code... but its not showing the string. just a snapshot of the process behind it
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main(int argc, char *argv[])
{
sf::Window App(sf::VideoMode(800, 600, 32), "F*ck it. Uploads Happen." );
sf::RenderWindow Window;
sf::Font Font;
if (!Font.LoadFromFile("Tr2n.ttf" )) Font = sf::Font::GetDefaultFont();
sf::String Text("Hello, world!" , Font, 50);
Window.Draw(Text);
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed) App.Close();
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) App.Close();
}
}
return EXIT_SUCCESS;
}
Last edited on Oct 22, 2013 at 4:25am UTC
Oct 22, 2013 at 4:30am UTC
Your sf::Window is your sf::RenderWindow. You don't have to create another RenderWindow.
Get rid of your 'Window' and render to your 'App'.
Oct 22, 2013 at 4:32am UTC
so wait... they are the same thing?
Oct 22, 2013 at 4:36am UTC
i got rid of line 7 and added Render to the window, then replaced window with app on line 14
Oct 22, 2013 at 4:45am UTC
nvr mnd... i skipped a tutorial
Oct 22, 2013 at 5:34am UTC
oh my god you rock. thanks.
Oct 22, 2013 at 6:05am UTC
one last question... in java there is a class that can display an options bar. how would i do this in sfml?
Oct 22, 2013 at 6:11am UTC
Like a toolbar? That's more of a widgetry thing, and isn't something SFML is designed to do.
Oct 22, 2013 at 6:14am UTC
damn oh well. ill just make it window based then