It still isn't working for me for some reason. Window works fine for me if I don't try to imbed it into my Game class, however, when I do it this way I get an error saying NonCopyable. Here is my code for my main file and my header files, and below them is the error.
main.cpp
#include "Game.h"
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::VideoMode VMode(600, 390, 32);
sf::RenderWindow window;
window.Create(VMode, "Yellow Snake", sf::Style::Close);
Game game(window);
game.Run();
return 0;
}
Game.h
#ifndef GAME_H
#define GAME_H
#include <SFML/Graphics.hpp>
#include <iostream>
class Game
{
public:
Game(sf::RenderWindow& window);
sf::RenderWindow Window;
void Run();
protected:
private:
};
#endif // GAME_H
Game.cpp
#include "Game.h"
#include <SFML/Graphics.hpp>
#include <iostream>
Game::Game(sf::RenderWindow& window):
Window(window)
{
}
void Game::Run()
{
window.Display();
}
Error:
c:\mingw\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\SFML\System\NonCopyable.hpp|57|error: 'sf::NonCopyable::NonCopyable(const sf::NonCopyable&)' is private|
c:\mingw\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\SFML\Window\Window.hpp|55|error: within this context|
c:\mingw\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\SFML\System\NonCopyable.hpp|57|error: 'sf::NonCopyable::NonCopyable(const sf::NonCopyable&)' is private|
c:\mingw\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\SFML\Window\Input.hpp|44|error: within this context|
c:\mingw\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\SFML\Window\Window.hpp|55|note: synthesized method 'sf::Input::Input(const sf::Input&)' first required here |
c:\mingw\bin\..\lib\gcc\mingw32\4.6.1\..\..\..\..\include\SFML\Graphics\RenderWindow.hpp|45|note: synthesized method 'sf::Window::Window(const sf::Window&)' first required here |
s Files\CPP\Dev\Yellow_Snake2\Game.cpp||In constructor 'Game::Game(sf::RenderWindow&)':|
s Files\CPP\Dev\Yellow_Snake2\Game.cpp|6|note: synthesized method 'sf::RenderWindow::RenderWindow(const sf::RenderWindow&)' first required here |
s Files\CPP\Dev\Yellow_Snake2\Game.cpp||In member function 'void Game::Run()':|
s Files\CPP\Dev\Yellow_Snake2\Game.cpp|12|error: 'window' was not declared in this scope|
s Files\CPP\Dev\Yellow_Snake2\Game.cpp|13|error: expected ';' before '}' token|
||=== Build finished: 9 errors, 0 warnings ===|
Any advice here?