I am trying to put my window in a struct, I made this file as a test as my other file was huge, the program compiles but the window never appears, what's going wrong?
#include <iostream>
#include <SFML/Graphics.hpp>
using namespace std;
struct Str
{
Str(sf::RenderWindow& window, sf::VideoMode& vidM);
sf::RenderWindow& window;
sf::VideoMode& vidM;
};
Str::Str(sf::RenderWindow& window, sf::VideoMode& vidM): window(window), vidM(vidM)
{
}
void MAIN(Str &str);
int main()
{
sf::RenderWindow win;
sf::VideoMode vMode;
Str str(win, vMode);
MAIN(str);
}
void MAIN(Str &str)
{
str.window;
str.vidM.height = 800;
str.vidM.width = 600;
str.window.setTitle("Window");
while(str.window.isOpen())
{
str.window.clear();
sf::Event event;
while(str.window.pollEvent(event))
{
switch(event.type)
{
case sf::Event::Closed:
{
str.window.close();
}
}
}
str.window.display();
}
}