SFML community forums

Help => Window => Topic started by: AceDawg45 on June 06, 2014, 04:56:04 pm

Title: Help with creating a window?
Post by: AceDawg45 on June 06, 2014, 04:56:04 pm
So, I finally got SFML to work, and I am trying to use the tutorials on the site
http://sfml-dev.org/tutorials/1.6/window-window.php

Well, the code at the top doesn't work for me. Am I missing something? My code:

#include <iostream>
#include <SFML/Window.hpp>
using namespace std;

int main(int argc, char** argv)
{
    sf::Window window(sf::VideoMode(800, 600, 32), "SFML Window");
   
    while(window.isOpen()){
        sf::Event event;
        while(window.pollEvent(event)){

            if(event.type == sf::Event::Closed){
                window.close();
            }
        }
    }

    return 0;
}


 
Title: Re: Help with creating a window?
Post by: Nexus on June 06, 2014, 05:00:03 pm
Am I missing something?
The link points to SFML version 1.6, which is massively outdated. But the shown code is for SFML 2.

Well, the code at the top doesn't work for me.
Read this (http://en.sfml-dev.org/forums/index.php?topic=5559.0).
Title: Re: Help with creating a window?
Post by: AceDawg45 on June 06, 2014, 05:24:15 pm
Oh, I meant the code example at the top of the webpage I linked to. I am completely new to this. Anybody know how to fix the code?
Title: Re: Help with creating a window?
Post by: Nexus on June 06, 2014, 08:29:22 pm
You apparently haven't read my answer, let alone the link I posted :(

The tutorial is about SFML 1.6, today we have version 2.1. Use the newer version.
And we can't magically know what your problem is. Describe it, as stated in the link.
Title: Re: Help with creating a window?
Post by: AceDawg45 on June 06, 2014, 08:39:25 pm
Ok, well the Console window comes up, but I don't get anything for the SFML window. I looked at the SFML 2 tutorial, and I still couldn't get it fixed. The compiler also will say "cannot optain handle to inferior. Parameter incorrect". It doesn't come up as an error, though, it comes up as a warning.
Title: Re: Help with creating a window?
Post by: AndreeU17 on June 14, 2014, 06:45:23 pm
So, I finally got SFML to work, and I am trying to use the tutorials on the site
http://sfml-dev.org/tutorials/1.6/window-window.php

Well, the code at the top doesn't work for me. Am I missing something? My code:

#include <iostream>
#include <SFML/Window.hpp>
using namespace std;

int main(int argc, char** argv)
{
    sf::Window window(sf::VideoMode(800, 600, 32), "SFML Window");
   
    while(window.isOpen()){
        sf::Event event;
        while(window.pollEvent(event)){

            if(event.type == sf::Event::Closed){
                window.close();
            }
        }
    }

    return 0;
}


 

whatss wrong is that you didnt display the window. window.display();
Title: Re: Help with creating a window?
Post by: AceDawg45 on June 16, 2014, 04:28:23 pm
I added it in there (after the nested while loop, inside while(window.isOpen()) and still, nothing
Title: Re: Help with creating a window?
Post by: Stauricus on June 16, 2014, 10:24:05 pm
works for me. opens a empty black window, of course.
are you using dynamic or static libs (and did you link them)? windows/linux/mac? sfml 2.1 or 1.6? which ide? these are important info...
Title: Re: Help with creating a window?
Post by: AceDawg45 on June 17, 2014, 11:28:49 pm
I have the dynamic files. Here is the .pro file:
Code: [Select]

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

LIBS += -LC:/SFML/lib

CONFIG(release, debug|release): LIBS += -lsfml-audio -lsfml-graphics -lsfml-main -lsfml-network -lsfml-window -lsfml-system
CONFIG(debug, debug|release): LIBS += -lsfml-audio-d -lsfml-graphics-d -lsfml-main-d -lsfml-network-d -llibsfml-window-d -lsfml-system-d
CONFIG += c++11
INCLUDEPATH += C:/SFML/include
DEPENDPATH += C:/SFML/include

Also, as I said somewhere at the top, I am using Qt Creator. SFML 2.1, and on Windows.