SFML community forums

Help => General => Topic started by: Paki Programmer on January 26, 2012, 11:22:45 pm

Title: Noncopyable Error
Post by: Paki Programmer on January 26, 2012, 11:22:45 pm
Ive looked around on other forums and this one and i think im certain that im trying to copy the sf::RenderWindow window that i made for my game engine...and according to what i've found that's not possible. I suppose i have to make a pointer to the window or a reference but since im still fairly rusty with programming (haven't used C++ for a while) i dont know how to go about doing this. Here are the two parts of my code i think are causing the trouble. Any idea how i can go about creating a reference or pointer to the render window ?


Code: [Select]

sf::RenderWindow System::SetWindow(int width, int height, std::string title)
{
sf::RenderWindow *ref = new sf::RenderWindow();
sf::RenderWindow w(sf::VideoMode(width, height), title.c_str());

ref = &w;

return *ref;
}


Code: [Select]

void System::Init()
{
engine = new System();
window = new sf::RenderWindow();

engine -> window = &engine -> SetWindow(800, 600, "Test");
}


And also here is the error i keep getting:

Title: Noncopyable Error
Post by: Paki Programmer on January 26, 2012, 11:36:59 pm
never mind guys i managed to fix it :)
Title: Noncopyable Error
Post by: TechRogue on January 27, 2012, 04:02:46 am
Can you give an explanation of your fix for future users who might find this topic?