I am trying to make a class ("render") that will handle all drawing within my program, so that if I had a sprite I wanted to draw I would send it to a function such as:
void draw(sf::Sprite);
Now so far it is working but I have run into trouble whether or not to declare the main RenderWindow in this class, e.g:
private:
sf::RenderWindow window(sf::VideoMode(800, 800), "A Game That Loves You!");
With this I would only be able to access it within this class but also make an accessory function to access it outside. Now here is my issue:
I have a couple of errors, one of them has this error message:
..\..\..\Assets\SFML-2.1\include\SFML\System\NonCopyable.hpp|67|error: 'sf::NonCopyable::NonCopyable(const sf::NonCopyable&)' is private|
and the other error is:
F:\Programming\C++ SFML\SFML Development\render.cpp|16|note: synthesized method 'sf::RenderWindow::RenderWindow(const sf::RenderWindow&)' first required here |
This is the overall code I have at the moment:
render.h:
#ifndef RENDER_H
#define RENDER_H
#include <SFML/Graphics.hpp>
class render
{
public:
render();
void draw(sf::Sprite);
sf::RenderWindow getWindow();
protected:
private:
sf::RenderWindow window;
};
#endif // RENDER_H
render.cpp:
#include "render.h"
#include <SFML/Graphics.hpp>
#include <iostream>
render::render()
{
sf::RenderWindow window(sf::VideoMode(800, 800), "A Game That Loves You!");
}
void render::draw(sf::Sprite sprite)
{
//empty!
}
sf::RenderWindow render::getWindow()
{
return window;
}
If anyone could explain or give a solution to these errors I would be very grateful, thanks. (: