Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML2.1 No Window.PollEvent  (Read 2819 times)

0 Members and 1 Guest are viewing this topic.

nickkorta

  • Newbie
  • *
  • Posts: 17
    • View Profile
SFML2.1 No Window.PollEvent
« on: August 12, 2013, 11:33:49 pm »
I don't have a pollEvent function under Window or RenderWindow.
I'm using Ubuntu and my IDE is Qt.

I linked SFML in the project File(.pro) that is made when using Qt
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp \
    game.cpp

INCLUDEPATH += \Media\nickkorta\Shared\SFML-2.1\Linux\include
LIBS += -lsfml-system -lsfml-window -lsfml-graphics -lsfml-audio

HEADERS += \
    game.hpp

 

Here is my Game.h
#include "SFML/System.hpp"
#include"SFML/Graphics.hpp"
#include "SFML/Window.hpp"
#include "SFML/Audio.hpp"
#include "SFML/Network.hpp"


#ifndef GAME_HPP
#define GAME_HPP

class Game
{
public:
    Game();
private:
    void Initialize();
    void LoadContent();
    void Update();
    void Draw();
    bool running;
    sf::RenderWindow window;
    sf::Event event;
};

#endif // GAME_HPP
 

Game.cpp
#include "game.hpp"

Game::Game()
{
    Initialize();
    LoadContent();
    while(running)
    {
        Update();
        Draw();
    }
    window.Close();
}

void Game::Initialize()
{
    window.Create(sf::VideoMode(1080,720,32),"Game");
}

void Game::LoadContent()
{
}

void Game::Update()
{
    while (window.pollEvent(event))
    {
    }
}

void Game::Draw()
{
    window.Display();
    window.Clear();
}
 

Everything runs fine. I also noticed that I can move the window around and can use the maximize and minimize buttons. I have done this in windows and I cant do that without using Window.PollEvent(event).

Thanks

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: SFML2.1 No Window.PollEvent
« Reply #1 on: August 13, 2013, 12:01:42 am »
What do you mean by "You don't have"?
Could you provide an error?

nickkorta

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: SFML2.1 No Window.PollEvent
« Reply #2 on: August 13, 2013, 12:07:55 am »
error: 'class sf::RenderWindow' has no member named 'PollEvent'

I does not show up under other members when typing window.

AlejandroCoria

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • alejandrocoria.games
    • Email
Re: SFML2.1 No Window.PollEvent
« Reply #3 on: August 13, 2013, 12:14:49 am »
you're using SFML 1.6, because the function names like Clear or Display in SFML 2.0 and later are in lowercase

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML2.1 No Window.PollEvent
« Reply #4 on: August 13, 2013, 12:15:29 am »
You're using an old version. Install SFML 2.1.

Furthermore, auto-completion tools are not reliable, they often contain bugs.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

nickkorta

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: SFML2.1 No Window.PollEvent
« Reply #5 on: August 13, 2013, 12:29:32 am »
I download GCC-2 under Linux here. http://www.sfml-dev.org/download/sfml/2.1/
I'm pretty sure i'm using 2.1. I just re downloaded it and linked it up and everything is the same.

Edit: I went to windows and that is using SFML 2.1(Visual Studio) witch was downloaded at the same page.
« Last Edit: August 13, 2013, 12:53:41 am by nickkorta »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10987
    • View Profile
    • development blog
    • Email
Re: SFML2.1 No Window.PollEvent
« Reply #6 on: August 13, 2013, 03:14:57 am »
I download GCC-2 under Linux here. http://www.sfml-dev.org/download/sfml/2.1/
Just because you download it, it doesn't mean that you're using it. ;)

If you've ever installed SFML from the package manager, which is most likely still version 1.6, then the compiler will probably use SFML 1.6 over the downloaded version. At best you just uninstall SFML 1.6, since it's rather old.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/