Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Enyss

Pages: [1]
1
Oh thanks... I missed this -_-'

2
This is a minimal code that show the error:

#include <SFML\Graphics.hpp>

class RenderManager
{
public:
        RenderManager();
        static RenderManager & rm();

        sf::RenderWindow & getWindow();
private:
        sf::RenderWindow window;
};

RenderManager::RenderManager()
{
        window.create(sf::VideoMode(800, 600), "Realms of Dream");
}

RenderManager & RenderManager::rm()
{
        static RenderManager rm;
        return rm;
}

sf::RenderWindow & RenderManager::getWindow()
{
        return window;
}

int main()
{
        sf::RenderWindow window = RenderManager::rm().getWindow();
        return 0;
}
 

3
In fact, I return a reference (I made a copy mistake in the code I pasted here), so it should works no?

4
Hello,

 I have a strange error when I try to return a RenderWindow reference from a singleton class:

 Error C2280 'sf::RenderWindow::RenderWindow(const sf::RenderWindow &)': attempting to reference a deleted function.

Minimal code :

#include <SFML\Graphics.hpp>

class RenderManager
{
public:
        RenderManager();
        static RenderManager & rm();

        sf::RenderWindow & getWindow();
private:
        sf::RenderWindow window;
};

RenderManager::RenderManager()
{
        window.create(sf::VideoMode(800, 600), "Realms of Dream");
        tileSet.loadFromFile("gfx/tileset.png");
}

RenderManager & RenderManager::rm()
{
        static RenderManager rm;
        return rm;
}

sf::RenderWindow & RenderManager::getWindow()
{
        return window;
}

Thanks.

Pages: [1]