Yea, So I initially read in a cfg file to have a default game setup
/* ======== Loading in the board data ======= */
cfgWindowMaker.ReadingCFGFile("boards/configexpert.cfg");
/* ======== Creating the MineSweeper Window for gameplay ======== */
sf::RenderWindow window(sf::VideoMode(cfgWindowMaker.GetWidth(), cfgWindowMaker.GetHeight()), "Minesweeper!", sf::Style::Close);
I than do my event for resize in the event loop
sf::View view = window.getDefaultView();
/* ======== When window is open ..... End of Initializations ======== */
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
if (event.type == sf::Event::Resized) {
// resize my view
// update the view to the new size of the window
sf::FloatRect visibleArea(0, 0, cfgWindowMaker.GetWidth(), cfgWindowMaker.GetHeight());
window.setView(sf::View(visibleArea));
sf::RenderWindow window(sf::VideoMode(cfgWindowMaker.GetWidth(), cfgWindowMaker.GetHeight()), "Minesweeper!", sf::Style::Close);
}
and if I left click on beginner button it would load a smaller dimension of the board (including resizing the window)
if (test1Btn.contains(mousePosFloat))
{
boardObject.ResetGame(cfgWindowMaker);
cfgWindowMaker.ReadingCFGFile("boards/configbeginner.cfg");
boardObject.RandomBombMaker(cfgWindowMaker, window);
sf::FloatRect visibleArea(0, 0, cfgWindowMaker.GetWidth(), cfgWindowMaker.GetHeight());
}
if (test2Btn.contains(mousePosFloat))
{
cout << "Test 2" << endl;
boardObject.ResetGame(cfgWindowMaker);
cfgWindowMaker.ReadingCFGFile("boards/configintermediate.cfg");
boardObject.RandomBombMaker(cfgWindowMaker, window);
window.setView(view);
}
As you can see I tried resizing the event two ways (with floatRect and with setView) where both outputs show the result of the image I posted in the above reply
Thank you for the help!