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