Can anyone tell me why my SFML program isnt working?

main.cpp

#include "Game.hpp"
#include <SFML/Graphics.hpp>
#include "Game.cpp"


int main()
{

Game pac;




return EXIT_SUCCESS;
}


Game.cpp

#include "Game.hpp"
#include <SFML/Graphics.hpp>

Game::Game()
// Creation of Render Window with Video Mode
{
m_window(sf::VideoMode(640,480));

}

void Game::run()
{

while(m_window.isOpen())
{

///calling event function
sf::Event event;

while(m_window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
{
m_window.close();
}

}

window.clear();

window.display();

}

}

Game.hpp

#ifndef GAME_HPP_INCLUDED
#define GAME_HPP_INCLUDED
#include <SFML/Graphics.hpp>


class Game
{

public:
Game();
void run();

private:
sf::RenderWindow m_window;
};
#endif // GAME_HPP_INCLUDED


///Please help me out
1
2
3
4
5
int main()
{
  Game pac;
  return EXIT_SUCCESS;
}


So you create an object of type Game, named pac.
Then your program finishes.

if you want some of the functions of the game object to run, you need to call them.
Topic archived. No new replies allowed.