Hello, I'm having a bit of trouble thinking of a way to pass an sf::RenderWindow object to another class.
In the main I have object "Window"
int main
{
sf::RenderWindow Window(sf::VideoMode(1024,768,32),"Default");
[...]
}
And I want to pass this object to a class "cTest".
I tried it like this:
class cTest
{
sf::RenderWindow& m_Window;
cTest(sf::RenderWindow& Window):m_Window(Window);
};
Final Code:
class cTest
{
sf::RenderWindow& m_Window;
cTest(sf::RenderWindow& Window):m_Window(Window);
};
int main
{
sf::RenderWindow Window(sf::VideoMode(1024,768,32),"Default");
[...]
cTest otest(Window);
[...]
}
I does seem too work but I can't stop shaking the feel that this isn't the correct way to do this. Could someone enlighten me please?
Thanks in advance