Right,
Gobbles I looked at that piece of code and it seems to be working perfectly, however I am still having an issue, basically me resizing the window does the letterbox effect which is what I want so that is great, however I have myself a user interface which sits at the bottom and moves with the player.
Basically I have a function where I pass in a sf::RenderWindow and then I use that to take the view, update the view and draw my user interface, here is my code
void UserInterface::Draw(sf::RenderWindow& window)
{
sf::View windowView = window.getView();
sf::View tempView(sf::FloatRect(0, 0, window.getSize().x, window.getSize().y));
window.setView(tempView);
window.draw(BottomBar);
window.setView(windowView);
}
I have attached a screenshot with my error result, basically I want the red box to be where the blue box is. Once I have that everything will be fine
Any chance I could get some more help,
P.S.
I have updated my code like so
sf::View windowView = window.getView();
sf::View tempView(sf::FloatRect(windowView.getViewport().left, windowView.getViewport().height, windowView.getSize().x, windowView.getSize().y));
window.setView(tempView);
window.draw(BottomBar);
for (int i = 0; i < PowerUpIcons.size(); i++)
{
window.draw(PowerUpIcons.at(i));
}
if (SelectedPower != 0)
{
window.draw(PowerSelected);
}
window.setView(windowView);
The second attachment is the new result, but as you can see the bar fills the whole width, not just the correct ratio as the game does.