1
Window / create a window from another method and returning it?
« on: February 26, 2022, 07:18:25 am »
i basically have a struct in other file that i have included, and inside its a method to
but this doesnt work. the following error pops up in this file:
error C2280: 'sf::RenderWindow::RenderWindow(const sf::RenderWindow &)': attempting to reference a deleted function
in the main.cpp file:
struct sfml {
sf::RenderWindow& init_window() {
globals.window.settings.antialiasingLevel = 8;
sf::RenderWindow window = sf::RenderWindow(sf::VideoMode(sf::VideoMode::getDesktopMode().width, sf::VideoMode::getDesktopMode().height), globals.window.title, sf::Style::None, globals.window.settings);
return window;
}
} sfml;
sf::RenderWindow& init_window() {
globals.window.settings.antialiasingLevel = 8;
sf::RenderWindow window = sf::RenderWindow(sf::VideoMode(sf::VideoMode::getDesktopMode().width, sf::VideoMode::getDesktopMode().height), globals.window.title, sf::Style::None, globals.window.settings);
return window;
}
} sfml;
but this doesnt work. the following error pops up in this file:
error C2280: 'sf::RenderWindow::RenderWindow(const sf::RenderWindow &)': attempting to reference a deleted function
in the main.cpp file:
sf::RenderWindow& window = sfml.init_window();