Jesper, yes in my original post I described that my current solution is to use a RenderTexture. Visually it's perfect but I was concerned about the performance hit, I think it's not a big issue now
DarkRoku I have experimented with zooming but I wasn't able to find a solution that solves my issue
Thank you for your help I really appreciate it!
If anyone is curious I thought I would share my very small basic example to illustrate my problem. Hit Q to switch between window only and rendertexture. If anyone if bored enough to check it out I'm always open for feedback. Thanks everyone!
//in main.cpp
#include <SFML/Graphics.hpp>
//program entry point and loops
int main(int argc, char* args[]){
//view setup
sf::Vector2f native_res={800,600};
sf::View view;
view.setSize(native_res);
view.setCenter(native_res.x/2,native_res.y/2);
//window setup
sf::Vector2f user_res={640,480};
sf::RenderWindow window(sf::VideoMode(user_res.x, user_res.y),"View testing",sf::Style::Titlebar|sf::Style::Close);
//apply view with zoom here??
//float zoom=native_res.x/user_res.x; //assumes matching ratios
//view.zoom(zoom);
//apply view
window.setView(view);
//textures
sf::Texture walltex;
sf::Texture backingtex;
walltex.loadFromFile("wall.png");
backingtex.loadFromFile("backing.png");
walltex.setSmooth(true);
backingtex.setSmooth(true);
//sprites
sf::Sprite backing(backingtex);
sf::Sprite wall1(walltex);
sf::Sprite wall2(walltex);
wall1.setPosition(100,100);
wall2.setPosition(132,116);
//off-screen canvas via rendertexture
sf::RenderTexture canvas;
canvas.create(native_res.x,native_res.y);
canvas.setSmooth(true);
sf::Sprite canvas_sprite(canvas.getTexture());
//loop
bool drawcanvas=true;
while(window.isOpen()){
//sole event check for closing window
sf::Event event;
while(window.pollEvent(event)){
if(event.type==sf::Event::Closed){
window.close();
}
if(event.type==sf::Event::KeyPressed){
if(event.key.code==sf::Keyboard::Q){
drawcanvas=!drawcanvas;
}
}
}
if(drawcanvas==true){
//WINDOW ONLY DRAWS
window.clear(sf::Color::Black);
window.draw(backing);
window.draw(wall1);
window.draw(wall2);
window.display();
} else {
canvas.clear(sf::Color::Black);
canvas.draw(backing);
canvas.draw(wall1);
canvas.draw(wall2);
canvas.display();
window.clear(sf::Color::Black);
window.draw(canvas_sprite);
window.display();
}
}
return 0;
}